comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function.
Date: Sat, 30 Mar 2013 15:51:52 +0000
Date: 2013-03-30T15:51:52+00:00	[thread overview]
Message-ID: <ly6208j36v.fsf@pushface.org> (raw)
In-Reply-To: kj5dn6$978$1@munin.nbi.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:

> Perhaps you guys would like to do as you are always griping to others
> and provide a complete enough example to see what you are really
> talking about???

I'm not sure whether this is exactly the same:

generic
   type Attribute_Values is (<>);
package Demo is
   function Text (Item : Character) return String;
private
   function Image (Item : Attribute_Values) return String;
   function Image (Item : Positive) return String;
end Demo;

package body Demo is
   function Text (Item : Character) return String is
   begin
      return Image (Integer (Character'Pos (Item)))
        & " "
        & Image (Positive (Character'Pos (Item)));
   end Text;
   function Image (Item : Attribute_Values) return String is
   begin
      return (1 => Character'Val (Attribute_Values'Pos (Item)));
   end Image;
   function Image (Item : Positive) return String is
   begin
      return Positive'Image (Item);
   end Image;
end Demo;

with Demo;
with Ada.Text_IO; use Ada.Text_IO;
procedure Demo_Main is
   package Integers is new Demo (Attribute_Values => Integer);
begin
   Put_Line (Integers.Text ('a'));
end Demo_Main;

outputs

a 97

where we would have expected

 97 97



  parent reply	other threads:[~2013-03-30 15:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 17:34 Interresting, possibly buggy behavior in GNAT generics w/ expression function Shark8
2013-03-28 18:06 ` Simon Wright
2013-03-28 18:38   ` Shark8
2013-03-30  5:59     ` Stephen Leake
2013-03-30 14:20       ` Shark8
2013-03-29  7:45 ` Simon Wright
2013-03-29 12:27   ` Dmitry A. Kazakov
2013-03-29 14:45     ` Simon Wright
2013-03-29 16:21       ` Dmitry A. Kazakov
2013-03-29 16:43         ` Shark8
2013-03-29 17:43         ` Eryndlia Mavourneen
2013-03-29 17:45           ` Eryndlia Mavourneen
2013-03-29 18:38             ` Simon Wright
2013-03-30  0:56         ` Randy Brukardt
2013-03-30  9:24           ` Dmitry A. Kazakov
2013-04-02  0:52             ` Randy Brukardt
2013-04-02  8:51               ` Dmitry A. Kazakov
2013-04-02 21:59                 ` Randy Brukardt
2013-03-29 14:47   ` Shark8
2013-03-29 14:56     ` Shark8
2013-03-30  1:04   ` Randy Brukardt
2013-03-30  2:36     ` Shark8
2013-03-30 15:51     ` Simon Wright [this message]
2013-04-01 15:58     ` Adam Beneschan
2013-04-02  0:46       ` Randy Brukardt
2013-04-02  8:18         ` Simon Wright
2013-04-02 11:14         ` Stephen Leake
2013-04-02 22:00           ` Randy Brukardt
2013-04-02 23:01             ` Adam Beneschan
2013-04-04  0:08               ` Randy Brukardt
2013-03-29 14:47 ` Simon Wright
2013-03-29 14:54   ` Shark8
2013-03-29 15:26     ` Bill Findlay
2013-03-29 15:48     ` Simon Wright
replies disabled

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