Post

gdscript as a language is like... weird its elegance comes from how nicely it integrates with Godot, like the dedicated syntax for signals, exports, custom node types, etc. but elsewhere, there are so many papercuts and seemingly missing features that it feels awkward to write at times

no keyword arguments - feels puzzling that one wouldn't take one of the best features from its primary source of inspiration, Python no structs/record/dataclass equivalent - tiny small-scope well-typed structures are still best made with class definitions and verbose Java-style constructor init

and the big one: the type system on the positive, it's nice that it has good inference (usually) and runtime validation. I'm glad it exists, and I'd rather have what's here than have nothing. but what's here is rather... frustrating

0 reposts0 likes

map/filter/reduce - you'll run into problems 95% of the time using these functions because lambdas are not well-typed. map and filter don't narrow the type of array items, so you need to awkwardly and unsafely cast the resulting array a lot of the time

`is` doesn't narrow variable types... kind of? if you write this: if item is Actor and item.on_stage: the `item` variable isn't narrowed after `and`, but with this: if item is Actor: if item.on_stage: you get autocomplete, but the type is still seemingly unchanged? scary and confusing

... so the soundest way to check a casted type is this: var actor := item as Actor if actor and actor.on_stage: actor becomes null at runtime if it's not an instance of Actor i honestly don't hate this behavior, but the verbosity vs. what could be a simple narrowed check is not great

no generics! while Array and Dictionary (only recently, but thank god) can be generic, you cannot have custom generic classes or types, and generic _functions_ are nonexistent they needed to add lerpi and lerpf for ints and floats respectively because lerp is untyped and also works on vectors. ugh