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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Jan 13 12:54:02 UTC 2020

Hi Eliot,

I use to do the following:

Given an expression (in a workspace, debugger or anywhere else) such as

6 * 7 ** 8


I use to select the "6 * 7" and press print-it to see the intermediary result of the first message. After that, I cut the selection into clipboard to a) continue working with it in another workspace and b) restore the previous version in the first editor and continue working with the expression.
I think this feature is quite important, as it emphasizes the universality of the Compiler.

However, if we decide to insert more text outside of the selection on print-it, this habit won't be so easy. So at least, please make a preference for this :)

Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
Gesendet: Freitag, 10. Januar 2020 15:57:49
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] inserting the results of doit in code highlighted contexts

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




This could indeed improve the styling in certain scenarios:
. 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<http://forum.world.st/LayoutFrame-gt-gt-printOn-td5104021.html>). In other scenarios, no improvement would be achieved again:

does not look better than
. 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<http://forum.world.st/The-Inbox-Morphic-ct-1586-mcz-td5106774.html>. 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.


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/20200113/ded3d93c/attachment.html>

More information about the Squeak-dev mailing list