Subject: Re: ILC2005: McCarthy denounces Common Lisp, "Lisp", XML, and Rahul
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 06 Jul 2005 00:11:48 -0500
Newsgroups: comp.lang.lisp
Message-ID: <UN6dnT82UpOJ9VbfRVn-qA@speakeasy.net>
Joerg Hoehle  <hoehle@users.sourceforge.net> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
| >   (mapcar #$(cons $1 (+ 32 (* 9/5 $1))) (iota 11 0 10))
| > But don't worry, I never use #$ in permanent code...  ;-}
| 
| The Iterate package has exactly this readmacro, #L...
| (mapcar #L(cons !1 (+ 32 (* 9/5 !1))) (iota 11 0 10))
+---------------

Neat!

+---------------
| Note how I fear a problem with all these hacks (sorry): they do not
| scale, because they don't compose.  What do you expect out of [example]...
| Such observations have led me to withdraw from using such seemingly
| cool (at first sight) "extensions".
+---------------

Which is exactly why I said "I never use #$ in permanent code".
My various "REPL conveniences" are just that, personal shortcuts,
*not* language proposals.

+---------------
| Growing a language is what I'm looking for, and that's a hard job.
+---------------

Indeed, as I discovered circa 1996 when I tried write an infix dialect
of Scheme to avoid massive parenthephobia at a PPOE. Oh, sure, a simple
hybrid of Tcl & ML syntax styles [don't shudder, it wasn't *that* bad!],
really just a thin veneer of syntactic sugar over the Scheme REPL, worked
well enough to satisfy the users of the particular application in question
[a user-mode hardware debugger], and P'Lite [Parentheses-Lite Scheme,
pronounced "polite"] had several dozen happy users for a few years...

But there were always a few nasty corner cases that didn't seem "right"
to me, which made me feel uneasy about promoting the "language" to a
wider audience [which I had permission to do, by the way, so that wasn't
the reason].

Case in point: As in Tcl, a "word" by itself was a function call, e.g.:

    plite> display "a string" ; newline ; display "another string" ; newline
    a string
    another string
    plite> 

But like Scheme, Lisp, ML, and BLISS, it was also an expression language,
so the value of the last expression in a BEGIN block (PROGN) should be
returned as the value of the block:

    plite> let x = 3 in { set x = x + 1 ; x }
    4
    plite> 

But this leads to a problem [and Lisp-1 vs. Lisp-2 doesn't really help],
namely, what should one return when the last expression is a block is a
single symbol *and* the value of the symbol is a function [in a Lisp-1
such as MzScheme, or has both a function- and symbol-binding in a Lisp-2]?
E.g.:

    plite> let x = 3 in { display x ; newline }
    3
    ???
    plite> 

What should get printed where the question marks are?  #<void>, which
"newline" returns as a value?  Or #<primitive:newline>, the value of
(eval newline)?  [Note: Please ignore for a moment the fact that the
MzScheme REPL suppresses printing #<void> as a value -- that's an
irrelevant side-issue.]

Consistency with the Tcl-like imperative command style says that one
should call the function and return whatever the function returns.
Consistency with expression-language (Scheme/Lisp/ML/BLISS) style
says that one should return the symbol's variable binding as the
value. What to do? What to do?

For expedience and "least astonishment" with the particular set of
users at the time, I chose to implement the Tcl-like imperative command
style *iff* the symbol had a variable binding whose value was some sort
of function, e.g., "procedure?" (Scheme) or "fboundp" (CL). If script-
writing users wanted the other result, I told them to use "values {symbol}"
instead of just "{symbol}", which was an unambiguous way to request the
symbol's variable binding as the value.

But almost a decade later, I'm still not sure that was necessarily
the "right" answer for an infix dialect of Scheme or CL intended for
a wider audience than the one I had at the time. [I'm open to comments
and/or criticism on this point.]

As you said, "Growing a language... [is] a hard job."


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607