optional end delimiters Per Bothner 27 Mar 2013 16:37 UTC

[Sent to both srfi-108 and srfi-109 lists, with follow-ups
to the srfi-108 list.]

We have been discussion whether to add optional end delimters
to SRFI-109 strings, for example:

   one two three
   uno dos tres

On reflection, such end delimiters may be equally valuable
for named literals, including document processing.  In that
case it makes sense to allow the tagname as an end delimiter.
This is done in XML: <tag>...</tag>.
It is also common on document processing (markup) languages,
including Scribe, LaTeX and texinfo:


@begin example
@end example

This makes it easier to "match up delimiters" and it can
help catch errors, especially for long bodies.

I suggest allowing an optional '&tagname' before the ending '}'.

Sentence 2.

It is an error if the ending tagname doesn't match the start tagname.

This makes for easy parsing, without ambiguities.

Alternatively, having the end tag follow the '}'
is possible, but the parsing is more complex, and it
seems difficult to avoid ambiguities.  For example:

Sentence 2.




Having the end delimiter start with '}' makes it easier to
find it (especially on the start of the line), but the syntax
and parsing becomes less obvious.

The SRFI-109 (string) syntax should be designed in conjuction
with this.  For example, if we go with the:


syntax, then a "matching" SRFI-109 syntax might be:

	--Per Bothner
xxxxxx@oracle.com   xxxxxx@bothner.com   http://per.bothner.com/