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
mailto:[EMAIL PROTECTED]

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to