GNU Guile 3.0
gnu.org
gnu.org
Previously I had been using macros to bolt-on support for definitions in expression context, but that was buggy at best. If you have time you should look at the algorithm behind this letrectification. The paper is called "Fixing letrec (Reloaded)" and can be found here: https://legacy.cs.indiana.edu/~dyb/pubs/letrec-reloaded.pdf
This means letrec is now just as fast as let, which means (define ...) at the top of functions now is as fast as (let ...). For small functions called often, that could add quite a bit of overhead.
I usually use Common Lisp and when I use a Scheme-like language I usually use Racket. However, projects likes Guile (great for scripting applications, the web framework is cool), Chez, and Gambit are much appreciated (I use them all, at least a few times a year).
I know that Lisp languages are not the best tool for every application, but using Lisp languages makes me happy so I try to use them whenever possible.
It's a little hard to include in my own designs though, as much as I'd like to do it. If I had a wish-list, it would be:
- Make some of the dependencies (especially libgc) internal.
- Reduce the installed size.
- Consider adding a license exception that allows using Guile without inheriting GPLv3's Installation Instructions requirement, which prevents inclusion on a lot of commercial products (even as a standalone program for running scripts).
The Guile team is doing great work, and I'll enjoy trying out 3.0 once it hits my distro packages. I just wish that it slotted better into more systems.
There's some humor in the idea that Guile started out with the stated goal of being a Tcl killer. Years later, a Guile install is almost 8 times the size of a Tcl install and it introduces significant external dependencies. The licensing is also worse for inclusion in larger systems.
Just a note from someone who was bitten by GNU make and guile integration last year. Huge numbers of systems have old make versions with no support for guile extensions¹, and many systems that do have new enough releases require a separate package² to use it.
And yeah, I'd written all my fancy integrations before figuring out they'd be worthless :/ It did allow me to noodle over the build system for long enough to come with some real improvements though, so it wasn't all wasted.
1. Some presumably to stay on pre-GPL3 make
2. make-guile on Debian for example.
I'm not sure what that says. `apt install make-guile` vs `apt install meson` don't seem all that different, if it is just about dependencies. I think that means your point on licensing is probably the bigger issue, or that perhaps I just picked the wrong day to open a PR with a guile extension…
Make's Guile extensions will probably never see widespread use until distro packagers compile them in by default. And distro packagers don't necessarily want to do that, because it would mean a bunch of extra dependencies (including ~100MB of Guile) just to compile a core build-tool.
If `make-guile` remains an optional (and incompatible) package distinct from vanilla `make`, users like us won't be able to rely on its availability. Which means it won't see big adoption by users. And many distros aren't interested in increasing `make`'s dependency footprint to support a userbase that doesn't exist because of chicken-and-egg reasons.
I've seen unofficial binary builds for windows but they are hard to find... and probably they use cygwin?
I wish Guile was readily available in other platforms (I wish their downloads page looked like this [1]...), but I'm guessing the main reason it is not is more philosophical than practical.
brew install guile
That's a bottle though. I don't know if it's hard to build but it isn't hard to install.Huge number of complex and extremely platform-specific dependencies and modules, like garbage collectors, foreign function interfaces, native code generators, etc, etc. All inherently very platform-specific, fragile, and dependent on specific tooling. Very much not plain C code.
It is not unique to guile either. Compiling things on Mac os brings back memories from Redhat 8. I have had so much more luck with WSL or even cygwin than Mac os for at least a dozen open source apps.
From the Emacs side I strongly doubt it will happen. The discussions that have been going on for faaaar less intrusive changes is staggering. Reading the discussions about the portable dumper (new in the upcoming emacs 27, proposed in 2014) is a nice 4 hours. That was in just about every measurable way a step forward for Emacs, yet it took almost 4 years for it to be mainlined,despite glibc more or less deprecating the old unexec from under emacs' feet.
I might be misrepresenting just about everything here, but one thing I am pretty certain of: guile Emacs will never happen, despite the promises of running elisp on guile.
While this may be the case, my understanding was that once the codebases were combined and guile-emacs builds were brought online, they encountered a severe performance drop from vanilla Emacs due to back-and-forth string conversion between Guile's Unicode strings and the Emacs internal enhanced string type. I thought that the project was abandoned after finding no obvious resolution to the problem short of a complete rewrite of all Emacs string handling.
> guile Emacs will never happen
Universe heat death is still far away, there's always hope.
-- JavaScript/Typescript for in-browser or even some server-side stuff (e.g., NodeJS)
-- Python seems to be dominant for non-browser code that doesn't need to be fast (or which needs to call Python libraries)
-- C/C++/Rust/C# in the performance space
-- And then the workhorse Bash/ZSH etc for command-line script-fu
I am sincerely asking, what's the nice good fit for a Lisp these days? I know Emacs uses it as its internal language -- fair enough. But other than that.
Thanks and I did not mean to hurt anyone's feelings, I just really am curious.
<stands on soapbox>
Scheme: fix your damn documentation
I have to know that SRFI (scheme request for implementation) is a thing. Then I have to look over hundreds of them to find the one I want (do I want SRFI 69, 90, 125, or 126 for hash tables?). Then I have to find that obscure doc somewhere that says which SRFI are supported. Then I have to read the specification doc as the only source of documentation on https://srfi.schemers.org/.
Also quite good for building small programs with no/minimal depencies from scratch. Which I suspect reduces to my first statement...
If you made the same kind of list of 4 languages that dominate all use cases back in 1990 (say), Scheme wouldn't have made the list then either; BUT the 4 languages would be different than they are now. If you want the most frictionless and popular language for the tech stack of the moment, use the trendy language du jour, but you have to live with neverending churn. If you want a language that is perpetually "good enough," use something like Scheme.
There are use cases where longevity and inoffensiveness are important. Embedded scripting, the original motivation for Guile, is one of them. Scheme is my go-to for little personal utility programs. After a long day of dealing with headaches from trendy environment du jour, I want to come home to something that's bulletproof, just works, and I already know. The minimalism and clarity make it a good first learning language. It seems like it'd be good for code "for the ages" like reference implementations and government software, but AFAIK there hasn't been much of that.
and CL can be super performant btw.
CL allows for live/REPL programming, unmatched elsewhere, and still has features not found elsewhere too. Happy discovery!
Since these dumps turn out to be s-expressions, it seemed like a good idea to do further processing using a Lisp. I picked Racket (a Scheme) and it was great: parsing was a no-op, and the language made recursing through the structure and pattern-matching on the contents really simple.
The only downside was that I wrote a lot of "contracts" (dynamically-checked types), since I'm more comfortable in statically-typed languages (Haskell, StandardML, etc.). Turns out that Racket contracts are REALLY slow, so I ended up using a macro to discard them unless we were running the test suite :(
I prefer typing and less flexibility on larger projects, but Guile is my go-to for for small/medium programs.
Great to see good work being done on this.
Or you can learn autotools and do it yourself, but I don't recommend opening that can of worms.
Further, if I try naively $ sh -x ./autogen.sh then that fails on a dependency on libtoolize, of which I never have heard of and which doesn't seem to be known to bananian.
Agreed that the README needs much better documentation of the package-time dependencies (autoconf, automake, m4, perl, etc), and the build-time dependencies (libtool, libgc, plus a bunch of other libraries).
$ sh -x ./autogen.sh completes successfully and I got a ./configure and a INSTALL file (don't recall having seen an INSTALL file be autogenerated, but my memory might very well be failing me there). The './configure' also completes successfully (after a while -- seems like autoconfigure still believes that there are other Unices besides Linux left ;-} but 'make' eventually fails with
--8<-- [..] CC libguile_3.0_la-intrinsics.lo CC libguile_3.0_la-ioext.lo CC libguile_3.0_la-jit.lo jit.c:232:1: error: initializer element is not constant static const jit_gpr_t THREAD = JIT_V0; ^ jit.c:237:1: error: initializer element is not constant static const jit_gpr_t SP = JIT_R0; ^ [..] -->8--
I'll try again with 3.1 ...
I used the release from https://ftp.gnu.org/gnu/guile/guile-3.0.0.tar.gz (linked from https://www.gnu.org/software/guile/download/ )
It's a release file so it includes the configure script out of the box. To install the build dependencies:
sudo apt-get install libtool libgmp-dev libiconv-dev libltdl-dev libgc-dev libffi libffi-dev libunistring-dev pkg-config
After running sudo make install I tried to run guile, but it complained about not finding a .so file. A symlink fixed it: sudo ln -s /usr/local/lib/libguile-3.0.so.1 /usr/lib/
After this, it worked. Perhaps fire up a fresh Bash for good measure.Unrelated: I can't use the history in the Guile REPL though - if I press the up key, I get garbage rather than my previous line.
sudo apt-get install -y libtool libgmp-dev libltdl-dev libgc-dev libffi-dev libffi-dev libunistring-dev pkg-configI have been following along since you first picked up Guile and began running with it.
Displacing badly-designed, slow scripting languages is the natural home for Lisp, and Guile is the right vehicle for it.
[0] https://wingolog.org/archives/2019/05/24/lightening-run-time...
[1] https://www.gnu.org/software/guile/docs/master/guile.html/Ju...
Now that Scheme runs faster I get to write more Scheme and less C and I couldn't be happier.