▲ 48 points
back
13 comments
Go is an example of a classless OOP language.
Here's a good example http://www.goinggo.net/2015/03/object-oriented-programming-m...
Yeah, it's surprising too. I was programming for a good week in Go before I discovered anonymous fields and how they worked. They really need to do a better job of explaining that they have a form of inheritance in the language that allows structs to exhibit polymorphism beyond being an interface as it isn't really explicitly stated anywhere in the docs. The section in the FAQ that answers if Go is an OO language never makes explicit reference to them, and in the language spec they don't get their own section.
An interesting idea, though I actually feel like Lua implements much of this concept already. Admittedly, there are plenty of differences, but Lua has no `class` or `new` keywords, but you can implement Object Orientation very simply with Tables.
Actually, that's one of many reasons I find Lua to be so elegant; but perhaps that's just me :P
While the slideshow seems aimed at creating something new, I think (hope?) that's more of a rhetorical device, because prototype-based OO goes back to Self, and even the language that introduced classes (Smalltalk) resembles this more strongly than the more common class-based OO languages (C++ and Java).
Lua is not really unique in following the same concept. Javascript and Python are also both based on the hash-with-blessed-class-member prototype-driven approach, even though they also both build class systems on top of it (JS more recently than Python).
These are course notes for a grad-level PL class. I've seen something like this before...maybe 10 years ago. I don't think the encoding is particularly novel, just part of the material being taught.
Reading over the notes, it looks like NewtonScript (and probably Self) also implements much of the concept. NewtonScript actually does 2 parent pointers and is well worth a look even if the parent platform long ago died.
Prototypes are only one approach to inheritance, of course! A fun other one (which Crockford quite likes) is Parasitic Inheritance, where Bar() is a function that takes the object Foo() returns and augments it.
JavaScript is an example of "class"-less OOP
(at least before they actually added classes.)
ES6 added the class keyword, but that doesn't mean that there are actual classes in JavaScript. I can highly recommend this book if you'd like to dive deeper, I just finished reading it: https://github.com/getify/You-Dont-Know-JS/tree/master/this%...
Isn't this exactly what the Self language is?
http://en.wikipedia.org/wiki/Self_%28programming_language%29
Not really, this seems more like an classless OO encoding in functional programming. Related but not the same.
Does he define what an 'object' is? This is anything but trivial.