Non-ugly ways to implement a 'static' class or namespace?

thebluepandabear therealbluepandabear at
Mon Feb 6 01:49:38 UTC 2023

On Sunday, 5 February 2023 at 23:50:35 UTC, Ali Çehreli wrote:
> On 2/5/23 02:57, thebluepandabear wrote:
> > When dealing with contexts, or for when you want a clear
> context in your
> > codebase, namespaces can be a life saver
> Can you give an example of a D problem that namespaces could 
> solve? I have been with D for 14 years and haven't missed 
> namespaces from C++ ever.
> The reason I ask is, mentioning lack of features of other 
> programming languages is not the right way to go. We have to 
> understand what problem they were trying to solve with that 
> feature and then see how D already tackels it.
> In this case, it is namespacing and D solves it with the 
> following feature and perhaps others that I can't think of:
> - modules
> - structs
> - classes
> - templates
> I don't consider myself a maintainer of D but I don't agree 
> that yet another feature for namespacing is needed. I feel that 
> it would bring complications.
> I don't think it is practical to bring all features of all 
> languages into D or any other language.
> > we've seen it used in the D
> > library, so there's no excuse for why this shouldn't be
> added, in my
> > opinion.
> If I'm not mistaken you've counted five such instances. Were 
> they really necessary? Could they be coded in a different way? 
> What is the cost of missing namespaces? I think you are the 
> first person raising this issue.
> You must have a strong case for this feature; so, I recommend 
> you write a DIP for it. It is likely that the mere act of doing 
> that will expose hidden costs and usage problems.
> Ali

I'm not going to create a DIP when I've hardly even touched the 
surface of the language, this is a beginners forum. I would need 
to wait 3-5 years until I'd feel comfortable doing so. Right now, 
it's not my place to be doing such things; this is just an 
observation from a beginner (aka me).

More information about the Digitalmars-d-learn mailing list