Re: commenting out blocks of code
- From: Neil Hodgson <nyamatongwe+thunder@xxxxxxxxx>
- Date: Sat, 18 Feb 2006 03:14:49 GMT
I see the developers of Scite are either newbies to GUI programming, or
they operate in a world of their own. Ctrl-Q is reserved for Quit (or
Exit) in every GUI API I know of.
I am the developer responsible for SciTE and the Ctrl+Q decision.
Ctrl+Q is not reserved for Quit on every platform. Perhaps you have
never used Windows where Exit does not normally have a distinct command key of its own but can be performed with Alt+F4 (Close) for single window applications. Since exiting an application is a far less common action than modifying the data within that application, it doesn't deserve one of the more easily typed key bindings. Some applications use Ctrl+Q but, of the applications I currently have open, Firefox, Internet Explorer, Explorer, iTunes, Visual Studio .NET, WordPad, QuickTime, PythonWin, and WinMerge don't respond to Ctrl+Q by quitting and Thunderbird does.
It is *easy* to detect when a line is already commented. It starts with a
#. The ~ is superfluous.
It is not usual to change a line from being code to being a comment as most lines of code make no sense as English text. If you do sometimes want to do this, the "#" key can be pressed at the beginning of a line. Ctrl+Q exists to allow commenting out sections of code that you do not want to be active. The "~" acts to differentiate these different uses of one language feature and makes it easy to apply the operation over
ranges that include comments and then invert the operation.
Commenting and uncommenting should be two different commands: the whole
point of nested comments is that it allows you to comment a block of text
which may already contain comments. Having one command do both commenting
and uncommenting according to the presence or absence of semantic clues in
the text is a recipe for failure ("No you stupid computer, I want to
COMMENT that block, not uncomment it!!!").
Comments and commented out code are distinct. Using the same marker
for both is ambiguous. Few languages support true nested comments.
SciTE's implementation of Ctrl+Q is very popular although you can change the text inserted/removed from "#~" to "#" if you prefer and SciTE also includes a command to add stream style comments for languages like /* C++ */.
Imagine if your text editor used cntl-C for both copy and paste, somehow
guessing whether you wanted to copy selected text or paste over it
according to some subtle clue in the text itself. Wouldn't that be fun?
Your imaginary command makes no sense as it is described. What are its full semantics? Why was it implemented this way?
BTW, I have been implementing GUIs for over 20 years so maybe me and
the other SciTE users are in our own world. It does feel like a
friendly, enjoyable, comfortable world, though.
- Prev by Date: Re: zope 3.2 and imprt errors
- Next by Date: Re: Python 3000 deat !? Is true division ever coming ?
- Previous by thread: Re: commenting out blocks of code
- Next by thread: Re: commenting out blocks of code