News for hackers. Stuff that matters.
Re:Why I love Rust for tokenising and parsing by James_K on Friday November 08, 2024 @07:20AM (#42086292)
They just use the implementation from the last version of the compiler, which you can follow back in a long chain to the first implementation. As for the implementation of the garbage collector, it probably just doesn't allocate anything. The basics of a garbage collector are a function "alloc" and another one "collect". The function to allocate memory usually looks something like this:

  char heap[100000000];
  int heap_end;
  void *alloc(int n_bytes) {
    void *out = &heap[heap_end]
    heap_end += n_bytes;
    return out;
  }
As you can see, it doesn't need to allocate any memory to do this.
Re:Why I love Rust for tokenising and parsing by umanwizard on Friday November 08, 2024 @09:37AM (#42087154)
> They just use the implementation from the last version of the compiler

The garbage collector isn’t part of the compiler, it’s part of the runtime. It’s worth being clear about this distinction because I think it’s the root of the OP’s confusion.

Re:Why I love Rust for tokenising and parsing by wrs on Friday November 08, 2024 @10:52AM (#42087738)
Sure, but what’ll really bake OP’s noodle is that Go’s GC is written in Go too. :) [0]

[0] https://go.dev/src/runtime/mgc.go