Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is one of those "Turing tar-pit" scenarios. As you point out, it's technically possible, but in most languages, it would drastically increase the verbosity of the code.

None of the built-in control structures will work with your custom types. In Java, for example, "int" is a primitive, and "Integer" is final. All the built-in functionality that works with numeric types won't work with your types. All of the standard and third-party libraries expect the built-in types, too. Java doesn't support operator overloading, so you wouldn't be able to + your numbers, either. Instead of helping you with every arithmetic operation, it would be a massive pain point at every arithmetic operation.

Strings and integers are fundamental types. Programming languages just aren't designed to let people substitute their own.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: