On Fri, Feb 1, 2013 at 10:28 AM, Eliot Miranda <[email protected]>wrote:
> > > On Fri, Feb 1, 2013 at 9:47 AM, Terry Raymond < > [email protected]> wrote: > >> I constantly run into the situation where I am incorporating either HTML >> or javascript**** >> >> in my methods. The problem I run into is the smalltalk string quote(‘). >> It is a real pain**** >> >> to double quote it, and don’t even try to copy and paste external >> javascript.**** >> >> ** ** >> >> So, I think it would be real helpful to have some other funky string >> quote like**** >> >> ##{{ }}## or some sequence that is very unlikely to occur in another >> language.**** >> >> ** ** >> >> Has anyone done this or even thought about it? >> > > David Leibs has been pushing a well-thought-through facility he calls (and > other systems name) "quasi-quote". Here, a string literal contains escape > sequences, a little like printf, that allow one to substitute values. > Dave's syntax uses square brackets to escape into Smalltalk. So that > (IIRC) you say things like > > '<html><head></head><body><H1>[myHeading]</H1>' > > which compiles to something analogous to > > String streamContents: [:s| s > nextPutAll: '<html><head></head><body><H1>'; nextPutAll: myHeading > asString; nextPutAll: '</H1>] > > But this excellent suggestion has fallen on deaf ears (my own included) > for more than a decade. > <blush>, saw quote, brian farted, now realize this is nothing to do with your issue Terry. Apologies</blush>. But you could come up with some convention to embed in quasi-quote to change the string quote, right? he thing is to choose your escape character(s) with care. You need a quote to escape to and from processing ($[ & $]). You need a literal quote ( $\ ?). Do you need a third quote to change quote interpretation? Or do you need a third quote that turns off single quote as end of string? eg. say $^ indicates no close quote until the matching $^. So the following '^'my single-quoted string'^' denotes '''my single-quoted string''' and I realize I can't remember how David's proposal distinguishes between quasi-quote strings and normal Smalltalk strings. > **** >> >> ** ** >> >> Terry**** >> >> ** ** >> >> ===========================================================**** >> >> Terry Raymond**** >> >> Crafted Smalltalk**** >> >> 80 Lazywood Ln.**** >> >> Tiverton, RI 02878**** >> >> (401) 624-4517 [email protected] **** >> >> ===========================================================**** >> >> ** ** >> >> _______________________________________________ >> vwnc mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> > > > -- > best, > Eliot > -- best, Eliot
