comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: limited types (Was: Records that could be arrays)
Date: Mon, 27 Feb 2006 21:21:08 +0100
Date: 2006-02-27T21:20:55+01:00	[thread overview]
Message-ID: <1dd53t0syyc1z.1ety6xoat1ce5$.dlg@40tude.net> (raw)
In-Reply-To: 1141059143.617291.39980@i40g2000cwc.googlegroups.com

On 27 Feb 2006 08:52:23 -0800, Matthew Heaney wrote:

> Dmitry A. Kazakov wrote:
>>
>> 1. Passing as a parameter
> 
> Just pass a cursor:

I don't see how a constraint imposed on elements can propagate to the
cursor.

The question Georg asked was: where typed containers of elements of related
types might themselves appear related. The number of cases is huge.
Generics fundamentally cannot help here, they aren't dynamically
polymorphic. Whatever you do, the polymorphism can come only from outside,
like in the case of a tagged formal parameter, or as a type inheritance in
the declarative part of a generic package. So generics are completely
irrelevant to the discussion about the design of constructors and the types
system.

>> 2. Copying
> 
> while (Has_Element (C) loop
>   Put_Element_Somewhere (Element (C);
> end loop;

It is dynamic typing. The constraint check would happen at run-time. Too
late. You just have tossed a stinking herring in a jug apple cider...

>> 3. Merging
> 
> You'll need to define a relational operator over your element type, but
> then you can say:
> 
> Merge (C1.First, C2.First);

Same as above. I don't mix herrings and apples, because barrels and boxes
never meet in the production line. But they can on a container ship. And
their elements do in someone's stomach.

>> 4. Slicing
> 
> Just use a cursor pair:
> 
> Do_Something (C1, C2);  -- half-open range

Huh, what about a submatrix? The main diagonal of? And, BTW, I don't do
anything I want to get a new container.

[...]
> Do_Something (C1, C2);
> Compare (C1, C2);

Same as above.

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



  reply	other threads:[~2006-02-27 20:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 16:51 limited types (Was: Records that could be arrays) Thierry Bernier
2006-02-24 21:57 ` Randy Brukardt
2006-02-25  2:21   ` Matthew Heaney
2006-02-25  3:38     ` Matthew Heaney
2006-02-25 11:06   ` Dmitry A. Kazakov
2006-02-25 15:05     ` Matthew Heaney
2006-02-26  1:01       ` Randy Brukardt
2006-02-26  9:00       ` Dmitry A. Kazakov
2006-02-26 18:20         ` Matthew Heaney
2006-02-26 20:52           ` Dmitry A. Kazakov
2006-02-26 22:07             ` Matthew Heaney
2006-02-27  9:11               ` Dmitry A. Kazakov
2006-02-27 14:34                 ` Georg Bauhaus
2006-02-27 16:05                   ` Dmitry A. Kazakov
2006-02-27 16:52                     ` Matthew Heaney
2006-02-27 20:21                       ` Dmitry A. Kazakov [this message]
2006-02-27 21:40                         ` Georg Bauhaus
2006-02-28  9:38                           ` Dmitry A. Kazakov
2006-02-27 23:00                         ` Matthew Heaney
2006-02-28  9:39                           ` Dmitry A. Kazakov
2006-02-28 17:24                             ` Matthew Heaney
2006-02-28 19:06                               ` Dmitry A. Kazakov
2006-02-28 19:58                                 ` Matthew Heaney
2006-02-28 21:03                                   ` Dmitry A. Kazakov
2006-02-28 21:51                                   ` limited types Simon Wright
2006-03-01  1:59                                     ` Matthew Heaney
replies disabled

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