whython icon indicating copy to clipboard operation
whython copied to clipboard

Allow assigning to constants

Open cgccuser opened this issue 4 years ago • 3 comments

Why should 1 always be 1? Why can True never be False? Why can None never be "everything"? These arbitrary, fascist rules must not be enforced any longer. The Python developers may never listen to me, but I hope that the open-minded folks at Whython will. I propose allowing users to assign values to constants/literals/whatever they're called. No longer should "bad" = "good" be an error! It should replace all occurrences of the string bad with good later in the program. Likewise for numbers and stuff.

cgccuser avatar Nov 26 '21 16:11 cgccuser

Not sure this is really possible...

pxeger avatar Nov 26 '21 16:11 pxeger

Perhaps you could replace every constant/literal with get_literal_or_previously_assigned_value("foo") and have a dictionary of these previously assigned "constants."

cgccuser avatar Nov 27 '21 14:11 cgccuser

Ooh, that's an excellent hack!

pxeger avatar Nov 27 '21 15:11 pxeger