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!news3.google.com!news.glorb.com!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!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: 19 Aug 2005 11:08:05 -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 1124464085 17418 192.74.137.71 (19 Aug 2005 15:08:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 19 Aug 2005 15:08:05 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:4190 Date: 2005-08-19T11:08:05-04:00 List-Id: David Trudgett writes: > Robert A Duff writes: > > > 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 > > A small quibble, perhaps: I don't think one can use the phrase "most > macro systems" for the simple reason that (as far as I'm aware) no > language family besides the Lisp one has a macro system (in the sense > that Lisp has it -- they may well use the same word, but C language > "macros", for instance, are a completely different beast). I was including Lisp macros and C macros and the macros of many other languages, including assembly languages in the term "macro systems". Larry Kilgallen mentioned Bliss, which has an extremely powerful macro system. Most of them, I believe, share the same problem of accidentally referring to names visible at the place of the instantiation (macro call). But I agree that most of them are inferior to the Lisp version in many other respects. > > Some Lisp dialects have "hygienic macros", which are a lot more like Ada > > generics in this regard. > > You would be referring to Scheme dialects here. Yes, Scheme is one example. I think there are others, but I can't remember any examples at the moment. >... Interestingly, > Scheme's "hygienic macros" do not make Common Lisp's macros > "unhygienic"! They just add an extra restriction which stops the > programmer from doing certain things that can be done in Common Lisp > macros (from what I hear). The same level of "hygiene" can be had in > Common Lisp macros by the use of appropriate programming style, > including the use of GENSYM to avoid referring to extraneous "symbols" > (read "variable names", close enough). This has been debated intensely in the Lisp community. My opinion is that GENSYM doesn't make them hygienic, because GENSYM is something you have to remember to do by hand all over the place. In Scheme macros, and Ada generics, it happens automatically. Also, I don't see how this hygiene loses any power -- if you *want* to capture variable names visible at the call site, you can pass parameters to the macro/generic. > Thanks for your comments, Bob. Likewise. - Bob