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: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Wed, 23 Apr 2014 18:40:33 +0200 Organization: A noiseless patient Spider Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 23 Apr 2014 16:40:31 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="271672a259e86d4645012299bd282e2a"; logging-data="19523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mxMWknr1nXEpKZcHxOWFS" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: Cancel-Lock: sha1:btcH0HBKG3E477HvhV+/GdycW/8= X-Enigmail-Version: 1.6 X-Original-Bytes: 2454 Xref: number.nntp.dca.giganews.com comp.lang.ada:186032 Date: 2014-04-23T18:40:33+02:00 List-Id: Le 23/04/2014 18:27, Dmitry A. Kazakov a écrit : >> But that would require every type to have a 'Img. Yes, you said you >> > wanted that, but there are clearly types where no sensible image could >> > be provided. > No, I didn't want that. > > Instead I would do two things: > > 1. Classes for all types; > > 2. An interface named Printable (or whatever else name) with the primitive > operation Image. > > Now, if a type is supposed to have Image, it must implement the interface. > All scalar types will. > > If a record type need to have Image, you inherit to Printable. If Image is > needed in a generic the formal type inherits to Printable. That's it. But why require such a machinery? If you want to express that a formal type must feature an Image function, you can do it even in '83: generic type T is private; with function Image (Item : T) return String; package Foo is... What would an attribute bring as benefit? -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr