Learning about OCaml's OO features today.
It rather reminds me of Go: you don't need to do up-front design of what common methods your objects have. Its type is just its methods (structural typing AIUI).
You don't even need to define classes at all! Just return an object.
miniblog.
Related Posts
TypeScript has a really neat way of changing the required-ness of fields in objects.
Partial<Foo> is the same shape as Foo, but all the fields are optional. Required<Foo> is the same shape as foo but all the fields are required.
LambdaMOO has prototypical inheritance, so you create objects from other objects.
@create $note named "Old Post-It"
You now have Old Post-It with object number #51116 and parent generic note (#9).
An object that can have children is called 'fertile'!
I've been writing programming language documentation for objects. It's surprisingly nuanced!
How do you introduce objects to the reader? What elements should the first example contain? What order do you introduce concepts like methods, inheritance and properties?