[Mono-list] Enum declaration; Conflicts and Blame for Interoperability Problems

Jeroen Frijters jeroen@sumatra.nl
Tue, 7 Jan 2003 14:03:20 +0100


lupus wrote:
> For binding purposes (e.g. for locating a method definition from the
> method reference used to call it) enums 
> shall be distinct from their underlying type.  For all other purposes,
>                                                ^^^^^^^^^^^^^^^^^^^^^^
> including verification and execution of 
> code, an unboxed enum freely interconverts with its underlying type.
> 
> We think this sentence allows the use of the underlying type 
> instead of the enum type in the static fields of the enum.

I agree, however ...

> The underlying issue, though, is that with the 
> Reflection.Emit API it's not possible to create enums as
> produced by csc. Once portable.net
> will implement Reflection.Emit, it'll have to support this 
> stuff anyway, just like the MS runtime does.

... I would argue that MS's EnumBuilder.DefineLiteral is broken. It would be
best if it allowed both using the underlying type as well as the enum type,
but the current behavior as the only option is *not* acceptable (given that
it is not CLS compliant).

I have filed a bug with MS.

Regards,
Jeroen