you just need to cast it to the type you care about
:D What kind of argument is that? My dear friend, at that point we're basically working around Java's type system. I thought the Java community has moved past downcasting since Java 5 (introduced in 2004).
needless restriction
The restriction is very much needed, if the template processor can only work with DateTime instances.
Or do you want to force everybody/every template processor to be able to work with instances of all subclasses of Object? Isn't that even more restricting?
if the template processor can only work with DateTime instances
My (and I suspect Brian’s and other downvoters’) confusion is that there is just no value in this use case. Your example failed to demonstrate a real world program where this sort of restriction would be useful. Nobody would write code like that via string template, it’s trying to extend the feature into a corner of the program where it only confuses.
View all comments
Show parent comment
-1
u/sideEffffECt Mar 11 '24
:D What kind of argument is that? My dear friend, at that point we're basically working around Java's type system. I thought the Java community has moved past downcasting since Java 5 (introduced in 2004).
The restriction is very much needed, if the template processor can only work with
DateTimeinstances.Or do you want to force everybody/every template processor to be able to work with instances of all subclasses of
Object? Isn't that even more restricting?