• 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. SKILL++ class slots

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 13390
  • 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

SKILL++ class slots

acook
acook over 11 years ago

I have a few question on slots in a class. Given the following class that implements string utilities:

defclass( String()

 ()

(

(str @initarg nil) ; The string

(len @initarg nil); The length of the string 

)

)

defmethod( Length ((s String))

s->len = strlen(str)

) 

 

Is there a way to trigger Length() whenever the slot "str" is updated? I know I could make another method like "SetStr" but that is a little messy, I also have to remember to always use that method and not set str directly.

Thank you,

Aaron 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Aaron,

    No, SKILL++ (like CLOS) doesn't work that way. The C++ like syntax might make it look as if it does, but it doesn't. It's not a flaw in the language, it's just different from C++.  You can create a writer method, using @writer, but in this case you want some specific behaviour.

    Given that when you do obj->str="whatever", it's really doing (putpropq obj "whatever" str), there's not really any difference with writing SetStr(obj "whatever"). It's not "messy" - it's just the way it's done in the language - you use procedural abstraction.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Aaron,

    No, SKILL++ (like CLOS) doesn't work that way. The C++ like syntax might make it look as if it does, but it doesn't. It's not a flaw in the language, it's just different from C++.  You can create a writer method, using @writer, but in this case you want some specific behaviour.

    Given that when you do obj->str="whatever", it's really doing (putpropq obj "whatever" str), there's not really any difference with writing SetStr(obj "whatever"). It's not "messy" - it's just the way it's done in the language - you use procedural abstraction.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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