Leyec, the magic dev behind it managed to make a full python type checker with super advanced features and about 0 overhead. It's crazy
>Beartype now implicitly type-checks all annotated classes, callables, and variable assignments across all submodules of all packages.
"Typed Python" does poorly (compared to e.g. Typescript) on things like overloading functions, generics, structural subtyping, et al.
Golang does typing, but JSONs are PITA to handle.
Try parsing something like `[{"a': 1, "b": "c", "d": [], "e": {}}, null, 1, "2"]` in go.
Types are a bless as well as a curse.
We used to have strict typed XML. Nobody even bothered.
Not JSONs in general, but a sane API would never return something like that.
> We used to have strict typed XML. Nobody even bothered.
Nowadays there is OpenAPI, GraphQL, protobuf, etc. and people do bother about such things.
Yeah, because it was ugly as hell and not human-readable.
But the same issue exists as other dynamic languages, how do you know what the type is of the item you are accessing?
If you know the array will be laid out exactly like that before you make the request you can always create a custom parser to return a struct with those fields name what they actually are instead of arbitrary data.
The only valid way to parse that dynamically is to try and fail in a loop which is inefficient enough that you should stop using whatever API returns that monstrosity.
re: Python. I like PyRight/PyLance for Python typing, it seems to "just work" afaict. I also like msgspec for dataclass like behavior [2].
---