What is the difference between enum and shared immutable?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Oct 29 15:13:21 UTC 2020


On Thu, Oct 29, 2020 at 11:00:42AM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote:
> On 10/29/20 10:39 AM, H. S. Teoh wrote:
> > On Thu, Oct 29, 2020 at 09:50:28AM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote:
> > [...]
> > > D frequently allows no-op attributes.
> > [...]
> > 
> > I find that to be a bad smell in terms of language design, actually.
> > Either something should be allowed and have a definite effect, or it
> > should not be allowed.  Not this murky grey area where you can write
> > something and it seems to be allowed, but doesn't actually have any
> > effect.
> 
> I think it's to aid in things like:
> 
> @safe:
> 
> // lots of things, but only functions are tagged as @safe
[...]

But why can't that be treated differently from explicitly writing @safe
on a declaration?  I mean, yeah, it's easier to implement the compiler
that way, but ease of implementation shouldn't count against proper
language design!


T

-- 
Doubt is a self-fulfilling prophecy.


More information about the Digitalmars-d-learn mailing list