[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A couple more details
While I'm breaking my silence, I might as well note a couple of other
things that have been on my mind. (I'm pretty busy with X3J13 right now
so haven't had the time to devote to this that I might otherwise, but
maybe something here will spark some interest in someone who does have
some more time.)
* Rename "char=?" to "char=", etc.
Rationale:
a. `Symmetry' with "="
b. I think of "=" as short for "equal?", so "char=?" looks like
"char-equal??" to my eyes.
* Rename "set!" to "set".
Rationale:
It's redundant. The operation already says in English that the
operator is destructive. If you have "append" and you make a
destructive version, it makes some sense to call it either
"destructive append" or "append!". In the original T manual, I
specified that "!" was pronounced " destructively" just as I
specified that "?" was pronounced "-pee". That way people would
pronounce "zero?" as "zero-pee" and "append!" as
"append destructively" for verbal compatibility with Lisp
programmers. In the case of set, though, it feels funny to me
to say "set destructively" since there is no non-destructive
version of set.
* Rename "set-car!" to "set-car", etc.
Rationale:
As for "set!", but in these cases I would withdraw the objection
if someone proposed "set-car", etc. as a non-destructive variant
in order to motivate the destructively part:
(DEFINE (SET-CAR X Y) (CONS (CAR Y) X))
(DEFINE (SET-CDR X Y) (CONS (CAR X) Y))
...
Note: The same argument doesn't make sense for SET! above since
the non-destructive variant is not appropriately compelling
(for what I claim are deep reasons):
(DEFINE (SET X Y) Y)
* Add essential syntax:
(CALL procedure . arguments)
(STATIC identifier)
Rationale:
Among other things (I have a few more reasons I might pull out if
people took this idea seriously), these would allow the entire language
to be described in terms of a much simpler primitive syntax. eg,
(LAMBDA (X) (+ X 3))
would be shorthand for:
(LAMBDA (X) (CALL (STATIC +) (STATIC X) (QUOTE 3)))
This would be useful as we move into the time when we start doing
macro expansion, because you could provide a macroexpansion
facility that guaranteed to always give you the longhand form,
making it much easier to dispatch off of things because you would
know that every valid primitive expression in the language was
represented by a list whose car was a keyword identifying the
operation. No more of this troublesome stuff, which comes up
a lot in user code walkers:
(LET ((X (MACROEXPAND Y)))
(COND ((SYMBOL? X) ...)
((ATOM? X) ...)
((NOT (ATOM (CAR X))) ...)
((MEMBER X '(LAMBDA ...)) ...)
(ELSE ;procedure
...)))
Instead, assuming that (MACROEXPAND 'X) => (STATIC X),
(MACROEXPAND '3) => (QUOTE 3), etc., then:
(LET ((X (MACROEXPAND Y)))
(CASE (CAR X)
((QUOTE) ...)
((STATIC) ...)
((CALL) ...)
...))