Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi

this thread initiated an interesting discussion about macros, parsing and sideeffects in the chatter box which I would like to document for the afterworld:

please send me a /msg if you want to be excluded from the log

[moritz] 09:43:40
I don't really mind either way, and hope that the right people (whoever they may be) participate in the discussion either way

[LanX] 09:45:34
I frontpaged it ... Devel::Declare is still a black box for me and I really want a macro mechanism like in LISP, which would easily solve most syntax extension issues ...

[tye] 09:47:10
bleh. such vague lines people like to draw. Meditations is for sharing an insight, not asking a question. Much cleared distinction (and, yes, unclear distinctions are a problem).

[LanX] 09:47:20
... without being "evil" (=opinion!)

[tye] 09:48:22
then you probably want Perl 6, LanX

[MidLifeXis] 09:48:35
Tell us what you really think, tye ;-) Good morning, BTW.

[tye] 09:49:41
but, alas, tunnel (20 minutes more wait to get a non-tunnel bus this morning). So, good morning and see y'all later. :)

[moritz] 09:50:08
moritz thinks that Perl 6 hasn't solved all the macro problems yet

[LanX] 09:50:35
Hm yes I want Perl* (benefits of Perl6 in Perl5)

[tye] 09:50:44
heh. bit of a clog getting into the tunnel, it seems.

[moritz] 09:51:09
LanX that's why they call "Perl 6" :-)

[moritz] 09:51:58
s/why/what/

[mikelieman] 09:54:30
Sounds like The City...

[LanX] 09:58:55
LOL the CB Sidebar breaks the CSS of this blog

[tye] 10:06:54
true, moritz. My point wasn't that Perl 6 is a panacea. My point was more that people looking at good ways to provide "macros" in Perl should look at Perl 6, since it is partly the result of smart people having looked at that problem...

[tye] 10:07:03
.

[moritz] 10:08:09
tye right. I just wanted to point out that it still needs much work

[tye] 10:10:48
Note that "This means that the handling code does not have to parse Perl" must be followed by "to find the invocations of its syntax". Which is why I will stay well away from such extensions.

[tye] 10:12:00
Now, if one chose to use Devel::Declare to write an extension where it isn't required to parse Perl code in order to find the end of the custom declaration, then that might be a reasonable extension to use.

[LanX] 10:13:58
I can't discuss Perl6 macros, because I don't know them in details. LISP has a very simple approach, functions marked as macros, are parsed as functions and executed, but the return value is evaled in place, so no "evil"ness like with source filters ...

[tye] 10:14:06
heh, after complaining about the evils of having to parse Perl we get "Devel::Declare provides lots of utilities for parsing tokens".

[moritz] 10:15:48
ouch.

[moritz] 10:16:16
LanX LISP macros can only be so simple because everything (including ASTs) are lists. You can't have that in Perl, because Perl is not that simple

[tye] 10:16:26
Heh. Checking the reviews of one of the example modules, "Make sure that you have the latest Devel::Declare or you can have some weird issues that won't seem to make any sense". Exactly the type of error that result from source filters...

[tye] 10:16:39
...The bane and hallmark of ETOOMUCHMAGIC.

[moritz] 10:17:24
tye got a link to the review?

[tye] 10:17:50
http://cpanratings.perl.org/dist/TryCatch

[tye] 10:18:43
somebody should incorporate these observations in LanX's thread. I won't have time to post to it. :)

[LanX] 10:21:42
LanX 's thread?

[moritz] 10:23:08
moritz updated his question

[LanX] 10:23:16
moritz: what's complicated about changing macro_call() to eval macro_call() at compilation time???

[moritz] 10:24:17
LanX nothing, but it doesn't solve your problems

[ambrus] 10:24:32
moritz: (a) they aren't simple, (b) that applies only to scheme, for common lisp has ways to change the reader too.

[moritz] 10:26:09
ambrus I've never really learned lisp, just a bit of scheme. Then I extrapolated my knowledge, which was probably not good :-)

[LanX] 10:27:00
moritz: IMHO we have diffrenet concepts of macros

[moritz] 10:27:43
do we?

[tye] 10:27:46
yeah, I think that would probably be a much better hook to implement than other hooks that have been implemented (like use but in-line and w/o the need for a surrounding block of scope)

[MidLifeXis] 10:35:07
In college they had us scheming with a lisp. AI instructor preferred scheme, and the prog languages instructure preferred lisp. What confusion that caused for many.

[MidLifeXis] 10:36:25
AI instructor was from a different department under some cross-discipline program. Liked her, though. Learned quite a bit, even if she was flakey sometimes.

[moritz] 10:36:27
hilarity ensured

[MidLifeXis] 10:37:48
For the most part, IIRC, the level we had to use on each were able to be mapped back and forth with a keyword table and a search and replace '{' vs '('.

[Corion] 10:39:19
MidLifeXis: So basically you wrote a custom REPL that converted between (your subsets of) Lisp and Scheme transparently? :-))

[MidLifeXis] 10:40:51
In the wetware.

[LanX] 10:42:02
does anyone object to log the macro/D::D CB-discussion into a reply to moritz' thread?

Cheers Rolf

UPDATE: reversed text, still working on better formatted version.


In reply to Devel::Declare vs LISP like macros... by LanX
in thread Is Devel::Declare really so much less evil than source filters? by moritz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-20 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found