Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dylan's type system

10 views
Skip to first unread message

Scot Dyer

unread,
Mar 24, 1993, 12:34:57 PM3/24/93
to
Now that all that fuss is over (about multiple-argument dispatch), I think
there's a real Dylan design issue to be brought up.

What made the early FORTRANs so easy to compile was exactly what made them so
difficult to use in many cases -- a real lack of dynamicism. On the other
hand, if we look at LISP around that time, we see that it was problematic in
exactly the opposite way -- a real lack of static-ness.

In my eyes, good languages provide a facility for dynamicism that a compiler
can reduce to static stuff as much as possible. This is certainly the [only]
argument for C++ over SmallTalk, since they both subscribe to [basically] the
same paradigm otherwise.

THE PROBLEM:

The s-expression "(car x)" cannot be typed by a Dylan compiler, even given that
x is an instance of <list>. Therefore, the s-expression "(f (car x))" MUST
be compiled as code using a dynamic method dispatch. If we had some higher
order type information, like x is a <list> of <integer>s, then the <integer>
method for f could be selected statically (at compile-time -- actually this
would be a mere constant reduction in the front-end...).

This is a real liability of Dylan's, and in my mind the only major design flaw.
Are there any plans to introduce a higher-order class system to Dylan? Of
course, a "sufficiently smart compiler" could _view_ <list> as higher-order
and do all kinds of inter-procedural analysis to get the higher-order type
information, but this probably wouldn't come to fruition -- like most of the
other "sufficiently smart" LISP compilers...

Are there any plans to add higher-order classes to the Dylan spec? I could
probably do it with the existing Dylan language*, but that wouldn't make my
compiler know about them so what would be the use?

-- Scot

* By writing a function: (<list-of> /class/) that returns a class from a hash-
table, since method specializers have to be eval'ed anyhoo...

Andrew LM Shalit

unread,
Mar 24, 1993, 3:25:12 PM3/24/93
to
In article <930324173...@eagle.sharebase.com>,

dy...@eagle.sharebase.com (Scot Dyer) wrote:
>
> Are there any plans to add higher-order classes to the Dylan spec?

Yes. The specification of this feature should be available shortly.

-Andrew Shalit
Apple Computer

Kent Sandvik

unread,
Mar 24, 1993, 10:46:41 PM3/24/93
to
At 9:34 3/24/93 -0800, Scot Dyer wrote:
>In my eyes, good languages provide a facility for dynamicism that a compiler
>can reduce to static stuff as much as possible. This is certainly the [only]
>argument for C++ over SmallTalk, since they both subscribe to [basically] the
>same paradigm otherwise.

I saw a compiler implementation as part of a new language I'm not allowed
to talk
about (it's not from Apple) where the static compiler part does *no* type or
parameter checking, but the runtime catches the most obvious problems.

Now, first I thought this was heresy, but the more I think about this
angle it makes sense concerning having an extremely fast static compiler
in combination with a debug-runtime environment for testing purposes.

By the way, I'm not a static language evangelist, quite the contrary.

Regards,
Kent Sandvik

Kenneth Knight

unread,
Mar 25, 1993, 4:07:31 PM3/25/93
to
In article <930324173...@eagle.sharebase.com> dy...@eagle.sharebase.com (Scot Dyer) writes:
>THE PROBLEM:
>
>The s-expression "(car x)" cannot be typed by a Dylan compiler, even given that
>x is an instance of <list>. Therefore, the s-expression "(f (car x))" MUST
>be compiled as code using a dynamic method dispatch. If we had some higher
>order type information, like x is a <list> of <integer>s, then the <integer>
>method for f could be selected statically (at compile-time -- actually this
>would be a mere constant reduction in the front-end...).

I think I must be missing something here. If x is an instance of <list> the
compiler will know this. Are you asking for sub-classes of <list> like
<integer-list> which you as the programmer must specify when instantiating
x in the first place? Or, and this sounds like a better though tougher idea,
if x is always a <list> of <integer>s as you said the compiler would
optimize its code generation around this fact? This latter sounds like it
would be really tricky. What am I mis-understanding?

** Ken **

0 new messages