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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Multiple iterators for a type Date: Sat, 26 May 2018 15:52:14 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <574749990.548999719.627915.laguest-archeia.com@nntp.aioe.org> NNTP-Posting-Host: CvkHMVp693S8Z+lk11jyqg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:52696 Date: 2018-05-26T15:52:14+02:00 List-Id: On 2018-05-26 15:03, Lucretia wrote: > On Saturday, 26 May 2018 07:59:59 UTC+1, Dmitry A. Kazakov wrote: >> On 2018-05-26 05:57, Luke A. Guest wrote: >>> Stephen Leake <> wrote: >>> >>>> An "iterator" can be anything you want it to be. As Randy pointed out, >>>> there can be only one that gets special treatment from the compiler, but >>>> you did not mention that as a requirement. >>>> >>> >>> I’m attempting to implement a Unicode string using UTF-8, so I want the >>> basic iterator over octets, then the next will iterate over the octets and >>> generate code points, then another will be graphème clusters. >> >> Why do you bother? I mean, there is no solution for having a >> user-defined array type in Ada. Iterator is only a small part of it. >> Even if the iterator kludge worked somehow, the rest would not. >> >> Multiple inheritance is not complete either, so having two array >> interfaces for one object will be extremely difficult and uncomfortable. >> You will end up with a mess of helper generic packages to emulate full >> inheritance. [I went that way, there is nothing good there.] >> >> In short, there is nothing useful Ada 20xx could bring to the problem of >> dealing with encoded strings. > > Sorry, didn't understand a word of this wrt to my post. > > We can't have user defined array types in Ada? WTF? There are only built-in arrays in Ada. You cannot have an array ADT providing your array object representation and/or implementation of array operations. > What wouldn't work? Implementation of encoded string with two array views of it, as an array of encoding units and an array of characters/glyphs/code points etc. > How is MI involved here? An encoded string implements two array interfaces. Add here fixed/bounded/unbounded axis and you will have a lot of things to inherit from and export to. You would certainly want to be able to mix all possible combinations of these. > What has Ada 20xx got to do with anything? You can stick to Ada 95. Iterators and interfaces do not help much with encoded strings. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de