Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

That's pretty good, but has the effect of also disabling any side effects of the conditional. Sometimes that's okay, but mostly you want the rest of the code to run normally and only disable the action within the block.

It also misses the all the other opportunities where the #{ ... } might work, from bareblocks to inline blocks to subroutine bodies. In fact anywhere where a scoping block can currently exist, if that block is preceded by a #, then the entire block would be made noop.

It even looks (to the non-expert source diver I am) as if it would be fairly easy to implement. There are some edge cases that would need to be dealt with if it were to be truely universal. For example, to work with the inline blocks of map and grep, it would need to replace the disabled block with a default behaviour. Eg. pass everything through for grep, and the input unchanged for map.

Dealing with non-core and user-defined map-like subs, (List::Util::reduce/first, etc), would be a problem, but then they need prototypes to function and there are a lot of dark corners surrounding protoyped subs; one more probably wouldn't hurt.

Any way you cut it, the absence of a proper multi-line comment is a thorn in the side of Perl 5 that I'd love to see corrected in Perl 6. I think the addition of a scoped-comment, one that works with the language structure rather than arbitrary lines, would be a unique and powerful feature of the new language.

The only good argument against it I've seen is the "not very obvious/visible", which as I outlined it above is very valid. However, I see no reason why the syntax shoudn't be extended to be "an open brace preceded by 1 or more #s with no intervening whitespace or other characters. That would allow for people who favour delimiting their comments in very obvious ways to do something like

if( ... ) ###################################################################### +######{ ... } ## or while( ... ) ########{ ... ... }

As programmers, our eyes are already tuned to pairing braces, and with proper indentation, it is fairly intuative to see the extent of the block(-comment).


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: More than One Line Comment by BrowserUk
in thread More than One Line Comment by gopalr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-10-04 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (19 votes). Check out past polls.

    Notices?