News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by paozac on Saturday May 15, 2021 @12:07PM (#27166420)
Programming languages are tools, what matters is if they do their job. And the current popularity of javascript means it works for most people. But boy, how ugly and inconsistent it is. I wish I could like it.
Re:Modern Javascript: Everything you missed over the last 10... by neya on Saturday May 15, 2021 @01:31PM (#27167170)
I maintain systems written in Ruby, Elixir and PHP over the years. Every server side code written by me even as old as 5 years ago, works with very little modification required for today.

But the Javascript part is the one that always causes me hours-days worth of work into Rabbit holes. And by JS, I don't necessarily refer to the language alone. It's the entire ecosystem.

Oh, `npm install`? You just found out you got like 1000+ vulnerabilities. Alright, good thing it told me actually, let me update.

BOOM! Babel doesn't support this specification in this file anymore because it's nonsensical so you have to do something else now. Ok, BOOM! Babel deprecated that now, you have to try this workaround. Oh, wait. Actually, there is no workaround. You gotta downgrade your node version.

Ok, let me downgrade. Oops, that package isn't supported anymore on this node version. Oh, you need to replace this because it's no longer maintained.

I literally never had to go though this pain with any of my Elixir backend projects.

Fuck Javascript

Re:Modern Javascript: Everything you missed over the last 10... by midrus on Saturday May 15, 2021 @02:07PM (#27167479)
So npm gives you warnings about vulnerabilities and that's a bad thing?

You notice you have thousands of outdated dependencies and that's a bad thing?

I used to work a lot with python years ago, and the only reasons we didn't have this problems was because the packages management was so terrible that you didn't even notice you had to update dependencies or that they had vulnerabilities.

Re:Modern Javascript: Everything you missed over the last 10... by lanstin on Saturday May 15, 2021 @02:33PM (#27167701)
Diff being you usually have like five python deeps for every hundred npm deps a d you can do the old school thing and subscribe to the security alerts for those deps. The difference in number of deps means you have the cognitive space to understand them. Npm needed to automate because the numbers are too high. One of python’s old selling points was “Batteries included”. And the idea is fewer large library rather than a bunch of tiny libraries.

With a small number of deps where you skim the development DL, you know if there is a security issue or a cool new feature you want. Also it has more of the Unix C philosophy of don’t break stable APIs in new releases. So upgrading mostly just worked. (Stuff like deliberately breaking old SSL protocols aside). (Until python 3 of course.)

Re:Modern Javascript: Everything you missed over the last 10... by jonnycomputer on Saturday May 15, 2021 @04:20PM (#27168627)
I got to pains to limit how many python external libraries I use, for all these reasons. But because Python is so capable on its own, it works.
Re:Modern Javascript: Everything you missed over the last 10... by Draiken on Saturday May 15, 2021 @02:38PM (#27167742)
Most languages I've used don't *need* to have 1000 dependencies like JS does.

They also don't have thousands of projects depending on ridiculous packages like left pad because they actually have a standard library.

The surface of vulnerabilities and the brittleness of the entire ecosystem is the bad thing, not the warnings.

Re:Modern Javascript: Everything you missed over the last 10... by heavyset_go on Saturday May 15, 2021 @06:09PM (#27169466)
> So npm gives you warnings about vulnerabilities and that's a bad thing?

> You notice you have thousands of outdated dependencies and that's a bad thing?

This is a weird reply considering that the OP literally said those were a good thing:

> Oh, `npm install`? You just found out you got like 1000+ vulnerabilities. Alright, good thing it told me actually, let me update.

The bad things are in the lines that follow.

Re:Modern Javascript: Everything you missed over the last 10... by wreath on Sunday May 16, 2021 @12:24AM (#27171223)
Not OP but what I think they struggled with is fixing warnings. JS projects are like a poorly built house, things are constantly deteriorating and need constant maintenance.
Re:Modern Javascript: Everything you missed over the last 10... by iso1210 on Sunday May 16, 2021 @08:20AM (#27173170)
I've got a new nodejs project that a colleague wrote about 6 months ago. It's already completely broken and needed a lot of effort to get working again.

On the other hand his php project from 2011 still works, just as my perl stuff from 2006 still just works.

Re:Modern Javascript: Everything you missed over the last 10... by wreath on Sunday May 16, 2021 @10:21AM (#27173893)
This doesn't sound foreign to me. Node projects rely on a lot of dependencies (and so does their dependencies) so there is a lot of moving parts and it's prone to break.
Re:Modern Javascript: Everything you missed over the last 10... by neya on Sunday May 16, 2021 @02:12PM (#27175742)
> So npm gives you warnings about vulnerabilities and that's a bad thing?

> Alright, good thing it told me actually, let me update.

Re:Modern Javascript: Everything you missed over the last 10... by a1371 on Saturday May 15, 2021 @02:32PM (#27167688)
You're comparing Elixir & Ruby with Babel, not vanilla JavaScript. You are putting your code on non-standard JavaScript, that's on you.
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @02:40PM (#27167756)
> You're comparing Elixir & Ruby with Babel, not vanilla JavaScript. You are putting your code on non-standard JavaScript, that's on you.

Babel is the only way to use modern standard JS without excluding older browsers.

Re:Modern Javascript: Everything you missed over the last 10... by austincheney on Saturday May 15, 2021 @06:31PM (#27169601)
I completely disagree. The TypeScript compiler allows you to specify a compile target against a version of JavaScript. That means you can write modern TypeScript and have it compile to ES3.
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Sunday May 16, 2021 @11:26AM (#27174297)
Well, yeah, but then you’re using modern TypeScript, not modern JavaScript.
Re:Modern Javascript: Everything you missed over the last 10... by Oddskar on Monday May 17, 2021 @05:53AM (#27181673)
Modern Javascript is a subset of TypeScript though.
Re:Modern Javascript: Everything you missed over the last 10... by z3t4 on Sunday May 16, 2021 @06:30AM (#27172655)
JavaScript is backwards compatible. What you wrote in JavaScript 10 years ago will still work today in all JavaScript engines.

Because you mentioned Babel I suspect you actually didn't use JavaScript - but a language that compiled to JavaScript. And this complicate things a lot and is probably the root cause of your wasted hours. The time you save upfront by using some framework you pay back later in maintenance once new versions are released and things get deprecated. In JavaScript itself nothing will ever get deprecated.

Re:Modern Javascript: Everything you missed over the last 10... by adevx on Saturday May 15, 2021 @03:03PM (#27167929)
1: Trying to fix every vulnerability in any nested dependency is probably not what you want to do. In my experience only a tiny fraction has an attack surface and most are duplicates. 2: Webpack is a monster and updating webpack will always result in a lot of work. If possible use a well supported framework that incorporates Webpack, like Next.js or Nuxt.js. Updating will be a breeze. 3: Don't wait years before scanning for issues, update on a set schedule so it won't become a huge task once a critical issue is found.
Re:Modern Javascript: Everything you missed over the last 10... by Master_Odin on Saturday May 15, 2021 @08:04PM (#27170078)
Do elixir libraries just never deprecate stuff? Or just that their package managers never alert you about vulnerabilities so you can pretend like they don't exist and so never upgrade?
Re:Modern Javascript: Everything you missed over the last 10... by machiaweliczny on Monday May 17, 2021 @10:27AM (#27183808)
Actually Elixir Phoenix 1.2 to 1.3 is painful transition.
Re:Modern Javascript: Everything you missed over the last 10... by Rompect on Saturday May 15, 2021 @02:47PM (#27167813)
Sounds a lot like the external packages are the problem.
Re:Modern Javascript: Everything you missed over the last 10... by AegirLeet on Saturday May 15, 2021 @01:11PM (#27166980)
I write PHP for a living and every time I look at the JS world, I feel like they're exactly where PHP was 15 years ago, except with 20 times the amount of incomprehensible tooling.
Re:Modern Javascript: Everything you missed over the last 10... by steve_adams_86 on Saturday May 15, 2021 @02:37PM (#27167728)
I’ve worked with PHP and JS extensively and while I could almost agree from some narrow perspectives, I think JS is nowhere near where PHP was 15 years ago in any sense.

I was writing PHP 15 years ago. It wasn’t a great dev experience and the tooling was awful. JavaScript today has stellar tooling in comparison, and arguably less warts in its standard library than PHP still has today.

I really disliked JavaScript until I read some books that helped me understand what it’s doing under the hood. These days I just don’t have issues with it. Yeah, the ecosystem thrashes a lot and the tooling experience can be bad in regards to that, but otherwise it’s impressive lately. Even without TypeScript, intellisense on regular JS enables extremely streamlined navigation of references and implementations, refactoring, project navigation, tooling integration, etc. Not to mention modern profiling and debugging tools for JS are incredibly easy to use and benefit from.

PHP wasn’t at this stage even 10 years ago. The debugging story was still xdebug and tooling was improving but not great. Composer was painfully slow and buggy - nowhere near as nice as yarn and npm are now.

Yeah JS has problems, but I don’t believe it’s nearly as bad as old PHP.

Re:Modern Javascript: Everything you missed over the last 10... by BeefWellington on Saturday May 15, 2021 @03:52PM (#27168386)
> JavaScript today has stellar tooling in comparison, and arguably less warts in its standard library than PHP still has today.

There are a lot of reasons to like JavaScript as a language and NodeJS as a particular implementation. The standard library (or lack thereof) is absolutely not one of them as things stand today. I'm not even sure what you'd compare between them.

If you meant to say "package available at the other end of npm install" instead of "standard library" I could see that being a different story.

Re:Modern Javascript: Everything you missed over the last 10... by effable on Saturday May 15, 2021 @05:25PM (#27169172)
This may be a little off topic but your comment piqued my interest: I am currently learning JavaScript and I was wondering if you would like to recommend any of the books you read.
Re:Modern Javascript: Everything you missed over the last 10... by steve_adams_86 on Sunday May 16, 2021 @01:17AM (#27171408)
It’s been a while, but I really enjoyed the “You don’t know JS” series by Kyle Simpson. It explained a lot of the details I needed to understand in order to be proficient more consistently. Whether I was working on client or server side code, I felt like I understood my tools well enough to feel a lot more confident than I did before.

https://github.com/getify/You-Dont-Know-JS

Re:Modern Javascript: Everything you missed over the last 10... by sdfin on Saturday May 15, 2021 @06:11PM (#27169486)
I re-learned JS recently, https://javascript.info/ was an awesome resource and has almost anything you may need. Also MDN is good.
Re:Modern Javascript: Everything you missed over the last 10... by agumonkey on Saturday May 15, 2021 @01:40PM (#27167253)
Can you give more details ?
Re:Modern Javascript: Everything you missed over the last 10... by AegirLeet on Saturday May 15, 2021 @02:52PM (#27167846)
15 years ago, PHP didn't really support any programming paradigm very well, it was a huge untyped mess, the standard library was missing a lot of stuff, reusing code meant including individual files based on filesystem paths.

Today, PHP offers a solid OOP experience, good gradual typing, a larger and saner standard library and code loading based on namespaced components.

Now compare today's JS to PHP back in the day. It has the exact same kinds of problems. Except with modern JS, you'll end up adding TypeScript, webpack, Babel and a dozen other tools as well as several hundred megabytes of libraries to paper over all of those problems. But by doing that, you make the build process and the code that ultimately runs in a browser completely incomprehensible and undebuggable for the average developer. And then you start adding even more tooling (source maps that barely work) to try and solve that problem...

Re:Modern Javascript: Everything you missed over the last 10... by agumonkey on Saturday May 15, 2021 @04:52PM (#27168908)
I had the impression that beside gradual typing, ES6 solved most of the mess (cleaner apis, modules) which was happening at the same time PHP (and python) accelerated their growth.

I find it really unfair to compare es6 to php 15 years ago, es6 is really cute (the babel/transpiling part is peculiar, I admit it)

Re:Modern Javascript: Everything you missed over the last 10... by Waterluvian on Saturday May 15, 2021 @12:35PM (#27166674)
I started just despising JS. But with discipline and a well-configured linter, formatter, and ideally using Typescript, I've found it to become my favourite language.

Doesn't mean I'm saying JS is inherently beautiful. But if you ignore the bad features and do a little setup, it has the potential to be wonderful.

Re:Modern Javascript: Everything you missed over the last 10... by Cyberdog on Saturday May 15, 2021 @01:29PM (#27167146)
So many people are bringing up TypeScript here as an example of how JavaScript isn't so bad. I kinda feel like that's cheating. Like saying eggs are absolutely delicious when baked into a cake - you're praising something after it has been turned into an entirely different product.

Maybe TypeScript is great, but I just don't like the idea of depending on transpilers to not suck when creating the final code, and also having to debug that transpiled code, and then the whole transpilation step in between the standard command-S-command-tab-command-R workflow (this is also why I never use SASS/LESS if I don't have to).

Once JS itself has strict typing and real classes, and enough time has passed that I can be assured 95% of people using five-year-old browsers will be able to use it, then we can talk about the wonders of JavaScript. Until then I don't get why anyone would use it (or anything that transpiles to it) when there are so many better alternatives for server-side development.

Let's not even get started with Electron.

Re:Modern Javascript: Everything you missed over the last 10... by Waterluvian on Saturday May 15, 2021 @01:56PM (#27167380)
People occasionally rely on compilers. I don't really see this as much different.

At the end of the day all I care about is if I build the products and solve the problems I'm hired to do. Beyond maintainability, the "engineering" stuff is a distraction we need to be careful not to obsess over.

Re:Modern Javascript: Everything you missed over the last 10... by lanstin on Saturday May 15, 2021 @02:13PM (#27167534)
Well yes. But as the problem solver, there is nothing better than when someone has a problem, and you have a solution ready at hand which came from lambda calculus or distributed systems tricks or some crazy shit from On Lisp. That is why they are paying you, not to cranks out good dutiful straightforward solutions but for clever ideas that are simple to implement and operate. The engineering is both awareness and skill in following processes to get great cheap and effective solutions. Otherwise you end up with 20 million lines of code and all the aesthetically sensitive people have have to leave the company.
Re:Modern Javascript: Everything you missed over the last 10... by Vinnl on Sunday May 16, 2021 @02:25AM (#27171647)
Given that people are usually already using Babel, TypeScript isn't really any different than running a linter is. There's no additional transpilation step if you write your code in TS, but you can also run TypeScript to have it warn you of potential errors.
Re:Modern Javascript: Everything you missed over the last 10... by osmarks on Saturday May 15, 2021 @01:43PM (#27167280)
Why is the transpilation step an issue? You can set it up to happen whenever the file is changed with most things.
Re:Modern Javascript: Everything you missed over the last 10... by cesarb on Saturday May 15, 2021 @03:45PM (#27168311)
Because it's no longer the same language. You're not programming in JavaScript, you're programming in TypeScript, which happens to be compiled to something JavaScript engines accept. All the praise towards TypeScript does not necessarily apply to JavaScript. It would be like praising Assembly while you're actually programming in C.
Re:Modern Javascript: Everything you missed over the last 10... by goodoldneon on Saturday May 15, 2021 @06:52PM (#27169704)
AFAIK, the only difference between TS and JS is types. TS doesn't give you anything that's functionally different than JS -- only types that are stripped during compilation. You can't perform any logic on types at all (e.g. you can't have conditional logic based on interfaces).

Comparing assembly/C to JS/TS doesn't make sense.

Re:Modern Javascript: Everything you missed over the last 10... by CRConrad on Sunday May 16, 2021 @05:15PM (#27177064)
Yeah, and the only difference between C and machine code is that C hasn't been compiled yet. The comparison makes perfect sense.
Re:Modern Javascript: Everything you missed over the last 10... by goodoldneon on Sunday May 16, 2021 @06:40PM (#27177750)
Writing TypeScript is like writing JavaScript but with type annotations. Writing C is not like writing assembly with type annotations.
Re:Modern Javascript: Everything you missed over the last 10... by CRConrad on Monday May 17, 2021 @01:31AM (#27180335)
> Writing TypeScript is like writing JavaScript but...

...but different.

> Writing C is not like writing assembly...

...it's different.

Re:Modern Javascript: Everything you missed over the last 10... by Cyberdog on Saturday May 15, 2021 @03:48PM (#27168342)
With most things, yes, if the implementation for that feature supports your operating system, and it doesn't take long enough to be noticeable, and there's no weird caching issues at any given level, then yes, it's transparent in that case.

Or you could just write the JS directly and be done with it.

Re:Modern Javascript: Everything you missed over the last 10... by mnahkies on Saturday May 15, 2021 @02:00PM (#27167414)
> I just don't like the idea of depending on transpilers to not suck when creating the final code

How does this differ from trusting a compiler or interpreter?

Every language has to be translated to machine code in some way.

Re:Modern Javascript: Everything you missed over the last 10... by Cyberdog on Saturday May 15, 2021 @03:52PM (#27168381)
> How does this differ from trusting a compiler or interpreter?

When was the last time you found a bug and it was the compiler or interpreter's fault?

At any rate, the big difference is debugging, as I mentioned above. How fun is it to debug code which you only kind of indirectly wrote?

Re:Modern Javascript: Everything you missed over the last 10... by mnahkies on Saturday May 15, 2021 @04:03PM (#27168482)
The code output by typescript is generally pretty readable depending on the target, and the source mapping works very well regardless. The debuggers in all major browsers and ides handle it fine.

I've not come across any bugs caused by typescript itself in the time I've been using it since 2014, and my point was that this is the same for c or any other language - how fun is it to debug assembly you only kind of wrote

Re:Modern Javascript: Everything you missed over the last 10... by gentleman11 on Saturday May 15, 2021 @12:23PM (#27166564)
If people didn’t like JavaScript for front end work, it’s not like they could just switch to python
Re:Modern Javascript: Everything you missed over the last 10... by garyrob on Saturday May 15, 2021 @12:28PM (#27166614)
This brand-new book on using Python (via Transcrypt) in the browser to build a React app may be helpful in that regard: https://pyreact.com. Just started reading it. Seems very good so far.
Re:Modern Javascript: Everything you missed over the last 10... by gentleman11 on Saturday May 15, 2021 @12:33PM (#27166655)
Is the result ie 11 compatible and performant? Honestly curious
Re:Modern Javascript: Everything you missed over the last 10... by Master_Odin on Saturday May 15, 2021 @08:09PM (#27170101)
MS products are going to stop working with IE 11 come August, seems like it's time as an industry to force its retirement on any holdout managers.
Re:Modern Javascript: Everything you missed over the last 10... by bobthepanda on Saturday May 15, 2021 @12:29PM (#27166623)
WASM is supposed to unlock non-Javascript for the browser, no?

Also there have been attempts before but nothing really stuck. How many non-Googlers use Dart?

Re:Modern Javascript: Everything you missed over the last 10... by echelon on Saturday May 15, 2021 @01:29PM (#27167147)
You can write Rust for the frontend right now. It's pretty neat.

Yew [1] is one of the early Rust frameworks for client side work. It allows for multi-threaded (!) execution and javascript interop.

Not many other languages make sense as you have to pack in the whole runtime, GC, etc. Rust is pretty well positioned for WASM, and it's going to take off soon.

[1] https://github.com/yewstack/yew

Re:Modern Javascript: Everything you missed over the last 10... by irrational on Saturday May 15, 2021 @01:27PM (#27167121)
No? WASM doesn't replace JavaScript. Think of it as a high-performance library that JavaScript can make use of.
Re:Modern Javascript: Everything you missed over the last 10... by globular-toast on Saturday May 15, 2021 @12:27PM (#27166611)
I use both JS and Python for work and not a day goes by where I don't wish history had taken a different course and Python had ended up embedded in web browsers.
Re:Modern Javascript: Everything you missed over the last 10... by qbasic_forever on Saturday May 15, 2021 @01:33PM (#27167200)
There was a strange time in the dark days of IE6 dominance 20 years ago that you actually could write page scripts in non-javascript languages. VBScript was a big option that some people used, and IIRC there was a way to get python support in IE (and Windows) script host too. When I was first learning Javascript in ~1998 I remember all the docs showed how to do stuff in both JS and VB script tags: https://stackoverflow.com/questions/17483782/vbscript-suppor...
Re:Modern Javascript: Everything you missed over the last 10... by paozac on Saturday May 15, 2021 @12:38PM (#27166703)
Or Lua
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @12:57PM (#27166878)
> If people didn’t like JavaScript for front end work, it’s not like they could just switch to python

Sure, they can, both via compile-to-JS solutions like Transcrypt [0], and via generate-the-frontend-with-backend-Python solutions like idom [1], Plotly Dash [2], and others.

[0] https://www.transcrypt.org/

[1] https://idom-docs.herokuapp.com/docs/index.html

[2] https://dash.plotly.com/

Re:Modern Javascript: Everything you missed over the last 10... by esrauch on Saturday May 15, 2021 @01:08PM (#27166960)
It turns out that even if you accept "Python is great and JavaScript sucks" that "Python compiled to JavaScript" ends up even worse than JavaScript.
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @01:31PM (#27167167)
> It turns out that even if you accept "Python is great and JavaScript sucks" that "Python compiled to JavaScript" ends up even worse than JavaScript.

Clearly, there are people that disagree with this value judgement, and the existence of that disagreement is an existence proof that Python for frontend is, in fact, a choice people can make, even if it is one you find unattractive.

Re:Modern Javascript: Everything you missed over the last 10... by esrauch on Saturday May 15, 2021 @01:44PM (#27167289)
I also have gotten DMs on Reddit from companies looking for devs since I commented on a thread 10 years ago about an obscure toy language: it doesn't mean thats a reasonable choice for technology.

I think theres legitimate reasons to compile Python to JS, but "JS is bad" can't be one of them, since you still have JS that you have to worry about. It makes sense for codesharing with server code or preexisting business logic.

Over the years I've debugged js compiled from various languages, and it's seriously a terrible experience: however bad you think debugging handwritten js is, reading and debugging generated js is strictly worse (and you will have to)

Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @01:57PM (#27167393)
> however crazy you think handwritten js is, generated js is just obviously worse to try to read (and you will have to)

Or...maybe I won’t; I’ve used plenty of compile-to-JS languages (including what starts as “js” with JSX and modern features but gets compiled to plain, and more widely supported, JS), and I spend as much time reading and debugging JS in its compiled form as I do reading and and debugging .NET or Python bytecode instead of source, which is none.

Re:Modern Javascript: Everything you missed over the last 10... by ad404b8a372f2b9 on Saturday May 15, 2021 @01:04PM (#27166934)
That's not a solution if you end up with Javascript in the end. (Also Dash is absolutely terrible, horrible documentation, horrible code.)
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @01:27PM (#27167127)
> That's not a solution if you end up with Javascript in the end. (

It is, just as using compile-to-(or interpreted-by-a-runtime-in-)-native-code languages is a solution to “I don’t like raw x86_64 machine code for desktop applications”, even if you end up running machine code in the end.

> Also Dash is absolutely terrible, horrible documentation, horrible code.

“X is not a choice people can make” is a different claim than “One example of X is not something I personally would recommend”.

Re:Modern Javascript: Everything you missed over the last 10... by ad404b8a372f2b9 on Saturday May 15, 2021 @04:45PM (#27168850)
The issue is that writing code that goes through a JS-transpiler is more complicated than just writing Javascript, unless the language you choose is Javascript-adjacent, whereas writing code that compiles to machine code is infinitely less complicated than just writing machine code.

As to your second point, that's why I put it in parentheses, of course it doesn't refute your claim but if you use as example a technology that has awful documentation because of this two-language paradigm, and leads to garbage code both at the Python stage and the Javascript stage, to me it doesn't paint a good picture of the whole concept.

Re:Modern Javascript: Everything you missed over the last 10... by vbsteven on Saturday May 15, 2021 @01:13PM (#27166995)
Why is that not a solution? The concept of compiling/transpiling a language into the target language for the runtime is everywhere.

Even native languages like C/C++/Rust compile their language into binary format that the platform can run. It just so happens that the web runtime format is JS instead of binary machine instructions.

Re:Modern Javascript: Everything you missed over the last 10... by HideousKojima on Saturday May 15, 2021 @01:22PM (#27167082)
Because debugging your transpiled JavaScript becomes a nightmare in a language you already hate
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @01:40PM (#27167254)
> Because debugging your transpiled JavaScript becomes a nightmare in a language you already hate

That’s what sourcemaps are for; you don’t have to debug compiled instead of source format on the web just like you don't on other platforms.

Re:Modern Javascript: Everything you missed over the last 10... by ptx on Saturday May 15, 2021 @07:34PM (#27169918)
IDOM looks a lot like what I had been thinking of implementing, but with the additional benefit of actually existing. :) Thanks for the pointer!
Re:Modern Javascript: Everything you missed over the last 10... by tshaddox on Saturday May 15, 2021 @12:52PM (#27166827)
Can’t easily write Django code in JavaScript either. In general it’s not like working programmers get to choose any programming language whatsoever for the hardware and platform they’re writing software for.
Re:Modern Javascript: Everything you missed over the last 10... by pessimizer on Saturday May 15, 2021 @01:21PM (#27167077)
You don't have to use Django (you can choose one of the billion alternative CMSes), but everyone has to use a browser. Hell, Django itself has to write javascript.
Re:Modern Javascript: Everything you missed over the last 10... by sirsinsalot on Saturday May 15, 2021 @02:30PM (#27167672)
Django is not a CMS
Re:Modern Javascript: Everything you missed over the last 10... by ironmagma on Saturday May 15, 2021 @12:55PM (#27166853)
There are a wealth of alternatives though... ClojureScript, Elm, ReasonML, and Purescript just to name a few.
Re:Modern Javascript: Everything you missed over the last 10... by aphextron on Saturday May 15, 2021 @12:32PM (#27166646)
>If people didn’t like JavaScript for front end work, it’s not like they could just switch to python

Sure you could. You can develop for the web in practically any language you like these days. People use JavaScript because it has native support for the DOM that nothing else can match. Until we get away from the DOM for application development, it will always be king.

Re:Modern Javascript: Everything you missed over the last 10... by magila on Saturday May 15, 2021 @12:41PM (#27166727)
That has nothing to do with Javascript's merits as a language though. It's simply the only language browsers expose the DOM to natively.
Re:Modern Javascript: Everything you missed over the last 10... by aphextron on Saturday May 15, 2021 @12:45PM (#27166761)
>That has nothing to do with Javascript's merits as a language though.

Sure it does. DOM support is built into the very core of JS as a language, and that has shaped the entire history of its' development and subsequent API choices. It's not just a library that it happens to support, the way it would be with any other language.

Re:Modern Javascript: Everything you missed over the last 10... by roofwellhams on Saturday May 15, 2021 @12:39PM (#27166714)
Try to debug that nightmare. Usually you'll need to debug compiled code.
Re:Modern Javascript: Everything you missed over the last 10... by gentleman11 on Saturday May 15, 2021 @02:28PM (#27167651)
Do sourcemaps not help? I’m not experienced with python to js, but they help with minified js
Re:Modern Javascript: Everything you missed over the last 10... by austincheney on Sunday May 16, 2021 @05:12PM (#27177047)
Yes, the language is sloppy. Like all things sloppy it’s more about knowing what not to do only after which the elegance is exposed.

That said, unfortunately, the language is much better expressing personal projects than picking up the trash in an untrained corporate environment like an over paid janitor.

Re:Modern Javascript: Everything you missed over the last 10... by nsonha on Saturday May 15, 2021 @12:29PM (#27166624)
Example of inconsistencies? comparing to what? If you're gonna cherry pick some outdated es5 to make that point, dont bother.
Re:Modern Javascript: Everything you missed over the last 10... by makapuf on Saturday May 15, 2021 @01:01PM (#27166913)
Iterating over an object keys, an array or a map?
Re:Modern Javascript: Everything you missed over the last 10... by frankenst1 on Saturday May 15, 2021 @06:01PM (#27169419)

    let obj = {a:1},
        arr = [1], 
        map = new Map().set("a",1);    

    // Iterating over an object keys
    for (let x of Object.keys(obj)) {...}

    // an array
    for (let x of arr) {...}

    // or a map?
    for (let x of map) {...}
Re:Modern Javascript: Everything you missed over the last 10... by kingdomcome50 on Saturday May 15, 2021 @01:18PM (#27167034)
I would expect, given you have described an operation on 3 different data structures using different words, that it would also demand 3 different kinds of syntax/denotation no? Your own language requires as much. Why not JS?
Re:Modern Javascript: Everything you missed over the last 10... by makapuf on Saturday May 15, 2021 @02:03PM (#27167445)
Well in python by example you use for x in myobject to iterate and that's it, no Object.entries(myobj) vs. mymap.entries , lua is even more consistent, ..
Re:Modern Javascript: Everything you missed over the last 10... by nsonha on Saturday May 15, 2021 @09:46PM (#27170525)
Hey what about map and comprehension? This is a language that claims to value "one way to do things"
Re:Modern Javascript: Everything you missed over the last 10... by stevula on Saturday May 15, 2021 @07:17PM (#27169822)
It’s not uncommon in Python to iterate through dict.items() (or dict.keys()) which is basically the same thing.