trifork / erjang

A JVM-based Erlang VM
http://www.erjang.org
Apache License 2.0
725 stars 62 forks source link

Serialization of EFunHandler function objects isn't implemented #48

Closed eriksoe closed 13 years ago

eriksoe commented 13 years ago

==== To reproduce: 1> erlang:term_to_binary(fun erlang:is_lt/2).

=== Observed behaviour: \ exception error: {not_implemented,"Encode for erjang.EFunHandler2", "erjang.EObject.encode(EObject.java:435)"} in function term_to_binary/1

edwardw commented 13 years ago

But it does work for existing functions, such as:

But I can't figure out why it only fails for non-existing functions.

edwardw commented 13 years ago

I think I've figured this out. In order to implement erjang.EObject$encode method for ejang.EFunHandler, we need something similar to erjang.EFun$make_encode_method_for_exported and add it to erjang.EFun$get_fun_with_handler. It seems to be impossible because we don't know module and function name of certain EFunHandler instance unless its invoke method has been, well, invoked.

If such observation is true, I think this issue can't be solved.

edwardw commented 13 years ago

Fixed.

krestenkrab commented 13 years ago

Thanks for the fix!