1,791 karma · joined October 27, 2012
addEventListener is possibly the worst organically grown API I've seen in a long time. If anything, its sordid history should be a lesson to the Chrome dev team that fucking around with proprietary extensions (which this most definitely is) just leads to future technical debt and pain for everyone. Why do they never learn?
As an example: To this day I have no idea what media formats are supported by AVAudioPlayer on iOS[2]. The documentation's links (Cmd+F "iOS Hardware and Software Audio Codecs") have been broken for so long that not even the Wayback Machine has a copy. And Googling for the same information only gives me Stack Overflow answers that references the same broken link. I suspect at this point not even Apple knows what formats their own audio framework is capable of playing.
[1]: https://yuiblog.com/blog/2006/10/20/video-crockford-domtheor...
[2]: https://developer.apple.com/documentation/avfoundation/avaud...
Opinionated: React is a library written for a language that is not JavaScript (the first prototype was written in OCaml). It demands immutability, which JS has no native support for. it wants you to use FP, but JS natively has little support for FP both in its standard library and syntax. FP only looks good in JS if you've never used a real FP language.
DSL: JSX is a DSL - I can't remember the last time I've seen someone use && as a poor man's if statement, or ternary statements dozens of lines long until I started writing JSX. JSX is neither idiomatic JavaScript nor HTML.
Fast: Performance benchmarks (which admitted are flawed as they can't capture real-world usage) show that React and Vue have similar rendering speeds. Vue's computed property dependency tracing means that a lot of the performance optimizations which require manual work to enable in React (manually memoize expensive computation, shouldComponentUpdate, PureComponent etc.) are handled automatically by the framework.
Of course it also means you can't upgrade React without upgrading Flow, and you can't target a specific (older) version of React without downgrading Flow.
- Saying the error messages are "not intuitive" is a bit of an understatement. Most memorably, this was an actual message I was presented with after upgrading to Flow v0.53 - https://imgur.com/UseQxEz.png
- Flow's goal appears to be ensuring correctness rather than being useful. Object.value produces an array of mixed, effectively erasing their type (https://github.com/facebook/flow/issues/2174). document.body is a Maybe (https://github.com/facebook/flow/issues/4783). All use of getters and setters are marked as unsafe, with no way to selectively opt in or out (https://github.com/facebook/flow/issues/2826). These are pedantic to the point of uselessness.
- When a function call's parameter type disagrees with the function signature, Flow flips a coin and marks one of them as incorrect. GitHub issue from Oct 2016 - https://github.com/facebook/flow/issues/2587 (issue is closed because they're 'working on it', not because it's actually resolved)
- Flow's libdef is a fraction of TypeScript's. I frequently convert TypeScript libdefs to Flow libdefs. I have yet to see a library that has Flow libdef but not TypeScript libdefs.
At least Microsoft has the good grace to put up free VMs for browser testing - https://developer.microsoft.com/en-us/microsoft-edge/tools/v...
<a href="...">Link 1</a> |
<a href="...">Link 2</a> |
<a href="...">Link 3</a>
It's not Link 1 | Link 2 | Link 3
as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace.Here's another -
<dl>
{ Object.entries(definitions).map(([term, definition]) => (
<dt>{ term }</dt>
<dd>{ definition }</dd>
)}
</dl>
This does not work - instead, you need to return an array, but the result is ugly - the commas are part of JS, not HTML, and don't appear in the output, but reading this quickly it's hard to see that (the difference is the braces surrounding the block). <dl>
{ Object.entries(definitions).map(([term, definition]) => ([
<dt>{ term }</dt>,
<dd>{ definition }</dd>,
])}
</dl>
Vue's 'weird DSL' is HTML (the same is not quite true for Angular's). What you see is exactly what you get. Having a DSL also means you can define your own syntax. Things that are verbose (due to historical reasons in JS), such as iterating over an object, can be made simple - <dl>
<template v-for="(definition, term) in definitions">
<dt>{{ term }}</dt>
<dd>{{ definition }}</dd>
</template>
</dl> arr[3] = 'New content';
Updating an array element immutably arr = arr.map((element, index) => {
if (index === 3) return 'New content';
return element;
});
It's possible, sure, but it feels terrible. JavaScript objects want to be mutated - it's the most idiomatic way of interacting with them. Whether functional programming paradigm is good (I certainly feel it is) is beside the point - JS wasn't designed for it.When I think of immutable primitives, I think of Python's tuples, which will raise a big fat error when you try to mutate them, or even better, Swift's structs, which gives you a new copy with every mutation.
I know because I reviewed this library (https://github.com/VincentGarreau/particles.js) when a colleague wanted to add something similar to our site. The problem is it uses a naive O(n^2) algorithm for linking up particles when they get near each other, which wastes a lot of CPU cycles.
Running this script with a large number of particles and auto-linking on is ill-advised - but fortunately you can delete the <canvas> element quite easily to stop the script.
It's also possible to export any Flash movie as a standalone executable with the Flash runtime baked in. This should be immune to any sort of deprecation. Of course this relies on the developer who holds the original source file to do the exporting.
Laravel can act as the API backend to the frontend (basically a set of REST endpoints that the frontend can talk to), or alternatively the Vue components are used only where heavy client-side interactions are required, while the rest of the pages are still served up by Laravel normally.
It is not legal, no. Travel on railway and plane and booking hotels all require you to present your ID, as is signing up for a mobile phone.
There is a vast difference between the government banning you and reddit banning you (which they are not actually doing here, but for the sake of argument).
You have the right to free expression. You do not have the right to free expression on someone else's platform. reddit is not the Internet - if reddit does not like what you say, you can set up your own space on the Internet. If the government does not like what you say, then there is literally no legal alternative. That's the difference.
Oh, and stop confusing net neutrality with this issue. It's not the same.
1. It keeps the tech industry domestic
2. The servers are physically inside China, guaranteeing them access to the data
This is why I've always thought that the Great Firewall's purpose is not only censorship, but also a form of Internet-age protectionism.
And if I scroll down a bit more you'll find a web worker spawned by the same page consuming another 120MB of RAM. This is a lot of stuff happening on what is suppose to be just a news article.