Michel Hermier
Michel Hermier
How about: ```javascript Reflect.hasMethod(item, "read()") Reflect.getMethod(item, "read()") // For the future, not implementable as this yet ```
About the module where this should belong, even it looks like it would fit it `meta` I think it is better to have it in its own module. The reason...
I already have some code around like this, since the idea is not new. I will give a try at implementing it (the minimal required version) later today.
Please take a look at that preliminary implementation at https://github.com/mhermier/wren/tree/mirror. API is slightly different that what was proposed here, but it sounds more logical to me for the future developments.
For now it is bare-bone and limited to the original request. That said `methods` and `getMethod(_)` is a little bit problematic, since there is no internal `ObjMethod`. So initially it...
Anyway, I don't want to rush a whole API, so that basic feature get accepted first. So we can use it already and start to build on top of it.
It should but I provided it for speed.
Most usage should be hit and run: ```javascript if (ObjectMirror.hasMethod(foo, "bar(_)")) foo.bar(42) ``` If you use the regular API: ```javascript if (Reflect.call(foo).hasMethod("bar(_)")) foo.bar(42) ``` With the *official* API, there is...
In a regular mirror API, `reflect` is a function and it should return a `Mirror` based on what you passed. I did not put the `hasMethod()` there to respect the...
Well this is what I learned from looking at other implementations. Maybe these days it changed a little, but the basic functionality is the same, only the organization change depending...