-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using reflection, cannot get name of type declared inside Eval'uated code #947
Comments
Basically, it appears that any reflect.Value which is returned by the interpreter.Eval method does not retain the type information for custom types. It only does so for the ones which are part of stdlib. |
Any comments friends ? |
Similar as #939. |
thank you very much @mvertes |
@en-vee btw, aside from the problems of making the interfaces cross boundaries between the evaled code, and the caller, there were some unsupported cases regarding type assertions so far (which have just been fixed). |
@mpl thanks for that. I'll give this a go. |
closing in favour of #939 |
Hi,
My aim is to provide a plugin interface for my application where the plugin source code looks like below :
plugin.go
In my application code which reads the above plugin code, I do the following :
Expected result: Expected ok = true as m1 implements the Key() method as shown in plugin.go
Got: ok=false
Also, when I do fmt.Println(reflect.TypeOf(m1)), I just get *struct { X int }
Why do I not get the name *my.M printed using the reflection API ?
I guess if I am able to type-assert on the Keyer interface successfully, even that should solve my problems.
I see great potential in using yaegi as an embedded plugin framework.
Please help me achieve my goal of being able to invoke methods on the type defined in my interpreted/plugin Go source code above.
Or alternatively, any way of determining the plugin/interperted code defined type name using reflection.
The text was updated successfully, but these errors were encountered: