Skip to content

Conversation

@bpcreech
Copy link
Owner

@bpcreech bpcreech commented Apr 9, 2024

Regarding Symbols: It's not clear whether Symbols are really objects! MDN says they're primitives and then goes on to talk about their object prototypes... V8 seems to allow them to be casted to Objects and used as such... e.g., sym=mr.eval('Symbol("fdsa")'); sym["toString"](this=sym) == "Symbol(fdsa)" works (there is an object-get in there). So I special-cased them to allow casting to Object; hope that doesn't backfire later. (Either way, we were allowing it before this pull request; I'm not just stopping it here.)

@bpcreech bpcreech force-pushed the feature/verify-object-cast branch from b5caf79 to 011e39c Compare April 9, 2024 16:26
@bpcreech
Copy link
Owner Author

bpcreech commented May 2, 2024

Update for posterity, doing this type safety actually breaks stuff because PyMiniRacer is currently accidentally relying on this ambiguity of whether Symbols are objects or not.

This worries me because the V8 API allows us to call Object methods (like get and set) on Symbol instances today even though the C++ API inheritance structure implies that shouldn't actually work because Symbols aren't Objects. It feels like that might stop working in the future, who knows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants