HNHacker News
TopNewBestAskShowJobs

jasonhansel

9,140 karma · joined February 2, 2015

Website: https://jasonhansel.com
submissionscomments
jasonhansel··on Lies we tell ourselves to keep using Golang
> No, methods nil receivers in Go don't trigger panics (if they are not dereferenced).

Yes, but in practice most methods do dereference their receivers. Given that, you have two choices:

1. Check for nil receivers explicitly in every method. This is considered unidiomatic and libraries rarely do this.

2. Don't check for nil receivers, and have your method panic on the first dereference with no explicit check. Then, most of your methods can halt partway through in unexpected (and usually undocumented) ways, unless you pay very close attention to this failure mode.

Furthermore, such panics can occur far down the call stack, making it non-obvious from the stack trace where the error is.

Also, this means that, if you upgrade your library so that a method now dereferences its receiver, your library is suddenly no longer backwards-compatible.

jasonhansel··on Lies we tell ourselves to keep using Golang
Something that annoys me:

- Go's approach to normal error handling assumes that correctness and proper error handling are paramount: every error must be handled explicitly, and every control flow path must be made obvious, no matter how much verbosity this creates.

- Go's approach to panic handling assumes that correctness and proper error handling don't matter: a function can halt at any given point, panics are easy to trigger by accident (e.g. methods with nil receivers), handling them explicitly is usually discouraged, and they tend to leave values in intermediate and unexpected states (unless you use "defer" very carefully and consistently).

Rust partially resolves this issue by preventing many causes of panics, by using methods like "lock poisoning" to avoid leaving shared values in unexpected states, and by having proper destructors.

Go's approach (just crash everything) makes it easy for one error to completely bring down an application. Handling panics leads to values being left in inconsistent states with operations half-completed.

jasonhansel··on Is infinity an odd or even number? (2011)
Aristotle figured this out first: the "potentially infinite" exists, but the "actually infinite" does not.
jasonhansel··on Why T-shaped people? (2018)
I wish that these sorts of articles were written based on statistical or experimental evidence, rather than just anecdotes and intuition.
jasonhansel··on What happens when babies are left to cry it out?
> It is very much possible to co-sleep and then gradually transition them to their own bed.

Isn't co-sleeping (as in bed-sharing) discouraged in the US, at least for newborns, because of the risk of SIDS?

To quote the AAP:

> AAP recommends that parents sleep in the same room – but not in the same bed as a baby, preferably for at least the first six months.

Source: https://www.aap.org/en/news-room/news-releases/aap/2022/amer...

To quote the CDC:

> Sharing a room with your baby is much safer than bed sharing and may decrease the risk of SIDS by as much as 50%.

Source: https://www.cdc.gov/reproductivehealth/features/baby-safe-sl...

From a recent meta-analysis:

> The combined OR for SIDS in all bed sharing versus non-bed sharing infants was 2.89 (95% CI, 1.99-4.18).

Source: https://pubmed.ncbi.nlm.nih.gov/21868032/

jasonhansel··on The Zen anti-interpretation of quantum mechanics (2021)
> OK, but are the quantum states “ontic” (really out in the world), or “epistemic” (only in our heads)?

Scott's answer to this seems like a cop-out. He's basically saying "I can't tell which things are epistemic or ontic, and this all seems very complicated, so I'm going to assume the distinction doesn't exist."

jasonhansel··on All About USB-C: Illegal Adapters
For a while, I've been using a USB-C female to USB-A male adapter to connect my MagSafe charger to various old-school USB wall chargers. Somewhat surprisingly, this works perfectly; the charging speed is probably slower but I haven't noticed.

That said, I'm guessing this violates some specification or other. Ah, well, no explosions yet.

jasonhansel··on Social Security denies disability benefits based on list with jobs from 1977
> they tend not to survive too long.

Usually they try regulatory capture or anti-competitive behavior first.

jasonhansel··on Anti-Capitalist Software License
It specifies in the third clause:

> If the User is an organization with owners, then all owners are workers and all workers are owners with equal equity and/or equal vote.

jasonhansel··on Social Security denies disability benefits based on list with jobs from 1977
Private businesses are just as inefficient and wasteful, as anyone who's worked in a large corporate bureaucracy can attest. It's just that they have very little transparency, so you don't hear about it on the news.
jasonhansel··on 6M Acres of Public Land in the US West Are Corner-Locked
Why is so much of the West still owned by the federal government? This isn't a widespread problem in most of the country.
jasonhansel··on Life Is Short (2016)
Here's my question: why should you care what your future self thinks? Should avoiding future regret really be your primary goal now?

This whole article seems a bit self-centered, in that it suggests you should first and foremost care about how things will affect you in the future, rather than caring about others.

It seems to me like you should spend less time trying to prevent future regret, and more time trying to do right by other people.

jasonhansel··on Eight studies reveal a bias in human imagination
Somewhat counterintuitively, people are often more creative when they have more restrictions in place. Being limited in what you can do can make people more likely to find creative solutions.

I suspect that this is an example. There are a huge number of ways things could be worse, and a far smaller number of ways things could be better. So it may actually be easier to come up with examples from the latter set, since your options are more restricted.

jasonhansel··on California passes law banning Tesla from calling software FSD
I think Elon's biggest problem with mass transit is just that he doesn't like the masses. As he once tweeted:

> I think public transport is painful. It sucks. Why do you want to get on something with a lot of other people[...]And there’s like a bunch of random strangers, one of who might be a serial killer, OK, great.

Not the only problem he cites there (note the "[...]"). But I'm pretty sure there's a reason it's the most prominent.

(Incidentally, given the demographics of those most reliant on mass transit, one wonders why exactly he thinks that they are so likely to be serial killers.)

jasonhansel··on California passes law banning Tesla from calling software FSD
In suburban areas, light rail can work quite well. Although you have to wait longer because of stops, the trains can also move much faster than cars--existing trains are fairly slow, but introducing higher-speed trains would make them competitive with cars.

In rural areas, though, your point stands. For adults traveling alone, though, lightweight electronic vehicles like e-bikes may be better than electric cars.

Ultimately, an "electric car" is like a "horseless carriage"--an attempt to shoehorn a new energy source into an old form factor where it doesn't fit particularly well.

jasonhansel··on Sesame allergen labeling law has unintended effect: sesame in more foods
I'm talking about research, but in particular research testing potential interventions.

There has been a fair amount of research (but no solid consensus) on why allergy rates are increasing.

But AFAIK there have been fairly few attempts to try to use any of those competing hypotheses to devise preventive treatments whose effectiveness could be tested experimentally.

jasonhansel··on Sesame allergen labeling law has unintended effect: sesame in more foods
Unfortunate that we're doing so little to stop the massive increase in food allergy rates that has occurred over the past few decades. Labeling is good, but we should invest in prevention also.
jasonhansel··on iPhone 14 Pro faced 'unprecedented' setback leading to removal of new GPU
One would think that the makers of smartphone chips would be particularly good at and experienced with calculating power draw.
jasonhansel··on Caroline Ellison, CEO of Alameda Research, pleads guilty to seven offences
Some are probably negotiating them now. I'm guessing they arrested SBF so quickly because they got a number of witnesses to testify against him.
jasonhansel··on Bankman-Fried's Shrinking ‘$250M Bond’
> Would you extend a 250M credit to someone who offers you 11.8M in illiquid assets?

Sounds like something SBF would find reasonable.

jasonhansel··on Notes from the Field: Tetanus in an Unvaccinated Child – Oregon, 2017 (2019)
> Despite extensive review of the risks and benefits of tetanus vaccination by physicians, the family declined the second dose of DTaP and any other recommended immunizations.

Wow.

jasonhansel··on FTX founder Sam Bankman-Fried to be released on $250M bail
Also, it's fairly common for someone to initially plead "not guilty," even if they're planning to change their plea to "guilty" later. IIRC if you plead guilty, you can't change it later, so it's usually best to leave your options open.
jasonhansel··on FTX founder Sam Bankman-Fried to be released on $250M bail
If he runs, he can always spin it as a $250 million donation to the government.
jasonhansel··on LastPass user vaults stolen in recent hack
Also: thanks to "forgot my password" features, if someone gets your email password, they can now find and access all your (non-2FA-enabled) accounts.
jasonhansel··on For Want of a JOIN
Escaping.
jasonhansel··on For Want of a JOIN
Interesting! Have you looked at Datalog? In many ways it's the ideal purely relational language.
jasonhansel··on For Want of a JOIN
SQL actually isn't all that transferable, because in practice you almost always use an ORM or a query builder instead of writing queries directly into your codebase. So when switching languages you still need to learn the new language's ORM; your knowledge of the underlying SQL will only go so far.

Of course queries should be human-readable, but there's no need for it to be a complete language with its own grammar and templating via prepared statements. The queries could be encoded in JSON or some similar (probably custom) human-readable language that can easily be generated programmatically. MongoDB does this IIRC; it's probably the only thing I like about Mongo, but it's a good idea.

jasonhansel··on For Want of a JOIN
The issue is that, to put things in 1NF, you need to fully normalize everything, which has a big performance penalty since every query now has to JOIN a large number of tables together.

Of course, an RDBMS could be designed to do that without a performance penalty, by storing data in a denormalized form and automatically translating queries for the normalized data accordingly.

But SQL doesn't have the features you'd need to control and manage that sort of transparent denormalization. So you'd end up having to extend SQL to support it properly so that the performance penalty in question could be mitigated in all cases.

edit: Rather than "you need to fully normalize everything," I should have said "you need to split all your data across multiple tables to eliminate the need for structured data within records." The performance penalty happens when you need to do this everywhere for sufficiently complex datasets.

jasonhansel··on For Want of a JOIN
Those languages all have first-class functions and OOP-style encapsulation.

In SQL stored procedures (at least in Postgres), you can't have a variable that holds multiple records. You can't even define a variable inside of a block.

jasonhansel··on For Want of a JOIN
IIRC in Postgres you need to refresh an entire materialized view all at once, effectively recreating the entire table; you can't just have it update incrementally whenever the underlying data changes.

I think SQL Server can do this, but...then you have to use SQL Server.

← PreviousPage 6 of 34Next →