On 16 Oct 2008, at 12:09 pm, Jonathan Cast wrote:
I am not sure how say in a Java language a constructor can "conjure up
a value of an unknown type".

Well, that's the point.  It can't, in Haskell or in Java.  If you
understand that --- that you can't call the default constructor of a
class that is not statically known at compile time

If you understand that about Java, then you don't understand Java.
Java reflection means that compile-time types are backed up by
runtime objects belonging to Type in general, to Class if they
are class types.  It also means that you can discover the
default constructor by using aClass.getConstructor(), and you
can invoke it by using .newInstance().

If it were not possible to do this, Java would not get much
use out of its ability to load new classes at run time.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to