elfprince13 wrote:
suggestion: treat objects as compile-time hash-tables on symbols that flatten into structs in the runtime environment? This way methods and member variables share a single namespace ...
... runtime hashtables ... have numerous downsides, including performance concerns and type safety.
... runtime hashtables ... have numerous downsides, including performance concerns and type safety.
Thanks, I'll consider this if I get to a point where my POC shows promise. For now, in using JavaScript because I get objects for free, and I can quickly see if an object model lends well to representing models more easily. If not, then I may add well bring on the S-expressions with some flavor of Scheme.
I'll worry about optimization later; though if there is something I can do about it in JavaScript (I don't control the engine), that's probably worth knowing. One thing I am doing (not sure if it's better or worse) is wrapping values in a {type: , value: } object so I don't have to deal with complicated type-lookup; week see if that pays off.
By the way, I'm implementing it so that everything is in the same namespace, which JavaScript supports without complaint. I'm trying to do it in a way that "namespace" means the current lexical scope chain by default, but can be ANY object chain that is specified.
Anyway, if I do implement this in a lower level language outside of the browser, I'll certainly cutout whatever OOP overhead I can, and use a tiny handful of structs instead of classes. I'll also definitely consider full support for symbols as interned string-objects. I know JavaScript just uses strings for everything.