inserting the results of doit in code highlighted contexts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

inserting the results of doit in code highlighted contexts

Eliot Miranda-2
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


Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Christoph Thiede

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:
Compare
against
. 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:

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". :)

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 ...

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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


Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Stéphane Rollandin
I believe that the dot should also be selected, so that deleting the
selection reverts to the initial code.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Tobias Pape
In reply to this post by Christoph Thiede
Hi

> On 10.01.2020, at 13:20, Thiede, Christoph <[hidden email]> 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
> )?

I'm rather for enclosing the result in quotes so as to make them a comment.

Best regards
        -Tobias


>
> This could indeed improve the styling in certain scenarios:
> Compare
>
> against
>
> . 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:
>
>
> 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". :)
>
> 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 ...
>
> Best,
> Christoph
>
> Von: Squeak-dev <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
> 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



Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Christoph Thiede

I'm rather for enclosing the result in quotes so as to make them a comment.


But this would break all reevaluability features. You could not any longer print-it 6*7 and then inspect-it the result.

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Tobias Pape <[hidden email]>
Gesendet: Freitag, 10. Januar 2020 15:03:18
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] inserting the results of doit in code highlighted contexts
 
Hi
> On 10.01.2020, at 13:20, Thiede, Christoph <[hidden email]> 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
> )?

I'm rather for enclosing the result in quotes so as to make them a comment.

Best regards
        -Tobias


>
> This could indeed improve the styling in certain scenarios:
> Compare
>
> against
>
> . 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:
>
>
> 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". :)
>
> 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 ...
>
> Best,
> Christoph
>
> Von: Squeak-dev <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
> 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





Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Eliot Miranda-2
In reply to this post by Christoph Thiede
Hi Christoph,

On Jan 10, 2020, at 4:20 AM, Thiede, Christoph <[hidden email]> 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 <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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



Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Christoph Thiede

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 :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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 <[hidden email]> 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 <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Eliot Miranda-2
Hi Christoph,

On Mon, Jan 13, 2020 at 4:54 AM Thiede, Christoph <[hidden email]> wrote:

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 :)

Agreed.  This does feel like a preference to me too.  On or off by default?  Votes please...
 

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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 <[hidden email]> 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 <[hidden email]> im Auftrag von Eliot Miranda <[hidden email]>
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




--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: inserting the results of doit in code highlighted contexts

Stéphane Rollandin
>     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 :)
>
>
> Agreed.  This does feel like a preference to me too.  On or off by
> default?  Votes please...

I vote for the original code, outside the selection, to be left
untouched by default. This convey simplicity and straightforwardness,
which I believe is in the spirit of Smalltalk.

Now my inner hacker also says that if something more than the result
printString is to be inserted, then it would be nice to have that highly
customizable so that it can fit several workflows, and maybe be set
differently for different tools... But for now a preference is fine AFAIAC.


Stef