1)
public class Foo {
public static String bar(byte b) {
return "byte";
}
}
user=> (Foo/bar 1)
"byte"
public class Foo {
public static String bar(byte b) {
return "byte";
}
public static String bar(Thread thread) {
return "thread";
}
}
user=> (Foo/bar 1)
IllegalArgumentException No matching method found: bar
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
Is this a bug or a feature?
2)
public class Foo {
public static String bar(int i) {
return "int";
}
public static String bar(long l) {
return "long";
}
}
user=> (Foo/bar 1)
"long"
user=> (Foo/bar (Long. 1))
CompilerException java.lang.IllegalArgumentException: More than one
matching method found: bar, compiling:(NO_SOURCE_PATH:3:1)
user=> (Foo/bar (Integer. 1)) ; Shouldn't this also fail?
"int"
user=> (def x (Long. 1)) ; same as (def x 1)
#'user/x
user=> (Foo/bar x) ; a bug?
"int"
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.