comp.lang.ada
 help / color / mirror / Atom feed
From: Lao Xiao Hai <laoxhai@ix.netcom.com>
Subject: Re: Redefined "=" = generic disaster?
Date: Sun, 29 Oct 2000 19:49:01 -0800
Date: 2000-10-30T03:53:10+00:00	[thread overview]
Message-ID: <39FCEFAD.56BE85B1@ix.netcom.com> (raw)
In-Reply-To: 8tecab$epm$1@nnrp1.deja.com



Robert Dewar wrote:

> Please post exact Ada 95 code that works (check it out first)
> and does something you consider unexpected.

Could not resist posting this package specification and body in response

to your challenge Robert.   Before you read it, I admit it is silly to
the
point of being frivolous, but not that far removed from some code that
actually finds its way into some designs.

package Strange_Equality is

   type Strange is private;
   type Grisly  is private;
   type Goulish is private;

   function "=" (G1 : Grisly;  G2 : Goulish) return Strange;

private

  type Strange is range -1..3;
  type Grisly  is (Red, Yellow, Blue);
  type Goulish is digits 7;

end Strange_Equality;

  with the following package body

package body Strange_Equality is

   function "=" (G1 : Grisly;  G2 : Goulish) return Strange is
   begin
      if Grisly'Pos(G1) = Integer(G2) then
         return Grisly'Pos(G1);
      else
         return Strange'First;
      end if;
   end "=";

end Strange_Equality;







  parent reply	other threads:[~2000-10-30  3:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-21  6:59 Redefined "=" = generic disaster? Vincent Marciante
2000-10-21  0:00 ` Jeff Carter
2000-10-21  0:00   ` Vincent Marciante
2000-10-28 11:12     ` Robert Dewar
2000-10-29  8:43       ` Vincent Marciante
2000-10-30  3:49       ` Lao Xiao Hai [this message]
2000-10-30 18:46         ` Robert Dewar
2000-10-31  3:27           ` Lao Xiao Hai
2000-10-31  6:54             ` Vincent Marciante
2000-10-31 19:51             ` Robert Dewar
2000-11-01 17:47               ` Mats Weber
2000-11-02  5:27                 ` Vincent Marciante
2000-11-02 16:52                   ` Mats Weber
2000-11-02 14:59                 ` Tucker Taft
2000-11-05  4:29                   ` Robert Dewar
2000-11-05  4:32                   ` Robert Dewar
2000-11-05  4:26                 ` Robert Dewar
2000-10-21  0:00   ` Vincent Marciante
2000-10-22  2:50     ` Jeff Carter
2000-10-22  0:00       ` Vincent Marciante
replies disabled

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