comp.lang.ada
 help / color / mirror / Atom feed
From: "Rego, P." <pvrego@gmail.com>
Cc: mailbox@dmitry-kazakov.de
Subject: Re: Constructors with multiple inheritance
Date: Fri, 30 Sep 2011 07:04:24 -0700 (PDT)
Date: 2011-09-30T07:04:24-07:00	[thread overview]
Message-ID: <23774546.1654.1317391464047.JavaMail.geo-discussion-forums@yqnk41> (raw)
In-Reply-To: <2pu3h5hqltxi$.ze4yrf1f2y8z.dlg@40tude.net>

> > Yes, I agree. But that's the point. I want to reserve the address (so I
> > can build my queues from there).
> 
> The problem is not the result, but the argument of Construct.

Ok. But did not understand the problem if the argument is null.
 
> > It works (and the current code utilizes this approach), but I cannot name
> > it a method,
> 
> "method" is not an Ada term, but from the OO point of view Construct is a
> method, because it is covariant in the result.

I don't think "method" is a term owned by any language, the concept is outside of the language implementation. But, whatever. So if I inherit a class which have a method defined in the "function Construct return Parent_Class_Ptr" form instead of the "function Construct (Obj : Parent_Class) return Parent_Class_Ptr" it behaves the same manner? I.e., the childs have full access to the methods and can even override them? 

> > since I cannot call the funtion from inside the class, using
> > something like Object.Method.
> 
> X.Op is just a syntactic sugar for Op (X). It has nothing to do with an
> operation being a method or not, except that in Ada the sugar is allowed
> only for certain types of methods, rather than universally.
> 
> (The operation Op is a method of the type T in one of its arguments or the
> result, when the type of that argument or result is T and Op is covariant
> in it.)
> > So I need to fix the
> > package.function_constructor call and use a call of type
> > object.method_constructor.
> 
> Why?

Well, the prefixed notation if I understood well was made exactly for filling this. For me it's not just sugar, since I use it frequently. I can even cite the Rationale for Ada 2005 pg. 33, "the Ada 95 object oriented model has been criticized for not being really OO since the notation for applying a subprogram (method) to an object emphasizes the subprogram and not the object.". So that's why I try not to use the package.function approach, and one of the premisses of using the prefixed notation is "Y is the first parameter of Op".
 
> What is wrong with the abstract factory pattern?

Nothing wrong. I'm not questioning this.



  reply	other threads:[~2011-09-30 14:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29 19:40 Constructors with multiple inheritance Rego, P.
2011-09-29 20:20 ` Dmitry A. Kazakov
2011-09-30  3:11   ` Rego, P.
2011-09-30  7:36     ` Dmitry A. Kazakov
2011-09-30 14:04       ` Rego, P. [this message]
2011-09-30 16:29         ` Robert A Duff
2011-09-30 19:14           ` Rego, P.
2011-09-30 16:42         ` Dmitry A. Kazakov
2011-09-30 19:42           ` Rego, P.
2011-10-06 12:46             ` Julian Leyh
2011-11-09  2:24           ` Rego, P.
2011-11-09  8:39             ` Dmitry A. Kazakov
2011-11-10  3:47               ` Rego, P.
2011-11-10  7:09                 ` AdaMagica
2011-11-10  7:20                   ` AdaMagica
2011-11-10  8:35                   ` Dmitry A. Kazakov
2011-11-12 15:16                     ` Rego, P.
2011-11-12 15:30                   ` Rego, P.
2011-11-12 16:28                     ` Dmitry A. Kazakov
2011-11-12 17:41                       ` Rego, P.
2011-11-10  8:33                 ` Simon Wright
2011-11-10  9:01                 ` Georg Bauhaus
2011-11-10  9:09                   ` Georg Bauhaus
2011-11-10 18:16                 ` Jeffrey Carter
2011-11-10 19:39                   ` Dmitry A. Kazakov
2011-11-09  9:00             ` Simon Wright
2011-11-10  3:54               ` Rego, P.
2011-10-07  0:08 ` Shark8
replies disabled

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