kdrnic/box2dweb

Box2d and Processing.js don't mix

Closed this issue · 3 comments

Including Box2D and Processing on the same page will break it.

Firefox console outputs:
18:12:22.618: Exception: missing ( before formal parameters Source File: 
file:///C:/b2d/processing.js Line: 17949, Column: 16 Category: content 
javascript

Tested on Windows 7 with Opera 11beta1 and Firefox 4.0b8pre




Original issue reported on code.google.com by kristjan...@gmail.com on 23 Nov 2010 at 4:32

Attachments:

Here is why:
Box2dWeb defines valueOf() in Object.prototype which provides an unique id for 
each object. This allows using objects as keys and simulates 
flash.utils.Dictionary-behavior:

var d = new flash.utils.Dictionary;
d[{foo: bar}] = "foobar";

Processing.js defines toString at some places in the processing-code -to- 
Javascript compiler. Unfortunately valueOf seems to have higher precedence.

So maybe I can fix it, by making valueOf return the toString() value, if 
available as a workaround.

I'm currently working on version 2.0 of my converter. I hope I can remove the 
valueOf-override at all by improving type-tracking.

Original comment by Uli.He...@googlemail.com on 23 Nov 2010 at 6:43

  • Changed state: Accepted

Original comment by Uli.He...@googlemail.com on 23 Nov 2010 at 11:00

  • Changed state: Started
This issue was closed by revision r11.

Original comment by Uli.He...@googlemail.com on 24 Nov 2010 at 1:08

  • Changed state: Fixed