Hacker News new | past | comments | ask | show | jobs | submit login

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




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

Search: