Because we have no desire to differentiate between undefined & null.

David

On Sun, Aug 17, 2014 at 8:49 AM, Angel Java Lopez <[email protected]> wrote:
> Just curious
>
> Why then
>
> is-hidden != null
>
> instead of
>
> is-hidden !== null
>
> Angel "Java" Lopez
> @ajlopez
>
>
> On Sun, Aug 17, 2014 at 9:45 AM, stephanos <[email protected]> wrote:
>>
>> Thank you! It make sense now :)
>>
>>
>> On Sunday, August 17, 2014 2:44:23 PM UTC+2, [email protected] wrote:
>> > The boolean metadata is a type hint telling the ClojureScript compiler
>> > that is-hidden is boolean. Knowing is-hidden is a boolean allows
>> > ClojureScript to compile to
>> >
>> > if (is-hidden){
>> > }
>> > else {
>> > }
>> >
>> > instead of
>> >
>> > if (is-hidden != null && is-hidden !== false){
>> > }
>> > else {
>> > }
>> >
>> > if the type isn't known to be a boolean. The extra checks are needed
>> > because ClojureScript has only two values that evaluate to false: false and
>> > nil. JavaScript evaluates false, null undefined, "", 0, and NaN to be 
>> > false.
>> >
>> > About the only time you need to use the boolean type hint is in
>> > performance sensitive code where the compiler can't infer the type of a var
>> > (like a parameter passed into a function).
>> >
>> > I hope this answers your question
>> >
>> > Peter Schuck
>>
>> --
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/clojurescript.
>
>
> --
> Note that posts from new members are moderated - please be patient with your
> first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to