IRC channel logs


back to list of logs

***ft_ is now known as ft
***fangism is now known as fangism-ctrl-Z
<nalaginrut>morning guilers!
<saul>Is there a means to instruct the Guile reader to accept escaped apostrophes within strings? E.g., "hello, saul\\'s world"
<daviid>"hello, saul\\\\'s world"
<saul>daviid, I would prefer to not have to modify the source file. I am using Guile to parse pre-existing .scm files.
<taylanub>saul: are these sources for another Scheme implementation or so ?
<saul>taylanub, yes. I wish to automatically process them with Guile. Not hand edit them.
<saul>So I'd like the reader to accept and ignore the (unnecessary) backslash before the apostrophe.
<saul>It also seems that Guile should not be generating an error for unrecognized escape sequences in string constants.
<nalaginrut>When people handle Scheme the powerful weapon, they prefer write a new language with it, include me LOL
<civodul>Hello Guilers!
<ijp>merry wednesday
<nalaginrut>happy Wednesday, tomorrow is holiday~
<taylanub>saul: do any of the Scheme standards specify a behavior for that situation ? I'd say throwing an exception isn't worse than any other arbitrary choice :\\
<saul>taylanub, R5RS (to my knowledge) only specifies behavior for \\" and \\\\ -- I will have to investigate R6RS and R7RS.
<ijp>taylanub: I don't think so
<ijp>saul: there is no read option for this
<saul>In my opinion, producing an error makes Guile less useful for parsing generic files.
<ijp>read is not a parser for generic files
<ijp>never has been, never will be
<wingo>ijp is right, if a bit grumpily so :)
<ijp>adding this behaviour would not be particularly difficult, but it may not be wise
<ijp>every future escape sequence would break backwards compatibility, although having said that, how often do we do that?
<ijp>one recently for r7rs, but that is just an instance of the above behaviour
<saul>ijp, any escape sequence added in the future would break things either way.
<ijp>not so
<ijp>as you've already seen \\FOO does not work for arbitrary FOO
<ijp>so adding \\FOO breaks no old programs, which won't be using it
<ijp>if you pass a file containing \\FOO to an old program that uses READ, you'll get an error, just like they do now
<taylanub>saul: it's unlikely that someone would write a program that *expects* \\' to throw an exception, so when this behavior changes it's fine; however if \\' did something useful (like return ') then people will write programs relying on that, and changing it will really break compatibility of those programs
<taylanub>i.e. what ijp said, in different words
<saul>taylanub, I can see your point. It's just that every language I've ever used passes through unrecognized escapes and I was hoping to not have to implement a whole new Scheme reader owing to just this problem with string constants.
<taylanub>saul: Couldn't you patch the files, possibly sending patches to wherever they come from in first place? If this \\' doesn't have any special semantics, it shouldn't be there in first place.
<saul>taylanub, I am going to check into whether such a patch will be acceptable.
<saul>The full story is that I have written a simple utility that extracts gettext-marked strings from GIMP Script-fu files (for translators). Such strings are marked for translation with a preceding underscore. for ex: _"string".
<saul>Using Guile's reader works well for parsing this as the underscore is treated as a regular symbol. Here is the script I wrote:
<civodul>saul: xgettext supports Scheme, bur rather forms like (_ "foo")
<saul>civodul, understood. And GIMP might switch to that with the next major version (3.0) but for now there are too many scripts in the wild using the _" method to change.
<saul>I am not requesting a change to Gule's current behavior as 1) I now understand your concern about compatibility and 2) such a change would not help me. I was mainly hoping that the reader implementation might be configurable to permit the escaped apostrophes.
<civodul>i was just mentioning xgettext because that's what people normally use for these things
<civodul>but otherwise, i imagine you could write 'gimp-read' on top of 'read', which special-cases '_' things
<civodul>maybe that's what the fine folks on this channel already suggested? :-)
<ijp>maybe civodul should talke the opportunity to plug guile-reader
<civodul>right, i could even do that ;-)
<civodul>it sounds overkill for this case though
<wingo>we could have a reader option that just ignores unknown escapes
<wingo>would be a useful escape valve for people, if they understand that code written using that option might break in the future if/when we add more escapes
<unknown_lamer> blech, perils of bipt not publicizing guile-emacs more
<unknown_lamer>I've offered to post things about it on slashdot, because it's topical and the more lisp news on slashdot the better >:O
<saul>wingo, the reader option might be useful for use with scheme-y config files, rather than those ugly INI things and those obtuse XML things. :-)
<ijp>I'm sure all those people writing \\ for no good reason will agree
***fangism-ctrl-Z is now known as fangism