comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Operators Questions
Date: 1996/10/30
Date: 1996-10-30T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023180003010961903550001@news.ni.net> (raw)
In-Reply-To: 3275D478.5952@eurocontrol.fr


In article <3275D478.5952@eurocontrol.fr>, Richard Irvine
<Richard.Irvine@eurocontrol.fr> wrote:

Put this on my wish list for the next revision of the language: the ability
to overload the membership operator "in".  That way I can say

generic
   type T is private;
package Sets is

   type Set is private;

   function "in" (Left : T, Right : Set) return Boolean;
...
end;

package Integer_Sets is new Sets (Integer);
subtype Integer_Set is Integer_Sets.Set;
use Integer_Sets;

   The_Set : Integer_Set;
begin
   ...
   if 4 in The_Set then
      ...


I think that that's much hipper than

   if Is_Member_Of (The_Set, Item => 4) then
      ...

But of course your mileage may vary.  

Language designers: any reason overloading of "in" is too difficult for
inclusion in the language?  Why can't you do this already?  This exclusion
of the ability to overload "in" seems rather odd and unexpected.

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
mheaney@ni.net
(818) 985-1271




  parent reply	other threads:[~1996-10-30  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-29  0:00 Operators Questions Richard Irvine
1996-10-29  0:00 ` Norman H. Cohen
1996-11-07  0:00   ` William Frye
1996-10-29  0:00 ` Robert Dewar
1996-10-30  0:00 ` Fergus Henderson
1996-10-30  0:00 ` Matthew Heaney [this message]
1996-10-31  0:00   ` Michael F Brenner
1996-10-31  0:00   ` Adam Beneschan
1996-10-31  0:00 ` Jon S Anthony
1996-10-31  0:00   ` Adam Beneschan
1996-11-02  0:00   ` Robert Dewar
1996-11-02  0:00 ` Jon S Anthony
1996-11-05  0:00 ` Jon S Anthony
replies disabled

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