comp.lang.ada
 help / color / mirror / Atom feed
* is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada?
@ 2015-07-10 17:00 Nasser M. Abbasi
  2015-07-10 17:18 ` David Botton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nasser M. Abbasi @ 2015-07-10 17:00 UTC (permalink / raw)


It is very useful to be able to have multi-line raw
strings in the code, written as is, over many lines,
as one raw string.

Ada currently does not support this feature. This is called
multi-line raw strings, and also called HERE-DOCUEMNT

https://en.wikipedia.org/wiki/Here_document

The rosseta entry is http://rosettacode.org/wiki/Here_document

One can see the Ada entry there is not a true multi-line
raw string as one needs to add &"" at each line. Compare
that to the Python or Perl.

 From the Ada entry:

"Ada has neither heredocs nor multiline strings.
A workaround is to use containers of strings: "

C++-11 also added support for multi-line raw strings.
Few examples in Ruby, Perl, Python and C++11 showing
how this feature is used are http://12000.org/my_notes/here_document/index.htm

It is these kinds of practical features that make computer
Languages useful.

How hard would it be to add support for this in Ada?
Either at language level, or as a package?

--Nasser







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada?
  2015-07-10 17:00 is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada? Nasser M. Abbasi
@ 2015-07-10 17:18 ` David Botton
  2015-07-10 17:26 ` Simon Clubley
  2015-07-10 21:04 ` Dmitry A. Kazakov
  2 siblings, 0 replies; 5+ messages in thread
From: David Botton @ 2015-07-10 17:18 UTC (permalink / raw)


> It is these kinds of practical features that make computer
> Languages useful.

For application development in our day and age, very practical. I truly wish I had that feature and also the ability to just specify a binary file as being associated with a variable and at compile time it compiles in the binary file as the data for that variable.

There are ways to "fake it", AWS has a feature to compile in files for example.

David Botton


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada?
  2015-07-10 17:00 is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada? Nasser M. Abbasi
  2015-07-10 17:18 ` David Botton
@ 2015-07-10 17:26 ` Simon Clubley
  2015-07-10 17:41   ` David Botton
  2015-07-10 21:04 ` Dmitry A. Kazakov
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Clubley @ 2015-07-10 17:26 UTC (permalink / raw)


On 2015-07-10, Nasser M. Abbasi <nma@12000.org> wrote:
> It is very useful to be able to have multi-line raw
> strings in the code, written as is, over many lines,
> as one raw string.
>
> Ada currently does not support this feature. This is called
> multi-line raw strings, and also called HERE-DOCUEMNT
>
> https://en.wikipedia.org/wiki/Here_document
>
> The rosseta entry is http://rosettacode.org/wiki/Here_document
>
> One can see the Ada entry there is not a true multi-line
> raw string as one needs to add &"" at each line. Compare
> that to the Python or Perl.
>

[snip]

I would strongly oppose this for Ada (given Ada's safety critical
design goals).

Ada syntax was choosen to try and reduce the chances that silly
mistakes made while typing in code would produce a program which
compiled but was wrong due to a silly typing error. (For example,
"==" versus "=" in C).

In your proposal, if the terminating sequence was slightly mistyped
then the following program code would be consumed as data until a
valid heredoc terminator was found.

This is also why there is no multiline comment construct in Ada
IIRC but only "--".

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada?
  2015-07-10 17:26 ` Simon Clubley
@ 2015-07-10 17:41   ` David Botton
  0 siblings, 0 replies; 5+ messages in thread
From: David Botton @ 2015-07-10 17:41 UTC (permalink / raw)



> I would strongly oppose this for Ada (given Ada's safety critical
> design goals).

No Ada's design goal was to allow safety critical not pinhole to it ever. For safety critical systems you want to use various pragma restrictions, no issue to restrict this use when it makes sense to do so.

> In your proposal, if the terminating sequence was slightly mistyped
> then the following program code would be consumed as data until a
> valid heredoc terminator was found.

Easily caught by compilers and warnings issues if suspect.

> This is also why there is no multiline comment construct in Ada
> IIRC but only "--".

Multiline comments are often abused during debug sessions and easy to slip by if left in place. That is very different than a HERE-DOCUMENT use case.

David Botton

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada?
  2015-07-10 17:00 is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada? Nasser M. Abbasi
  2015-07-10 17:18 ` David Botton
  2015-07-10 17:26 ` Simon Clubley
@ 2015-07-10 21:04 ` Dmitry A. Kazakov
  2 siblings, 0 replies; 5+ messages in thread
From: Dmitry A. Kazakov @ 2015-07-10 21:04 UTC (permalink / raw)


On Fri, 10 Jul 2015 12:00:52 -0500, Nasser M. Abbasi wrote:

> It is very useful to be able to have multi-line raw
> strings in the code, written as is, over many lines,
> as one raw string.

There is no such thing. String is a string an array of characters.

> Ada currently does not support this feature. This is called
> multi-line raw strings, and also called HERE-DOCUEMNT
> 
> https://en.wikipedia.org/wiki/Here_document

Useless and misleading.

Ada as an OO language supports implementation of text buffers of any sort.
WiKi authors contaminated by Unix and untyped languages seem unaware that
text buffer is neither file nor string.

> How hard would it be to add support for this in Ada?

No problem at all.

> Either at language level, or as a package?

It does not make sense to provide this feature at the language level
because different applications of text buffer require different
implementations and interfaces. E.g. GTK text buffer supports mark-up and
tagging pieces of text. The buffers I use for parser don't need that, nor
they need editing support GTK text buffer has etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-10 21:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-10 17:00 is it possible to add multi-line raw strings (HERE-DOCUMENT) support to Ada? Nasser M. Abbasi
2015-07-10 17:18 ` David Botton
2015-07-10 17:26 ` Simon Clubley
2015-07-10 17:41   ` David Botton
2015-07-10 21:04 ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox