[squeak-dev] Re: Is there a preference setting to block automatic parentheses?

Chris Muller asqueaker at gmail.com
Thu Feb 26 17:11:12 UTC 2015


>>  I think users who are trying to work on multiple
>> expressions at once are the ones who will most benefit from Auto
>> Enclose.  IOW, just for clarity, here is the process a normal user
>> would follow:
>>
>> 0 > self foo: (|)                                     "ah, the system
>> typed the closing paren for me, NICE!"
>> 1 >  self foo: (knorz bar: max)              "ah, there is something missing"
>> 2 >  |self foo: (knorz bar: max)             " ... "
>> 3 >  c add: |self foo: (knorz bar: max)      " oh, that now needs parens "
>> 4 >  c add: (|)self foo: (knorz bar: max)    "ah, the system saved me
>> a keystroke at 0, so I understand why it did this, is there a better
>> way?"
>> 5 >  c add: (|self foo: (knorz bar: max)     "Delete"
>> 5.1 > c add: (self foo: (knorz bar: max)|   "End key"
>
> Does not work If there is stuff after that, (which it typically is).
> Also, All keyboards I use have no dedicated 'end' key and, Ctrl-e (as in every unix) does not work.

Then use the arrows or click there.  We're talking about Auto Enclose
not navigation..

>> 5.2 > c add: (self foo: (knorz bar: max))|   "Closing paren.
>> Expression modification completed.  Next?"
>
> I do not at all think in 'expression modification'.
> This does not work in comments, either.
>
>> 6 >  c add: (self foo: (knorz bar: max|))     "maybe an off by one? add +1 "
>> 7 >  c add: (self foo: (knorz bar: max + 1|)) "Ohm a closing paren
>> still missing. I now type )"
>> 8 >  c add: (self foo: (knorz bar: max + 1)|)  "System did not insert
>> an additional paren, NICE!"
>
>> So, that leaves your ARGH at line 4 but because of what happened at 0,
>> the user probably understands what and why it happened.  So instead of
>> saying "ARGH" I think they might be more inquisitive to ask, "Is there
>> a better way?"  Which, of course, there is:
>>
>> 3 > c add: |self foo: (knorz bar: max)   "Press Shift+End, followed by
>> Command+(."
>
> again, no end key.

This is off topic..  simply use another means to select the
expression, there are several ways.

> and how should I type Command+(? like, Command-Shift-9? Ok.

Yes.

> Why not  '(' at that point.

Because that is used to /replace/ the currently selected expression
with a new expression.  Selection replace is how all editors work, and
we agreed we wish to minimize surprises and violations of typing
behavior invariants.

>> 4 > c add: (self foo: (knorz bar: max))|  "NICE!"
>>
>> Once they learn that, I think occurrences of the line 4 case will
>> diminish and they'll continue to gain appreciation for Auto Enclose
>> (et al).
>
> Chris, I work for +5 year with Editors where I cannot disable auto-enclose and
> I constantly get this
>
> |       "type ("
> (|)     "i just wanted (, Delete"
> |       "Whut? ("
> (|)     "again? Backspace"
> |       "Whut? ("
> (|)     "Ok. 'right'"
> ()|     "Backspace "
> (|      "finally"
>
> Actually, the "delete" case is rare, as I have to type fn+BACKSPACE.

The above may be the case for other editors, but not Squeak.  With
Squeak, the worst you have is:

|       "type ("
(|)     "i just wanted (, Delete"
(|      "finally"

When one considers all the cases where Auto Enclose helps by keeping
one's expression nestings balanced, I think the problem of 2nd line
above becomes understandable to the user, and, if it is happening
"constantly" that they will like to learn and use the better way; of
selecting the expression and pressing Command+(..

You are an experienced developer who has his ways set by now; I'm more
interested for this feature to help new users who want to be empowered
by a system suitable for power-users and not just developers..


More information about the Squeak-dev mailing list