Keyboard shortcuts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Panu Viljamaa-5
Blair McGlashan wrote:
...
>
> The shortcut keys for Microsoft's controls can be found in MSDN, e.g. for
> the RichEdit control (used in current Dolphin versions for the source editor
> windows):
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/aboutricheditcontrols.asp
>

Now, how to redefine/remap these within Dolphin ?

 From working with other Smalltalks I've developed a
preference for Alt-S over Ctrl-S. It is much easier
to type the former than the latter, at least on my
keyboard, in my opinion.

I would truly appreciate any hints on how this could
be done, but I think the question also raises a more
general question of why it seems so difficult (to me
at least) to infer this information by looking at the
system itself. I suppose the answer is that Dolphin
is too closely tied to the Windows sub-system, jumping
in and out of windows constantly, relying heavily on
windows message-processing, and thus making the debugger
of little help.

In contrast other Smalltalk's that have been criticized
as being less 'non-integrated' to their host platform
would seem to be easier to understand by simply debugging
through the response to a system event.

In general I'm sure most would agree that events
are a nuisance as far as program understanding is
concerned. What'd you think?

-Panu Viljamaa


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Randy Coulman-2
In reply to this post by Chris Uppal-3
Chris Uppal wrote:
>
> To be honest I simplified a bit in my post -- I'm actually using the keyboad
> accelerators that you originally posted here (for which, belatedly, thank-you)
> plus my own code that's only invoked from the menu.
>

Ah, OK.  I was curious to see how you'd done it, but I guess I already
know :-).

> |'ve never bothered to try to merge the two (just never got around to it...).
> The code's straightforward, but FWIW:
>

Thanks for the code.  I'll have to add it to my stuff.

Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Blair McGlashan-2
In reply to this post by Randy Coulman-2
Randy

Thanks for your feedback.

You wrote in message news:bpphiu$1r4pfk$[hidden email]...
> ...
> 1) When saving a method, when VW encounters a variable-like symbol it
> doesn't recognize, it pops up a list of potential actions.  The actions
> are to define the symbol as a temporary variable, a class variable, a
> global, leave it undeclared, or to correct it (see below) or cancel
> (allowing me to fix things up).  In addition, we installed a patch to
> add the choices of declaring it as an inst var, and a co-worker added an
> option to define it as new class, popping up the class creation dialog.
> ...

I can see that this would be a useful feature, and if you are used to having
it then its absence would tend to interrupt your flow. I've added an
enhancement request (#1405), though I can't promise that we'll be able to
put this into D6. Also I don't think we'd implement it in quite that way.

> ...
> 2) When saving a method, when VW encounters an unimplemented message, it
> pops up a warning that allows you to proceed, correct it, or cancel.

Ditto (#1406).

> 3) There are times when VW's "show refactoring changes" option comes in
> really handy.  Most of the time, it is just in the way.  I don't
> generally care about seeing the changes (although it helps to understand
> an unfamiliar refactoring).  When I really want it is when the RB gives
> a warning like "This will change all N implementers.  Proceed?".  In VW
> with "show refactoring changes" enabled, I can proceed and then remove
> the changes that I actually don't want.  Dolphin's scoped refactorings
> help a lot here, but there are still times I'd like to be more selective
> than the scoping allows.
>
> My ideal implementation would not be to have this as a global setting,
> but instead to have it be an option whenever one of the warning dialogs
> pops up.  So, instead of "Proceed" and "Cancel", you would have
> "Proceed", "Show Changes", and "Cancel".
>

Yes, I agree. D6 has a suitable changes browser (as part of the Rewrite
Editor) and I was intending to add a check box into some of the refactoring
dialogs to allow the user to request display of the proposed changes rather
than immediate application. I like the idea of also allowing this as an
option from one of the warning/confirmation prompts. I'll formalise this
into an enhancement request (now #1410).

> 4) Multiple buffer support.

We have discussed this recently, and were intending to do something along
these lines, hopefully in D6. I've formalised it into an enhancement request
(#1408).

> 5) Keyboard shortcuts for surrounding text with single/double quotes,
> parentheses, or brackets (see below).

I've added an enhancement recording your and Chris' request (#1409).

Thanks

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Blair McGlashan-2
In reply to this post by Chris Uppal-3
"Chris Uppal" <[hidden email]> wrote in message
news:3fc1ee27$1$122$[hidden email]...
>....   Oh, the other thing I didn't mention is that I
> also try to hook image startup to warn of packages that are older than
their
> on-disk representation.  I'm still not happy about they way I'm doing that
> (implementing DolphinSplash>>onViewClosed) but (as I've discussed here
before)
> there doesn't seem to be any better place to put it.  Is there any chance
you
> (someday) could add another startup hook that happens after all the
windows are
> re-opened and the splash screen (if any) has gone away ?  I seem to
remember
> Bill asking for something similar once too.

Yes we can do that. From the implementation of
DevelopmentSessionManager>>showSplash I'd say that it was needed to display
the Tip of the Day window more cleanly too.

> > As for the prompt you could already achieve what you want to do without
> > needing to modify any system methods by subclassing
> > DevelopmentSessionManager, overriding  and replacing the singleton
> > instance. I don't particular want to make this a standard feature
because
> > we firmly believe that the image should be used as a temporary
repository
> > for work that is in progress. If one always saves the image on exit
> > (except when aborting some modifications) then the changed packages can
> > be written out at any time.
>
> I think you miss the point.  I have no particular objection to having
unsaved
> packages in the image (except that my own development pattern calls for
not
> having unsaved packages at all), what the exit hook does is to ensure that
I
> know what's been changed when I decide *whether* to save the image on
exit.  I
> quite often exit without saving and I became very tired of accidentally
loosing
> work, and even tireder of having to stop and think (and check) to avoid
> accidents.
>

You're right I did miss the point, sorry.

Do you find it all that useful to know the complete list of changed packages
though? I'd have thought you would want to know those that have changed
during the session.

>...
> > In D6 the compiler is no longer involved in syntax colouring* - it is
> > performed dynamically as you type.
>
> Hmm..  I obviously haven't tried that yet, but I must admit I don't like
the
> sound of it.

It doesn't entirely surprise me that you say that :-). Of course this is now
almost a standard feature of modern IDEs, but to get some idea of this
particular implementation I suggest downloading the Scite editor from
http://www.scintilla.org. Its a very good text editor anyway, and well worth
having. You won't be able to experience the colouring of Smalltalk code
though, so you'll have to content yourself with the mainstream (and myriad
obscure) languages it does support. AFAIK nobody has yet written a C++
"lexer" for it in the standard Scintilla pattern, and we won't be doing so
because ours runs in Smalltalk in the image where we want it to be.

>...Will it be possible to turn it off without loosing "static"
> syntax colouring ?

No, though it will be possible to turn it off. Totally disabling it will
also disable some existing and future dynamic features (since the colouring
effectively identifies the tokens and so allows one to implement other
useful dynamic code intelligence features). For those that don't like the
use of colour to help understand code, it is possible to define all the
styles to be the same without losing the tokenisation. Within workspaces it
will be possible to switch between languages too. Workspaces no longer
support RTF, but we've put in a little Wordpad sample for that.

>
> BTW, have you been able to find a way to persuade Scintilla to distinguish
> unary sends from other identifiers ?  I don't know about anyone else, but
one
> of my most common typos is to miss the : off the end of a keyword.  The
> undefined-send underlining often catches that, but it'd be even better if
> Dolphin could distinguish between unary sends and identifiers (I suggest
"teal"
> as a colour).
>

Actually yes, but only as a side effect of the fact that our styler doesn't
yet distinguish between identifiers and unary messages. This is because it
is fundamentally a lexical analyser, and so it needs special case hacks to
make it able to identify certain syntactic features. These hacks are still
pending, but I can certainly make it distinguish between selector types
quite easily.

>...
> > > Object>>inspectorClass
> > >     Modified to answer my own inspector.
> >
> > I intend to bounce that back to development system instance
> > (SmalltalkSystem) so that it can be configured through User Preferences
in
> > the normal way (#1399).
>
> Wasn't that in the beta of D5 at one point ?
>

Yes it may have been. Probably before the alternate inspector mechanism was
introduced.

>
> > > SmalltalkSystem>>createVariableAccessors:in:classVariable:
> > >     Modified to generate code adhering to my own conventions.
> >
> > I think the best way to achieve that would be to subclass and replace
> > SmalltalkSystem's singleton instance - a straightforward process with
none
> > of the trickyness of replacing the session manager.
>
> Seems a rather heavyweight operation for such a simple task
(SmalltalkSystem's
> something of a "God class" which makes subclassing it feel almost
blasphemous
> ;-), I think I'll stick to just modifying the method directly -- after
all,
> it's not going to break anything important if I screw up.
>

Well not really. It is how the refactoring system replaces that particular
behaviour to use the 'Create Accessors' refactoring. One of the reasons we
put a lot of the actual meat of the development system in SmalltalkSystem is
that it allows it to be overridden at a single point.

>
> > - The quoting/bracketing I can add enhancement requests for if you feel
> > they are sufficiently useful (I can see that these would be useful for,
> > e.g., commenting out blocks of code, or wrapping some statements up in a
> > block). - I quite like the idea of the display string shortcut, but do
> > you really find you do this often enough to make it worthwhile?
>
> Well, *I* find them useful.  I wouldn't add them to the base system just
for
> me, though.

With Randy's additional vote, I've added an enhancement request for the
block quoting/unquoting operations. I'd quite like these myself too.

>
> I'm sorry, I should have made it clear that (with the exception of the
package
> timestamp stuff) I wasn't asking for you to adopt my changes, just trying
to
> provide a data-point for what one of your users is doing with Dolphin.
>
> (BTW, on that subject, I'm also using various aspects of the
configurability
> you've built-in to substitute my own slightly modified CHB; to rearrange
the
> "tools folder"; to replace the default method categorisation policy; and
to add
> several virtual method categories.)

I'm always interested in ideas for virtual method categories. D6 does add a
'changed' category that includes those methods that have been modified since
a class was last saved. There is also a new PluggableVirtualMethodCategory
class that makes it easier to define new virtual category types just by
defining a filter block.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Randy Coulman-2
In reply to this post by Blair McGlashan-2
Thanks for adding all of these to the list.  More below.

Blair McGlashan wrote:

> Randy
>>...
>>1) When saving a method, when VW encounters a variable-like symbol it
>>doesn't recognize, it pops up a list of potential actions.  The actions
>>are to define the symbol as a temporary variable, a class variable, a
>>global, leave it undeclared, or to correct it (see below) or cancel
>>(allowing me to fix things up).  In addition, we installed a patch to
>>add the choices of declaring it as an inst var, and a co-worker added an
>>option to define it as new class, popping up the class creation dialog.
>>...
>
> I can see that this would be a useful feature, and if you are used to having
> it then its absence would tend to interrupt your flow. I've added an
> enhancement request (#1405), though I can't promise that we'll be able to
> put this into D6. Also I don't think we'd implement it in quite that way.
>

How are you thinking it might be implemented?

I've looked briefly at how to hook into the compiler in D5 to implement
this myself, but wasn't sure that it was even possible at this stage
(and now I'm not sure how well that work would carry forward into D6).
Your response to Chris Uppal in this thread regarding Scintilla suggests
that it might be possible to trigger this from the lexical analysis done
by the new syntax highlighting code instead of the compiler.  Obviously,
I can't look into that until D6 is available.

I'm assuming that I can find enough examples in the RB and other systme
code to figure out how to perform the various actions, but even that
would be a learning curve for me.  But the part I'm most unsure about is
hooking into the compiler.

>
>>5) Keyboard shortcuts for surrounding text with single/double quotes,
>>parentheses, or brackets (see below).
>
>
> I've added an enhancement recording your and Chris' request (#1409).
>

I'll re-emphasize my earlier suggestion that I'd prefer these to be
bound to better accelerators (Ctrl-", Ctrl-', Ctrl-(, and Ctrl-[) than
what I had done, if you can figure out how to do it.  If I get some time
this evening, I'll try again getting the accelerators I want working and
post a report about which work and which don't.

Thanks again,
Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Randy Coulman-2
Randy Coulman wrote:
>
> I'll re-emphasize my earlier suggestion that I'd prefer these to be
> bound to better accelerators (Ctrl-", Ctrl-', Ctrl-(, and Ctrl-[) than
> what I had done, if you can figure out how to do it.  If I get some time
> this evening, I'll try again getting the accelerators I want working and
> post a report about which work and which don't.
>

OK, I tried again.

I can get Ctrl-( to work (using 'Ctrl+Shift+9' as the accelerator key
string).  The rest I had no luck with.  I got 'Unrecognized virtual key:
' errors.

So, I subclassed Keyboard, overrode buildVKeyMap to add $[, $', and $"
to the table, and installed my Keyboard subclass as the default.  That
got me past the errors, but typing those accelerators had no apparent
effect in the workspace.

Maybe someone else who knows more about this stuff can take it further.

Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Keith Alcock-3
In reply to this post by Blair McGlashan-2
Blair, others,

I haven't been following the "virtual method category" discussion closely, but
wonder if what you mention below would allow me to write a method comment
beginning with "Protected -" and have the method automatically added to a
protected category, which can hopefully be indicated on screen, much like is
done for "Private -".  It's something I mentioned trying to do in the past and I
think it would help distinguish between the public interface and an interface
intended for subclasses only.

Keith

Blair McGlashan wrote:

> >
> > I'm sorry, I should have made it clear that (with the exception of the
> package
> > timestamp stuff) I wasn't asking for you to adopt my changes, just trying
> to
> > provide a data-point for what one of your users is doing with Dolphin.
> >
> > (BTW, on that subject, I'm also using various aspects of the
> configurability
> > you've built-in to substitute my own slightly modified CHB; to rearrange
> the
> > "tools folder"; to replace the default method categorisation policy; and
> to add
> > several virtual method categories.)
>
> I'm always interested in ideas for virtual method categories. D6 does add a
> 'changed' category that includes those methods that have been modified since
> a class was last saved. There is also a new PluggableVirtualMethodCategory
> class that makes it easier to define new virtual category types just by
> defining a filter block.
>
> Regards
>
> Blair


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Blair McGlashan
In reply to this post by Randy Coulman-2
"Randy Coulman" <[hidden email]> wrote in message
news:bq16ns$1tv94m$[hidden email]...
>...
> [Re: Prompts to auto-correct undefined variables/messages]
> Blair McGlashan wrote:
> > I can see that this would be a useful feature, and if you are used to
having
> > it then its absence would tend to interrupt your flow. I've added an
> > enhancement request (#1405), though I can't promise that we'll be able
to
> > put this into D6. Also I don't think we'd implement it in quite that
way.
> >
>
> How are you thinking it might be implemented?

I was really commenting on the UI style. I didn't really want to critique
it, but since you ask: I find a series of prompts like that to be too
intrusive/too controlling - it's an example of the old "Who is driving?' GUI
blooper since it forces the user to respond to a series of series of prompts
putting the computer very much in the driving seat. I'd prefer to indicate
that there is a problem with certain "words" in the source code, e.g. by
underlining them, and then provide options on the context menu to perform
auto-corrections at the users behest.

>
> I've looked briefly at how to hook into the compiler in D5 to implement
> this myself, but wasn't sure that it was even possible at this stage
> (and now I'm not sure how well that work would carry forward into D6).
> Your response to Chris Uppal in this thread regarding Scintilla suggests
> that it might be possible to trigger this from the lexical analysis done
> by the new syntax highlighting code instead of the compiler.  Obviously,
> I can't look into that until D6 is available.

To some extent that is true; one could identify undefined selectors, but
undefined variables would require at least some syntax analysis to pick up
the temps. I think probably we would have the compiler issue warnings about
undefined messages/variables and then interpret these after the fact.

>
> I'm assuming that I can find enough examples in the RB and other systme
> code to figure out how to perform the various actions, but even that
> would be a learning curve for me.  But the part I'm most unsure about is
> hooking into the compiler.

If I was going to have a go at it in D5 I would hook in before the main
Dolphin compiler is invoked, running the source through the RBParser
(SmalltalkParser) to build a parse tree, and then working with that to
identify errors that could be corrected. The easiest implementation would be
to produce a series of prompts (:-)) for each possible correction that one
encountered in the tree. One would then modify the tree to make the actual
corrections, and then re-emit the code from the tree. As you say, this would
involve a learning curve, but I think it would be quite an interesting
project.

>
> >
> >>5) Keyboard shortcuts for surrounding text with single/double quotes,
> >>parentheses, or brackets (see below).
> >
> >
> > I've added an enhancement recording your and Chris' request (#1409).
> >
>
> I'll re-emphasize my earlier suggestion that I'd prefer these to be
> bound to better accelerators (Ctrl-", Ctrl-', Ctrl-(, and Ctrl-[) than
> what I had done, if you can figure out how to do it.  If I get some time
> this evening, I'll try again getting the accelerators I want working and
> post a report about which work and which don't.

Well there are a number of issues with using certain control characters as
part of accelerator key sequences. Normally accelerator key sequences (or
shortcut keys) are stored down as a virtual key code plus some modifiers for
Ctrl, Shift, etc. The resulting key code is constant regardless of keyboard
layout, and this is what Dolphin stores. However some keys, such as quote
key don't have a standard virtual key number, making them unstable when you
switch between keyboard layouts. For example the quote key on a US keyboard
is allocated VK_OEM_7, which on a UK keyboard corresponds with the # key.

Now the #additionalAccelerators mechanism, used to define extra accelerator
key sequences that are not on the menus, uses a conversion from a
"normalised" representation of the key names (in this instance normal means
the UK English key names) to the virtual key codes. i.e. the names you use
in code would always be the UK English key names, even if these are not the
key names you see for accelerator keys on the menus (Dolphin will display
the regional key names on menus). The mapping from UK English key names to
the correct virtual key codes is not locale sensitive, or subject to
variations dependent on keyboard layout (i.e. the key sequence you name will
be the key sequence you get, regardless of whether the position of the key
on the keyboard is the same as a UK English keyboard). However this only
works where a key has a standard virtual keycode. In fact the table we use
for the conversions should only include the keys for which virtual key codes
are available, so you just won't be able to use Ctrl+' for a key sequence
with the additionalAccelerators mechanism, it is an error.

Furthermore most of those keys are shifted, so if you were defining them as
key sequences through the additionalAccelerators mechanism (rather than in
the MenuComposer where you just type them into a HotKey control), then you
would need to express them as 'Ctrl+Shift+<unshifted key>'. Bearing in mind
that the translations from strings are normalised to use the UK keyboard
layout, this might cause problems with certain shifted keys since the
keyboard layout may be different for the shifted keys associated with the
unshifted keys. This is another way of saying that there might not be a
standard virtual key code for some shifted keys either.

Ctrl+[ is already in use for the 'Move Temporary to Inner Scope'
refactoring, but probably shouldn't be because it has an OEM virtual key
code, and may suffer from keyboard layout sensitivity too (its OK between UK
and US keyboards).

Fundamentally, though, it is possible to use almost any key sequence you
like, and if working through the MenuComposer then you can just type in the
one you want. Otherwise you need to work out the numeric key sequence for
the key you want (try AcceleratorPresenter show inspect, and observe the
value to find out the code), and then you can add in an additional
accelerator using an IDE extension. I think Chris Demers' "Code Context
Lookup Tool" does this.

To try this out, open a new workspace from the toolbar. Now click on the
Visual Object Finder tool on that workspace's toolbar, and then click over
the workspace's own caption. In the resulting inspector, select the
workspace itself, and then in the value pane evaluate the following:

 cmd := CommandMenuItem
    command: #cloneNew    "Use your command here - this is just a demo"
    description: 'Quote Selection'.
 cmd acceleratorKey: 4830.
 cmd registerAcceleratorKeyIn: view combinedAcceleratorTable.

If you now press Ctrl+' on a US keyboard in that workspace, you should find
a clone of it will be opened. Also if you invoke the 'Key Bindings' command
on its help menu, you should see the new key binding listed. If you have a
UK keyboard, then you would have to press Ctrl+# to operate the command.

I expect this is more information and detail than you wanted. Perhaps I
should have just quoted Microsoft's "Guidelines for Keyboard User Interface
Design"
(http://msdn.microsoft.com/library/?url=/library/en-us/dnacc/html/ATG_Keyboa
rdShortcuts.asp?frame=true):

    "Avoid using the following characters for shortcut keys: @ Ã,£ $ {} []
\ ~ | ^ ' < > "

(in the section "Assigning Shortcut Keys").

The reasoning for this is not explained, but I suspect it might be something
to do with the keyboard layout issues I've described.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Chris Uppal-3
In reply to this post by Blair McGlashan-2
Blair McGlashan wrote:

> Do you find it all that useful to know the complete list of changed
> packages though? I'd have thought you would want to know those that have
> changed during the session.

For me it comes to pretty-much the same thing.  I rarely go long without saving
the packages I'm working on, and I also save out all the OA (etc) packages
that come with the initial image, so under normal circumstances "changed" and
"recently changed" are essentially synonyms.  I can see how other working
practices would cause the list to get cluttered with irrelevancies, though.


> > > In D6 the compiler is no longer involved in syntax colouring* - it is
> > > performed dynamically as you type.
> >
> > Hmm..  I obviously haven't tried that yet, but I must admit I don't
> > like the sound of it.
>
> It doesn't entirely surprise me that you say that :-).

Well, of course you aren't surprised!  Not only am I an iconoclast and
confirmed Ludite, I' also mentioned the matter only a little while ago in this
very ng...


> Of course this is
> now almost a standard feature of modern IDEs

Yep.  Ugh!


> but to get some idea of this
> particular implementation I suggest downloading the Scite editor from
> http://www.scintilla.org. Its a very good text editor anyway, and well
> worth having.

As it happens, I'd got Scite already (came with Ruby, I think) -- so far it has
failed to persuade me away from vi (or even PFE)...


>You won't be able to experience the colouring of Smalltalk
> code though,

ST/X does on-the-fly colouring too.  I never did like it.  It may be because I
tend to watch the screen as I'm typing, so the colour changes are
irritating/distracting.


> > ...Will it be possible to turn it off without loosing "static"
> > syntax colouring ?
>
> No, though it will be possible to turn it off.

Pity.  I really need the colouring to be able to read Smalltalk (I don't need,
want, or use syntax colouring for other languages).  Oh, well.  I'm sure I'll
be able to hack something.  Maybe turn the colouring off (or down) on the first
keystroke and turn it back on on 'accept', or hack Scintilla, or something...


> > BTW, have you been able to find a way to persuade Scintilla to
> > distinguish unary sends from other identifiers ?
> [...]
> I can certainly make it distinguish between
> selector types quite easily.

Excellent.  I look forward to it.


> > > I think the best way to achieve that would be to subclass and replace
> > > SmalltalkSystem's singleton instance - a straightforward process with
> > > none of the trickyness of replacing the session manager.
> >
> > Seems a rather heavyweight operation [...]
> >
>
> Well not really. It is how the refactoring system replaces that particular
> behaviour to use the 'Create Accessors' refactoring. One of the reasons we
> put a lot of the actual meat of the development system in SmalltalkSystem
> is that it allows it to be overridden at a single point.

Ah, right.  I'd missed that aspect of the design.  Thanks.


> I'm always interested in ideas for virtual method categories. D6 does add
> a 'changed' category that includes those methods that have been modified
> since a class was last saved.

That sounds good.

FWIW, I have virtual categories for:

    Loose methods
    Methods that are overridden
    Methods that are not referred to
    Methods that refer to undefined selectors

I find all of them very useful -- unfortunately the last three are too slow
without some rather elaborate caching (in fact I use a global 'database' of
cross-reference info that adds around 1M to my image).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Defining undefined symbols (was Re: Keyboard shortcuts)

Randy Coulman-2
In reply to this post by Blair McGlashan
Blair McGlashan wrote:

>
> I was really commenting on the UI style. I didn't really want to critique
> it, but since you ask: I find a series of prompts like that to be too
> intrusive/too controlling - it's an example of the old "Who is driving?' GUI
> blooper since it forces the user to respond to a series of series of prompts
> putting the computer very much in the driving seat. I'd prefer to indicate
> that there is a problem with certain "words" in the source code, e.g. by
> underlining them, and then provide options on the context menu to perform
> auto-corrections at the users behest.
>

I read your message this morning before work, but didn't have time to
respond. I've been thinking about it off and on all day.

Generally, I agree with you about the intrusive UI.  In this case, I'm
not sure I do.  It's really hard to know without actually trying it both
ways.  The way you describe reminds me a bit of Eclipse, where you get a
little symbol in the margin that you can click to get a list of
"auto-correction" options.  Is that along the lines you're thinking, but
with the symbol actually being syntax highlighting on the offending code?

Here are my current thoughts:

- As I'm typing in code, I certainly don't want to be interrupted.  If
this tool is smart enough to recognize undefined symbols as they're
typed, then some sort of syntax highlight is quite appropriate.

- There's an add-on package for VW that does on-the-fly syntax
highlighting.  There's some lags/delays in it that I find distracting,
and the default set of markups use different sizes of fonts, so your
text jumps around a lot when you're typing.  That's very distracting.
On the other hand, the highlighting is helpful, so I haven't turned it
off yet (although this is partly in deference to some co-workers who
like using it). I'm guessing/hoping Scintilla won't suffer from this
same problem.

- When I use the tool that VW has, I basically switch from
typing/editing mode to "book-keeping" mode where the tool helps me
define anything that wasn't already defined.  In that mode, I really
don't mind the intrusive UI.  In fact, I think I prefer it, because I
don't have to visually scan for the appropriate syntax highlighting,
click the right mouse button, and choose the correct operation.  The
tool scans the code for me and pops up a constrained menu with (mostly)
only the choices I care about.  The menu has nice big buttons, so it's
easy to hit the one I want.  I think (but can't be sure until I try it
both ways) that the intrusive mode would improve flow in this case.

- It also occurred to me today that, even without a tool like this,
there would be a couple of ways to make Dolphin flow better when doing
"strict" TDD:

1) Allow methods with undefined symbols to be saved in spite of the
error.  If there is a reference to a class or variable that is not yet
defined, warn about it, but don't stop the method from being accepted.
That way, it would be possible to switch away to define the new class or
instance variable that would make the method work.

2) Multiple buffer support.  I could simply switch to a second buffer to
define the class or instance variable, then come back and save the
method.  Currently, I have to open another browser to do this.

I still want the tool, though :-).

>
> If I was going to have a go at it in D5 I would hook in before the main
> Dolphin compiler is invoked, running the source through the RBParser
> (SmalltalkParser) to build a parse tree, and then working with that to
> identify errors that could be corrected. The easiest implementation would be
> to produce a series of prompts (:-)) for each possible correction that one
> encountered in the tree. One would then modify the tree to make the actual
> corrections, and then re-emit the code from the tree. As you say, this would
> involve a learning curve, but I think it would be quite an interesting
> project.
>

You are an evil, evil person.  You give me a good idea like this to try
and do it right before a 4-day weekend when I have other projects that I
should really be working on instead.  Now I've got to spend all weekend
resisting this temptation.  :-)

Seriously, that's a good idea.  I hadn't thought of doing it that way,
but it makes sense.  If I succumb to the temptation, I'll let you know
how it goes.

Thanks,
Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Randy Coulman-2
In reply to this post by Blair McGlashan
Blair McGlashan wrote:

>
> I expect this is more information and detail than you wanted. Perhaps I
> should have just quoted Microsoft's "Guidelines for Keyboard User Interface
> Design"
> (http://msdn.microsoft.com/library/?url=/library/en-us/dnacc/html/ATG_Keyboa
> rdShortcuts.asp?frame=true):
>
>     "Avoid using the following characters for shortcut keys: @ Ã,£ $ {} []
> \ ~ | ^ ' < > "
>
> (in the section "Assigning Shortcut Keys").
>

I appreciate the detailed response.  Definitely enough to make me back
off on this one.  I had done some searching in MSDN last night, but
hadn't found this particular article.   I wasn't aware that the keyboard
layout issues would be a problem, but they certainly seem to be.

Thanks,
Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Defining undefined symbols (was Re: Keyboard shortcuts)

Blair McGlashan
In reply to this post by Randy Coulman-2
Randy

You wrote in message news:bq438d$1t4rv6$[hidden email]...
> >
> > I was really commenting on the UI style. I didn't really want to
critique
> > it, but since you ask: I find a series of prompts like that to be too
> > intrusive/too controlling - it's an example of the old "Who is driving?'
GUI
> > blooper since it forces the user to respond to a series of series of
prompts
> > putting the computer very much in the driving seat. I'd prefer to
indicate
> > that there is a problem with certain "words" in the source code, e.g. by
> > underlining them, and then provide options on the context menu to
perform

> > auto-corrections at the users behest.
> >
>
> I read your message this morning before work, but didn't have time to
> respond. I've been thinking about it off and on all day.
>
> Generally, I agree with you about the intrusive UI.  In this case, I'm
> not sure I do.  It's really hard to know without actually trying it both
> ways.  The way you describe reminds me a bit of Eclipse, where you get a
> little symbol in the margin that you can click to get a list of
> "auto-correction" options.  Is that along the lines you're thinking, but
> with the symbol actually being syntax highlighting on the offending code?

That is a similar style, yes. BTW: I think this is particularly important
for the unimplemented messages. These may not even be errors, so one
certainly doesn't want to be forced to respond to a prompt to correct them
each time one saves a method.

>
> Here are my current thoughts:
>
> - As I'm typing in code, I certainly don't want to be interrupted.  If
> this tool is smart enough to recognize undefined symbols as they're
> typed, then some sort of syntax highlight is quite appropriate.

I quite agree.

>
> - There's an add-on package for VW that does on-the-fly syntax
> highlighting.  There's some lags/delays in it that I find distracting,
> and the default set of markups use different sizes of fonts, so your
> text jumps around a lot when you're typing.  That's very distracting.
> On the other hand, the highlighting is helpful, so I haven't turned it
> off yet (although this is partly in deference to some co-workers who
> like using it). I'm guessing/hoping Scintilla won't suffer from this
> same problem.

No there is no delay. The colouring is instantaneous and responds
immediately as you type. In my experience this is a lot less distracting
than colouring that happens in a "blocky" way after a short delay. We use
similar default styles to the ones we've employed since the very early
Dolphin betas, and these certainly don't include any changes of font size.
It is also very easy to customise the styles through the User Preferences.

Actually I find that the instantaneous colouring helps me to see and correct
errors as I type. Certainly it makes unterminated comments and strings
immediately obvious, but there are other more subtle errors one can spot
such as a missing period causing the variable reference at the start of the
next statement to be treated as a further unary message send.

>
> - When I use the tool that VW has, I basically switch from
> typing/editing mode to "book-keeping" mode where the tool helps me
> define anything that wasn't already defined.  In that mode, I really
> don't mind the intrusive UI.  In fact, I think I prefer it, because I
> don't have to visually scan for the appropriate syntax highlighting,
> click the right mouse button, and choose the correct operation.  The
> tool scans the code for me and pops up a constrained menu with (mostly)
> only the choices I care about.  The menu has nice big buttons, so it's
> easy to hit the one I want.  I think (but can't be sure until I try it
> both ways) that the intrusive mode would improve flow in this case.

We could always include a "Correct All" command that lets the computer drive
the UI, and even allow this to be run automatically each time you save a
method. This could be done with a separate Correct+Accept command (like the
existing Reformat+Accept), or perhaps by having an option to always correct
on accept.

>
> - It also occurred to me today that, even without a tool like this,
> there would be a couple of ways to make Dolphin flow better when doing
> "strict" TDD:
>
> 1) Allow methods with undefined symbols to be saved in spite of the
> error.  If there is a reference to a class or variable that is not yet
> defined, warn about it, but don't stop the method from being accepted.
> That way, it would be possible to switch away to define the new class or
> instance variable that would make the method work.
>
> 2) Multiple buffer support.  I could simply switch to a second buffer to
> define the class or instance variable, then come back and save the
> method.  Currently, I have to open another browser to do this.

Of these I think (2) is the better solution. I don't particularly like the
idea of being able to define invalid code artefacts. We allow this for
"unattended" compilations, such as through a file-in, of course.

As you say one can simulate multiple multiple buffers by opening multiple
browsers. You may not be aware, however, that you can switch to the class
definition tab in the class browsers to add new instance variables without
losing the method source you are editing.

>
> I still want the tool, though :-).
>
> >
> > If I was going to have a go at it in D5 I would hook in before the main
> > Dolphin compiler is invoked, running the source through the RBParser
> > (SmalltalkParser) to build a parse tree, and then working with that to
> > identify errors that could be corrected. The easiest implementation
would be
> > to produce a series of prompts (:-)) for each possible correction that
one
> > encountered in the tree. One would then modify the tree to make the
actual
> > corrections, and then re-emit the code from the tree. As you say, this
would

> > involve a learning curve, but I think it would be quite an interesting
> > project.
> >
>
> You are an evil, evil person.  You give me a good idea like this to try
> and do it right before a 4-day weekend when I have other projects that I
> should really be working on instead.  Now I've got to spend all weekend
> resisting this temptation.  :-)
>
> Seriously, that's a good idea.  I hadn't thought of doing it that way,
> but it makes sense.  If I succumb to the temptation, I'll let you know
> how it goes.
>

:-). Just tell your family it was my fault. I'm not likely to encounter
them, so I'm probably safe.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Defining undefined symbols (was Re: Keyboard shortcuts)

Ian Bartholomew-18
Blair McGlashan wrote:

> That is a similar style, yes. BTW: I think this is particularly
> important for the unimplemented messages. These may not even be
> errors, so one certainly doesn't want to be forced to respond to a
> prompt to correct them each time one saves a method.

<fx: Blows own trumpet a little>  I quite like the way I added the
unimplemented messages warning to my goodie.  If there are no other
errors and it finds an unimplemented selector (or selectors) in the
method being saved then it just beeps a warning and lists the offenders
in the browser's status bar.  It seems to be nicely unobtrusive, if I am
expecting it I can easily ignore the beep, but immediately provides
enough information to correct most spelling or syntax errors.

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Defining undefined symbols (was Re: Keyboard shortcuts)

Blair McGlashan
"Ian Bartholomew" <[hidden email]> wrote in message
news:1Wkxb.13621$[hidden email]...

> Blair McGlashan wrote:
>
> > That is a similar style, yes. BTW: I think this is particularly
> > important for the unimplemented messages. These may not even be
> > errors, so one certainly doesn't want to be forced to respond to a
> > prompt to correct them each time one saves a method.
>
> <fx: Blows own trumpet a little>  I quite like the way I added the
> unimplemented messages warning to my goodie.  If there are no other
> errors and it finds an unimplemented selector (or selectors) in the
> method being saved then it just beeps a warning and lists the offenders
> in the browser's status bar.  It seems to be nicely unobtrusive, if I am
> expecting it I can easily ignore the beep, but immediately provides
> enough information to correct most spelling or syntax errors.

Ian, I am a big fan of this IDE extension of yours too.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Blair McGlashan
In reply to this post by Keith Alcock-3
"Keith Alcock" <[hidden email]> wrote in message
news:[hidden email]...
> Blair, others,
>
> I haven't been following the "virtual method category" discussion closely,
but
> wonder if what you mention below would allow me to write a method comment
> beginning with "Protected -" and have the method automatically added to a
> protected category, which can hopefully be indicated on screen, much like
is
> done for "Private -".  It's something I mentioned trying to do in the past
and I
> think it would help distinguish between the public interface and an
interface
> intended for subclasses only.
>

Method categories in Dolphin are objects, and are responsible for deciding
their own membership. Standard method categories do this by reference to a
static dictionary similar to the traditional Smalltalk-80 "organisation".
However since a method can belong to as many categories as one likes, and
the categories are objects and can define their own behaviour, one can
define category classes that implement any particular classification scheme
that one might want. So yes, you could define a method category that
determines its membership be looking for a particular pattern in the method
commment. Whether or not this would be performant or useful is something
that you'll have to judge by trying it out and seeing whether it meets your
expectations.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Defining undefined symbols (was Re: Keyboard shortcuts)

Randy Coulman-2
In reply to this post by Blair McGlashan
Blair McGlashan wrote:
>
> That is a similar style, yes. BTW: I think this is particularly important
> for the unimplemented messages. These may not even be errors, so one
> certainly doesn't want to be forced to respond to a prompt to correct them
> each time one saves a method.
>

I agree.  I'm thinking mostly of variables and classes, not
unimplemented messages.  What VW seems to do for unimplemented messages
is prompt once, and then never again for the same message.

>
> We could always include a "Correct All" command that lets the computer drive
> the UI, and even allow this to be run automatically each time you save a
> method. This could be done with a separate Correct+Accept command (like the
> existing Reformat+Accept), or perhaps by having an option to always correct
> on accept.
>

This would be ideal.  I think I like the option idea better, because
otherwise I'd like "Correct + Reformat + Accept" :-).

>
> As you say one can simulate multiple multiple buffers by opening multiple
> browsers. You may not be aware, however, that you can switch to the class
> definition tab in the class browsers to add new instance variables without
> losing the method source you are editing.
>

I was not aware of this.  Thanks for the tip.  That will help with
instance variables for sure.  Of course, temporaries you can fix right
in place.  That leaves undefined classes.  The times those most affect
me are when I'm writing my first test for a new class, because I write
the test first.

Thanks,
Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Defining undefined symbols (was Re: Keyboard shortcuts)

Randy Coulman-2
In reply to this post by Ian Bartholomew-18
Ian Bartholomew wrote:
>
> <fx: Blows own trumpet a little>  I quite like the way I added the
> unimplemented messages warning to my goodie.  If there are no other
> errors and it finds an unimplemented selector (or selectors) in the
> method being saved then it just beeps a warning and lists the offenders
> in the browser's status bar.  It seems to be nicely unobtrusive, if I am
> expecting it I can easily ignore the beep, but immediately provides
> enough information to correct most spelling or syntax errors.
>

That's yours?  I thought it was part of the base image.  Sorry about
that.  When I get a new image, one of the first things I do is load your
stuff, so I just don't notice what belongs to what.  I like that extension.

Randy
--
Randy Coulman
NOTE: Reply-to: address is spam-guarded.  Reassemble the following to
reply directly:
rcoulman at charter dot net


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts

Joseph Pelrine-6
In reply to this post by Blair McGlashan
Blair

Blair McGlashan wrote:

>"Keith Alcock" <[hidden email]> wrote in message
>news:[hidden email]...
>
>>Blair, others,
>>
>>I haven't been following the "virtual method category" discussion closely,
>>
>but
>
>>wonder if what you mention below would allow me to write a method comment
>>beginning with "Protected -" and have the method automatically added to a
>>protected category, which can hopefully be indicated on screen, much like
>>
>is
>
>>done for "Private -".  It's something I mentioned trying to do in the past
>>
>and I
>
>>think it would help distinguish between the public interface and an
>>
>interface
>
>>intended for subclasses only.
>>
>
>Method categories in Dolphin are objects, and are responsible for deciding
>their own membership. Standard method categories do this by reference to a
>static dictionary similar to the traditional Smalltalk-80 "organisation".
>However since a method can belong to as many categories as one likes, and
>the categories are objects and can define their own behaviour, one can
>define category classes that implement any particular classification scheme
>that one might want. So yes, you could define a method category that
>determines its membership be looking for a particular pattern in the method
>commment. Whether or not this would be performant or useful is something
>that you'll have to judge by trying it out and seeing whether it meets your
>expectations.
>
Reading this, I just realized that you've defined (at least what I
understand) "traits" to be! Quite interesting...

Cheers

--
--
Joseph Pelrine [ | ]
MetaProg GmbH
Email: [hidden email]
Web:   http://www.metaprog.com

"If you don't live on the edge, you're taking up too much space" -
Doug Robinson


--
--
Joseph Pelrine [ | ]
MetaProg GmbH
Email: [hidden email]
Web:   http://www.metaprog.com

"If you don't live on the edge, you're taking up too much space" -
Doug Robinson


12