JavaScript
-
So, all you've mustered is some lame-ass whataboutism?
Have a good daySo you don't have a suggestion. Got it.
-
So you don't have a suggestion. Got it.
Of course. Nothing beats JS, oh guru mighty guru
-
- 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.
- But also, that was in reply to https://lemm.ee/comment/20939144 which only mentions "implicit type coercion" in general.
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.
-
(.)
is a valid expression in Haskell. Normally it is the prefix form of the infix operator.
that does function
composition.(.) (2*) (1+) 3
=((2*) . (1+)) 3
=2 * (1 + 3)
=8
.But, the most common use of the word "boob" in my experience in Haskell is the "boobs operator":
(.)(.)
. It's usage in Haskell is limited (tho valid), but it's appearance in racy ASCII art predates even the first versions on Haskell.The pioneers of ASCII art in the 70s and 80s are the unsung heroes of porn.
-
Of course. Nothing beats JS, oh guru mighty guru
So all you've mustered is some lame-ass ad-hominem? Have a good day
-
This post did not contain any content.
It's my favorite language too, but I also find this hilarious.
-
So, just don’t use JavaScript?
That's also my understanding: "Javascript is great because you can use other languages and then transpile them to JS."
-
This post did not contain any content.wrote on last edited by [email protected]
It's because
+
is two different operators and overloads based on the type to the left, while-
is only a numeric operator and coerces left and right operands to numeric. But frankly if you're still using+
for math or string concatenation in 2025, you're doing it wrong. -
It's because
+
is two different operators and overloads based on the type to the left, while-
is only a numeric operator and coerces left and right operands to numeric. But frankly if you're still using+
for math or string concatenation in 2025, you're doing it wrong.I know nothing about javascript, what is wrong with using + for math? perhaps naively, I'd say it looks suited for the job
-
This post did not contain any content.
It makes sense though
-
I know nothing about javascript, what is wrong with using + for math? perhaps naively, I'd say it looks suited for the job
It's much better to make your own function that uses bitwise operations to do addition.
function add(a, b) { while (b !== 0) { // Calculate carry let carry = a & b; // Sum without carry a = a ^ b; // Shift carry to the left b = carry << 1; } return a; }
(For certain definitions of better.)
-
Not really, considering Typescript only adds static types to JS. It's not a different language, it's an extension.
Since it needs to be compiled to JavaScript in order to be used, I kind of consider it a different language. Yes, it's a strict superset of JavaScript, but that makes it different.
-
Yeah, this looks dumb on the surface, but you've got bigger problems if you're trying to do math with strings
Better than doing physics with strings
-
That's also my understanding: "Javascript is great because you can use other languages and then transpile them to JS."
Oh man machine language is so good, literally the best actually
-
I know nothing about javascript, what is wrong with using + for math? perhaps naively, I'd say it looks suited for the job
The correct way to do it is to load a 500mb library that has an add function in it.
-
It makes sense though
-
So, just don’t use JavaScript?
Yeah! Wasm is a thing. At least rust and go are pretty neat in the browser lately.
We should leave that pile of semantics and just go further with web development
-
Since it needs to be compiled to JavaScript in order to be used, I kind of consider it a different language. Yes, it's a strict superset of JavaScript, but that makes it different.
wrote on last edited by [email protected]That's your prerogative, but it honestly doesn't make sense. Typescript adds almost no functionality to JS (and the few pieces it adds are now considered mistakes that shouldn't be used anymore). It only focuses on adding typing information, and in the future you'll be able to run TS that doesn't use those few added features as JS (see the proposal).
You can also add the TS types as comments in your JS code, which IMO shows that it's not a different language.
-
That's also my understanding: "Javascript is great because you can use other languages and then transpile them to JS."
wrote on last edited by [email protected]JS itself is great, I prefer it to most other languages due to the flexibility that it allows. Adding types through TS to safeguard against footguns doesn't mean you're not still using JS. You can also add the types using comments instead if you prefer it, which means you're actually writing raw JS.
-
It makes sense though
.... It does?