[Pharo-dev] Why do we have doublequoting for "?

Tudor Girba tudor at tudorgirba.com
Sun Feb 26 16:11:34 EST 2017


Hi Stef,

Just a clarification.

The mechanism you mention is obtained through Cmd+p, Enter and this embeds the printout as a comment in the existing editor. This is particularly useful when you want to keep a trace of multiple executions in the same editor (typically a Playground). In order to make any string a valid Pharo comment we use String>>asComment, and this escapes “ (double-quote) inside a comment. Without it, the result would not be a valid comment and the syntax highlighting would be broken.

For your goal of having the result in the debugger this is obviously not ideal. This is why we ended up with Cmd+p,Cmd+p, but this is not available in Pharo 5.

Cheers,
Doru


> On Feb 24, 2017, at 8:30 AM, stepharong <stepharong at free.fr> wrote:
> 
> Yuriy
> 
> 
> Why does it make sense to have "" "" inside strings?
> 
> 
> So if you paste this as a comment somewhere you don’t have to manually add double double-quotes.
> 
> Did you read my example?
> I do not need any double double quotes. 
> 
> 
> I don’t use the result of print it at all, but I guess there are two scenarios for it’s usage. One as you described: copy the result and use it in tests or in some further computation. 
> 
> But this is exactly what I cannot do with this stupid doubling of double quotes
> 
> (but if you use TDD test are already written ;P).
> 
> well...
> 
> Another one is to copy the result and paste it somewhere as a comment in your code, to access it easily afterwards. If you have a double quote in your result it will break the comment, so the thing is escaped automatically.
> 
> Probably but here this is inside a string. 
> I think that this heuristic is totally bogus. 
> 
> 
> Uko
> 
>> On 23 Feb 2017, at 22:25, stepharong <stepharong at free.fr> wrote:
>> 
>> Thnkas gabriel
>> I'm hacking in an old Pharo 50 image and it was terrible because printit even a copyReplaceAll: '""' byt: '"'
>> did not work. 
>> I do not understand what is the scenario to double quote comment character " 
>> 
>> I understand single quotes but not double quotes. 
>> stef
>> 
>> Try doing Ctrl+P twice. It will not comment the printed string.
>> 
>> On Thu, Feb 23, 2017 at 4:17 PM, stepharong <stepharong at free.fr> wrote:
>> about quoting ;(
>> 
>> Hi
>> 
>> I have a string
>> 
>>  '<li>
>> <span class="author">Stéphane Ducasse and Damien Pollet</span>, <span class="title">Fingerprints</span>, <span class="journal">Journal of Information System</span>, <span class="year">2010</span>.
>> </li>
>> '
>> 
>> and when I do printIt in the debugger I get the following
>> 
>> 
>>  "'<li>
>> <span class=""author"">Stéphane Ducasse and Damien Pollet</span>, <span class=""title"">Fingerprints</span>, <span class=""journal"">Journal of Information System</span>, <span class=""year"">2010</span>.
>> </li>
>> '"
>> 
>> I do not get why we doublequote the character "
>> inside string.
>> 
>> It means that I have to remove all the " inside to string to be able to express tests.
>> 
>> Stef
>> 
>> 
>> 
>> 
>> 
>> -- 
>> Using Opera's mail client: http://www.opera.com/mail/
> 
> 
> 
> 
> -- 
> Using Opera's mail client: http://www.opera.com/mail/

--
www.tudorgirba.com
www.feenk.com

"Innovation comes in the least expected form. 
That is, if it is expected, it already happened."




More information about the Pharo-dev mailing list