Hi devs & users,

I have a pending commit changing the treatment of settings in script
files. I'd like to discuss a bit about the new choices before
commiting -- also, I'll be away during the week-end, so I wouldn't be
here to fix my mistakes if there are any.

Currently, settings are done via "set THIS = THAT", only at the
beginning of a script (after inclusion expansion) and where THAT must
be a ground value. It is impossible for example to use argv(1),
system("bla") or even 1+1.

I propose to add a set() function to the API (of type (string,
'a)->unit where 'a is bool, int, float, string or [string]). The
syntax would then become set("THIS",THAT) with quotes around THIS, but
full flexibility on what THAT can be. And of course, this can now be
done at any point in the execution of the script.

(Note that it also becomes possible to change a setting dynamically.
This side effect is not so useful. For most settings, this could be
misleading since a runtime change would at best have no effect, and at
worse lead to inconsistencies. I didn't see much settings that could
be dynamically changed: only tag.encodings. Slight modifications could
allow a dynamic modification for root.max_latency and root.sync. I
don't know about mpd/harbor/log stuff.)

What do you think ? Do you like the syntax, the new possibilities ?
Are you afraid of the side effects ? I think it'd be good to do the
change now.
-- 
David

PS: By the way, the settings page on the wiki is becoming useless as
liquidsoap is auto-documenting its setting correctly now (maybe we
should generate the page from the liquidsoap output just as for the
reference).

Répondre à