Sure. And you’re entitled to yours. But words have meaning and this isn’t MY OPINION, it’s objective reality. It follows strict rules for predictable output, it is not nonsensical.
You’re entitled to think it’s nonsense, and you’d be wrong. You don’t have to like implicit type coercion, but it’s popular and in many languages for good reason…
Language
Implicit Coercion Example
JavaScript
'5' - 1 → 4
PHP
'5' + 1 → 6
Perl
'5' + 1 → 6
Bash
$(( '5' + 1 )) → 6
Lua
"5" + 1 → 6
R
"5" + 1 → 6
MATLAB
'5' + 1 → 54 (ASCII math)
SQL (MySQL)
'5' + 1 → 6
Visual Basic
'5' + 1 → 6
TypeScript
'5' - 1 → 4
Tcl
"5" + 1 → 6
Awk
'5' + 1 → 6
PowerShell
'5' + 1 → 6
ColdFusion
'5' + 1 → 6
VBScript
'5' + 1 → 6
ActionScript
'5' - 1 → 4
Objective-J
'5' - 1 → 4
Excel Formula
"5" + 1 → 6
PostScript
(5) 1add → 6
I think JavaScript is filthy, I’m at home with C#, but I understand and don’t fear ITC.
In https://lemm.ee/comment/20947041 they claimed “implicit type coercion” and showed many examples; they did NOT claim “string concatenation”.
However, that was in reply to https://lemmy.world/comment/17473361 which was talking about “implicit conversion to string” which is a specific type of “implicit type coercion”; NONE of the examples given involved a conversion to string.
You are entitled to your opinion. implicit conversion to string is not a feature in most languages for good reasons.
Sure. And you’re entitled to yours. But words have meaning and this isn’t MY OPINION, it’s objective reality. It follows strict rules for predictable output, it is not nonsensical.
You’re entitled to think it’s nonsense, and you’d be wrong. You don’t have to like implicit type coercion, but it’s popular and in many languages for good reason…
'5' - 1 → 4
'5' + 1 → 6
'5' + 1 → 6
$(( '5' + 1 )) → 6
"5" + 1 → 6
"5" + 1 → 6
'5' + 1 → 54
(ASCII math)'5' + 1 → 6
'5' + 1 → 6
'5' - 1 → 4
"5" + 1 → 6
'5' + 1 → 6
'5' + 1 → 6
'5' + 1 → 6
'5' + 1 → 6
'5' - 1 → 4
'5' - 1 → 4
"5" + 1 → 6
(5) 1 add → 6
I think JavaScript is filthy, I’m at home with C#, but I understand and don’t fear ITC.
Also, you contradicted yourself just then and there. Not a single of your examples does string concatenation for these types. It’s only JS
So, I think probably everyone in the thread is “correct”, but you are actually talking past one another.
I think the JS behavior is a bad design choice, but it is well documented and consistent across implementations.
Read the thread again, it seems you slipped somewhere. This was all about the claim that implicit conversion to string somehow could make sense.
C# is filthy. But it explains where you got your warped idea of righteousness.