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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9aae240c681f9f62,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!y38g2000hsy.googlegroups.com!not-for-mail From: Eric Hughes Newsgroups: comp.lang.ada Subject: Defect with formal package parameters Date: Thu, 19 Jun 2008 08:14:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: <78a72b57-bd9f-45b1-bd6c-65bc855cb831@y38g2000hsy.googlegroups.com> NNTP-Posting-Host: 166.70.57.218 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1213888455 17610 127.0.0.1 (19 Jun 2008 15:14:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 19 Jun 2008 15:14:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y38g2000hsy.googlegroups.com; posting-host=166.70.57.218; posting-account=5RIiTwoAAACt_Eu87gmPAJMoMTeMz-rn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:769 Date: 2008-06-19T08:14:15-07:00 List-Id: GNAT 2008 (just installed) fails to compile the following example, which was cut down from existing code to isolate the problem. This is the error message. > foo.ada-spec:16:34: actual for "Operation" in actual instance does not match formal Changing the syntax to eliminate "others =>", which is what the commented-out line does, allows the example to compile without error. Unfortunately, that's not a viable workaround, because the real code requires named parameters. At present I am assuming this is a defect with GNAT 2008 rather than with the Ada 2005 language definition. I had the identical problem with GNAT 2007. I had stopped development back then, a few months ago, in the apparently-misplaced hope that a new compiler version would fix this. I should point out, for those without significant experience in generic programming, that this defect completely blocks a huge class of generic layering techniques that are primarily of interest to library authors. Code that does not admit significant reconfiguration does not require this technique. Eric ======================================================= package Foo is pragma Elaborate_Body( Foo ) ; generic with procedure Operation is <> ; package Signature is end ; procedure Operation_Actual is null ; package Impl is new Signature( Operation => Operation_Actual ) ; generic with package S is new Signature( others => <> ) ; -- with package S is new Signature( <> ) ; package Module is end ; package M is new Module( S => Impl ) ; end ; =======================================================