DEV Community

Cover image for JS Dialect Rant
Joey Mink
Joey Mink

Posted on

JS Dialect Rant

I spent a lot of time at my last job writing JavaScript. We had a set version of node, we had our dependencies more-or-less steady, and we put our heads down and coded. I left feeling like I knew JavaScript! Wheee!

Then I got started with React at my next job. Cool sh*t, no doubt. But ES5 components led to ES6 class-based components. When I tried to consume that ES6 code I would get invalid keyword errors on things like class and import. Huh? transpile it with Babel! Oh, okay...

Then I got into mobx (<- totes dig it!), with all it's decorators and what not (oh Java, I do miss you a little). But when I tried to run that code, I'd get errors about @ being totally uncool. Babel to the rescue!

stage-0, stage-1, transform-decorators-legacy, ...

Woah. WTF language am I writing in now? Some quick duckduckgoes imply that I'm using proposed JavaScript syntax that hasn't even been approved yet. When I look at the code running in the browser, it's all translated into, what I think is, ES5 (which is also es2015?). Okay, enough trivia, there's work to do! It's transpiling successfully? Good, head down...

Anyhoo, I ðŸ’‒ the functional programming experience JavaScript continues to offer, and I love that the code is so portable in this browser/electron world. But seriously, you need a guru to fully understand:

  1. the state of the JS language
  2. the dialect you're writing in
  3. the translations that babel is performing (and how to configure it)
  4. interpreting the translation when debugging at runtime

Wowzers. I write JS, you may write JS, but I bet yours and mine look a helluvalot different. And I bet my code can't be pasted into your codebase without syntax errors. And to me, that's just kinda like ... woah.

Top comments (0)