Aha, you stumbled upon the "weird" behaviour of
rebol's OP! datatypes.

>> type? :+
== op!

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

becomes (internally)

        + 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
"boat" 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

or

        2 + length? "boat"

being conscious that in tight loops parens slow things down a tiny bit.

Anton.

> I'm kinda new to REBOL. Actually I was a member of this list about two
> years ago and I was registered with my Yahoo! account. I felt like
> that I'm really missing REBOL so I've joined the list once again :-)
> 
> In the online manual at
> http://www.rebol.com/docs/core23/rebolcore-3.html it's written that:
> 
> "The values and words of a block are always evaluated from first 
> to last...=
> "
> 
> So I expected the following statement, without the parantheses of
> course, return 6 but it is erroneous:
> 
> length? "boat" + 2
> 
> Can someone please explain the reason behind this behaviour?
> 
> Thanks in advance,
> --=20
> Behrang Saeedzadeh


-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to