Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 07, 2006 private module declarations | ||||
---|---|---|---|---|
| ||||
I know this is not the first time this comes into the light but... I insist. Actually (luckily), one can do the following: bar.d | class Bar {...whatever...} // Aux object foo.d | private import bar; // Private could be omitted | | class Foo {...whatever...} main.d | import foo; | | void main() | { | Foo f = new Foo; | Bar b = new Bar; // Error, private imported in foo.d | ... What are the difficulties of implementing in the language the following? foo.d | private class Bar {...whatever...} // Aux object | class Foo {...whatever...} main.d | import foo; | | void main() | { | Foo f = new Foo; | Bar b = new Bar; // Error, private member of foo.d | ... I would love to see this someday. Regards, -- Tom; "Some things have to be believed to be seen." |
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | "Tom" <ihate@spam.com> wrote in message news:eb60uq$7eo$1@digitaldaemon.com... > What are the difficulties of implementing in the language the following? > > foo.d > | private class Bar {...whatever...} // Aux object > | class Foo {...whatever...} > > main.d > | import foo; > | > | void main() > | { > | Foo f = new Foo; > | Bar b = new Bar; // Error, private member of foo.d > | ... > > I would love to see this someday. I would absolutely love to see this. I mean, private module members already exist - but only for variables and functions. I've always wanted to be able to make aggregate types private to a module. |
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | On Sun, 06 Aug 2006 21:19:35 -0300, Tom wrote: > I know this is not the first time this comes into the light but... I insist. > > Actually (luckily), one can do the following: > > bar.d >| class Bar {...whatever...} // Aux object > > foo.d >| private import bar; // Private could be omitted >| >| class Foo {...whatever...} > > main.d >| import foo; >| >| void main() >| { >| Foo f = new Foo; >| Bar b = new Bar; // Error, private imported in foo.d >| ... > > What are the difficulties of implementing in the language the following? > > foo.d >| private class Bar {...whatever...} // Aux object >| class Foo {...whatever...} > > main.d >| import foo; >| >| void main() >| { >| Foo f = new Foo; >| Bar b = new Bar; // Error, private member of foo.d >| ... > > I would love to see this someday. Makes a lot of sense to me too. What is fundamentally different about classes and structs, and every other type of declaration when it comes to visibility/accessibility? I'm sure this is a hang over from "the way C++ does it" mentality. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 7/08/2006 1:08:40 PM |
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | Tom wrote:
> I know this is not the first time this comes into the light but... I insist.
>
> Actually (luckily), one can do the following:
>
> bar.d
> | class Bar {...whatever...} // Aux object
>
> foo.d
> | private import bar; // Private could be omitted
> |
> | class Foo {...whatever...}
>
> main.d
> | import foo;
> |
> | void main()
> | {
> | Foo f = new Foo;
> | Bar b = new Bar; // Error, private imported in foo.d
> | ...
>
> What are the difficulties of implementing in the language the following?
>
> foo.d
> | private class Bar {...whatever...} // Aux object
> | class Foo {...whatever...}
>
> main.d
> | import foo;
> |
> | void main()
> | {
> | Foo f = new Foo;
> | Bar b = new Bar; // Error, private member of foo.d
> | ...
>
> I would love to see this someday.
I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
Sean
|
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote:
> Tom wrote:
>
>> I know this is not the first time this comes into the light but... I insist.
>>
>> Actually (luckily), one can do the following:
>>
>> bar.d
>> | class Bar {...whatever...} // Aux object
>>
>> foo.d
>> | private import bar; // Private could be omitted
>> |
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private imported in foo.d
>> | ...
>>
>> What are the difficulties of implementing in the language the following?
>>
>> foo.d
>> | private class Bar {...whatever...} // Aux object
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private member of foo.d
>> | ...
>>
>> I would love to see this someday.
>
>
> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
>
>
> Sean
Count me too;
|
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to kris | kris wrote:
> Sean Kelly wrote:
>> Tom wrote:
>>
>>> I know this is not the first time this comes into the light but... I insist.
>>>
>>> Actually (luckily), one can do the following:
>>>
>>> bar.d
>>> | class Bar {...whatever...} // Aux object
>>>
>>> foo.d
>>> | private import bar; // Private could be omitted
>>> |
>>> | class Foo {...whatever...}
>>>
>>> main.d
>>> | import foo;
>>> |
>>> | void main()
>>> | {
>>> | Foo f = new Foo;
>>> | Bar b = new Bar; // Error, private imported in foo.d
>>> | ...
>>>
>>> What are the difficulties of implementing in the language the following?
>>>
>>> foo.d
>>> | private class Bar {...whatever...} // Aux object
>>> | class Foo {...whatever...}
>>>
>>> main.d
>>> | import foo;
>>> |
>>> | void main()
>>> | {
>>> | Foo f = new Foo;
>>> | Bar b = new Bar; // Error, private member of foo.d
>>> | ...
>>>
>>> I would love to see this someday.
>>
>>
>> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
>>
>>
>> Sean
>
>
> Count me too;
Ditto.
|
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave | Dave wrote:
> kris wrote:
>
>> Sean Kelly wrote:
>>
>>> Tom wrote:
>>>
>>>> I know this is not the first time this comes into the light but... I insist.
>>>>
>>>> Actually (luckily), one can do the following:
>>>>
>>>> bar.d
>>>> | class Bar {...whatever...} // Aux object
>>>>
>>>> foo.d
>>>> | private import bar; // Private could be omitted
>>>> |
>>>> | class Foo {...whatever...}
>>>>
>>>> main.d
>>>> | import foo;
>>>> |
>>>> | void main()
>>>> | {
>>>> | Foo f = new Foo;
>>>> | Bar b = new Bar; // Error, private imported in foo.d
>>>> | ...
>>>>
>>>> What are the difficulties of implementing in the language the following?
>>>>
>>>> foo.d
>>>> | private class Bar {...whatever...} // Aux object
>>>> | class Foo {...whatever...}
>>>>
>>>> main.d
>>>> | import foo;
>>>> |
>>>> | void main()
>>>> | {
>>>> | Foo f = new Foo;
>>>> | Bar b = new Bar; // Error, private member of foo.d
>>>> | ...
>>>>
>>>> I would love to see this someday.
>>>
>>> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
>>>
>>> Sean
>>
>> Count me too;
>
> Ditto.
Tritto. (Is that even a word?)
-- Chris Nicholson-Sauls
|
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Nicholson-Sauls | Chris Nicholson-Sauls wrote: > Dave wrote: >> kris wrote: >> >>> Sean Kelly wrote: >>> >>>> Tom wrote: >>>> >>>>> I know this is not the first time this comes into the light but... I insist. >>>>> >>>>> Actually (luckily), one can do the following: >>>>> >>>>> bar.d >>>>> | class Bar {...whatever...} // Aux object >>>>> >>>>> foo.d >>>>> | private import bar; // Private could be omitted >>>>> | >>>>> | class Foo {...whatever...} >>>>> >>>>> main.d >>>>> | import foo; >>>>> | >>>>> | void main() >>>>> | { >>>>> | Foo f = new Foo; >>>>> | Bar b = new Bar; // Error, private imported in foo.d >>>>> | ... >>>>> >>>>> What are the difficulties of implementing in the language the following? >>>>> >>>>> foo.d >>>>> | private class Bar {...whatever...} // Aux object >>>>> | class Foo {...whatever...} >>>>> >>>>> main.d >>>>> | import foo; >>>>> | >>>>> | void main() >>>>> | { >>>>> | Foo f = new Foo; >>>>> | Bar b = new Bar; // Error, private member of foo.d >>>>> | ... >>>>> >>>>> I would love to see this someday. >>>> >>>> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then. >>>> >>>> Sean >>> >>> Count me too; >> >> Ditto. > > Tritto. (Is that even a word?) Quatro? -- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi |
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote:
> Tom wrote:
>> I know this is not the first time this comes into the light but... I insist.
>>
>> Actually (luckily), one can do the following:
>>
>> bar.d
>> | class Bar {...whatever...} // Aux object
>>
>> foo.d
>> | private import bar; // Private could be omitted
>> |
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private imported in foo.d
>> | ...
>>
>> What are the difficulties of implementing in the language the following?
>>
>> foo.d
>> | private class Bar {...whatever...} // Aux object
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private member of foo.d
>> | ...
>>
>> I would love to see this someday.
>
> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
>
I knew it didn't work this way but use this technique in hope it will work one day.
|
August 07, 2006 Re: private module declarations | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote:
> Tom wrote:
>> I know this is not the first time this comes into the light but... I insist.
>>
>> Actually (luckily), one can do the following:
>>
>> bar.d
>> | class Bar {...whatever...} // Aux object
>>
>> foo.d
>> | private import bar; // Private could be omitted
>> |
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private imported in foo.d
>> | ...
>>
>> What are the difficulties of implementing in the language the following?
>>
>> foo.d
>> | private class Bar {...whatever...} // Aux object
>> | class Foo {...whatever...}
>>
>> main.d
>> | import foo;
>> |
>> | void main()
>> | {
>> | Foo f = new Foo;
>> | Bar b = new Bar; // Error, private member of foo.d
>> | ...
>>
>> I would love to see this someday.
>
> I thought it already worked this way, as I use the technique quite a bit :-p Ah well, I vote for it too then.
>
>
> Sean
I also thought it worked this way. I want it too.
|
Copyright © 1999-2021 by the D Language Foundation