I decided to learn a bit of React again for some toy projects (my day job JS framework is Angular). Most of the tutorials for setting up a React project "from scratch" ultimately result in using the create-react-app library to hide a lot of the complexity (transpilers, bundlers), but I'm not interested in Webpack or Babel - primarily because I know browsers don't need them anymore. Also, I like to learn about how the bits and bobs work together for small projects like this. Here are the 3 things I want: Typescript, JSX, and compile/deploy to ES modules. Can this actually be done? Yes, and it's not that difficult.
Read the rest of this entry ...The elder days of my blog are littered with useless musings on XML and JSON. So why not throw another one on the pile? 🙂
I wish JSON supported:
- Multi-line strings (but no string interpolation)
- Trailing commas (in arrays and object property lists)
- Comments
Of course none of these will probably ever happen, but having any of these three would keep JSON wonderfully simple but vastly improve the user experience of those who have to hand-tweak JSON files (which is a lot of people!). I kept these feature requests to only things supported by ECMAScript itself. I also note that several parsers seem to accept JSON with #2 and #3.
YAML has all these, but of course it has many other features that, I assume, make it burdensome to write a fully compliant parser.
[Update Jan 2023: I finally filed a bug on VS Code for this idea of back-ticked string support in their tasks.json. Maybe it's crazy, I haven't decided... but feel free to vote it up!]
The esteemed Dr. Axel Rauschmayer has written a blog post about a new proposal for JavaScript: Types as Comments. It definitely has got me thinking.
On the one hand, I'm a huge fan of JavaScript evolution over the last decade or so. Arrow functions, const/var, classes, modules - that's all good stuff that has improved the language.
Seemingly on the same side of this argument: I'm also a huge fan of Typescript. It changed how I do large-scale frontend development four or so years ago - static typing in a language helps me write clear code, catches a huge number of bugs at compile-time, and the tooling and overall ecosystem around it is top-notch. Kudos to Microsoft on this one.
But I'm not convinced the value of this proposal nets out positive. The proposal itself says that the primary motivation is to inch JavaScript evolution towards eventually supporting static types:
Does JavaScript need static type-checking?
"Given how much effort organizations and teams have put into building type-checkers and adopting them, the answer is yes."
Why?
You have to accept that JavaScript is the language of the runtime. We shouldn't be caring about types at runtime - that's the job of the toolchain prior to deploying. That's the way every other language works (feel free to tell me how wrong I am in the comments - I am no language expert!).
Static typing only helps developers, not users.
Think about it this way: what level of performance degradation are you willing to accept for full support of static types? Is it ok for the JavaScript parser and runtime to be 5% slower for every web page or 15% larger in code size? Of course I'm pulling these numbers out of my ass.
When I was first fanboying out on TS, I used to think "gee, wouldn't it be really cool for browsers to support Typescript natively". Wouldn't that be an awesome way to learn and view source, etc. But you know what's good for that instead? Super-fast and small JavaScript for best performance and if you want to share your developer brilliance, have an optional compile-mode and source maps that point to your awesome Typescript.
Another thing I don't like about the proposal is that, while they are clearly heavily influenced by Typescript, they hedge:
How does this proposal relate to TypeScript?
"This proposal is a balancing act: trying to be as TypeScript compatible as possible while still allowing other type systems"
You are JavaScript - if you are adamant about eventually supporting static types, why not boldly point towards a "north star" of a language that has already proven itself? Is it that you don't want to admit Typescript won? Is it lingering anti-Microsoft bias?
My opinion: If we are going to add static typing for web apps, we should just use Typescript as a new script type. <script type="application/x-typescript"> seems a better option to me so that the browser can choose an appropriate parser, etc.
I was thinking of setting up a bug tracker for a personal project that might have random users. I'd like to have a way for users to report bugs with as little friction as possible, but with something more than an email or a post on a mailing list. Basically a link I can send a user to. Github? Jira? Something better? Are there any good issue trackers that allow multiple identity systems?
How's everybody doing? My work-from-home setup involves a Macbook Pro, a CalDigit TS3+ dock, two external displays (one in portrait, one in landscape), and a couple other peripherals. Since getting the TS3+, I've noticed that OSX screws up the orientation of the external displays ~50% of the time. This inevitably results in me furiously tilting my head sideways while I try to maneuver the mouse pointer onto the Mac Display preferences for that display and fix it before my first meeting of the day starts.
I found a Stack Overflow solution that works for me. I downloaded the free Display Rotation Menu tool from Mage Software and now I can just click and change the orientation from the system menu. Should be part of the OS in these WFH days!