What is the difference between enum and shared immutable?

Steven Schveighoffer schveiguy at gmail.com
Thu Oct 29 13:50:28 UTC 2020


On 10/28/20 6:28 PM, IGotD- wrote:
> On Wednesday, 28 October 2020 at 21:54:19 UTC, Jan Hönig wrote:
>>
>> shared immutable x = 1;
>>
> 
> Is there a point to add shared to an immutable? Aren't immutable 
> implicitly also shared?

You are correct:

pragma(msg, typeof(x)); // immutable(int)

D frequently allows no-op attributes.

-Steve


More information about the Digitalmars-d-learn mailing list