[erlang-patches] Serge's ei float patch
Tue Jun 1 16:40:32 CEST 2010
On 6/1/2010 9:00 AM, Björn-Egil Dahlberg wrote:
> Oops. I forgot something. (And yet again erl_interface is faced with a
> problem). ei_get_type exposes the internal representation (external
> format) of types. This is a problem. Earlier implementation had its own
> types ... which seemingly was a bad idea ...
> Angels are crying for suggesting this but, what do you think of letting
> get_type return ERL_FLOAT_EXT for both ERL_FLOAT_EXT and NEW_FLOAT_EXT?
> My aim is to remove the necessity for changing original source code
> dependent on erl_interface, if that is at all possible.
> What do you think?
Since ei_get_type() is not implicitly used by the decoding family of
functions in erl_interface (that rely on the wire-level representation
of data types) this should be ok (though not pretty). There's a similar
situation with ERL_REFERENCE_EXT and ERL_NEW_REFERENCE_EXT, in which
case ei_get_type() distinguishes the two.
Perhaps a better solution (that could be implemented later after this
patch is released) would be for ei_get_type() always to return
ERL_FLOAT_EXT and ERL_REFERENCE_EXT for "old" and "new" corresponding
representations, but have another flavor of erl_init() that would set
compatibility mode as a bitmask of flags. The mode would control
turning on support for old format as default behavior.
More information about the erlang-patches