From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Limited_Controlled and constructor functions
Date: Fri, 19 Jan 2007 15:33:06 +0100
Date: 2007-01-19T15:33:06+01:00 [thread overview]
Message-ID: <1qu3xfyfc024$.phvronbnfx6j.dlg@40tude.net> (raw)
In-Reply-To: eoqi2o$frt$1@cernne03.cern.ch
On Fri, 19 Jan 2007 14:45:59 +0100, Maciej Sobczak wrote:
> Dmitry A. Kazakov wrote:
>> On Fri, 19 Jan 2007 08:58:54 +0100, Maciej Sobczak wrote:
>>
>>> What I want to accomplish is the functional way of building lists of
>>> values of variant types:
>>>
>>> P : constant Params := Make_Params(Param("Hello"),
>>> Param("Ada"),
>>> Param(12),
>>> Param(3.14)));
>>
>> Hmm, but should the parameters and containers of be limited types?
>
> Probably not, but...
>
>> I find it rather natural to be able to copy parameter(s)
>
> ... I don't like to overengineer things in anticipation of usage
> patterns that actually might never happen. I prefer to forbid it and
> wait until it's asked for.
But you used ":=", which was (no matter what RM says (:-)) a primitive
operation undefined for limited types. Prior Ada 2005 it was, now, ":=" in
declarations has a different meaning than in statements...
> In C++ it's two lines of code or even half:
>
> class MyClass : boost::noncopyable
> ...
Huh, C++ has even weaker means to describe formal types contracts. It has
dire <class T>. In Ada there is limited, tagged, range <> etc. Far too
weak, IMO, but still better than C++.
Anyway, there must be a reason why you wanted to have a compound parameters
object rather than to specify them directly in the factory function. You
didn't say what was the goal. To have an abstract factory? I have a
suspicion that it wouldn't work anyway. BTW, you could try streams and
getting the object directly from the stream instead.
> > send them over IP...
>
> Then we're talking about serialization.
Egh, no, serialization is ordering in time. To be able to copy is about
lack of identity and memory-isotropy.
> Limited types don't forbid it.
Limited types is a kludge. There should be a simpler and clearer way to say
that the thingy has no visible compiler-generated copy constructor, no
equality, no aggregates, no assignment (in Ada 95). All these are just
primitive operations or parts of.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-01-19 14:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-18 9:51 Limited_Controlled and constructor functions Maciej Sobczak
2007-01-18 12:13 ` AW: " Grein, Christoph (Fa. ESG)
2007-01-18 16:41 ` Robert A Duff
2007-01-19 7:58 ` Maciej Sobczak
2007-01-19 9:41 ` Dmitry A. Kazakov
2007-01-19 13:45 ` Maciej Sobczak
2007-01-19 14:33 ` Dmitry A. Kazakov [this message]
2007-01-22 8:59 ` Maciej Sobczak
2007-01-20 17:09 ` Gautier
2007-01-20 19:39 ` Gautier
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox