comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: Abusing tagged types
Date: Fri, 28 Nov 2008 15:35:43 +0100
Date: 2008-11-28T15:35:43+01:00	[thread overview]
Message-ID: <7kvogg.8dj.ln@hunter.axlog.fr> (raw)
In-Reply-To: <7cca32f3-0815-4564-b83a-d19a0e59b8ab@l42g2000yqe.googlegroups.com>

Maciej Sobczak a �crit :
> 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?
One of the nice things in Ada is the ability to make a difference 
between a method and a subprogram (and yes, I'm afraid about the new 
generation of programmers who know only classes as unit of 
modularization, and call every subprogram a method).

IMHO, the term method should be reserved to operations that have a 
general semantics, but whose implementation (the way of doing the thing 
- the /method/ for doing the thing) depends on the type to which it 
applies. Methods make sense only in the presence of dynamic dispatching, 
i.e. the ability to tell an object: "do this your own way".

O.M notation stresses this by making clearer that a method is applied to 
a given object. Although subprograms may have a parameter of a 
non-tagged type which is in some sense distinguished, they are not 
methods by my definition, and I would not favour using that notation (to 
be honnest, I've never been a great fan of the O.M notation in any case 
- it is misleading if you have more than one controlling operand, which 
is a great superiority of Ada over other OO languages).

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



      parent reply	other threads:[~2008-11-28 14:35 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
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 [this message]
replies disabled

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