[Pharo5] Semantic Warnings as icons in the editor

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

[Pharo5] Semantic Warnings as icons in the editor

Marcus Denker-4
Hi,

One result of Friday’s Pharo Sprint in Chile: Use the nice icons of the new text editor
to display some of the semantic errors nicely (instead of breaking flow with a intrusive dialog):

This was done by Johan based on the prototype Miguel did in September:

1) unused temps:


(the “drag the crosshair”r is an artefact of the snapshot tool)

2) temps used that are not initialised:



In a next step, we need to integrate that with the QA tool… no need to have this reported
twice.

What is nice is that this simplified the Compiler: instead of having an Exception and raising
it, we now just annotate the AST:

unusedVariable: variableNode

variableNode propertyAt: #semanticWarning put: 'unused variable’

(this is very simple for now, with a node just being able to have one kind of semanticWarning).

SemanticWarningIconStyler is what adds the icon. It has 4 methods with one line each.

Marcus

Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

Tudor Girba-2
Very nice!

Doru


> On Nov 28, 2015, at 11:01 PM, Marcus Denker <[hidden email]> wrote:
>
> Hi,
>
> One result of Friday’s Pharo Sprint in Chile: Use the nice icons of the new text editor
> to display some of the semantic errors nicely (instead of breaking flow with a intrusive dialog):
>
> This was done by Johan based on the prototype Miguel did in September:
>
> 1) unused temps:
>
> <unused.png>
>
> (the “drag the crosshair”r is an artefact of the snapshot tool)
>
> 2) temps used that are not initialised:
>
> <uninit.png>
>
>
> In a next step, we need to integrate that with the QA tool… no need to have this reported
> twice.
>
> What is nice is that this simplified the Compiler: instead of having an Exception and raising
> it, we now just annotate the AST:
>
> unusedVariable: variableNode
>
> variableNode propertyAt: #semanticWarning put: 'unused variable’
>
> (this is very simple for now, with a node just being able to have one kind of semanticWarning).
>
> SemanticWarningIconStyler is what adds the icon. It has 4 methods with one line each.
>
> Marcus
>

--
www.tudorgirba.com

"Value is always contextual."




Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

CyrilFerlicot
In reply to this post by Marcus Denker-4
This is really cool ! :)
One more step to get a nice IDE!
Thank you for your efforts :)

On Saturday, November 28, 2015, Marcus Denker <[hidden email]> wrote:
Hi,

One result of Friday’s Pharo Sprint in Chile: Use the nice icons of the new text editor
to display some of the semantic errors nicely (instead of breaking flow with a intrusive dialog):

This was done by Johan based on the prototype Miguel did in September:

1) unused temps:


(the “drag the crosshair”r is an artefact of the snapshot tool)

2) temps used that are not initialised:



In a next step, we need to integrate that with the QA tool… no need to have this reported
twice.

What is nice is that this simplified the Compiler: instead of having an Exception and raising
it, we now just annotate the AST:

unusedVariable: variableNode

variableNode propertyAt: #semanticWarning put: 'unused variable’

(this is very simple for now, with a node just being able to have one kind of semanticWarning).

SemanticWarningIconStyler is what adds the icon. It has 4 methods with one line each.

Marcus



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

jfabry

And now the question for the monday morning development effort is: what more semantic warnings of the compiler can we reveal like this? :-)

On Nov 28, 2015, at 19:06, Cyril Ferlicot <[hidden email]> wrote:

This is really cool ! :)
One more step to get a nice IDE!
Thank you for your efforts :)

On Saturday, November 28, 2015, Marcus Denker <[hidden email]> wrote:
Hi,

One result of Friday’s Pharo Sprint in Chile: Use the nice icons of the new text editor
to display some of the semantic errors nicely (instead of breaking flow with a intrusive dialog):

This was done by Johan based on the prototype Miguel did in September:

1) unused temps:

<unused.png>

(the “drag the crosshair”r is an artefact of the snapshot tool)

2) temps used that are not initialised:

<uninit.png>


In a next step, we need to integrate that with the QA tool… no need to have this reported
twice.

What is nice is that this simplified the Compiler: instead of having an Exception and raising
it, we now just annotate the AST:

unusedVariable: variableNode

variableNode propertyAt: #semanticWarning put: 'unused variable’

(this is very simple for now, with a node just being able to have one kind of semanticWarning).

SemanticWarningIconStyler is what adds the icon. It has 4 methods with one line each.

Marcus



--
Cheers
Cyril Ferlicot




---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

Nicolas Cellier
It's nice, but I like the Compiler to be pedantic in such cases and manifest itself BEFORE accepting the method.
One thing is suspicious patterns, another is obviously wrong code. Can't we have graduated responses?

2015-11-29 0:52 GMT+01:00 Johan Fabry <[hidden email]>:

And now the question for the monday morning development effort is: what more semantic warnings of the compiler can we reveal like this? :-)

On Nov 28, 2015, at 19:06, Cyril Ferlicot <[hidden email]> wrote:

This is really cool ! :)
One more step to get a nice IDE!
Thank you for your efforts :)

On Saturday, November 28, 2015, Marcus Denker <[hidden email]> wrote:
Hi,

One result of Friday’s Pharo Sprint in Chile: Use the nice icons of the new text editor
to display some of the semantic errors nicely (instead of breaking flow with a intrusive dialog):

This was done by Johan based on the prototype Miguel did in September:

1) unused temps:

<unused.png>

(the “drag the crosshair”r is an artefact of the snapshot tool)

2) temps used that are not initialised:

<uninit.png>


In a next step, we need to integrate that with the QA tool… no need to have this reported
twice.

What is nice is that this simplified the Compiler: instead of having an Exception and raising
it, we now just annotate the AST:

unusedVariable: variableNode

variableNode propertyAt: #semanticWarning put: 'unused variable’

(this is very simple for now, with a node just being able to have one kind of semanticWarning).

SemanticWarningIconStyler is what adds the icon. It has 4 methods with one line each.

Marcus



--
Cheers
Cyril Ferlicot




---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

Thierry Goubier
Le 29/11/2015 14:14, Nicolas Cellier a écrit :
> It's nice, but I like the Compiler to be pedantic in such cases and
> manifest itself BEFORE accepting the method.
> One thing is suspicious patterns, another is obviously wrong code. Can't
> we have graduated responses?

The problem is that certain semantic warnings were false positives, as
the recursive block definition.

A := [ ... A value ].

Thierry

>
> 2015-11-29 0:52 GMT+01:00 Johan Fabry <[hidden email]
> <mailto:[hidden email]>>:
>
>
>     And now the question for the monday morning development effort is:
>     what more semantic warnings of the compiler can we reveal like this? :-)
>
>>     On Nov 28, 2015, at 19:06, Cyril Ferlicot
>>     <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>     This is really cool ! :)
>>     One more step to get a nice IDE!
>>     Thank you for your efforts :)
>>
>>     On Saturday, November 28, 2015, Marcus Denker
>>     <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>         Hi,
>>
>>         One result of Friday’s Pharo Sprint in Chile: Use the nice
>>         icons of the new text editor
>>         to display some of the semantic errors nicely (instead of
>>         breaking flow with a intrusive dialog):
>>
>>         This was done by Johan based on the prototype Miguel did in
>>         September:
>>
>>         1) unused temps:
>>
>>         <unused.png>
>>
>>         (the “drag the crosshair”r is an artefact of the snapshot tool)
>>
>>         2) temps used that are not initialised:
>>
>>         <uninit.png>
>>
>>
>>         In a next step, we need to integrate that with the QA tool… no
>>         need to have this reported
>>         twice.
>>
>>         What is nice is that this simplified the Compiler: instead of
>>         having an Exception and raising
>>         it, we now just annotate the AST:
>>
>>         unusedVariable: variableNode
>>
>>         variableNode propertyAt: #semanticWarning put: 'unused variable’
>>
>>         (this is very simple for now, with a node just being able to
>>         have one kind of semanticWarning).
>>
>>         SemanticWarningIconStyler is what adds the icon. It has 4
>>         methods with one line each.
>>
>>         Marcus
>>
>>
>>
>>     --
>>     Cheers
>>     Cyril Ferlicot
>>
>
>
>
>     ---> Save our in-boxes! http://emailcharter.org <---
>
>     Johan Fabry   - http://pleiad.cl/~jfabry
>     PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -
>       University of Chile
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

jfabry

> On Nov 29, 2015, at 10:21, Thierry Goubier <[hidden email]> wrote:
>
> Le 29/11/2015 14:14, Nicolas Cellier a écrit :
>> It's nice, but I like the Compiler to be pedantic in such cases and
>> manifest itself BEFORE accepting the method.
>> One thing is suspicious patterns, another is obviously wrong code. Can't
>> we have graduated responses?
>
> The problem is that certain semantic warnings were false positives, as the recursive block definition.
>
> A := [ ... A value ].

Indeed, this warning happens to me from time to time (I tend to use blocks as lambdas in some cases) and it is *extremely* annoying to have to close the warning window every time. I think I will address that tomorrow …


---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] Semantic Warnings as icons in the editor

Nicolas Cellier
Oh, the rate of false positive is so low in this case, less than 1 out of 1000 I guess...
Here is a super twisty workaround (I don't really recommend it, but for the fun)

A := [:a | ... a value: a].
self doSomethingLike: [A value: A].

2015-11-29 16:37 GMT+01:00 Johan Fabry <[hidden email]>:

> On Nov 29, 2015, at 10:21, Thierry Goubier <[hidden email]> wrote:
>
> Le 29/11/2015 14:14, Nicolas Cellier a écrit :
>> It's nice, but I like the Compiler to be pedantic in such cases and
>> manifest itself BEFORE accepting the method.
>> One thing is suspicious patterns, another is obviously wrong code. Can't
>> we have graduated responses?
>
> The problem is that certain semantic warnings were false positives, as the recursive block definition.
>
> A := [ ... A value ].

Indeed, this warning happens to me from time to time (I tend to use blocks as lambdas in some cases) and it is *extremely* annoying to have to close the warning window every time. I think I will address that tomorrow …


---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile