Re: (alength nil) => java.lang.IllegalArgumentException: More than one matching method found

2009-01-06 Thread Paul Mooser

Well, I'm guessing that the multiple methods exception is due to the
fact that the value of "null" in Java is not typed - that is to say,
there is no such thing as a "null String" versus a "null Integer" -
null is just null. If you pass a value of null to something that has
multiple implementations, it's probably finding it can't determine
which one it should call with just null (or nil, in clojure).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (alength nil) => java.lang.IllegalArgumentException: More than one matching method found

2009-01-06 Thread rzeze...@gmail.com



On Jan 6, 9:54 am, Chouser  wrote:
> On Mon, Jan 5, 2009 at 11:29 PM, rzeze...@gmail.com  
> wrote:
>
> > I was just messing around with array's and produced the following
> > exception.  I don't actually need this to work for any reason, but I
> > was rather surprised by the behavior.  Is this a bug or expected
> > behavior? Please note I'm using revision 1195.
>
> > user=> (alength nil)
> > java.lang.IllegalArgumentException: More than one matching method
> > found: alength (NO_SOURCE_FILE:146)
>
> The docs say "Works on arrays of all types" and last I checked, nil is
> not an array of any type.
> What would you expect it to do?
>
> --Chouser

Thanks for the reply Chris.  I'm not sure what I would expect it to
do.  I just found the actual exception returned to be odd.  For
example, compare it to the following:

user=> (alength "ryan")
java.lang.IllegalArgumentException: Argument is not an array
(NO_SOURCE_FILE:0)

That exception makes sense, because I called alength on something that
is not a primitive Java array.  I would expect the same from calling
'(alength nil)' (or maybe even just return nil).  This doesn't really
bother me, but I just thought I'd be a good steward and mention
something on the list.

-Ryan



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: (alength nil) => java.lang.IllegalArgumentException: More than one matching method found

2009-01-06 Thread Chouser

On Mon, Jan 5, 2009 at 11:29 PM, rzeze...@gmail.com  wrote:
>
> I was just messing around with array's and produced the following
> exception.  I don't actually need this to work for any reason, but I
> was rather surprised by the behavior.  Is this a bug or expected
> behavior? Please note I'm using revision 1195.
>
> user=> (alength nil)
> java.lang.IllegalArgumentException: More than one matching method
> found: alength (NO_SOURCE_FILE:146)

The docs say "Works on arrays of all types" and last I checked, nil is
not an array of any type.
What would you expect it to do?

--Chouser

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---