Larry Wall writes:
> If we're going to stick with the notion that <foo> captures and
> something else doesn't, I'm beginning to think that the other thing
> isn't Âfoo for a couple of reasons.

I just sat down to say the exact same thing.  I'm glad you beat me to
it.

> And people would have to get used to seeing ? as non-capturing assertions:
> 
>     <?before ...>
>     <?after ...>
>     <?ws>
>     <?sp>
>     <?null>
> 
> This has a rather Ruby-esque "I am a boolean" feeling to it.  I think
> I like it.  It's pretty easy to type, at least on my keyboard.

Yeah, I like it pretty well too.  Better than the french quites for
sure.

> Now suppose that we extend that "I am a boolean" feeling to
> 
>     <?{ code }>
> 
> which might take the place of the confusing <(...)>, and make consistent
> the notion that we always use {...} to invoke "real" code.

Hmm...  I'm just so attached to <(...)>.  I find it quite beautiful.  It
also somehow communicates the feeling "you shouldn't be putting
side-effects here".

> I think I'm leaning toward the idea that anything in angles that
> begins alpha is a capture to just the alpha part, so the ? prefix is
> merely a no-op that happens to make the assertion not start with an
> alpha.  Interestingly, that gives these implicit bindings:
> 
>     <after ...>               $<after>        $`
>     <before ...>      $<before>       $'

I don't quite follow.  Wouldn't that mean that these guys would get
clobbered if you used lookaheads or lookbehinds in your rules?

> Or we could use some standard delim for that:
> 
>     <ws-1> <ws-2> <ws-3>
> 
> which is vaguely reminiscent of our "version" syntax.  Indeed, if we
> had quantifications, you might well want to have wildcards <ws-*> and
> let the name be filled in rather than autogenerating a list.  But
> maybe we just stick with lists in that case.

I can imagine this being a lot cleaner if the thing after the dash can
be any sort of identifier:

    <ws-indent> if <?ws> <condition> <ws-comment>

On the other hand, it could be misleading, since the standard naming of
BNF uses dashes instead of underscored.  I don't think it should be a
big problem though. 

> I'm still thinking about what Â... might mean, if anything.  Bonus
> points for interpolative and/or word-splitty.

Yeah... umm... nope.  I got nothin.

Luke

Reply via email to