On Oct 9, 2:30 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Here's another variant of the "classes are not first class objects in
> Java" problem:
>
> user=> (new String)
> ""
> user=> (new (Class/forName "java.lang.String"))
> java.lang.IllegalArgumentException: Unable to resolve classname:
> [EMAIL PROTECTED]
>
> I understand why this fails, and that it is consistent with Java. But
> Java is ugly here, and since new is a Clojure special form I think
> this could be made to work without negative surprises elsewhere.
>
> Rich: I will write the patch if you will apply it.

Java may be ugly in its overlap of types, class objects and scopes,
but it is also fast.

Treating classes as values and then using those values for new and
method calls dictates reflection. I'm loathe to build into the
primitives behavior that will encourage reflection, especially after
working so hard on enabling Clojure to avoid it.

It ends up that very few real cases require such dynamic behavior and
I'd prefer they be called out as such.

I've shown reflective examples in pastes:

http://paste.lisp.org/display/67182/raw

There's no reason not to have jnew or jctor or whatever.

Rich

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to