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

the perfect way to add it to the syntax

But the issue with macros is not how to indicate the interpreter you are declaring one but how to tell the interpreter the kind of arguments you are expecting.

In Lisp (and family) you don't have this problem because the language doesn't have a grammar but on Perl, in order to parse something, you need to know where you are.

The macros in my patch only accept one kind of arguments (expressions) ruling out several interesting usages. For instance, extending the syntax as in try {...} catch {...}.

Replies are listed 'Best First'.
Re^5: The Case for Macros in Perl
by BrowserUk (Patriarch) on Sep 16, 2014 at 12:07 UTC
    The macros in my patch only accept one kind of arguments (expressions) ruling out several interesting usages. For instance, extending the syntax as in try {...} catch {...}.

    I actually consider that a plus. IMO, macros should be limited in both their power and scope. And the in-lining of 'functions' (only) is, for me, the perfect break point.

    The syntax and semantics of functions are very clearly defined and understood. And macros that mirror those are thus easy to learn reason about and use.

    It has been a very long time since I did Lisp, and I was not very good at it then; but I do remember that only thing worse than the (lack of) syntax, was the unholy mess you get into when trying to debug errant Lisp macros. Yuck!


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.