Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!gatech!swrinde!elroy.jpl.nasa.gov!lll-winken.llnl.gov!uop!csus.edu!netcom.com!netcom8!haahr
From: haahr@netcom.com (Paul Haahr)
Subject: Re: Generic (as in Template) Classes?
In-Reply-To: derway@ndc.com's message of 01 Jun 1995 22:14:16 GMT
Message-ID: <HAAHR.95Jun2122522@netcom8.netcom.com>
Sender: haahr@netcom8.netcom.com
Organization: NETCOM On-line services
References: <DERWAY.95Jun1151416@alumni.ndc.com>
Date: Fri, 2 Jun 1995 11:25:22 GMT
Lines: 26

Don Erway <derway@ndc.com> wrote:
> Dylan, (and dynamic languages in general), do not provide for generic
> classes, such as Eiffel and C++ provide.  What is lost?
> 
> If we wanted to use Dylan in a more type safe manner, we would have to derive
> new subclasses for things like stack-of-integers, rather than using a generic
> class.
> 
> Is this much loss?  Is there a work around?

Limited collection types, which are documented in design note 6 but
didn't make it into the DIRM, address this issue.

A type which might correspond to want you want could be

	limited(<deque>, of: <integer>)

and could be used instead of <deque> throughout the program.

> Will the macro facility make up the difference?

Only so far as macros are a way of writing lots of versions of the same
code, enabling you to simulate templates.

Paul

