3 ms·
> It's really sad when I see `foo(bar)`, and I have no idea what the type of `bar` is, and if it's an object, I have no idea what fields `bar` has With a stati
by u801e 9y ago
> It's really sad when I see `foo(bar)`, and I have no idea what the type of `bar` is, and if it's an object, I have no idea what fields `bar` has
With a statically typed language, you still have to look through the code to find the definition of an object. I believe that can be avoided by having easy to access to documentation which would also apply to dynamically typed languages like Python.
- Ensorceled 9y agoNot if you use Hungarian notation! Shudder.
- weberc2 9y agoRight, but modern text editors and IDEs automate the lookup, and failing that, you have the type right there so you can quickly and easily figure out which file contains its definition. I use Python every day, and the sad (but improving!) state of typing is one of my biggest grievances. Documentation doesn't close the gap because it is often incorrect or outdated; I've added more than a couple production bugs because I trusted the documentation. A type checker is necessary to keep the type annotations in line with the source code.
- dragonwriter 9y ago> With a statically typed language, you still have to look through the code to find the definition of an object Static typing (or, more to the point, compile time structure that doesn't require running the code to get right, but the two are closely linked) makes tooling to avoid manual lookups easier to implement and more reliable.
- dahauns 9y ago>I believe that can be avoided by having easy to access to documentation which would also apply to dynamically typed languages like Python. staring at five year old project, started as a one-off quick'n'dirty prototype, having gone through many hands doing one-off quick'n'dirty additions since then What documentation? But seriously - I don't have to "look through the code". It's a few keystrokes at most and it's always there and correct.
- winter_blue 9y ago> you still have to look through the code to find the definition of an object I haven't done this in the last 10 years. I typically use IDEs, and every IDE I've used has had a "Go To Definition/Declaration" feature, and let you set a key binding for it. On JetBrains' IDEs, I've gotten quite used to pressing Ctrl+B to jump to a type definition's, and then pressing Alt+← to jump back to where I was originally in the code.
- flavio81 9y ago>I typically use IDEs, and every IDE I've used has had a "Go To Definition/Declaration" feature This is also available in some dynamically typed languages, working just fine.
- lmm 9y agoYou can go to the definition, but the definition might just be foo.bar(). Whereas in a statically typed language the IDE can always tell you what the type is (you shouldn't even need to jump to the declaration/definition, you should be able to mouseover or hit a hotkey to just get the type without leaving the line you're on)
- dahauns 9y ago"working just fine". No, not even close to the same level.
- deleted 9y ago[deleted]