[REBOL] Re: The evaluation semantics
From: antonr:lexicon at: 30-Aug-2005 18:02
Aha, you stumbled upon the "weird" behaviour of
rebol's OP! datatypes.
>> type? :+
Yes, the infix operators (+ - * /) behave a bit differently
than other "normal" rebol functions and actions.
The explanation I remember is that an expression such as:
arg1 + arg2
+ arg1 arg2
so that it is then like any other rebol function.
In your example, the + would have jumped just in
front of the string, and then took two arguments
and 2, and tried to add them together.
You can rewrite it like this:
+ length? "boat" 2
But what we usually end up writing is:
(length? "boat") + 2
2 + length? "boat"
being conscious that in tight loops parens slow things down a tiny bit.