From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3413256b2f4bedfc X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: OT: What was the first programming language to use 'generics'?... Date: 18 Aug 2005 17:36:41 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <43045094_1@glkas0286.greenlnk.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1124401001 25398 192.74.137.71 (18 Aug 2005 21:36:41 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 18 Aug 2005 21:36:41 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:4176 Date: 2005-08-18T17:36:41-04:00 List-Id: David Trudgett writes: > "Martin Dowie" writes: > > > ...and were they called 'generics'? > > > > Not Ada but I just know /someone/ here will know this! ;-) > > > > > > Probably (given I'm not a language historian) Lisp code macros were > the first, except for a couple of provisos: (a) Lisp never had the > strong static typing that Ada has, so Lisp macros weren't invented to > solve the same problem as Ada generics; and (b) Lisp macros are more > general than Ada generics in the sense that they allow essentially > arbitrary code (not text) generation (every Ada programmer's > nightmare? ;-)). An important difference between Ada's generics and most macro systems is: what should names in the template refer to. If a name in the template refers to something local to the template, it refers to the copy of that thing in the instance. If it refers to a formal parameter in the template, it refers to the actual parameter in the instance. If it refers to neither, what should it refer to? To something visible at the place of the template, or something visible at the place of the instance? The Ada answer is: at the place of the template. The usual macro answer is: at the place of the instance. Some Lisp dialects have "hygienic macros", which are a lot more like Ada generics in this regard. - Bob