in reply to Re^2: Assign Contains RegEx WTF??
in thread Assign Contains RegEx WTF??

How does the quote go? "Any sufficiently advanced technology is indistinguishable from magic." (Or something along those lines.)

Anyway, if the point is to write maintainable code, it still seems reasonable to document well enough that the intent is clear. Code comments aren't only for beginners. They also serve to illustrate to future maintainers that "you really did mean to do that." Plus, they will help to save time as someone else familiarizes him/herself with your code. Or is that "h(?:im|er)self"? ;)


Dave

Replies are listed 'Best First'.
Re^4: Assign Contains RegEx WTF??
by JavaFan (Canon) on May 20, 2009 at 10:31 UTC
    Yes, but where do you stop? At the end of that road is:
    $i++; # Add 1 to $i
    IMO, if you have to document the syntax, you should rewrite the code. Now, I don't think:
    ($copy = $orig) =~ s/PATTERN/REPLACEMENT/;
    is obscure. It shouldn't need comments. If you feel you're among novices or bad programmers, still don't comment the code. Rewrite it in baby steps.