CtorReader bug?

2014-08-16 Thread dennis zhuang
user= #java.lang.String[hello world]
hello world

user= #java.lang.String[(byte-array) utf8]
IllegalArgumentException No matching ctor found for class java.lang.String
 clojure.lang.Reflector.invokeConstructor (Reflector.java:183)

It seems that the CtorReader
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245
doesn't eval the arguments before invoking constructor,so it can't find a
valid ctor.

I am not sure whether it's a bug or an expected behaviour.


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Sorry,the error example must be:

user= #java.lang.String[(byte-array 10) utf8]
IllegalArgumentException No matching ctor found for class java.lang.String
 clojure.lang.Reflector.invokeConstructor (Reflector.java:183)



2014-08-16 19:59 GMT+08:00 dennis zhuang killme2...@gmail.com:

 user= #java.lang.String[hello world]
 hello world

 user= #java.lang.String[(byte-array) utf8]
 IllegalArgumentException No matching ctor found for class java.lang.String
  clojure.lang.Reflector.invokeConstructor (Reflector.java:183)

 It seems that the CtorReader
 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245
 doesn't eval the arguments before invoking constructor,so it can't find a
 valid ctor.

 I am not sure whether it's a bug or an expected behaviour.


 --
 庄晓丹
 Email:killme2...@gmail.com xzhu...@avos.com
 Site:   http://fnil.net
 Twitter:  @killme2008





-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CtorReader bug?

2014-08-16 Thread Nicola Mometto
It's by design, see the section on ctor literals http://clojure.org/reader#toc1

The elements in the vector part are passed unevaluated to the relevant
constructor.

Nicola

dennis zhuang writes:

 user= #java.lang.String[hello world]
 hello world

 user= #java.lang.String[(byte-array) utf8]
 IllegalArgumentException No matching ctor found for class java.lang.String
  clojure.lang.Reflector.invokeConstructor (Reflector.java:183)

 It seems that the CtorReader
 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245
 doesn't eval the arguments before invoking constructor,so it can't find a
 valid ctor.

 I am not sure whether it's a bug or an expected behaviour.


 --
 庄晓丹
 Email:killme2...@gmail.com xzhu...@avos.com
 Site:   http://fnil.net
 Twitter:  @killme2008

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Got it.

Thanks for your quick reply.


2014-08-16 20:14 GMT+08:00 Nicola Mometto brobro...@gmail.com:

 It's by design, see the section on ctor literals
 http://clojure.org/reader#toc1

 The elements in the vector part are passed unevaluated to the relevant
 constructor.

 Nicola

 dennis zhuang writes:

  user= #java.lang.String[hello world]
  hello world
 
  user= #java.lang.String[(byte-array) utf8]
  IllegalArgumentException No matching ctor found for class
 java.lang.String
   clojure.lang.Reflector.invokeConstructor (Reflector.java:183)
 
  It seems that the CtorReader
  
 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245
 
  doesn't eval the arguments before invoking constructor,so it can't find a
  valid ctor.
 
  I am not sure whether it's a bug or an expected behaviour.
 
 
  --
  庄晓丹
  Email:killme2...@gmail.com xzhu...@avos.com
  Site:   http://fnil.net
  Twitter:  @killme2008

 --
 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 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
 ---
 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 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.