Problems loading underscore assignments

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

Problems loading underscore assignments

Sean P. DeNigris
Administrator
I tried both programmatically ("Scanner allowUnderscoreAsAssignment: true") and via the settings browser to allow underscore assignments, but I still got errors loading AtomMorph. e.g.

    "Syntax Error"
    randomPositionIn: aRectangle maxVelocity: maxVelocity
        "Give this atom a random position and velocity."

        | origin extent |
        origin _ aRectangle origin.
        extent _ ***Nothing more expected ->***(aRectangle extent - self bounds extent) rounded.
        self position:
                (origin x + extent x atRandom) @
                (origin y + extent y atRandom).
        velocity _
                (maxVelocity - (2 * maxVelocity) atRandom) @
                (maxVelocity - (2 * maxVelocity) atRandom).
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Problems loading underscore assignments

Sean P. DeNigris
Administrator
Is there a way for fix underscores via OB in lieu of the programmatic way shown at http://book.pharo-project.org/book/Tidbits/TipsAndTricks/FixingUnderscores ?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Problems loading underscore assignments

Lukas Renggli
Yes, the refactoring engine contains a code transformation that fixes
automatically and preserves all formatting. Just run Code Critics on
your package and apply the suggested transformations for
"Transformations > Underscore assignements should be avoided".

Again you must evaluate "Scanner allowUnderscoreAsAssignment: true"
before running Code Critics, otherwise the refactoring engine does not
parse methods with underscore assignments.

Lukas

On 29 January 2012 05:32, Sean P. DeNigris <[hidden email]> wrote:
> Is there a way for fix underscores via OB in lieu of the programmatic way
> shown at
> http://book.pharo-project.org/book/Tidbits/TipsAndTricks/FixingUnderscores ?
>
> --
> View this message in context: http://forum.world.st/Problems-loading-underscore-assignments-tp4337617p4337618.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>



--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: Problems loading underscore assignments

Lukas Renggli
The programmatic way described on
http://book.pharo-project.org/book/Tidbits/TipsAndTricks/FixingUnderscores
does the same as what I described below. It should just be updated to
work with a more recent version of the refactoring engine:

   Gofer new
        squeaksource: 'rb';
        package: 'AST-Core';
        package: 'Refactoring-Core';
        package: 'Refactoring-Changes';
        package: 'Refactoring-Critics';
        package: 'Refactoring-Environment';
        package: 'Refactoring-Pharo-Platform';
        load.

And the class references must be replaced like this:

    BrowserEnvironment -> RBBrowserEnvironment
    SmalllintChecker -> RBSmalllintChecker
    CompositeRefactoryChange -> RBCompositeRefactoryChange

After the programmatic instructions should work as well.

Lukas

On 29 January 2012 10:48, Lukas Renggli <[hidden email]> wrote:

> Yes, the refactoring engine contains a code transformation that fixes
> automatically and preserves all formatting. Just run Code Critics on
> your package and apply the suggested transformations for
> "Transformations > Underscore assignements should be avoided".
>
> Again you must evaluate "Scanner allowUnderscoreAsAssignment: true"
> before running Code Critics, otherwise the refactoring engine does not
> parse methods with underscore assignments.
>
> Lukas
>
> On 29 January 2012 05:32, Sean P. DeNigris <[hidden email]> wrote:
>> Is there a way for fix underscores via OB in lieu of the programmatic way
>> shown at
>> http://book.pharo-project.org/book/Tidbits/TipsAndTricks/FixingUnderscores ?
>>
>> --
>> View this message in context: http://forum.world.st/Problems-loading-underscore-assignments-tp4337617p4337618.html
>> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch



--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: Problems loading underscore assignments

Mariano Martinez Peck
In reply to this post by Sean P. DeNigris


On Sun, Jan 29, 2012 at 5:31 AM, Sean P. DeNigris <[hidden email]> wrote:
I tried both programmatically ("Scanner allowUnderscoreAsAssignment: true")
and via the settings browser to allow underscore assignments, but I still
got errors loading AtomMorph. e.g.

I don't know which image version you are using but in last sprint I fixed this:
http://code.google.com/p/pharo/issues/detail?id=4636

Cheers
 

   "Syntax Error"
   randomPositionIn: aRectangle maxVelocity: maxVelocity
       "Give this atom a random position and velocity."

       | origin extent |
       origin _ aRectangle origin.
       extent _ ***Nothing more expected ->***(aRectangle extent - self bounds
extent) rounded.
       self position:
               (origin x + extent x atRandom) @
               (origin y + extent y atRandom).
       velocity _
               (maxVelocity - (2 * maxVelocity) atRandom) @
               (maxVelocity - (2 * maxVelocity) atRandom).


--
View this message in context: http://forum.world.st/Problems-loading-underscore-assignments-tp4337617p4337617.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Problems loading underscore assignments

Sean P. DeNigris
Administrator
Mariano Martinez Peck wrote
I don't know which image version you are using
1.3

Mariano Martinez Peck wrote
I fixed this:
Great, thanks.
Cheers,
Sean