HNHacker News
TopNewBestAskShowJobs

smasher164

1,521 karma · joined August 13, 2015

akhil.cc
submissionscomments
smasher164··on Hacking anything with GNU Guix
As long as you don't hardcode "expected paths" (like in the FHS) in the filesystem, and expose the expectations you have via some configuration (environment variables and flags are fine), then packaging your software for Nix is pretty straightforward.
smasher164··on Using WebTransport
Yeah I just wanted to do a client-server app on a UDP-like socket, but WebRTC had so much complexity that it put me off.

It's gotten better now, but WebTransport is the solution we've needed for a while.

smasher164··on Millet, a Language Server for SML
I can't wait to try this out. Thanks for building this!
smasher164··on Our Roadmap for Nix
Oh that page isn't mine, I just found it as a good explainer for nix templates.
smasher164··on Our Roadmap for Nix
Nowadays, every one of my projects starts with a flake.nix file. I even have templates (https://peppe.rs/posts/novice_nix:_flake_templates/) fo archetypes of projects, like a Go, Rust, GTK project, etc...

I love that flakes allow you to decouple a package from nixpkgs and place it in your repo, but in order to fully realize this dream, there needs to be a proper index of these packages, as well as non-experimental support for flakes.

Another (pipe) dream of mine is that Nix gets true cross-platform support, including non-WSL windows. This would allow it to fulfill a role that doesn't currently exist, which is a cross-platform package manager and build system that works across language ecosystems.

smasher164··on The disproportionate influence of early tech decisions
Not to stretch the analogy too far, but isn’t this true of any non-trivial dynamical system? They are highly sensitive to initial conditions.
smasher164··on Reference count, don't garbage collect
Not sure about the characteristics of your workload, but here's a talk where a group wrote device drivers in several high-level languages, and measured their performance: https://media.ccc.de/v/35c3-9670-safe_and_secure_drivers_in_...

They found that the Swift version spent 76% of the time doing reference counting, even slower than Go, which spent 0.5% in the garbage collector.

smasher164··on Reference count, don't garbage collect
For how strongly worded this article is, you'd think the author would provide some substance in their reasoning. Reference counting, even atomic, is quite expensive. Not only because it can invalidate the cache line, but depending on the architecture (looking at you x86), the memory model will deter reordering of instructions. On top of this, reference counting has a cascading effect, where one destructor causes another destructor to run, and so on. This chain of destructor calls is more or less comparable to a GC pause.
smasher164··on Ask HN: What are some cool but obscure data structures you know about?
I wonder if you could apply e-graphs to situations where the union-find data structure would be used, i.e. if there are any additional benefits gotten from the congruence relation.
smasher164··on Lessons from Writing a Compiler
After reading through the Austral site, I have to say that the reasoning for its various features is very well articulated. This language ticks a lot of boxes. The only feedback I have to offer is to not skimp on the FFI, because the easier it is to call into C and C++ code, the easier the language will be to adopt (at least for the domain it seems to be targeting).
smasher164··on WxWidgets 3.2
wxPython is the only maintained alternative there. I think there’s an opportunity to create bindings to other languages with libClang nowadays. However, it’s gotta be done selectively, since there’s so much surface area in the API to fill in the gaps for C++’s standard library.
smasher164··on Data Race Patterns in Go
This definitely matches my experience using Go at my previous organization.

1. Closures and concurrency really don't mix well. The loop variable capture in particular is very pernicious. There's an open issue to change this behavior in the language: https://github.com/golang/go/issues/20733.

2. Yep. I've seen this problem in our codebase. I've grown to just be very deliberate with data that needs to be shared. Put it all in a struct that's passed around by its pointer.

3. This issue is caught fairly easily by the race detector. Using a sync.Map or a lock around a map is pretty easy to communicate with other Go devs.

4. This should be documented better, but the convention around structs that should not be passed around by value is to embed a noCopy field inside. https://github.com/golang/go/issues/8005#issuecomment-190753... This will get caught by go vet, since it'll treat it like a Locker.

5 & 6. Go makes it pretty easy to do ad-hoc concurrency as you see fit. This makes it possible for people to just create channels, waitgroups, and goroutines willy-nilly. It's really important to design upfront how you're gonna do an operation concurrently, especially because there aren't many guardrails. I'd suggest that many newcomers stick with x/sync.ErrGroup (which forces you to use its Go method, and can now set a cap on the # of goroutines), and use a *sync.Mutex inside a struct in 99% of cases.

7. Didn't encounter this that often, but sharing a bunch of state between (sub)tests should already be a red flag. Either there's something global that you initialized at the very beginning (like opening a connection), or that state should be scoped and passed down to that individual test, so it can't really infect everything around it.

smasher164··on Rust without the async (hard) part
Go has asynchronous preemption now using signals. Tight loops are preemptible.
smasher164··on Lies we tell ourselves to keep using Golang
Not a fan of articles that attempt to speak for me or say that I have stockholm syndrome. It’s super gaslighty and a pernicious form of contempt culture in the tech community. Instead of just saying how they feel about a language, they try to claim a moral high ground.
smasher164··on Lies we tell ourselves to keep using Golang
Yeah, his complaint about newtypes is just incorrect.
smasher164··on GraalVM 22.1: Developer experience improvements, Apple Silicon builds, and more
I think Project Loom support will open up green thread support for more Truffle-based languages. I could see Go, Haskell, Erlang, Scheme, and Concurrent ML -style languages taking advantage of that infrastructure.

I'm also hoping for official support for static linking. Right now, it's an undocumented feature done through the Feature API.

smasher164··on How Nix and NixOS get so close to perfect
I think Spack[1] might address some of the problems surrounding Nix. It uses python to configure packages, and the upcoming release will have Windows support too. The "Getting Started" information is pretty helpful, but package-level documentation still needs some work.

[1]: https://spack.readthedocs.io/en/latest/

smasher164··on Are We Sixel Yet?
Most terminals don’t support > 8 bit, so this is less about having a cutting-edge graphics protocol in the terminal, but more about having a standardized, backwards-compatible protocol that can feasibly be implemented by most terminal emulators.
smasher164··on Are We Sixel Yet?
There are libraries in most languages to output sixel graphics, however libsixel (https://saitoha.github.io/libsixel/) is a popular one written in C. There are some interesting use-cases shown on that page. These will abstract away the escape sequences and allow you to pass them a raw bitmap.
smasher164··on I was wrong – CRDTs are the future (2020)
I've been delving into CRDTs lately, and one thing I've been wondering is if there's an implementation that is purely SQL-based. All operations and merges would happen through database queries. This may not be suitable for real-time use, but I've noticed that most CRDT implementations expect you to have the entire data structure in memory, forcing you to be clever with the way you model your data and save to disk.
smasher164··on An Introduction to Generics
See here: https://go.googlesource.com/proposal/+/refs/heads/master/des...
smasher164··on A statically typed scripting language that transpiles to Posix sh
Neat!

A really cool enhancement to this would be if the compiler could target a polyglot script that is both Shell and Batch. For example: https://stackoverflow.com/a/17623721

Then you'd get a single script that would automatically be portable and executable on pretty much every conceivable platform.

smasher164··on The Future of Kubernetes
You're right. By itself, WASM is nothing like K8s. This comparison only makes sense if you consider how you would define the syscall layer.

People are seeing WASM in the context of a distributed runtime. Obviously, this would require you to write your applications with something not POSIX-like, but it would allow you to scale your service on a cluster. Your unit of computation isn't just confined to a single machine.

smasher164··on The Future of Kubernetes
1. WASM doesn't require a runtime. You can perform AOT compilation on it and still get the benefits of sandboxing.

2. Even under interpretation, WASM doesn't require the interpreter to jump through hoops or optimization to get it to be performant. In this sense, it's more of a portable assembly format than something like LLVM IR.

smasher164··on PipeWire: A year in review and a look ahead
Yes. This is how I did it initially, before rewriting it using serde. However, as I mention here (https://www.reddit.com/r/swaywm/comments/sks343/comment/hvn3...), shell with jq was too slow -- particularly if you're holding down the volume key.
smasher164··on TP240PhoneHome Reflection/Amplification DDoS Attack Vector
It's interesting that you say that, because we've already sort of balkanized around ISPs. However, CDNs and DDOS protection popped up around services that ISPs couldn't provide. Maybe the dream is for ISPs to provide these services as well, making it more tenable for regular users to self-host.
smasher164··on PipeWire: A year in review and a look ahead
Big fan of PipeWire, although I wish the tooling could work directly with PipeWire, instead of going through pactl. It's there, it's just not user-friendly. I ended up writing a tool for changing volume/muting that directly uses pw-cli: https://github.com/smasher164/pw-volume.
smasher164··on Show HN: All desktop software calculators are wrong, so I had to build my own
Great work! I like how well considered the design is. This calculator takes a point in the design space with text input, equation rendering, a grapher, and Big Int/Floats for number representation.

I wonder if the author considered an input method where keypresses translate directly into a rendered equation? Symbolab kind of does this, so instead of writing an expression in some functional style and seeing its rendered output, I can directly manipulate the rendered equation with the keyboard.

The other point the author makes about discoverability of operators like sqrt and cbrt, I feel that you could circumvent it by introducing a semantic search feature for operators. For example, typing "square root" would display a list of suggestions for operators that match that, like an IDE.

The last question I have is if the author has looked at libraries like Calcium (https://fredrikj.net/calcium/) or the work that went into the Android calculator recently (https://dl.acm.org/doi/pdf/10.1145/3385412.3386037). They use exact arithmetic with computable real/complex numbers. It might serve as a cleaner abstraction that switching between different BigNum representations yourself.

smasher164··on Reproducible Builds in February 2022
I believe it was this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=127957...

I encountered it when I updated a bunch of NixOS packages at once. Since the crash happened in chromium, I figured I'd downgrade that specific package by pinning an older channel. It still didn't work. But I knew that chromium had worked before, and nix doesn't really use the FHS, so the system wouldn't be polluted with random versions of packages. I also knew that the SHA for chromium had to match what was here: https://github.com/NixOS/nixpkgs/commit/a1c5e5bc40749652503c....

So if chromium wasn't the issue, the problem would have to lie elsewhere. Comparing the last two generations of my system, I found that Sway had updated, which also brought a new version of wlroots that broke older versions of chromium. I eventually found my way to this issue and rolled Sway back until the fix landed in stable.

There were probably easier/quicker ways to reach the same conclusion I did. But I think that knowing the software on my system was built correctly, and was relatively isolated (i.e. wasn't depending on random versions of libraries in the FHS) made it so I wouldn't fall down a rabbit hole that lead to a dead end.

smasher164··on Reproducible Builds in February 2022
For me, it serves as a guarantee that the binary will work correctly on my system. Knowing that if something is broken, that it isn’t due to a broken build makes it easy to debug issues. For example, when I updated wlroots, and chromium broke, I was able to isolate the issue very quickly.
← PreviousPage 4 of 9Next →