Hi Matt,
Thanks for the finding and the patch.
I would prefer to return 'true' not only if we're on R13B03 but also
if the release is older than that.
Also, instead of using the erts version, I think it's easier to use
the otp release, since people refer to otp versions mostly by the
release version on not by the erts version (I might be wrong here).
Do you agree with the following?
diff --git a/src/ejson/ejson.erl b/src/ejson/ejson.erl
index 2b26444..11f3b79 100644
--- a/src/ejson/ejson.erl
+++ b/src/ejson/ejson.erl
@@ -27,7 +27,12 @@ init() ->
filename:join(Dir, ejson)
end,
(catch erlang:load_nif(SoName, 0)),
- ok.
+ case erlang:system_info(otp_release) =< "R13B03" of
+ true ->
+ true;
+ false ->
+ ok
+ end.
On Thu, Apr 7, 2011 at 2:32 PM, Matt Goodall <[email protected]> wrote:
> Hi,
> The new ejson module doesn't support older versions of Erlang because the
> expected result from the module's on_load fun changed from true to ok.
> The attached one-line change (as a git diff) fixes it for me using the
> standard Erlang packages on Ubuntu 10.10 and 11.04 but I don't have a newer
> version of Erlang installed to test against.
> Obviously, with this change applied I'm still using the non-NIF json
> implementation but at least the ejson module loads ;-).
> - Matt
--
Filipe David Manana,
[email protected], [email protected]
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."