digitalmars.D - namespaces
- imr1984 (2/2) Apr 16 2005 Who else think that namespaces is a feature lacking in D? I do.
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (7/10) Apr 16 2005 No, there doesn't seem to be any such plans...
- Joey Peters (11/14) Apr 16 2005 I would really like such a feature for further grouping my code. Current...
- pragma (12/28) Apr 16 2005 You can also get away with this:
- Chris Sauls (12/19) Apr 16 2005 Or the (IMHO) slightly "safer" abstract-static-class trick:
- Alexander Panek (18/50) Apr 17 2005 how about just using:
- Jarrett Billingsley (4/17) Apr 18 2005 The point is that while we can do this, we can't _force_ the use of
-
Jarrett Billingsley
(4/4)
Apr 18 2005
"Alexander Panek"
wrote in message - Jarrett Billingsley (4/5) Apr 16 2005 Ooh! Me! Me!
- zwang (2/7) Apr 16 2005 Why do you need namespace while D offers modules?
- Unknown W. Brackets (2/11) Apr 16 2005
Who else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?
Apr 16 2005
imr1984 wrote:Who else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?No, there doesn't seem to be any such plans... http://www.digitalmars.com/d/overview.html: (Features To Drop) "Namespaces. An attempt to deal with the problems resulting from linking together independently developed pieces of code that have conflicting names. The idea of modules is simpler and works much better." --anders
Apr 16 2005
I would really like such a feature for further grouping my code. Currently I'm using templates and mixins, maybe you can use them too if you really need a sort of namespace: "imr1984" <imr1984_member pathlink.com> schreef in bericht news:d3qh64$27t5$1 digitaldaemon.com...Who else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?
Apr 16 2005
In article <d3qsfk$2ka6$1 digitaldaemon.com>, Joey Peters says...I would really like such a feature for further grouping my code. Currently I'm using templates and mixins, maybe you can use them too if you really need a sort of namespace: "imr1984" <imr1984_member pathlink.com> schreef in bericht news:d3qh64$27t5$1 digitaldaemon.com...You can also get away with this: struct MyNamespace{ static void foo(){ } static int bar; } void main(){ MyNamespace.foo(); MyNamespace.bar(); } - EricAnderton at yahooWho else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?
Apr 16 2005
pragma wrote:You can also get away with this: struct MyNamespace{ static void foo(){ } static int bar; }Or the (IMHO) slightly "safer" abstract-static-class trick: What makes it "safer" is that with a struct some fool could create a variable of type MyNamespace. ...although on further thought, that might actually have its uses for namespace-shortening... but then again that's what 'alias' is for. Too much thought too early in the day. -- Chris Sauls
Apr 16 2005
On Sat, 16 Apr 2005 14:03:46 +0000 (UTC), pragma <pragma_member pathlink.com> wrote:In article <d3qsfk$2ka6$1 digitaldaemon.com>, Joey Peters says...how about just using: /* -- file1.d -- */ module foo; int bar() { return (((2-1+3)*4)/(5^6)); } /* -- file2.d -- */ import foo; void main() { writefln(foo.bar()); } it`s just the same like namespaces, not with { } as limitations but all within a file using "module xy;" is one 'namespace' ... i don`t really get why you need yet-another-"i-reinvent-the-wheel-again"-keyword? :p just my 0,1 cents (i don`t have more), Alex -- huh? did you say something? :oI would really like such a feature for further grouping my code. Currently I'm using templates and mixins, maybe you can use them too if you really need a sort of namespace: "imr1984" <imr1984_member pathlink.com> schreef in bericht news:d3qh64$27t5$1 digitaldaemon.com...You can also get away with this: struct MyNamespace{ static void foo(){ } static int bar; } void main(){ MyNamespace.foo(); MyNamespace.bar(); } - EricAnderton at yahooWho else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?
Apr 17 2005
"Alexander Panek" <alexander.panek brainsware.org> wrote in message news:opspdtj5r2y2yy8c chello080109082145.3.15.vie.surfer.at...how about just using: /* -- file1.d -- */ module foo; int bar() { return (((2-1+3)*4)/(5^6)); } /* -- file2.d -- */ import foo; void main() { writefln(foo.bar()); } it`s just the same like namespaces, not with { } as limitations but all within a file using "module xy;" is one 'namespace' ... i don`t really get why you need yet-another-"i-reinvent-the-wheel-again"-keyword? :pThe point is that while we can do this, we can't _force_ the use of qualified names. That's what the OP said anyway.
Apr 18 2005
"Alexander Panek" <alexander.panek brainsware.org> wrote in message news:opspdtj5r2y2yy8c chello080109082145.3.15.vie.surfer.at... Oh wait, that was the thread 3 threads down from this one.. in any case, that's that.
Apr 18 2005
"imr1984" <imr1984_member pathlink.com> wrote in message news:d3qh64$27t5$1 digitaldaemon.com...Who else think that namespaces is a feature lacking in D? I do.Ooh! Me! Me! ;)
Apr 16 2005
imr1984 wrote:Who else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?Why do you need namespace while D offers modules?
Apr 16 2005
Please see the "Proposition" thread posted somewhat earlier. -[Unknown]imr1984 wrote:Who else think that namespaces is a feature lacking in D? I do. Are there any plans for namespaces in the future?Why do you need namespace while D offers modules?
Apr 16 2005