Hiding import behaviour
Erik Hesselink
hesselink at gmail.com
Sun Oct 19 12:10:55 UTC 2014
I feel that this extension, while looking tempting for writing code
from scratch, might hurt maintainability of code. Adding an explicit
import can suddenly cause type errors in completely unrelated places
(when it hides an implicit import and the new function is type
incorrect), or worse, can cause semantic change (when it hides an
implicit import and the new function is type correct, but has
different behavior). Remember that not all code is written by the same
person, or in a short time frame, so not everybody might fully
understand every module and every import of the code they're editing.
Erik
On Sun, Oct 19, 2014 at 1:32 AM, David Feuer <david.feuer at gmail.com> wrote:
> I'm generally in favor of the proposal, but I figured I should mention one
> situation when I personally might find this confusing. If the module import
> list is very long, and includes an unrestricted import of a well-known
> module, it might be easy to assume a certain well-known function comes from
> there, when in fact it comes from some other module on the other end of the
> import list.
>
> On Oct 18, 2014 6:39 PM, "Joachim Breitner" <mail at joachim-breitner.de>
> wrote:
>>
>> Hi,
>>
>> Am Samstag, den 18.10.2014, 11:02 -0700 schrieb htebalaka:
>> > I guess my central point is I don't see how anyone can benefit from the
>> > current behaviour. For instance, a simple real world example:
>> >
>> > import Prelude
>> > import Data.Text.Lazy.IO (putStrLn)
>>
>> I find this quite convincing. If I bother to explicitly write out „take
>> putStrLn from Data.Text.Lazy.IO“, why should the compiler assume that I
>> might have meant some putStrLn from somewhere else.
>>
>> Of course, order should not matter (I don’t think anyone suggested it
>> should, I think Austin simply mis-read that).
>>
>> Greetings,
>> Joachim
>>
>>
>> --
>> Joachim “nomeata” Breitner
>> mail at joachim-breitner.de • http://www.joachim-breitner.de/
>> Jabber: nomeata at joachim-breitner.de • GPG-Key: 0xF0FBF51F
>> Debian Developer: nomeata at debian.org
>>
>>
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
More information about the Glasgow-haskell-users
mailing list