HNHacker News
TopNewBestAskShowJobs

laughinghan

2,942 karma · joined August 25, 2010

http://twitter.com/laughinghan

http://github.com/laughinghan

submissionscomments
laughinghan··on Apple Hides Taiwan Flag in Hong Kong
You genuinely believe Tim Cook has more leverage than China?

By what fraction do you think Apple's profits would drop if it had to rebuild all of its factories outside of China? By what fraction do you think China's GDP or tax revenue would drop if it kicked Apple out of China?

Even if that situation were reversed, Tim Cook answers to shareholders via a board of directors. He's legally obligated to maximize shareholder value. Who do you think the Chinese officials who want power over Taiwan answer to? What legal obligations of any kind do you think they are under?

laughinghan··on No evidence that testosterone reduces cognitive empathy
Of course it's not the only 'maleness' that could be tested and analyzed, but the article say it is the one most strongly linked to autism.

> Prior to this work, the strongest evidence for a link between testosterone exposure and reduced cognitive empathy came in 2011 in a study that [...] supported the idea that prenatal testosterone exposure created a more masculinized brain that less readily inferred the emotional state of others. The study was used as support for the “extreme male brain” hypothesis of autism, which contends that autism is an exaggeration of “male” tendencies toward a cognitive style characterized by systemizing over empathizing.

laughinghan··on Ocean plastic waste probably comes from ships, report says
To be fair, that would still be an improvement because we could make them isolate those bags and recycle or burn for energy or something. It is by comparison impossible to control what consumers do with those bags.
laughinghan··on How a double-free bug in WhatsApp turns to remote code execution
Besides, what's the minimum chunk size? Can't be less than the 64-bit word size can it? The chances of a random 8-byte gravestone appearing in legit memory is practically nil. If free() took only 1ns to run and you called it 2^64 times, that would take >500 years.
laughinghan··on How a double-free bug in WhatsApp turns to remote code execution
On the other hand, the chances of an innocent memory block having a random 8-byte magic value is vanishingly small, so that would work even better. If free() took only 1ns to run and you called it 2^64 times, that would take >500 years.
laughinghan··on Life in China Is Getting Harder With High Prices
I actually was careful not to say that I believe that is happening, I said that's what "average people" think.

You asked "if China is really going to collapse, what is in it for average people in the US or other countries?", and I hoped that you were genuinely interested in understanding why there are people in the West who dislike the Chinese government. Does my explanation make sense, and convince you that it's not because they want to "prove democracy correct"?

I am also interested in what you believe is and isn't happening in China and why. The organ harvesting reports are extreme and salacious, and I can see believing the Vocational Training Centers are voluntary, but the others seem obvious and undeniable? Is it not well-known in China that the government bans certain books? Or that social media posts can be taken down on the basis of being too critical of the party?

I'm not entirely sure why you bring up shock therapy. It's true that many countries failed to or suffered when they liberalized their society alongside their economies. It's also true that many countries have done it quite successfully.

laughinghan··on WARP is here
That is a great blogpost! It also explicitly undermines your point:

"My primary hope is that it’s just not a real problem. Certainly there has been very little in the way of speech restriction so far, and what little there has been has been against things which, on the object level, I’m happy to see gone."

> This is literally corporate fascism if done in an extralegal way.

I resolutely and absolutely oppose corporations acting extralegally. But Cloudflare and Voxility have an absolute legal right to not do business with 8chan and Epik if they so choose.

laughinghan··on WARP is here
I have searched and been unable to find anything suggesting this is true. Do you have a citation?

Another reason I don't think this is true is that I also can't find anything suggesting that the content the Christchurch killer posted is illegal (indeed, it has significant newsworthiness and academic value), and 8chan's policy was to allow anything not "illegal in the United States of America" [1] . If it didn't violate 8chan's policies, why did they take down the stream?

[1]: http://web.archive.org/web/20190805065011/https://8ch.net/fa...

laughinghan··on Kik, once valued at $1B, is to be closed
All of tumblr works like that.

Not defending, just contextualizing, and clarifying that NPM didn't make that specific design choice. Obviously, they chose to use tumblr, though.

laughinghan··on WARP is here
I think it's extremely clear that mwcampbell is pointing to being 'headquartered in a single country' as one of the aspects they don't like about a single company having too much power. It's clear they're not advocating more headquarters for companies with too much power, they're advocating more companies each with less power.
laughinghan··on WARP is here
You're right that Facebook was successfully abused by the Christchurch killer, but 8chan was being used by his community as intended, not abused.

To most people, that's why 8chan needed to be shut down, but Facebook only needs to be fixed. Why do you think that's irrelevant, and being small is the only crime?

laughinghan··on WARP is here
You and I have completely inverted ideas of what censorship is and why it is bad.

Using legal tools would be horrific. Government censors deciding what material is too dangerous for the public is exactly one of the elements of fascism.

Private entities on the open market exercising their right to not help promote ideas they object to is a good thing. It means that the more objectionable an idea is, the harder it is to publish and the smaller its reach; and the more in the gray area an idea it is, the easier it is disseminate and the wider its reach. If one of those private entities makes a mistake in judgment, that's an opportunity for a competitor.

Governments have a monopoly on violence. Its power is not kept in check by competitors, but by systems like a bill of rights. Weakening those rights to allow legal tools to control ideas would be disastrous.

Corporations have no responsibility or ability to educate everyone about misinformation. They do have a responsibility not to enable bad people to do bad things, including not promoting ideas they know are dangerous.

laughinghan··on V8 adds support for top-level await
> maybe it only returns a promise on Tuesdays, or at random like some other commenter wrote

But async/await makes this better, because a function marked async always returns a promise.

laughinghan··on V8 adds support for top-level await
> With promises it's the opposite situation, errors will be swallowed unless you explicitly handle the rejection.

Yes, I've been bitten by this too, it's certainly a drawback with the design of Promises. I wouldn't describe it as magic though, since both the implementation and the impetus are easy to understand.

> Actually, it doesn't even have to be `readFile` that changes, it might be a function that it depends on, causing bugs further up the call stack.

I don't think it's possible for readFile to become async without at least some change to it (possibly just adding 'async' and 'await' keywords, but at least some change), except maybe a rare case of a tail call.

> even though it seems everything should be fine

In what way would it seem that everything should be fine? If readFile() were changed from sync to async, wouldn't every single call to readFile() in the entire codebase need to be changed, just like if readFile() were changed from returning a string to returning a File object? It's not like most or even any at all of the calls to readFile() wouldn't need changing, then I could see how it might seem like everything would be fine.

> breaks in a subtle way

But this isn't a subtle bug, it completely breaks as soon as readFile() is changed from sync to async, right? No testing, automated or manual, of this codepath would work at all after the change, right? It's not like a cursory smoke test of this codepath seems to work fine, then I could see how the bug could seem subtle.

> I still keep running into dumb situations like the above. I still keep running into dumb situations like the above

You don't seem like a bad programmer, which is why I'm skeptical of the example you gave.

laughinghan··on V8 adds support for top-level await
I think you missed my point. I understood how you inverted explicit and implicit, you saw me explain that to someone else who asked about Promise.all().

What I'm asking you is, how does anyone, be it the programmer, compiler, or runtime, know whether to block on qux() or not, given that it sometimes synchronously returns 1?

Are you saying that in your proposal, it would become part of the calling convention that any time any function at all returns (and no 'async' keyword was used), the callee would check if a Promise was returned and if so, return a continuation promise?

That is no small runtime cost.

In an untyped language like JS, the cases where static analysis could determine whether a function returns a Promise or not are vanishingly few, probably about the same as the cases where a function can be inlined. Remember, anyone at any point can overwrite Array.prototype.push to be anything they want, including a function that returns a Promise. Any function that takes and calls a callback might be calling an async function. Any math or string operation could be calling .valueOf() or .toString(), which might be async.

laughinghan··on Performance metrics for web apps
This is a great article, walks through a bunch of complications with measuring web performance.

Summary:

1. Use performance.now(), which has 0.1ms resolution and is monotonic, instead of new Date() which has 1ms resolution and can decrease if machine time changes

2. Check for document.hidden and the 'visibilitychange' event

3. Use event.timeStamp for start time (when measuring responsiveness to an event)

4. Use the parameter that requestAnimationFrame() passes to callbacks to include time running framework code

5. You can nest requestAnimationFrame() to include Layout and Paint time, but that limits precision to 16ms so they didn't

6. Instead of percentiles, count % of events under a target like 100ms, it's more user-centric: instead of "how fast/slow is my app" it tells you "how often do users experience slowness"

7. Chart the counts at multiple targets in an percent stacked area chart

One weird thing to me about items 5 and 6—why not both? Why not have a chart including and a chart excluding Layout and Paint time, so you know if you're doing bad CSS or something that's introducing an expensive repaint? Why not have a stacked line chart with percentiles alongside the percent stacked area chart?

laughinghan··on V8 adds support for top-level await
How is swallowing errors magic? try/catch does that and predates ES3.

To clarify your example, what about:

    function foo() {
      const val = async (1 + 2)
      return val;
    }
    const x = foo();
Does the `x = foo()` block/implicitly await?

> if you forget an await you've probably introduced a bug, and the only way to know is ... docs

Given that async is "contagious", I'm having a lot of trouble imagining a scenario where a codepath could run and appear to work, but actually be hiding a bug because you didn't realize something was async. Unless you're just saying that the bug would be apparent as soon as you ran the code, but the syntax checker wouldn't flag it for you?

laughinghan··on V8 adds support for top-level await
I like your idea, but I don't see how it could work in an untyped language. Consider:

    function foo() { return 1; }
    function bar() { return fetch('http://example.com'); } // implicitly async
    
    function qux() {
      const fn = Math.random() > 1/2 ? foo : bar;
      fn();
      return 1;
    }
Is qux() synchronous?
laughinghan··on V8 adds support for top-level await
I think you missed this part: "instead make developers explicitly say when they wish for the result to be async"

So using Promise.all() would be as simple as:

    const results = Promise.all(async fetch(url1), async fetch(url2))
laughinghan··on Life in China Is Getting Harder With High Prices
Why 1991? Surely such articles predate 1991.

I'm not sure why you think writers at Bloomberg, a Wall Street-oriented outlet, represent average people in the US.

I'm also not sure why you think anyone would want China to collapse in order to "prove democracy correct", as if to win a bet. Democracy is a means to an end. "Average people" think that in China, though many people are doing great under the current system, there are also people not doing great, average people just like them, who are being oppressed, harassed for reading banned books, punished for criticizing party officials, put into re-education labor camps, even having their organs harvested, and they want that to stop. If China stopped all that tomorrow without collapsing, most people would be ecstatic about that. But they won't, and average people believe the best way to permanently stop that kind of thing is for everyone to get a voice and a vote in their government—indeed, for a hundred flowers to bloom, or 百花齐放, if you will.

laughinghan··on Life in China Is Getting Harder With High Prices
Economic growth for 8 straight years of the last 7 years of the Obama administration and the first year of the Trump administration were good for the USA and our fellow Americans.

Is killing children okay if it's not deliberate?

laughinghan··on Life in China Is Getting Harder With High Prices
It sounds to me like you're saying that you'd rather go back to poverty than live in 1984.

The more salient question, though, is whether you'd rather go back to poverty than live in Singapore?

laughinghan··on Life in China Is Getting Harder With High Prices
Two things can be bad without being close to equal or even comparable.

The UK's pervasive mass surveillance is definitely bad, but you can, for example, campaign and vote against them, right? Do you feel like pervasive CCTV limits who you can vote for or what books you can read? That's not a strawman, that's literally what it's like in China right now.

laughinghan··on Too Much Dark Money in Almonds
It’s not a good assumption to think that because a charity pays lavish salaries and stays in fancy hotels that it is somehow more effective.

You're 100% right!

We should assume no such thing. We should measure whether it's more effective and reward that. Measuring and rewarding anything else creates perverse incentives, such as:

I’d rather donate to a charity that both has low overhead and reduces the malaria rate by 20%.

Really? If two charities deliver the same results, where one pays its staff minimally and spends the vast majority of its money on its treatment program, and the other pays and treats its staff well (lavishly, even) and spends less money on a more cost-effective treatment program, yielding the same ultimate results, then I'd say the former enriches more lives and deserves my money more.

When people say "no good deed goes unpunished", that's a joke because that's obviously not how we want the world to work. The world we want is one where bad deeds are punished and good deeds are rewarded.

We should prefer to donate to a charity that is as effective as alternatives but pays and treats its workers better, because the people who make those missions succeed deserve to be rewarded, not punished.

it’s pretty much impossible to tell if a single charity reduces the malaria rate ... there are lots of other factors and organizations contributing to a shared goal

That's why the article I linked to advocates randomized controlled trials, among other ideas.

laughinghan··on Weld: Accelerating numpy, scikit and pandas as much as 100x with Rust and LLVM
Maybe "dialect" would be more accurate than "superset"? I don't think Cython is technically a superset of Python, since I think runtime metaprogramming features like __dict__ and monkey-patching are significantly altered or restricted?
laughinghan··on Chrome 78 Beta: a new Houdini API, native file system access and more
No one has suggested that people "expect the same UI between mobile & desktop apps".

The point under discussion is that it's desirable for apps to have "coherence and familiarity" across platforms.

It's important that there be coherence and familiarity between Slack and Spotify's mobile, desktop, and web apps, for example, because most of their customers will use at least 2 of the 3 in any given week, which likely contributed to their choice to use Electron for their desktop apps.

laughinghan··on Too Much Dark Money in Almonds
> it’s easier for me to just filter by low absolute and relative overhead

Don't. Don't even do that. Don't try to determine their overhead at all. Just look at results, like the rate of malaria in children in the region.

Better to donate to a charity that stays in lavish hotels, parties all the time, and reduces the malaria rate by 20%, than a charity with no overhead, works super hard, pays their staff little, spends 95% of their budget on treatment, and still only reduces the malaria rate by 5%.

laughinghan··on Chrome 78 Beta: a new Houdini API, native file system access and more
The user only uses the application in the platforms that one uses

Most people only use one desktop and one mobile OS, but it's extremely common to use the same app on both desktop and mobile.

If your Mac and Windows apps both have to be consistent with your iOS app, they end up having to be consistent with each other.

laughinghan··on Silicon Valley is terrified of California’s privacy law
How would you prove that you were the owner of a name and address without revealing additional information about yourself?

Theoretically, there could be a system where, if the publisher of a name+address gets an anonymous request to remove that information, then they have to mail a letter with a nonce to that address, and then if they get a followup request with that nonce, then they have to comply and remove it.

In practice, a system involving third-parties such as a lawyer or government agency is more likely, I'm just proving my point that there's nothing fundamental that requires compromising anonymity.

It's also worth noting that if a client is known to their lawyer but unknown to anyone else, it's pretty widely accepted to describe that client as anonymous, even if they're not technically anonymous in the ultimate, purist sense.

If a website operator is anonymous, how are you going to contact them and require them to take down your information? [What] if they refuse?"

First of all, that's not a conflict or tradeoff between my ability to anonymously use services and my control over my data.

And the obvious solution, which is the one we have, is that to run a website, someone has to give up a little anonymity and be subject to laws. But there's no fundamental reason people can't anonymously use services and maintain control over their data.

laughinghan··on Too Much Dark Money in Almonds
Sure, but I'm saying something more specific than just "head-and-shoulders the best". I'm saying we should entirely ignore overhead and in fact pretty much ignore what the charity itself does at all (how much of your donation goes to fundraising? How much goes to lavish hotels?), and just look at the actual malaria rate in the children they treat.

I highly recommend reading the New Republic article I linked to, it talks about all this in a lot more detail.

← PreviousPage 8 of 27Next →