Opt-in versioning

Ingvar von Schoultz ingvar-v-s at comhem.se
Sun Jul 20 23:43:32 PDT 2008

Michael Haufe wrote:
> The entire concept of {{ ... }} irks me, and probably quite a few 
> others. This would add a level of syntax complexity and confusion 
> non-intuitive to most developers.
> Object literal {{ foo : bar}}?
> function(){{...}} ?
> if(){{
> ...
> }}
> else {{
> ...
> }}
> switch()? with()? Imagine JSON with these rules. thats abhorrent. I 
> understand the concern with scoping but this would be too far of a shift 
> to be considered I would hope.

They'd be entirely optional. If you prefer to use single braces
throughout your file, no problem, do that. Then you have the
complicated rules and hidden semantics to deal with, but if
you prefer that to the double braces it'll work just fine.

The double braces are for people who want simplicity and regularity.

I'm surprised that you think they'll be confusing. They have
just one very simple, clear, specific meaning: Enclose variables.
Everybody knows about enclosing variables. As I see it they
remove confusion.

You'd use double braces only when you want to enclose variables
locally. When you have no local variables there's no need:

     {{  local variables

     {   no local variables

If you seldom enclose local variables you'll seldom need
the doubling, even if you choose to enable it.

An object literal wouldn't use double braces because it isn't
a scoping block (it doesn't enclose local variables). JSON
doesn't have any scoping blocks.

I you find the doubling abhorrent, do you find this more

     {   local stuff

     [   no local stuff

This would require good syntax coloring. It wouldn't work in
old browsers. Personally I prefer the double braces.

Ingvar von Schoultz

------- (My quirky use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)

More information about the Es4-discuss mailing list