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

New name for "constant" value phase

Open josh11b opened this issue 3 years ago • 3 comments

(separate from the question of whether the value phases are actually just value categories)

The thing we want to name is "a value that is known at type-checking time" in contrast to "symbolic value", which is a value that will be known at code generation / monomorphization time but type checking is done without knowing its value, or "runtime value" which is not known until runtime.

Original suggestion for this name in #typesystem on Discord. Suggestion to find a new name in PR #1378.

josh11b avatar Jul 15 '22 04:07 josh11b

I've been warming up to the idea of referring to all :! values as "constants", and the ones with template :! as "template constants". Some things I like about this nomenclature:

  • it exactly matches our syntax
  • it matches people's intuition that a constant is something known at compile time
  • it correctly implies that template constants are more specialized, and non-template constants are the normal thing you should use in ordinary code
  • these names are natural enough that I think users will try to use them, whether they're our official terms or not! As @chandlerc pointed out in https://github.com/carbon-language/carbon-lang/pull/1378/files#r921592116, users will want to refer to all :! values as constants, so it's great if we can make that the actual name.

mconst avatar Jul 15 '22 06:07 mconst

I've been warming up to the idea of referring to all :! values as "constants", and the ones with template :! as "template constants".

Slight tweak that preserves many of the benefits that I want to mention:

:! -> "symbolic constants"

template _:! -> "template constants"

The idea being that they are both constants, symbolic ones unavailable at type-checking, template available.

I'm not advocating one way or the other, just floating it so we can think about it. I'm still pondering a bit.

chandlerc avatar Jul 15 '22 07:07 chandlerc

! is typically associated with negating a value or use within the inequality operator.

I'm not sure const comes to anyone's mind when they see !. Remember to make a language as readable and inviting as possible. There's a reason we don't all use Rust.

Turbine1991 avatar Jul 20 '22 16:07 Turbine1991

Just confirming that the leads are happy with the tweaked names here:

https://github.com/carbon-language/carbon-lang/issues/1391#issuecomment-1185245169

Marking this as decided!

chandlerc avatar Nov 03 '22 03:11 chandlerc

Just confirming that the leads are happy with the tweaked names here:

#1391 (comment)

Marking this as decided!

To be quite honest, if it's too different to other languages. People may as well learn Rust. This language will likely be sidetracked to some existing projects which will get updates.

I've given up on Carbon and started learning Rust as it's nothing like C++/Javascript/C# syntactically, and Rust is almost just as different.

Turbine1991 avatar Nov 06 '22 03:11 Turbine1991

Just a quick reminder to not use specific issues to post more general feedback -- that should happen on its own discussion thread. Also, please keep feedback constructive.

chandlerc avatar Nov 07 '22 04:11 chandlerc

Just a quick reminder to not use specific issues to post more general feedback -- that should happen on its own discussion thread. Also, please keep feedback constructive.

It was constructive criticism to not alienate the C++ folk.

Turbine1991 avatar Nov 07 '22 16:11 Turbine1991

Just a quick reminder to not use specific issues to post more general feedback -- that should happen on its own discussion thread. Also, please keep feedback constructive.

It was constructive criticism to not alienate the C++ folk.

Not for this issue. This issue is about a terminology question in how we explain Carbon. The feedback is not specific to this terminology and doesn't connect it to alienating C++ folks. I really am happy to engage and discuss this topic, but it doesn't belong on this issue. If you'd like to have a constructive and friendly discussion about the tradeoffs around familiarity for C++ folks, please start a fresh thread, ideally in the "discussions" part of GitHub.

I'm going to hide the new comment and this comment to keep this issue focused. Please do not continue to ignore moderator feedback on where to have discussions.

chandlerc avatar Nov 07 '22 23:11 chandlerc