JavaScript is everywhere. JavaScript got better during the last years, but some things are still inconvenient.
Abondoned: I think WebAssembly will gain traction and JavaScript usage will decrease. That's why I think it does not make sense any more to fix fundamental flaws in JavaScript.
The rest of this text is left for the curious reader.
For other things which I think need an agreement/spec/ see Missing Internet Specs
Goal: fix the flaws by influencing future specification.
Before fixing the flaws consensus is needed.
The transition to the cleaned up version could be done to improve the strict mode
Before consensus can be reached, the flaws need to be written down.
Everything which can be done simpler or more obivious is a flaw.
If unsure, the Zen of Python is a good general guideline.
Of course there is no single truth. Agreement need to be found by discussing and maybe voting.
Just for fun I keep a list of synomys for "flaw" which I saw while discussing how to fix JS:
- JS baggage ("if you want to see what a version of TypeScript without JS baggage looks like, check out static TypeScript")
- horribleness ("I suspect someone out there has documented all of JavaScript's horribleness.")
- terribleness ("For example, JS equality terribleness will never be fixed by TS, and there is a laundry list of things like that which will never be fixed.")
But let's focus on the way we want it to be.
Please tell me what you think:
- Which flaws does JS have?
- Why do you prefer a different language? What could be added to JS to make it more attractive?
- Why did you avoid JS in the past? Please provide feedback!
Let's influence the future together :-)
Don't wait for others or projects like TypeScript to fix this. There are fundamental issues, which can't be solved in TypeScript, Polyfill, Shim, WebAssembly, ...
Please create a new issue and tell us how you would like JS to look like in the future: https://github.com/guettli/lets-fix-js/issues/new
"Equality is one of the most initially confusing aspects of JavaScript." Source: http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html
If it is confusing, then it is not obvious. This is a flaw.
It is way to complicated to check if a dictionary is empty:
Object.keys(obj).length === 0;
Above solution is from How do I test for an empty JavaScript object?
https://stackoverflow.com/questions/48802728/how-to-marshal-json-with-bigints
Works in Python
import json
>>> json.dumps(json.loads('{"NETWORK_ID": 6000370005980500000071}'))
'{"NETWORK_ID": 6000370005980500000071}'
There thousand ways to work around it. Very common is base64 encoding. But that's a useless work-around.
In Python you can create binary data with the "b" prefix. Example:
binary_data = b'\x00\xff....'
It would be nice to support it.
Other tools which support this:
A timedelta datatype would be very nice.
Other tools which support this:
Quoting @asb:
Leave comments is essential for human beings understand what is going up. Is the best practice in any programming language. Is kind and nice for all who will study what is done. Every one knows that JSON was, -was- a encapsuled internal way to exchange data in javascript but now JSON is used do describe the data for all world. So, please make // into comments for JSON, let the spice flow.
Why HCL (HashiCorp Configuration Language) was invented:
JSON ... is fairly verbose and most importantly doesn't support comments.
Source: https://github.com/hashicorp/hcl
- @orta at https://gitter.im/Microsoft/TypeScript
- @MicahZoltu at https://gitter.im/Microsoft/TypeScript
- @agsb issue #1