Agreed. I think that's a pretty common way people think about null vs 
undefined, and it's consistent with the language's behavior.

Dave

On Jul 10, 2011, at 3:09 PM, liorean wrote:

> On 10 July 2011 22:23, David Herman <dher...@mozilla.com> wrote:
>> Another common and useful fusion of two traversals that's in many Schemes is 
>> map-filter or filter-map:
>> 
>>    a.filterMap(f) ~~~ [res for [i,x] of items(a) let (res = f(x, i)) if (res 
>> !== void 0)]
>> 
>> I rather arbitrarily chose to accept both null and undefined here as way to 
>> say "no element" -- a reasonable alternative would be to accept *only* 
>> undefined as "no element".
> 
> The way I think of it is that in analogy to NaN being the Numbers that
> represent no number, null is the Object that represents no object, in
> other words a reasonable value to store to tell just that. The
> undefined value is by analogy the value that represents no value, so
> is the only value that should be a "no element".
> 
> But that might be just my way of thinking about and distinguishing the
> not-a-something special cases.
> -- 
> David "liorean" Andersson
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to