Re: Extend-protocol to numbers fails with zero in CLJS

2014-06-08 Thread Karsten Schmidt
Thanks, Logan - that helped indeed! I also saw the compiler warning about that, but wasn't quite sure what to make of it and my solution seemed to work, at least until I tested with zero... Having said this, I've never seen or heard of a `number` type and found the lowercase naming very misleading

Re: Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Logan Linn
It will work for 0 if you use `number` instead of `js/Number`. Generally you shouldn't extend any js/* type On Friday, June 6, 2014 9:57:38 AM UTC-7, Karsten Schmidt wrote: > > I'm trying to extend-protocol for numbers and various other types (incl. > collections & nil) in CLJS, so have been doi

Re: Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Karsten Schmidt
...actually, this would be sufficient: if (goog.isDefAndNotNull(and__3466__auto__)) { ... } On 6 Jun 2014 17:57, "Karsten Schmidt" wrote: > I'm trying to extend-protocol for numbers and various other types (incl. > collections & nil) in CLJS, so have been doing something like this (reduced > ema

Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Karsten Schmidt
I'm trying to extend-protocol for numbers and various other types (incl. collections & nil) in CLJS, so have been doing something like this (reduced email version): (defprotocol PDeltaEq (delta= [a b])) (extend-protocol PDeltaEq js/Number (delta= [a b] :yay) nil (delta= [_ b] (nil? b)))