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=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!ottix-news.ottix.net!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: A bad counterintuitive behaviour of Ada about OO Date: Thu, 07 Aug 2014 16:53:50 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <932kntuq5rrr.8sumwibqrufn.dlg@40tude.net> <1ohy7vnbntskq$.h139ov04mlxu$.dlg@40tude.net> <1iqas4j5s9mep$.1i2lwbt33qqqn$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1407444821 24012 192.74.137.71 (7 Aug 2014 20:53:41 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 7 Aug 2014 20:53:41 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:8ytkOAdKpa23tXFe0pvZm+vEc4w= Xref: number.nntp.dca.giganews.com comp.lang.ada:188223 Date: 2014-08-07T16:53:50-04:00 List-Id: "Dmitry A. Kazakov" writes: > On Thu, 07 Aug 2014 14:14:52 -0400, Robert A Duff wrote: > >> "Dmitry A. Kazakov" writes: >> >>>...you cannot have one of class-wide >>> elements. >> >> ...but that's not one of them. Ada.Containers.Indefinite_Vectors >> supports class-wide element types, for example. > > But you must have class-wide "elementary types" first. There is none, which > was the point. Oh, now I see what you mean. That's not a restriction on generics, it's a restriction on non-tagged types. We tried to add 'Class on non-tagged types in Ada 9X, but the idea was rejected. universal_integer is something like root_integer'Class, but since you can't name those types, you can't do something like: function Image(X: universal_integer; Base: Integer range 2..16 := 10) return String; > ----------- > Generics (parametric polymorphism) does not add anything to the language. > Anything you want to parametrize, must be in the language first, e.g. to > have a generic package the language must have plain packages. I think types should be generic, instead. See Eiffel. - Bob