Hello,
in CoffeeScript implicit parens are opened just after an identifier
and always closed at the end of line. I think it's the same in
LiveScript in your case - with explicit parens your example would look
like this:
new Sheep( [new Moose( "Sid", new Moose "Bob" ) ] )
which is clearly not what you want. To make it work you need to make
sure the list has two elements - this can be done in many different
ways, for example:
# the obvious
new Sheep [ new Moose("Sid"), new Moose("Bob") ] # you could leave the
second set of parens out, but don't ;)
# another obvious fix
new Sheep [ (new Moose "Sid"), (new Moose "Bob") ]
# less obvious fix
new Sheep [
new Moose "Sid" # note: no comma
new Moose "Bob"
]
etc.
So, in short, I think this is expected behaviour and not a bug.
Also note that in JavaScript you can never be sure how many arguments
a function, or a constructor, takes. Even if a function declares only
one formal parameter it's still possible to pass any number of
arguments to it and it still can access all arguments, even those
which are not declared. In other words:
f = (x) -> [x, &1, &2]
f 1, 2, 3 # returns [1, 2, 3]
This makes inferring the "correct" number of arguments during parsing
impossible in general.