Re: SKILL Q: Coaxing a Symbol to Give Up Its Value Without UsingEVAL?
by Andrew Beckett <andrewb@[EMAIL PROTECTED]
>
Apr 30, 2008 at 11:01 AM
S. Badel wrote, on 04/17/08 00:05:
>> Anyone who has glanced at the Cadence SKILL do***entation knows the
>> use of eval() is a no-no. But there are situations in which one binds
>> a value to a symbol and then p***** the QUOTED symbol around before
>> finally needing the actual value associated with the symbol. What
>> other ways can one get at a symbol's value besides using eval()?
>
> symeval() does precisely this. But I don't think the end result is any
> different from using eval().
>
> I do not see any problems with eval() myself, though.
>
> Cheers,
> Stéphane
It's preferrable to avoid eval() because:
a) it means you're doing run-time evaluation - this means you're not
taking
advantage of the byte-code compilation which will improve speed
b) you need to be particularly careful when using SKILL++ code because
of it needing to understand the scope you're in.
symeval() to some extent is similar, but it's really just looking up a
symbol value, so that's not so costly.
However, often you'd be better off using a macro.
See my previous posting http://tinyurl.com/5wx3y7
Andrew.