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

ProtectAndHide ProtectAndHide at gmail.com
Mon Feb 6 02:15:45 UTC 2023


On Sunday, 5 February 2023 at 23:53:35 UTC, Ali Çehreli wrote:
> On 2/5/23 14:40, ProtectAndHide wrote:
>
> > On Sunday, 5 February 2023 at 10:51:51 UTC, thebluepandabear
> wrote:
> >>
> >> It's not a terrible workaround to be honest.
> >> ....
> >
> > The 'terrible' part is this:
> >
> > - the compiler will allow you to declare a variable of type
> Algo
> > - the compiler will allow you to declare an array with
> elements of type
> > Algo
> > - the compiler will allow you to use Algo as a type argument
> > - the compiler will allow you to use Algo as a parameter
> > - the compiler will allow you to use Algo as a return type
>
> I understand disabling the programmer to do certain things are 
> beneficial e.g. to prevent bugs but those above can all be seen 
> as features. What is so terrible about giving the programmer 
> those powers?
>
> Ali

I do not agree, that a compiler that allows a programmer to 
misuse a type, should be seen as 'a feature'.

If that's the kind of 'power' D programmers want, then D is not 
for me.



More information about the Digitalmars-d-learn mailing list