-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Add typed variables to GDScript #2200
Comments
This is something i really, really want to do (typed variables), as it On Sat, Jun 27, 2015 at 5:39 PM, Ace-Dragon notifications@github.com
|
I see, I didn't know that adding this would entail a very involved process. I don't need it today (my game works very smooth right now), but hopefully it can be done within the next several version releases. |
after a long discussion, GDScript will be left untyped. We may make or bind an alternative language that is typed and leave gdscript as is. |
@reduz Recently we discussed that this is probably no longer the case, as it would make JIT-ing much simpler... so this should be reopened, right? 😃 |
Want to try adding it? It could be a syntax like
var a:int
for example
On Dec 29, 2016 17:36, "Bojidar Marinov" <notifications@github.com> wrote:
@reduz <https://github.com/reduz> Recently we discussed that this is
probably no longer the case, as it would make JIT-ing much simpler... so
this should be reopened, right? 😃
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2200 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z2xnD-VM7ya9W-NWotaK--88thHrsks5rNBnMgaJpZM4FNYOb>
.
|
I prefer Dart's syntax: var imVariant = "hi"
String imString = "ok thx" |
Not having optional static typing that is especially used for ALL engine API means the learning curve for using Godot skyrockets. The constant requirement to consult documentation is frustrating. Sorry guys ;( |
If that "var" keyword means "variant", neikeq's syntax makes sense. |
Juan has some plans about implementing optional static typing in GDScript, which may be implemented in a future Godot 3.x release (it won't be done for 3.0, as it is currently in feature freeze). This could also bring performance improvements when making use of static types. Also, note that you can access the API documentation very easily from the editor, you can even hold Ctrland click on a class name to access its built-in documentation. |
Patrons voted this, so its priority for 3.1
…On Dec 2, 2017 8:19 AM, "Hugo Locurcio" ***@***.***> wrote:
Not having optional static typing that is especially used for ALL engine
API means the learning curve for using Godot skyrockets. The constant
requirement to consult documentation is frustrating. Sorry guys ;(
Juan has some plans about implementing optional static typing in GDScript,
which may be implemented in a future Godot 3.x release (it won't be done
for 3.0, as it is currently in feature freeze). This could also bring
performance improvements when making use of static types.
Also, note that you can access the API documentation very easily from the
editor, you can even hold Ctrland click on a class name to access its
built-in documentation.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2200 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z25e2QmcdkCliOrxcS4cC8bl2Nr4vks5s8TIrgaJpZM4FNYOb>
.
|
This is a duplicate of #10630, which is more recent but also has some more activity, so closing this one in favour of the other. If any information described here is missing from the other issue, feel free to link it/copy it there. |
So right now, every variable can be one of three types...
However, the downside with having to use dynamic types with all possible values that are changeable is that they are not the fastest solution around. Now I propose that GDscript gets a third main variable type, static.
The main benefit I can see is that it can potentially make scripts a bit faster, this will not replace the general dynamic type, but merely give the developer another way to optimize logic and make code more readable (because the interpreter would not have to check what type the value is and will throw an error if the wrong type of value is assigned).
The syntax would work similar to how the export system works, so you could have like...
Would this be worth adding to Godot (which would depend on how much speed gain scripts can get in practice)?
The text was updated successfully, but these errors were encountered: