4 ms·
I'm not sure what you mean by a "name". Do you mean the same thing as Hickey's definition of "identity", i.e. "a stable logical entity associated with a series
by weavejester 12y ago
I'm not sure what you mean by a "name". Do you mean the same thing as Hickey's definition of "identity", i.e. "a stable logical entity associated with a series of different values over time"?
- seanmcdirmid 12y agoYes. To identify something whose fields change over time, it needs a name (even if that name is just a GUID or address). Well without fields, you don't need names, but this isn't a very interesting case (it is hard to scale up programs with just what are essentially global variables!). Values are anonymous in contrast: you can't really tell the difference between this 42 and that 42.
- weavejester 12y agoSo would you consider a pointer to a memory location to be an object?
- seanmcdirmid 12y agoUse the wiki [1]: > In computer science, an object is a location in memory having a value and possibly referenced by an identifier. Not useful huh? I would say, if the memory location is heap allocated and has mutable fields, then it is probably acting like an object (it could also be a value, it depends if its identity is important or not). [1] http://en.wikipedia.org/wiki/Object_(computer_science) http://en.wikipedia.org/wiki/Object_(computer_science)
- weavejester 12y agoWikipedia appears to distinguish between "object-based" languages and "object-orientated" languages. On the subject of object orientated languages, it says: > An object has state (data) and behavior (code). Which is the definition I'm most familiar with. I wouldn't class a Clojure reference as an "object", as it has state but no inherent behavior. > I would say, if the memory location is heap allocated and has mutable fields, then it is probably acting like an object So a reference to an immutable map wouldn't count as an object for you, because there are no mutable fields?
- seanmcdirmid 12y agoThe reference to the immutable map doesn't count (a immutable map is just a value), but keys into the map can form objects (in that they represent "object" properties). Actually, that is how you get objects without first class mutability (identities must still be generated, of course, which is the same thing). Ya, the wiki article makes a distinction between programming and designing with objects, and object-oriented programming. It really. All my arguments are about designing and programming with objects vs. designing and programming with values, call it "programming with objects" if you must.