[plt-scheme] Re: Apparent inconsistencies between original spirit of RnRS and R6RS [Fw: Ann: Sketchy LISP, Third Edition]

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Aug 8 05:45:13 EDT 2008

On Aug  8, Benjamin L.Russell wrote:
> Okay; after some further discussion on comp.lang.scheme, I
> discovered that R6RS, unlike Common Lisp, allows the language to
> restrict the imported libraries so as not to import those that are
> undesired, so this is not a concern with R6RS in its present state.

This was true in PLT for a long time now.  You can have a language
that is as restricted as you want.  You can even exclude `require'
from the language, and looking at all that extra documentation becomes
irrelevant bcause you can't use it.  (And BTW, this is not something
that I say in theory -- in my course I give the students a different
language for each homework.)

> My worry concerned my experiences with Common Lisp.  When I was
> starting out in my first course in Computer Science, which used both
> Common Lisp and Scheme (and a one-page translation chart, labelled
> "Common Lisp for Schemers," written by the professor, Drew
> McDermott, to let us do the exercises in SICP in Common Lisp if we
> preferred), back in fall of 1990, we used, if I remember correctly,
> a reference manual for Franz Lisp that was over a thousand pages
> long that documented the available libraries.

That is, IMO, one of the biggest problems of CL to this day: not only
is it big -- but it is unclear which parts are the core and which
parts are not.  In fact, at the technical programmer level, there is
no such distinction...  (And yes, there is the restriction that
forbids your from overriding builtins, but that's not nearly the
same.  And yes, you also have packages, but comparing CL packages to
the PLT module system is like [ugh, I dislike such analogies, so I'll
let you imagine the rest].)

> While libraries are definitely a benefit for professional
> programmers, I believe that they can actually be a hindrance in an
> introductory course in computer science, because of the following
> reasons:
> 1) They shift the focus from thinking about the underlying algorithms
> to looking up libraries, and 

[JFYI, these days students are always looking up stuff -- there's
always a chance that google will come up with a solution to your
homework, right?]

> 2) They can cause confusion for some beginner-level students who do
> not know enough reserved words to avoid namespace collisions easily.

In addition to the ability to provide restricted languages, the main
advantage of the PLT module system is that it is impossible to break
by just writing random stuff.  Recently, mzscheme was changed to allow
"overwriting" required bindings, so this is a valid module:

  #lang scheme
  (define + *)
  (+ 4 5)

And the result will be 20.  But no other parts of the system break as
a result -- it's only your own code that sees the new binding.  If you
run that in DrScheme (which is actually running your code -- it
doesn't start a subprocess to protect itself from such things), you
get the same result -- and the rest of drscheme works perfectly fine
(and *not* because the source code doesn't use any additions...).

In other words, you're likely to not know about some binding in the
language -- it's pretty big now (I'm counting around 1500 bindings in
the `scheme' language, whereas CLtL lists aroun 1100).  So you can
write this code:

  #lang scheme
  (define (warn string) (fprintf "WARNING: ~a\n" string))

and miss the fact that about a month ago `warn' got added to the
language.  Your code will still work fine; drscheme will still work
fine too.

> For beginners, keeping the language simple helps immensely.  [...]

... and you've just motivated the student languages.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.