Replies: 3 comments 9 replies
-
Having this be an annotation would be consistent with how the GDScript leads have discussed their approach to keywords versus annotations, in my opinion, since it's modifying the existing behavior of a variable. However, for simple readability reasons, I feel like it'd be better to use the @readonly var parent = get_parent() is much more verbose than let parent = get_parent() to an extent that I feel the former's syntax could discourage its use, or at the very least make it harder to visually parse. I will concede that |
Beta Was this translation helpful? Give feedback.
-
no |
Beta Was this translation helpful? Give feedback.
-
Not using I was going to go on a big tangent, and I may in response to this, but in very simplistic terms, like a beginner may say: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
GDScript currently uses a
const
keyword for compile-time constants. It may be getting support for immutable variables (runtime constants) too, but a consensus from the community is desired to decide on the syntax:I have previously posted a preliminary informal poll with 8 suggested options, and an intermediate poll with 4 options.
As explained before, multiple rounds were used to account for secondary and negative preferences.
This is the last round, with only the 2 most voted options.
This poll is only about what the word itself should be. Whether it should be a prefix annotation to
var
or a standalone keyword (or even prefix keyword if allowed) is secondary in this poll.Disclaimer: I'm not a member or contributor of the repo, so treat this as a non-official "community" poll, for reference only. It's up to the devs whether they'll actually consider it or not.
Suggested syntax options
Informational only, doesn't necessarily mean all features would be supported as shown.
let
Proposing it as a standalone keyword. Unlikely to be fit for an annotation.
@readonly var
|readonly
Showing syntax as an annotation (devs seem to be moving away from prefix keywords).
Could be discussed as standalone keyword as well (replacing
var
instead of prefixing it).Considerations
You can read the posts in #820 and #12635 for the community's considerations regarding familiarity from other languages, succinctness/verbosity, explicitness of its meaning, risk of clashing, risk of confusion, personal preferences, etc.
Again, I intend to close it in about a month (hopefully my reminder works this time; I'll set it to Saturday August 16th).
Again, I won't look at the votes until it's closed, and I won't vote (unless it's a tie at the closing date).
31 votes ·
Beta Was this translation helpful? Give feedback.
All reactions