On Fri, Feb 1, 2013 at 9:47 AM, Terry Raymond <traymond@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@craftedsmalltalk.com ****
===========================================================****
vwnc mailing list vwnc@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Dave's brilliance is beyond dispute, but that looks very familiar somehow - isn't it something like what used to happen in Seaside?
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>'
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Never forget: 2 + 2 = 5 for extremely large values of 2.
On Fri, Feb 1, 2013 at 10:28 AM, Eliot Miranda eliot.miranda@gmail.comwrote:
On Fri, Feb 1, 2013 at 9:47 AM, Terry Raymond < traymond@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.
<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 traymond@craftedsmalltalk.com ****
===========================================================****
vwnc mailing list vwnc@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
-- best, Eliot
On Fri, Feb 1, 2013 at 10:28 AM, Eliot Miranda eliot.miranda@gmail.comwrote:
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.
That's certainly a useful construct, but I don't think it addresses Terry's problem. He wants a string literal that can include $' and CR without escaping. Something like HEREDOC or Python's triple-double-quote string literals.
Colin
On Fri, Feb 1, 2013 at 10:44 AM, Colin Putney colin@wiresong.com wrote:
On Fri, Feb 1, 2013 at 10:28 AM, Eliot Miranda eliot.miranda@gmail.comwrote:
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.
That's certainly a useful construct, but I don't think it addresses Terry's problem. He wants a string literal that can include $' and CR without escaping. Something like HEREDOC or Python's triple-double-quote string literals.
If I had a brain I would have remembered the syntax and hence that it does address Terry's point. The quote character for quasi-quote is ` (back tick), so single ticks are literal inside a quasi-quote. <blush>Sorry</blush>
Colin
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.
Why is it a pain to change single quotes into two-successive single quotes?
1) Copy HTML from external source. 2) Back in Squeak, Command+V to paste it. 3) Press Command+Home. Press Command+F. Type single-quote (') in the find dialog. Enter. 4) Type single-quote twice. (Replaces highlighted single-quote with two single quotes). 5) Command+Shift+J to replace all subsequent occurrences. 6) Command+A to select all. 7) Command+' (single-quote) to enclose entire string in single quotes.
Takes all of about 10 seconds. Unless HTML has two single-quotes in succession I see no reason it shouldn't work..
On Fri, Feb 1, 2013 at 3:14 PM, Chris Muller asqueaker@gmail.com wrote:
Why is it a pain to change single quotes into two-successive single quotes?
- Copy HTML from external source.
- Back in Squeak, Command+V to paste it.
- Press Command+Home. Press Command+F. Type single-quote (') in
the find dialog. Enter. 4) Type single-quote twice. (Replaces highlighted single-quote with two single quotes). 5) Command+Shift+J to replace all subsequent occurrences. 6) Command+A to select all. 7) Command+' (single-quote) to enclose entire string in single quotes.
Takes all of about 10 seconds. Unless HTML has two single-quotes in succession I see no reason it shouldn't work..
Javascript might have two single-quotes in succession—that's an empty string. And even when the above does work, it's still a pain.
Colin
Why bother yourself with changing the quotes manually? Let squeak do it for you.
Open a workspace Explore it until you find the text Open an inspector on the text Select the string instance variable in the text's inspector Now what you type in the workspace gets stringified in the inspector Copy that and paste into your code.
Cheers, Bob
On 2/1/13 6:14 PM, Chris Muller wrote:
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.
Why is it a pain to change single quotes into two-successive single quotes?
- Copy HTML from external source.
- Back in Squeak, Command+V to paste it.
- Press Command+Home. Press Command+F. Type single-quote (') in
the find dialog. Enter. 4) Type single-quote twice. (Replaces highlighted single-quote with two single quotes). 5) Command+Shift+J to replace all subsequent occurrences. 6) Command+A to select all. 7) Command+' (single-quote) to enclose entire string in single quotes.
Takes all of about 10 seconds. Unless HTML has two single-quotes in succession I see no reason it shouldn't work..
On Fri, Feb 1, 2013 at 4:03 PM, Bob Arning arning315@comcast.net wrote:
Why bother yourself with changing the quotes manually? Let squeak do it for you.
Terry's in VisualWorks.
Open a workspace Explore it until you find the text Open an inspector on the text Select the string instance variable in the text's inspector Now what you type in the workspace gets stringified in the inspector Copy that and paste into your code.
Cool. Even better, add this to the doit menu:
(TextEditor classPool at: #UndoSelection) inspect
Even better add this to the doIt menu:
TextEditor classPool at: #UndoSelection put: (TextEditor classPool at: #UndoSelection) printString
and its dual:
TextEditor classPool at: #UndoSelection put: (Compiler evaluate: (TextEditor classPool at: #UndoSelection))
a.k.a. (without the droppings in the changes file)
TextEditor classPool at: #UndoSelection put: (Scanner new scanTokens: (TextEditor classPool at: #UndoSelection)) first
Cheers, Bob
On 2/1/13 6:14 PM, Chris Muller wrote:
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.
Why is it a pain to change single quotes into two-successive single quotes?
- Copy HTML from external source.
- Back in Squeak, Command+V to paste it.
- Press Command+Home. Press Command+F. Type single-quote (') in
the find dialog. Enter. 4) Type single-quote twice. (Replaces highlighted single-quote with two single quotes). 5) Command+Shift+J to replace all subsequent occurrences. 6) Command+A to select all. 7) Command+' (single-quote) to enclose entire string in single quotes.
Takes all of about 10 seconds. Unless HTML has two single-quotes in succession I see no reason it shouldn't work..
It's been 10 years or so since I used VisualWorks but didn't they have a way of highlighting a string hitting escape and then the next thing you typed surrounded the highlighted text. Was great for { ( [ ' "
That's a nice feature but it's like so many features if you don't know about it, it doesn't work for you.
Ron Teitelbaum
From: squeak-dev-bounces@lists.squeakfoundation.org [mailto:squeak-dev-bounces@lists.squeakfoundation.org] On Behalf Of Eliot Miranda Sent: Friday, February 01, 2013 7:09 PM To: The general-purpose Squeak developers list Subject: Re: [squeak-dev] Re: [vwnc] Does anyone have a "new" string literal?
On Fri, Feb 1, 2013 at 4:03 PM, Bob Arning arning315@comcast.net wrote:
Why bother yourself with changing the quotes manually? Let squeak do it for you.
Terry's in VisualWorks.
Open a workspace Explore it until you find the text Open an inspector on the text Select the string instance variable in the text's inspector Now what you type in the workspace gets stringified in the inspector Copy that and paste into your code.
Cool. Even better, add this to the doit menu:
(TextEditor classPool at: #UndoSelection) inspect
Even better add this to the doIt menu:
TextEditor classPool at: #UndoSelection put: (TextEditor classPool at: #UndoSelection) printString
and its dual:
TextEditor classPool at: #UndoSelection put: (Compiler evaluate: (TextEditor classPool at: #UndoSelection))
a.k.a. (without the droppings in the changes file)
TextEditor classPool at: #UndoSelection put: (Scanner new scanTokens: (TextEditor classPool at: #UndoSelection)) first
Cheers, Bob
On 2/1/13 6:14 PM, Chris Muller wrote:
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.
Why is it a pain to change single quotes into two-successive single quotes?
1) Copy HTML from external source. 2) Back in Squeak, Command+V to paste it. 3) Press Command+Home. Press Command+F. Type single-quote (') in the find dialog. Enter. 4) Type single-quote twice. (Replaces highlighted single-quote with two single quotes). 5) Command+Shift+J to replace all subsequent occurrences. 6) Command+A to select all. 7) Command+' (single-quote) to enclose entire string in single quotes.
Takes all of about 10 seconds. Unless HTML has two single-quotes in succession I see no reason it shouldn't work..
squeak-dev@lists.squeakfoundation.org