[Nix-dev] Compiling Nix code
Michael Raskin
7c6f434c at mail.ru
Thu Feb 25 15:39:06 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 02/25/2010 04:38 PM, Ludovic Courtès wrote:
>> Or you compile to some byte-code representation
>> where variables point to closures in the heap that are overwritten by their
>> normal forms when entered. I'm sort of leaning towards that approach (compile
>> to Parrot or Guile or whatever).
>
> Of course, I’m somewhat biased as to which solution you should choose
> ;-), but here’s how it could work with Guile:
>
> - There’d be a compiler front-end for the Nix language. It would
> compile to the ‘Tree-IL’ language, which is roughly residual Scheme
> code after macro expansion [0].
Now what is the benefit of not compiling into Scheme code for an actual
compiler?
> - The lexer and parser themselves can be translated from Flex/Bison to
> SILex [1] and ‘parse-lalr’ [2].
Or just used as is in a shared library. Less changes - less bugs in
transition to hunt.
> - Since Tree-IL is call-by-value, parameters in a function call would
> need to wrapped in a R5RS ‘delay’ form or rather a SRFI-45 ‘lazy’
> form [2]. If need be, promises can be made more efficient by adding
> special VM support.
Fortunately, that can be done in any Scheme and in many functional
languages.
> - Attribute sets could be implemented on top of Bagwell’s vlist-based
> hash lists, a purely functional dictionary type [4].
Why not use whatever hashtable performs best? Obviously, Nix code will
not be able
> As a bonus Nix programs would be able to use other Guile libraries.
> Imagine yourself writing a multi-threaded, Unicode-capable, GTK+ or
Unicode-capable? Please make Unicode-capable version of Guile the
default in Nixpkgs. (string-length "я") -> 2.
Yes, guile_1_9 just fails on this test in a UTF-8 locale.
mzscheme and ikarus handle this correctly - just in case anyone cares.
Among Lisps sbcl, clisp and ecl also handle this as they should.
> networking app in Nix! :-)
Great. There goes reproducibility. I thought about adding new
possibilities to Nix to enable loading shared libraries long ago, but
never found a way to check that it will not add too much randomness into
evaluation.
Why would I want to write a GUI application in Nix??
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJLhouJAAoJEE6tnN0aWvw3RQIH/Azk1gjCljBIgZiY7HBS7juv
gFOaOhjoHLxWnAfLoAjUycBndkEUMBziDaPXwPQHlGydBVXVkEP/TxxOWzgl5Oly
4weT3fYB2LxRyhzi/i/tgRqzHGMUK1jmu9VhR8SkP9MhjiPrlRfcbcT5kYHeE+pB
oRfy678D3lG58aGp7C0QGSjACmwJ/oM7059osEB05RdMOFObxCRjZoBl4kL2pt79
zPKIewQ4LsTxTry2DGerDE0rM7zxuIyoa4LcxuAIB3YfNqq3+3P9HTPkES/4T2ig
QHp4nqEVmL5I57NpGmnLb6WvYrsKTmkFd0psHDd7ErWuDKZVU5zumvn7xMFVH0E=
=qaeg
-----END PGP SIGNATURE-----
More information about the nix-dev
mailing list