1,606 karma · joined November 12, 2012
There are a few Web APIs which work this way — for example, you can’t make a page fullscreen unless you do so in response to user input/interaction [0].
[0]: https://developer.mozilla.org/en-US/docs/Web/API/Element/req...
Out of interest, is there a page anywhere explaining the difference between RustEnhanced and Sublime-LSP + Rust Analyzer? I’ve got both installed, but when I enable Sublime-LSP + RustAnalyzer the experience and functionality is different enough that I assumed it was overriding RustEnhanced.
If you’re using Sublime Text 3, it’s essentially an alternative to RustEnhanced[0].
Edit: Not to mention that the onerror event handler on the <img> tag has always been able to find out if an image didn’t display [2].
[0] https://html.spec.whatwg.org/multipage/media.html#dom-naviga...
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_ne...
[2] https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageEl...
Wouldn’t using the <picture> element[0] allow this this? It’s pretty widely supported (every browser that supports WebP and Safari)[1] and allows a fallback to a JPEG in an <img> tag.
[0] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pi...
1. A not insignificant number of packages are either polyfilling things in browsers, or providing a consistent (or ‘isomorphic') API for certain things across both browsers and Node.js, or adding things that should have been in a standard library.
2. A lot of packages still seem to be distributed primarily as CommonJS and not ES Modules. CommonJS makes tree-shaking harder than it should, so it was often just easier to break what should have been a single library into many smaller pieces.
Hopefully in the not too distant future library maintainers get around to reading the Node.js docs[0] fix some of this.
[0] https://www.amazon.com.au/Bob-Woolmers-Art-Science-Cricket/d...
Sure, Australia Post is one of Australia’s oldest institutions if you count from the date of the establishment of its oldest predecessor (which this map does, as a Postmaster-General was first appointed for New South Wales in 1809), but a single national postal service wasn’t established until Australia itself was established in 1901 and the colonial postal services were merged, and even then it was a government department until 1975, and wasn’t corporatised until 1989 and remains government-owned to this day.
I didn’t link to MyFireWatch precisely because it is showing ‘hotspots’ from the past 72 hours, which is not necessarily the same thing as mapping actual reported fires, hence the confusion of some of the maps talked about in the article. The data on MyFireWatch on areas which have burned is also very inaccurate for some states (Tasmania and Victoria at least).
MyFireWatch explicitly says not to use their map in an emergency[0], because the ‘latest’ hotspot data can be up to four hours old, can be up to 2km out of place (5km in extremes), and may not show fires obscured from or otherwise undetectable from the satellite.
New South Wales: https://www.rfs.nsw.gov.au/fire-information/fires-near-me
Northern Territory: https://www.pfes.nt.gov.au/incidentmap/
Queensland: https://www.ruralfire.qld.gov.au/map/Pages/default.aspx
South Australia: https://www.cfs.sa.gov.au/site/home.jsp
Tasmania: http://www.fire.tas.gov.au/Show?pageId=colGMapBushfires
Victoria: https://www.emergency.vic.gov.au/respond/
Western Australia: https://www.emergency.wa.gov.au
[0] https://en.wikipedia.org/wiki/Ö#In_English, https://en.wikipedia.org/wiki/Diaeresis_(diacritic)#English
I’m aware that “condescendiente” doesn’t mean “condescending”, but I’m taking it as evidence that Google Translate interpreted “patronize” with the “to condescend” sense rather than the “to sponsor or support” sense, meaning that word-sense disambiguation works better in those instances.
"Don't patronise me.” -> "No me patrocines.”
“Don’t patronize me.” -> "No me patrocines.”
"Don't patronise me!” -> "¡No me patrocines!”
“Don’t patronize me!” -> "¡No me patrocines!”
"Do not patronise me.” -> "No me patrocines.”
"Do not patronize me.” -> "No seas condescendiente conmigo.”
“Do not patronise me!” -> "¡No me patrocines!”
"Do not patronize me!” -> "No seas condescendiente conmigo.”
Word-sense disambiguation seems to work if you write “do not” instead of “don’t” and use ‘-ize' spelling, it fails otherwise.
That translation is pretty accurate for at least one of the senses of patronise, though. Word-sense disambiguation is what’s failing Google Translate in that case.
Otherwise, Node.js can do exactly what you just said Python and MS Basic can do.
I can’t find the link which details this right now, but I believe there are/were some cases where Flow’s syntax isn’t strictly a superset of JavaScript (to do with generics and comparison operators). I’m not sure whether TypeScript has the same problem or not.
Still, when having to do things with JS/Python/C++ I’ve wasted many afternoons down the rabbit hole of trying to glean information from Github Issues, stackoverflow answers, Twitter threads and obscure forum threads — usually to find the problem (and fix) I ran into was so trivial it could have been a single line in an error message. (I feel like a lot of JS tools - particularly Webpack, Jest and Babel - have regressed a fair bit recently in this regard. Python just fails silently (or bizarrely) too often and C/C++ compiler error messages are often less readable than the code itself.)
The book keeping could be moved into a couple of utility functions - it’d be largely the same for most custom hooks.
I’m also not sure relying on a linter is necessarily going to make static call Hooks simpler. Poorly written hooks are going to be buggy whether they’re Symbol keyed or not. I think that one of the big disadvantages of static call Hooks would seem to be that incorrect conditional usage could still accidentally work.
> My post does mention that we care about copy paste experience
I think I misunderstood that section when I first read it - it makes sense now. I’m not convinced it’s a huge win though.
> I later go into why allowing conditional declarations of state or effects isn’t even particularly useful or desirable because the semantics are too confusing.
We’ll have to agree to disagree - while I’m not eagerly wanting to use Hooks in conditionals, I dont think the semantics are that confusing.
> A key design goal is that creating a custom Hook is easy. You should be able to literally copy paste part of your component (e.g. a bunch of useState calls and some event handlers) and call it a day.
I'd totally understand that reasoning, because the keyed Hooks are more verbose and would generally require two or three parts of a component to be copy-pasted – but the examples under Flaws #3 and #5 didn't make this clear (to me at least), and I hadn’t seen ‘ease of custom Hook implementation’ cited as an argument against keyed hooks before.
I’m really just playing devil’s advocate here, because in my playing around with Hooks I haven’t yet found a case where keyed Hooks are necessary, but I have accidentally put calls to useState() inside a conditional a heap of times.
Edit: Flaw #5, not #7
I would’ve used a WeakMap with Symbol keys that mapped to a list or object containing Symbols.
Sorry if I’m just overlooking something obvious, but most of the examples that I’ve seen to explain why Symbol keys aren’t better than the current proposal seem to be just be examples of badly implemented custom hooks, not necessarily flaws with Symbol keys per se.