Andrew how will the self hosted compiler maintain a known trust back to assembly? i.e how can someone look at a self hosted zig compiler and build it themself from source, never needing to download blobs from the internet? Otherwise you lose the ability to trust anything you build.
Zig specifics aside… build it from source using what ? Another compiler. Okay, so you can compile that one from source. But what does that? Another compiler. Unless you’re recording memory contents and executing instructions by hand, you’ve just discovered the Ken Thompson hack. At some point the pragmatic thing is to trust some bits from a trusted source (e.g. downloaded from an official repo w/ a known cert, etc.).
Zig self hosted compiler is now capable of building itself
71–80 of 285 posts
Re: Zig self hosted compiler is now capable of building itself
#72D has a C compiler built-in now, I wonder if we could bootstrap all the toolchain now.
Don't most toolchains have a rather large C++ component? Just parsing C++ is a rather large undertaking (my understanding is that it's syntax is turing complete).
Re: Zig self hosted compiler is now capable of building itself
#73Earlier quoted context omitted.
As someone not familiar with android development, this is somewhat confusing because I always thought Google was pushing dart/flutter for mobile these days? Or is it both at once?
From talking to a Googler the reason why Google devotes resources to Kotlin is that there was and still is a large external demand from the Android development community for Kotlin.
https://talkingkotlin.com/the-first-kotlin-commit-in-android...
Re: Zig self hosted compiler is now capable of building itself
#74Earlier quoted context omitted.
I think Zig prefers explicit memory management, because allocations may fail and should be handled explicitly, and because automatic deallocations lead to hard-to-predict lifetimes (excess memory usage, and bugs for resource handles that are destructed at hard to predict moments). These are things that a "systems language" programmer should put in the work to do correctly/near-optimally, and not ask the compiler to j…
> because automatic deallocations lead to hard-to-predict lifetimes (excess memory usage, and bugs for resource handles that are destructed at hard to predict moments). I don't really feel this is the case in Rust.
Re: Zig self hosted compiler is now capable of building itself
#75Earlier quoted context omitted.
Zig specifics aside… build it from source using what ? Another compiler. Okay, so you can compile that one from source. But what does that? Another compiler. Unless you’re recording memory contents and executing instructions by hand, you’ve just discovered the Ken Thompson hack. At some point the pragmatic thing is to trust some bits from a trusted source (e.g. downloaded from an official repo w/ a known cert, etc.).
You just need 1 compiler written in assembly, and work your way up from there. C17 -> assembly of your choice, written in assembly Zig -> C17 “transpiler”, written in C17
Re: Zig self hosted compiler is now capable of building itself
#76Andrew how will the self hosted compiler maintain a known trust back to assembly? i.e how can someone look at a self hosted zig compiler and build it themself from source, never needing to download blobs from the internet? Otherwise you lose the ability to trust anything you build.
Zig specifics aside… build it from source using what ? Another compiler. Okay, so you can compile that one from source. But what does that? Another compiler. Unless you’re recording memory contents and executing instructions by hand, you’ve just discovered the Ken Thompson hack. At some point the pragmatic thing is to trust some bits from a trusted source (e.g. downloaded from an official repo w/ a known cert, etc.).
Re: Zig self hosted compiler is now capable of building itself
#77Earlier quoted context omitted.
Thanks :) The new Zig implementation is certainly more well designed than the C++ implementation, for several reasons: * It's the second implementation of the language * It did not have to survive as much evolution and language churn * I leveled up as a programmer over the last 7 years * The Zig language safety and debugging features make it possible to do things I would never dream of attempting in C++ for fear of f…
Thanks for all the context. Curious to know more about the concept/design of the DAW.
Re: Zig self hosted compiler is now capable of building itself
#78Earlier quoted context omitted.
Congratulations with the milestone! Does using Zig over C++ lead to "less memory, and represents a modest performance"? Or was the C++ implementation a bit sloppy? (lacking data oriented design for instance) Also, what specifically are you most excited using Zig for?
Thanks :) The new Zig implementation is certainly more well designed than the C++ implementation, for several reasons: * It's the second implementation of the language * It did not have to survive as much evolution and language churn * I leveled up as a programmer over the last 7 years * The Zig language safety and debugging features make it possible to do things I would never dream of attempting in C++ for fear of f…
Re: Zig self hosted compiler is now capable of building itself
#79I was thinking of learning Rust but it seems a bit overkill due to manual memory management as compared to languages with similar speed like Nim, Zig, and Crystal. How would one compare these languages? Is it worth learning Rust or Zig and dealing with the borrow checker or manual memory management in general, or are GC languages like Nim or Crystal good enough? I'm not doing any embedded programming by the way, just…
Obviously i'm biased, but i quite enjoy it. I find i am more efficient now than before, because it manages to give me the ease of the "easier" languages quite often with a rich set of tooling when i need to go deeper.
Personally i feel the concern over the borrow checker is way overblown. 95% of the time the borrow checker is very simple. The common worst case i experience is "oh, i'm borrowing all of `foo` when i really want `foo.bar` - which is quite easily solved by borrowing just the `.bar` in a higher scope.
The lifetime jazz is rarely even worth using when compared to "easier" languages. Throw a reference count around the data and you get similar behavior to that of them and you never had to worry about a single lifetime. Same goes for clones/etc.
I often advocate this. For beginners to use the language like it was a GC'd language. A clone or reference count is often not a big deal and can significantly simplify your life. Then, when you're deeper into the language you can test the waters of lifetimes.
So yea. Your mileage will vary i'm sure. But i find Rust to be closer to GC'd languages than actual manual languages, in UX at least. You won't screw up and leak or introduce undefined behavior, which is quite a big UX concern imo.
Re: Zig self hosted compiler is now capable of building itself
#80Earlier quoted context omitted.
Congratulations with the milestone! Does using Zig over C++ lead to "less memory, and represents a modest performance"? Or was the C++ implementation a bit sloppy? (lacking data oriented design for instance) Also, what specifically are you most excited using Zig for?
Thanks :) The new Zig implementation is certainly more well designed than the C++ implementation, for several reasons: * It's the second implementation of the language * It did not have to survive as much evolution and language churn * I leveled up as a programmer over the last 7 years * The Zig language safety and debugging features make it possible to do things I would never dream of attempting in C++ for fear of f…