News for hackers. Stuff that matters.
Re:Not Growing a Language by phoe-krk on Saturday April 03, 2021 @02:49PM (#26683612)
As for definition, it already exists: https://docs.oracle.com/javase/8/docs/api/java/lang/Number.h...

As for abuse prevention: it would be impossible to use the common operators like +, -, +=, <<, >> and so on for anything that is not numbers, and therefore prevent C++ levels of overloading abuse.

Re:Not Growing a Language by zokier on Saturday April 03, 2021 @04:05PM (#26684277)
But any class can inherit that Number, there is nothing enforcing that the subclass is particularly number-like. You can do just stuff like

    class MyString extends Number
and you get access to operator overloads. Only thing that makes this annoying is Javas lack of multiple inheritance, but that is pretty minor thing.
Re:Not Growing a Language by hinkley on Saturday April 03, 2021 @06:21PM (#26685270)
There is a level of stupid that is deniable, and a level that is not. MyString extends Number is going to lead more swiftly to words with your coworkers.