Open adlai opened 2 years ago
In my entirely non-authoritative opinion, it seems like it belongs in "Language extensions" alongside libraries like trivia
.
"Language extensions" seems to be where control flow constructs are located, and this seems like it's intended to be a control flow construct (rather than a text processing routine).
I do wonder why they chose string literals and not keywords, but that's a different question entirely!
it seems like it belongs in "Language extensions"
agreed.
But of course, we can create and re-arrange categories.
ps: for a simple version, see str:string-case
ps: for a simple version, see str:string-case
link (pinned to one specific commit, to avoid breaking when you update the repository)
I do wonder why they chose string literals and not keywords, but that's a different question entirely!
The more I've used it, the more it seems to me to simply be an intermediate primitive, similar to how implementors might lean upon cl:tagbody
for implementing more complicated constructs; and for an intermediate, it's nice to avoid the extra code cruft of dealing with packages. I do realise that if it's an interface macro, then keywords are nice, because they save one character; and if you're really gone golfing, let any symbol get used, with some keyword options in the switch form [i.e., some keyword within the form immediately following the string-case
symbol] to allow for optional including of qualified names instead of only the cl:symbol-name
.
Please note that I am not (yet!) nominating this library for inclusion, due to the lack of obvious categorisation.
It exports one symbol, similar to the
cl:case
macro, for matching string literals; and I must admit that it is quite a low-level library, and most folks these days would probably complain that it's not a complete reimplementation of the Glasgow Haskell Compiler.