Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 26, 2004 make imports private by default | ||||
---|---|---|---|---|
| ||||
I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly. Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly. Just my opinion. Andrew Edwards |
September 26, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | Tyro wrote: > > I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly. > > Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly. > > Just my opinion. > Andrew Edwards I agree with you. If it is still possible at this state of development, I would even argue to make imports private by default and add a public keyword for the rare cases where this is needed. -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com |
September 26, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | On Sun, 26 Sep 2004 05:05:19 -0400, Tyro wrote:
> I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly.
>
> Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly.
>
> Just my opinion.
> Andrew Edwards
Aggreed, 100%. Always default to the least confusing behavior, don't pull in symbols from across the ocean ;)
Mike Swieton
__
You can tell the ideals of a nation by its advertisements.
- Norman Douglas
|
September 27, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | Agreed "Tyro" <ridimz_at@yahoo.dot.com> wrote in message news:cj60p4$4m$1@digitaldaemon.com... >I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly. > > Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly. > > Just my opinion. > Andrew Edwards |
September 27, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | "Tyro" <ridimz_at@yahoo.dot.com> escribió en el mensaje news:cj60p4$4m$1@digitaldaemon.com... |I don't know about you guys but IMHO imports should be made private by | default. On the grand scheme of things this is quite minuscule, however, | I think it important to point out that a vast majority of conflicts are | caused by the mere fact that imports are done publicly. | | Most often when I import a library module, I only want it to be made | available only in the file into which I imported it. If I need it to be | available to users of my code, I should then be required to state so | explicitly. | | Just my opinion. | Andrew Edwards I agree, but I think once Walter spoke of consistency: all things in D are public by default, so making imports private would break consistency. That's what he said, makes sense, although (again) I agree with the proposal. ----------------------- Carlos Santander Bernal |
September 27, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | Carlos Santander B. wrote:
> I agree, but I think once Walter spoke of consistency: all things in D are
> public by default, so making imports private would break consistency. That's what he said, makes sense, although (again) I agree with the proposal.
As do I.
|
September 27, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | > I agree, but I think once Walter spoke of consistency: all things in D are public by default, so making imports private would break consistency. That's
Yes consistency, that's what I thought. Kind of like it.
|
September 27, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bent Rasmussen | Bent Rasmussen wrote:
>>I agree, but I think once Walter spoke of consistency: all things in D are
>>public by default, so making imports private would break consistency. That's
>
>
> Yes consistency, that's what I thought. Kind of like it.
>
I agree that consistency is fundamentally important in the language. However, if in keeping the "tradition" one introduces characteristics that are both unintuitive and problematic, then the tradition must be broken in favor of a more sophisticated solution.
I would much rather feel somewhat inconsistent (a little less traditional) than having to hunt down bugs caused by importing someone else's library and plastering my code with "private import" when that is what I mean 99% of the time anyway.
|
September 30, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | me too.
Tyro wrote:
> I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly.
>
> Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly.
>
> Just my opinion.
> Andrew Edwards
|
September 30, 2004 Re: make imports private by default | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tyro | On Sun, 26 Sep 2004 05:05:19 -0400, Tyro wrote: > I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly. > > Most often when I import a library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly. > > Just my opinion. It's hard to think of any overriding counter argument. The only thing I can come up with so far is that making imports default to private is inconsistent with member declarations, as these are public by default. In the meantime I guess we need to get into the habit of coding thus ... private{ import std.string; import std.stdio; import whatever.etc; } -- Derek Melbourne, Australia 30/09/2004 2:55:29 PM |
Copyright © 1999-2021 by the D Language Foundation