tbodt / v8py

Write Python APIs, then call them from JavaScript using the V8 engine.
GNU Lesser General Public License v3.0
440 stars 28 forks source link

Can't access instance attributes #16

Closed AlexHill closed 6 years ago

AlexHill commented 6 years ago

Hi,

Just clarifying what is and isn't possible with v8py - is it expected that instance attributes on objects exposed to V8 won't be accessible? e.g. attributes set in __init__? If so, is that a fundamental limitation or just a "not implemented yet"?

Many thanks, Alex

tbodt commented 6 years ago

Yeah, that's intentional. The idea is to easily be able to make instance variables that are private to javascript, but public to python. @property works.

AlexHill commented 6 years ago

Gotcha, thanks. And from the look of the tests, __getitem__ should work with dot notation in JS if I need to expose dynamic properties?

tbodt commented 6 years ago

Yep. JavaScript does not distinguish between . and [].

AlexHill commented 6 years ago

Ok. Thankyou!