2013/4/28 stephane ducasse <stephane.ducasse@free.fr>
Hello.
I found this:
shortcut := $a ctrl. self assert: shortcut == shortcut shift
Why modifiers change receiver state instead of create new instance?
I can understand since they modify the shortcut.
To me it is very bad unexpected behaviour.
Why?
Because shortcut1 := $a ctrl. shortcut2 := $a ctrl shift created different shortcuts. And it is fully unexpected that I can not refactor it to: shotcut2 := shortcut1 shift Because after that my shortcut1 become broken. It was happen in TxTextMorph where selection and movement shortcuts created at same time TxTextMorph>>moveEditorOn: aShortcut by: aSelector self on: aShortcut do: [ self moveEditorBy: aSelector withSelection: false ]. self on: selectionModeModifier + aShortcut do: [ self moveEditorBy: aSelector withSelection: true]. To fix it I add deep copy of given shortcut before modifier operation.
There is another example:
shortcut := $a ctrl. self assert: shortcut == (KMModifier shift + shortcut)
Yes. Such operation modified argument of message #+. What the crapp! Why it not returns new instance?
I hope you agree to change this behaviour