Earlier quoted context omitted.
JavaScript is an objected oriented language.
Not really, from what I gather it's closer to a functional language that lets you implement objects with private data by using closures.
For modern development Javascript indeed is a shit language
221–230 of 243 posts
Re: For modern development Javascript indeed is a shit language
#222Earlier quoted context omitted.
> Except it clearly is possible since I and millions of other developers seem to manage it daily. Clearly possible to fix code that's in branches/working trees that you don't even have access to?? > This is a problem of your code-base, not the language. If your code is so brittle that it can't stand a few function changes without collapsing into a miasma of shit When you change function signatures, code that calls th…
> Clearly possible to fix code that's in branches/working trees that you don't even have access to?? This is a non-issue - if you're using unstable libraries then that's your own problem and breakages are to be expected. This is not the fault of JS. > When you change function signatures, code that calls those functions is broken. In static languages the breakage is a compile-time error. In dynamic languages the break…
All your replies about external APIs changing are irrelevant. A codeveloper touching functions that call your functions or defining functions called by you will integrate with your work with an innocuous "git pull" and force you to review everything just to rule out what JS could have easily detected.
> If a change in a dependency causes you to have a ripple effect of completely broken code - then yes, your code is tightly coupled.
Again, I'm not talking about "dependencies" or libraries here at all.
> In my job, if somebody commits and pushes something which is going to completely fuck the rest of the development team, then they're told to piss off and fix it.
The push was completely benign. The integration of that push with your current work will be broken in cryptic ways. Not necessarily ones that show up in the testing suites.
> If you absolutely must change a function signature which is part of an API that others may be depending on, then you fucking document it and alert your users. Again, not JS. Sort your process out.
Every single function signature can break things, not just exposed APIs. Two developers might work on the same piece of code. There's not necessarily any obvious point to notify here and still breakage may arise.
> Except it doesn't, because who updates a dependency without checking that they can actually depend on it? The clue's in the name.
You clearly haven't understood the scenario involved, I'll try to describe it again:
1) Developer A adds a new function FOO that calls internal function BAR in his unpushed working tree.
2) Developer B changes the signature of internal function BAR, and pushes this change to "master".
3) Developer A pulls from master, his code is now broken, but JS doesn't even warn him when he executes it. Instead, wrong results (or accidentally correct results for any given test case) arise.
4) The test suites don't catch the error. Developer A unwittingly pushes the broken code to master.
Re: For modern development Javascript indeed is a shit language
#223Earlier quoted context omitted.
I'm not missing the point, and I don't agree that it hides an error and gives a cryptic bug. Messing with a function signature and not updating callers of that function is not a bug in the language, it's a bug in the programmer and will result in runtime bugs in any dynamic language. If you require X number of args, then assert that they aren't undefined. If you presume callers pass in X number of args in a variable…
> I'm not missing the point, and I don't agree that it hides an error and gives a cryptic bug. It hides the error by carrying on, despite having the wrong number of arguments, and executing code with thus necessarily wrong inputs. > Messing with a function signature and not updating callers of that function is not a bug in the language, it's a bug in the programmer When editing code, you routinely change the function…
You don't have to check every every arg to check the count is correct if that's something you're concerned about. Nor does checking args are undefined require a line per since you could check them all with a single assert.
If you're the type who has constant bugs from wrong arg counts, use another language that better suits your programming style, but it's not a problem everyone has.
And Dijkstra despised OO, and came from a much different time, I don't much care for many of his opinions. Alan Kay is more my style.
Re: For modern development Javascript indeed is a shit language
#224Earlier quoted context omitted.
Do you mean lexical scope? Scheme has it and it is awesome. If you think it is not a good feature you should grab a SICP and see the magical stuff you can do with it.
He is asking what other sane language does not have lexical scope, as that was listed as one of JavaScript's advantages.
Re: For modern development Javascript indeed is a shit language
#225Earlier quoted context omitted.
How do you handle Javascript ignoring wrong numbers of function arguments? Do you use a linter to catch this sort of thing? This part of Javascript sounds the most absolutely insane to me: Silencing an error like that is catastrophic.
Is this so much of a problem that we need to re-design JS to handle it? Why not just avoid making this mistake in the first place by reading the code? Not to sound dismissive - but if you're making these kinds of mistakes regularly enough to irritate you, it's not the language that's at fault. Javascript's squishiness is the thing I like the most about it. It's far from perfect, just like any other language out there…
It's like someone complaining that git let them make a mess after they merged master into their feature branch and then merge it back into master.
Re: For modern development Javascript indeed is a shit language
#226Earlier quoted context omitted.
Not really, from what I gather it's closer to a functional language that lets you implement objects with private data by using closures.
Yes really. It's an OO language based on Self's prototypical OO model rather than a class based OO model. Prototypical OO is still OO, unless you're claiming Self isn't OO, but the Smalltalker's who invented Self would very much disagree. Prototypes are objects, no closures or classes required.
Re: For modern development Javascript indeed is a shit language
#227Earlier quoted context omitted.
Not really, from what I gather it's closer to a functional language that lets you implement objects with private data by using closures.
Yes really. It's an OO language based on Self's prototypical OO model rather than a class based OO model. Prototypical OO is still OO, unless you're claiming Self isn't OO, but the Smalltalker's who invented Self would very much disagree. Prototypes are objects, no closures or classes required.
I do like what we seem to be arriving at with asm.js; a subset of JS as the assembly language of the web, with people being able to choose the language that best fits their problem domain and target the JS machine.
Re: For modern development Javascript indeed is a shit language
#228Earlier quoted context omitted.
Every single one of these compile to the JavaScript runtime. (Dart has a native VM in Chromium, but AFAIK it is a long way off from the real world)
Right and ClojureScript, for example, has full goroutines in it (i.e. core.async) if doing standard callback based async in JS isn't your thing. Functionally, it makes little to no difference whether you're writing something that compiles down to JS or writing something that compiles down to its own runtime (assuming you turn source maps on your browser).
It actually makes a big difference. You can't use profiles, debugger, libraries, and other stuff which is platform specific but have to use JavaScript ones. Often, they don't play well with with languages which generate to JS.
Re: For modern development Javascript indeed is a shit language
#229Earlier quoted context omitted.
> I'm not missing the point, and I don't agree that it hides an error and gives a cryptic bug. It hides the error by carrying on, despite having the wrong number of arguments, and executing code with thus necessarily wrong inputs. > Messing with a function signature and not updating callers of that function is not a bug in the language, it's a bug in the programmer When editing code, you routinely change the function…
> That captures half of the bugs (too few arguments), for a large overhead (an extra line for almost every argument in every function). You don't have to check every every arg to check the count is correct if that's something you're concerned about. Nor does checking args are undefined require a line per since you could check them all with a single assert. If you're the type who has constant bugs from wrong arg count…
That's true, but the overhead is still relatively huge.
> If you're the type who has constant bugs from wrong arg counts, use another language that better suits your programming style, but it's not a problem everyone has
I'm the type of programmer who tries to avoid errors as much as I can, but still make them as I am human, as we all are.
One of the possible errors that's really easy to make is forgetting to grep for callers of a function you just changed. Of course 99 out of 100 times you remember, but 1 out of 100 you will forget.
Another possible error is remembering to change the function signature, but just having a typo or mistake.
And finally, even if you make no errors at all -- when you pull from the server you get a bunch of function signatures and calls changed "under you feet", so any changes you had already pending (perhaps in different files) are now potentially silently invalidated, and there won't even be a runtime error to tell you about them.
There is really no real benefit to this behavior at all (beyond backwards compatibility of course). Explicit rest-of-args cost nothing.
Error messages are superior to wrong behavior, and this behavior is simply insane.
Re: For modern development Javascript indeed is a shit language
#230Earlier quoted context omitted.
Is this so much of a problem that we need to re-design JS to handle it? Why not just avoid making this mistake in the first place by reading the code? Not to sound dismissive - but if you're making these kinds of mistakes regularly enough to irritate you, it's not the language that's at fault. Javascript's squishiness is the thing I like the most about it. It's far from perfect, just like any other language out there…
This. People complaining about what JavaScript lets you do just need to learn how to exploit its strengths while being aware of its dangers. It's like someone complaining that git let them make a mess after they merged master into their feature branch and then merge it back into master.
git commit - m"Hi" && git push
Let's push a commit with an undefined message, and ignore the m"Hi" argument. Error messages are annoying.