SKILL Q: Coaxing a Symbol to Give Up Its Value Without Using EVAL?

Discussion in 'Cadence' started by Edward, Apr 16, 2008.

  1. Edward

    Edward Guest

    Anyone who has glanced at the Cadence SKILL documentation knows the
    use of eval() is a no-no. But there are situations in which one binds
    a value to a symbol and then passes 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()?
     
    Edward, Apr 16, 2008
    #1
  2. Edward

    S. Badel Guest

    Anyone who has glanced at the Cadence SKILL documentation knows the
    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
     
    S. Badel, Apr 17, 2008
    #2
  3. S. Badel wrote, on 04/17/08 00:05:
    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.
     
    Andrew Beckett, Apr 30, 2008
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.