carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
https://github.com/carbon-language/carbon-lang/blob/trunk/README.md
Other
32.3k stars 1.48k forks source link

Does Lambdas' introduction of ref and copy resolve the open question in values.md? #3859

Open CJ-Johnson opened 3 months ago

CJ-Johnson commented 3 months ago

Summary of issue:

/docs/design/values.md#value-representation-and-customization

Open question: The syntax for this is just placeholder, using a placeholder keyword. It isn't final at all and likely will need to change to read well.

Can const Self be replaced with const copy? Can const Self* be replaced with const ref?

See Lambdas proposal at https://github.com/carbon-language/carbon-lang/pull/3848

Details:

No response

Any other information that you want to share?

No response

justzh commented 3 months ago

Yes it does because the altimeter requires it.

geoffromer commented 2 months ago

It seems like it would be confusing if in this context const copy and const ref are self-contained expressions that refer to types, while in an implicit parameter list they are introducers or modifiers for a larger syntactic construct that refers to a variable (or a whole set of variables, in the case of the default capture mode).

It does seem like there's some commonality in the underlying semantics, but I'm not sure how to surface that in the syntax. When/if the design for function calls, extend adapt, etc. gets to a point where we can define reference types in terms of those concepts, I think we'll be in a much better position to sort this out.