Closed skydread1 closed 3 years ago
It is failing to compile because hashCode
and equals
are Java methods. The equivalent on the CLR are Object.GetHashCode
and Object.Equals
. This is a persistent problem with anything hosty, such as type definitions. MAGIC already handles these differences internally when creating types, but if the user is overriding superclass methods they need to use the correct name and casing depending on the platform. I do not see an easy way to do this without reader conditionals, but I am open to suggestions.
Yes, that's what I though also.
One way to do it would be to have a map nativeJava-nativeC#
and referring to it every time the function is not found in CLR.
It would need to be updated regularly and it is valid only for the functions that are really equivalent in both java and c# which is not often the case (different args etc).
I guess, keeping the reader conditionals
is fine since they are quite easy to read and most of the users won't have much native java function in their code. (Hopefully).
Agreed on all points. Host-specific code is not portable by definition!
Problem
We consider the following clojure ns:
The expecting results are
Compilation error
However, when I try to compile, I have a magic error:
Workaround
The workaround is to use the reader conditionals to handle the object equality such as:
Suggestion
There probably is a way to handle this directly in
magic
so it is transparent for the user.