Live data from Hacker News

Objects Are Not Abstract Data Types

stuartsierra.com

1–10 of 15 posts

Re: Objects Are Not Abstract Data Types

#5
my understanding is an object is a particular piece of memory, structured according to a class which may be seen as the abstract data type for that particular piece of data. As far as I understand the JVM, the compiler doesn't replicate function bodies for every instance of a class. I think a more appropriate title to this article would be... "protocols and datatypes in clojure", of course I wouldn't have read the article if that were the title...

Re: Objects Are Not Abstract Data Types

#7
I might be wrong, but doesn't this describe Google Go's interfaces as well? As in, the data structure of an object is independent of the functions/methods that can operate on the object. At least that's how I understand it right now (having never used it). And the type of a thing is related to the set of functions (matched by name) that are expected to work rather than the data's memory structure.

Re: Objects Are Not Abstract Data Types

#9
post #5

my understanding is an object is a particular piece of memory, structured according to a class which may be seen as the abstract data type for that particular piece of data. As far as I understand the JVM, the compiler doesn't replicate function bodies for every instance of a class. I think a more appropriate title to this article would be... "protocols and datatypes in clojure", of course I wouldn't have read the ar…

"an object is a particular piece of memory, structured according to a class" does not sound like a particularly useful way to think about objects unless you are working at a low enough level that you care how objects are laid out in memory.

Re: Objects Are Not Abstract Data Types

#10

I might be wrong, but doesn't this describe Google Go's interfaces as well? As in, the data structure of an object is independent of the functions/methods that can operate on the object. At least that's how I understand it right now (having never used it). And the type of a thing is related to the set of functions (matched by name) that are expected to work rather than the data's memory structure.

See also:

Modules in OCaml

Type classes in Haskell

C++0x "concepts" (axed from the specification, but you can do generic programming with templates)

And many more.

Post reply on HN