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.1 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c689b55786a9f2bd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!eternal-september.org!.POSTED!not-for-mail From: Warren Newsgroups: comp.lang.ada Subject: Re: for S'Image use Func?? Date: Thu, 6 May 2010 20:04:07 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Thu, 6 May 2010 20:04:07 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="9f8M0iN5t54V+4DF/iqO8g"; logging-data="17304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XBCWzsLr0wR21qBncIeBVQLMIHc5fYZI=" User-Agent: Xnews/5.04.25 X-Face: &6@]C2>ZS=NM|HE-^zWuryN#Z/2_.s9E|G&~DRi|sav9{E}XQJb*\_>=a5"q]\%A;5}LKP][1mA{gZ,Q!j Cancel-Lock: sha1:pARsgT79hc/GsxYjpI46LwmFguI= Xref: g2news2.google.com comp.lang.ada:11337 Date: 2010-05-06T20:04:07+00:00 List-Id: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= expounded in news:op.vcaqajn0ule2fv@garhos: > Le Thu, 06 May 2010 19:10:20 +0200, Warren a > écrit: > >> I have tried to google for this and have not yet found >> a suitable answer, so I'll troll, er, poll for an >> answer here.. >> >> Is there the ability to substitute your own S'Image >> function? For example, a basic interpreter might >> define: >> >> type LNumber_Type is range 0..99_999; >> >> Can I declare.. >> >> for LNumber_Type'Image use LNumber_To_String; > However, it later says: > > [ARM 2005 13.3 (5/1)] > An attribute_designator is allowed in an attribute_definition_clause > only if this International Standard explicitly allows it ... > Finally, it should be checked if Image is explicitely allowed as an > attribute designator for an operational clause (I may check later to > give you a more formal answer to this one question). As others have suggested, probably not, or at best on an implementation basis only. At best, this suggests that this approach is unportable. >> Finally, there is actually a third question- more along >> the lines of "Should this language feature be used >> in this manner?", or is it preferable to just code your >> own along the lines of (which is what I presently use): >> >> function To_String(LNO : LNumber_Type) return String; > I would say, it is more handy to define a function, because a function > would be able to hold the exact formatting parameter your application > requires, it would be able to hold the exact optional defaults for > those parameters and it would better integrates with the overall > general design of an Ada application, that, “withing” package and > using renames clause. Using attribute, you are require to always use > thye type name as a prefix for such things as ’Image. True, but in my case I just needed the leading zeros, sans any sign: 900 to be displayed as "00900" (vs " 900"). > All of this providing I've understood what you were requesting for. Yep, you got it. Warren