Re: Scheme macros
From: William D Clinger (cesuraSPAM_at_verizon.net)
Date: 03/07/04
- Next message: Anton van Straaten: "Re: Scheme macros"
- Previous message: Rahul Jain: "Re: Scheme macros"
- In reply to: Peter Seibel: "Re: Scheme macros"
- Next in thread: Rahul Jain: "Re: Scheme macros"
- Reply: Rahul Jain: "Re: Scheme macros"
- Reply: Kaz Kylheku: "Re: Scheme macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Mar 2004 12:26:01 -0800
Peter Seibel <peter@javamonkey.com> wrote:
> I'm not sure it's quite fair to say Common Lisp has 700 "reserved
> words". At least, if there's anyone reading along from a C/C++/Java
> background who's not familiar with the Common Lisp symbol package,
> they shouldn't think that what you're calling "reserved words" in
> Common Lisp are the same thing.
I'm sure it was quite unfair.
It would have fairer to say that Common Lisp has 979 symbols in the
COMMON-LISP package that are restricted in the following ways:
None may be defined as a global function, macro, compiler macro,type
specifier, structure, or declaration. None may be removed from the
COMMON-LISP package, nor may their home package be altered. None may
be traced, declared or proclaimed special, defined as a method
combination type, used as the class-name argument to SETF of
FIND-CLASS, bound as a catch tag, or bound as a restart name. None
may have a SETF expander defined for them, nor may their SETF
function names be defined, undefined, or bound. 751 of these symbols
are restricted in the following ways: None of the 751 may be bound as
a local function or macro, nor may a local SETF function be bound for
them. This list of restrictions is incomplete.
My use of the phrase "reserved words" was a misleading abbreviation
of the truer statement above. Next time I'll try to remember to say
"restricted words" instead.
You gave a very nice example of the difference:
> I ran into a very specific instance of the difference today: I was
> writing some code to take apart Java classfiles. I ended up trying to
> write a class named RETURN to represent the JVM op of the same name.
> Of course I got an error because RETURN is a symbol in the CL package.
> When I had written a similar piece of software in Java I had run into
> the same problem because "return" is reserved word in Java.
>
> However the difference is that in Common Lisp the only restriction is
> on the specific name COMMON-LISP:RETURN. So I was able to cleanly
> solve my problem by making a package JVM which contained the names of
> all the classes I wanted to create to represent JVM ops. There's no
> way to do the same thing in Java because the reserved words are really
> reserved.
>
> -Peter
Will
- Next message: Anton van Straaten: "Re: Scheme macros"
- Previous message: Rahul Jain: "Re: Scheme macros"
- In reply to: Peter Seibel: "Re: Scheme macros"
- Next in thread: Rahul Jain: "Re: Scheme macros"
- Reply: Rahul Jain: "Re: Scheme macros"
- Reply: Kaz Kylheku: "Re: Scheme macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|