Re: limited types (Was: Records that could be arrays)
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 21:21:08 +0100
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
.
- Follow-Ups:
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Georg Bauhaus
- Re: limited types (Was: Records that could be arrays)
- References:
- limited types (Was: Records that could be arrays)
- From: Thierry Bernier
- Re: limited types (Was: Records that could be arrays)
- From: Randy Brukardt
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Georg Bauhaus
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- limited types (Was: Records that could be arrays)
- Prev by Date: Re: OT: Re: help with include and library files in GPS
- Next by Date: Re: limited types (Was: Records that could be arrays)
- Previous by thread: Re: limited types (Was: Records that could be arrays)
- Next by thread: Re: limited types (Was: Records that could be arrays)
- Index(es):
Relevant Pages
|
|