comp.lang.ada
 help / color / mirror / Atom feed
From: madmats@elma.epfl.ch (Mats Weber)
Subject: Overloading of ":="
Date: 20 Dec 88 13:05:01 GMT	[thread overview]
Message-ID: <881220140501.20a00495@elcc.epfl.ch> (raw)


In his message dated 3 Dec 88 21:08:16 GMT, mcvax!enea!sommar@uunet.uu.net
(Erland Sommarskog) writes:

>   Generic
>      Type Data_type is limited private;
>      With procedure Assign(A : in out Data_type;
>                            B : in     Data_type);
>      With function "<"(A, B : Data_type) return boolean is <>;
>      With function ">"(A, B : Data_type) return boolean is <>;
>   Package Binary_trees is
>
>With an overloadable ":=" I could have declared the second parameter as
>
>      With procedure ":="(A : in out Data_type;
>                          B : in     Data_type) is <>;
>
>This would save the user from declaring unnecessary Assign for types like
>integer. This Assign procedure he has to write is simple, but is 100% noise
>to his code.

Instanciating and using this generic package with Standard.Integer (or any
type that does not have a default initial value) is ERRONEOUS because the
formal parameter A of Assign or ":=" is of mode 'in out', hence the
corresponding actual paramter must be an initialized variable.

For more information on this subject, read the paper by Genillard et al.
"Rationale for the Design of Reusable Abstract Data Types Implemented in Ada"
To appear soon in Ada Letters.

Another document that should be read by anyone before even thinking of Ada 9x
language changes is "Rationale for the Design of the Ada Programming Language"
by Ichbiah et al.

Mats Weber
Swiss Federal Institute of Technology
EPFL DI LITh
1015 Lausanne
Switzerland

e-mail : madmats@elma.epfl.ch

             reply	other threads:[~1988-12-20 13:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-12-20 13:05 Mats Weber [this message]
  -- strict thread matches above, loose matches on Subject: below --
1988-12-24 22:02 Overloading of ":=" Erland Sommarskog
1988-12-25 19:27 ` William Thomas Wolfe,2847,
1988-12-26 13:07 Erland Sommarskog
replies disabled

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