-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object model #8
Comments
I'll try to sum up a few different models. Please correct me where i'm wrong ;)
All of these approaches are not big on information hiding. Also:
In general i'd like to see inheritance de-emphasised or completely left out. Another aspect that we can discuss is the addition of a trait system. There is a little bit of overlap with the described record approach that allows open method definition. |
I disagree, type safety has little to do with prototype OO. See TypeScript for example, and Inko uses prototype OO and the language offers type safety (through gradual typing). One of the big benefits of prototype OO is that it's super easy to model other object systems (class based OO for example) on top of it, while the inverse is not necessarily true. I personally also found it a bit easier to wrap my head around. |
Your are correct, i worded that wrong. What i meant is that the structure is more... amorphous? But I'll take a look into how typescript handles that (and of course Inko ;) ). |
@madmalik Yeah, the underlying data structures are definitely less specialised. For example, for Inko it's (more or less) just this: struct Object {
prototype: *mut Object,
attributes: Box<HashMap<*mut Object, *mut Object>>,
value: ObjectValue
}
enum ObjectValue {
Integer(i64),
Float(f64),
String(Box<String>),
...
} |
We need a chapter that outlines the object model the VM will use, what the trade-offs are, etc, etc.
The text was updated successfully, but these errors were encountered: