3 ms·
Static verification is great and all, but the most important reason for static typing is UI/UX: Hit-dot-see-what-I-can-do. No keeping APIs in my head or losin
by carsongross 15y ago
Static verification is great and all, but the most important reason for static typing is UI/UX: Hit-dot-see-what-I-can-do.
No keeping APIs in my head or losing flow to a google search, hit dot, see what I can do.
Everything beyond this is gravy.
- DanHulton 15y agoMany good editors/IDEs will do this for you fairly reliably. Komodo and Sublime Text both support this for PHP/JS at a minimum, as an example.
- WayneDB 15y agoKomodo relies on getting type info from JSDoc notation and Sublime Text barely does autocomplete at all. For instance type this into Sublime and you won't get a list of String methods when you type the last dot: var x = "Hi!"; x. I'm not sure how Komodo does with that one without any JSDoc notation. I'm know that there are editors that do a slightly better job (for instance, Visual Studio probably has the best Javascript autocomplete I've ever seen) but still, it really pales in comparison to how well it works with statically typed languages.
- Too 15y agoIn visual studio your example would work. You can even do it on user defined types. It's pretty accurate and actually finds every place where it seems reasonable where it could have the information. But it doesn't go much further than that. For example parameters inside functions don't have intellisense and return values from functions rarely do, but sometimes.
- WayneDB 15y agoYou're right about parameters inside of functions, but wrong about return values. It does work for return values as long as visual studio can deduce the type by running the code. For parameters, you have to help visual studio out by documenting what the parameter does using XML code comments (e.g. /// <param name="arg1" type="String">Arg1 description</param>).
- keypusher 15y agoI don't see how that is related to static typing. With Python for instance, code completion works great using Pydev+Eclipse or Pycharm.
- carsongross 15y agoDon't know what to tell you: the difference between the reliability and accuracy of statically typed autocomplete and dynamically typed autocomplete is night and day, by their nature. A best case scenario for dynamic typing is either global inference analysis, which is slow and painful, or relying on test/runtime information, which is unstable and incomplete. That's just a fact, man.
- heretohelp 15y agoNo, it's not. http://rope.sourceforge.net/ http://rope.sourceforge.net/ is pretty painless. Doesn't seem like you've actually used it.
- carsongross 15y agoLook, man, it just can't. Cute library though.
- heretohelp 15y agoYes it can. The language isn't non-deterministic, rope has the ability to do both basic static analysis (which catches the common cases 95% of the time), or it can do dynamic analysis to determine what went where. Please don't comment on what Rope can or cannot do unless you actually understand how it, or Python for that matter, works.
- randlet 15y agoWingIDE (my Python editor of choice) has fantastic support for this, as well as an excellent integrated debugger.