WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: typeof null

Re: typeof null

by rauschma :: Rate this Message:

| View in Thread

typeof is so quirky that I’m not sure fixing it is worth the trouble. It might make more sense to introduce a new mechanism that subsumes both typeof and instanceof and also took value objects into consideration (if there is a use case for doing so). Additionally, using typeof for finding out whether a variable is declared or not seems like a separate concern to me. If that was handled via a separate operator then one could prototype improved versions of typeof via libraries (because typeof unknownVariable not throwing is something you can’t implement via a library).

Axel

On May 8, 2012, at 18:19 , Rick Waldron wrote:

Aware that that typeof null has been rejected, but I was wondering if it could be revived via the implicit "opt-in" path, eg:

non-strict, non-opt-in:

typeof null === "null"; // false

implied opt-in:

module Foo {
  export function create( options ) {

    if ( typeof options === "null" ) {
      return ... some default thing;
    }
  };
}

import create from Foo;

let default = create( null );


Is something like this even possible?

Rick

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

-- 
Dr. Axel Rauschmayer



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

 « Return to Thread: typeof null