~andrewrk/ziglang

4 3

one comment on the latest news: https://ziglang.org/news/goodbye-cpp/ article - Idris2 uses Scheme to bootstrap

Andreas Reuleaux <rx@a-rx.info>
Details
Message ID
<87y1rdz6ge.fsf@laptop>
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks for sharing these latests news:

  Goodbye to the C++ Implementation of Zig
  https://ziglang.org/news/goodbye-cpp/

And this is great news for Zig, indeed!

As there wasn't a means to comment on this article (it's not a blog),
I take the liberty to add one comment here:

To the various possibilities mentioned in the solutions space there:

  Don’t self-host
  Use a prior build of the compiler
  Compile the compiler to C code
  Compile the compiler to C code exactly once, but clean it up and maintain it directly from then on
  Compile the compiler to a simple virtual machine - and Web Assembly in particular (the method chosen)

I would like to add one more possibility - I have no idea, if this is
feasable for Zig at all (with Zig depending on LLVM) or if it's worth
exploring at all (now that this web assembly idea works) - but
nevertheless - maybe it's worth looking into:

Idris (Idris 2 i.e.) is self-hosting by compiling itself down to Scheme, and using that
Scheme-code then to bootstrap: i.e. on installing Idris one compiles a piece of Scheme (I use racket
typically, but I think Chez works as well), which was created before from the Idris code: this is
readable code (but nevertheless tedious to read). - And Idris folks claim that this is faster than their C backend!

Again: I have no idea, if this could be helpful for Zig as well.

Thanks,
  Andreas
Anthony Carrico <acarrico@memebeam.org>
Details
Message ID
<5a6f4a0c-f1b3-9bae-06ee-1f13976aad0c@memebeam.org>
In-Reply-To
<87y1rdz6ge.fsf@laptop> (view parent)
DKIM signature
missing
Download raw message
On 12/11/22 21:44, Andreas Reuleaux wrote:
> Thanks for sharing these latests news:
> 
>    Goodbye to the C++ Implementation of Zig
>    https://ziglang.org/news/goodbye-cpp/
> 
> And this is great news for Zig, indeed!

Very interesting. Also, the rss feed is broken. See:


https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fziglang.org%2Fnews%2Findex.xml

-- 
Anthony Carrico
Details
Message ID
<COZZUJEX08Z3.2N81A5C3HOSM6@debian>
In-Reply-To
<87y1rdz6ge.fsf@laptop> (view parent)
DKIM signature
pass
Download raw message
On Sun Dec 11, 2022 at 8:44 PM CST, Andreas Reuleaux wrote:

> Thanks for sharing these latests news:
>
>   Goodbye to the C++ Implementation of Zig
>   https://ziglang.org/news/goodbye-cpp/
>
> And this is great news for Zig, indeed!
>
> As there wasn't a means to comment on this article (it's not a blog),
> I take the liberty to add one comment here:
>
> To the various possibilities mentioned in the solutions space there:
>
>   Don’t self-host
>   Use a prior build of the compiler
>   Compile the compiler to C code
>   Compile the compiler to C code exactly once, but clean it up and maintain it directly from then on
>   Compile the compiler to a simple virtual machine - and Web Assembly in particular (the method chosen)
>
> I would like to add one more possibility - I have no idea, if this is
> feasable for Zig at all (with Zig depending on LLVM) or if it's worth
> exploring at all (now that this web assembly idea works) - but
> nevertheless - maybe it's worth looking into:
>
> Idris (Idris 2 i.e.) is self-hosting by compiling itself down to Scheme, and using that
> Scheme-code then to bootstrap: i.e. on installing Idris one compiles a piece of Scheme (I use racket
> typically, but I think Chez works as well), which was created before from the Idris code: this is
> readable code (but nevertheless tedious to read). - And Idris folks claim that this is faster than their C backend!
>
> Again: I have no idea, if this could be helpful for Zig as well.
>
> Thanks,
>   Andreas

AFAIU, Idris uses Scheme as backend the same way Zig uses C.  Thus this
is similar to option "Compile the compiler to C code", just using Scheme
instead of C.  For Zig to do this it would have to implement a Scheme
backend, and don't think anything would be gained in this matter.
Andreas Reuleaux <rx@a-rx.info>
Details
Message ID
<87h6y0w4qd.fsf@laptop>
In-Reply-To
<COZZUJEX08Z3.2N81A5C3HOSM6@debian> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
"Jose Lombera" <jose@lombera.dev> writes:


> AFAIU, Idris uses Scheme as backend the same way Zig uses C.  Thus this
> is similar to option "Compile the compiler to C code", just using Scheme
> instead of C.  For Zig to do this it would have to implement a Scheme
> backend, and don't think anything would be gained in this matter.


Well, it could be faster than the C backend: for Idris this is the case:

I remember one talk of Edwin Brady - being invited at some Scheme conference
(unusual!) - and explaining in some more details their motivations /
experiences of chosing Scheme over C.

(I would have to google for a link - and I am busy currently, sorry).

But then, the circumstances for Idris are different, of course,
and may not apply to Zig at all.

But still: maybe worth further exploring.

Thanks,
  -A
Anthony Carrico <acarrico@memebeam.org>
Details
Message ID
<481af379-1172-d5df-0f8e-8faa9a55707b@memebeam.org>
In-Reply-To
<87h6y0w4qd.fsf@laptop> (view parent)
DKIM signature
missing
Download raw message
On 12/12/22 19:02, Andreas Reuleaux wrote:
> I remember one talk of Edwin Brady - being invited at some Scheme conference
> (unusual!) - and explaining in some more details their motivations /
> experiences of chosing Scheme over C.

Memory >8Gig was the big problem for Zig (I had to plug external swap in 
to compile on my 8G laptop).

It seems like Andrew and Jacob used the only backend they had which 
wasn't target specific, and could be handily translate to C. It is 
clever, they can target any machine, but they don't need to store C or 
rely on an emulator to do it because they can hit the local C compiler.

I don't quite see the git bisect advantage, It seems like you would need 
a new WASM blob at exactly the same time you would need a new C blob.

In any case, Chez probably isn't that great for Andrew's data-oriented 
design techniques.

I did actually listen to Edwin Brady's talk when it came out, and Edwin 
was picking a handy choice for his own use case. The Chez scheme runtime 
is well optimized for mostly functional style, garbage collection, 
proper tail calls, continuations, etc., so a good fit for Idris2. Racket 
also switched to the newly open sourced Chez for the backend.

Interesting connection, Andreas. Thanks.

-- 
Anthony Carrico
Reply to thread Export thread (mbox)