[Haskell-cafe] Proposal: TypeDirectedNameResolution

Enrique enriquesl at gmail.com
Sun Mar 3 16:52:55 CET 2013


simonpj wrote: 

"What do I envy about object-oriented languages? Not state, not subtyping, 
not inheritance. But I do envy the power of type-based name resolution. 
Here's what I mean:

Programers can explore a library, with the help of an IDE, by typing "x.", at 
which point a list of x's methods pops up."

That feature is not really from OOP, as he also wrote. It is possible just 
because in Java or C++ you write the object first and then the method, 
connected with a dot. So, we could say that most of the OOP languages uses 
RPN (Reverse Polish Notation), but only for one argument: the object itself.

If Haskell would have been designed for RPN, it would be natural to have the 
same IDE power as the OOP languajes, in a more natural way. 

For example, as you write an integer the IDE could offer you the unary 
functions that can be applied to an integer, but if you enter a string after 
it, the IDE would offer you the functions of two arguments, one of them of 
type string and the other of type integer. That would be much more powerfull 
indeed than the OOP case. It could be used not only on an IDE, but also on 
the interpreter, and not only with declared names, but also with implicit 
types like numbers, text strings, tuples, enum elements, ... It would be 
easier work for the compiler as well. 

So, I think that it was not a good design decision not to use RPN as the 
basic notation for Haskell, but it is late for changing it :( . 

 




More information about the Haskell-Cafe mailing list