W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2009

Re: Interactions between optional and nullable

From: Brendan Eich <brendan@mozilla.org>
Date: Tue, 8 Dec 2009 09:37:28 -0800
Cc: Anne van Kesteren <annevk@opera.com>, public-script-coord@w3.org
Message-Id: <E5C1696F-E97C-4FB5-B1C3-14E9D3E2F996@mozilla.org>
To: Robin Berjon <robin@robineko.com>
On Dec 8, 2009, at 9:17 AM, Robin Berjon wrote:

> Admittedly, at some point we should just use an options map. But  
> some cases seem to still want positional.

Could you give some real-world examples?

IMHO "idiomatic JS" does not abuse positional parameters to let either  
or both be optional, requiring programmers to pass null. Trailing  
parameters in increasing order of optionality are common (this is not  
really an idiom, or at least not one peculiar to JS); otherwise an  
object with optional properties is often passed:

d.foo({bar: myBar, foo: myFoo});
d.foo({bar: otherBar});
d.foo({foo: someFoo});

/be
Received on Tuesday, 8 December 2009 17:50:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC