[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Tables without commas
- From: Pedro Miller Rabinovitch <pedro@...>
- Date: Thu, 15 Mar 2001 11:56:44 -0300
This is how it is in Sol (a derivation of Lua), the ',' in the record
field constructor is optional. The only place where it _is_ required
is before a [key]=val field ({ a=b , [foo]=2 }). Without the ','
you'd get a=b[foo]=2 and that will raise a syntax error.
Sure thing.
> The only thing people should look out for is stuff like:
> a = { strlen "aaa" }
You get much more problems. Sol requires the ',' in list field parts.
Correct. It's a nice approach, I guess -- originally I really only
intended the optional comma behaviour for recfields.
I.e. what's the result of { 1 -2 } or { a (b+c)*d }? (Btw, in Sol your
two examples above would create exactly the same code - it calls strlen
for "aaa" and would give a[1]=3 (not 4!) ;-) IMO the ',' is necessary
in the list fields.
strlen"aaa" == 4 ?? Doh. My old example had 4 'a's. Please ignore. :-)
I suppose the recfield part is pretty useful. I'll probably keep the
patch around for my not-Lua language interpreter.
Thanks for the tips -- that's exactly the kind of help/critique I was
expecting when I posted.
Pedro.
--
Pedro Miller Rabinovitch
Gerente Geral de Tecnologia
Cipher Technology
www.cipher.com.br