[Haskell-cafe] Re: What I wish someone had told me...

Jonathan Cast jonathanccast at fastmail.fm
Thu Oct 16 12:16:59 EDT 2008

On Thu, 2008-10-16 at 15:02 +1300, Richard O'Keefe wrote:
> 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.

God, I hope never to understand Java.  *shudder*

> 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().

Wait, what?  Why can't Java use this to keep template parameters around
at run time?  Or is the article (as per which Set<Integer> and
Set<Double> are identical at run time) full of it?


More information about the Haskell-Cafe mailing list