Believing in booleans



  • @Zylon said:

    You use "+" to assemble big blobs of output, knowing that it will dutifully coerce everything in its path into a string of some type, and then NEVER use bare string-bearing variables in actual mathematical calculations. That's just good practice, no matter what the coercion rules.

    For JS, maybe.

    I found "." = concatenation v "+" = addition to make more sense in perl/PHP.



  • @Cassidy said:

    I found "." = concatenation v "+" = addition to make more sense in perl/PHP.
     

    But then PHP screwed up comparisons by not using eq and ne for strings (like Perl)!

     



  • @Zylon said:

    Then you're a spectacular moron
     

    You're a meanie. :(

    @Zylon said:

    thinking that the coercion behavior should change depending on what's in the string. What a glorious breeding ground for bugs THAT would be.

    I don't think so.

     



  • @morbiuswilters said:

    and because of JS's overloading of the + operator, you end up with the following:
     

    I am in favour of separate operators for concatenation and addition, which would pretty much solve this mess entirely.



  • @Zemm said:

    But then PHP screwed up comparisons by not using eq and ne for strings (like Perl)!
     

    You're saying those operators are distinct from != and == in PHP?



  • @dhromed said:

    I am in favour of separate operators for concatenation and addition, which would pretty much solve this mess entirely.

    Score one for VB, then.



  • I'm in favor of strict typing, which would solve this mess entirely.



  • @Zylon said:

    @morbiuswilters said:

    @Zylon said:
    Today I learned that in Morbs-land, nobody ever prints numbers.

    What does that have to do with anything?

     

    Other than the fact that I was directly responding to something that you said??? In JS, the moment strings get involved, you aren't ADDING, you're CONCATENATING. That happens a whole hell of a lot when generating output, and is thus not "a sign that your code is seriously screwed up".

    Yes, it's inconsistent with how every other mathematical operator coerces, which is unfortunate. But from the perspective of someone who know what they're doing, it's perfectly fine.

    Right, because I said concatenation should be impossible. Oh, wait, that's just your Down's Syndrome acting up. I actually said it was obnoxious to use + for addition and concatenation and to coerce strings-to-numbers for 3 of the arithmetic operators but numbers-to-strings for the other.

    @Zylon said:

    You use "+" to assemble big blobs of output, knowing that it will dutifully coerce everything in its path into a string of some type, and then NEVER use bare string-bearing variables in actual mathematical calculations. That's just good practice, no matter what the coercion rules.

    So what the fuck is the point of coercion if it doesn't even work consistently? Basically, you're just spewing feces, yet again.



  • @dhromed said:

    @Zemm said:

    But then PHP screwed up comparisons by not using eq and ne for strings (like Perl)!
     

    You're saying those operators are distinct from != and == in PHP?

    You'd use !== and === if you wanted to compare two variables and guarantee both were strings.



  • @dhromed said:

    @Zemm said:

    But then PHP screwed up comparisons by not using eq and ne for strings (like Perl)!
     

    You're saying those operators are distinct from != and == in PHP?

    PHP doesn't have eq, but Perl does. PHP's == does a different (implicit) cast compared to Perl.

    If you use == in Perl it does a numeric comparison; eq is for string comparison.

     



  • @Zemm said:

    PHP doesn't have eq, but Perl does. PHP's == does a different (implicit) cast compared to Perl.

    If you use == in Perl it does a numeric comparison; eq is for string comparison.

     

    Oh, I misread PHP when you actually said Perl.

    My bad. No error here. Move along.

     



  • @Scarlet Manuka said:

    @dhromed said:
    I am in favour of separate operators for concatenation and addition, which would pretty much solve this mess entirely.

    Score one for VB, then.

    In VB, + can still be used for both addition and concatenation.


Log in to reply