On Tue, 2014-07-22 at 21:48 -0700, Jim Lewis wrote: > If we do not support arbitrary sized composites, then where do we stop? > > Currently we stopped before we implemented write and to_string for > integer_vector, real_vector, ... I am really missing these. So why > not try to generalize a solution and allow overloading to clean up any > issues introduced. > > In 2008 we committed to the to_string route since it is overloaded. It > is too bad there are differences between 'image and to_string for > character as otherwise, it would be interesting to merge the two and > have 'image to implicitly call to_string (explicit version if it exists > or otherwise the implicit one). Would it be horrible to have > character'image('A') return a string containing A without the single > quotes? There is a precedent in Ada for attaching user-written functions to implement attributes - but not specifically the 'image attribute, through the syntax "for <type'attribute> use <function>". Then the user-provided function replaces the default implementation. Where this is used in Ada is with the stream I/O attributes 'read and 'write (ditto 'input and 'output) allowing you to stream arbitrary objects to/from file, and to switch between different file formats by evaluating the "for ... use" clauses. Can be a little tricky to set up but works really well. Then you could have character'image('A') work any way you want. Caveat: I have not studied the details or looked at the AIs to see if this was also considered for 'image and 'value, and (if so) what the issues were, but I would be surprised if it hadn't been given some consideration. - Brian -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Jul 23 00:55:35 2014
This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 00:55:42 PDT