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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.26.8 with SMTP id 8mr23039449iti.27.1517383638251; Tue, 30 Jan 2018 23:27:18 -0800 (PST) X-Received: by 10.157.3.6 with SMTP id 6mr291323otv.3.1517383637250; Tue, 30 Jan 2018 23:27:17 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no1558851ita.0!news-out.google.com!b73ni6035ita.0!nntp.google.com!g80no1552354itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 30 Jan 2018 23:27:17 -0800 (PST) In-Reply-To: <575826a1-c983-49aa-95e2-54048f6b7b5b@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=176.130.29.212; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH NNTP-Posting-Host: 176.130.29.212 References: <575826a1-c983-49aa-95e2-54048f6b7b5b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: [ANN] List_Image v0.2.0 From: briot.emmanuel@gmail.com Injection-Date: Wed, 31 Jan 2018 07:27:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3593 X-Received-Body-CRC: 1965255318 Xref: reader02.eternal-september.org comp.lang.ada:50221 Date: 2018-01-30T23:27:17-08:00 List-Id: > List_Image is a small helper to print the content of Ada predefined conta= iners, available here : https://github.com/LionelDraghi/List_Image Nice ! And well documented :-) When I started on the traits containers, I was hoping to create a library o= f common signature packages that could be reused and built upon in various = libraries. Perhaps we could get started on that. I must admit I never thought of the `Image_Style` traits, but they definite= ly fit very well. Some comments on the code: * EOL should be defined different when on Windows. I used to test whether= the GNAT.OS_Lib.Directory_Separator is '\', perhaps there's a better way n= owadays. For sure, a "Is_Windows" constant would be useful somewhere. EOL : constant String :=3D (if Is_Windows then ASCII.CR & ASCII.LF els= e ASCII.LF); * Cursors_SIgnature is what I was calling a Forward_Cursor in the traits = containers. So there's some code sharing to be done here :-) However, the p= rofile of Has_Element and Next, in my case, was also receiving the containe= r as a parameter, so that they could be compatible with the formal containe= rs distributed with GNAT, and used in SPARK. It is easy to ignore that extr= a parameter for the standard Ada containers, but not possible to invent it = if not given. For some reason, I was also passing No_Element and "=3D", but without looki= ng at the code in more details, my first thought now is that these should n= ot be there, so your approach is lighter and likely better. * It would be more efficient to use GNATCOLL.Strings instead of Unbounded= _Strings (a lot more effort was done for performance there), but then it ad= ds a dependency on a third party library. GNATCOLL.Strings is also using so= me kind of traits-based approach (and I have a version locally that uses tr= aits to decide whether to use atomic counters, non-atomic counters, or no c= ounter at all (and thus no copy-on-write). Again in the spirit of sharing= a signature-based library somewhere By the way, using 'Tmp :=3D Tmp & "...";' is inefficient compared to '= Append (Tmp, "...")` so I would recommend the latter. * I see you finally gave up on using the iterable as formal parameters. = I also had very limited success with that. As a result, the generic algorit= hms have to be written using explicit cursors, but since they are reused ea= sily, that's not such an issue.