Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Comment on

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

Well, you know all these attempts to add syntax to Perl5 using sub(&;)-ish prototypes? (Like try { ... } catch { ... }; which look like keywords but are really function calls.) That device is very limited and carries risks of leaking accidentally created closures which makes it dangerous to use in any persistent environment. In Perl6, even if the language didn't already have these, it would be easy to write macros that transform this into code behaving exactly as if they were real keywords.

Or consider the Acme::Don't module and esp Simon Cozen's take at it; this would be trivial to implement with a Perl6 macro.

Then we have cases like the Test modules. It would be nice if there was a way for ok() to actually "understandd" the code of the test being evaluated, so we could just write ok($foo eq $bar, 'calculation [...]') - currently, in order to get the actual test described in the failure message you must use a specialized derivative function such as is($foo, $bar, 'calculation results should equal safety check'). Instead of having to learn all the testing modules and the tests they provide (and hunt around for the module that implements the kind of test you want or eventually rolling your own), you just let a macro figure out how to DWIM with Perl code, whose syntax you presumably already know well.

Or PDL. It basically adds a whole new sublanguage to Perl for mass numbercrunching. In many cases it has to try to fit a square peg into a round hole in order to somehow map a mathematically oriented notation into Perl syntax in a semi intuitive fashion. With true macros, it could actually add new definitions of mathematically oriented syntax to the language.

And these are only the most obvious examples because they already attempt to recast Perl5 syntax for a specific subject. Probably any very deep but narrowly defined programming field can likely benefit from casting its most basic premises into actual, additional supporting syntax for the language.

Makeshifts last the longest.

In reply to Re^3: Macros, LFSPs and LFMs by Aristotle
in thread Macros, LFSPs and LFMs by stefp

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (6)
    As of 2018-06-22 07:28 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (122 votes). Check out past polls.