Language level heads-up warnings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Language level heads-up warnings

David Luposchainsky
Hello GHC-Devs,

The discussion on the libraries mailing list brought up the issue of
breaking compatbility in favour of language evolution/sanitation again;
topics mentioned specifically were Prelude's monomorphic
Foldable/Traversable functions, and the Applicative/Monad issue.

The main arguments of both sides are these:

(+) We've been aware of certain unfortunate features of Base for a long
time, and we understand very well how to fix this, and what the
consequences are.

(-) Changing core language features is something you can never forsee
the consequences of. Breaking compatibility should be avoided at all costs.

(There's also the argument about beginner friendliness, which is not
backed by evidence, so I'll leave it out here.)

These two seem contradictory, however they have one almost obvious
common ground: we can already write code right now that will be
unaffected by moving Foldable/Traversable/Applicative+Monad to the
Prelude. Suppose all code is written with this in mind, the change is
trivial.

Which brings us to the actual problem, namely that code is not written
with this in mind. It is easy to forget about the issue in a practical
setting, regardless of how small the required effort is. Therefore, I'd
like to bring forward the idea of "language level heads-up warnings"
(suggestions for better names appreciated).

Right now, we can only deprecate functions. When used, GHC informs us
"hey, this will work for now, but better use that in the future".
However, this mechanism is too specialized to tackle the problem above:
for example, there is no way to warn a user about a Monad that is not an
Applicative.

If the community agrees on making one of the "big" changes, what would
you think of adding warnings about language usage? I'm sure over the
course of a couple of GHC releases, the great majority of libraries
would be modified to rectify these warnings again. If you want an
example: "Warning: Monad without Applicative. This will be enforced in a
future language standard."

These warnings would have to be hardcoded into GHC, but keep in mind
that this is only for very few, relatively high impact changes, and can
be removed once everything is done. In my opinion, this may be a far
better transitional feature than the alternative (adding compatibility
modules, convincing thousands of developers to listen to the people in
favour of the change, ...).

Greetings,
David


Reply | Threaded
Open this post in threaded view
|

Language level heads-up warnings

Simon Peyton Jones
Yes, I think that if the libraries community thought it was important, I (or indeed someone else) could add a couple of ad-hoc warnings to GHC without much work. But you'd all need to be clear and specific about what warnings were wanted, and they'd need to be easy to check (ie no global program analysis).

Simon

-----Original Message-----
From: ghc-devs-bounces at haskell.org [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Luposchainsky
Sent: 22 May 2013 12:36
To: ghc-devs at haskell.org
Subject: Language level heads-up warnings

Hello GHC-Devs,

The discussion on the libraries mailing list brought up the issue of breaking compatbility in favour of language evolution/sanitation again; topics mentioned specifically were Prelude's monomorphic Foldable/Traversable functions, and the Applicative/Monad issue.

The main arguments of both sides are these:

(+) We've been aware of certain unfortunate features of Base for a long time, and we understand very well how to fix this, and what the consequences are.

(-) Changing core language features is something you can never forsee the consequences of. Breaking compatibility should be avoided at all costs.

(There's also the argument about beginner friendliness, which is not backed by evidence, so I'll leave it out here.)

These two seem contradictory, however they have one almost obvious common ground: we can already write code right now that will be unaffected by moving Foldable/Traversable/Applicative+Monad to the Prelude. Suppose all code is written with this in mind, the change is trivial.

Which brings us to the actual problem, namely that code is not written with this in mind. It is easy to forget about the issue in a practical setting, regardless of how small the required effort is. Therefore, I'd like to bring forward the idea of "language level heads-up warnings"
(suggestions for better names appreciated).

Right now, we can only deprecate functions. When used, GHC informs us "hey, this will work for now, but better use that in the future".
However, this mechanism is too specialized to tackle the problem above:
for example, there is no way to warn a user about a Monad that is not an Applicative.

If the community agrees on making one of the "big" changes, what would you think of adding warnings about language usage? I'm sure over the course of a couple of GHC releases, the great majority of libraries would be modified to rectify these warnings again. If you want an
example: "Warning: Monad without Applicative. This will be enforced in a future language standard."

These warnings would have to be hardcoded into GHC, but keep in mind that this is only for very few, relatively high impact changes, and can be removed once everything is done. In my opinion, this may be a far better transitional feature than the alternative (adding compatibility modules, convincing thousands of developers to listen to the people in favour of the change, ...).

Greetings,
David

_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs


Reply | Threaded
Open this post in threaded view
|

Language level heads-up warnings

David Luposchainsky
On 2013-05-22 15:42, Simon Peyton-Jones wrote:
> Yes, I think that if the libraries community thought it was
> important, I (or indeed someone else) could add a couple of ad-hoc
> warnings to GHC without much work. But you'd all need to be clear and
> specific about what warnings were wanted, and they'd need to be easy
> to check (ie no global program analysis).

Simon,

good to hear that it's worth thinking about.

I'm not sure what exactly "no global program analysis" means here. Where
would the boundaries of such warnings be? I could imagine problems if
Applicative/Monad are defined in separate packages/modules (although
that may be rare in practice).

Greetings,
David


Reply | Threaded
Open this post in threaded view
|

Language level heads-up warnings

Simon Peyton Jones
I'm just saying that GHC has to be able to check while compiling one module, ie as now.  (It can see details of the things it imports, obviously, since it needs to know that to compile the module)

| -----Original Message-----
| From: David Luposchainsky [mailto:dluposchainsky at googlemail.com]
| Sent: 22 May 2013 14:54
| To: ghc-devs at haskell.org
| Cc: Simon Peyton-Jones
| Subject: Re: Language level heads-up warnings
|
| On 2013-05-22 15:42, Simon Peyton-Jones wrote:
| > Yes, I think that if the libraries community thought it was
| > important, I (or indeed someone else) could add a couple of ad-hoc
| > warnings to GHC without much work. But you'd all need to be clear and
| > specific about what warnings were wanted, and they'd need to be easy
| > to check (ie no global program analysis).
|
| Simon,
|
| good to hear that it's worth thinking about.
|
| I'm not sure what exactly "no global program analysis" means here. Where
| would the boundaries of such warnings be? I could imagine problems if
| Applicative/Monad are defined in separate packages/modules (although
| that may be rare in practice).
|
| Greetings,
| David