[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string[], doesn't exist?
- From: "Aaron Brown" <arundelo@...>
- Date: Sat, 24 Jun 2006 11:39:42 -0400
Sam Roberts wrote:
Would things break terribly if any of {}, "", and Number
could be passed as an argument expression without
parentheses?
From the manual:
Arguments have the following syntax:
args ::= `(´ [explist1] `)´
args ::= tableconstructor
args ::= String
A call of the form f{fields} is syntactic sugar for
f({fields}); that is, the argument list is a single new
table. A call of the form f'string' (or f"string" or
f[[string]]) is syntactic sugar for f('string'); that
is, the argument list is a single literal string.
So tables can be passed like this too. If you want to
pass a literal number without argument parens, you can
pass it as a string and then convert it inside the
function.
(Offhand, I can't think of any ambiguities that would be
created by letting this be done with numbers too.)
--
Aaron