comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Abusing tagged types
Date: Fri, 28 Nov 2008 05:28:38 -0800 (PST)
Date: 2008-11-28T05:28:38-08:00	[thread overview]
Message-ID: <7cca32f3-0815-4564-b83a-d19a0e59b8ab@l42g2000yqe.googlegroups.com> (raw)
In-Reply-To: 87y6z4cefp.fsf@willow.rfc1149.net

On 28 Lis, 11:50, Samuel Tardieu <s...@rfc1149.net> wrote:

> Maciej> The type can be made tagged *only* to get the syntax sugar.
> Maciej> Is it considered to be an abuse of the language feature?
>
> This will increase the memory size of every instance. Even if no
> dispatching is used the tag will be stored in each object because
> dispatching *could* be used.

Let's say that in this case it does not matter anyway.

I'm asking about the design principles - the *purpose* of tagged type
is to achieve polymorphism with dispatching calls. Is it OK to use
tagged type without this motivation?
(well, Controlled is also in this category...)

By the way - what is the rationale for allowing Obj.Operation only for
tagged types and not for all types? "Ada 2005 Rationale" does not seem
to explain this.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada



  reply	other threads:[~2008-11-28 13:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-28 10:01 Abusing tagged types Maciej Sobczak
2008-11-28 10:50 ` Samuel Tardieu
2008-11-28 13:28   ` Maciej Sobczak [this message]
2008-11-28 14:08     ` Ludovic Brenta
2008-12-01 19:54       ` Adam Beneschan
2008-12-02  4:04         ` Randy Brukardt
2008-11-28 14:35     ` Jean-Pierre Rosen
replies disabled

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