Forward compatibility (was Re: [Haskell-cafe] GHCi infers a type but
refuses it as type signature)
Luke Palmer
lrpalmer at gmail.com
Tue Jun 23 05:20:10 EDT 2009
On Tue, Jun 23, 2009 at 2:20 AM, <papa.eric at free.fr> wrote:
> > Simple: the definition of MonadState uses those extensions.
>
> Thanks, yes it helps and explains all. :^)
>
> I suppose then that if -XFlexibleContexts is indeed required by the
> standard libraries, it is a "safe" extension, meaning supported by all
> compilers? Are many such extensions de-facto standard that anyone can enable
> by default?
You should treat "all compilers" the same way as a universal quantifier in
mathematics. It's not just all the compilers you know about, but all
possible compilers. In which case the answer to your question is of course
no.
(Beware: incoming my "recurring rant of the month", which I am trying
ferociously to cram down the throats of my peers :-p)
By measuring your software's portability on this stricter criterion, you
contribute to the exponential growth of our field. It means that
*every *future
compiler can compile your code for 10% less effort*. *A future innovation
may rely on one such compiler, which means it can use your code 10% sooner
-- which may be the difference between your good code being used and it
being badly reimplemented (and future bug fixes in the new code does not
benefit yours). And so on, ad infinitum.
When you think about potability, think about it from the perspective of
twenty years in the future. Fundeps are becoming obsolete now, will your
code still work when they are gone? Will it still work when the typeclass
resolution algorithm is obsoleted by a superior algorithm (I'm looking at
you, Oleg! :-)? When Haskell is obsolete, how hard will it be to port?
Of course, there is definitely a place for extensions -- we should be
testing them, to help refine the language that will one day obsolete
Haskell. A culture of extension users helps us to know that, for example,
even though implicit params are cool, nobody cares.
I think "works on all existing compilers" is a fine definition of "portable"
-- let's just realize that there is a level of portability beyond that, a
level which gives our whole field a little boost.
</rant>
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090623/7a95f68e/attachment.html
More information about the Haskell-Cafe
mailing list