wren-lang / wren

The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.
http://wren.io
MIT License
6.9k stars 552 forks source link

Is there a way in C to check whether a class/object has specific method defined? #604

Open paladin-t opened 6 years ago

paladin-t commented 6 years ago

The method could be defined either in Wren or foreign. As a developer, I'd like to be able to check whether it was already there before invoking it.

mhermier commented 6 years ago

Right now, you can only test it by inheritance. But implementing such feature so trivial that you can do it in many ways. First time I did it was by interrogating the class. And one off the last time was by implementing a mirror API/module, that extracted all the methods signatures.