JesseKPhillips / Juno-Windows-Class-Library

A class library for Windows programming written in D
http://dsource.org/projects/juno
Boost Software License 1.0
15 stars 3 forks source link

[tlbimpd] handling of types with reserved words as names #13

Closed Numpsy closed 12 years ago

Numpsy commented 12 years ago

Some type libraries define types which have special or reserved words as names.

For example, the Outlook 12 typelib defines an interface called 'Exception', and if you try to compile the .d file produced from it by tlbimpd in a recent DMD2 you get an error saying that only object.d can define a type called Exception.

These types need to be renamed somehow. We could just do what it already does for parameters with reserved names and rename them in a fixed way (e.g append 'Type' to the name), or we could do what the VisualC++ #import command does and allow the user to rename types to specified values.

JesseKPhillips commented 12 years ago

Parameters aren't part of the API while these types, I do believe, will be user facing. I think that it would be good to keep most of the type names the same. But it isn't appropriate to require renaming them when the conflict comes from the compiler itself.

I think name clashes are mostly handled by the module system and there are probably very few compiler enforced definitions (Object maybe?). So I suggest we special-case the situations like this one and maybe use ComException and if needed ComObject.

Numpsy commented 12 years ago

Ok, i'll see about automating the special cases for now.

Numpsy commented 12 years ago

Ok, i've made a minmal change that prepends 'Com' to a fixed list of type names (currently Object, Exception and Throwable). This is a rather narrow fix, but it does fix my current issue.

JesseKPhillips commented 12 years ago

Thank you, I believe this to be closed and as more types cause issues a new ticket can be created.