Linked by Kaj-de-Vos on Thu 20th Dec 2012 00:22 UTC
Syllable, AtheOS As the Syllable project predicted many years ago, version 3 of the REBOL programming language has finally been open sourced, under the Apache 2 licence (screenshot on Syllable Desktop). Also, the alpha version of the high-level Red programming language, supporting Syllable Desktop, has been released, by now in version 0.3.1 (screenshot, demo program, video at the Science Park in Amsterdam).
Thread beginning with comment 545951
To view parent comment, click here.
To read all comments associated with this story, please click here.
REBOL
by Kaj-de-Vos on Thu 20th Dec 2012 12:04 UTC in reply to "REBOL"
Kaj-de-Vos
Member since:
2010-06-09

My "The C Programming Language, Second Edition" falls open at page 53, where the precedence table of operators is. When I program in C, I often need to refer to it, because it's too complex to remember. Much C code acknowledges that by not even relying on precedence, but littering expressions with parentheses to make them unambiguous.

This problem doesn't exist in REBOL and Red, because they have only two simple precedence rules:

- Operators evaluate from left to right.
- Infix operators take precedence over prefix functions.

If you want * to take precedence over +, you can simply write

1 + (2 * 3)

However, as a REBOL programmer you quickly get used to writing it as

2 * 3 + 1

Reply Parent Score: 3

REBOL
by andrewclunn on Thu 20th Dec 2012 13:20 in reply to "REBOL"
andrewclunn Member since:
2012-11-05

That's either genius or the dumbest thing I've ever seen.

Edited 2012-12-20 13:20 UTC

Reply Parent Score: 3

REBOL
by henrikmk on Thu 20th Dec 2012 13:32 in reply to "REBOL"
henrikmk Member since:
2005-07-10

You just gotta get used to it, that's all. It's simpler for the interpreter to handle.

Reply Parent Score: 2

REBOL
by Kaj-de-Vos on Thu 20th Dec 2012 13:58 in reply to "REBOL"
Kaj-de-Vos Member since:
2010-06-09

It's a pattern that people can't see the difference. :-) Otherwise, it wouldn't be outstanding.

Reply Parent Score: 1

REBOL
by satsujinka on Fri 21st Dec 2012 00:37 in reply to "REBOL"
satsujinka Member since:
2010-03-11

I understand why you'd do that, but... I'd have the reverse problem. I'd have to constantly be rearranging any REBOL code I wrote because I would have written it expecting precedence (which comes naturally to me because I have a strong background in math.)

Reply Parent Score: 2

REBOL
by Kaj-de-Vos on Fri 21st Dec 2012 00:57 in reply to "REBOL"
Kaj-de-Vos Member since:
2010-06-09

No, you can just add parentheses, as I showed.

Reply Parent Score: 1

REBOL
by renox on Fri 21st Dec 2012 10:30 in reply to "REBOL"
renox Member since:
2005-07-06

So your justification that Rebol has a strange behaviour because C has also a strange (different) behaviour??

Both are wrong IMHO: the best behaviour is: associativity as in math for + - * / and for all the other operators Rebol behaviour.

Reply Parent Score: 3

REBOL
by Kaj-de-Vos on Fri 21st Dec 2012 13:41 in reply to "REBOL"
Kaj-de-Vos Member since:
2010-06-09

That's an interesting idea, which would indeed fit best with common people's experience. The nice thing about REBOL is that it's a meta language: you have control over how the language is evaluated. REBOL makes it easy to write an expression evaluator that would use the rules you stated. I would indeed implement such an evaluator if I would allow users to enter their own expressions, for example in a calculator application.

Reply Parent Score: 1

REBOL
by RobG on Fri 21st Dec 2012 14:27 in reply to "REBOL"
RobG Member since:
2012-10-17

I absolutely disagree. There are 2 choices to my mind:

1. Use standard precedences for arithmetic, comparison and logic operators as defined in common mathematical usage.

2. Have everything use standard precedences.

C's implementation is actually flawed - Ritchie himself acknowledges so (http://cm.bell-labs.com/cm/cs/who/dmr/chist.html), so blindly copying that seems the wrong approach.

Reply Parent Score: 2

REBOL
by jockm on Tue 25th Dec 2012 15:47 in reply to "REBOL"
jockm Member since:
2012-12-22

When I program in C, I often need to refer to it, because it's too complex to remember


So you never learned any of the mnemonics for operator precedence? Or indeed had to learn in in school, or where it is still very much needed in real life?

If you start with the assumption that unary operators come first, and comparison and logical operators come at the end, then the old saw of My Dear Aunt Sally (multiplication, division, addition, subtraction) holds.

Much C code acknowledges that by not even relying on precedence, but littering expressions with parentheses to make them unambiguous


Or like how people do with real math, or have to do in REBOL to make sure the intent is clear?

I am not impresses with this argument. I have met many die hard proponents of Smalltalk, APL, Lisp, and Forth — and with the exception of Forth — none of them have actually claimed that the precedence in their language was somehow better. Instead they would say something like "well the operator precedence is a bit funky, but that is a consequence of how the language works, you will get used to it"

I will end as a general thought: It's ok to admit the flaws of something you love. It isn't somehow admitting defeat. Nothing that is useable in the real world is perfect. Nor in promoting your thing, do you need to talk down something else.

Reply Parent Score: 1

REBOL
by Kaj-de-Vos on Tue 25th Dec 2012 16:02 in reply to "REBOL"
Kaj-de-Vos Member since:
2010-06-09

There are many flaws in REBOL, but this is not one of them. We're fixing many of the other flaws in Red, but we're pleased with the default expression precedence as it is.

As I noted before, REBOL makes it easy to implement your own expression evaluator with different precedence when you want.

Reply Parent Score: 1