2009-02-01

How lexical scope is important

"Fexprs more flexible, powerful, easier to learn? (Newlisp vs CL)" @ c.l.l.
Rainer Joswig (with some participation from Kaz Kylheku and Pascal Bourguignon) on a practical example explain, what problems of dynamic scope (still used in the suggested "improved" newLisp, which turns out to be old, actually :) are solved by lexical scope.
Bonus: how to create lisp-style special global variables in C++ (and a discussion of what can be improved in CL in this regard)

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I'll add two links that might be of use for those who are interested enough in the subject to make their own opinion:

    * Newlisp lexical scope support, adviced by Newlisp author:

    Contexts

    * My own texts explaining how dynamic scope can be used on a safe way, if one uses language without lexical scope or he doesn't want to use lexical scope. (Again, NL has lexical scope.)

    Kazimir Majorinc's blog

    Thank you.

    ReplyDelete
  3. Hi Kazimir. I think it could be helpful for you to read the book Let over Lambda (http://letoverlambda.com/), where great examples of what you can do with lexical scope are given, as well as excursions into the theoretical basis of Lisp.

    Otherwise, you know, if you want to call something by some name, that's your subjective decision, but don't expect others to agree with you. For example, I believe, that the need to use #' to get to the function-value of a cell is a great hint to the programmer and such statement, as (map even '(1 2)), is ugly and confusing. The adept of Scheme (or Newlisp, yeah?) will think the opposite. In the end beauty is in the eye of the beholder. And the objective criteria, that you can try to judge language features by, do not include neither something like token count, nor a relative ease of understanding to you personally, but rather applicability to the real world needs and compromises, that are taken. After all not all things are equally easy. Some are hard, but that doesn't mean, that you should try to dumb them down. So, that said, can you point to any objective flaw in Rainer Joswig's solution? ;)

    ReplyDelete
  4. Vsevolod,

    Thanks for a book recommendation.
    I do not really have anything significant to add to what I already told in the original article.

    If you do not mind, I'll just post the link to that article, since I wrote few new posts after that so it scrolled down.

    Majorinc, Challenged by Common Lispers.

    Thanks again.

    ReplyDelete