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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Interestingly, because Perl 5's mutability under sub declarations was so confusing to people; Perl 6's sub declarations never mutate the grammar. Apart from explicit macros or mixed-in grammar rules, the only thing that can change the grammar is a constant declaration, which declares a word that never takes arguments, much like a 0-ary sub in Perl 5. (Type declarations may be considered a specialized kind of constant declaration, where the constant being declared just happens to be a type.) In Perl 6, there are no barewords, so any unrecognized word is assumed to be a list operator that will be declared later in the same file.

So while Perl 6's grammar is more mutable in theory; it is less frequently mutated by accident.

Another interesting consequence of this decision is that the blocks supplied to map and grep are not a special syntax, so they require a comma. Likewise use of & in a sub signature does not change parsing. On the other hand, bare blocks are just anonymous closures in Perl 6, so they can be passed in any position, and are not restricted to the first argument as they are with Perl 5's & prototype.


In reply to Re^2: Perl 6 and Perl 5 parsing by TimToady
in thread Perl 6 and Perl 5 parsing by Anonymous Monk

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 meditating upon the Monastery: (4)
As of 2024-04-23 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found