From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec14cedca2cdf8ac,start X-Google-Attributes: gid103376,public From: nobody@REPLAY.COM (Anonymous) Subject: Why isn't this ambiguous? Date: 1997/08/01 Message-ID: <199708011539.RAA04612@basement.replay.com>#1/1 X-Deja-AN: 261322445 X-001: Replay may or may not approve of the content of this posting X-002: Report misuse of this automated service to X-URL: http://www.replay.com/remailer/ Organization: Replay and Company UnLimited Mail-To-News-Contact: postmaster@nym.alias.net Newsgroups: comp.lang.ada Date: 1997-08-01T00:00:00+00:00 List-Id: Here's some code: with Ada.Text_Io; use Ada; procedure F_Test is subtype I_Num is Integer range 1 .. 5; subtype O_Num is Integer range 0 .. 99_999; function Image (I : I_Num) return Character is Img : constant String := Integer'Image (I); begin Text_Io.Put_Line ("This is Image 1"); return Img (Img'Last); end Image; function Make (I : I_Num; O : O_Num) return String is function Image (O : O_Num) return String is Img : String := Integer'Image (O); begin Text_Io.Put_Line ("This is Image 2"); Img (Img'First) := '0'; end Image; function Make (I : I_Num; O : O_Num) return String is function Image (O : O_Num) return String is Img : String := Integer'Image (O); begin Text_Io.Put_Line ("This is Image 2"); Img (Img'First) := '0'; if Img'Length > 5 then return Img (Img'First + 1 .. Img'Last); end if; return (1 .. 5 - Img'Length => '0') & Img; end Image; begin return Image (I) & '_' & Image (O); end Make; begin Text_Io.Put_Line (Make (2, 1) ); Text_Io.Put_Line (Make (3, 1_000) ); end F_Test; With GNAT 3.07/Solaris/Sparc and 3.09/Linux/Pentium, this compiles and produces this output: This is Image 1 This is Image 1 2_1 This is Image 1 raised CONSTRAINT_ERROR I expected the calls to Image to be ambiguous, but GNAT has chosen the one that returns Character. Anyone able to provide insight? Jeff Carter PGP:1024/440FBE21 My real e-mail address: ( carter @ innocon . com ) "I blow my nose on you." Monty Python & the Holy Grail Posted with Spam Hater - see http://www.compulink.co.uk/~net-services/spam/