Existential operator (was: ||= is much needed?)
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
if typeof block is 'function' then block.call(@, params) else
hashKeyFor: (obj) -> obj?.hashKey?() or obj
callback?(err, mappedRecords, env)
return true if lhs?.isEqual?(rhs) and rhs?.isEqual?(lhs)
wrapper = wrapper?(core) or wrapper
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss