Hacker News new | past | comments | ask | show | jobs | submit login

In programs, anonymous objects always have an unique ID automatically assigned - by the very virtue of being separate entities. Usually those IDs are what we call "references" in programming.



I'm talking about the level of e.g. programming language implementation. A lambda needs to be assigned an id, for example, but it's not a reference that the user can manipulate. It's an implementation detail, as are surrogate keys.


You don't manipulate the reference directly (i.e. you shouldn't learn its numeric value (though you can - useful for debugging), and you can't change it) - but you do use it indirectly all the times with ==, eq, or however the referential equality operator is called in a given programming language.

This is what, given (excuse the Java):

    MyObject a = new String("choo choo");
    MyObject b = a;
    MyObject c = new String("choo choo");
allows you to observe that:

    a == b;
    a != c;
    b != c;
even though:

    a.equals(b);
    a.equals(c);
    b.equals(c);
under string comparison.

This is exactly like surrogate keys. An implementation detail that's crucial to the meaning of the whole thing.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: