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

[REBOL] Re: x: :y question

From: joel:neely:fedex at: 3-Feb-2003 8:17

Hi, Bolek, ... or a funny little wrinkle in REBOL syntax. Boleslav Brezovsky wrote:
> Hi, > > is this bug or I do not understand something? > > >> a: :+ > >> 1 a 2 > ** Script Error: a expected value2 argument of type: number pair char > money date time tuple > ** Near: a 2 >
Apparently REBOL figures out "early" (? perhaps at lexical scan ?) that (1 + 2) is equivalent to (1 + 2) for predefined words such as '+ and therefore does not make that same inference for other words simply set to the same internal (op!) value.
>> (+ 1 2)
== 3
>> a: :+ >> type? :a
== op!
>> (a 1 2)
== 3
>> (1 + 2)
== 3
>> (1 a 3)
** Script Error: a expected value2 argument of type: number pair char money date time tuple ** Near: a 3 However, ALIAS seems to allow a way to "tunnel" around that issue:
>> alias '+ "und"
== und
>> 1 und 2
== 3 As to whether this is a "bug" or not, I don't know whether RT had intended this inconsistency. -jn-