String reboot (plain text)
elias vasylenko
eliasvasylenko at gmail.com
Tue Feb 12 14:03:39 UTC 2019
Good point, I hadn't spotted that possibility, thank you for the
reassurance.
It's interesting that none of the escape sequences defined currently in
Java (sans-slash) can occur directly following a string literal (I think),
so the closing delimiter could be used directly as the escape marker quite
happily. This could be an argument to select a format for closing
delimiters which ends in a backslash.
Come to think of it, for normal string literals " could have been used as
the escape character instead of \ for the same reason, but no doubt that
would have looked a bit confusing! I wonder if any languages have made that
choice, excluding the fairly common practice of using a quote to escape
itself of course.
On Mon, 11 Feb 2019 at 18:26, John Rose <john.r.rose at oracle.com> wrote:
> On Feb 11, 2019, at 3:05 AM, elias vasylenko <eliasvasylenko at gmail.com>
> wrote:
> >
> > I think this is one of the few situations where the entire meal needs
> > to be served all in one go.
> >
> > I agree with your goal statement, but there are assumptions about
> escaping
> > which I don't think bear out. And I realise I've said most of this before
> > on this list and I hate to sound like a broken record, but this choice
> can
> > only be made once.
>
> I have similar worries, but here's why I don't think things are as bad
> as you do.
>
> Such a choice can be made in a way that either precludes or reserves
> encoding space for future additions.
>
> I'm hoping we come up with a design that can be extended to include
> strong quotes, at a later point, if needed.
>
> It's straightforward to extend the strong quotes concept to include
> escapes. You simply define a variation of each close quote (for each
> open quote) to serve as a string interruptor, rather than a terminator.
>
> With a finite set of quotes, your concern can be addressed by reserving
> some combinations of characters within the string that are neither body
> characters nor the close quote. A reservation is all that's needed, not
> a full definition. Since the set of characters that can *follow* a Java
> string is limited, the reservation can take the form of a close quote
> followed by further characters.
>
> — John
More information about the amber-dev
mailing list