Hacker News new | past | comments | ask | show | jobs | submit login

I like the idea a lot, although the kind of people who don't like shell scripts for init would likely flip completely out at packages using guile lisp rather than some obscure DSL, and then parenthesis-ophobes are going to react very poorly to the libgit2 extended example ending in four closing parenthesis. A little diversity in thought might be a good thing of course.

An init system written entirely in Guile LISP is interesting to think about. I'm old enough to (barely) remember the 80s lisp machines and since all modern CS/IT progress is re-implementing stuff from four decades ago, we're about due for something like linux ported from C to clojure or another lisp with a new init and the guix packaging system written in guile-scheme-lisp. The idea of an OS written to run on a JVM instead of virtualization like vmware is intriguing. I can come up with enough bright ideas in five minutes to keep me busy for fifty years, so this daydreaming is all very unlikely to happen.




An init system written entirely in Guile LISP is interesting to think about

https://www.gnu.org/software/shepherd/


From the documentation:

> The daemon that runs in the background and is responsible for controlling the services is shepherd, while the user interface tool is called herd: it’s the command that allows you to actually herd your daemons

It seems strange the the herd controls the shepherd, but I guess it fits in well with GNU's user empowerment philosophy.

I'm very much a parenthesis-ophobe, but things like init configuration is a niche guile seems to be perfect for. It's terse enough to replace ini's, it's complex enough to provide structure like xml or json, it's an actual language so no one ends up writing their own and it's trivial to embed, like like lua.


I always thought of the `herd` command as a verb (i.e. what do shepherds do? they `herd` things [well, sheep, I suppose]).



And Shepherd is very pleasant to interact with.


The funny thing is that a DSL looks aesthetically pleasing but is more often than not a nightmare to work with.

Lisp itself is a DSL, it's completely unconstrained by common syntactical conventions (whitespace, block scopes, etc.) and the worst anyone can take away from that setup is that it requires typing ')' too much. Yet there are so many tools invented entirely to manipulate Lisp code so you don't need to rewrite editor plugins and what-not to get fresh syntax highlighting and completion for your brand new language.

Because it's also a programming language, it already supports functions and other constructs for abstraction and code reuse, should you need them for larger scripts with lots of boilerplate.

But tend to reject it and the already done work because of the aesthetics, and then we're going into the GitHub repos for things like Helm, Kubernetes, Terraform, etc. because the custom YAML/JSON-esque templating setup misses vital features and we're having to re-learn the same stuff over and over again.


One thing that puzzles me is that many people who complain about parenthesis are perfectly willing to deal with strange and inconvenient delimiter characters, such as semicolons and commas.


Typically commas and semicolons don't have to be matched with open-commas and open-semicolons and you won't see several of them together like ';;;;'. There is a lot less ambiguity over what is ending than something like this example (worst case) from TFA:

> (lambda _ (for-each make-file-writable (find-files "." ".*")))))))

',' and ';' are far more convenient too, the sit right next to m and l, parenthesis require finger stretching and the shift key.


> Typically commas and semicolons don't have to be matched with open-commas and open-semicolons

This is a problem that is non-existent when you use common tooling to write Lisp, like ParEdit or Smartparens. Since nobody would write C++ in Microsoft Word, nobody writes a lot of Lisp code without auto-matching parentheses tools.


I'm using paredit, so I'm never typing out closing parentheses. I'm just slurping and barfing s-expressions all over the place. I don't see parentheses but syntax units that my editor ensures remain correct.

(I can understand the frustration if I was forced not to use Emacs, which has s-expression navigation commands, and if the use of paredit were forbidden.)


It's the great advantage of Lisp syntax that it supports structural editing in a complete and unified way, and paredit enables the leap from editing code by manipulating plain lines of characters to directly editing code as hierarchical structure.


What C and its descendents have instead is numerous repetitions of '\s}\n' to end

if-then-elseif-else switch-case for while until functions methods classes

and good luck figuring out which matches which when there's more than a screen between the beginning and the end of a block


> parenthesis-ophobes are going to react very poorly to the libgit2 extended example ending in four closing parenthesis

I think parenthesis-phobia is a red herring. The delimiter bytes in s-expressions denote structure, and most s-expression users are happy to render them as parentheses glyphs. Those who aren't are welcome to use one of the myriad preprocessors/renderers which display this structure in other ways, e.g.

https://srfi.schemers.org/srfi-119/srfi-119.html#Implementat... (converts back and forth to indentation)

https://srfi.schemers.org/srfi-110/srfi-110.html#reference-i... (converts back and forth to indentation)

https://srfi.schemers.org/srfi-49/srfi-49.html#Implementatio... (converts back and forth to indentation)

https://sourceforge.net/p/readable/code/ci/develop/tree/src/... (converts to indentation; an 'unsweeten.sscm' script converts the other way)

https://github.com/mjsottile/sfsexp/blob/master/src/sexp_vis... (converts to a graphviz tree diagram)

http://www.foldr.org/~michaelw/emacs/mwe-color-box.el (shows tree structure using nested boxes of different colours)

The fact that such tools aren't widely used shows that parentheses aren't a/the problem.


Another Guile component is mcron[1] which allows cron jobs to be scheduled using Lispy syntax as well. I have, for instance:

  ;; fetch mail via isync/mbsync for mu/mu4e every 5 minutes
  (job '(next-minute (range 0 60 5)) "/home/$USER/.guix-profile/bin/mbsync -a")

  ;; run backup every hour
  (job '(next-hour (range 0 23 1)) "/home/$USER/.local/bin/borg-backup.sh")

[1]: https://www.gnu.org/software/mcron/manual/html_node/index.ht...


If you want to know why mcron as opposed to cron, you only need to look at the introduction: https://www.gnu.org/software/mcron/manual/html_node/Introduc...


I still wish there were a few more examples of actual guile cron jobs, but there is one example which illustrates the power of using guile for defining cron jobs in the 'every second Sunday' example:

  (job (lambda (current-time)
         (let* ((next-month (next-month-from current-time))
                (first-day (tm:wday (localtime next-month)))
                (second-sunday (if (eqv? first-day 0)
                                   8
                                   (- 14 first-day))))
           (+ next-month (* 24 60 60 second-sunday))))
       "my-program")


> the kind of people who don't like shell scripts for init would likely flip completely out at packages using guile lisp rather than some obscure DSL

Do you mean people used to systemd specifically or does this also include runit, s6, etc.?

> parenthesis-ophobes are going to react very poorly to the libgit2 extended example ending in four closing parentheses

Though, of course, for humans reading Lisp, the trick is not to focus on the parentheses too much, but use the indentation. And then use the parentheses as a sort of double-sanity check as you move your editor's point/cursor across them and see the other member of the pair light up (assuming a sane lisp editor/editor configuration).

(And maybe: parenthephobes?)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: