Thanks a lot!
There is a problem though: when i pass incorrect parameters to
such a method, it says, that S has no such field, which is a
misleading error message.
There is also a problem: when i declare opDispatch to be private,
i still have access to this forwarding from another package. Is
it a bug or what?
Nah, this gives me lots of compiler crap, like .empty and others,
when compiler tries to compile them.
Cool! Only this does not show me where the error was. __FILE__
and __LINE__ is not any help here, because it's a template. Any
other way to find out where the actual error was?
I tried this:
struct S {
R opDispatch(string name, R, Args...)(Args args) {
return mixin((*iface). ~ name)(iface, args);
}
SomeT ** iface;
}
But then val.foo(1, 2) gives me no property 'foo' for type 'S'.
I've seen the template solution:
struct S {
Actyaly, last variant didn't work either: i was testing it
inside S like ifc.foo(1), so UFCS kiked in, not alias this.
On Saturday, 21 June 2014 at 18:16:17 UTC, monnoroch wrote:
Actyaly, last variant didn't work either: i was testing it
inside S like ifc.foo(1), so UFCS kiked in, not alias this.
Oh, my bad, alias impl this; actually did work. But the first
argument problem still holds.
I can't link to libjvm.so.
Here's my code:
extern (C) {
int JNI_CreateJavaVM(void ** pvm, void ** penv, void * args);
}
void main() {
writefln(0x%x, .JNI_CreateJavaVM);
}
Which ptints wrong stuff. When then i use it and check the
contents of **pvm is also prints wrong stuff
Oh, found a problem, it was about one more layer of pointer
indirection.