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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.Ry1GfOCil8z4iThfpbQjlA.user.gioia.aioe.org!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: Ada++ Date: Sat, 13 Jun 2020 04:40:53 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <50711230-5b14-4278-b9d8-d197bbe3c93b@googlegroups.com> <9320040f-5486-4d1e-847d-f81b0a59fcfa@googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: Ry1GfOCil8z4iThfpbQjlA.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:68.0) Gecko/20100101 Thunderbird/68.7.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:59067 Date: 2020-06-13T04:40:53-05:00 List-Id: On 5/29/2020 1:06 AM, J-P. Rosen wrote: > Le 29/05/2020 à 06:38, Nasser M. Abbasi a écrit : >> "Ada has neither heredocs nor multiline strings. A >> workaround is to use containers of strings:" > > Please provide a use case showing how these features are > necessary/important. > I wanted sometime ago to use Ada to generate Latex file on the fly. You might ask, why not use Latex editor? Because this is different. When writing a program to generate the Latex file, then one can do some computation in the program on the fly, and emit the resulting string into the Latex file as it is being composed. This way each time the program is run, a new Latex file is generated, with possible new content each time. This can be much faster/better than having to edit a static Latex file in the Latex editor and update the document manually each time new results are obtained for example, by manually copying some computation result from another program into the Latex document. I do this all the time for example in Mathematica. Each time I update something in the data, I run the program, which generate brand new Latex file, then compile this Latex file to get the new PDF report. Much much faster than editing Latex file each time something new changed. But to do this, one has to be able to write, inside the Ada editor, as if one is using a plain Latex editor, and not worry about having to close strings every 80 characters or so and start new line and having to append each string one by one. It is much better to write large amount of text at once, and having its structure preserved as is. This is what multi-line raw strings allow one to do. It is like writing a program to generate new program. It is not possible to do this in Ada. Well, it is, but it will be very very cumbersome. Here are some very basic examples using Ruby, Perl and C++ https://www.12000.org/my_notes/here_document/index.htm To see an example using Mathematica, used to generate a web page, here is an example https://mathematica.stackexchange.com/questions/152663/making-a-website-with-mathematica it is the second answer there. > In the rare cases where I needed to put a several-lines message into a > single string, I just marked the place of line break with a LF character > (in Ada, you could even use an NUL character for that!), and issued a > New_Line when I encountered it. Anyway, that's what other languages do > implicitely. > > If you don't mind being (slightly) OS dependent, printing the LF will > naturally accompish what you want. > --Nasser