News for hackers. Stuff that matters.
Re:GNU Shepherd 1.0.0 Released by uludag on Tuesday January 14, 2025 @01:28PM (#42701572)
I think this may be just due to unfamiliarity. Like, if that mess you shared was written as follows:

  {
    start: makeForkexecConstructor(["…/bin/ntpd", "-n", "-c", "/…/…-ntpd.conf", "-u", "ntpd", "-g"]),
    logFile: "/var/log/ntpd.log"
  }
this wouldn't bat an eye. Even though I've never used Guile, just familiarity with Elisp makes that example pretty straightforward. Lisp-adjacent people would all pretty quickly grok this I presume.

And I think it's also hard to claim that one is better than the other. I personally have gotten my feet wet with Guix and I would love the time to become more familiar it.

Re:GNU Shepherd 1.0.0 Released by packetlost on Tuesday January 14, 2025 @03:11PM (#42703147)
Eh, I'm a Schemer (not Guile though) but the above is dramatically less readable and, at a glance, understandable than the equivalent systemd .target file. The problem with Lisps (but especially Schemes) is there's magic everywhere that makes no sense without having a sizeable context of the program you're working in.
Re:GNU Shepherd 1.0.0 Released by Bootvis on Tuesday January 14, 2025 @03:52PM (#42703678)
IMO in this example there seems too be to little magic.
Re:GNU Shepherd 1.0.0 Released by yencabulator on Tuesday January 14, 2025 @04:39PM (#42704259)
I would definitely bat an eye at "make fork exec constructor", regardless of what syntax sugar you sprinkle on that abomination.
Re:GNU Shepherd 1.0.0 Released by ebilgenius on Tuesday January 14, 2025 @06:32PM (#42705418)
While I agree it's hard to claim one is outright better than the other and there are a lot of factors that go into it, I do feel it's important to toss my chip in as someone who's not familiar with Lisp, Scheme, or any other functional language that I find it's syntax and layout particularly difficult to parse, let alone get started with compared to say, the INI-inspired systemd conf files. I can detail why but the mere fact that I'd have to learn an entire functional programming language (no matter how "easy/simple" it's claimed to be) to be able to competently edit a service file is a huge immediate turn-off for me.
Re:GNU Shepherd 1.0.0 Released by Pay08 on Wednesday January 15, 2025 @03:35PM (#42716567)
This is very basic Scheme syntax (plus Guile's keyword argument extension), nothing advanced and definitely not all of Scheme.
Re:GNU Shepherd 1.0.0 Released by rmgk on Wednesday January 15, 2025 @05:37AM (#42709444)
I don’t think this is about lisp syntax.

The systemd variant uses one of the universal DSLs for key-value pairs (key=value) and the universal DSL for calling programs (program name, space separated list of arguments).

The latter is even the same syntax that lisp uses for functions calls – thus I would argue the systemd config file looks more like a lisp program than the Guix version does.

As a person that has seen a reasonable amount of sexpression, this is what I would not bat an eye at:

(start /path/to/ntpd -n -c /etc/ntpd.conf -u ntpd -g)

Re:GNU Shepherd 1.0.0 Released by Pay08 on Wednesday January 15, 2025 @03:34PM (#42716545)
It is also strictly less powerful because of that, often needing to launch bash scripts instead of the programs directly.
Re:GNU Shepherd 1.0.0 Released by rmgk on Thursday January 16, 2025 @11:50AM (#42727707)
I understand this as systemds config being less powerful than using Guile?

If so, I fully agree, on the config being less powerful.

Maybe let me add to my original argument, because it does not seem to make it’s point well.

I think that it would be feasible (and worthwhile) to simplify the configuration structure while keeping Guile syntax, and have the complaint be a non issue. As opposed to keeping the semantic structure and just changing the syntax as the comment I replied to proposed.

Re:GNU Shepherd 1.0.0 Released by bmacho on Wednesday January 15, 2025 @07:11PM (#42719147)
> and the universal DSL for calling programs (program name, space separated list of arguments).

Yeah, don't do that. Both the program name, and the arguments can and do contain spaces. Do instead what every other languages do, that is, use a list of strings to invoke programs.

> The latter is even the same syntax that lisp uses for functions calls

No it's not.

Re:GNU Shepherd 1.0.0 Released by rmgk on Thursday January 16, 2025 @12:49PM (#42728449)
The way that this syntax (see bash, zsh, fish, etc) usually work is that these lists are separated by spaces. You can still quote arguments if they contain spaces (or escape the spaces).

Choosing space for a very common thing in your language often makes sense, as you reduce the amount of visual elements. Thus space is often used to apply arguments to functions. Lisp and Haskell are common examples Though, you could argue that in Lisp it only is an application if it is within parenthesis.

Re:GNU Shepherd 1.0.0 Released by kazinator on Thursday January 16, 2025 @04:31PM (#42731155)
Lisp looks like it uses spaces, but that's only when we look at certain kinds of tokens that are terminated by whitespace, like numbers and symbols.

So (ls -l .foo) is a three element list of symbols in Common Lisp or Scheme, sure.

Symbols are not strings though; we don't necessarily want to use symbols this way. For one thing, they get interned. That means they stick around forever, or until explicitly uninterned. The symbols are memorized so that the next time they appear, the same object is returned (almost always implemented as a pointer to the same symbol).

String tokens use mandatory double quotes: ("ls" "-l" ".foo")

Re:GNU Shepherd 1.0.0 Released by bmacho on Friday January 17, 2025 @03:29AM (#42735275)
> The way that this syntax (see bash, zsh, fish, etc) usually work is that these lists are separated by spaces.

And programming languages that have variables, string type, and function calls do the opposite. In C, Python, JavaScript etc, in order to start a program you make a function call with a list of strings.

> Choosing space for a very common thing in your language often makes sense,

Not interpreting space separated things as strings but as keywords (built ins, variable names, literals) makes more sense for bigger programs.