From: Yannick Duchêne (Hibou57) on
Le Thu, 10 Jun 2010 08:34:07 +0200, Vadim Godunko <vgodunko(a)gmail.com> a
écrit:
> I want to known more about how to use OOP in Ada without access types!
Wadim, if saying OOP, you meant dynamic dispatching, then you are indeed
not required to use access type for that. Just use class-wide type : an
object whose view is class-wide type, is dispatching. Alternatively and if
needed, you can use a view conversion : if an object is not declared so
that it has a class-wide type view, then you are still allowed to use a
view-conversion expression.

Feel free to ask for, if you need more details or references to the ARM to
read it your-self.

Have a nice day

--
There is even better than a pragma Assert: a SPARK --# check.
--# check C and WhoKnowWhat and YouKnowWho;
--# assert Ada;
-- i.e. forget about previous premises which leads to conclusion
-- and start with new conclusion as premise.
From: AdaMagica on
On 10 Jun., 08:34, Vadim Godunko <vgodu...(a)gmail.com> wrote:
> I want to known more about how to use OOP in Ada without access types!

type Element is tagged ...
subtype Any_Element is Element'Class;

procedure Show (E: Element);

A: Element;
X: Any_Element := Initial_Value;

Show (A); -- no dispatch
Show (X); -- dispatches
Show (Element (X)); -- no dispatch

type Special_Element is new Element with ...;

procedure Handle (S: Special_Element) is
begin
Show (S); -- no dispatch
Show (Any_Element (S)); -- re-dispatch
end Handle;
From: Maciej Sobczak on
On 10 Cze, 08:13, "Randy Brukardt" <ra...(a)rrsoftware.com> wrote:

> >The overly object-oriented style (OOO (tm)) promotes or even relies on
> >overly dynamic memory management model.
> >This naturally leads to Pointers Everywhere Driven Development (PEDD).
>
> Maybe in C++

This is what Martin asked for.
It is possible to go pretty far without using pointers, but it's
enough to introduce at least one factory design pattern and you're
tied.
(but there is more, see below)

The Ada's ability to return unconstrained types from functions is
really good (it allows to initialize class-wide object based on run-
time decisions) and contributes to better handling of OO. This is a
very important difference and I found it illuminating when comparing
OO models in these two languages.

> (Probably copying a crappy design from some other
> language.) There should be almost no visible access types

Well, not so fast. Access types are necessary for referring to
existing objects.
Think about request handlers in AWS, for example - the idea is that
objects are *registered* somewhere for future use. How would you do
that without access types? At least obtaining the 'Access value is
necessary, even if the explicit use of access variables can be
avoided.

A similar idiom is used in YAMI4, where message handlers are instances
of types that derive from common interface:

http://www.inspirel.com/yami4/book/6-2-1.html

I am not aware of any way to support this functionality without access
types.

--
Maciej Sobczak * http://www.inspirel.com

YAMI4 - Messaging Solution for Distributed Systems
http://www.inspirel.com/yami4
From: Vadim Godunko on
On Jun 10, 10:54 am, Yannick Duchêne (Hibou57)
<yannick_duch...(a)yahoo.fr> wrote:
> Le Thu, 10 Jun 2010 08:34:07 +0200, Vadim Godunko <vgodu...(a)gmail.com> a  
> écrit:> I want to known more about how to use OOP in Ada without access types!
>
> Wadim, if saying OOP, you meant dynamic dispatching, then you are indeed  
> not required to use access type for that.
No, I more asked for real example where Ada's OOP is be used without
access types in OOP way. The only known example is Tuker's work on
some part of ASIS 05, but from my point of view this work is set of
tricks and assumptions successful for concrete example but not for
general use.
From: Dmitry A. Kazakov on
On Wed, 09 Jun 2010 23:09:52 +0200, Yannick Duchêne (Hibou57) wrote:

> Le Wed, 09 Jun 2010 21:10:06 +0200, Dmitry A. Kazakov
> <mailbox(a)dmitry-kazakov.de> a écrit:
>>> So this should not be a compilation unit and this should be expressed in
>>> the language. Do you think about something at the level of types ?
>>
>> Depends on the intentions. If you render it as a type, then it must be a
>> class-wide one. This is the reason why I believe that generics are
>> superfluous and could be gradually replaced by classes.
>
> What would become formal parameters, like type parameters ?

Base types, class-wide types.

> Overloading
> functions returning type derived from that of the ancestor one ? OK. So,
> this will require an original bas type in the root definition which could
> be wide enough to reach actual capabilities of generics. An “ANY” type
> (like in QBasic) ?

Nope. The element of a stack is not just any type. It is a copyable type
(the class "private" in terms of Ada generics).

> An abstract base type ? OK. So, now, we will need to be
> able to declare abstract base type, that is, abstract discrete types, etc.
> Is that what's in your mind ?

Yes. These are abstract interfaces to be defined. This is an easy part BTW.

>> Depends on the meaning of these.
>
> Just means “pattern” ;) well... pie dish, cake tin, waffle iron, and so on
> (btw, none of these latter requires dynamic typing)

Pattern = design pattern, e.g. "Bridge pattern"?
Pattern = formal language description, e.g. *.adb?
Pattern = dynamic type specification to match?
...
and 100+ types of patterns known in AI and *PATTERN* recognition. (:-))

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de