[Pharo-project] Problems loading underscore assignments
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). -- View this message in context: http://forum.world.st/Problems-loading-underscore-assignments-tp4337617p4337... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
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-tp4337617p4337... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
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 <sean@clipperadams.com> 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-tp4337617p4337... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
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 <renggli@gmail.com> 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 <sean@clipperadams.com> 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-tp4337617p4337... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- Lukas Renggli www.lukas-renggli.ch
On Sun, Jan 29, 2012 at 5:31 AM, Sean P. DeNigris <sean@clipperadams.com>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-tp4337617p4337... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Mariano http://marianopeck.wordpress.com
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. -- View this message in context: http://forum.world.st/Problems-loading-underscore-assignments-tp4337617p4339... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (3)
-
Lukas Renggli -
Mariano Martinez Peck -
Sean P. DeNigris