On Wed, Jan 12, 2011 at 7:07 AM, Nicholas C. Zakas
<jsmen...@nczonline.net>wrote:

> ?To be more precise void is an operator, just typeof. The parentheses are
> optional, just like you can write -1 or -(1), the same is true for void(0)
> or void 0, although white space is required when parentheses aren't there
> for void and typeof.
>

Ah, there's an interesting "quirk" (?) in the language there. Did you know
it's not actually required? You're required to let the parser be able to
distinct the keyword from an identifier. This goes for all
literals/operators. If the parser is able to do that, then the whitespace is
not needed. These are all valid statements, which do exactly as you'd expect
them to.

void"";
void[];
void"moar";
... return[some,array];
etc.

(I'm still in favor of adding the space! But in terms of the spec, the space
is only required to make a distinction.)

- peter

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to