Date.prototype.valueOf called on incompatible Proxy #44
Comments
Apparently the current implementation of Proxies in both SpiderMonkey and V8 doesn't support the Date object. This is the JS builtin, the bug has nothing to do with the date.js library. Support for the Date object should be coming with the new direct Proxies. Here's a bug link for direct Proxies in SpiderMonkey so Firefox should have support soon. No public bug for V8 that I could find. Hopefully they're working on it. |
is a Date a "primitive" then, as per the docs stating that contracts can't be put on primitives? |
Note quite. Date is an "irregular object" (like array, function, and the DOM) that doesn't behave quite like a regular JS object should. Direct proxies won't (as far as I know) let us proxy primitives but it will let us better proxy the irregular objects. |
Then can the documentation be updated to specifically mention the irregular options? |
thanks! |
Direct proxies are supported in SpiderMonkey. You must call new Proxy(target, handler) -- the 'new' is required. It seems you can make a Date instance be the target without exceptions, but I haven't tested extensively, or in particular the contracts.coffee testcase here -- just a quick js shell session. /be |
I am trying to define some contracts that return dates. I am using the date.js library. If I define
DateC = Any
, it works fine.If I define:
I get this error:
startDate
here should be the date object. Am I missing an equality operator in my contract?The text was updated successfully, but these errors were encountered: