Geir said:
[snip]
> > 3.  Why do that when \" \\ -> " \ should be enough to eschew the current
> > hack?
> >
> > Rebuttal:
> >   Because then we really have two different escaping rules for "" string
> > definitions.  One rule for dealing with valid references and directives
and
> > one for dealing with " and \ .  Consider...
>
> Yes.  I don't see that as a big deal, quite frankly.  Because if you
impose
> \c->c then you still don't have uniformity because that is *not* how it
> works for references and directives.

i didn't say we'd have uniformity with how it works for refs and directives
outside of string definitions.  that uniformity already doesn't exist
because we can't use " in interpolated string definitions and will be even
more disparate once any new escaping rule is added there.  however, \c -> c
in string definitions does give us internal conformity; that is exactly what
my example was meant to show.  apparently it failed.  is my rebuttal
argument clear to you now, or would it help if i tried again?

>
> >
> > if   \" \\ -> " \  is implemented, then it becomes *very* unclear to me
what
> > happens if someone does
> >
> > #set( $foo = "\$this.might.be.null" )
> >
> > See it?  If the reference is not null, then this should be valid syntax.
> > But if the reference evaluates to null, then we have a syntax error!!
This
> > sort of behavior confuses and frightens me.
>
> I don't quite understand.  If the \c->c rule applies then it's irrelevant
> what this.might.be.null is

huh?  i was describing the situation if the \" \\ -> " \  rule was applied
instead of the \c -> c rule.

> If the reference escaping rule applies, then all is well.

ah.  i think i see our miscommunication.  in my understanding of \" \\ -> "
\,  the implementation would give a syntax error when it encountered a lone
\.  that's because i think we ought to have a consistent way to get the same
character in a string.  if \\ and \ both come out as \ depending on what
follows them, i find that very unfriendly.

i suppose we could make the rule something like (in order of precedence)

1. do standard reference/directive escaping
2.  \\ -> \
3.  \" -> "
4.  \c -> c

that should make so only things like

#set( $foo = "\" )

would cause syntax errors, but that's an awfully complex rule.  i think it
would be much clearer, easier, and consistent to go with just \c -> c.


> > Instead, if we implement \c -> c and give it precedence over the
> > reference/directive escaping, we get more understandable behavior.
> >
> > #set( $foo = "\$this.might.be.null" )$foo
> >
> > will *always* output
> >
> > $this.might.be.null
> >
> > consistency and clarity is good! right?
>
> But that's not really want "" does, is it?

not right now.  remember, this thread is about changing what #set( $foo =
"" ) does!

> In some ways, I don't think it's that big of a deal if we just have the
> precedence rule though.

like i said... you may not think it's such a big deal to understand and
remember an escaping rule like that, but some people aren't so sharp.

[snip]
> > If someone really needs to have a string with a single quote in it,
(e.g.
> > #set( $foo = "This has a ' in it." ) ) then they can always just use a
> > double quoted string (assuming the \c -> c rule is implemented).
>
> How?
>
> #set($foo = 'This #foo() has a \' in it')
>
> Is waaaay different from
>
> #set($foo = "This #foo() has a ' in it")

no kidding! that's why you wouldn't do that!  the correct way would be

#set( $foo = "This \#foo() has a ' in it" )

:-)

Nathan Bubna
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to