[Laszlo-dev] [JIRA] Commented: (LPP-6670) Remove `if (a in b)` when a is an instance var in b's class

P T Withington ptw at laszlosystems.com
Thu Jul 24 07:09:15 PDT 2008


My quick cut at what to do:

In places where it is just checking for existence, `a in b` can be  
rewritten `b['a']`.  If you are just going to use `null` instead of  
`undefined` then say `b['a'] || null`.  If you are making an  
`instanceof` check, change that to `is` because `instanceof` will  
complain if its left arg is not an object, so `b['a'] is ...`.

Couple of specific examples:

> debugger/LzDebug.lzs
>  if (! (('backtrace' in error) && (error.backtrace instanceof  
> LzBacktrace))) {
error['backtrace'] is LzBacktrace
>  var alen = (('length' in obj) &&
probably (! isNaN(obj['length']))
>  var hopp = 'hasOwnProperty' in obj && obj.hasOwnProperty instanceof  
> Function;
obj['hasOwnProperty'] is Function

Or, leave the debugger to me.  I don't think any of the debugger is in  
swf9 yet anyways.


More information about the Laszlo-dev mailing list