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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: container cursor type cannot be tagged Date: Thu, 28 Aug 2014 14:21:35 -0500 Message-ID: <85ppfkxvwg.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) Cancel-Lock: sha1:1MsXSQWD1S81i9PIesTvndJ6SVg= MIME-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 7f46453ff8146e3fb833032348 X-Received-Bytes: 1777 X-Received-Body-CRC: 707837917 Xref: news.eternal-september.org comp.lang.ada:21958 Date: 2014-08-28T14:21:35-05:00 List-Id: In trying to build my own container package, I ran into a problem; the Cursor type cannot be tagged. Which means we can't use "Cursor.op" notation, which I've grown to really like. The reason it can't be tagged is these two functions defined by Ada.Iterator_Interfaces (and similar ones for reverse iteration): overriding function First (Object : Iterator) return Cursor; overriding function Next (Object : Iterator; Position : Cursor) return Cursor; Iterator is a tagged type, so Cursor can't be; Ada 2012 doesn't support dispatching on multiple tagged types (LRM 3.9.3 12). One solution to this is to define a new aspect Controlling_Type: overriding function First (Object : Iterator) return Cursor with Controlling_Type => Iterator; which says to not use Cursor to dispatch calls to this subprogram. That would be useful in other similar situations. I didn't find an AI on this issue; would this be worth a proposal? Another solution would be to provide another version of Ada.Iterator_Interfaces, where Cursor is explicitly tagged, and these functions use Cursor'Class. That seems more of a kludge. -- -- Stephe