HaloO,
Mark J. Reed wrote:
On Mon, Sep 8, 2008 at 11:08 AM, TSa <[EMAIL PROTECTED]> wrote:
Sorry, what am I missing that I see no problem with List
always itemizing to an Array?
A List *does* always itemize to an Array. But parens do not a List
make; the discontinuity mentioned is syntactic.
(1,2,3) # (or longer) List
(1,2) # List
(1) # Item
() # ?
If () goes back to a List, then there's a double discontinuity in the
way parenthesized expressions are parsed.
Ahh, I see. Thanks for the hint. It's actually comma that builds lists.
So we could go with () for undef and require (1,) and (,) for the single
element and empty list respectively. But then +(1,2,3,()) == 4.
On the other hand, there's just that sort of double discontinuity in
English pluralization, where we say "2 (or more) items", then "1
item", but then "no items". So perhaps it's justifiable in Perl6 as
well.
I would also opt for () meaning empty list as a *defined* value. Pairs
that shall receive the empty list as value could be abbreviated from
:foo(()) to :foo(,). As long as the distinction between Array and List
doesn't matter one can also say :foo[], of course.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan