On Friday 27 June 2008 22:21:05 Slava Pestov wrote:

> So, we could have a syntax like the following:
>
> TUPLE: color { "red" integer 0 } { "green" integer 0 } { "blue" integer 0 }
> ;
>
> Each slot specifier would either be a string, a two element array (name,
> default value) or a three element array (name, class, default value).

I don't mind that syntax, except for the double quotes. I'd be ok with:

        TUPLE: color { red integer 0 } { green integer 0 } { blue integer 0 } ;

You can provide either a type or an initial value. There is ambiguity if you 
provide a type as an initial value. For this case, you could have some rule 
on ordering.

Let's put that syntax side by side with the KLF syntax:

        TUPLE: color { red integer 0 } { green integer 0 } { blue integer 0 } ;
        TUPLE: color red/integer=0 green/integer=0 blue/integer=0 ;

KLF sure is shorter. But, and they might shoot me for this, I kinda like the 
first version visually. I could get used to the second version. Maybe I've 
been abducted and brainwashed by K and J aliens.

The per slot key overhead of the first version is 8. KLF is 2.

Remember that '{' is a shifted character so it has a key count of 2.

Since we're already in the deep end of the character overloading pool, you 
might as well consider overloading '[' here. The per slot key overhead would 
drop to 6 if you used them here:

        TUPLE: color [ red integer 0 ] [ green integer 0 ] [ blue integer 0 ] ;

Ed

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to