[squeak-dev] Re: [vwnc] Does anyone have a "new" string literal?

Eliot Miranda eliot.miranda at gmail.com
Fri Feb 1 18:28:40 UTC 2013


On Fri, Feb 1, 2013 at 9:47 AM, Terry Raymond <traymond at craftedsmalltalk.com
> 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.

****
>
> ** **
>
> Terry****
>
> ** **
>
> ===========================================================****
>
> Terry Raymond****
>
> Crafted Smalltalk****
>
> 80 Lazywood Ln.****
>
> Tiverton, RI  02878****
>
> (401) 624-4517      traymond at craftedsmalltalk.com ****
>
> ===========================================================****
>
> ** **
>
> _______________________________________________
> vwnc mailing list
> vwnc at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130201/1cf80aa8/attachment.htm


More information about the Squeak-dev mailing list