How can I get the "owner" of a method?
solidstate1991
laszloszeremi at outlook.com
Sat Oct 1 19:05:58 UTC 2022
On Friday, 30 September 2022 at 22:20:06 UTC, Salih Dincer wrote:
> Maybe this will help you:
> ```d
> template Bar(T)
> {
> void fun() {}
> }
>
> class Foo(T)
> {
> mixin Bar!T b;
> alias fun = b.fun;
>
> void test()
> {
> fun();
> }
> }
> ```
> SDB at 79
The issue with that is in that case is instead of writing
boilerplate I'll have to rewrite already existing functions.
Currently, to make objects compatible with Lua in some way, I
have to write functions like this:
```d
package void scrollLayer(void* target, int x, int y) {
Layer l = cast(Layer)target;
l.scroll(x, y);
}
```
This is very time consuming, and some automated method would be
preferred where it can be done (some manual stuff will be done of
course), then I can further automate it by using user attributes.
More information about the Digitalmars-d-learn
mailing list