4 ms·
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 h
by ridiculous_fish 7y ago
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!
- naasking 7y agoNeat, 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.
- deleted 7y ago[deleted]
- marcosdumay 7y agoThis actually exploits a static component of the type. This would not work on a fully dynamic type system.
- ridiculous_fish 7y agoI don't get it, why not?
- marcosdumay 7y agoOn 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.
- zaphirplane 7y agoDoes the language have rm -fr method ? ;) Still. nice