IIRC the AGPL is better for this, but most GPL licenses are just blacklisted by companies; reducing the likelihood of the language catching on.
2,784 karma · joined March 29, 2011
Website: https://yorickpeterse.com
IIRC the AGPL is better for this, but most GPL licenses are just blacklisted by companies; reducing the likelihood of the language catching on.
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.
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).
* 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.
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.
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 :)
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.
> 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`.
[1]: https://yorickpeterse.com/articles/10-years-of-software-deve...
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.
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/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.
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.
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 :)
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).
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.