Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Static types enable better static tooling. Dynamic types enable better dynamic tooling. :)

These days, most programmers are very familiar with high quality static tooling (IDEs) but less familiar with high quality dynamic tooling.



Right on. Here's an amazing example.

Pharo Smalltalk has a feature where you can find methods by giving an example of the input and output you expect. Forget how to uppercase a string? Just write:

    'eureka' . 'EUREKA'
and the IDE will suggest the method asUppercase.

It does this by dynamically invoking all of string's methods until it finds one whose output matches!


Neat, but not generalizable because methods often have side effects. You could easily know when this search is safe in a language that types side-effects, like Haskell. So types can enhance this feature too.


This actually exploits a static component of the type. This would not work on a fully dynamic type system.


I don't get it, why not?


On a fully dynamic type system, static analysis can't know what functions accept strings. It would have to try every single function, what is not viable, because many have side effects.


Does the language have rm -fr method ? ;) Still. nice


Maybe! But you have to admit that having static types with an AST available provides considerably more program synthesis and intellisense possibilities than only having an AST.


The dynamically typed case is not "only an AST," it's a living and breathing program. It made this HTTP request and performed some computation and read that file, and you can talk to it and learn all about its state!


Don't confuse dynamic typing with metaprogramming or fexpr. These are all orthogonal. Tooling for dynamically typed languages as a whole only have access to the AST, although some with the above features may have access to more.


Exactly.

I think the dynamic tooling are things like macros. It seems that JavaScript is being used as the dynamically typed foil, where a better example would be Scheme.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: