Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 12:32:57 UTC, test wrote: On Monday, 22 October 2018 at 12:16:50 UTC, Stanislav Blinov wrote: On Monday, 22 October 2018 at 12:03:22 UTC, test wrote: You're trying to call a static function 'getThis' on Fiber. The type 'Fiber' is really a Proxy!FiberS. Proxy doesn't

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 12:16:50 UTC, Stanislav Blinov wrote: On Monday, 22 October 2018 at 12:03:22 UTC, test wrote: You're trying to call a static function 'getThis' on Fiber. The type 'Fiber' is really a Proxy!FiberS. Proxy doesn't have a static getThis() function. So the compiler tries

Re: need help about get all public static function name

2018-10-22 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 22 October 2018 at 12:03:22 UTC, test wrote: On Monday, 22 October 2018 at 11:59:21 UTC, test wrote: On Monday, 22 October 2018 at 11:42:59 UTC, test wrote: I try made a simple example but it has no error: I find the way to show the error: https://run.dlang.io/is/f8cULz import s

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 11:59:21 UTC, test wrote: On Monday, 22 October 2018 at 11:42:59 UTC, test wrote: I try made a simple example but it has no error: I find the way to show the error: https://run.dlang.io/is/f8cULz import std.traits; struct FiberS { static auto getThis()

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 11:42:59 UTC, test wrote: On Monday, 22 October 2018 at 11:18:20 UTC, Stanislav Blinov wrote: Error: template instance `TypeTemplate!(BaseType)` error instantiating I use alias this to allow call static method on proxyType. It work some time, but on other case

Re: need help about get all public static function name

2018-10-22 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 22 October 2018 at 11:42:59 UTC, test wrote: some how when I call "is(typeof(__traits(getMember, BaseType, name))) " in the template, my code report others error like: Error: no property fromPointer for type void Error: template instance TypeTemplate!(BaseType) is used as a type

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 11:18:20 UTC, Stanislav Blinov wrote: On Monday, 22 October 2018 at 10:49:10 UTC, test wrote: note the added check that the member is not a type: is(typeof(__traits(getMember, BaseType, name))). You'll still need to iterate overloads if you want to get all static

Re: need help about get all public static function name

2018-10-22 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 22 October 2018 at 10:49:10 UTC, test wrote: test1.d = alias Fn1 = void function(); struct XX { alias Fn= Fn1; // ... } 'Fn' is not a static function, it's a type. I.e. you can declare a function pointer with it: Fn func; test2.

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 10:49:10 UTC, test wrote: On Monday, 22 October 2018 at 10:45:07 UTC, test wrote: On Monday, 22 October 2018 at 10:29:56 UTC, Stanislav Blinov wrote: extern(C) void main(){ GetPub!XX; } https://run.dlang.io/is/f295qE

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 10:45:07 UTC, test wrote: On Monday, 22 October 2018 at 10:29:56 UTC, Stanislav Blinov wrote: On Monday, 22 October 2018 at 10:16:22 UTC, test wrote: and On Monday, 22 October 2018 at 10:45:07 UTC, test wrote: test1.d = alias Fn1 = void

Re: need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
On Monday, 22 October 2018 at 10:29:56 UTC, Stanislav Blinov wrote: On Monday, 22 October 2018 at 10:16:22 UTC, test wrote: I try use traits get all public static function of a struct pass to template... how to do this ? void allFunctions(T)() { import std.stdio; foreach (name; __tr

Re: need help about get all public static function name

2018-10-22 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 22 October 2018 at 10:16:22 UTC, test wrote: I try use traits get all public static function of a struct pass to template... how to do this ? void allFunctions(T)() { import std.stdio; foreach (name; __traits(allMembers, T)) { static foreach (overload; __traits(get

need help about get all public static function name

2018-10-22 Thread test via Digitalmars-d-learn
I try use traits get all public static function of a struct pass to template. Compiler report " .Function is not accessible from module " with __traits(isStaticFunction, __traits(getMember, Type , name)). If I add " __traits(getProtection, __traits(getMember, Type, name)) == "public" befor