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: a07f3367d7,268e52cd81f7181c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!postnews.google.com!26g2000yqv.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: GNAT bug - still in 2010? Date: Sun, 31 Oct 2010 14:24:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1c7d78b4-71fc-4c39-99a3-f9dca111b335@26g2000yqv.googlegroups.com> References: <6cebf1a3-3b2a-4e79-a39e-669a6a5ca00c@l20g2000yqm.googlegroups.com> NNTP-Posting-Host: 85.1.63.81 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288560266 19221 127.0.0.1 (31 Oct 2010 21:24:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 31 Oct 2010 21:24:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 26g2000yqv.googlegroups.com; posting-host=85.1.63.81; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15073 Date: 2010-10-31T14:24:26-07:00 List-Id: On 27 Pa=C5=BA, 21:43, Maciej Sobczak wrote: > I thought that it might be possible to work around the problem with a > mix-in - that is, instead of deriving the protected type from > interface, move the interface down as a component of the protected > type. I will answer myself. Yes, it is possible and this is what I did. The only problems were: 1. I have immediately run into another compiler bug due to the fact that the name of the protected type cannot be used with 'Access, like here: > =C2=A0 =C2=A0protected type My_Protected is > =C2=A0 =C2=A0 =C2=A0 procedure Do_Something; > =C2=A0 =C2=A0private > =C2=A0 =C2=A0 =C2=A0 Mixin : My_Interface_Mixin (My_Protected'Access); -= - bang! > =C2=A0 =C2=A0end My_Protected; This bug seems to be already fixed in newer compilers, so I will not report it. 2. I have defined the protected type and the mixin in two separate packages. This required "limited with" for the package where the protected type was defined, which does not work, as the compiler does not see the protected type: -- a.ads package A is protected type PT is end PT; end A; -- b.ads limited with A; package B is type PT_Ptr is access PT; -- "PT" is undefined end B; This compiler bug also seems to be fixed in newer versions, so I will not report it. I have solved both problems by passing System.Address around to completely hide dependencies between packages and doing conversions to recover the original type. It is a hack from hell, but until proper compilers will become more widely used, I keep it as a valid solution. Of course, I will welcome all other suggestions. -- Maciej Sobczak * http://www.inspirel.com