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

[REBOL] Re: Defining new infix operators ?

From: gjones05:mail:orion at: 20-Apr-2001 17:38

From: <[geza67--freestart--hu]>
> Hello, REBOLers ! > > Just for a bit of "syntactic sugar" :-) : > Is it possible to define new infix operators ? > I tried : > > >> ||: make op! ... etc. > ** Script Error: Cannot use make on datatype! value > > It would be a very nice feature ( la Prolog, or C++) to define (or > "overload") some operators. > > Cheers: > Geza Lakner MD
Interesting idea. In fact, I've been pondering the chicken and egg argument about REBOL in terms of whether the operators are natively prefix or infix. My guess is that they are defined as prefix, like most of REBOL, and then REBOL uses a dialect in essence in evaluating expressions as infix. It is "easy" to define new operators as prefix. For example: ||: :or || 1 2 ; yields 3 I know that this is not quite the syntactic sugar that you're looking for, but it demonstrates REBOL's flexibility, nonetheless. Maybe if it's not "top secret", or something, RT can put my mind to rest over whether the infix notation is just a type of dialect. I.m really curious about this one. --Scott Jones