Expand GDScript guidelines with guidelines from the main repository.#53
Expand GDScript guidelines with guidelines from the main repository.#53Ivorforce wants to merge 1 commit intogodotengine:mainfrom
Conversation
51c40a2 to
8d3f6e9
Compare
| ----------------- | ||
|
|
||
| GDScript is gradually typed. Type hints are optional and help with static analysis and performance. | ||
| However, typed code must easily interoperate with untyped code. |
There was a problem hiding this comment.
A short code example here could be nice.
How would issues with typed code interoperating with untyped code play into GDScript language development itself? I would think what's being described here would be more relevant for those writing addons and game scripts in GDScript itself.
There was a problem hiding this comment.
The idea, I think, is that people can always choose to either type or not type a section of their GDScript code, and it works seamlessly without weird workarounds. This is a design goal for the language, not a guideline for GDScript users.
I guess we could provide a code example, but I'm not sure if that would be useful. Given that it seems to be ambiguous right now, maybe we should work on the phrasing instead?
There was a problem hiding this comment.
This is more of a statement of fact than a guideline or anything of the like. For actual users, they should always use typed code when possible.
For GDScript developers, it is a requirement that typed code must weaken to untyped code without loss in functionality and not require conversion code from users.
All things said, I don't think it is worth worrying too much about the verbiage. It seems very likely that the whole "gradually typed" thing would need to be scrapped in favor of a proper strongly-typed paradigm to do the kinds of things that people want to see in the language.
There was a problem hiding this comment.
In my experiences working on GDScript language features so far, it's felt like the strict typing of C++ has forced the GDScript features to be type-safe and adaptable to untyped code. As a result, it comes across to me as more of a "statement of fact" like you said.
However, I know my work with GDScript has been quite limited, so there are no doubt places where a GDScript engine developer would need to take into consideration typed vs untyped code. Something like an example scenario or little code snippet that demonstrates this could be helpful for giving contributors an idea of what to look out for.
There was a problem hiding this comment.
I'm a bit harder pressed to find a nice and self contained example for this, but I remain convinced that this is a design goal rather than a state of fact. There are tons of details in gradual typing that you can get wrong, or get right, to shape the experience of users that need glue code between typed and untyped code.
8d3f6e9 to
ddcfa27
Compare
ddcfa27 to
ec3833f
Compare
ec3833f to
bf5c4b1
Compare
Migrates some information from the README.md on the main godot repository.
I've paraphrased it to fit with guidelines, and added one of my own which often comes up.
I also removed the last point during migration (about language speed). I don't think it makes for a good guideline for a language to be slow 😅
Corresponding engine PR: godotengine/godot#115820