On Monday, 22 August 2022 at 16:19:06 UTC, Andrey Zherikov wrote:
I have an impression that template function can be called without parenthesis if it doesn't have run-time parameters so `func!0` is the same as `func!0()`. Am I wrong?
You're not wrong. This behavior is a special case in `typeof`. I was merely attempting to explain why such a special case might have been introduced.
If we consider free function vs. member function, why is `typeof(u.func!0)` not the same as `typeof(u.func2!0)` here?
My guess is that `u.func2!0` is rewritten to `func2!0(u)` during semantic analysis, so it does not trigger the special-case behavior.
Is `typeof(u.func2!0)` correct in this case? If so then I'll just convert my API to free-standing functions and everything will work as a magic (without my own implementation of `getUDA`).
It's probably not worth completely changing your API design just to work around this issue. Also, even if you do this, it is still possible for a user to run into a same problem with a member function of one of their own types; for example:
```d import your.library; struct MyStruct { U myFunc() { /* ... */ } } @(MyStruct.myFunc) whatever; ```