You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is such a basic feature, I'm shocked GDScript doesn't have this.
If you don't know what I'm talking about:
var float_or_string: float | string = "string" # this is a union float_or_string = 3.14 # does not throw error
GDScript looks very primative without basic type features. I don't think it's possible to achieve type safety without a basic set of tools which include type unions.
This is honestly very bad, and I think that implementing basic features like this should be high priority.
Describe the problem or limitation you are having in your project
Cannot achieve type safety using Godot
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Godot needs at least the minimum set of features needed to write typesafe code.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is no workaround for not having basic features like this.
Is there a reason why this should be core and not an add-on in the asset library?
People are not going to write typesafe code without a basic set of features that enable them to do so. People spoiled by typescript and strongly typed python will be looking at GDscrpit and immediatly see how unsafe the language is due to it's lack of type features. They might still use it anyways because Unity's leadship is so terrible and the rest of Godot is fine.
The text was updated successfully, but these errors were encountered:
Johnrobmiller
changed the title
Where are type unions??
In 2023, Godot still does not have type unions !!!
Oct 15, 2023
Describe the project you are working on
This is such a basic feature, I'm shocked GDScript doesn't have this.
If you don't know what I'm talking about:
var float_or_string: float | string = "string" # this is a union
float_or_string = 3.14 # does not throw error
GDScript looks very primative without basic type features. I don't think it's possible to achieve type safety without a basic set of tools which include type unions.
This is honestly very bad, and I think that implementing basic features like this should be high priority.
Describe the problem or limitation you are having in your project
Cannot achieve type safety using Godot
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Godot needs at least the minimum set of features needed to write typesafe code.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Typescript is a great example of how this should work: https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is no workaround for not having basic features like this.
Is there a reason why this should be core and not an add-on in the asset library?
People are not going to write typesafe code without a basic set of features that enable them to do so. People spoiled by typescript and strongly typed python will be looking at GDscrpit and immediatly see how unsafe the language is due to it's lack of type features. They might still use it anyways because Unity's leadship is so terrible and the rest of Godot is fine.
The text was updated successfully, but these errors were encountered: