Is it possible or is it planned for the JS engine to bind classes. In a way that we don't have to pass the "this" variable to all the methods. So far i only seen normal functions beeing bound into JS, maybe i missed something could someone shed some light on that issue.
Not really sure how that could be done? (unless I'm misunderstanding what you mean)
Well i use luabind (it uses bootst underneath)
I can bind a JUCE class like so:
class_<String>("String") .def(constructor<const char *>()) .def(constructor<const char *, const int>()) .def(constructor<double>()) .def(constructor<double,int>()) .def(self + other<const String &>()) .def("hashCode", &String::hashCode)
etc. This allows me to use the String class in Lua like so:
function getHash(x) s1 = String(x) return s1:hashCode() end
Oh, I see. Well I guess that could be done, and probably wouldn't need any changes to the parser to handle it. Quite a complex set of classes to build though!
I really have no idea how is that done, it's the magic of boost but i saw this kind of implementation in LuaBridge and i think some other Lua binding frameworks. This is just useful, and if we could have something like that we could provide access to JUCE great set of classes (at least the core set). That would make the JS engine really helpful with file access, network access etc. I know that binding those classes would be a tedious work and maintaining code like that is a pain (i'm doing that now with luabnd and juce, i bound a lot of classes and everytime a single parameter changes it's const'ness or something the whole project fails to build with some enigmatic template based error reports)
Anyway it would be very helpful, i'd love to find out how to do that also, what's the trick into doing that ?
What i was trying to get to is exactly this:
This is a functionality of c++11 but i assume JUCE will move in that direction anyway. I'm playing around with this functionality at the moment, binding JSON-RPC methods to functions in a class and holding them in a HashMap. It simplifies the interface and takes much less code to write.
Anyway i just wanted to make sure i explained, i have a tendency to overcomplicate simple things.
Is this possible today?