Closed tim-janik closed 7 years ago
Thanks, merged PR #55
@pmed, shouldn't the IsEmpty in js_function_template() still be fixed? AFAICS, it's always false, or am I missing something?
It's fixed in 04789a913441465aa6194629be86529f727913b6, thanks. Yes, js_function is always non-empty, it was a piece of dead code.
C++ classes are wrapped using class_function_template() from class.hpp and calling inherit<>() changes inheritance for js_function_template(). Now classes that also get a ctor() let class_function_template() inherit from js_function_template(), which means that classes without a ctor are not affected at all by inherit<>() calls.
Note that the implementation of js_function_template() may look like it's returning class_function_template() for classes without ctor, but that is not the case because jsfunc is never Empty, due to the initialization in classsingleton(). The code could be changed to test ctor!=NULL instead of IsEmpty(), but that would make working inheritance depend on the order in which inherit() and ctor() are called on a class_.
I guess the one solution that can work reliably is to simply always have class_function_template() inherit from js_function_template(). That's what PR #55 accomplishes.