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

Re^2: The Case for Macros in Perl

by eyepopslikeamosquito (Archbishop)
on Sep 13, 2014 at 12:46 UTC ( [id://1100485]=note: print w/replies, xml ) Need Help??


in reply to Re: The Case for Macros in Perl
in thread The Case for Macros in Perl

Yes, I think the OP should be more specific about what type of macro he is asking for:

  • Textual macros (e.g. C pre-processor).
  • Procedural macros (e.g. PL/I, assembler).
  • Lisp macros.
  • Perl 6 macros aka syntactic/hygienic macros.

Update: more P6 macros blog posts from Carl Masak:

Replies are listed 'Best First'.
Re^3: The Case for Macros in Perl
by raiph (Deacon) on Sep 15, 2014 at 01:13 UTC
      Perhaps with an agreed-upon Perl 6 spec we can eventually get the same backported into Perl 5 ;-)
        »»» This post is about the immature Perl 6, not the rock solid Perl 5 «««

        I'm not aware of a compelling reason to wait for 6.0.0. cf Moose which used P6 OO design as-it-was-then as its starting point.

        I think a one hour review/consideration of P6 macros as they are now would probably be worthwhile for anyone considering the design of a macro facility for P5 today, even if their conclusion is "we can't use any of this in P5". The heart of the Macros spec is in the Macros section of the Subroutines spec, so it's fairly easy to review the overall design. And the basics, plus hygiene, have already been implemented in Rakudo, so it's easy to try it out too, eg by using the online evalbots on #perl6. I'd be happy to provide further pointers if you or anyone else expresses interest.

        Another possibility I'm particularly curious about is ways in which P5 and P6 can leverage each other to create a greater Perl. While I don't currently see a way to do this in relation to macros, perhaps someone more creative than I could use Inline::Perl5 and/or v5 to bring some macro magic to P5.

Re^3: The Case for Macros in Perl
by einhverfr (Friar) on Sep 14, 2014 at 02:17 UTC

    Actually thinking of something like a Lisp macro, in particular being self-processed source-code not merely on the textual level but on a level higher than that (below the perl 6 macro level though)

    In this specific case, my thinking is to create a text string and eval it and see if that is cleaner. But it would be nicer to be able to process statements of perl as statements of perl, not as strings which will hopefully compile.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1100485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found