From: Ken A. <kan...@bb...> - 2004-06-23 14:07:37
|
You're right, i didn't look closely enough at the example. I thought it was ;;; output page header (define (header title) #- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>#- title -#</title> </head> -#) ) (header "foobar") that is as you nested #-'s you go in and out of string/scheme mode. But i think it would be confusing to know which level you were at. I wouldn't add another quasi string type. I'd make it so people could add their own # macro characters. k At 09:29 AM 6/23/2004 -0400, Timothy John Hickey wrote: >On Jun 23, 2004, at 8:59 AM, Ken Anderson wrote: > >>http://www.unknownlamer.org/code/guile-web-manual.html >> >>Guile uses #- ... -# as their quasi string approach. Interesting. > >But their quasi-string doesn't allow escaping into Scheme in >the middle. It seems to be just for quoting long sections of text >(like Pythons triple quote """.....""") >They can get something similar to full quasi-strings though >using string- append, or flatten-and-string-append: > >(flatten-and-string-append > #- <html> > <head><title> -# title #- </title></head> > <body bgcolor="-# color #-"> > <h1>Cool, a -# color #- page</h1> > </body> > </html> -#) > >which is equivalent to our approach: > >#{<html> > <head><title> #[ title ]# </title></head> > <body bgcolor="#[ color ]#"> > <h1>Cool, a #[ color ]# page</h1> > </body> > </html> }# > >Our-variant on their approach (not escaping into Scheme) >would be > >(!{} > #-{<html> > <head><title>}-# title #{ </title></head> > <body bgcolor="}# color #{"> > <h1>Cool, a }# color #{ page</h1> > </body> > </html> }#) > >This makes it a little more clear locally what is a string >and what is Scheme and uses our built-in operator >!{} == flatten-and-string-append > > >Maybe we should add guile-style quasi-strings to JScheme. >It would be easy and the guile approach does have a certain elegance! > >--Tim--- |