ARexx (32/77)

From:Joseph Duchâtelet
Date:15 Apr 2001 at 20:22:08
Subject:Re: Invalid Symbol ?

Hello Me

On 13-Apr-01, you wrote:

> Hello Joseph
>
> On 12-Abr-01, you wrote:
>
>> Hello Andreas
>>
>> On 11-Apr-01, you wrote:
>>
>>> Hi,
>>>
>>> I just came across something I do not understand:
>>>

>>> msg.34 = 'eGroups-EW/0.82'

>>>
>>> IF msg.34 = "MSG.34" THEN
>>> This fails with Err:8 Unrecognized Token
>> This works OK here
>>> IF Value(msg.34) = "MSG.34" THEN
>>> This fails with "Symbol Expected"
>> Here too
>> Works however with msg34 as a variable
>> say Value(msg.34) has the same error message
>> I guess value does not like compound variables.
>> say Value('msg.34') works though :)
>
>
> Yes, value('msg.34') works fine, and so does say msg.34, from an ARexx
> shell.
>
> It has nothing to do with compound variables, though: if you use
>> msg = 'eGroups-EW/0.82'82'
> and then type
> say msg ---> eGroups-EW/0.82
> say value(msg) ---> +++ Syntax Error: Symbol expected
> say value('msg') --> eGroups-EW/0.82
>
> and if you use (no arithmetical operations signs)
>> msg.34 = 'eGroups_EW[0.82'
>> say msg.34 ---> eGroups_EW[0.82
>> say value(msg.34) - --> eGroups_EW[0.82
>
> but if (* sign) :
>> msg.34 = 'eGroups_EW*0.82'
>> say msg.34 ---> eGroups_EW*0.82
>> say value(msg.34) ---> +++ Syntax Error: Symbol expected
>> say value('msg.34') ---> eGroups_EW*0.82
>
> So, I think it's a combination of quoting and value() trying to
> evaluate the expression. If the expression is quoted, then ARexx knows
> it hasn't to "calculate" it.
>
> If the expression is writen in a script, and not on the shell, more
> quotes could be needed, like value('''msg.34''').
> Darn ARexx quoting :)

I tested the following script
/* */
msg.34 = "Hello"
msg34 = "GetLost"
say msg.34
say msg34
say Value(msg.34)
say Value('msg.34')
say Value(msg34)
say Value('msg34')

and got the results
Hello
GetLost
HELLO
Hello
GETLOST
GetLost

So you are right : it has nothing to do with compound variables.
You can conclude from this that Value() does not treat msg.34 nor msg34 as
an
initialized variable. In fact the main objective of Value() as stated in
'Using Arexx on the Amiga' (Zamara & ullivan)
"VALUE evaluates its single argument, then treats the resulting string as an
Arexx symbol (numeric constant or variable name)...
Usually though, the argument string evaluates to a variable name, and it is
the value of that variable that is returned.."

There is no special need for an evaluation function for either a normal
variable nor for a compound variable whose name can be written down in the
program (just use it as in say msg.34).
Value() wants that you give it some 'real' work to do
(translating a quoted string into a (compound)variable name)

My previous reply was based on a script too (where i used the 'litigious'
affectation
>> msg.34 = 'eGroups-EW/0.82'
I used a single pair of quotes with the Value('msg.34') in this case too.

Conclusion; the quotes are needed, also, in a script but one pair is enough

2d Conclusion: we better avoid to use Value() in those trivial cases.

All the best

Joseph

------------------------ Yahoo! Groups Sponsor ---------------------~-~>
Secure your servers with 128-bit SSL encryption!
Grab your copy of VeriSign's FREE Guide,
"Securing Your Web site for Business." Get it now!
http://us.click.yahoo.com/KVNB7A/e.WCAA/bT0EAA/stAVlB/TM
---------------------------------------------------------------------_->

ARexx mailing list - No flames, no overquoting, no crossposting.
Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/