in reply to Re^2: perl compiler optimizer curiosity
in thread perl compiler optimizer curiosity

Sorry, if I say "macro" I mean real ones like in Lisp.

Preprocessor macros like in C are sh*t in comparison.

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

  • Comment on Re^3: perl compiler optimizer curiosity

Replies are listed 'Best First'.
[OT] Re^4: perl compiler optimizer curiosity
by afoken (Chancellor) on Mar 15, 2022 at 11:58 UTC
    if I say "macro" I mean real ones like in Lisp. Preprocessor macros like in C are sh*t in comparison.

    I never used Lisp, but I know C. Can you show some examples?

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      We had this discussion multiple times before, but I can't find those threads in a hurry.

      Preprocessing/source filter means you have an second parsing stage which has not only to reproduce the whole syntax (horror in Perl) but might also expand to unpredictable results when combined (like two source filters)

      Lisp'ish Syntactic macros:

      • look and parse like functions
      • the arguments are used as building blocks for an "expanded" template
      • the expansion happen while compiling in the same stage
      • don't require any syntax parsing by themselves
      • can be used to efficiently extend syntax

      There are still some traps, like the need for "hygiene", but this a problem with dumber source filters too.

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

      update
      see also https://en.wikipedia.org/wiki/Macro_(computer_science)#Syntactic_macros