[squeak-dev] inserting the results of doit in code highlighted contexts

Eliot Miranda eliot.miranda at gmail.com
Fri Jan 10 14:57:49 UTC 2020


Hi Christoph,

> On Jan 10, 2020, at 4:20 AM, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> 
> 
> Hi Eliot! :-)
> 
> 
> 
> Do I understand your desire correctly?
> 
> 
> 
> Given the input
> 
> 6 * 7
> 
> after pressing <cmd>p, you would like the editor to contain
> 
> 6 * 7. 42
> 
> (instead of the current result,
> 
> 6 * 7 42
> 
> )?
> 

Exactly.

> 
> This could indeed improve the styling in certain scenarios:
> Compare
> <pastedImage.png>
> against
> <pastedImage.png>
> . However, this would only improve the current situation in a very limited number of scenarios, that is, iff #printIt returns an evaluable string (see also this thread). In other scenarios, no improvement would be achieved again:
> 
> <pastedImage.png>
> does not look better than
> <pastedImage.png>
> . So provided that I understand you correctly, I personally would rather dislike your proposal. Also, it might be confusing if printIt "changes your code". :)

One important principle I was taught at ParcPlace was don’t let the perfect be the enemy of the good.  I think my proposal is good (it perfectly suits a common use case), but not perfect.  But also your two objections (don’t take this personally) are not really objections you my proposal, but illustrations of problems of using syntax highlighting in workspaces.

Depending on the result printed, either with or without introducing a period, syntax highlighting may be disturbed.  And in cases where it is not (an Object above), the fact that the syntax highlighter is able to highlight is accidental and actually erroneous (“Object” is treated as a selector, not a global identifier).  

As far as the period modifying ones code, we have both syntax highlighting to show in some cases that it has been modified, and we have undo to revert it quickly.

My proposal makes nothing worse, and makes a common case better.  My proposal is extremely simple.

> Rather, I would like to resume the discussion from Morphic-ct.1586. I think it addresses the same issue, the missstyling of printIt results. Maybe, TextAttributes should indeed have a volatile flag for this purpose, to skip them while copying the text somewhere else ...

This is all good but is a much more complex solution. Is it wise for us to discard a simple improvement?

Tobias, in whether to insert as a comment or not, I do hope not. I live in workspaces when working on VM bugs, and live in Pharo playgrounds in my consulting work.  Pharo inserts the printIt as a comment. I find the comment approach clumsy.  If I want to do further processing, something I may need to do with high frequency (way less than 100%, but maybe as much as 33%, for example subtracting a numeric result from the end of the expression I evaluated happens to me a lot in the VM), then I have to remove the comment and then insert the selector and then printIt.  With the period I just have to select the period.  So I’m frustrated by the insert-as-comment approach and hence much prefer my simple insert-a-statement-separator approach.

> Best,
> Christoph
> 
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
> Gesendet: Donnerstag, 9. Januar 2020 18:46 Uhr
> An: The general-purpose Squeak developers list
> Betreff: [squeak-dev] inserting the results of doit in code highlighted contexts
>  
> Hi All,
> 
>     let me suggest that the SmalltalkEditor i nests a period at the beginning of a printIt result if the last non-whitespace character of the doit expression was not a period.  That way the result will be correctly highlighted if the doit is.
> _,,,^..^,,,_
> best, Eliot
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200110/b5fcd364/attachment.html>


More information about the Squeak-dev mailing list