lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>> That syntax does look pretty wacky, [...]

Roberto Ierusalimschy:
> Suggestions for improvements are wellcome. The syntax needs to allow the
> inclusion of any literal string; it would be nice if the old `[[ ]]'
> could fit as a special case of the new format.

To wrap an unconstrained text (a long string or comment) there are a few
options:

(1) Specifying its length.

Convenient for computers but not humans, very hard for a person to see the
end of such a string, and prone to easy upset if a person wishes to manually
edit the string.

(2) Have a termination sequence, and use escape padding to prevent that
sequence occuring.

Easy for a computer to generate. Easy for a human to generate from scratch
but a lot of work if one wishes to 'wrap' an exisiting section (unless its
structure is well known). Easy for a human to read unless there are multiple
nested sections (which causes escapes on the escapes on the escapes etc).

(3) Have an arbitrary escape sequence specified at the start.

This is easy for a human to do (especially if the syntax allows nesting,
when one may almost always get away with using the same terminator); a human
can rely on certain sequences never occuring in formatted structures (like
code) and use an editor's "find" facility to double check. Easy for a human
to read, and to modify text (so long as care is taken not to inadvertantly
create the terminator inside the text). Easy for a computer to create IF it
has the whole text available at the start to analyse and make sure the
computer's choice of terminator does not occur in the text. IF the whole
text is not available at the start then neither a human nor a compter can
use this method.

*cheers*
Peter Hill.