« Return to Thread: typeof null

Re: typeof null

by Brendan Eich-2 :: Rate this Message:

| View in Thread

As Crock said, the problem programmers face is "I have a value, I want
to treat it as an object and get a property (call a method, etc.). How
do I test is-this-an-object so that I can use dot without worrying about
that throwing right away on null left-hand side?"

/be

John J Barton wrote:

> On Tue, May 8, 2012 at 6:07 PM, Brendan Eich<brendan@...>  wrote:
>> Object class reflection is frowned upon in Smalltalk for a reason. We want
>> protocols, structural conventions -- not nominal type tags. Or so I think!
>
> Perhaps it would be helpful if someone made the case for typeof null
> === 'null'.
>
> To me typeof null === 'object' is fine. It makes null a value in the
> space of 'object'. In practice I see 'null' used to mean "I know this
> reference (usually an argument) should be an object; I want to pass
> nothing but signal that I really did mean to pass nothing." The status
> quo allows this and it seems enough work for null to do for us.
>
> Are there new things I can do if I now have a new answer to the
> 'typeof' question?
>
> jjb
> _______________________________________________
> es-discuss mailing list
> es-discuss@...
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@...
https://mail.mozilla.org/listinfo/es-discuss

 « Return to Thread: typeof null