Closed GoogleCodeExporter closed 8 years ago
I am reminded that instanceOf is not exactly equivalant to calling
QueryInterface,
since QI will throw if the object doesn't support that interface, where
instanceOf
won't. That's not entirely relevant, however.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 6:31
bah, and instanceof is always all lowercase, in spite of my muscle memory to the
contrary.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 6:32
This patch does the trick:
--- /home/db48x/elisp/js2-20080406.el.orig 2008-04-14 01:49:35.000000000
-0500
+++ /home/db48x/elisp/js2-20080406.el 2008-04-14 01:49:50.000000000 -0500
@@ -5932,7 +5932,8 @@
js2-SETELEM_OP
js2-LOCAL_BLOCK
js2-SET_REF_OP
- js2-YIELD))
+ js2-YIELD
+ js2-INSTANCEOF))
(aset tokens tt t))
tokens))
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 6:50
I hesitate to make this change universally unless "instanceof" can have side
effects
in normal browser JavaScript - not counting the possible TypeError.
I'm happy to add it as a configuration option. Does that seem reasonable?
Original comment by steve.ye...@gmail.com
on 14 Apr 2008 at 10:26
Maybe. The ECMA spec says that the instanceof operator results in a function
call to
the HasInstance method on the object, so that sorta counts as a side effect. Of
course, that method isn't deleteable or overridable so for a given
implementation it
will either always cause side effects or never cause side effects. See section
11.8.6
of the spec.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 10:43
Oh, also. Isn't this message worded a little oddly? Sometimes not causing a side
effect is a virtue. The real error is that in this case I'm executing this
statement
solely for it's side effect, and then throwing away its return value. A
different
wording could be in order.
Original comment by dlb...@gmail.com
on 14 Apr 2008 at 10:50
Original comment by steve.ye...@gmail.com
on 22 Apr 2008 at 4:28
Original issue reported on code.google.com by
dlb...@gmail.com
on 14 Apr 2008 at 6:26