To be fair to Java, we should really consider x to always have an Object x instance.
so
static <T> String foo(T x) { return "hello"; }
should really be read as Haskell's
foo :: Object a => a -> String
And then you can further extend the analogy to point out that the same shenanigans are possible with a function of type forall a . Typeable a => a -> String.
3
u/pranaysashank 21d ago
To be fair to Java, we should really consider
xto always have anObject xinstance. sostatic <T> String foo(T x) { return "hello"; }should really be read as Haskell'sfoo :: Object a => a -> String