Re: Minimal keywords needed for constructing a full CL system
- From: Lars Brinkhoff <lars.spam@xxxxxxxxxx>
- Date: Mon, 17 Jul 2006 20:46:28 +0200
rpw3@xxxxxxxx (Rob Warnock) writes:
Lars Brinkhoff <lars.spam@xxxxxxxxxx> wrote:
I've implemented much of CL in Emacs Lisp, which has a muchVery interesting indeed! Do you think your "much of CL" meets the
smaller set of primives than CL.
definition of a "subset of CL" given in CLHS 1.7 "Language Subsets"?
Absolutely. It's actually quite close to full ANSI CL, but some major
chunks are missing, like pretty printing and CLOS. Other than that,
it's just another implementation of CL.
You could even subset Emacs Lisp and use that as an implementationRight, but consider the above comments on the relationship between
substrate, which would get us a lot closer to a "minimal" subset.
the implementation substrate and the "subset CL" which it hosts.
Ok, in that case, my implementaion uses Emacs Lisp almost exclusively
as a substrate, and the CL layer is a separate language on top of
that.
However, I believe you could take the Emacs Lisp language (not the
implementation) as a starting point, modify it somewhat, and get a
language that would be both a strict subset of CL, and a useful CL
implementation language. Or at least use Emacs Lisp as some kind of
guide to which features to include. Emacs Lisp is actually already
quite close to being a CL subset, at least culturally.
Emacs Lisp only has catch and throw.In my "QDL", I'm probably going to use TAGBODY/GO as the "primitive"
one
Yes, that would have been my choise too.
O.k., fine. And as Kent has pointed out elsewhere in this thread:- The CL exception system [...]None of these are primitive.
...in an error system...really none of the functionality needs
to be primitive. This was already possible to write in portable CL.
What was not portable to write was the "fact" that it gets called.
So at least enough hooks have to be provided in the implementation
substrate
Right, but to pick nits, a substrate doesn't need those hooks (like,
provably, Emacs Lisp), but a subset does.
- The full numeric tower: Reals [float, rational, integer (fixnumEmacs Lisp only has fixnums and floats. In my implementation, all
and bignum)] and Complex [pairs of those] and the usual related
functions.
other types of numbers are built from those. Of course, floats could
be implemented with fixnums.
It's that sticky little "equivalent semantics" clause that worries me.
By now, you should have realised (as have I) that I was writing about
something slighly different from what you was asking for. Of course,
most Emacs Lisp operators have wildly different semantics from the
corresponding CL operators. So Emacs Lisp hardly qualifies as the
subset language you want. However, it's quite straightforward to use
it to implement the CL semantics in a distinct set of operators.
But once you extend a fixnum-only subset to include floats, with
automatic coercion to floats for non-fixnum results, then I think
you can no longer claim to meet the "equivalent semantics" clause!!
No, but a fixnum-only subset wouldn't have to handle things that way.
By your suggestion, signals could be raised at appropriate points, and
handled to implement CL semantics.
And if Emacs Lisp is your implementation substrate, then the expression
(/ 3 5) ==> 0.6 would fail to have equivalent semantics in full CL.
But because Emacs Lisp is a *substrate*, not a subset, this doesn't
matter. In my CL implementation, (/ 3 5) evaluates to 3/5, as it
should. Obviously, the emacs-lisp:/ operator isn't the same as
common-lisp:/.
as you point out, from vectors come structs, and from structs, CLOS.
(Or structs come from CLOS, or they may be separate. Each way has its
merits.)
But if you do this, there may be problems with the subset semantics.
You wouldn't want the subset to say that TYPE-OF a struct is VECTOR.
Of course you can make the subset have its own operator, say
CL-SUBSET:TYPE-OF, and implement CL:TYPE-OF in terms of that, but then
a small part of your subset has been expatriated to substrate layer,
and then you have a situation that is similar to my implementation.
You don't need hash tables, but weak hash tables are very very handyJust curious... How are weak hash tables more useful than generic
weak pointers?
I didn't say they are. I don't know enough on generic weak pointers
to comment on that.
Declaration processing is just part of the compiler. You need oneWell, mere "assignment to memory locations" doesn't provide the
kind of binding: lexical or dynamic. Or maybe none at all, just
assignment to memory locations.
right semantics for LAMBDA, and if you have LAMBDA, then almost all
the other binding constructs are just a hop, skip, & jump away.
Right. It's just the substrate vs subset thing again.
I'm still curious as to whether any CL implementors or serious users
have an opinion/belief/hunch about whether a "useful" subset of CL
exists that meets CLHS 1.7...
I believe Lisp500 may be quite close to such a subset. When I last
looked at it, it really seemed to go out of its way to only implement
the most necessary primitives in C, and add more CL operators in a
Lisp initiation file.
.
- References:
- Minimal keywords needed for constructing a full CL system
- From: Javier
- Re: Minimal keywords needed for constructing a full CL system
- From: Rob Thorpe
- Re: Minimal keywords needed for constructing a full CL system
- From: Rob Warnock
- Re: Minimal keywords needed for constructing a full CL system
- From: Lars Brinkhoff
- Re: Minimal keywords needed for constructing a full CL system
- From: Rob Warnock
- Minimal keywords needed for constructing a full CL system
- Prev by Date: Re: GNU CLISP 2.39 (2006-07-16)
- Next by Date: Re: Minimal keywords needed for constructing a full CL system
- Previous by thread: Re: Minimal keywords needed for constructing a full CL system
- Next by thread: Re: Minimal keywords needed for constructing a full CL system
- Index(es):
Relevant Pages
|