comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Reemergence of predefined equality operator...
Date: Thu, 1 Aug 2002 14:48:52 GMT
Date: 2002-08-01T14:48:52+00:00	[thread overview]
Message-ID: <wccu1memy7f.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: dstanbro-3A1595.21143801082002@news-server.bigpond.net.au

Dale Stanbrough <dstanbro@bigpond.net.au> writes:

> Wouldn't it be appropriate for Text_IO.Integer_IO, if it wants to be
> sure of the mod operator it is using, to simply specify it?

Well, maybe, but I don't understand your example below.
The parameter of Put is a generic formal type, but you have
written Natural.  If it were Natural, then the reemergence issue
would not arise, and ``item mod 10'' means exactly the same as
``Standard."mod" (item, 10)''.  If it's a generic formal type,
then ``Standard."mod" (item, 10)'' would be illegal.  Either way,
I don't see the point of Standard."mod".

Also, you didn't do anything special for the "<", "+", and "/"
shown below, which have the same issue.

>    procedure put (item : natural) is
>       zero_char : constant := character'pos ('0');
>    begin
>       if item < 10 then
>          put (character'val (item + zero_char));
>       else
>          put (item / 10);
>          put (Standard."mod" (item, 10));
>       end if;
>    end;
> 
> That way if a new mod was imported via a generic parameter it 
> simply wouldn't be used in this case.

A new "mod" is *not* imported by a generic parameter.  The generic
package we're talking about takes the type, and the "mod" we're talking
about is simply the primitive "mod" for that type.  The question is,
inside the generic, should the primitive "mod" be user-defined
if the actual type has one?

> Dale

- Bob



      reply	other threads:[~2002-08-01 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-31 22:25 Reemergence of predefined equality operator Dale Stanbrough
2002-07-31 22:47 ` Robert A Duff
2002-08-01  1:30   ` Vincent Marciante
2002-08-01 12:06     ` Robert Dewar
2002-08-25 17:46       ` Vincent Marciante
2002-08-25 22:04         ` Robert A Duff
2002-08-01 11:14   ` Dale Stanbrough
2002-08-01 14:48     ` Robert A Duff [this message]
replies disabled

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