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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9544fb5ce0a6df8b,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.36.6 with SMTP id m6mr17500443pbj.4.1322349539039; Sat, 26 Nov 2011 15:18:59 -0800 (PST) Path: lh20ni21816pbb.0!nntp.google.com!news2.google.com!postnews.google.com!s6g2000vbc.googlegroups.com!not-for-mail From: Matt Borchers Newsgroups: comp.lang.ada Subject: Overloading attributes Date: Sat, 26 Nov 2011 15:13:17 -0800 (PST) Organization: http://groups.google.com Message-ID: <8ed87fee-166a-4be9-ae6c-4d0fbeb4788c@s6g2000vbc.googlegroups.com> NNTP-Posting-Host: 98.216.120.213 Mime-Version: 1.0 X-Trace: posting.google.com 1322349538 17754 127.0.0.1 (26 Nov 2011 23:18:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 26 Nov 2011 23:18:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s6g2000vbc.googlegroups.com; posting-host=98.216.120.213; posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA- User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe) Xref: news2.google.com comp.lang.ada:14668 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-26T15:13:17-08:00 List-Id: Why is it that one cannot overload the 'Image and 'Value attribute similar to how we can overload 'Input, 'Output, 'Read, and 'Write? I think it would be nice to be able to do the following: type FOO is ...; function Image( f : FOO ) return String; for FOO'Image use Image; function To_Foo( s : String ) return FOO; for FOO'Value use To_Foo; Is there a reason that this is not allowed? Why limit 'Image and 'Value to only scalar types. Why expose a routine to "stringify" an object through the package specification when a language construct already exists that could do this? I can also imagine how overloading 'Pred and 'Succ would be kinda nice for link list traversals (and possibly other linked structures): type A_FOO is access FOO; --FOO has a field that points to next record via pointer function Succ( f : A_FOO ) return A_FOO; for A_FOO'Succ use Succ; --similar for 'Pred if it is a doubly linked list x : A_FOO; x := x'Succ; Why expose a Next routine through the package specification when a language construct already exists that can do this? How about other Attributes like 'Pos, 'Val, 'First, 'Last, etc? Could they be overloaded on user-defined types?