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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Wed, 23 Apr 2014 16:38:56 +0200 Organization: cbb software GmbH Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: G+aXx1XI67D34t54ibhUPQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 1947 Xref: number.nntp.dca.giganews.com comp.lang.ada:186025 Date: 2014-04-23T16:38:56+02:00 List-Id: On Wed, 23 Apr 2014 15:57:03 +0200, J-P. Rosen wrote: > Le 23/04/2014 14:55, björn lundin a écrit : > >> I'd like V'Img to be standard ada like T'Image(V); As in the gnat >> implementation >> > No big cost, no big benefit... > >> Also, I'd like to be able to define the string function for a record >> type to be used for the 'image attribute. >> >> type T2 is record A : T; B : T; end record; >> >> function F_T2_Image(O : T2) return String is begin return O.A'Img & " >> " O.B'Img; end F_T2_Image; >> >> for T2'Image use F_T2_Image >> >> V2 : T2; .. Put_Line(V2'Img); >> > And what is the benefit over writing: > Put_Line (F_T2_Image (V2)); > ? generic type T is private; package Foo is ... package body Foo is procedure Bar (X : T) is begin ... X'Img ... That is the only use case for an attribute, in absence of primitive operations of course. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de