Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[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? :+
== 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.