Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 3 participants
- 144616 messages
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by Ben Coman
On Sun, Oct 2, 2016 at 8:10 PM, Peter Uhnak <i.uhnak(a)gmail.com> wrote:
> Hi,
>
> a) creating a class is message send like any other... and the returned value is the newly created class.
>
> So you can do
>
> locellClass := Object subclass: #LOCell.
> locellClass compile: 'myMethod'.
>
> b) Alternatively (what I usually do), is `#MyClass asClass` (or Smalltalk classNamed: #MyClass).
>
> Note that using the former (`asClass`) is (justly) frowned upon when used in regular code, but it is perfectly fine in Playground. (Just like 'MyPackage' asPackage, etc.)
>
> As for distribution (which you've mentioned in another mail), I write code like this in my startup scripts, e.g. https://github.com/peteruhnak/pharo-scripts/blob/master/config/5.0/roassal-…
>
> Likewise you can just file-out a method, class, or package(s) and send that to another person, who can just file it in.
>
> Final note regarding your string operations... try to avoid using comma to concat many strings, using stream is preferable (from both performance and readability), e.g.
The performance aspect is not absolute and depends on usage...
http://forum.world.st/Stream-instead-of-string-concatenation-td4856891.html
http://forum.world.st/When-to-use-a-stream-for-concatenating-text-td4811093…
cheers -ben
>
> LOCell compile: (String streamContents: [ :stream |
> stream
> nextPutAll: 'initialize'; cr;
> nextPutAll: ' super initialize.'; cr.
> ]).
>
> Also Pharo understands multiline strings just fine, so you can do this:
>
> LOCell compile: 'initialize
> super initialize.
> self label: ''''.
> self borderWidth: 2'
>
>
> If you need to specify parameters, take a look at String>>format:
>
> 'Today is {1}.' format: {Date today}.
> 'Today is {date}.' format: (Dictionary with: #date->Date today).
>
> Peter
>
>
> On Sat, Oct 01, 2016 at 12:39:26PM -0700, CodeDmitry wrote:
>>
>> ([
>> LOCell compile:
>> 'initialize', (String cr),
>> ' super initialize.', (String cr),
>> ' self label: ''''.', (String cr),
>> ' self borderWidth: 2.', (String cr),
>> ' bounds := (0@0) corner: (16@16).', (String cr),
>> ' offColor := Color paleYellow.', (String cr),
>> ' onColor := Color paleBlue darker.', (String cr),
>> ' self useSquareCorners.', (String cr),
>> ' self turnOff.'
>> ] value).
>>
>> ([
>> LOGame compile:
>> 'cellsPerSide', (String cr),
>> ' ^10'
>> ] value).
>>
>> ([
>> LOGame compile:
>> 'toggleNeighboursOfCellAt: i at: j', (String cr),
>> ' (i > 1) ifTrue: [', (String cr),
>> ' (cells at: i - 1 at: j) toggleState.', (String cr),
>> ' ].', (String cr),
>> (String cr),
>> ' (i < self cellsPerSide) ifTrue: [', (String cr),
>> ' (cells at: i + 1 at: j) toggleState.', (String cr),
>> ' ].', (String cr),
>> (String cr),
>> ' (j > 1) ifTrue: [', (String cr),
>> ' (cells at: i at: j - 1) toggleState.', (String cr),
>> ' ].', (String cr),
>> (String cr),
>> ' (j < self cellsPerSide) ifTrue: [', (String cr),
>> ' (cells at: i at: j + 1) toggleState.', (String cr),
>> ' ].'
>> ] value).
>>
>> ([
>> LOGame compile:
>> 'newCellAt: i at: j', (String cr),
>> ' | c origin | ', (String cr),
>> (String cr),
>> ' c := LOCell new.', (String cr),
>> ' origin := self innerBounds origin.', (String cr),
>> (String cr),
>> ' self addMorph: c.', (String cr),
>> ' ', (String cr),
>> ' c position: ([', (String cr),
>> ' | x_index y_index c_width c_height |', (String cr),
>> (String cr),
>> ' x_index := i - 1.', (String cr),
>> ' y_index := j - 1.', (String cr),
>> ' c_width := c width.', (String cr),
>> ' c_height := c height.', (String cr),
>> ' ', (String cr),
>> ' (x_index * c_width)@(y_index * c_height) + origin', (String
>> cr),
>> ' ] value).', (String cr),
>> (String cr),
>> ' c mouseAction: [', (String cr),
>> ' self toggleNeighboursOfCellAt: i at: j.', (String cr),
>> ' ].', (String cr),
>> ' ^ c.', (String cr)
>> ] value).
>>
>> ([
>> LOGame compile:
>> 'initialize', (String cr),
>> ' | sampleCell width height n |', (String cr),
>> (String cr),
>> ' super initialize.', (String cr),
>> ' n := self cellsPerSide.', (String cr),
>> (String cr),
>> ' sampleCell := LOCell new.', (String cr),
>> ' width := sampleCell width.', (String cr),
>> ' height := sampleCell height.', (String cr),
>> (String cr),
>> ' self bounds: ', (String cr),
>> ' ((5@5) extent:', (String cr),
>> ' (width * n)@(height * n) + ', (String cr),
>> ' (2 * (self borderWidth))).', (String cr),
>> (String cr),
>> ' cells := Matrix new: n tabulate: [:i :j |', (String cr),
>> ' self newCellAt: i at: j.', (String cr),
>> ' ].'
>> ] value).
>>
>>
>>
>>
>> --
>> View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917707.h…
>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>
>
Oct. 2, 2016
compiling code on background / in parallel
by Peter Uhnak
Hi,
can anyone think of some inherent danger to performing code compilation on background?
E.g.
[
cls := Object subclass: #Something.
cls addInstVarNamed: #myVar.
cls addInstVarNamed: #myVar2.
cls addInstVarNamed: #myVar3.
cls compile: 'method'.
cls compile: 'myVar
^ myVar'.
cls compile: 'myVar3
^ myVar3'.
cls removeInstVarNamed: #myVar3.
] fork.
Parallel operations on the same class are not an issue for me, but I don't know if this can lead to some eventual corruption (because Pharo assumes that e.g. changes file is locked etc.).
Or e.g. installing new project/package on the background while I countinue doing my work (=writing code).
Thanks,
Peter
Oct. 2, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by Peter Uhnak
Hi,
a) creating a class is message send like any other... and the returned value is the newly created class.
So you can do
locellClass := Object subclass: #LOCell.
locellClass compile: 'myMethod'.
b) Alternatively (what I usually do), is `#MyClass asClass` (or Smalltalk classNamed: #MyClass).
Note that using the former (`asClass`) is (justly) frowned upon when used in regular code, but it is perfectly fine in Playground. (Just like 'MyPackage' asPackage, etc.)
As for distribution (which you've mentioned in another mail), I write code like this in my startup scripts, e.g. https://github.com/peteruhnak/pharo-scripts/blob/master/config/5.0/roassal-…
Likewise you can just file-out a method, class, or package(s) and send that to another person, who can just file it in.
Final note regarding your string operations... try to avoid using comma to concat many strings, using stream is preferable (from both performance and readability), e.g.
LOCell compile: (String streamContents: [ :stream |
stream
nextPutAll: 'initialize'; cr;
nextPutAll: ' super initialize.'; cr.
]).
Also Pharo understands multiline strings just fine, so you can do this:
LOCell compile: 'initialize
super initialize.
self label: ''''.
self borderWidth: 2'
If you need to specify parameters, take a look at String>>format:
'Today is {1}.' format: {Date today}.
'Today is {date}.' format: (Dictionary with: #date->Date today).
Peter
On Sat, Oct 01, 2016 at 12:39:26PM -0700, CodeDmitry wrote:
>
> ([
> LOCell compile:
> 'initialize', (String cr),
> ' super initialize.', (String cr),
> ' self label: ''''.', (String cr),
> ' self borderWidth: 2.', (String cr),
> ' bounds := (0@0) corner: (16@16).', (String cr),
> ' offColor := Color paleYellow.', (String cr),
> ' onColor := Color paleBlue darker.', (String cr),
> ' self useSquareCorners.', (String cr),
> ' self turnOff.'
> ] value).
>
> ([
> LOGame compile:
> 'cellsPerSide', (String cr),
> ' ^10'
> ] value).
>
> ([
> LOGame compile:
> 'toggleNeighboursOfCellAt: i at: j', (String cr),
> ' (i > 1) ifTrue: [', (String cr),
> ' (cells at: i - 1 at: j) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (i < self cellsPerSide) ifTrue: [', (String cr),
> ' (cells at: i + 1 at: j) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (j > 1) ifTrue: [', (String cr),
> ' (cells at: i at: j - 1) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (j < self cellsPerSide) ifTrue: [', (String cr),
> ' (cells at: i at: j + 1) toggleState.', (String cr),
> ' ].'
> ] value).
>
> ([
> LOGame compile:
> 'newCellAt: i at: j', (String cr),
> ' | c origin | ', (String cr),
> (String cr),
> ' c := LOCell new.', (String cr),
> ' origin := self innerBounds origin.', (String cr),
> (String cr),
> ' self addMorph: c.', (String cr),
> ' ', (String cr),
> ' c position: ([', (String cr),
> ' | x_index y_index c_width c_height |', (String cr),
> (String cr),
> ' x_index := i - 1.', (String cr),
> ' y_index := j - 1.', (String cr),
> ' c_width := c width.', (String cr),
> ' c_height := c height.', (String cr),
> ' ', (String cr),
> ' (x_index * c_width)@(y_index * c_height) + origin', (String
> cr),
> ' ] value).', (String cr),
> (String cr),
> ' c mouseAction: [', (String cr),
> ' self toggleNeighboursOfCellAt: i at: j.', (String cr),
> ' ].', (String cr),
> ' ^ c.', (String cr)
> ] value).
>
> ([
> LOGame compile:
> 'initialize', (String cr),
> ' | sampleCell width height n |', (String cr),
> (String cr),
> ' super initialize.', (String cr),
> ' n := self cellsPerSide.', (String cr),
> (String cr),
> ' sampleCell := LOCell new.', (String cr),
> ' width := sampleCell width.', (String cr),
> ' height := sampleCell height.', (String cr),
> (String cr),
> ' self bounds: ', (String cr),
> ' ((5@5) extent:', (String cr),
> ' (width * n)@(height * n) + ', (String cr),
> ' (2 * (self borderWidth))).', (String cr),
> (String cr),
> ' cells := Matrix new: n tabulate: [:i :j |', (String cr),
> ' self newCellAt: i at: j.', (String cr),
> ' ].'
> ] value).
>
>
>
>
> --
> View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917707.h…
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>
Oct. 2, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by CodeDmitry
It's just nice to have a standalone code that I can give to my friends that
they can read and run to create the structure without having to setup
everything themselves, but at the same time not needing to use a package. A
standalone script is quite elegant for situations like that, since it well
encapsulates the automation without forcing people to understand packaging.
--
View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917764.h…
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Oct. 2, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by Dimitris Chloupis
This a problem I have long identified with Smalltalk that Pharo inherits.
The fact that workspace is disconnected from System Browser.
But I never bothered fixing because of other priorities.
Personally I am suprised you ask why one would want a more close connection
between System Browser and Workspace/Playground , isn't it obvious it would
speed up workflow considerably ?
My workaround has been not to use Playground at all and instead work
directly with System Browser. I use playground only to trigger class
execution. Even that is not necessary because of the script pragma which
makes possible to trigger execution directly from System Browser.
This is not just a problem of Workspace only , all tools inside Smaltalkl
are disconnected with exception of inspector and debugger . The king of
integration and the best example of how to connect a tool with others is
GTSpotter. Of course that is also what makes GTSpotter so popular.
On Sun, 2 Oct 2016 at 08:19, stepharo <stepharo(a)free.fr> wrote:
> But why do you want that? Why do you want to code everything in the
> playground?
>
>
> Le 1/10/16 à 21:58, CodeDmitry a écrit :
> > Thanks Peter! I admit I couldnt really dynamically add methods to a
> class at
> > runtime since I was doing it as follows:
> >
> > ([
> > (LOCell class) methodDict
> > at: #mouseAction
> > put: ((LOCell class) compile:
> > mouseAction: a
> > ^ mouseAction := a
> > ).
> > ] value).
> >
> > Which caused constant harassment by Pharo until I typed:
> >
> > (LOCell class) removeAllKeys.
> >
> > or
> >
> > (LOCell class) removeKey: #mouseAction.
> >
> > I'll try your method in a bit to see if it works better.
>
> But you are using black magic incantation instead of using the class
> browser
> So do not complain if you shoot in your feet in the future.
>
> I would not code like that because you will just get frustrated and you
> will
> think pharo is bad while we are all using hyper fast and safe and we
> keep black magic
> for the place we want it.
>
> Stef
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917706.h…
> > Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.
> >
> >
>
>
>
Oct. 2, 2016
Re: [Pharo-dev] How do recover change with epicea?
by stepharo
super cool
I love such mail :)
Le 2/10/16 à 00:39, Martin Dias a écrit :
> I'm back!
>
>
> Thanks for your feedback. I also didn't like the names... I was
> experimenting with new names that communicate better tools' meaning.
> In the middle of this experimentation I had release 8.0.2 with bug
> fixes, and those experimental names became public. Then, in this
> thread I understood that what was missing is explaining (or improving)
> the logs (ombu files) model... not finding super tool names.
>
>
> The new version of Epicea is waiting for integration:
>
> https://pharo.fogbugz.com/f/cases/19165/Integrate-Epicea-8-0-3
>
>
>
> This version has the tool names proposed by Norbert and agreed by
> Stef, reported as:
>
> https://pharo.fogbugz.com/f/cases/19163/Improve-Epicea-tool-names
>
>
> and has a CustomHelp with the high-level documentation as proposed by
> Sven, reported in:
>
> https://pharo.fogbugz.com/f/cases/19164/Add-help-to-Epicea-project
>
>
> I also added "fly by help" in some buttons and didn't had an
> explanation yet. Stef, I didn't investigate if menu entries can have
> fly by help.
>
>
> The next Epicea version should have some improvement on this issue:
>
> https://pharo.fogbugz.com/f/cases/edit/19125/Epicea-Log-writing-is-very-slow
>
>
>
>
> Cheers
> Martin
>
>
> On Thu, Sep 22, 2016 at 2:25 PM, stepharo <stepharo(a)free.fr
> <mailto:stepharo@free.fr>> wrote:
>
> :)
>
> I'm trying to remember if we have fly by help on menu item because
> this descriptions would fit nicely there.
>
> Martin the names proposed by Norbert are cool.
>
>
> Stef
>
>
> Le 21/9/16 à 13:00, Sven Van Caekenberghe a écrit :
>
> Thank you for this clear explanation, Martin. People will
> always have trouble using any tool/UI if they do not
> understand the underlying model. It helped me. Needless to
> say, such high level documentation needs to go somewhere.
>
> On 21 Sep 2016, at 06:50, Martin Dias
> <tinchodias(a)gmail.com <mailto:tinchodias@gmail.com>> wrote:
>
> Hi Stef, âNo idea why Epicea didn't log your changes.
>
> About "monitor vs. log set"... the two new entries in
> World Menu > Tools > Epicea... I'd like user opinions to
> improve naming and UI. I can tell some things introduced
> in the latest integration.
>
> - The Log Set
> As you know, Epicea Monitor logs code changes (and some
> IDE events such as MC load/save and refactorings). Such
> data is placed in .ombu files in a local directory. Each
> time a Pharo image opens, Epicea Monitor logs code changes
> into a new ombu file. Those ombu files in the local
> directory is what is currently called "Log Set".
>
> - The Monitor UI shows the code changes since Epicea
> started to log.
> ===> This means it shows changes placed in potentially
> several ombu files.
>
> - The Log Set UI shows:
> -- all the logs in the local directory on the left panel, and
> -- the content of the selected log in the right panel.
> ===> This UI visually connects the logs to help user to
> understand how the ombu files are related. Note that the
> code changes displayed on the right panel belong to only
> one log (different than in the Monitor UI, that might show
> changes in several logs).
>
> Cheers,
> Martin
>
> On Tue, Sep 20, 2016 at 4:57 PM, stepharo
> <stepharo(a)free.fr <mailto:stepharo@free.fr>> wrote:
> even better
>
> Smalltalk tools changeList browseRecentLog
>
> does not show any changes :)
>
> So I redownloaded the latest version of tried
>
> - changes something
>
> - exist without saving
>
> - reopening the image
>
> And I could not reproduce the bug.... Shit.
>
> So I lost my time.
>
> Stef
>
>
>
>
>
> Hi
>
> i introduced a loop (yes totally stupid) in menu morph icon :)
> so I had to quit my image.
> I thought that epicea would show me all the changes and I
> could not find how to do it.
> I do not know how to invoke the old recover lost
> changes... so so far I lost 40 min of dev :(
>
> I have no idea what is monitor vs log set in Epicea.
> And log set is just with the changes I'm doing :( not the
> ones I lost :(
>
> In cutting alpha image it would be good to make sure that
> we cannot lose our work :(
> Stef
>
>
>
>
>
>
> <epiceaLogSet.jpg>
>
>
>
>
>
Oct. 2, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by stepharo
You see Pharo as a file syntax too.
You did all that because you do not like you use the code browser but
you should try it.
because coding in the playground for now does not really scales.
Le 1/10/16 à 22:39, CodeDmitry a écrit :
> Ok I got the proof of concept down, but I can't get it all to run at once
> since Pharo realizes that the class does not exist(at the time of running),
> even though it will exist by the time it gets to that line.
>
> Is there a way to modify the following Transcript code make the following
> code run "at once". Ignoring the fact that classes are not created at time
> of writing?
>
> ([
> SimpleSwitchMorph subclass: #LOCell
> instanceVariableNames: 'mouseAction'
> classVariableNames: ''
> package: 'PBE-LightsOut'
> ] value).
>
> ([
> BorderedMorph subclass: #LOGame
> instanceVariableNames: 'cells'
> classVariableNames: ''
> package: 'PBE-LightsOut'
> ] value).
>
> ([
> LOCell compile:
> 'mouseAction: a', (String cr),
> ' ^ mouseAction := a'.
> ] value).
>
> ([
> LOCell compile:
> 'mouseUp: e', (String cr),
> ' mouseAction value'
> ] value).
>
> ([
> LOCell compile:
> 'initialize', (String cr),
> ' super initialize.', (String cr),
> ' self label: ''''.', (String cr),
> ' self borderWidth: 2.', (String cr),
> ' bounds := (0@0) corner: (16@16).', (String cr),
> ' offColor := Color paleYellow.', (String cr),
> ' onColor := Color paleBlue darker.', (String cr),
> ' self useSquareCorners.', (String cr),
> ' self turnOff.'
> ] value).
>
> ([
> LOGame compile:
> 'cellsPerSide', (String cr),
> ' ^10'
> ] value).
>
> ([
> LOGame compile:
> 'toggleNeighboursOfCellAt: i at: j', (String cr),
> ' (i > 1) ifTrue: [', (String cr),
> ' (cells at: i - 1 at: j) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (i < self cellsPerSide) ifTrue: [', (String cr),
> ' (cells at: i + 1 at: j) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (j > 1) ifTrue: [', (String cr),
> ' (cells at: i at: j - 1) toggleState.', (String cr),
> ' ].', (String cr),
> (String cr),
> ' (j < self cellsPerSide) ifTrue: [', (String cr),
> ' (cells at: i at: j + 1) toggleState.', (String cr),
> ' ].'
> ] value).
>
> ([
> LOGame compile:
> 'newCellAt: i at: j', (String cr),
> ' | c origin | ', (String cr),
> (String cr),
> ' c := LOCell new.', (String cr),
> ' origin := self innerBounds origin.', (String cr),
> (String cr),
> ' self addMorph: c.', (String cr),
> ' ', (String cr),
> ' c position: ([', (String cr),
> ' | x_index y_index c_width c_height |', (String cr),
> (String cr),
> ' x_index := i - 1.', (String cr),
> ' y_index := j - 1.', (String cr),
> ' c_width := c width.', (String cr),
> ' c_height := c height.', (String cr),
> ' ', (String cr),
> ' (x_index * c_width)@(y_index * c_height) + origin', (String
> cr),
> ' ] value).', (String cr),
> (String cr),
> ' c mouseAction: [', (String cr),
> ' self toggleNeighboursOfCellAt: i at: j.', (String cr),
> ' ].', (String cr),
> ' ^ c.', (String cr)
> ] value).
>
> ([
> LOGame compile:
> 'initialize', (String cr),
> ' | sampleCell width height n |', (String cr),
> (String cr),
> ' super initialize.', (String cr),
> ' n := self cellsPerSide.', (String cr),
> (String cr),
> ' sampleCell := LOCell new.', (String cr),
> ' width := sampleCell width.', (String cr),
> ' height := sampleCell height.', (String cr),
> (String cr),
> ' self bounds: ', (String cr),
> ' ((5@5) extent:', (String cr),
> ' (width * n)@(height * n) + ', (String cr),
> ' (2 * (self borderWidth))).', (String cr),
> (String cr),
> ' cells := Matrix new: n tabulate: [:i :j |', (String cr),
> ' self newCellAt: i at: j.', (String cr),
> ' ].'
> ] value).
>
>
>
>
> --
> View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917707.h…
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>
>
Oct. 2, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by stepharo
But why do you want that? Why do you want to code everything in the
playground?
Le 1/10/16 à 21:58, CodeDmitry a écrit :
> Thanks Peter! I admit I couldnt really dynamically add methods to a class at
> runtime since I was doing it as follows:
>
> ([
> (LOCell class) methodDict
> at: #mouseAction
> put: ((LOCell class) compile:
> mouseAction: a
> ^ mouseAction := a
> ).
> ] value).
>
> Which caused constant harassment by Pharo until I typed:
>
> (LOCell class) removeAllKeys.
>
> or
>
> (LOCell class) removeKey: #mouseAction.
>
> I'll try your method in a bit to see if it works better.
But you are using black magic incantation instead of using the class browser
So do not complain if you shoot in your feet in the future.
I would not code like that because you will just get frustrated and you
will
think pharo is bad while we are all using hyper fast and safe and we
keep black magic
for the place we want it.
Stef
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917706.h…
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>
>
Oct. 2, 2016
Re: [Pharo-dev] How do recover change with epicea?
by Martin Dias
I'm back!
Thanks for your feedback. I also didn't like the names... I was
experimenting with new names that communicate better tools' meaning. In the
middle of this experimentation I had release 8.0.2 with bug fixes, and
those experimental names became public. Then, in this thread I understood
that what was missing is explaining (or improving) the logs (ombu files)
model... not finding super tool names.
The new version of Epicea is waiting for integration:
https://pharo.fogbugz.com/f/cases/19165/Integrate-Epicea-8-0-3
This version has the tool names proposed by Norbert and agreed by Stef,
reported as:
https://pharo.fogbugz.com/f/cases/19163/Improve-Epicea-tool-names
and has a CustomHelp with the high-level documentation as proposed by Sven,
reported in:
https://pharo.fogbugz.com/f/cases/19164/Add-help-to-Epicea-project
I also added "fly by help" in some buttons and didn't had an explanation
yet. Stef, I didn't investigate if menu entries can have fly by help.
The next Epicea version should have some improvement on this issue:
https://pharo.fogbugz.com/f/cases/edit/19125/Epicea-Log-writing-is-very-slow
Cheers
Martin
On Thu, Sep 22, 2016 at 2:25 PM, stepharo <stepharo(a)free.fr> wrote:
> :)
>
> I'm trying to remember if we have fly by help on menu item because this
> descriptions would fit nicely there.
>
> Martin the names proposed by Norbert are cool.
>
>
> Stef
>
>
> Le 21/9/16 à 13:00, Sven Van Caekenberghe a écrit :
>
> Thank you for this clear explanation, Martin. People will always have
>> trouble using any tool/UI if they do not understand the underlying model.
>> It helped me. Needless to say, such high level documentation needs to go
>> somewhere.
>>
>> On 21 Sep 2016, at 06:50, Martin Dias <tinchodias(a)gmail.com> wrote:
>>>
>>> Hi Stef, âNo idea why Epicea didn't log your changes.
>>>
>>> About "monitor vs. log set"... the two new entries in World Menu > Tools
>>> > Epicea... I'd like user opinions to improve naming and UI. I can tell
>>> some things introduced in the latest integration.
>>>
>>> - The Log Set
>>> As you know, Epicea Monitor logs code changes (and some IDE events such
>>> as MC load/save and refactorings). Such data is placed in .ombu files in a
>>> local directory. Each time a Pharo image opens, Epicea Monitor logs code
>>> changes into a new ombu file. Those ombu files in the local directory is
>>> what is currently called "Log Set".
>>>
>>> - The Monitor UI shows the code changes since Epicea started to log.
>>> ===> This means it shows changes placed in potentially several ombu
>>> files.
>>>
>>> - The Log Set UI shows:
>>> -- all the logs in the local directory on the left panel, and
>>> -- the content of the selected log in the right panel.
>>> ===> This UI visually connects the logs to help user to understand how
>>> the ombu files are related. Note that the code changes displayed on the
>>> right panel belong to only one log (different than in the Monitor UI, that
>>> might show changes in several logs).
>>>
>>> Cheers,
>>> Martin
>>>
>>> On Tue, Sep 20, 2016 at 4:57 PM, stepharo <stepharo(a)free.fr> wrote:
>>> even better
>>>
>>> Smalltalk tools changeList browseRecentLog
>>>
>>> does not show any changes :)
>>>
>>> So I redownloaded the latest version of tried
>>>
>>> - changes something
>>>
>>> - exist without saving
>>>
>>> - reopening the image
>>>
>>> And I could not reproduce the bug.... Shit.
>>>
>>> So I lost my time.
>>>
>>> Stef
>>>
>>>
>>>
>>>
>>>
>>> Hi
>>>
>>> i introduced a loop (yes totally stupid) in menu morph icon :)
>>> so I had to quit my image.
>>> I thought that epicea would show me all the changes and I could not find
>>> how to do it.
>>> I do not know how to invoke the old recover lost changes... so so far I
>>> lost 40 min of dev :(
>>>
>>> I have no idea what is monitor vs log set in Epicea.
>>> And log set is just with the changes I'm doing :( not the ones I lost :(
>>>
>>> In cutting alpha image it would be good to make sure that we cannot lose
>>> our work :(
>>> Stef
>>>
>>>
>>>
>>>
>>>
>>>
>>> <epiceaLogSet.jpg>
>>>
>>
>>
>
>
Oct. 1, 2016
Re: [Pharo-dev] New to Pharo; a bunch of questions.
by CodeDmitry
Complete proof of concept(all I needed was Smalltalk classNamed: x) to
reflect the class at runtime so that the playground script doesn't get
confused since the classes don't exist before script is evaluated.
([
"create the classes."
([
SimpleSwitchMorph subclass: #LOCell
instanceVariableNames: 'mouseAction'
classVariableNames: ''
package: 'PBE-LightsOut'.
BorderedMorph subclass: #LOGame
instanceVariableNames: 'cells'
classVariableNames: ''
package: 'PBE-LightsOut'.
] value).
"create LOCell methods."
([:this |
this compile:
'mouseAction: a', (String cr),
' ^ mouseAction := a'.
this compile:
'mouseUp: e', (String cr),
' mouseAction value'.
this compile:
'initialize', (String cr),
' super initialize.', (String cr),
' self label: ''''.', (String cr),
' self borderWidth: 2.', (String cr),
' bounds := (0@0) corner: (16@16).', (String cr),
' offColor := Color paleYellow.', (String cr),
' onColor := Color paleBlue darker.', (String cr),
' self useSquareCorners.', (String cr),
' self turnOff.'.
] value: (Smalltalk classNamed: 'LOCell')).
([:this |
this compile:
'cellsPerSide', (String cr),
' ^10'.
this compile:
'toggleNeighboursOfCellAt: i at: j', (String cr),
' (i > 1) ifTrue: [', (String cr),
' (cells at: i - 1 at: j) toggleState.', (String cr),
' ].', (String cr),
(String cr),
' (i < self cellsPerSide) ifTrue: [', (String cr),
' (cells at: i + 1 at: j) toggleState.', (String cr),
' ].', (String cr),
(String cr),
' (j > 1) ifTrue: [', (String cr),
' (cells at: i at: j - 1) toggleState.', (String cr),
' ].', (String cr),
(String cr),
' (j < self cellsPerSide) ifTrue: [', (String cr),
' (cells at: i at: j + 1) toggleState.', (String cr),
' ].'.
this compile:
'newCellAt: i at: j', (String cr),
' | c origin | ', (String cr),
(String cr),
' c := LOCell new.', (String cr),
' origin := self innerBounds origin.', (String cr),
(String cr),
' self addMorph: c.', (String cr),
' ', (String cr),
' c position: ([', (String cr),
' | x_index y_index c_width c_height |', (String cr),
(String cr),
' x_index := i - 1.', (String cr),
' y_index := j - 1.', (String cr),
' c_width := c width.', (String cr),
' c_height := c height.', (String cr),
' ', (String cr),
' (x_index * c_width)@(y_index * c_height) + origin',
(String cr),
' ] value).', (String cr),
(String cr),
' c mouseAction: [', (String cr),
' self toggleNeighboursOfCellAt: i at: j.', (String cr),
' ].', (String cr),
' ^ c.', (String cr).
this compile:
'initialize', (String cr),
' | sampleCell width height n |', (String cr),
(String cr),
' super initialize.', (String cr),
' n := self cellsPerSide.', (String cr),
(String cr),
' sampleCell := LOCell new.', (String cr),
' width := sampleCell width.', (String cr),
' height := sampleCell height.', (String cr),
(String cr),
' self bounds: ', (String cr),
' ((5@5) extent:', (String cr),
' (width * n)@(height * n) + ', (String cr),
' (2 * (self borderWidth))).', (String cr),
(String cr),
' cells := Matrix new: n tabulate: [:i :j |', (String cr),
' self newCellAt: i at: j.', (String cr),
' ].'.
] value: (Smalltalk classNamed: 'LOGame')).
] value).
--
View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917710.h…
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Oct. 1, 2016