As I am digging deeper and deeper I am discovering interesting design challenges.
In .NET, the base class for enumerated types is System.Enum, which does not allow non-integral- (nor char-) based types.
D allows strings in enumerated types, like so:
enum : string
A = "hello",
B = "betty"
Possible solutions: make D.NET's enums based on [mscorlib]System.Enum and forbid non integrals (current implementation), or make my own [dnetlib]core.Enum base class. The problem with the latter is that it would preclude inter-operation with other languages. Walter Bright's suggestion (it is so clever that I wish I came up with it myself) is to use a combination of both solutions: generate structures derived from System.Enum when possible, and base them off a custom class when not. The D .NET compiler will split enums into two groups - those that are integral types, and those that are not, plus the "char" case. This allows interoperability without crippling language features.
D strings are UTF8, System.String is Unicode 16. My attempt to cleverly use System.String under the hood (rather than represent D strings as byte arrays) created way more complications than I initially thought, and prompted a major re-factoring effort that ate up almost my entire week-end.
An interesting wrinkle is that in D.NET associative arrays are implemented using Dictionary objects under the hood, which use the Equals method to compare keys. For System.String, Equals does a lexicographical comparison as one would normally expect; for System.Array, the implementation of Equals simply compares object references.
D strings are now represented as arrays of bytes; in order to make associative arrays work correctly, extra work had to be done.
Can't do pointers as members of classes or elements in an array.
This stems from a restriction in the IL: cannot have managed pointers as class fields or array elements.
3.a) in D.NET a nested method cannot access variables of pointer type in the surrounding lexical context (because the implementation constructs a delegate under the hood, and the object part has all the accessed variables copied as its members)
3.b) can't pass pointers to variadic functions (because I send in the variable argument list in as an array -- for compatibility with System.Console.WriteLine)
How severe are these limitations? Are there any reasonable workarounds? I guess I'll have to dig D-per to find out.