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.51.141 with SMTP id k135mr27464268itk.19.1517500109709; Thu, 01 Feb 2018 07:48:29 -0800 (PST) X-Received: by 10.157.113.80 with SMTP id y16mr109819otj.1.1517500109500; Thu, 01 Feb 2018 07:48:29 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!goblin3!goblin2!goblin.stu.neva.ru!peer01.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no269140ita.0!news-out.google.com!s63ni454itb.0!nntp.google.com!w142no269135ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 1 Feb 2018 07:48:28 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.221.117.6; posting-account=O1Kt4QoAAABKYAjrg-cGai_vZLnN2LEw NNTP-Posting-Host: 193.221.117.6 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: Lionel Draghi Injection-Date: Thu, 01 Feb 2018 15:48:29 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 1777236679 X-Received-Bytes: 3897 Xref: reader02.eternal-september.org comp.lang.ada:50250 Date: 2018-02-01T07:48:28-08:00 List-Id: Le jeudi 1 f=C3=A9vrier 2018 10:56:16 UTC+1, J-P. Rosen a =C3=A9crit=C2=A0: > Le 31/01/2018 =C3=A0 22:11, Lionel Draghi a =C3=A9crit : > > I defaulted EOL to Windows CRLF, because it's seems to work well on > > my Linux box also. But note that it can be overridden when > > instantiating Cursors. I don't now a standard way to get the good > > line terminator. > There is none, for the simple reason that some operating systems have no > physical line terminator. That's why we have a New_Line procedure in > Ada, rather than some special character. >=20 > What I do when I need to return strings that span several lines is to > mark the places with LF; when I need to /print/ these strings, I scan > them and call New_Line at the place of the LF. Good idea to have portable code. =20 In my case, as the function is returning the image string, but isn't in cha= rge of printing it, it would =E2=80=9Cpass the buck=E2=80=9D to the user. I could add an helper Put_Image function, but it's not a totally satisfying= solution anyway. My (maybe na=C3=AFve) view is that we are getting in complex discussions an= d weird code patterns to solve a pretty simple problem. A Text_IO.Line_Terminator function, returning LF or CRLF or a null String f= or those OSes you just mentioned would be a drastic improvement over curren= t situation. Because of exceptional situations, we are depriving most Ada users of a sim= ple solution to a common problem (probably discussed hundred time in cla, a= pproximatively, I didn=E2=80=99t check =EF=81=8A).=20 It would be a OK to specify that this function has a platform dependent sem= antic, that will be specified by implementors (*). Isn=E2=80=99t it already= the case, and for much more complex OS dependent functions? If we can specify a standard Ada.Directories, I can=E2=80=99t imagine Line_= Terminator being a problem! =EF=81=8A=20 In the meantime, I understand from that discussion that I can hardly find a= clean internal solution to this problem. The only clean solution I see, is precisely to =E2=80=9Cpass the bucket=E2= =80=9D on the user side, by removing the default declaration of EOL, and as= king to the user to provide the convenient value.=20 Or to have a separate function, with different possible implementations (on= e being the GNAT dependent proposed by Emmanuel). Lionel (*) : we maybe don't even need to specify that the function shall return LF= on unix family OSes and CRLF on Windows