Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Amicable divorce

by jcb (Parson)
on Jul 17, 2020 at 04:28 UTC ( [id://11119438]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Amicable divorce (Macros)
in thread Amicable divorce

To me, the only difference is that the Lisp macro facility does not actually print its result for the next stage to read back in, but it could do that and still work. The difference from a preprocessor seems to me to be an implementation detail.

I am currently up late drafting a Meditation on the broader topic. I hope to have it posted soon.

Replies are listed 'Best First'.
Re^6: Amicable divorce
by salva (Canon) on Jul 17, 2020 at 08:13 UTC
    That is the same as saying that all programming languages are equal because they are Turing complete.

    Common Lisp macro facility is far more than a preprocessor. It allows manipulation of the language AST using the full language and the mechanic is perfectly ingrained into it.

    That allows the programmer to create new abstractions, domain specific languages, or to add support for new programming paradigms (as for instance, logic programming or as suggested by LanX, alternative OO systems).

      > It allows manipulation of the language AST using the full language and the mechanic is perfectly ingrained into it.

      perlcompile lists perlcompile listed so many backends to analyze the op-tree.

      It's unfortunate that there is no mechanism to preserve the original code-snippets in these tree nodes.

      FWIW one can (ab)use use as a macro mechanism, you might be interested in my talk about Fun with Macros

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

Re^6: Amicable divorce
by LanX (Saint) on Jul 17, 2020 at 04:52 UTC
    That's like carriage vs rocket.

    The preprocessor struggles to parse the code.

    The only thing you can statically parse in Perl is POD.°

    But the lisp macro gets the code (or rather AST) for free. No confusion where it begins or ends and about the elements in between.

    When OOP became popular, various lisp dialects just added some macros for implemention. Backwards compatibility included.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    °) well as POD, you can't make it to code. Mind you:

    POD inside a here doc is both string code and extractable comment.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found