Which language futures make D overcompicated?

Mike Parker aldacron at gmail.com
Fri Feb 9 15:35:38 UTC 2018


On Friday, 9 February 2018 at 15:27:18 UTC, Andrea Fontana wrote:

>> If you need to take the address of a constant, use immutable 
>> or const (doesn't really matter, but I prefer immutable). If 
>> you don't need the address, use enum.
>
> Why not static immutable?

For global scope? static has no effect there as far as I know. 
Looking at the ASM output on run.dlang.io, I see no difference 
between the two:

static immutable foo = 10;
immutable bar = 20;

LAT	group	
;File = onlineapp.d
	public	immutable(int) onlineapp.foo
	public	immutable(int) onlineapp.bar

...
                 mov	EDI,0Ah
		call	  @safe void 
std.stdio.writeln!(immutable(int)).writeln(immutable(int))@PLT32
		mov	EDI,014h
		call	  @safe void 
std.stdio.writeln!(immutable(int)).writeln(immutable(int))@PLT32


More information about the Digitalmars-d mailing list