On Thursday, 15 October 2015 at 01:51:50 UTC, Mike Parker wrote:
On Wednesday, 14 October 2015 at 21:52:05 UTC, Vladimir Panteleev wrote:


For example: usage of named enums. In C, all enums (or #defines) all live within the name namespace, with a prefix serving as the disambiguating "namespace", and all are implicitly convertible to each other. In many places, the bindings use named enums instead, which provides the advantage of strong typing - if a function accepts a parameter of a certain enum, you cannot accidentally pass a member of another enum.


I think named enums are a bad idea. For one thing, it's inconsistent with the other system modules. For another, it's a pain point for porting existing C code to D. If they are kept, then at the very least aliases ought to be provided.

Well, aliases would allow both C source compatibility and strong typing. Plus, it won't be a breaking change, so they can be added whenever. Now that we don't need to support D1, this can be done with a mixin OSLT.

Reply via email to