comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: String_Holder ?
Date: Mon, 19 Dec 2011 14:14:18 +0200
Date: 2011-12-19T14:14:18+02:00	[thread overview]
Message-ID: <9l8o06Fh7jU1@mid.individual.net> (raw)
In-Reply-To: <slrnjessh2.1lme.lithiumcat@sigil.instinctive.eu>

On 11-12-19 01:08 , Natasha Kerensikova wrote:
> Hello,
>
> On 2011-12-18, Jeffrey Carter<spam.jrcarter.not@spam.not.acm.org>  wrote:
>> On 12/18/2011 05:34 AM, Natasha Kerensikova wrote:
>>> type String_Holder is still to be defined;
>>>
>>> function Hold (S : String) return String_Holder;
>>>
>>> function To_String (Holder : String_Holder) return String;
>>>
>>> procedure Query (Holder : String_Holder;
>>>                    Process : not null access procedure (S : String));
>>
>> I see no advantage to this over Unbounded_String.
>
> Mostly having the type named after the function of objects in the
> project rather than characteristics of the objects.

That is a good aim. You can reach it by deriving a type with the name 
you want:

    type Goblin_Name is new Ada.Strings.Unbounded_String;

    type ... is record
       ...
       Goblin : Goblin_Name;
       ...
    end record;

> Also allowing to
> replace it more easily later on with an implementation better suited to
> the function in a particular project, should the need ever arise.

Simple, just change the derivation, one place, one change.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2011-12-19 12:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18 12:34 String_Holder ? Natasha Kerensikova
2011-12-18 16:48 ` Brad Moore
2011-12-18 20:55 ` Jeffrey Carter
2011-12-18 23:08   ` Natasha Kerensikova
2011-12-19 12:14     ` Niklas Holsti [this message]
2011-12-19 11:12 ` Martin
2011-12-19 23:53 ` Randy Brukardt
2011-12-22  9:08   ` Natasha Kerensikova
2011-12-22 10:08     ` Niklas Holsti
2011-12-22 12:23       ` Simon Wright
2011-12-23  1:26       ` Randy Brukardt
2011-12-23  6:18         ` Jeffrey Carter
2011-12-22 11:40     ` AdaMagica
replies disabled

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