4 ms·
C: "4" + 4 = 8 warning: assignment to ‘char’ from ‘char *’ makes integer from pointer without a cast Go: "4" + 4 invalid operation: "4" + 4 (mismatched types u
by kamranjon 4y ago
C: "4" + 4 = 8
warning: assignment to ‘char’ from ‘char *’ makes integer from pointer without a cast
Go: "4" + 4
invalid operation: "4" + 4 (mismatched types untyped string and untyped int)
Rust: "4" + 4
error[E0369]: cannot add `{integer}` to `&str`
Listen - you can argue semantics all you want but unless you try these things yourself, we're not going to get anywhere. You asked me for examples of non-dynamic languages that don't behave the same as javascript, I provided them. I feel like maybe you took my suggestion to actually try these things out as condescending, it wasn't, I was trying to be constructive.
This is a discussion about what languages allow you to do, compile-time vs run-time is irrelevant, if we get a warning or an error at compile-time vs run-time it makes no difference. The point is that Javascript silently hums along with no warning or error at all when you try to do something that many languages would not allow you to do without at least a warning. You can dig down into a semantic rabbit hole about what "throw" really means but I think you understand what I'm talking about.