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

> A type is a collection of possible values

Ok, but do two collections with the same values always correspond to the same type?

It depends on the language. If you have, for example, a type-and-effect system, a type can contain information (like "we wrote to stdout while computing this") that is never reflected in the value itself. In a formal setting, it's more appropriate to describe a type as a collection of pieces of source code, so that `2+3` and `print "computing...\n"; 2+3` have different types even though they'll evaluate to the same thing.

Generally, no, at least with nominal typing.

Yes, but if remember you can always say that the values are different.

A blue 5, and a red 5.

Five feet, or five inches.

Yes, they do.

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