-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LFE Can't handle java.lang.String objects from Erjang #84
Comments
I followed up last night on the mail list about this one; Kresten had previously given this excellent information: "… is probably some error in the value mapping. Its a bit complex, and if you want to dive into it I can explain more. But essentially a JavaObject thing can act as more than one kind of erlang term, depending on how you deconstruct it with pattern matching. For Java strings, we keep the string around, wrapped in a synthetic cons cell that will allow you to access head and tail..." In LFE's @@ -47,6 +47,10 @@ print1([quote,E], D, I, L) -> ["'",print1(E, D, I+1, L)];
print1([backquote,E], D, I, L) -> ["`",print1(E, D, I+1, L)];
print1([unquote,E], D, I, L) -> [",",print1(E, D, I+1, L)];
print1(['unquote-splicing',E], D, I, L) -> [",@",print1(E, D, I+2, L)];
+%% Handle specialized forms from Erjang
+print1([Head|Tail], _, _, _) when is_list(Head) and is_list(Tail) ->
+ Head ++ Tail;
+%% Continue with cons matching ...
print1([Car|_]=List, D, I, L) ->
%% Handle printable lists specially.
case io_lib:printable_list(List) of At first, this didn't seem to be stomping on any of the other patterns in the LFE pretty printer, but after a bit more testing, I'm unconvinced. I'm going to dig into this some more and explore some more edge cases. I will open a new ticket in LFE for all of this. |
Does your change make it work? Because that could give some good hints for where to go bug-hunting in the Erjang code. |
Excellent -- will try again with the change (once I've gotteb it to a point where I think Robert might approve!). |
I'm going to update this ticket to be more specific, now that we're getting closer to the issue. Here was the original description, for future reference: The following returns an error in LFE: > (java.lang.System:getProperty '"java.io.tmpdir")
exception error: badarg
in (: lfe_io_pretty
print1
"/var/folders/c8/2cl5l5_102b1qq8bh05t7xw40000gn/T/") The same call in Erjang-proper: 10> 'java.lang.System':getProperty("java.io.tmpdir").
"/var/folders/c8/2cl5l5_102b1qq8bh05t7xw40000gn/T/" This may be an issue in LFE; I will investigate and report back my findings to this ticket. |
Here's a simple example of the problem in action:
This seems to be a problem of displaying
java.lang.String
objects. Using alet
(an operation which doesn't attempt to display the result) gets around the problem highlighted in the example above:The text was updated successfully, but these errors were encountered: