5 ms·
This sounds cool: "Every active component in Rye is a function (if, loop, for, fn, return, extends, context). No keywords, no special forms." It should make t
by galaxyLogic 2y ago
This sounds cool:
"Every active component in Rye is a function (if, loop, for, fn, return, extends, context). No keywords, no special forms."
It should make the language much simpler than other languages.
The challenge of programming is dealing with copmplexity in code, and if the language takes away much of that complexity it should be a good thing.
- middayc 2y agoThanks, that comes from it's REBOL base ideas, but maybe it's even more pronounced in Rye where also operators are just "op-word" functions, and any function can be op-word/pipe-word (also the ones above if loop for ...).
- galaxyLogic 2y agoNot having studied Rye documentation, is it true that Rye syntax is "minimal"? Compared to for instance Smalltalk?
- middayc 2y agoYes ... Rye is syntax-wise in similar camp than Lisps, only without parenthesis. Some say Lisp has no syntax (which is debatable), but has a point that there are no syntax rules. There are multiple token types and they always combine / apply in the same ways, there are no special forms like "how to define a function" or "how to write and if else". In Rye calling if or eihter (if/else) is no different than calling any other function.
- galaxyLogic 2y agoNote in Smalltalk ifTrue:ifFalse: is similarly just a method/function of the class Boolean. Rye seems very promising.
- middayc 2y agoThanks! Out of many languages I tried, I have to admit I never really worked with smalltalk. I should one day!
- lispm 2y ago> There are multiple token types and they always combine / apply in the same ways, there are no special forms like "how to define a function" or "how to write and if else". In Rye calling if or eihter (if/else) is no different than calling any other function. Not in Lisp. In Lisp IF, COND, ... are either special operators or macros which expand to more primitive special operators. They are not functions. The syntax for COND is: cond {clause}* => result* clause::= (test-form form*) For example: (cond ((> x 1) (print 'larger) 1) ((= x 1) (print 'equal) 1) (t (print 'smaller))) COND is not a function. It is a macro. In a function call all arguments would be evaluated. But COND does not work that way. COND has a list of clauses. During evaluation, the first clause is looked at. It's first subform then is evaluated, here (> x 1). If that is true, then the following subforms are evaluated left to right and the values of the last form is returned. If the first subform form was not evaluated to true, the evaluation goes to the next form and repeats the process on the subform. * COND is not a function * COND has a special syntax * COND has a special evaluation rule The same is the case for defining functions. In Lisp the operator to define a global function is called DEFUN. DEFUN is a macro, not a function. It has special syntax (for example the second element in a DEFUN form needs to be an unevaluated function name, which usually (I omit some detail) needs to be a symbol (which will not be evaluated)... Again, DEFUN is not a function, it has special syntax and special semantics with side effects during compilation.
- middayc 2y agoYes, you are correct. I wasn't exact e nough about it, the end result syntax wise is similar, but there are macros involved in Lisps case. I wrote multiple times right about this difference between Rebol-s and Lisp-s. The main difference being that Lisps evaluate lists by default and you have to quote them to not be evaluated and Rebols don't evaluate blocks by default and you have to "do" them to evaluate them. That's why Rebol's can have if/loop/fn as ordinary functions and Lisps use Macros for them. If in rebol would be more like (if (> x 1) '(print 'larger)) I think. Thanks for making this clear ... it was a nice read.
- _19qg 2y ago> Lisps use Macros IF is a built-in special operator in Common Lisp. COND is a macro, which expands into IF forms. > (if (> x 1) '(print 'larger)) Stuff like this would not really work Common Lisp for the following code example: (let ((x 1)) (if (> x 1) '(print x))) The evaluator would not know that the X in the print form refers to the lexically bound X from the LET form.
- timbit42 2y agoCarl Sassenrath, the creator of the Amiga OS, created REBOL after he did Amiga Logo. Logo is what REBOL's syntax was based on. Logo is often called, 'Lisp without parentheses'.
- deleted 2y ago[deleted]
- IshKebab 2y agoThat's a reasonably common feature in hobby languages, at least for basic flow control. I've seen it a few times before. You could say TCL works like this too in the most horrible way possible.
- bsder 2y agoApparently it's called "either" and it doesn't evaluate every arm. So, explain to me how that is a function and not a special form?
- RodgerTheGreat 2y agoREBOL-family languages (including Logo) don't eagerly evaluate expressions like a Lisp, and therefore can use ordinary functions/operators in places that would otherwise need to be special forms and/or macros.
- middayc 2y agoExactly ... I tried to explain this here: https://ryelang.org/meet_rye/basics/if_either/ https://ryelang.org/meet_rye/basics/if_either/
- bsder 2y agoSo, you're passing around textual source code chunks? How do you force evaluation? I don't find this impossible. I have seen this in John Shutt's Kernel, for example. https://ftp.cs.wpi.edu/pub/techreports/pdf/05-07.pdf https://ftp.cs.wpi.edu/pub/techreports/pdf/05-07.pdf But I'm just not seeing the mechanisms I expect for such a language.
- RodgerTheGreat 2y agoNot strings; token lists. You can evaluate lists with `do`, or through functions which in turn use `do` on their arguments.
- cout 2y agoThis is a very good thing! Too many languages introduce keywords out of convenience, but in the end that makes the grammar more complex.