Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- 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
June 2024
- 15 participants
- 36 messages
Re: Can the rewrite tool replace a single statement with multiple statements?
by Tim Mackinnon
Hey Gabriel - thanks for chipping in - you've made me realise that its perhaps easier to give a simpler example (for the multiple replacement)., and while trying to explain in simpler terms I managed to solve the problem myself - but it does demonstrate the docs around this need a bit more work as I didn't find it easy to reason on.
I am still confused what the setting "this rule is for a method" does - so am keen for someone to shed light.
Anyway for my example it seems that I have to be very specific in how I match things for example I had to use the search pattern:
taskbarButtonMenu: `arg
| `@temps |
`.@before.
moveSubmenu
addToggle: 'Move right' translated
target: self
selector: #taskbarMoveRight
getStateSelector: nil
enablementSelector: #canBeMovedToRight.
`.@after
And it took me ages to realise that I have to specify the temp vars matching, and also understand that the @before and @after both needed the "." to represent lists of expressions both before and after and then the really subtle "." after @before which I guess prevents greedy matching.
With all of that in place, could then have the write rule add an extra statement after the moveSubmenu (or as many as I want)
e.g.
taskbarButtonMenu: `arg
| `@temps |
`.@before.
moveSubmenu
addToggle: 'Move right' translated
target: self
selector: #taskbarMoveRight
getStateSelector: nil
enablementSelector: #canBeMovedToRight.
moveSubmenu
addToggle: 'Move to...' translated
target: self
selector: #taskbarMoveTo
getStateSelector: nil.
`.@after
I'm curious now whether there is a more efficient way to do what I have done? Possibly the {} syntax could help now i've figured out the basic matching.
I really find it easy to confuse that if you don't specify the @temps section that can leave out a lot of matches (it essentialy means 0 or more temps vs. leaving it out means no temps at all). This is a trap that the docs should call out better I think.
Anyway - now I just need to figure out how to do this programatically - and possibly I can write a few more useful refactorings I've also thought it was odd that were missing.
On Mon, 3 Jun 2024, at 12:19 PM, Gabriel Cotelli wrote:
> I've used the rewrite tool extensively but never tried to create more than one expression from the original one. I think that this probably won't work because in your example the code is just statements, but the matching expression can be in code like this:
>
> self doSomething: (
> moveSubmenu
> addToggle: 'Move right' translated
> target: self
> selector: #taskbarMoveRight
> getStateSelector: nil
> enablementSelector: #canBeMovedToRight)
>
> and in this case, you cannot replace this with two statements. So I'm tempted to say that what you want is not supported.
>
> Regards, Gabriel
>
> On Mon, Jun 3, 2024 at 5:44â¯AM Tim Mackinnon <tim(a)testit.works> wrote:
>> __
>> I've never really learned the rewrite tool but while waiting for changes to propagate through P12, I thought maybe I could use it to safely patch changes until there are official updates (and it was a good chance to get more familiar with it).
>>
>> I thought there was more documentation available for how it works (interested in any old articles - but the online help in P12 is ok - although it doesn't display in markdown - in fact give there is markdown support now - I am a bit confused what should appear more readable these days - and how to fix/contribute changes to help).
>>
>> This aside - I wanted to patch the SystemWindow>>taskbarButtonMenu: (and add my fix to move tabs to any position).
>>
>> I started writing the following search expression - the find the last call to #addToggle:... method call that has a literal referencing #canBeMovedRight - as I want to add my new menu item after it.
>>
>> e.g.
>>
>> moveSubmenu `@addToggle: `{ :node | node isLiteralNode and: [ node value = #canBeMovedToRight] }
>>
>> but I'm not sure my {} filter block is ever called, as the above matches both addToggle:... calls, and not the one I'm after? I don't understand this - any have ideas on the proper syntax for generic matching?
>>
>> Anyway - I decided that in my case there is only one - so I can match it explicitly and so I search on the full call:
>>
>> and I entered this:
>> moveSubmenu
>> addToggle: 'Move right' translated
>> target: self
>> selector: #taskbarMoveRight
>> getStateSelector: nil
>> enablementSelector: #canBeMovedToRight.
>>
>> Which matches exactly - then I want to replace the single statement with 2 statements e.g.
>>
>> moveSubmenu
>> addToggle: 'Move right' translated
>> target: self
>> selector: #taskbarMoveRight
>> getStateSelector: nil
>> enablementSelector: #canBeMovedToRight.
>>
>> moveSubmenu
>> addToggle: 'Move to' translated
>> target: self
>> selector: #taskbarMoveTo
>> getStateSelector: nil.
>>
>>
>> However this gives an error in the rewrite tool (actually it results in a zero change, that then gives an error for EpMonitor).
>>
>> But my question is - why can't you rewrite a single statement to multiple ones? I have noticed that in this case I can cascade the message send - and this then rewrites properly - so it looks like it wants to replace a single node with a single node.
>>
>> If I couldn't cascade - It seems I would have to rewrite with something like: [ "put multiple expressions here" ] value.
>>
>> This seems an odd choice - but am I missing something obvious?
>>
>> Do you have to do what I'm proposing in 2 steps - rewrite to a block (or some equivalent) and then a 2nd rewrite to simplify the expression (like a refactor step) - so its more provably correct?
>>
>> I'm just curious on this - as it seemed time to learn this properly?
>>
>> Tim
June 3, 2024
Re: Can the rewrite tool replace a single statement with multiple statements?
by Gabriel Cotelli
I've used the rewrite tool extensively but never tried to create more than
one expression from the original one. I think that this probably won't work
because in your example the code is just statements, but the matching
expression can be in code like this:
self doSomething: (
moveSubmenu
addToggle: 'Move right' translated
target: self
selector: #taskbarMoveRight
getStateSelector: nil
enablementSelector: #canBeMovedToRight)
and in this case, you cannot replace this with two statements. So I'm
tempted to say that what you want is not supported.
Regards, Gabriel
On Mon, Jun 3, 2024 at 5:44â¯AM Tim Mackinnon <tim(a)testit.works> wrote:
> I've never really learned the rewrite tool but while waiting for changes
> to propagate through P12, I thought maybe I could use it to safely patch
> changes until there are official updates (and it was a good chance to get
> more familiar with it).
>
> I thought there was more documentation available for how it works
> (interested in any old articles - but the online help in P12 is ok -
> although it doesn't display in markdown - in fact give there is markdown
> support now - I am a bit confused what should appear more readable these
> days - and how to fix/contribute changes to help).
>
> This aside - I wanted to patch the SystemWindow>>taskbarButtonMenu: (and
> add my fix to move tabs to any position).
>
> I started writing the following search expression - the find the last call
> to #addToggle:... method call that has a literal referencing
> #canBeMovedRight - as I want to add my new menu item after it.
>
> e.g.
>
> moveSubmenu `@addToggle: `{ :node | node isLiteralNode and: [ node value =
> #canBeMovedToRight] }
>
> but I'm not sure my {} filter block is ever called, as the above matches
> both addToggle:... calls, and not the one I'm after? I don't understand
> this - any have ideas on the proper syntax for generic matching?
>
> Anyway - I decided that in my case there is only one - so I can match it
> explicitly and so I search on the full call:
>
> and I entered this:
> moveSubmenu
> addToggle: 'Move right' translated
> target: self
> selector: #taskbarMoveRight
> getStateSelector: nil
> enablementSelector: #canBeMovedToRight.
>
> Which matches exactly - then I want to replace the single statement with 2
> statements e.g.
>
> moveSubmenu
> addToggle: 'Move right' translated
> target: self
> selector: #taskbarMoveRight
> getStateSelector: nil
> enablementSelector: #canBeMovedToRight.
>
> moveSubmenu
> addToggle: 'Move to' translated
> target: self
> selector: #taskbarMoveTo
> getStateSelector: nil.
>
>
> However this gives an error in the rewrite tool (actually it results in a
> zero change, that then gives an error for EpMonitor).
>
> But my question is - why can't you rewrite a single statement to multiple
> ones? I have noticed that in this case I can cascade the message send - and
> this then rewrites properly - so it looks like it wants to replace a single
> node with a single node.
>
> If I couldn't cascade - It seems I would have to rewrite with something
> like: [ "put multiple expressions here" ] value.
>
> This seems an odd choice - but am I missing something obvious?
>
> Do you have to do what I'm proposing in 2 steps - rewrite to a block (or
> some equivalent) and then a 2nd rewrite to simplify the expression (like a
> refactor step) - so its more provably correct?
>
> I'm just curious on this - as it seemed time to learn this properly?
>
> Tim
>
June 3, 2024
Can the rewrite tool replace a single statement with multiple statements?
by Tim Mackinnon
I've never really learned the rewrite tool but while waiting for changes to propagate through P12, I thought maybe I could use it to safely patch changes until there are official updates (and it was a good chance to get more familiar with it).
I thought there was more documentation available for how it works (interested in any old articles - but the online help in P12 is ok - although it doesn't display in markdown - in fact give there is markdown support now - I am a bit confused what should appear more readable these days - and how to fix/contribute changes to help).
This aside - I wanted to patch the SystemWindow>>taskbarButtonMenu: (and add my fix to move tabs to any position).
I started writing the following search expression - the find the last call to #addToggle:... method call that has a literal referencing #canBeMovedRight - as I want to add my new menu item after it.
e.g.
moveSubmenu `@addToggle: `{ :node | node isLiteralNode and: [ node value = #canBeMovedToRight] }
but I'm not sure my {} filter block is ever called, as the above matches both addToggle:... calls, and not the one I'm after? I don't understand this - any have ideas on the proper syntax for generic matching?
Anyway - I decided that in my case there is only one - so I can match it explicitly and so I search on the full call:
and I entered this:
moveSubmenu
addToggle: 'Move right' translated
target: self
selector: #taskbarMoveRight
getStateSelector: nil
enablementSelector: #canBeMovedToRight.
Which matches exactly - then I want to replace the single statement with 2 statements e.g.
moveSubmenu
addToggle: 'Move right' translated
target: self
selector: #taskbarMoveRight
getStateSelector: nil
enablementSelector: #canBeMovedToRight.
moveSubmenu
addToggle: 'Move to' translated
target: self
selector: #taskbarMoveTo
getStateSelector: nil.
However this gives an error in the rewrite tool (actually it results in a zero change, that then gives an error for EpMonitor).
But my question is - why can't you rewrite a single statement to multiple ones? I have noticed that in this case I can cascade the message send - and this then rewrites properly - so it looks like it wants to replace a single node with a single node.
If I couldn't cascade - It seems I would have to rewrite with something like: [ "put multiple expressions here" ] value.
This seems an odd choice - but am I missing something obvious?
Do you have to do what I'm proposing in 2 steps - rewrite to a block (or some equivalent) and then a 2nd rewrite to simplify the expression (like a refactor step) - so its more provably correct?
I'm just curious on this - as it seemed time to learn this properly?
Tim
June 3, 2024
Re: Recent Pharo's seem to lose first keystroke when you swap to them to paste?
by Tim Mackinnon
Hi Russ (and others) - there is an update in the ticket, it looks like the meta key's state isn't been properly tracked due to how cocoa (macos) propogates events to the sdlc library (or something like that). Pablo has spotted something he thinks might fix it - so fingers crossed on this.
And thanks for everyone piping up - it makes the system better.
Tim
see. https://github.com/pharo-project/pharo/issues/16700
On Sat, 1 Jun 2024, at 3:45 PM, Russ Whaley wrote:
> I've paid specific attention to my pastes when an (outside of Pharo) window is active... such as a web browser and I'm copying a URL, etc. I find I must select the Pharo window, THEN select the widget for the paste. If I just select the widget, it appears to be giving the window focus only, and if I then selecting the widget, the paste works fine.
>
> Hope this helps.
> Russ
>
> On Wed, May 29, 2024 at 9:03â¯AM Tim Mackinnon <tim(a)testit.works> wrote:
>> __
>> It's very stange - and it seems many people experience it from comments on the submitted but - although it seems an OSX problem (so far) and one that has happened possibly in P9 or P10.
>>
>> Perhaps we can narrow it down enough to figure out the cause (and it occurs to me to see if GT has the same issue).
>>
>> Tim
>>
>> On Wed, 29 May 2024, at 12:29 PM, stephane ducasse wrote:
>>> Tx
>>> I did not know that pasting twice was workingâ¦
>>> How a strange bug.
>>>
>>> S
>>>
>>>> On 27 May 2024, at 22:32, Tim Mackinnon <tim(a)testit.works> wrote:
>>>>
>>>> I've submitted the issue https://github.com/pharo-project/pharo/issues/16700 and noted other comments
>>>>
>>>> On Mon, 27 May 2024, at 5:02 PM, Tim Mackinnon wrote:
>>>>>
>>>>> It would be handy to know if itâs just macOS - but Iâll write up an issue this evening.
>>>>>
>>>>> Thanks for confirming.
>>>>>
>>>>> Tim
>>>>>
>>>>>
>>>>>> On 27 May 2024, at 16:01, Koen De Hondt <koen(a)all-objects-all-the-time.st> wrote:
>>>>>> I have suffered from copy & paste issues like this for a long time, in P11 and P12.
>>>>>> I always have trouble with copying text from an image. I am already used to pressing Command-C twice ð
>>>>>>
>>>>>> I use a M2 Mac with MacOS 14.5, but it happened on earlier versions of MacOS as well.
>>>>>>
>>>>>> Koen
>>>>>>
>>>>>>> On 27 May 2024, at 15:48, Noury Bouraqadi <bouraqadi(a)gmail.com> wrote:
>>>>>>>
>>>>>>> Same bug on P11 with MacOS.
>>>>>>>
>>>>>>> On May 27 2024, at 3:44 pm, Tim Mackinnon <tim(a)testit.works> wrote:
>>>>>>>> For a while I've noticed that every time I try and copy some text from a web browser or email and then paste it into pharo the first time it fails - and then thinking I didn't copy, I try it again and then realise that I have to paste twice - as the first one doesn't work.
>>>>>>>>
>>>>>>>> This didn't seem to do this in Pharo 9 (maybe 10) but its definitely the case in Pharo 11 and Pharo 12. This is on OSX (14.x) so I'm wondering if the same occurs in Windows or Linux or if its just my laptop? Its quite annoying and I'm wondering if it might be a side effect from the gradual UI changes in Pharo?
>>>>>>>>
>>>>>>>> I've looked in the issues tracker - but its a tricky thing to search for - and so I wanted to canvas experience and then will report it.
>>>>>>>>
>>>>>>>> Tim
>>>
>>> Stéphane Ducasse
>>> http://stephane.ducasse.free.fr
>>> 06 30 93 66 73
>>>
>>> "If you knew today was your last day on earth, what would you do differently? ....ESPECIALLY if, by doing something different, today might not be your last day on earth.â Calvin & Hobbes
>>>
>>>
>>
>
>
> --
> Russ Whaley
> whaley.russ(a)gmail.com
June 1, 2024
Re: Recent Pharo's seem to lose first keystroke when you swap to them to paste?
by Russ Whaley
I've paid specific attention to my pastes when an (outside of Pharo) window
is active... such as a web browser and I'm copying a URL, etc. I find I
must select the Pharo window, THEN select the widget for the paste. If I
just select the widget, it appears to be giving the window focus only, and
if I then selecting the widget, the paste works fine.
Hope this helps.
Russ
On Wed, May 29, 2024 at 9:03â¯AM Tim Mackinnon <tim(a)testit.works> wrote:
> It's very stange - and it seems many people experience it from comments on
> the submitted but - although it seems an OSX problem (so far) and one that
> has happened possibly in P9 or P10.
>
> Perhaps we can narrow it down enough to figure out the cause (and it
> occurs to me to see if GT has the same issue).
>
> Tim
>
> On Wed, 29 May 2024, at 12:29 PM, stephane ducasse wrote:
>
> Tx
> I did not know that pasting twice was workingâ¦
> How a strange bug.
>
> S
>
> On 27 May 2024, at 22:32, Tim Mackinnon <tim(a)testit.works> wrote:
>
> I've submitted the issue
> https://github.com/pharo-project/pharo/issues/16700 and noted other
> comments
>
> On Mon, 27 May 2024, at 5:02 PM, Tim Mackinnon wrote:
>
>
> It would be handy to know if itâs just macOS - but Iâll write up an issue
> this evening.
>
> Thanks for confirming.
>
> Tim
>
>
> On 27 May 2024, at 16:01, Koen De Hondt <koen(a)all-objects-all-the-time.st>
> wrote:
>
> I have suffered from copy & paste issues like this for a long time, in
> P11 and P12.
> I always have trouble with copying text from an image. I am already used
> to pressing Command-C twice ð
>
> I use a M2 Mac with MacOS 14.5, but it happened on earlier versions of
> MacOS as well.
>
> Koen
>
> On 27 May 2024, at 15:48, Noury Bouraqadi <bouraqadi(a)gmail.com> wrote:
>
> Same bug on P11 with MacOS.
>
> On May 27 2024, at 3:44 pm, Tim Mackinnon <tim(a)testit.works> wrote:
>
> For a while I've noticed that every time I try and copy some text from a
> web browser or email and then paste it into pharo the first time it fails -
> and then thinking I didn't copy, I try it again and then realise that I
> have to paste twice - as the first one doesn't work.
>
> This didn't seem to do this in Pharo 9 (maybe 10) but its definitely the
> case in Pharo 11 and Pharo 12. This is on OSX (14.x) so I'm wondering if
> the same occurs in Windows or Linux or if its just my laptop? Its quite
> annoying and I'm wondering if it might be a side effect from the gradual UI
> changes in Pharo?
>
> I've looked in the issues tracker - but its a tricky thing to search for -
> and so I wanted to canvas experience and then will report it.
>
> Tim
>
>
> Stéphane Ducasse
> http://stephane.ducasse.free.fr
> 06 30 93 66 73
>
> "If you knew today was your last day on earth, what would you do
> differently? ....ESPECIALLY if, by doing something different, today
> might not be your last day on earth.â Calvin & Hobbes
>
>
>
>
--
Russ Whaley
whaley.russ(a)gmail.com
June 1, 2024
12 Month engineer position at Toulouse in Pharo
by stephane ducasse
Hi people
Can you distribute this job position around you?
Yannick Chevalier has a position to develop a tool to detect abnomalies
DeÌveloppement de lâoutil iCANt pour la deÌtection dâanomalies
<mailto:yannick.chevalier@gmail.com>
Who: yannick.chevalier(a)gmail.com <mailto:yannick.chevalier@gmail.com>
Where: Toulouse
Salary: 45 K Euros a more experienced dev could be hired for a shorter period and get a better salary.
S.
Stéphane Ducasse
http://stephane.ducasse.free.fr
06 30 93 66 73
"If you knew today was your last day on earth, what would you do differently? ....ESPECIALLY if, by doing something different, today might not be your last day on earth.â Calvin & Hobbes
June 1, 2024