-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
constants are actually "flat" #30212
Comments
I had some discussion with colleagues regarding this topic and eventually, my proposal would be to introduce a keyword So:
IMO it would be intuitive for people familiar with Java, C++, etc. |
I think changing the behavior of We can do this for 4.0 if anyone is currently relying on this behavior. |
Well, either way, |
This is a feature proposal disguised as a bug, so I'm closing it. Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
Godot version:
3.1 official build
OS/device including version:
Linux
Issue description & Steps to reproduce:
I'll start with quote from docs
Constants are similar to variables, but must be constants(...)
.The issue is, constants in godot are
flat
, i.e. if the constant is set e.g. toDictionary()
, the constant itself is constant, however dict's internals are not.Let's consider the example below (UTs using Gut):
The second test fails. I suspect why this is happening and even if this is made like that on purpose, IMO, it's counter-intuitive.
const
should enforcedeep
copying etc. I've already ran into trouble as I've been assuming consts are really const (IMO deep).After writing 1.5k LOC in GDScript this is the only weird issue I've faced.
It should either be fixed, or documented better.
The text was updated successfully, but these errors were encountered: