Shreyan, you have probably spent hundreds, maybe thousands of words to avoid giving straightforward, direct, explicit answers to the questions, preferring to force us to guess what you mean from vague analogies.
Please stop. Please give an explicit description of the functional requirements of this proposed feature. Give code samples showing the exact behaviour. Stop expecting us to guess what you mean when your statements contradict themselves.
what happens when I try to rebind a constant?
constant pi = 3.14 # later pi = 3.1415
For the record, this is not a rhetorical question. I do not know the answer, I have asked at least twice before what happens when we rebind a constant, *and you won't tell me*.
On Wed, May 26, 2021 at 09:55:41AM -0000, Shreyan Avigyan wrote:
Literals mean 10 or 20. Can you assign something to literal? No.
Constants aren't literals, they are names. `10` is a literal, but `pi` is a constant. Can you assign to a name? Yes, otherwise we can't give the constant a value in the first place. Can you rebind that name? You have said yes. You wrote:
"Constants doesn't mean we can't reassign the name to a different value."
Actually, I think most people think that being a constant *does* mean that you can't reassign the name to a different value. Otherwise its not a constant, its just a variable.
But in the same post I linked to above you explicitly ruled out classic constants like found in C and Java (and Pascal, and other languages). So now I have *no idea* what your constants are, since apparently they behave exactly like variables: they are names that refer to values, and you can rebind them to new values.
But you can assign something to a variable to point to another value. That's why I said constants should behave like literals. Point is constants are names bind to a value. We can change the value but not the name to point to a different value.
What do you mean by "change the value"? Are you talking about mutable objects?
Earlier you said that we can change the name to point to a different value, now you say that we can't.
Simply think "const type *pointer" not "type *pointer const".
That means nothing to me. This is a proposal for a feature in Python, please describe it in terms of existing Python behaviour, not whatever language that is.
And by debugging I meant it would immediately be detectable if someone tries to change the constant or not. (Not a good argument in constant's favor though)
How would it be detectable? Please stop expecting us to guess what will happen. **Tell us what will happen.**
It shouldn't be this hard to get information out of somebody proposing a new language feature :-(