|
Antigravitas posted:s/===/a sane language instead/ You're not the boss of me. Because my actual boss makes me use JavaScript.
|
# ? Nov 8, 2022 17:48 |
|
|
# ? Jun 5, 2024 07:53 |
|
Stoatbringer posted:"10" - 2 = 8 lol wtf
|
# ? Nov 8, 2022 17:48 |
|
LifeSunDeath posted:lol wtf + is simultaneously the addition operator between two numbers or the concatenation operator between a string and something that can be coerced to a string. Javascript
|
# ? Nov 8, 2022 17:59 |
|
Armitag3 posted:+ is simultaneously the addition operator between two numbers or the concatenation operator between a string and something that can be coerced to a string. how do you choose which one it does? also this reminds me of french counting.
|
# ? Nov 8, 2022 18:08 |
|
LifeSunDeath posted:how do you choose which one it does? also this reminds me of french counting. It chooses for you depending on the operands. If they're both numbers, it adds, if not it tries to concatenate by turning what isn't a string into a string.
|
# ? Nov 8, 2022 18:12 |
|
Whichever is the more inconvenient operation for your situation is what'll happen. No, that rule probably doesn't guarantee it'll be consistent across all browsers
|
# ? Nov 8, 2022 18:13 |
|
"10" - 2 = 8 does the opposite, the subtraction operator will try to turn what isn't a number into a number, effectively coercing that "10" into a 10.
|
# ? Nov 8, 2022 18:14 |
|
LifeSunDeath posted:how do you choose which one it does? also this reminds me of french counting. it assumes. items contained within quotes "" are a string, otherwise they have an unspecified datatype, probably a number string + number? = well, i'm guessing these are both strings, so i will concatenate them, "10" and "2" is "102", just like "fro" + "gs" = "frogs" string - number? = well, we can't subtract one string from another, so these must both be numbers. 10 - 2 = 8 what it SHOULD do is bark a clear syntax error at you to be more specific about what you want to do. do you mean "10" + "2" or 10 + 2?
|
# ? Nov 8, 2022 18:14 |
|
Armitag3 posted:It chooses for you depending on the operands. If they're both numbers, it adds, if not it tries to concatenate by turning what isn't a string into a string. Gross
|
# ? Nov 8, 2022 18:14 |
|
LifeSunDeath posted:Gross JavaScript was famously designed in 10 days, a lot of shortcuts were made
|
# ? Nov 8, 2022 18:15 |
|
Perestroika posted:And that's why you always use === 8===D~~~
|
# ? Nov 8, 2022 18:25 |
|
The good ol' "shaft" comparison.
|
# ? Nov 8, 2022 18:25 |
|
Meanwhile: >>> "10" - 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for -: 'str' and 'int' >>> "10" + 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate str (not "int") to str >>> However >>> "10" * 2 '1010'
|
# ? Nov 8, 2022 18:28 |
|
Armitag3 posted:JavaScript was famously designed in 10 days, a lot of shortcuts were made It was probably all the caffeine
|
# ? Nov 8, 2022 18:31 |
Stoatbringer posted:"10" - 2 = 8 https://www.destroyallsoftware.com/talks/wat
|
|
# ? Nov 8, 2022 18:39 |
|
someone drew a reverse version of this with a big titty anime woman proudly holding her weird little old man figure. i would not know how to find it though
|
# ? Nov 8, 2022 19:36 |
|
Antigravitas posted:Meanwhile: but 1010 is just a different way of writing 10
|
# ? Nov 8, 2022 19:55 |
Turpitude II posted:someone drew a reverse version of this with a big titty anime woman proudly holding her weird little old man figure. i would not know how to find it though Reverse image search
|
|
# ? Nov 8, 2022 20:06 |
|
END OF AN ERROR posted:Reverse image search
|
# ? Nov 8, 2022 20:37 |
|
Armitag3 posted:JavaScript was famously designed in 10 days, a lot of shortcuts were made
|
# ? Nov 8, 2022 21:40 |
|
Armitag3 posted:JavaScript was famously designed in 10 days, a lot of shortcuts were made lol god drat that explains a lot
|
# ? Nov 8, 2022 22:03 |
|
Antigravitas posted:Meanwhile: I was going to come in here guns blazing about how strongly typed languages are the only good ones but I see this and my brain is like yeah that makes sense and then I realize I've been pythonpilled
|
# ? Nov 8, 2022 22:29 |
|
All weakly typed language inevitable comes up with a half assed scheme to introduce types on some level. Language devs never seem to remember why that is
|
# ? Nov 8, 2022 22:40 |
|
The worst part about JavaScript is that it's inextricably part of the modern web. We're never going to be able to get rid of it and replace it with something better. (The next best thing is more sane languages that turn into JavaScript when you compile them.)
|
# ? Nov 8, 2022 22:57 |
|
Code Jockey posted:I was going to come in here guns blazing about how strongly typed languages are the only good ones but I see this and my brain is like yeah that makes sense Pathlib is what pythonpilled me. They overloaded the / operator. Observe. >>> from pathlib import Path >>> Path('/') / 'var' / 'lib' / 'foo' PosixPath('/var/lib/foo')
|
# ? Nov 8, 2022 22:59 |
|
Hyperlynx posted:The worst part about JavaScript is that it's inextricably part of the modern web. We're never going to be able to get rid of it and replace it with something better. Agree, but wasm is a shining ray of hope. Javascript and all its warts will still be there, absorbed like mitochondria into the new, more advanced web ecosystem.
|
# ? Nov 8, 2022 23:00 |
Hyperlynx posted:The worst part about JavaScript is that it's inextricably part of the modern web. We're never going to be able to get rid of it and replace it with something better. https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript (yes it's the same guy from the last link)
|
|
# ? Nov 8, 2022 23:06 |
|
Antigravitas posted:Pathlib is what pythonpilled me. They overloaded the / operator. Dear god no Static types are where it is at. That and static analysis tools that bitch at you if you try and do that kinda nonsense.
|
# ? Nov 8, 2022 23:09 |
|
Meanwhile I’m over here in Lua, redefining what operands do on every individual table object, cackling with glee as my syntax becomes completely incomprehensible.
|
# ? Nov 8, 2022 23:17 |
|
Dewgy posted:Meanwhile I’m over here in Lua, redefining what operands do on every individual table object, cackling with glee as my syntax becomes completely incomprehensible. I haven't tried in other languages, but C# will let you use Unicode crap for variable names. You can absolutely use Norse runes or zalgo text to take your obnoxiousness to the next level.
|
# ? Nov 8, 2022 23:24 |
|
Blue Footed Booby posted:I haven't tried in other languages, but C# will let you use Unicode crap for variable names. You can absolutely use Norse runes or zalgo text to take your obnoxiousness to the next level. So will C++. This works fine: #include <stdexcept> #include <iostream> int main() { try { throw std::runtime_error("oh no"); } catch (std::exception& 🤮) { std::cerr << 🤮.what(); } }
|
# ? Nov 8, 2022 23:39 |
|
|
# ? Nov 8, 2022 23:42 |
|
thats a jif thats made with a computer
|
# ? Nov 8, 2022 23:46 |
|
I'm upset there's not a grandma holding a bae-fu statue of some hammer cocked beefcake. Someone with AI art powers get on it!
|
# ? Nov 8, 2022 23:49 |
|
Blue Footed Booby posted:I haven't tried in other languages, but C# will let you use Unicode crap for variable names. You can absolutely use Norse runes or zalgo text to take your obnoxiousness to the next level. Lua tables have a hidden declaration called metamethods, so if you redefine a table’s “.__add” method, for example, you can change your syntax in very dumb ways. Say you have a table foo_devourer, and you define foo_devourer.__add to be : function(t) t = nil end Then “foo_devourer + any other object” just nulls out the second object and returns nothing. Lua’s kind of stupid that way and I love it.
|
# ? Nov 9, 2022 00:30 |
|
I overload every method when I start a project with custom ones that work how I think they should. For starters, the + method? Takes two ints and then turns them into strings and then adds them together. You want maths? Use Add(int, int) ya dummy. I make these global overrides in every project I touch. I also do a lot of work for public githubs.
|
# ? Nov 9, 2022 00:44 |
|
go post in YOSPOS nerds, no one fuckin cares about coding in the pictures thread
|
# ? Nov 9, 2022 01:25 |
|
Dewgy posted:Meanwhile I’m over here in Lua, redefining what operands do on every individual table object, cackling with glee as my syntax becomes completely incomprehensible. Meanwhile I'm over here trying to swallow my shame at briefly thinking "strongly typed" means you hammer it into the keyboard like Sean Connery is sitting there yelling at you
|
# ? Nov 9, 2022 02:48 |
|
Phy posted:Meanwhile I'm over here trying to swallow my shame at briefly thinking "strongly typed" means you hammer it into the keyboard like Sean Connery is sitting there yelling at you "PUNCH THE KEYS!" *Puts thumbs through phone screen.
|
# ? Nov 9, 2022 02:52 |
|
|
# ? Jun 5, 2024 07:53 |
|
Phy posted:Meanwhile I'm over here trying to swallow my shame at briefly thinking "strongly typed" means you hammer it into the keyboard like Sean Connery is sitting there yelling at you sadly this went out of style with the buckling spring keyboard, everyone's got weak baby fingies now
|
# ? Nov 9, 2022 02:53 |