HNHacker News
TopNewBestAskShowJobs

strager

300 karma · joined January 27, 2011

strager.nds@gmail.com http://strager.net/
submissionscomments
strager··on LAPD Officer Killed During Training Exercise Was Investigating Cops About Rape
> also have [cops] be subjected to term limits just like politicians

Why would we want cops to have less experience on average?

strager··on Buffering Output
Do any operating systems expose mixed buffering (for real screen rendering) to applications? I know Windows used to allow full-screen apps to implement single buffering, but I don't know if it could seamlessly transition into double buffering.
strager··on Want cleaner code? Use the rule of six
How do you debug that code?
strager··on Go Developer Survey 2022 Q2 Results
Function coloring is a problem with async/await: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
strager··on Zig, the Small Language
Maybe this: https://github.com/ziglang/zig/issues/335#issuecomment-10138...
strager··on Ask HN: What is a purchase that made you happy?
Hello Fresh subscription. I now spend more time with my girlfriend.
strager··on The SQLite Code of Ethics
That's a human problem, not a Christian problem. Cultures around the world enabled slavery.
strager··on The SQLite Code of Ethics
Christians and their faith lead the slavery prohibition movement.

I don't know the history of the other things you mentioned.

strager··on The SQLite Code of Ethics
> far more people have suffered

Compared to what?

strager··on Cold Showers
> Bugs are reduced by monitoring, testing, and reducing how much code there is so there's less surface area (which also makes monitoring and testing easier). > > You reduce code by refactoring.

This is a great point.

I wonder if there's a study on bugs-per-line-of-code, how this changes across project sizes, and whether refactoring changes bugs-per-line-of-code.

strager··on Cold Showers
> Your compiler can instantly tell you what you've broken.

For some definition of "instant".

I can often run my Python or JavaScript test suite faster than Haskell/GHC or Rust/rustc can type-check a module.

And it can take a while to understand Haskell, Rust, or C++ error reports.

(Of course, Python and JavaScript startup time and execution speed can hurt refactoring too. And AttributeError-s and random undefined-s aren't always easy to debug.)

strager··on Why Rust easily optimizes out smart pointers where C++ cannot?
> That's because you are explicitly telling the compiler to create a copy of your shared pointer

This is also happening in the Rust code (x.clone()).

strager··on Why Rust easily optimizes out smart pointers where C++ cannot?
C++'s std::shared_ptr<T> is not at all like Rust's Rc<T>. std::shared_ptr<T> is more like Arc<T> or Arc<Box<T>> depending on the deleter.

Also, your Rust example uses -O (which is -C opt-level=2), but your C++ example uses Clang's -O3 (which is like rustc's -C opt-level=3).

Here are examples which are more similar: Rust: https://godbolt.org/z/We7ah1ehe C++: https://godbolt.org/z/r31jrcbjc

> Smart pointers are often used in high-performance code (like browser engines) so it is interesting to learn how their usage impacts the generated code.

Browsers like Firefox and Chrome don't use std::shared_ptr. You should research how the compiler optimizes those implementations.

strager··on Why, oh why was this added?
In the OP's case, the _why_ can be encoded in function names. For example:

    function DatePicker() {
      function handleDateChange(event) {
        preventDialogFoobarFromClosing(event);
        ...
      }

      return (
        <ThirdPartyDatePicker
          onChange={handleDateChange}
        />
      );
    }

    function preventDialogFoobarFromClosing(event) {
      event.preventDefault();
    }
strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
Does GNU ld support delayload?
strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
> It also took me a while to get

Thanks for the feedback. I redesigned that code block, making it a side-by-side diff. Is it easier to understand now?

strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
That's a good point. I never thought of this. I assumed that, because Clang+MinGW was newer, it's less stable. That's why I went with GCC+MinGW. I completely forgot about the positive corporate influence on Clang.
strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
dlltool generates implibs. quick-lint-js has a .def -> .lib build step in its CMake build system. I'd say this is a form of compilation.
strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
Do you work on a compiler backend? =]
strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
You're right. I should have written 'Hypothesis', not 'Conclusion', for that line. EDIT: I corrected the article.

The statement is correct though. The bug was specific to Windows x64 builds when compiled with GCC-MinGW.

strager··on Sometimes, it is a compiler bug: inding and fixing a bug in a C++ toolchain
Interesting. I've heard of GCC doing this and breaking multi-threaded code, but not breaking single-threaded code. I'm curious. Can you share the bug report?
strager··on Custom JavaScript controls can't capture the nuance of form fields (2021)
Facebook, Twitter, Gmail, Discord
strager··on I’m porting the TypeScript type checker tsc to Go
esbuild, SWC, and Bun are not ports of existing programs.
strager··on What NPM should do to stop a new colors attack
> All dependencies sources must be included with project sources.

This sounds great for applications. But for libraries, you'll likely end up with the diamond dependency problem: an application uses two libraries, and each library uses their own copy of a third library.

strager··on The Web3 Fraud
The next OS vendor might.
strager··on The Web3 Fraud
> Removes counterparty risk.

Bitcoin does not remove counter-party risk. The counter-party is there, and it's risky:

* miners (can ditch Bitcoin; can censor your transactions)

* Bitcoin software (wallets; miners) (can have bugs which get your coins stolen)

* Bitcoin protocol (can have bugs which get your coins stolen)

* internet infrastructure (can censor Bitcoin)

strager··on XXH: Bring your favorite shell wherever you go through the SSH
> including support for the necessary aliasing and macros that system shells (ab)use for system configuration

I think we could get away without system-configured aliases and macros.

> I think the system you propose would require a fat server

Yup, this sounds about right.

> I think it also goes against the philosophy of "do one thing and do it right" because of all the moving parts.

Agreed. But Clang+LLVM and Visual Studio Code show that discarding this philosophy can lead to a successful project anyway.

strager··on About Three-in-Ten U.S. Adults Are Now Religiously Unaffiliated
> Why waste time with ...

This is what I used to think. Then I considered having children. My perspective changed quickly. (Though I don't know exactly why it changed.)

strager··on XXH: Bring your favorite shell wherever you go through the SSH
> Sure the shell might have looked amazing like a browser but why

So you don't need to copy your config to the remote server, like XXH does.

So you can still edit your command when your wifi gets spotty.

strager··on XXH: Bring your favorite shell wherever you go through the SSH
... while sacrificing features like auto-complete, shell awareness (Git branch and other doodads people love to put in their prompt), and persistence (screen/tmux/mosh).
← PreviousPage 3 of 7Next →