Fuck javascript. Fucking why is it passed in by reference. Literally no other type does this. Took 20 mins to debug.
Also
let foo = []; if (foo) { console.log("reached"); }
>>"reached"
Fucking hell this one took me 5 hours to debug. >inb4 use python not using some gay ass language with white space instead of curly brackets. Completely unreadable and impossible to navigate in files that are larger than 300 lines of code.
python also passes by reference, retard. what you might be expecting is that reverse isn't an in-place operation, in which some languages might be true, and in others not (and then you have ruby, which goes "why not both?")
Kayden Walker
>Fucking why is it passed in by reference. Literally no other type does this. Literally all (usable) languages do this.
Evan Hernandez
retarded. so how do you pass a copy in javascript then? current workaround is just to do foo.reverse() ... stuff in here ... foo.reverse()
at the very end of the function but thats hacky af.
Kayden Perry
Make a temporary variable?
Leo Edwards
>Fucking hell this one took me 5 hours to debug. What did you even tried to achieve there? If this array reference is truthy then execute? Use the actual boolean values in your if statements then you will avoid this type of errors in the future. Try strict TypeScript, ClojureScript (if you want purity) or even Scala compiled to JS. These three languages could give you some more sanity.
>proper indentation is build into the language >literally impossible for morons to fuck up >python is unreadable please stay in webshit where you belong
Adrian Gray
Why is it even there? Might aswell throw an error if you type ==
Levi Brooks
It does if you are using any decent linter.
Michael Nguyen
What would work? You just might be retarded.
Grayson King
I absolutely hate Javascript I refuse to use anything more than WYSIWYG and copypasting from tutorials.
It is a gutter language for gutter people and a waste of time to study in any depth. It is mind addling and makes you unable to think clearly by design.
Henry Morris
What are some languages you approve, based retard?
That's how it works in most languages. Very few pass arrays as a list of values by default, and even then you generally end up manually passing them as a reference most of the time.
I'm having a hard time understanding this. You bitch about JS because it has the == operator and a few other warts, but you're fine with Python, which is worse than JS in every single way (OOP out the ass, shitty lambdas, stupid variable scoping, horrible performance too...), C++ which is hardly designed at all, and Scala which is cool but kind of ends up being an abomination compared to purer FP languages that don't try to please the OOP crowd.
Nolan Bailey
How clueless are you?
Sebastian Lee
It takes an IQ of 80 or more to be able to use JS and understand the concept of using === instead of ==. I'm sorry you didn't make the cut.
>having such a shitlang implementation of == you need to invent the === operator
Carter Jenkins
>he takes joy in debugging shitlangs.
that's not what programming is meant to be, user.
Jace Thompson
these are sad and known problems since forever. I'm sorry you don't read prototype specs on mdn and just expect shit to work, tard.
Ian Jackson
ITT: python brainlet is too retarded to use javascript
Easton Jackson
Keep these threads going. Amazing how crossboarder nonprogrammer brainlets can't even spend 30 seconds to read docs then cry in a corner shitposting on Jow Forums
Look, he's finally getting it! How cute. Maybe next he'll figure out he needs more exercise, considering he can't handle one extra keypress.
Daniel Martinez
I just saw this episode, kek
Josiah King
The === operator has been there since the original version. The == operator was added later because of dumb Python devs wanting it.
Levi Parker
>His 'language' uses prototyping
>crusty front-end design tranny >programmer
Bentley Kelly
>three-character operators
Joshua Reyes
One moment brainlet user is like >Shitlang! >Only """webshitters""" use this lang!
but then user is like >waaah waaaah >why am I supposed to read documentation >waaaaah waaaaaah
Aaron Barnes
Stay unemployed.
Zachary Adams
I didn't say I enjoy it. But it sure as fuck didn't take my 4 hours to figure out the most simple shit unlike OP
Isaiah Martin
>Fucking why is it passed in by reference You want it to make a copy of your entire list every time you pass it?
James Long
>His 'language' uses prototyping
a) it's not my language faggot b) you don't have a choice in many cases unless you like injecting a lot of extra compiler code in your transpiled dream lang because some problems like UCS-2 string representations are fundementally baked in.
shit sucks mega ass, but it's the reality of the world. JS is hardly all that bad compared to some of the other scripting languages with double digit percentage adoption. If you hate it so much, there are numerous number of transpilers to js you can explore.
e.g. ClojureScript, BuckleScript, TypeScript, etc.
Josiah Richardson
Why defend the cancerous tyranny of js over the webdev ecosystem?
Eli Perez
...
Lucas Morgan
Over a shitlang like Python?
John Young
the behavior of reverse is quite tragic though. most of the array protos return new arrays, and all the new ones behave this way as well. it's just a strange and inconsistent wart.
Xavier Peterson
Fuck you. Completely misinterpreted the post. Of course i know how == and === works. == is based on implicit casting. And so because [] == false >>true
i assumed that when you pass it into if ([]) { }
the implicit casting of the array to type bool if(new Boolean([])) { }
would result in standard behaviour just like if(new Boolean("")) { }
Aiden Rogers
What makes you think python is a shitlang?
Dylan Bell
>tyranny If by that you mean ECMA then you're retarded. They've only made the language more stable and fixed the ridiculous nondtandardisation
Noah Gonzalez
>new Boolean Way off the fucking track, retard
Benjamin Hall
Having 2 equals operators, for one.
Hunter Scott
>whats the difference between assignment and assertion
Are you really this much of a brainlet?
Connor Harris
spastic
Chase Davis
the most absolute recent example of why python is a shitlang:
f'{'ayyyyy lmao'}' # syntax error, lol f'{"ayy lmao"}' # this is acceptable language design according to cpython devs.
Matthew Clark
Implicit boolean conversion is not the same as using == true you retard. And why the fuck would you ever use == true? Are you one of those idiots who does if (condition == true) { // do stuff }
Caleb Cooper
That's not what I'm referring to retard. Goes to show the limits of an IQ of 75.
Matthew Scott
That's true. reverse is a very old method from the early javascript days before the benefits of immutability in functional programming was as widely accepted. Newer methods added to javascript return something without modifying the original data, but older ones operate in-place
Ryan White
It's not great behavior, but it's also entirely your own fault for writing sloppy "if ([]) ..." code - especially without having a good understanding of the casting. Just write if (arr.length) ... or if (arr.length >= 0) ... and stop being a nigger. You can't complain about weak typing while wanting to abuse it yourself.
Gabriel Walker
you must be a great programmer in your head the problems are in the tools you use, not in your skills you're just too good user
Evan Ortiz
int a = 0; // Will the next line be executed????????????????/ a++; printf("%d\n", a);
Lincoln Mitchell
stop being so lazy, you have to be a lot more explicit in javascript because of type coercion bullshit.
just do
if (foo.length === 0)
if you can't handle that, then literally go back to python
Easton Perry
yes?
Evan Morales
Python: >== - equality >is - identity
JS: >== - equality >=== - identity
PHP: >== - equality >=== - identity
Bonus - Lisp: >= >eq >eql >equal >equalp
Xavier Cook
what's wrong OP? can't read code? i dont see anything wrong with your examples
Jacob Bell
there is almost no usecase for is in Python. It is not the same as the JS ===.
formatting as syntax no code conventions capitalized booleans cumbersome errors retarded versioning not strongly typed but very picky about data types fucking slow serialization as binaries formatting as fucking syntax
python is just a toy language and shouldn't be used in a serious project, only students and sysadmins use python
Hunter Howard
>formatting as syntax muh foic yeah, like you're not going to indent your code anyway
>no code conventions like PEP doesn't exist
Nolan Williams
you can disable javascript and post through an html form though
Leo Lee
import shitlbrary as shit shit.somefunction()
import deprecated_warning_generator as dg dg.some_function()
import other_library other_library.someFunction()
python is a mess and it breaks with a single whitespace
Levi Rogers
like camelcasing vs snakecasing isn't an issue in literally all C syntax languages
Adrian Gomez
Javascript is consistently camel case.
Nicholas Robinson
>he things == and is are the same thing I hope you're not genuinely this retarded.
Logan Hughes
>he "things" == and === are the same thing I hope you're not genuinely this retarded.
Jordan Bailey
>=== We're talking about Python, this doesn't exist.
Owen Richardson
It does though, only by another name >is
Austin Butler
if you are using it then at least how to use js, look up truthy and falsy values for starters
Easton Hill
>Formatting as syntax Formatting is characters just like curly braces. Unlike curly braces, it makes your code easier to read.
>no code conventions PEP
>capitalized booleans Who cares? Autism.
>cumbersome errors Python error handling is very sophisticated and not cumbersome at all.
>Retarded versioning As opposed to JS where everything is a intricate web of dependencies? lmao
>not strongly types but very picky about data types Why is this bad for a high-level interpreted language?
>fucking slow Only thing wrong with Python from my viewpoint. It still allows much quicker prototyping of object oriented programs than the alternatives. If it's a worthwhile exercise, it can be ported to C++ or other languages.
>serialization as binaries Why is this a problem?
Jaxon Bailey
why are you arguing with a python retard? they can barely write code
just nod an feel sorry for the poor idiot
Jace Parker
He's also wrong, Python is dynamically strongly typed.
Brandon Gomez
>value comparison and address comparison are the same thing
Kayden Sanders
Python is both call by reference and copy by value. All immutable data types and structures are copy by value while all the mutable data types and structures are call by reference. It's one of the parts of Python I dislike for obvious reasons. It's better to choose one and stick with it since it would reduce a lot of unexpected behaviour.
Brody Moore
I am a "python retard" too, fuck you.
Owen Stewart
*nods and feels sorry for you*
Jacob Butler
>Fucking why is it passed in by reference.
Why wouldn't it?? Are you new to programming?
Christian Edwards
it's irrelevant for the most part though since python doesn't have the same type coercion as javascript, so for most people "==" will suffice. meanwhile, in javascript, unless you want a debugging nightmare or know what you're doing, you should pretty much always use "==="