From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: limited types (Was: Records that could be arrays)
Date: Mon, 27 Feb 2006 22:40:18 +0100
Date: 2006-02-27T22:39:33+01:00 [thread overview]
Message-ID: <44037195$0$13798$9b4e6d93@newsread4.arcor-online.net> (raw)
In-Reply-To: <1dd53t0syyc1z.1ety6xoat1ce5$.dlg@40tude.net>
Dmitry A. Kazakov wrote:
> 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.
But then wouldn't you again be mixing apples and herrings?
type APPLE_CONTAINER is new CONTAINER with null record;
-- specializes in apples, only
type HERRING_CONTAINER is new CONTAINER with null record;
-- specializes in herrings, only
x: access CONTAINER'class := ...;
x.insert(an_apple); -- right or wrong? compile time?
> 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,
In fact, herrings with little pieces of apple aren't
that unusual, add onions and mayonnaise and you are
almost set - not everyone's taste, maybe. :-) Seriously,
wouldn't type-forcing containers be in the way of
composition?
How do you make a vector of doughnuts with different
toppings? Something like
zip(doughnuts.first, toppings.first);
seems reasonable to me.
next prev parent reply other threads:[~2006-02-27 21:40 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
2006-02-27 21:40 ` Georg Bauhaus [this message]
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