• 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. Scheme vs Common Lisp style in SKILL++

Stats

  • Locked Locked
  • Replies 18
  • Subscribers 144
  • Views 22573
  • 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

Scheme vs Common Lisp style in SKILL++

tweeks
tweeks over 11 years ago

 While you can write your SKILL++ code like it is C, Maclisp, Scheme, or Common Lisp (or none of the above...), I've been experimenting with Common Lisp style lately.

Trying to write Common Lisp style code in SKILL++ can lead to curious situations like this:

(defvar first car)

The intention is to define FIRST as another name for CAR, as in Common Lisp.  In Scheme, we would write

(define first car)

which seems pretty natural, but using DEFVAR to define a function just feels.... wrong... somehow... :)

I guess I should use ALIAS:

 (alias second cadr)

 except ALIAS has weird limitations:

ILS-> (foo = first)
primop:car
ILS-> (foo '(1 2 3))
1
ILS-> (foo = second)
macro:evalalias
ILS-> (foo '(1 2 3))
*Error* evalalias: unknown alias - foo

  • Cancel
Parents
  • tweeks
    tweeks over 10 years ago

    What's great about SKILL/SKILL++ is that there's so many ways to do things.

    What's annoying about SKILL/SKILL++ is that there's so many ways to do things.

    Define a procedure:

    (def square (lambda (x) (times x x)))
    (defun square (x) (times x x))
    (procedure square(x) (times x x))
    (define (square x) (times x x))
    (define square (lambda (x) (times x x)))
    (defvar square (lambda (x) (times x x)))
    (setq square (lambda (x) (times x x)))
    

    Define a global value:

    (define zero 0)
    (defvar zero 0)
    (setq zero 0)
    

    On the one hand, do we really need three semantically-identical ways to define a global variable, and seven to define a procedure?

    On the other hand, why not provide multiple redundant syntaxes if it helps make programmers from other languages feel more at home?

    On the third hand, SKILL is not Scheme or Common Lisp, so define, defun, and defvar only superficially resemble their namesakes: they are really very different animals. A Scheme programmer may feel at home with SKILL++'s define for a few minutes, but then be surprised later on by the differences. Likewise, a Common Lisp programmer will soon find that defun and defvar behave quite differently from CL. So in the short-run, the syntactic borrowing makes the language friendlier, but in the long-run these borrowings are "false-friends": familiar-looking words in a foreign language that actually mean quite different things from what you would expect.

    The differences are myriad: plus and append require two or more arugments; strings are immutable; improper and circular lists do not exist; the cdr of a cons must be a list; nil is not a symbol; environments are first-class; all free variable references are evaluated dynamically or lexically within a given block of code, depending on whether it's SKILL-mode or Scheme-mode; arithmetic with integers is inexact; rationals do not exist (but complex numbers are available in Virtuoso), and on and on and on.....

    What is SKILL/SKILL++'s philosophy? Scheme is minimalist and favors a functional style. Common Lisp is large and favors iteration over recursion. SKILL is large like Common Lisp, and seems to favor iteration like Common Lisp (foreach's default is mapc rather than mapcar; the gdmSpec interface is stateful; tail call optimization was not added until quite recently, and it still doesn't work reliably (for me anyway)...), but its documentation makes a big deal about being compatible with Scheme, and SKILL++ (with the plus-plus suggesting incremental improvement over the original) moved in the direction of Scheme's evaluation semantics rather than Common Lisp's, yet it added an object system patterned after CLOS!

    So what is SKILL/SKILL++'s philosophy? Is it trying to please everyone by pretending to be their favorite dialect? I like to think it is trying to create something new by taking the best features from both dialects. Scheme is the smallest, and CL is the biggest, so SKILL/SKILL++ is somewhere between. It's not as minimal and elegant as Scheme, and not as kitchen-sink and design-by-committee as CL. It has good support for pure functional programming like Scheme, but also good support for stateful iteration like CL. It supports unhygienic macros (which are widely regard as more powerful), while slowly adding support for hygienic macros (which are widely regard as much safer). It has an object system, but you are free to ignore it. It supports infix syntax, but you are free to (mostly) ignore that too.

    So SKILL appears to be a devil-may-care, happy-go-lucky language, lightheardedly doing its own thing rather than slavishly following the crowds. If Lisp is a language for non-conformists, SKILL is a dialect for non-comformists who refuse to conform to the other non-conformists! In this way it's a lot like Perl. If it had been free and open source back in the mid-80's, people might be using SKILL now instead of Perl, and Cadence might be a lot richer. :) But, like Xerox, Cadence wasn't in the software business (at least not that sort of software....)

    SKILL is so flexible, though, that it makes Perl look like Pascal. You can embed your own DSL's in SKILL very easily, because it's a Lisp.... Or you can pretend it's not Lisp (like my coworkers do) and write FORTRAN programs. It even has GOTO! SKILL just doesn't care. If Perl's motto is "there's more than one way to do it," and Python's is "there's only one (obvious) way to do it", then SKILL's motto is "whatever".

    Is SKILL supportive, or apathetic? Is it eager to please, or so code-weary that it can't even be bothered to care how you write your program?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • tweeks
    tweeks over 10 years ago

    What's great about SKILL/SKILL++ is that there's so many ways to do things.

    What's annoying about SKILL/SKILL++ is that there's so many ways to do things.

    Define a procedure:

    (def square (lambda (x) (times x x)))
    (defun square (x) (times x x))
    (procedure square(x) (times x x))
    (define (square x) (times x x))
    (define square (lambda (x) (times x x)))
    (defvar square (lambda (x) (times x x)))
    (setq square (lambda (x) (times x x)))
    

    Define a global value:

    (define zero 0)
    (defvar zero 0)
    (setq zero 0)
    

    On the one hand, do we really need three semantically-identical ways to define a global variable, and seven to define a procedure?

    On the other hand, why not provide multiple redundant syntaxes if it helps make programmers from other languages feel more at home?

    On the third hand, SKILL is not Scheme or Common Lisp, so define, defun, and defvar only superficially resemble their namesakes: they are really very different animals. A Scheme programmer may feel at home with SKILL++'s define for a few minutes, but then be surprised later on by the differences. Likewise, a Common Lisp programmer will soon find that defun and defvar behave quite differently from CL. So in the short-run, the syntactic borrowing makes the language friendlier, but in the long-run these borrowings are "false-friends": familiar-looking words in a foreign language that actually mean quite different things from what you would expect.

    The differences are myriad: plus and append require two or more arugments; strings are immutable; improper and circular lists do not exist; the cdr of a cons must be a list; nil is not a symbol; environments are first-class; all free variable references are evaluated dynamically or lexically within a given block of code, depending on whether it's SKILL-mode or Scheme-mode; arithmetic with integers is inexact; rationals do not exist (but complex numbers are available in Virtuoso), and on and on and on.....

    What is SKILL/SKILL++'s philosophy? Scheme is minimalist and favors a functional style. Common Lisp is large and favors iteration over recursion. SKILL is large like Common Lisp, and seems to favor iteration like Common Lisp (foreach's default is mapc rather than mapcar; the gdmSpec interface is stateful; tail call optimization was not added until quite recently, and it still doesn't work reliably (for me anyway)...), but its documentation makes a big deal about being compatible with Scheme, and SKILL++ (with the plus-plus suggesting incremental improvement over the original) moved in the direction of Scheme's evaluation semantics rather than Common Lisp's, yet it added an object system patterned after CLOS!

    So what is SKILL/SKILL++'s philosophy? Is it trying to please everyone by pretending to be their favorite dialect? I like to think it is trying to create something new by taking the best features from both dialects. Scheme is the smallest, and CL is the biggest, so SKILL/SKILL++ is somewhere between. It's not as minimal and elegant as Scheme, and not as kitchen-sink and design-by-committee as CL. It has good support for pure functional programming like Scheme, but also good support for stateful iteration like CL. It supports unhygienic macros (which are widely regard as more powerful), while slowly adding support for hygienic macros (which are widely regard as much safer). It has an object system, but you are free to ignore it. It supports infix syntax, but you are free to (mostly) ignore that too.

    So SKILL appears to be a devil-may-care, happy-go-lucky language, lightheardedly doing its own thing rather than slavishly following the crowds. If Lisp is a language for non-conformists, SKILL is a dialect for non-comformists who refuse to conform to the other non-conformists! In this way it's a lot like Perl. If it had been free and open source back in the mid-80's, people might be using SKILL now instead of Perl, and Cadence might be a lot richer. :) But, like Xerox, Cadence wasn't in the software business (at least not that sort of software....)

    SKILL is so flexible, though, that it makes Perl look like Pascal. You can embed your own DSL's in SKILL very easily, because it's a Lisp.... Or you can pretend it's not Lisp (like my coworkers do) and write FORTRAN programs. It even has GOTO! SKILL just doesn't care. If Perl's motto is "there's more than one way to do it," and Python's is "there's only one (obvious) way to do it", then SKILL's motto is "whatever".

    Is SKILL supportive, or apathetic? Is it eager to please, or so code-weary that it can't even be bothered to care how you write your program?

    • 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