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

[REBOL] if and parens

From: laurent:giroud:libertysurf at: 5-Oct-2002 23:30

Hi everyone again, I have a little "problem" that I encounter quite frequently with 'if : in certain cases I need to use parens to make sure that the expression tested is correctly evaluated. While I understand that in some cases parens may be necessary to avoid ambiguities, in the following example I fail to see why they are needed : this simply prints the list of files in the current folder and works quite fine :
>> foreach elt read %. [if (get in info? to-file elt 'type) = 'file [print elt]]
... but when removing the parens we get :
>> foreach elt read %. [if get in info? to-file elt 'type = 'file [print elt]]
** Script Error: in expected word argument of type: word ** Where: halt-view ** Near: if get in info? to-file The code looks quite unambiguous to me since all the part beetween the 'if and the "=" character evaluates without problem if isolated :
>> elt: %afile ; "afile" being an existing file >> get in info? to-file elt 'type
== file Would anyone have an explanation ? Regards, Laurent -- Laurent Giroud