Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You don't think of lists as a string of pointers when evaluating ML,

No, it's not. The Definition of Standard ML says absolutely nothing about lists or strings being implemented as pointers. Lists and strings are values.

> and it's the same thing.

It's not.

> That's not the earthshaking difference you seem to think it is.

It is. Values have a nontrivial equational theory that enables two syntactically different programs to be deemed equal using local reasoning exclusively. That is, without observing the effect of a computation on its much larger context. This in turn enables much more aggressive optimizations, both by hand and automatic, than are possible if all you have is object identities.

> In fact, values and objects are two aspects of the same thing.

Nope. Values are the more fundamental notion, mathematically. Object identities are but a particular kind of value, and so are object states in any mathematically civilized language.

> At the end of the day, lists are still chains of pointers, mutable or no, "object" or "value" (and I have to put it in quotes because your definition isn't in any way the common one).

Lists aren't chains of pointers when I evaluate them on paper. A list is just a sequence of elements. But even when working on a computer, using actual lists has concrete benefits, for example, the compiler is free to apply optimizations like “gluing” consecutive nodes to improve locality of reference (in the generated program) and ease the job on the garbage collector (assuming the list is used in a single-threaded fashion). In the limit, it's as if I had used a C++-style `std::vector`! When all you have is object identities, this optimization is obviously unsound.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: