[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is a lightweight language

I think Olin meant the number of the basic special
forms.  There is a hierarchy of coreness 

1. basic special forms
  2. primitive procedures
    3. user-addable primitive procedures
      4. user-defined macros
        5. user-defined procedures

(Most languages don't consider 5 core at all, and quite
a few languages don't consider 4 core, but I think it
helps to plot them on this hierarchy anyway.)

If an implementation can push the responsibility for
something further down in this hierarchy, it should, so
the topmost set can be pretty small, yea, verily,
the half-dozen that Olin mentioned.  Why "should"?
Well, it needn't, but it makes the impl maintainable
and flexible (both of which may be non-goals, I'll

Given how open the implementation is, set 3 can be
nonempty and distinct from set 5.  Procedures like
apply and call/cc can well be in set 3 instead of set
2.  And since call/cc is procedural, it doesn't have to
be in set 1, whatever non-1 set it winds (no pun) up
in.  cond and let are obviously in 4, even if an
impl typically tosses them in as value-added. 

This is just to establish terms.  Set 2 (strings,
vectors, numbers, etc) is obviously very
important.  But discrimination is useful. 


[Paul Graham]
> I also don't buy this story that all you have to implement
> are the "big five".  Just look at the Scheme report.  All
> the things that are not described as "library procedures"
> are stuff you have to implement as primitives: strings,
> vectors, math, i/o, etc.
> No real, usable language can be made out of 5 primitives.
> It is still a very interesting question, though, how small
> you can get the core to be.  
> > [Olin Shivers]
> > 
> > 		All you need to write is a simple s-exp parser, a simple GC,
> >    and implementations of the "big five" basic forms:
> >       LAMBDA
> >       QUOTE
> >       IF
> >       DEFINE
> >       SET!
> >    Scheme is a very small language! 
> > 
> > [Dan Weinreb]
> >
> > Is that really all you need?  What happened to call/cc?  What
> > happened
> > to integers and strings and vectors?  What about "cond" and "let" and
> > "apply"?