Existential operator (was: ||= is much needed?)

Jeremy Ashkenas jashkenas at gmail.com
Fri Jun 22 10:36:46 PDT 2012


On Thu, Jun 21, 2012 at 5:55 PM, Aymeric Vitte <vitteaymeric at gmail.com>wrote:

>
> According to my previous posts I am quite convinced it has an interest, I
> remain perplex regarding the use of ?( , then, I am really curious to see
> CS's uses, could you please highlight some projects ?
>

Certainly. Here's a brief sampling of some of the uses.

Mostly cases where function values may not exist, or cases where you're
passing a very heterogenous set of objects into an API, and you're not
entirely sure what methods are available, but want to look for specific
things.

if typeof block is 'function' then block.call(@, params) else
@[block]?(params)

hashKeyFor: (obj) -> obj?.hashKey?() or obj

callback?(err, mappedRecords, env)

unless varBase.hasProperties?()

callback?()

return true if lhs?.isEqual?(rhs) and rhs?.isEqual?(lhs)

wrapper = wrapper?(core) or wrapper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120622/218f74e6/attachment.html>


More information about the es-discuss mailing list