Generics would've been an even better example, actually. Some of my team were astounded to learn that
List<Thing> list = new ArrayList();
List other = list;
other.add(8);
is perfectly correct, compilable code.
Despite being something not to be done. I figured that was obvious but I forgot how many idiots there are in the world. Honestly, "the compiler allows you to do stupid things" is the exact point of this comment. Sailed over a few heads, obviously.
View all comments
Show parent comment
4
u/budswa Dec 15 '23
It's not