languages (was: a compiler for perl)
Jecel Assumpcao Jr
jecel@tunes.org
Wed, 24 May 2000 15:31:12 -0300
On Fri, 19 May 2000, Francois-Rene Rideau wrote:
> > I was talking about directly changing the list representation of
> > functions, not the source (though they are equivalent).
> I think the CommonLISP standard does not specify the effects
> of modifying the body of functions
> (e.g. by modifying interned strings or quoted material).
True, but unrelated to what we were discussing. This is a problem in
many languages - programmers expect literal objects to be immutable
when they are not. In C:
char msg[] = "Press 1 to explode the planet";
void main () {
msg[6] = '3';
....
printf ( msg );
....
}
In Smalltalk, newbies always have a hard times understanding this kind
of code:
label
"Answer the string that appears in the receiver's label."
labelText isNil
ifTrue: [^ 'Untitled' copy]
ifFalse: [^ labelText asString]
If you eliminate the "copy" and then edit the label of a newly created
window, you might have a nasty surprise the next time you create
another window...
> > You know, if Tunes was based on Logo it would start
> > out with a very large number of users :-)
> Alternatively, I could take Linux or *BSD, rename it "Tunes",
> and have a large number of users... next thing, LinuxOne hires me.
Very funny, but again unrelated as I wrote *based* on Logo in the same
sense that Tunes is now based on Scheme. While I was joking, I also
intended to point out that Logo is a far more powerful language than
most people realize. After all, there are many languages to which you
can't easily translate the example I gave. Compared to modern Lisps,
its dynamic binding seems very quaint and the lack of lambdas a serious
omission (though it is surprising how far you can get without them when
you have dynamic binding!). Schemers would miss continuations.
The problem of getting users is a real one since people in general (as
opposed to this list) hate learning new things. The only reason Java
did as well as it did was that they fooled everyone into thinking it
was really a kind of C or C++. If people had figured out that it was
really more closely related to the Wirth family of languages it would
not have become as popular.
In 1994 I designed a language called "Troy" (since renamed "NeoLogo",
see http://www.merlintec.com/pegasus2000/e_neologo.html) which was
compatible with Logo but was actually derived from Self. I hoped to get
into the schools (like a certain famous wooden horse ;-) but gave up
when I saw how little of Logo is actually taught to the students. Now I
feel that this might have worked if I bypassed the teachers by
including lots of online material where the students couldn't avoid
coming across it.
> > Just "grep eval source.lisp" and if the result is empty you know you
> > won't have to include the interpreter ;-)
>
> It's not as easy as you say. What about the following?
> (funcall (symbol-function (intern (concatenate 'string "EVA" "L")))
> "(+ 1 2)")
Ok. In practice, though, I don't think this kind of code would ever be
used except to prove that my rule is wrong in theory....
-- Jecel