OOP is TRWTF



  • @djls45 said in OOP is TRWTF:

    @pie_flavor said in OOP is TRWTF:

    @_P_ What's wrong with autoboxing? The types aren't malleable, they're still the same types, they can just convert between each other without explicit casts.

    But then how do you know what operation you will be doing on the data?
    Given "3" + 0.14 will I get 3.14 or "30.14"?
    Is it clear without reading documentation or memorizing the autoboxing conversion hierarchy?

    That's not boxing; that's coercion. Automatic type coercion is a very, very bad thing. (See: JavaScript.)



  • @djls45 said in OOP is TRWTF:

    @pie_flavor said in OOP is TRWTF:

    @_P_ What's wrong with autoboxing? The types aren't malleable, they're still the same types, they can just convert between each other without explicit casts.

    But then how do you know what operation you will be doing on the data?
    Given "3" + 0.14 will I get 3.14 or "30.14"?
    Is it clear without reading documentation or memorizing the autoboxing conversion hierarchy?

    No, by fundamental force you need to look at both sides to figure out what is the actual operation represented by the + there. Even operator/method overloading needs to check the argument types to decide what function to dispatch. (Implicit type conversion would be instead hard-coding this precedence into your language specs.)

    Auto-boxing is a implicit type coercion that's worse than operator overloading because it applies to everywhere, instead of a limited set of scenarios that you want it to happen.



  • @dkf said in OOP is TRWTF:

    @_P_ said in OOP is TRWTF:

    Sounds like it's more that you're a victim of bad implementation than it's a bad idea overall.

    No. The idea is Bad in itself, and those who promulgate it are bad for pushing something they've never tried to do in practice and should feel bad about their pathetic little lives for the waste of effort they're encouraging others to do. It's all the very worst sort of type wanking.

    Yeah, but you haven't actually tried to use actual dependent types, or serious FP paradigm either, so 🍹


  • Java Dev

    @djls45 said in OOP is TRWTF:

    @pie_flavor said in OOP is TRWTF:

    @_P_ What's wrong with autoboxing? The types aren't malleable, they're still the same types, they can just convert between each other without explicit casts.

    But then how do you know what operation you will be doing on the data?
    Given "3" + 0.14 will I get 3.14 or "30.14"?
    Is it clear without reading documentation or memorizing the autoboxing conversion hierarchy?

    List of things PHP did right: Addition and concatenation are different operators.


  • BINNED

    @PleegWat said in OOP is TRWTF:

    @djls45 said in OOP is TRWTF:

    @pie_flavor said in OOP is TRWTF:

    @_P_ What's wrong with autoboxing? The types aren't malleable, they're still the same types, they can just convert between each other without explicit casts.

    But then how do you know what operation you will be doing on the data?
    Given "3" + 0.14 will I get 3.14 or "30.14"?
    Is it clear without reading documentation or memorizing the autoboxing conversion hierarchy?

    List of things PHP did right: Addition and concatenation are different operators.

    In any sane language, those operations are never possible at the same time.


  • Considered Harmful

    @PleegWat said in OOP is TRWTF:

    @djls45 said in OOP is TRWTF:

    @pie_flavor said in OOP is TRWTF:

    @_P_ What's wrong with autoboxing? The types aren't malleable, they're still the same types, they can just convert between each other without explicit casts.

    But then how do you know what operation you will be doing on the data?
    Given "3" + 0.14 will I get 3.14 or "30.14"?
    Is it clear without reading documentation or memorizing the autoboxing conversion hierarchy?

    List of things PHP did right: Addition and concatenation are different operators.

    Rust, of course, wins because all operators are defined by their types rather than by the language; concatenation can't at all be confused for addition.


  • Banned

    This post is deleted!

  • Considered Harmful

    This post is deleted!

Log in to reply