[plt-scheme] here strings

From: Felix PLT Proxy (pltscheme at pnkfx.org)
Date: Mon Jun 28 16:30:55 EDT 2004

PLT Scheme Users-

This morning, while working on X-expression based web development, I 
finally was driven to add support for Here-Strings to MzScheme.

The essential strategy is to wrap the current input port with a custom 
port that will interpret the #<<END ... END sequence properly.

Its a bit of a hack, and there's certainly some bugs.  (In particular, I 
think I saw some evidence that the port wrapping is not unitary, which 
was surprising.  That is probably a symptom of a more signficant bug).

But I thought it might serve as a nice little example, and it will do 
the job until real Here string support is added to MzScheme proper.

The code is at:
http://pnkfx.org/~pnkfelix/CodePost/links/Dev/scheme/code/util/here-strings.scm
(its a simple module, only about 100 loc)

Oh.  Just in case you didn't know: Here-Strings are 
choose-your-own-delimiter based strings.  Choosing your own delimiter 
removes many cases where one might want escape sequences; therefore, 
Here-Strings don't HAVE escape sequences.  EG:

#<<END
Hello \woot/
World
END
==> "Hello\\woot/\nWorld"

-Felix
 



Posted on the users mailing list.