Open tbodt opened 7 years ago
Making this work as expected wouldn't be easy, since exactly one FunctionTemplate is created for each class, and V8 requires that everything other than functions, booleans, numbers, and strings be created in a context. Maybe a special context could be created for these things? But that would allow communication between contexts where that might not be intended:
class Thing:
thing = []
a = v8py.Context()
a.expose(Thing)
a.eval('Thing.thing.push("hello")')
b = v8py.Context()
b.expose(Thing)
a.eval('Thing.thing') #=> ['hello']
The solution is probably to ignore or issue a warning for these things.
cc @buffer
@desertkun has found that using a context would not actually help, since you can only set templates and primitives as template attributes anyway. https://github.com/tbodt/v8py/issues/24#issuecomment-396599646
Examples: