HNHacker News
TopNewBestAskShowJobs

YorickPeterse

2,784 karma · joined March 29, 2011

Author of the Inko programming language, formerly a staff developer at GitLab.

Website: https://yorickpeterse.com

submissionscomments
YorickPeterse··on Statement Regarding the Zen Programming Language
A language licensed as the GPL likely would not see any users, as programs built on it would link to it (or at least parts of it, such as the standard library); thus requiring either an exception clause, or that all software using the language also be licensed as GPL.

IIRC the AGPL is better for this, but most GPL licenses are just blacklisted by companies; reducing the likelihood of the language catching on.

YorickPeterse··on How I operated as a staff engineer at Heroku
This is also how we do Staff Engineering at GitLab: you're expected to spend most of your time writing code. What changes is how you go about doing that, how you communicate things, what responsibilities you have, the expectations of you, etc.
YorickPeterse··on Ruby adds experimental support for rightward assignments
I helped out with parser as well for a while, though it was mostly documentation, triaging issues, that sort of thing. I think I still have push access to the Gem, as at the time the project had a bus factor of 1 (= whitequark).

Anyway, I remember just how frustrated whitequark would get every time CRuby decided to make some random syntax change. I have a lot of respect for the current maintainer(s) for putting up with the ever growing complexity of the Ruby syntax. I hope Ruby stops changing the syntax on a regular basis, but I doubt this will happen any time soon.

YorickPeterse··on Async Views in Django 3.1
> The first issue you run into is the thread stack size - Linux has a hard default of 8MB; at 100,000 you start to hit OOM issues first. Go (and BEAM) has a ton of work to make this use case possible within the runtime.

This is not how thread stack sizes work. Thread stack sizes allocate a certain amount of _virtual_ memory. This means that with a stack size of 8MB you don't actually immediately use 8MB of physical memory. Only when you start filling up that memory do you start using physical memory. We can easily demonstrate this using a simple Rust program:

    use std::thread;
    use std::time::Duration;

    fn main() {
        let mut handles = Vec::with_capacity(10_000);

        for _ in 0..handles.capacity() {
            let handle = thread::spawn(|| thread::sleep(Duration::from_secs(1)));

            handles.push(handle);
        }

        for handle in handles {
            handle.join().unwrap();
        }
    }
We when compile this in release mode, and run it as follows:

    /usr/bin/time -f '%M KB RSS' program-name
On my Linux desktop this prints out:

    88492 KB RSS
This is roughly 86 MB or RSS memory being used. If the thread stacks would use physical memory, this would translate to just under 80 GB; and the program would have been OOM killed because I only have 16 GB of RAM available.

The virtual memory limits in turn are not much of an issue. I think on most 64 bits systems the virtual memory limit is 256 TB. A 256 TB limit would allow up to 33 554 432 OS threads with a stack size of 8MB. And since you can configure the limit when spawning threads, you can increase this number by spawning threads with a smaller limit (e.g. 4MB).

YorickPeterse··on Async Views in Django 3.1
I think it's not necessarily POSIX threads related. In theory there is nothing wrong with spawning tens/hundreds of thousands OS threads, and Linux does a decent job at this. But in practise you'll run into issues such as:

* Different OS' handle things differently. macOS limits the number of threads per process (somewhere around 1500 I believe). Other OS' may be slower, or impose other limits

* Because of this, sometimes spawning threads is pretty fast (e.g. 10 µsec). Other times it's super slow (I've seen threads take over 500 ms to spawn)

* Context switches are still pretty slow across OS'. There's finally some work being done towards lightweight thread support in Linux, but I suspect it will take a few years to become useful

I _really_ hope that one day we _can_ "just" spawn 100 000 OS threads without issues, as it would make many concurrency problems easier to solve. Sadly, I think it will take another 10-15 years.

YorickPeterse··on Why is there a normal galaxy sitting at the edge of the Universe?
Isn't this basically what the Big Rip hypothesis is about?
YorickPeterse··on Fast Typing: Keyboard Layouts
> https://danluu.com/keyboard-latency/

I'm surprised the HHKB2 scores better than the Ergodox. I used one for years but found it to type more sluggish. I suspect this is due to Topre switches requiring a bit more force to push down.

> Come to think of it, I might have incurred some latency myself with the particular layout I'd brewed

Oh yeah, the dual-function keys are horrible latency wise. I tried various ways of reducing this, but you end up having to choose between high latency or low latency but keys not registering. I ended up not using dual-function keys because of this. This is a bummer, because the concept is great.

The Ergodox/QMK does let you tweak the USB polling rate, but I haven't really taken a good look at this yet.

> I kind of still want a mechanical keyboard that has extreme amounts of click and clack, just because it feels so nice to type with. I just don't know which model I'd pick, and it'd be pretty expensive for something I'd only use occasionally.

Personally I'd love to see something like the Ergodox, but a bit more compact (e.g. no thumb cluster), and half the height. Height especially is something that seems overlooked with mechanical keyboards. This is a shame, as I suspect it's easier to keep your hands/arms at the right angle with a flatter keyboard.

YorickPeterse··on Fast Typing: Keyboard Layouts
I've been using an Ergodox for about a year now, but never noticed any latency issues of any kind. This is just using standard Cherry MX brown switches. Perhaps the issue was something else?

At the end of the day I think it's a matter of taste/preference. Some like mechanical keyboards (i.e. me), others don't. That's fine, just pick whatever works for you :)

YorickPeterse··on Gitlab reducing free tier CI/CD minutes from 2000 to 400 minutes
> Does anyone else think this is a Gitlab campaign against overuse of monomorphization in Rust projects? I just can't get myself to use Dyn...

I presume this is some kind of joke. If not, why on earth would GitLab campaign against the use of dyn types? GitLab doesn't even use Rust.

YorickPeterse··on Is TDD Dead? (2014)
While I'm not a fan of DSLs as seen in Ruby's RSpec, I do enjoy being able to write regular sentences as test names; provided you don't have to stick with the pattern "it is expected to ...".
YorickPeterse··on Cloudflare Package Repository Mirrors
At least on Arch Linux you can specify multiple servers, ensuring you don't depend on a single one.
YorickPeterse··on Cloudflare Package Repository Mirrors
I'm guessing this may be more a case of "We and our customers need this, so we may as well make it public".
YorickPeterse··on First Impressions of Rust
There's a thing called trademarks, and the case is indeed different for those. But even in that case, one would have to file some sort of dispute; you don't necessarily get to use the name everywhere forever, no questions asked.
YorickPeterse··on First Impressions of Rust
Honestly these questions are not that hard to answer. Just look at the likes of GitHub, GitLab, or really any source code hosting platform that supports the creation of groups.

> How do we decide which person/entity gets a namespace?

You get a personal one, named after your user account. In addition, you can create up to N namespaces. After that, you either have to request more or pay a small fee. This prevents namespace squatting, while still giving you the option to register a few for specific projects.

> What if there's a dispute?

First come first serve seems pretty reasonable. Just because your company is named X doesn't mean you have a perpetual and exclusive right to use that name wherever you want.

> What do we do about all the currently un-namespaced crates?

You would have to leave them, and perhaps disallow un-namespaced crates after a certain point of time. Maybe take a look at how NPM handled thsi.

> How would Rust (the language) understand namespaces?

A crate `foo/bar`, with `foo` being the namespace, should just translate to something like `use foo::bar`.

YorickPeterse··on Announcing The Zig Software Foundation
Instead of complaining about in on Hacker News, how about you try to submit a patch to make it work? That strikes me as far more productive.
YorickPeterse··on Announcing The Zig Software Foundation
Something tells me Zig developers have more important matters to focus on than being able to indent code with tabs.
YorickPeterse··on There's never been an easier time to write your own language (2016)
Because why not? It can be a fun an very insightful process, as you'll learn about and have to apply techniques you may not have heard of otherwise.
YorickPeterse··on Things I wish I had known when I started programming, Part 4 (2019)
10 years in, and I still deal with it on a regular basis (I wrote [1] a little bit about this the other day). Hopefully it goes away one day, but I suspect it won't.

[1]: https://yorickpeterse.com/articles/10-years-of-software-deve...

YorickPeterse··on A Few More Reasons Rust Compiles Slowly
To illustrate, let's take the following VM code: https://gitlab.com/inko-lang/inko/-/tree/master/vm. This VM consists of 18 262 lines of code, including VM tests.

An incremental release build where nothing has changed (I just ran `touch src/lib.rs`) takes 25 seconds. Compiling the VM from scratch including all dependencies takes 1 minute and 28 seconds.

That's not too bad, but it could (and in my opinion should be) much better. Debug builds are usually faster to compile, but tend to run too slowly to be useful for anything but debugging some VM bug.

YorickPeterse··on I Just Hit $100k/year On GitHub Sponsors
I'll join in as well! Please roast my profile here: https://github.com/sponsors/YorickPeterse
YorickPeterse··on Gitlab 13.1
We've actually been using feature flags for quite a while for some release tooling related projects. Geo has been used in the past when we migrated to Google Cloud if I remember correctly.
YorickPeterse··on The Hamler Programming Language
It indeed is difficult to combine static typing, and actors that can receive messages from any other actor. "Session typing" is a way of handling this, but I've yet to see an implementation that isn't overly complex.

Type-checking messages on the sending side is straightforward: just use a generic PID/actor type of some sort. So for example (using Inko [1] syntax here):

    let child: Process!(String) = process.spawn {
      ...
    }

    child.send('hello')
Handling this on the receiving end is more tricky, as a receive could happen anywhere at any time. Imagine somewhere deep down you have a method like this:

    def foo {
      process.receive
    }
How would the compiler know what type `process.receive` is supposed to return? What if you want not just a string, but a specific list of strings?

I'd say that for most languages the best approach is to use some kind of "Any" type for messages, and rely on some form of pattern matching to figure out what you're dealing with. This has the downside of not providing compile-time safety, but it might be good enough. For example, in Inko (this is a new addition not yet released) you would do something like this:

    match(process.receive) {
      'start' -> { start_the_thing }
      'stop' -> { stop_the_thing }
      else -> { oops }
    }
[1]: https://inko-lang.org/
YorickPeterse··on How to write good Git commit messages
Counter point: I have also worked for 10 years, and I keep running into people wishing developers spent more time writing better commit messages.

I think what matters is the type of project. A lot of commercial software is all about moving fast and not caring too much about the past. In such a setup, writing good commit messages may be less useful or even seen as a waste.

For software built to last however, I think good commit messages are invaluable. Issue trackers are replaced, documentation is rewritten or lost, comments are modified; but commit messages stay the way they are. This helps you get a better understanding of why decisions were made, something rarely documented properly.

YorickPeterse··on Ruby vs. Crystal Performance
Ruby's meta-programming capabilities is why optimising Ruby is so darn difficult. It's extremely powerful, but also complicates a lot of things.
YorickPeterse··on With remote work plan, Facebook dashes hopes of paycheck arbitrage
In some countries (at least in The Netherlands), it's also plain illegal to lower one's salary based on just location. In fact, over here lowering salary in general is difficult to do. But this being the US, I suspect it won't be much of an issue for Facebook.
YorickPeterse··on Ruby Next: A Transpiler for Ruby
Just because something hasn't been updated for a while doesn't mean it's broken.
YorickPeterse··on Tesla Q1 2020 Update
> They can't handle when someone is expressive (aka the Tesla @ 420 tweet, he simply expresses his opinion)

He tweeted about having money to take Tesla private, which from what I remember turned out to be false. Lying is not being expressive, it's just that: lying.

YorickPeterse··on Gleam: A statically typed language for the Erlang VM
> This is my current plan, though it does make interop with Erlang/OTP somewhat more tricky.

I have always wondered just how common it is in Erlang/Elixir to just fabricate a PID out of thin air and start sending messages to it. My gut feeling is that this is quite rare, but then again I'm not an Erlang user.

If you want to rubberduck about anything related to this, feel free to send me a message/Email/Tweet/etc :)

YorickPeterse··on Gleam: A statically typed language for the Erlang VM
Type safe process communication is a tough nut to crack. You can sort of handle it by doing away with PIDs or by at least making them generic, but that leaves out corner cases such as sending a message to the current process. Type inference of the message types is also hard, imagine something like this (using pseudo code here):

    let pid = spawn {
      ... hundreds of lines of code ...
      let message = receive
      message + 10
    }

    ... lots of code here ...

    send(pid, 20)
A compiler being able to infer the type of the message here will depend a bit on how it processes code: does it go into the spawn first, or process that later? If it does go into spawn first, what should it do when it reaches `message + 10`. And what if we were to process `send()` first, but it's actually sending the wrong type? We'd probably infer the type to be an integer, even if the receiving end actually wanted something else.

Session types are one approach to dealing with this, but I have yet to see an implementation of this where it's actually pleasant to describe the session in the type system; most that I remember turn out horribly complex.

I spent a fair bit of time on this for Inko (https://inko-lang.org/) as it has a similar message sending system. Right now you'd have to use pattern matching to make things safe (this isn't released yet), but obviously I would like to check this at compile-time. Sadly I haven't been able to make this work yet, as there was always some corner case somewhere that meant that whatever I had implemented at that point wouldn't quite cut it.

For a while Inko had a special API for this that basically worked by sending types closures to the receiving end, that way type-safety could be enforced by making sure the right closures were used. Sadly this is not the most efficient, and in some cases still required type annotations.

One thing I did, but this may not work for Gleam, is to replace PIDs with just references to processes, and only allow obtaining such references by spawning a process. By not allowing one to just create a PID out of thin air, you reduce the likelihood of a process randomly receiving a message of a type it does not understand. A side benefit of this is not having to allocate PIDs, which I found out can actually be quite a bottleneck when spawning many processes (though Gleam being based on BEAM has no real choice in this matter).

YorickPeterse··on Ask HN: What projects are you working on now?
Not specific to the quarantine, though I have been spending more time on it due to it: https://inko-lang.org/. It's a programming language I've been working on for the past few years.

In recent months I have been specifically working on making the compiler self-hosting. This has so far taken up more time than anticipated, as I had to rethink a lot of parts of the compiler (e.g. parts of the type system), and I didn't want to rush it.

With that said, progress is slowly improving as I'm making my way through implementing all the type checking rules. Hopefully in a few months the entire compiler is self-hosting.

← PreviousPage 7 of 14Next →