What is the difference between enum and shared immutable?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Oct 29 21:43:57 UTC 2020
On Thursday, 29 October 2020 at 14:39:31 UTC, 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.
Yes, but that is a tough call. Do you want to catch unintended
programmer errors or do you want to make it as easy as possible
to write generic code? I'm in favour of max strictness, but then
you need to keep the feature set down and make sure it is uniform
But I think it is a bit sad that "shared" isn't enforced so that
it could lead to actual benefits. Like requiring that globals are
typed shared and enable thread local garbage collection. E.g. GC
allocation of non-shared should be on a thread local heap and
anything shared should be on a global heap.
More information about the Digitalmars-d-learn