Fixing enum names in Phobos

Jonathan M Davis jmdavisProg at gmx.com
Thu Aug 4 10:34:23 PDT 2011


> On 8/4/11 10:59 AM, Jonathan M Davis wrote:
> > On Thursday 04 August 2011 07:33:55 Andrei Alexandrescu wrote:
> >> On 8/4/11 12:16 AM, Jonathan M Davis wrote:
> >>> So, does anyone actually have an opinion on this? Should we fix the
> >>> names or not?
> >> 
> >> We should probably fix the names. A migration path is to simply keep
> >> both names for a year or so and remove documentation for old names. For
> >> example:
> >> 
> >> enum Variadic {
> >> 
> >> no, /// doc
> >> NO = no,
> >> c, /// doc
> >> C = c,
> >> d, /// doc
> >> D = d,
> >> typesafe, /// doc
> >> TYPESAFE = typesafe
> >> 
> >> }
> > 
> > Except that that breaks any code that does something like
> > EnumMembers!Variadic. For some enums, that probably wouldn't break
> > anyone's code. But you can't know for sure whether anyone is using
> > EnumMembers on a particular enum. It would also change the values of
> > the enums, which could also break code, which wouldn't be an issue for
> > some enums, but it might be for some (and someone could always have been
> > foolish and relied on their exact values).
> 
> The values are not changed, but point taken about introspection.

Ah, yes. You initialized them with each other. I didn't notice that or think 
of it (though I probably should have). But I think that the introspection 
issues are great enough to make that approach a bad one, as nice as it would 
be to just provide both names temporarily.

- Jonathan M Davis


More information about the Digitalmars-d mailing list