• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. list all methods for specific instance of a class/ instance...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 14520
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

list all methods for specific instance of a class/ instance of a class

LDIL
LDIL over 5 years ago

Hello all.

In Ruby and Python 3, it is possible for an instance of class/a class, find all methods which are callable by it.

See link for example: ruby-doc.org/.../Object.html

In SKILL++, because it is a functional language, I would be looking for all methods which first argument can be the class that I am referring to.

So, for example, fixnum would yield (among others) plus, but would not yield println, and vice versa for string.

How can this be achievable in SKILL++?

Thanks.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago

    The simple answer is, not really. That's not to say it's impossible - but the main issue is that because methods don't belong to a class (as they do with Python, and Ruby (I think - I don't really have practical Ruby experience though)), it's a little harder to do this level of introspection.

    You could potentially find all symbols, find which are generic functions using isGeneric, then use getMethodSpecializers to find out which specialiser arguments are available (it could be on any of the arguments, not just the first) but you'd have to also deal with the fact that your object might be a superClass of the specialiser on the generic function (superclassesOf could find this). So I'm sure with a bit of thought and care to iron out the wrinkles, it could be done. However, my question would be why? Why would you want this?

    BTW, this wouldn't help with finding plus for fixnum, because plus is not a generic function - it's a simple function that happens to cope with fixnum and flonum, but that's not on an OO basis. BTW, println can be passed any object - but again, it's not a generic function - it just prints the result of printself for an object, or the built-in print representation for built-in types.  So this is not going to help you, because there's nothing to tie the arguments of these simple functions to the classes or types for which they can be called with - the downside of a loosely typed language.

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • LDIL
    LDIL over 5 years ago in reply to Andrew Beckett

    Hi Andrew. Once you have gone to Ruby, most code writers don't want to go back (I am one of them, and you can also ask Myles Prather from Cadence Texas), and you got that right about Ruby. I have an OCEAN command which analyzes parameters of certain cells. The methods are added as the project processes. One way is to have a slot with the methods' names, and add them, which is what I do now (inelegant, but fast). The methods have a naming convention, which I could use (I am using them anyway, in any language). The other way is to search, like you stated, and get the methods with a naming convention, which should be easy, as these methods' names always begin with the class name. So, I guess that that is what I'll do. The superclass is of no relevance, for the purpose of this exercise. I'll use the get generics of the symbols, and then, with setof, apply a regexp for the naming convention. For my current needs, this is enough. Except for one thing: How do I find all the symbols defined (the list to filter through)? Thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to LDIL

    allGenericFunctions=setof(sym oblist boundp('sym) && isGeneric(sym))

    The boundp is there because oblist (which is a list of all defined symbols) contains unbound and so when sym gets assigned unbound it would break otherwise.

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • LDIL
    LDIL over 4 years ago in reply to Andrew Beckett

    Well, now I have all the the building blocks. Thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information