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

no optional chaining - we at least have `nullable_thing and nullable_thing.property` but cmon, man just give me `nullable_thing?.property`

0 reposts1 like

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

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