carbon-lang icon indicating copy to clipboard operation
carbon-lang copied to clipboard

Always `==` not `=` in `where` clauses

Open josh11b opened this issue 3 years ago • 2 comments

Instead of having two different operators and semantics when constraining an associated type to be equal to another type variable versus a concrete type, unify the semantics and consistently use just the == operator in where clauses.

josh11b avatar Aug 19 '22 01:08 josh11b

Seems like a good change to me. I might remark = feels like assignment, but where feels more like a condition. It might particularly be worth noting that in examples like let PointT:! NSpacePoint where .N = 2;, let supports assignment following so using == to make it read less like an assignment might improve readability.

jonmeow avatar Aug 19 '22 15:08 jonmeow

It might particularly be worth noting that in examples like let PointT:! NSpacePoint where .N = 2;, let supports assignment following so using == to make it read less like an assignment might improve readability.

I added this rationale to the alternatives considered: https://github.com/carbon-language/carbon-lang/pull/2070/commits/fefcce63c94cc6cbd52ceb58e7f75bf5c9f21bcc

josh11b avatar Aug 19 '22 15:08 josh11b

I'm going to withdraw this proposal in favor of #2173 .

josh11b avatar Sep 21 '22 23:09 josh11b