A different semantics for WeakMap#get default value

Axel Rauschmayer axel at rauschma.de
Mon Jan 16 14:33:33 PST 2012


> Mark objected to the mutating-option-for-"get" overloading. I've agreed but wanted to go further here: optional trailing boolean parameters are an anti-pattern. I'm leaning toward thinking that all boolean option params are an anti-pattern.

All boolean parameters are anti-patterns? All optional boolean parameters? What’s the alternative?

I thought that boolean parameters where OK when they were labeled in some manner (e.g. via an object literal). But I always find unlabeled parameters problematic (beyond the first one). Some of it can be mitigated by choosing good function/method names. Furthermore, trailing callable parameters are often self-explanatory.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/60a2042a/attachment-0001.html>


More information about the es-discuss mailing list