On Tue, 2007-09-18 at 22:02 -0700, Erick Tryzelaar wrote:
> On 9/18/07, skaller <[EMAIL PROTECTED]> wrote:
> > On Tue, 2007-09-18 at 21:04 -0700, Erick Tryzelaar wrote:
> > > On 9/18/07, skaller <[EMAIL PROTECTED]> wrote:
> >
> > > The tildes are probably the easiest to read and notice.
> >
> > Except ~ means complement as an operator and 'destructor' in
> > C++, but the issue is more with the calling syntax IMHO.
>
>
> Good point. You're right with the best syntax is one where we don't
> even need change it. Being able to use (a=1, b=2), (b=2, a=1), or (1,
> 2) interchangeably would be great.
Well, they're not interchangeable since (1,2) doesn't specify
any labels.
in any case this now works:
//////////////////////////////
#import <flx.flxh>
var x = struct {a=1; b=2; };
println q"a=$(x.a), b=$(x.b)";
var y = (a=3, b=4);
println q"a=$(y.a), b=$(y.b)";
///////////////////////////
The RHS of the a=expr is an sor_condition or lower
precedence, otherwise you need brackets.
The grammar extension is trivial:
anon_value := lpar rassign (, rassign )* rpar =>#
"`(ast_record ,(cons _2 (map cadr _3)))"
;
rassign := sname = sor_condition =># "`(,_1 ,_3)";
It's actually not clear why not to use 'sexpr' rather
than sor_condition. sor_condition is the level down from
stuple, which is the one with the commas in it.
however:
(a=1,2,b=c)
is not actually ambiguous: it means
(a=(1,2),b=c)
and Dypgen should parse this correctly. However I banned it anyhow,
and forced the extra ().
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language