exceptions

Jacek Generowicz jacek.generowicz at cern.ch
Thu Jun 10 03:18:20 EDT 2004


hungjunglu at yahoo.com (Hung Jung Lu) writes:

> Alexander Schmolck <a.schmolck at gmx.net> wrote:
> > How do younger languages like IO make this point more forcefully than lisp,
> > smalltalk etc -- languages which have been around for decades?
> 
> Double checked with Lisp just now. And Lisp did not allow me to
> redefine "if", "setq", "t", etc.

I presume you mean Common Lisp. I'm pretty sure that Scheme allows you
to do this without any restriction.

> If there are tricks in Lisp to intercept "if", "setq", etc.I'd like
> to know.

In Common Lisp you are not allowed to rediefine any external symbols
in the COMMON-LISP package:

  http://www.lisp.org/HyperSpec/Body/sec_11-1-2-1.html

and, in particular,

  http://www.lisp.org/HyperSpec/Body/sec_11-1-2-1-2.html

... so you define your own versions in another package. If you want to
know more about the issues surrounding this, then I suggest you ask on
c.l.lisp, as this is, after all, c.l.python.

> Same if these limitations are specific to some particular
> implementations of Lisp.

If by "Lisp" you mean "Common Lisp": no. If by "Lisp" you mean "the
Lisp language family" and by "implementation" you mean "dialect": yes.

> I greatly suspect that these limitations of Lisp are general, since
> Lisp does not naturally have prototype-based scopes like
> onion-skins, and overriding things like "if" could more easily
> create havoc.

Python does not expose pointers to the programmer. I greatly suspect
that this limitation is general to all programming languages, as this
could easily create havoc :-)



More information about the Python-list mailing list