Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://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

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 having an uproarious good time at the Monastery: (7)
As of 2024-03-28 17:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found