in reply to Re^5: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
in thread Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)

why not

my $baz = sub { "$_[0] called Test::baz" }; ... package Page { ... for ( $foo, $bar, $baz->() ) { # less characters, safe mecha +nism TR { TD { $_ }; TD { $c++}; } } ... }

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^6: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
  • Download Code

Replies are listed 'Best First'.
Re^7: Which internal DSL are there in Perl? (Domain Specific Languages - Part 1)
by shmem (Chancellor) on Aug 04, 2017 at 21:47 UTC
    why not
    for ( $foo, $bar, $baz->() ) { # less characters, safe mecha +nism

    Yes of course, but for the sake of TIMTOWTDI, transparent calls of functions/methods known in the scope which uses the DSL should be possible. And yes, the notation Page->baz() is a kludge. Need something else.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      You asked me how to know if a result of a code block should be cached.

      PadWalker can list closed over lexicals hence indicating possible side effects.

      Parsing for imported functions is more complicated.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!