Thread overview | |||||
---|---|---|---|---|---|
|
October 08, 2009 Getting constructor's metadata | ||||
---|---|---|---|---|
| ||||
Is it possible to get types or aliases of all constructors of a class in D2? |
October 08, 2009 Re: Getting constructor's metadata | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | Max Samukha wrote:
> Is it possible to get types or aliases of all constructors of a class
> in D2?
No.
__traits has some random functionality in this regard. It has a command getVirtualFunctions which only returns virtual overloads. By "virtual", we mean "appears in vtbl". So any non-private, non-static overload will show up.
Constructors do not appear in any object vtbl. It would be kind of odd if they did.
There's a patch to add getOverloads to __traits. It would do what you want. But I doubt it works on DMD >2.020.
|
October 09, 2009 Re: Getting constructor's metadata | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christopher Wright | On Thu, 08 Oct 2009 18:46:08 -0400, Christopher Wright <dhasenan@gmail.com> wrote: >Max Samukha wrote: >> Is it possible to get types or aliases of all constructors of a class in D2? > >No. > >__traits has some random functionality in this regard. It has a command getVirtualFunctions which only returns virtual overloads. By "virtual", we mean "appears in vtbl". So any non-private, non-static overload will show up. Yeah, I know about limitations of __traits. And I don't understand why virtual functions are special-cased. If it is a temporary hack then I don't understand why it is in the specification. > >Constructors do not appear in any object vtbl. It would be kind of odd if they did. > >There's a patch to add getOverloads to __traits. It would do what you want. But I doubt it works on DMD >2.020. That is very bad. I hoped for some clever workaround. Really don't want to rely on a patched compiler. Probably, will have to wait another couple of years. |
Copyright © 1999-2021 by the D Language Foundation