carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.24k stars 1.48k forks source link

Capture the ambient discussion and thinking about bi-directional type information flow in a principle #4130

Open chandlerc opened 2 months ago

chandlerc commented 2 months ago

Several design discussions in Carbon have talked about "what direction does type information flow" in the context of type inference. Broadly, these discussions have seemed to advocate away from bi-directional type information flow.

More specifically, they have advocated away from "inwards" flow such as the context using the result of a call expression (as opposed to the arguments) influencing overload selection: https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p2875.md#overloaded-call-operator

Also more specifically, they have moved us away from a Hindley–Milner type system design for expression types, etc.

We should capture the underlying idea that informs these discussions as best we can and write it into a principle document that can be referenced. A nice property of such a principle is it can be relatively brief and doesn't need to be precise or exacting, but can still help indicate the directionality of Carbon's design in this space.

chandlerc commented 2 months ago

(marked as long-term because this isn't urgent at all, mostly filing the issue to not lose track of it)