On 28 April 2013 22:01, Denis Kudriashov <dionisi...@gmail.com> wrote:

> 2013/4/28 stephane ducasse <stephane.duca...@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].
>

Wow, that's beatiful piece of code!
This is how it should look like: clear and understandable from a first
sight.
So, we should fix the shortcuts api to let this beauty live :)


>
> 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
>> >
>> >
>>
>>
>>
>


-- 
Best regards,
Igor Stasenko.

Reply via email to