Readit News logoReadit News
dumbmatter commented on Completing Racket's relicensing effort   blog.racket-lang.org/2019... · Posted by u/samth
dumbmatter · 6 years ago
Two people declined to re-license their contributions to Racket. We therefore removed their contributions and, where appropriate, replaced them with new code and/or documentation.

Is that actually allowed by the GPL? I thought it was more like the "Ship of Theseus" - that even if you eventually replace all the original GPL code, the entire work remains GPLed. https://softwareengineering.stackexchange.com/questions/2603...

dumbmatter commented on Perl is dying   thehftguy.com/2019/10/07/... · Posted by u/user5994461
user5994461 · 6 years ago
>>> The CGI example you mentioned is broken, but is also using a module (CGI.pm) that's been bad and wrong for so long that even Perl, with its eternal love for backwards compatibility has removed it from Perl Core.

The CGI example is straight copy/pasted from the official Perl guide, November 2018. https://www.perl.com/article/perl-and-cgi/

dumbmatter · 6 years ago
...which says

> Warning you probably don’t want to use CGI for modern web development, see Why Not to Use CGI.

dumbmatter commented on Frustrations with React Hooks   blog.logrocket.com/frustr... · Posted by u/efunction
PKop · 6 years ago
What is the use case for re-rendering based on change of DOM ref? (that can't be accomplished by putting some data in state?)

Ref's are basically a 1 to 1 replacement for instance fields for mutable data (that doesn't cause rerenders).

https://reactjs.org/docs/hooks-reference.html#useref

There's always need for escape hatches and maybe I'm missing your use case, but in the context of a discussion about how hooks are more complicated than classes, what were you doing before with refs to solve your "re-render" on change scenario?

Your example was likely contrived, but modifying innerHTML should be replaced by putting whatever in state and simply rendering it. And use state for dependencies where you want to re-run on change. Refs are just another way to keep state but not have it affect render cycle.

dumbmatter · 6 years ago
Stuff like https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-...

If you're not aware of that, it is very tempting to use `useRef`, which is what I have often seen. Before hooks, we did not have the temptingly-named footgun `useRef` for this scenario (although we did have other footguns for other scenarios, and overall I love hooks).

dumbmatter commented on Frustrations with React Hooks   blog.logrocket.com/frustr... · Posted by u/efunction
PKop · 6 years ago
But it's a pretty straightforward rule once you know it right?

This is simply a matter of reading the docs (or making the mistake until you learn). Not an inherently more complex characteristic than, say, Class component lifecycle methods, which also required understanding their rules and reading the docs.

Once you know refs updates won't re-render, you won't make this mistake.

I don't understand why "a thing you need to learn then you're good" is somehow inherently more complicated than ... other apis that you need to also learn.

> but most people think of refs as...

This sounds like Dan Abramov's comment that some of the struggles with hooks is from people who have experience with react without hooks, vs people coming new to the whole thing. So maybe it's about relaxing pre-conceived notions until experience takes over.

dumbmatter · 6 years ago
Tons of shitty "here's how to use hooks for X" articles on Medium make the mistake, so people learning hooks right at the beginning will not be completely immune.

Also that the fix is "instead of using this one kind ref, use another kind of ref and put it in state"... I don't know, like I said I'm not sure if there is a better solution, but it still feels kind of unintuitive and complicated.

Now that I'm thinking about it... what is the reason that DOM refs and other refs need to be handled by the same concept? Every time I make a DOM ref, I'm doing something with it in a hook like useEffect. Why make me jump through hoops to re-run the hook if the DOM ref changes?

(I recognize there are probably good answers to those questions, the React folks are great, I just don't know the answers! Is it just to avoid introducing one more "type of thing", and instead making refs and DOM refs the same "thing"?)

dumbmatter commented on Frustrations with React Hooks   blog.logrocket.com/frustr... · Posted by u/efunction
bcyn · 6 years ago
> For example, this useRef / useEffect combo mystifies me even now: https://stackblitz.com/edit/react-ts-zhvuha

On this particular point, the reasoning is that refs are meant for values that don't need to trigger a rerender[1] -- an escape hatch, rather than something you reach for by default.

In that sandbox, you can accomplish what you mean to accomplish by using state rather than a ref.

[1] https://github.com/facebook/react/issues/14387#issuecomment-...

dumbmatter · 6 years ago
I've seen a ton of people make that mistake, though. I think it's because what you write is accurate - "refs are meant for values that don't need to trigger a rerender" - but most people think of refs (or at least refs of DOM elements, which for many people are the only refs they ever use) as just a way to access a DOM element. They expect it to just be a DOM element in a normal variable.

I'm not sure if there is a less confusing way of doing it, but it's damn confusing.

dumbmatter commented on U.S. to set up plan aimed at allowing prescription drugs from Canada   latimes.com/politics/stor... · Posted by u/ilamont
mrfredward · 6 years ago
Health insurers in most states are subject to a minimum loss ratio that says they must payout 85% of the premiums they take in. Insurers operating near this cap actually have an incentive to pay out more money in order to raise the cap on their profits.
dumbmatter · 6 years ago
I don't think that can explain it, because IIRC that rule has only been around since Obamacare, but the US/world price disparity for prescription drugs has existed much longer than that.
dumbmatter commented on What Happened with West Virginia’s Blockchain Voting Experiment?   slate.com/technology/2019... · Posted by u/randomwalker
acdha · 6 years ago
> The voters can see that their own transaction went through.

How do you prevent vote selling and coercion?

dumbmatter · 6 years ago
At least it'd be no worse than we have now with voting my mail.
dumbmatter commented on Browser Fingerprinting: A Survey   arxiv.org/abs/1905.01051... · Posted by u/Anon84
Ajedi32 · 6 years ago
Is there any reason why we couldn't have all browsers on all platforms use the same user agent header? I realize some sites use the user agent as a crude form of feature detection, but it's my understanding that that's generally considered to be bad practice.
dumbmatter · 6 years ago
Sometimes there are browser bugs that are impossible to do feature detection for, in which case have no better option than looking at the user agent.

For instance, several versions of Firefox had a serious bug in shared workers, which appeared intermittently when users opened your site in multiple tabs https://stackoverflow.com/questions/51092596/feature-detecti... - I had to use the user agent to work around this.

dumbmatter commented on Ask HN: Why does software development suck so much in finance?    · Posted by u/superhater
dumbmatter · 6 years ago
Alternative title: Why does software development suck so much in _______?
dumbmatter commented on Could an Eye Doctor Diagnose Alzheimer’s Before You Have Symptoms?   corporate.dukehealth.org/... · Posted by u/Gys
melling · 6 years ago
Yes, however, finding an early symptom, particularly a decade early, would be an incredible find.

If we could detect pancreatic cancer early, for example, would could go from a 7% survival to 90% rate.

dumbmatter · 6 years ago
And, sadly, if we could detect Alzheimer's a decade early, it would go from a 0% survival rate to a 0% survival rate.

Early detection would still be valuable for other reasons, though.

u/dumbmatter

KarmaCake day263October 1, 2015View Original