Environment variables and other alists with string keys
Lassi Kortela 03 Dec 2019 15:10 UTC
Here's a comprehensive set of readers using different tools, all
producing equivalent results:
<https://github.com/lassik/srfi-176/tree/for-draft-2/implementation>.
It's capable of parsing nested sublists like these:
(platform (computer x86-64) (endian little))
(c-type-bits (int 32) (long 64) (pointer 64) (size_t 64))
That relies on those sublists not having strings, so that the parser
doesn't have to worry about parentheses inside double-quotes and things
like that.
One thing that still bothers me is that that syntax can't do things like:
(environment ("TERM" "screen") ("LANG" "en_US.UTF-8"))
(java-system-properties ("java.vm.name" "OpenJDK 64-Bit Server VM"))
Those lists could be flattened:
(environment "TERM=screen" "LANG=en_US.UTF-8")
(java-system-properties "java.vm.name=OpenJDK 64-Bit Server VM")
Or written on multiple lines, but that would cause other problems:
(environment "TERM" "screen")
(environment "LANG" "en_US.UTF-8")
(java-system-properties "java.vm.name" "OpenJDK 64-Bit Server VM")
(java-system-properties "java.vm.version" "12+33")
Opinions?