Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Since Perl6 will treat any code as "old code" unless it starts with one of the new keywords...
That's not quite right. Perl 6 will treat code as Perl 5 code if (and only if) the first executable line in the program is a package statement.

And, yes, we're going to need some way to distinguish Perl 6 code from Perl 5 code. Because there are a few simple cases that mean completely different things in Perl 5 and Perl 6. For example:

print $hash{bang};

In Perl 5 that means: print the value of the entry of %hash whose key is "bang".

In Perl 6 that means: print the value of the entry of the hash referred to by $hash whose key is "bang".

How could we distinguish Perl 5 and Perl 6 code? I'd suggest we add a <code6> flag and have the monastery render code marked as Perl 6 in a different font. For example, the submission:

    We're going to need some way to distinguish:
    
    <code>
        print $hash{bang};  # entry 'bang' of hash %hash
    </code>
    
    from:
    
    <code6>
        print $hash{bang};  # entry 'bang' of hash %{$hash}
    </code6>
might be rendered:
We're going to need some way to distinguish:
    print $hash{bang};  # entry 'bang' of hash %hash
from:
    print $hash{bang};  # entry 'bang' of hash %{$hash}

Note: I've used a red-shift/blue-shift visual pun here, but in reality we'd need to use distinct font faces -- perhaps serif for Perl 5 and sans-serif for Perl 6 -- so as not to disadvantage those with impaired colour vision.

Using a separate mark-up tag would also support those monks who (through necessity or by choice) use a non-visual browser.


In reply to Re: Re: SOP6W by TheDamian
in thread SOP6W by rir

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 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?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found