Re: multi-line comments, C macros, Pod abuse

2006-08-19 Thread Nicholas Clark
On Sat, Aug 19, 2006 at 02:26:28AM +, Luke Palmer wrote:
 On 8/19/06, Aaron Crane [EMAIL PROTECTED] wrote:
 You don't actually need a macro in that case:
 
 if 0 { q
 ...
  }
 
 Which, of course, eliminates the original desire to have a
 code-commenting construct where you just change the 0 to a 1.  After
 all, we already have #{}.  Incidentally, you could consider that the
 desired construct, because it balances, and a closure at statement
 level executes itself:
 
 #{
if $baz {
$foo.bar
}
 }
 
 To uncomment, remove the # before the {.

Or in the same vein

if 0 { q

#  }


To uncomment the real code, add # before the if.

Although it is visually complex.

Nicholas Clark


Re: multi-line comments, C macros, Pod abuse

2006-08-19 Thread Dr.Ruud
Stuart Cook schreef:
 Larry Wall:

 if 0 {
 ...
 }

 The one disadvantage of that approach is that it will break if the
 commented-out code temporarily fails to compile.

How frequent does that happen?

And in that case s/if 0/\#/, as Luke mentioned.
And if the compile failure has to do with {}, use other braces.


But would the following work?

0 or q:to/END42/
  ...
END42

-- 
Affijn, Ruud

Gewoon is een tijger.




Re: multi-line comments, C macros, Pod abuse

2006-08-19 Thread Daniel Hulme
 Stuart Cook schreef:
  Larry Wall:
 
  if 0 {
  ...
  }
 
  The one disadvantage of that approach is that it will break if the
  commented-out code temporarily fails to compile.
 
 How frequent does that happen?
All the time. I often comment out bits of code while I'm refactoring or
such, because I've removed some functions or that the code depends on
s.t. it won't compile any more, I want to compile it to check that the
bits I've done work, and I want the commented-out code visible to remind
me to rewrite it later.

 And in that case s/if 0/\#/, as Luke mentioned.
 And if the compile failure has to do with {}, use other braces.
As you say, alternatives are available.

 But would the following work?
 
 0 or q:to/END42/
   ...
 END42
Shouldn't it be C0 and if you don't want the RHS (or C1 or, I
suppose)? In either case, wouldn't this have the side-effect of setting
the last-evaluated value, which might also be undesired.

-- 
I will take my life into my hands And I will use it.'MacArthur Park'
I will win the worship in their eyes And I will lose it.  Jimmy Webb
I will have the things that I desire(( http://surreal.istic.org/
And my passion flow like rivers to the sky  (( It's like a DEATH CIRCUS!


pgpsHubb64lJ2.pgp
Description: PGP signature