libera/#commonlisp - IRC Chatlog
Search
23:29:14
mathrick
which is pretty much what FORMAT / printf are. A specialised interpreter for a very limited (or not so much in the case of FORMAT) embedded language
23:30:01
mathrick
_death: for the same reason aeth wants to exclude ~/ from the language understood by the localisation, since it can open you up for arbitrary code injection
23:31:52
_death
well, I don't immediately see why it needs to protect against "arbitrary code injection" or be limited.. but it could if you wanted to constrain it that way
23:33:07
mathrick
because localisation shouldn't crash your code and allow people to steal credit cards :)
23:33:45
mathrick
so if we're talking localisable text that you ship off to people who aren't necessarily programmers, then it's a useful/necessary constraint to have
23:33:51
_death
if you trust it enough to display something to the user, it is possible that such trust extend to running code
23:34:15
mathrick
that is actually already the case with gettext() in C, it can crash if the localisation messes up the arguments
23:34:44
_death
if you just have a translator wiki that anyone can edit.. sure, probably better to constrain :)
23:34:46
Alfr
mathrick, if you localize and ship yourself, then the format string isn't of concern. (Unless you're malicious.)
23:36:23
aeth
mathrick: sure, you can add seconds since last edit and the number 17 to the end, space separated, too :-p
23:40:45
mathrick
Alfr: that's again a lot like the win9x way, which wasn't great. I like the fact that I can install arbitrary languages for my apps through apt and it just works. Localisations are not of trivial size once you're starting to talk 95+ different languages for something the size of Firefox or Libreoffice
23:41:38
_death
anyway, it reminded me of old parmenides (a project from 1990) localization approach.. it uses format control strings too.. https://github.com/death/Parmenides/blob/master/src/frk/fr-messages-esp.lisp
23:43:05
Alfr
mathrick, not that size itself is really of concern, producing the text is cost prohibitive enough that you won't do that.
23:44:45
Alfr
mathrick, assuming the king of information you want to output is fixed, associating with every tag a permutation will get you very far already.
23:47:15
mathrick
_death: heh, yeah. FORMAT certainly wasn't made *for* localisation, but it does work for it if you stay away from ~:R and its ilk
23:47:45
mathrick
oh man, I forgot that FORMAT can not only do Roman numerals, but also old Roman numerals
23:50:59
_death
anyway, localized output is not the only output a program my generate.. for example I used OUT to generate (non-lisp) source code in adhoc semi-structured way
23:54:10
_death
some years ago I talked about it in this channel and pasted https://gist.github.com/death/4e273d14e671a3c64f3be10cab2aa1b2
0:08:35
_death
and looking at that old conversation, it was pretty similar to the one we just had :)
0:47:45
_death
mathrick: spent a few minutes before sleep to do this https://gist.github.com/death/b793fd31c212f9a0c55e573b86884bfc
0:53:29
_death
if COMPILE is too much, you could of course switch to a more limited interpreter/compiler