comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,)
Subject: Re: Ada Language Change: Assignment Overloading
Date: 23 Nov 88 22:57:59 GMT	[thread overview]
Message-ID: <3657@hubcap.UUCP> (raw)
In-Reply-To: 8811221935.AA21274@grebyn.com

From article <8811221935.AA21274@grebyn.com>, by karl@grebyn.com (Karl Nyberg):
> From: mendal@sierra.stanford.edu (Geoff Mendal)
> 
> 1. Why simply restrict it to assignment?  Why not include membership,
>    short-circuit control forms, indexing, selection, attributes, etc.?
>    These are all basic operations.  I can think of many applications
>    for overloading membership instead of having to write a function.
>    Likewise, I can think of applications where an overloading of indexing
>    would make my code more readable.  How I would love to be able to
>    define my own attributes and use the attribute notation.  The point
>    is that there is nothing special about assignment.  Therefore, it
>    seems to me short-sighted to exclude other basic operations from the
>    overloading status discussion.

   First, assignment is a "fundamental" operation; except for attributes,
   the other things you've suggested apply only to specific classes of
   ADTs.  As for attributes, I think we could live without them if 
   appropriate procedures and functions were defined over the predefined
   ADTs; having attributes for predefined ADTs and functions for user-defined
   ADTs is another inconsistency.  Procedures and functions are definitely
   necessary; the attribute mechanism is not.

   Now another aspect of this problem is the principle that users should
   be able to define ADTs which are just as powerful as the predefined
   ADTs; obviously, this is not presently the case with Ada.  With regard
   to attributes, I think elimination of the feature will bring Ada into
   compliance with this principle, and result in general simplification.

   Another reason is that assignment procedures need to be invoked as part
   of the evaluation of a user-defined ADT which is passed by value.  No
   similarly vital function is performed by the other operations suggested.

   The argument that the operations listed (except assignment and attributes)
   should be user-programmable with respect to user-defined ADTs is reasonable,
   but clearly assignment is in a higher class of importance than the others.

> 4. Finally, what would an overloading of assignment look like?  Would
>    one parameter have to be mode in and the other mode out?  What about
>    mode in out?  What about side effects?  Would it be a function or
>    a procedure, or both?  

   procedure ":=" (FIRST_OBJECT  : in out TYPE;
                   SECOND_OBJECT : in     TYPE);

   would seem appropriate.

  parent reply	other threads:[~1988-11-23 22:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-11-22 19:35 Ada Language Change: Assignment Overloading Karl Nyberg
1988-11-23 12:36 ` Stephe Leake
1988-11-23 19:13 ` Ray Trent
1988-11-23 22:57 ` William Thomas Wolfe,2847, [this message]
1988-11-24  2:16   ` William Thomas Wolfe,2847,
1988-11-24  1:55 ` William Thomas Wolfe,2847,
replies disabled

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