[Haskell-cafe] Some thoughts on Type-Directed Name Resolution
Steve Horne
sh006d3592 at blueyonder.co.uk
Mon Jan 30 05:23:25 CET 2012
On 28/01/2012 13:00, Paul R wrote:
> AntC> Steve, I think that proposal has been rather superseeded by
> AntC> http://hackage.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields, which
> AntC> draws on TDNR. But SORF is best seen as an evolving design space, with precise
> AntC> details yet to be clarified/agreed. I've put my own variation into the ring:
> AntC> http://www.haskell.org/pipermail/glasgow-haskell-users/2011-
> AntC> December/021298.html -- which seems to have fallen into a black hole :-(
>
> AntC> One of the aspects of TDNR that wasn't so popular was that its type-directed
> AntC> resolution was very similar to instance resolution, but subtly and confusingly
> AntC> different.
>
> AntC> I guess we have to be very careful about the dot. It seems to be in a
> AntC> very 'crowded' syntax space, so if we implement the wrong way, we could end up
> AntC> shutting the door with the keys left inside.
>
> AntC> (...)
>
> All this dot syntax magic frankly frightens me. Haskell, as a pure
> functionnal language, requires (and allows !) a programming style that
> just does not mix well with object oriented practices. Stretching the
> syntax to have the dot feel a-bit-but-not-really like object oriented
> programming, mainly to have IDE autocompletion on some cases, does not
> make much sens.
That's a benefit of my idea. Modular programming used the dot long
before OOP became popular - OOP stole the dot from modular programming!
If a record is a module, that only means that one thing can be both a
module and a type (or value) at the same time. It takes little from OOP
that OOP didn't already take from the more fundamental modular
programming - and Haskell already has modules.
> If the editor matters - and it probably does -, we could rather take
> a more ambitious path, and work on a real semantic editor, as opposed to
> a plain left-to-right text editor, with hacked semantic goodies to
> alleviate the pain.
Every programmer has their own favorite editor, usually using the same
one to work in many different languages. For the moment, you'd have a
hard job separating me from Notepad++.
If you really want a "semantic editor", I'd argue a rich visual language
with a file format that isn't intended to be read directly. Something
more like writing in Word than writing in TeX. But I don't think most
programmers are ready for this, for various reasons. Version control
tools and readable differences get a place near the top of that list.
More information about the Haskell-Cafe
mailing list