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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,92a027c293f03acb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Workqueues in Ada Date: Sat, 28 Jul 2007 20:30:49 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1185669049 31415 192.74.137.71 (29 Jul 2007 00:30:49 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 29 Jul 2007 00:30:49 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:eTWJUA5M9GFDsF3HlIwZ95vEpHQ= Xref: g2news2.google.com comp.lang.ada:1254 Date: 2007-07-28T20:30:49-04:00 List-Id: Wiktor Moskwa writes: > In PragmARC most packages get a limited private generic type (called > Element) as an argument. Above error arises in components' Get functions > that return Element. I presume they are intended to return a COPY of the element, so "limited" doesn't seem appropriate on the formal type. >> Right, this is illegal in Ada 2005. The fix is probably to remove >> "limited" from Element, above, but I'd have to see the actual code to be >> sure. The compiler suggests, "consider switching to return of access >> type", but I think that's bogus. > > It doesn't look easy to port such code to Ada 2005 without removing > "limited". Agreed. It would probably mean switching whole library to use a lot > of access types instead of "implicit passing by reference" which is now. Well, it's just function returns that would have to change, but that would probably be an earthquake. > Nice to hear :) Limited types idea seems quite difficult to me. A limited type is a type where it doesn't make sense to copy objects. >...I don't > understand why limited "in" arguments can be passed by reference to a > procedure but "out" can't All limited parameters are passed (implicitly) by reference. Same for all tagged types. This applies to "in", "out" and "in out". The interesting case (new to Ada 2005) is function returns, which are "build in place" for limited types (except for limited types whose full type is nonlimited). >... (probably because after passing object to > the caller that object can finish its life but it's still fuzzy). > I had lots of problems with tagged types too. I wonder if using > access parameters everywhere is a remedy for all troubles in Ada 2005. No, I think it's better not to use access types "everywhere". - Bob