comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: IBM 437 encoded String to UTF-16 Wide_String
Date: Thu, 29 Nov 2012 22:03:35 +0100
Date: 2012-11-29T22:03:35+01:00	[thread overview]
Message-ID: <e79som8r7ckq$.zetuabh6mk0n$.dlg@40tude.net> (raw)
In-Reply-To: 50b76b9e$0$6572$9b4e6d93@newsspool3.arcor-online.net

On Thu, 29 Nov 2012 15:05:19 +0100, Georg Bauhaus wrote:

> On 29.11.12 11:52, Dmitry A. Kazakov wrote:
>> On Thu, 29 Nov 2012 10:51:27 +0100, Georg Bauhaus wrote:
>> 
>>> - if I want my subprograms to work with different
>>>    types of strings,
>> 
>> type A is new B; -- Ada 83
> 
> type A is new Root_String'Class;  -- not Ada

Rather:

   type My_Incompatible_String is new String; -- Ada 83

Yes, Ada 95 broke that for tagged typed. Presently, the workaround is this:

   type Base is abstract tagged ...;
   -- Define operations to clone here

   type A is new Base with null record;
   type B is new Base with null record;

Now B has the semantics of cloned A.

   type B is new A;

In any case, you cannot clone classes, you should their root types instead.
That will have the effect of cloning the class.

>>> this particular kind of problem can be solved with the help of a
>>> generic formal package that a user of my programs has instantiated,
>> 
>> Egh, which problem?
> 
> That of making a subprograms work with any type of
> string in current Ada.

And how generic container library may help? Generic instances do not
comprise a run-time class, which is their major flaw.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-12-05  3:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 21:02 IBM 437 encoded String to UTF-16 Wide_String gautier_niouzes
2012-11-27 21:38 ` J-P. Rosen
2012-11-27 22:12 ` gautier_niouzes
2012-11-27 22:14 ` Dmitry A. Kazakov
2012-11-27 23:13   ` gautier_niouzes
2012-11-27 23:41 ` Vadim Godunko
2012-11-28  8:34   ` briot.emmanuel
2012-11-28  8:52     ` Dmitry A. Kazakov
2012-11-28  9:43       ` Georg Bauhaus
2012-11-28  9:58         ` Dmitry A. Kazakov
2012-11-28 11:31           ` Georg Bauhaus
2012-11-28 13:36             ` Dmitry A. Kazakov
2012-11-28 13:47               ` Georg Bauhaus
2012-11-28 14:23                 ` Dmitry A. Kazakov
2012-11-28 17:35                   ` Georg Bauhaus
2012-11-28 18:00                     ` Dmitry A. Kazakov
2012-11-29  9:51                       ` Georg Bauhaus
2012-11-29 10:52                         ` Dmitry A. Kazakov
2012-11-29 14:05                           ` Georg Bauhaus
2012-11-29 21:03                             ` Dmitry A. Kazakov [this message]
2012-11-29  3:18             ` Randy Brukardt
2012-11-28 13:51     ` gautier_niouzes
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox