[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: awesome feature (yet to be added?)

From: Stephen J. Turnbull
Subject: Re: awesome feature (yet to be added?)
Date: Tue, 06 May 2014 17:19:35 +0900

Davis Herring writes:
 > Le or Bric wrote:

 >> Judging by the uptake.  We are the only two to think this is
 >> useful.  :)

There is an ancient solution with ancient support:  use #ifdef, not
comments, to control the language translator, and use hideif to
control your Emacs display if you like.  hideif wouldn't take much
work to "grey out" instead of completely hide the "inactive" code, now
that everybody has GUI displays capable of that.

 > I thought about implementing `invert-comment' a few years ago, but
 > I wasn't sure what to do about code like this:


 > Your idea of markers likely works out better than "toggle the
 > comments" because of cases like these.

I don't see why it would.  The markers would need to be user-
maintained to handle the cases you presented.  And therefore, highly
problematic[1], even if you provide high-level helper commands.  Finally,
there's another case you didn't mention: overlapping "togglable"
comment regions.

If one really wants to use comments for such cases (whether because of
personal preference or because of a style guide that doesn't allow or
strongly discourages random #ifdefs, or a language that doesn't have
them[2]), (1) you could use C++ and be consistent about which comment
convention is for comments and which for poor-man's ifdefs, or (2) you
could hack up VC support (ie, each toggleable comment configuration
would be a separate branch).

Solution (2) probably requires insane amounts of branching and merging
(combinatorial explosion of "#ifdef branches" since each local
alternative would require a pair of branches on top of each existing
#ifdef branch-pair -- could be lazy, but still...), so only git could
really support it, and you'd need to have substantial automatic
support for picking the right branches when switching for the same
reason (especially if "lazy", you'd need to merge on-the-fly).

[1]  I wonder if such development techniques weren't involved in
the recent embarrassing gnutls and openssl authentication bugs.

[2]  Although all languages should support a conditional statement
that could be used the same way with some decrease in runtime

reply via email to

[Prev in Thread] Current Thread [Next in Thread]