Re: commenting out blocks of code



Hi Steven,

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.
Windows guidelines:
http://msdn.microsoft.com/library/en-us/dnwue/html/appxB.asp

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.

Neil
.



Relevant Pages

  • Re: [SLE] TVTIME 1.0.1
    ... one you cannot figure out how to exit!). ... Then use this command to find the process ID of the ... modified buffer and without asking if you want to do that. ... simple:q command will quit only if the buffer is not modified. ...
    (SuSE)
  • writing to a - log file
    ... I have been struggling with this command for a whole day. ... the command prompt without typing in exit or quit from dos prompt. ...
    (comp.os.msdos.programmer)
  • Re: writing to a - log file
    ... I have been struggling with this command for a whole day. ... the command prompt without typing in exit or quit from dos prompt. ... Charles Dye raster@xxxxxxxxxxxxx ...
    (comp.os.msdos.programmer)
  • Re: newbie perl questions
    ... > Is there a way to use the Perl interpereter interactivwely? ... > type a command ... Type 'exit' to quit. ...
    (comp.lang.perl.misc)
  • Re: dd command & reading in background
    ... ^ D,"UnixReview: Shell Corner: The dspl Korn Shell ... user input timeout, do a search on C.U.S. for the ... # 0<c<127 - job exited with this exit code ...
    (comp.unix.shell)