I'm curious what the alternative would be? Python's threads/sub-processing almost requires IO queues to function well, and are nearly the same semantically as channels...
I'm not saying these are "good", just wondering what alternatives look like?
One alternative is STM, software transactional memory which is modular and composable. I think Haskell was first to implement it but its also in Clojure and some Scala libs.
This is what ZIO's type safe version looks like https://zio.dev/reference/stm/ Scala's for-comprehension is syntactic sugar for calls to flatMap, map, and withFilter, similar to Haskell's do-notation.
Using document.addEventListener means it will work even if the DOM is updated without having to add new event listeners. If I'm not expecting the DOM to change I would be more inclined to do something like:
document.querySelectorAll('.menu-wrapper')).forEach(menuWrapper => {
const button = menuWrapper.querySelector('.menu-opener');
const content = menuWrapper.querySelector('.menu-content');
if (!content || !button) {
return;
}
button.addEventListener(() => {
button.setAttribute('aria-expanded', 'true');
menu.showPopover();
});
content.addEventListener('toggle', e => {
// reset back to aria-expanded=false on close
if (e.newState == 'closed') {
button.setAttribute('aria-expanded', 'false');
}
});
});
The React example seems a little odd as well, if the "open" callback actually called "showPopover()" instead of only calling "setIsOpen" then the "useEffect" could be entirely redundant. The resulting code would be a lot clearer imo.
> it will work even if the DOM is updated without having to add new event listeners
Nailed it.
And the sibling comment got at it but the "magic phrase" to Google for this technique is "event delegation." Two more phrases: delegation relies on "event bubbling," bubbling can be interrupted with "event capturing." (You will rarely want to capture events, it's JS's `!important` equivalent)
I don't recall the exact numbers but I had a very similar experience, scoring very highly on spatial reasoning almost to the detriment of everything else.
I remember a close friend getting frustrated administering a working memory test on me. She couldn't believe how far removed from the norm my working memory capacity was given everything else she knew about me.
I'm not sure that's entirely true in the UK. The Polish plumber taking British jobs is a fairly common trope in far-right discourse. I believe this is prevalent across Western Europe in general.
I’m not convinced that the adherents of the UK and Western European far-right count Polish people as white, despite the typical Polish skin color. This is like how Italian and Irish people were often not considered white in the late 19th and early 20th century in the US, and probably in the UK too although I’m less familiar with that.
English people are generally not racist like Americans and don’t perceive the world in terms of a set of racial divisions. We are Island xenophobes, like Japanese people. There is us and then there is everybody else. Western Europeans get a pass because they are rich.
I do not think people in the UK care about where immigrants are from, they care about whether they compete with them for jobs. This is why some groups of people wanted less EU immigration (predominantly unskilled) and more skilled immigration, and professional people almost universally want EU immigration and oppose post Brexit policies that have allowed more highly skilled immigration.
This doesn't mean anything. It's either about skin color or not. If they have another criteria by which they decided that us Eastern Europeans are subhuman, then they don't have a problem with brown people, they have a problem with us.
I think that was true 10 years ago, but now it seems to have evened off a bit. Generally speaking (in my circles and the circles I see around me with family etc) there’s an acceptance of the “polish plumber” as a hard working person getting by these days.
This happens to each race in turn. First they're brown people coming to steal our jobs, then they're hard workers and some other race is stealing our jobs, then they're white or white-equivalent.
It's likely down to the fact that once the proverbial Polish Plumbers left, a lot of people realized that there's nobody here who actually wants to do that work, no matter the price. So we have no nurses, we have no truck drivers, we have no electricians. And the list goes on.
And it's impossible to import these people anymore, because a) the wages in the UK are low - lower than in most of the EU and much lower than in the US, and b) many of these professions are not really classified as high skill, even if they take a lot of practice.
I live in a smaller city in the UK so my experience is likely much different from those living in larger cities.
I never wear a helmet when riding a bike and used to commute daily. I've never had an accident involving traffic and have come off my bike less than a handful of times commuting. It seems like the odds of me coming off my bike and hitting my head is very low.
I'm not averse to helmets I just don't think wearing one makes sense for my commute. I'd rather wear a woolen hat. I do wear a helmet when I go rock climbing and would probably wear one if I was commuting in London.