Skip to content

Comment on What Dynamic Typing Is Forparent

Comments

Dynamic languages can execute code without type annotations, so you _can_ just dismiss types as redundant metadata. But I don’t think that’s wise. I find types really useful as a human reader of the code.

Whether you write document them or not, types still exist, and you have to think about them.

Dynamic languages make it really hard to answer “what is this thing, and what can I do with it?”. You have to resort through tracing through the callers, to check the union of all possible types that make it to that point. You can’t just check the tests, because there’s no guarantee they accurately reflect all callers. A simple type annotation just gives you the answer directly, no need to play mental interpreter.

I don't disagree, dynamic languages require better writing skills, so for example, in case of bilingual teams, metadata helps bridge the language barrier. However, if your team is good at expressing how/what/why[1] in your dynamic language, you will not have much issue answering what things are. Again, there are costs with either choice.

[1]: https://max.engineer/maintainable-code

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.