[dmd-beta] Migration path for enum Endian?

Andrei Alexandrescu andrei at erdani.com
Tue Sep 6 15:01:28 PDT 2011


On 9/6/11 4:52 PM, Jonathan M Davis wrote:
> On Tuesday, September 06, 2011 17:03:30 Nick Sabalausky wrote:
>> The names inside std.system.Endian were changed from UpperCamelCase to
>> lowerCamelCase, which makes sense, but maybe the old names should still
>> exist for migration?
>
> Yu can't rename enum values without breaking code. Any final switches would be
> broken if you left in the old values as would anything using
> std.traits.EnumMembers.

I think EnumMembers is used rarely enough to not warrant much worry. If 
final switch fails to compile because it doesn't handle all aliases of 
the same value, that's a bug in the compiler. So I think keeping old 
values alongside new ones is good practice.

> A simple renaming is caught and pointed out quite well
> by the compiler's spellchecker.

Code breakage is what it is.


Andrei


More information about the dmd-beta mailing list