[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Scheme has data types and Lisp doesn't."
In article <13046@well.UUCP> nagle@well.UUCP (John Nagle) writes:
> It's more of an MIT vs the rest of the LISP world tradition.
>Although Common LISP has data type declarations of a sort, they tend
>not to be taken all that seriously by compilers. CLTL is very weak
>on this subject [...] There's a faction in the LISP world that feels that
>floating point is unimportant. The strongest expression of this feeling
>was in the early Symbolics machines, which lacked floating point hardware.
>Much of the weakness on typing in Common Lisp reflects lobbying from the
>Symbolics faction, which generally supported the idea that everything
>possible should be dynamic.
I find this explanation rather strange. For one thing, Common Lisp
has more in the way of declarations than does Scheme, so I don't see
how Common Lisp's weakness explains why someone would say "Scheme
has data types and Lisp doesn't".
Neither Lisp nor Scheme (if we're going to pretend for the moment that
Scheme isn't a kind of Lisp) are strongly typed. Both use dynamic
typing. This is not something introduced by Common Lisp, nor is it
something that's changed in Scheme.
You might say this is Lisp (and Scheme) vs the rest of the world,
except that there are other languages that work in the same way.
But I don't think it's MIT vs the rest of the world. MacLisp
was known for the efficient numeric code generated by its compiler,
CLtL certainly seems to take floating point seriously and describes
a reather elaborate set of floating point facilities in detail.
There are a number of reason why Symbolics may not have had floating
point initially. But floating point is hardly the only case where
type information can lead to more efficient code on "conventional
machines". Because Symbolics machines have a hardware (microcode?)
type dispatch, type declarations don't help on their machines. It
could be argued that this is truer to the spirit of Lisp.
But in any case, Lisp has never been a strongly typed language,
so I don't see how that can be due to Symbolics.
> Reading section 4.5 of CLTL (Common Lisp, the Language) will give
>you a good feeling of the weakness of the commitment to strong typing
>in Common Lisp.
It's stronger than in most other Lisps and stronger than in Scheme.
> What people tend to actually implement are systems in which all objects
>are "LISP objects", and are still individually allocated and pointed to.
>Defining an array of "short-float" is likely to generate an array of pointers
>to LISP objects.
That varies from implementation to implementation.
>Declaring an argument to a function to be of a specific
>type may turn off some checking.
That varies too.
But these things also vary in Scheme.