IRC channel logs

2017-10-06.log

back to list of logs

<laertus>very interesting article
<laertus>i'm wondering why the bootstrap step uses an interpreter rather than a compiler
<laertus>if the goal is to build a compiler, why not just start by building a compiler?
<laertus>the interpreter is in C anyway, so why not start with a compiler in C?
<dsmith-work>Because the compier is written in Scheme, and there is no system Scheme compiler.
<laertus>but couldn't there be a bootstrap compiler written in C?
<dsmith-work>Double the work.
<laertus>how so?
<laertus>i mean just a minimal one, not a full-blown one
<dsmith-work>You need to write the same compiler twice.
<dsmith-work>Once in Scheme, once in C.
<laertus>then why not object to having to do twice the work on the interpreter
<laertus>the article says "In our case we do a half-bootstrap, first building an interpreter in C, compiling the interpreter in Scheme, then bootstrapping off that."
<laertus>it sounds like double the work is done on the interpeter
<dsmith-work>At one time, Guile was all C. Slowly moving to more and more Scheme.
<dsmith-work>and stripping down the C code.
<laertus>i understand the desire to use less C and using more Scheme
<laertus>but i just don't understand what using the interpreter first buys vs just going to a minimal compiler right away.. a bootstrap compiler
<laertus>i'm not suggesting having the final scheme compiler in C.. but just the bootstrap one
<laertus>so the duplicate work is minimzed
<dsmith-work>That'
<dsmith-work>s basically what we have now.
<laertus>except there's the interpreter step
<dsmith-work>Well, you'd need to ask wingo about it. I'm pretty sure he doesn't want to put any effort into C code.
<dsmith-work>s/into/into adding more/
<dsmith-work>I know it's hard. All that time building the initial compiler. The mind tries to think of things to make it better.
<laertus>i'm just trying to decrease global warming... :)
<laertus>hmmm... interesting comment in that article: "Bootstrapping Gambit from source takes about 3.5 minutes on a modern machine."
<laertus>"A gambit-hosted guile compiler should be able to compile the guile sources in a blink of an eye."
<davexunit>I bet they do not understand the situation fully enough to make that statement
<davexunit>you can compile guile releases without bootstrapping the compiler
<davexunit>the release tarballs have the pre-built modules
<davexunit>you only do the full bootstrapping process when you are building from a git checkout
<davexunit>guile is the only scheme I know about that can be compiled without using a pre-built version of itself.
<davexunit>maybe gambit can, too, I dunno. but guile's long bootstrap process has good reason behind it.
<davexunit>using gambit to compile guile would be really sad. it would mean that guile isn't good enough for itself.
<laertus>davexunit: another approach could be to learn whatever gambit's doing in this case and apply it to guile
<davexunit>sure, if it really is the same thing.
<laertus>if in fact there is anything relevant to learn from it that guile's not already doing
<davexunit>I'm skeptical.
<laertus>right
<laertus>skepticism is good
<davexunit>people told me that chicken does the same thing but much faster, but when I looked into it I discovered that it was completely different.
<davexunit>if there are things to steal from gambit then we should steal them :)
<laertus>agreed :)
<laertus>what about stalin?
<laertus>i keep hearing about how incredibly fast it is.. faster than C even
<davexunit>I know nothing about it.
<davexunit>except that it's not very practical to use.
<laertus> https://github.com/barak/stalin
<davexunit>with a more advanced linker guile ought to be able to do some "whole program" optimization like that
<laertus>stalin's probably not considered very practical because it only supports a subset of R4RS
<laertus>but for a first-phase bootstrap compiler you might not need very much
<davexunit>I don't think it makes sense to use another scheme compiler to bootstrap guile
<davexunit>because it doesn't solve the bootstrapping problem
<davexunit>it just pushes the problem to the other compiler you used to bootstrap it
<davexunit>guile is its own language, it's not "just" a standard scheme, so it's highly unlikely that it would work anyway.
<laertus>again, you don't necessarily have to use stalin itself, just maybe ideas from it to do something similar, if it's possible and if it offers a performance increase
<davexunit>stalin is very slow in terms of compilation time
<davexunit>it produces fast native code.
<davexunit>at the expense of spending huge amounts of time optimizing
<laertus>is it slower than the guile bootstrap interpreter, though?
<davexunit>not sure
<davexunit>but there's a chicken and egg problem
<laertus>also, if might be possible to cut down the optimizations that stalin does and still get a performance boost, i dunno
<davexunit>if you could just use a compiler to start out with, the problem wouldn't exist
<laertus>why couldn't you? that's what i don't understand
<davexunit>because you would need an already built version of guile
<laertus>but why don't you need an already built version of guile for the bootstrap interpreter?
<laertus>why is it possible to bootstrap with an interpreter but not a compiler?
<davexunit>the bootstrap interpreter breaks the cycle
<laertus>why couldn't a bootstrap compiler break the cycle?
<davexunit>it would require writing a separate compiler in C
<davexunit>completely different than guile's regular compiler
<laertus>just like it requires writing a separate interpreter in C
<laertus>for the bootstrap interpreter
<davexunit>one is far simpler than the other
<laertus>i see
<davexunit>the interpreter is very simple by comparison
<laertus>so guile's really choosing simplicity over performance
<laertus>as far as the bootstrap process is concerned, anywy
<davexunit>I don't think anyone is volunteering to write a completely separate compiler in C
<laertus>ACTION nods
<davexunit>users compiling guile don't even have to deal with this because the release tarballs have a prebuilt bootstrap compiler
<laertus>i'm building from git source, though
<davexunit>yeah
<laertus>so i definitely have to wait.. and wait.. and wait..
<davexunit>so you're hacking on guile
<davexunit>so waiting is the name of the game
<davexunit>once you do it once you'll rarely have to do it again
<davexunit>unless you are hacking on the compiler itself
<davexunit>then you might have to rebootstrap some subset of the compiler
<laertus>by the way... i keep seeing the guile log show stuff like: BOOTSTRAP GUILEC ice-9/eval.go
<laertus>or: BOOTSTRAP GUILEC ice-9/psyntax-pp.go
<laertus>what's the ".go" extension for?
<laertus>that's not the Go language, is it?
<nee`>laertus: .go stands for guile object
<amz3`>o/
<OrangeShark>happy friday!
<dsmith-work>Happy Friday, Guilers!!
<dsmith-work>Yey!
<civodul>hey hey!
***benq is now known as benqq
<akkad>ACTION needs help porting a simple scheme script
<amz3`>akkad: what is a the question?
<akkad>I guess if this is doable in guile https://github.com/kunabi/read-ct
<akkad>will rtfm
<amz3`>akkad: question?
<akkad>ENOTINTERATIVE
<akkad>nope
<akkad>oh I see. no zlib support in guile-lib
<OrangeShark>akkad: https://github.com/davexunit/guile-zlib
<davexunit>I wrote that quite a few years ago. hope it still works! patches welcome, if not!