TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Macros in Perl6

64 pointsby drewrover 13 years ago

3 comments

paulkoerover 13 years ago
This is interesting. You can manipulate the AST in other languages of course, for example Python. However these ASTs are so difficult to handle that programmers don't really want to work with them (see point 12. on bottom of the page <a href="http://norvig.com/python-lisp.html" rel="nofollow">http://norvig.com/python-lisp.html</a>).<p>I think Paul Graham wrote that any language implementing macros with Lisp-power will effectively have to introduce something that is 'as bad or worse than the parenthesis'. [1] It will be interesting to see how this will play out in Perl6.<p>However the example given in this article is pretty limited, so I think we can't really tell based on that. It also begs the question 'Why not use a function?', i.e. it is not a case where one needs a macro. It will be interesting to see how Perl6 handles real macro use cases where you have to do heavy AST manipulation. I think here the Lisp syntax is really showing its strengths because you don't have to think in terms of a different representation that you don't have in front of you.<p>[1] See text after the 1-9 list. <a href="http://www.paulgraham.com/icad.html" rel="nofollow">http://www.paulgraham.com/icad.html</a><p>Edit: Better source for [1].
评论 #3125703 未加载
draegtunover 13 years ago
Nice post. Puts more flesh on the bone than some previous examples i've seen (for eg: <a href="http://en.wikipedia.org/wiki/Perl_6#Macros" rel="nofollow">http://en.wikipedia.org/wiki/Perl_6#Macros</a>).
busterover 13 years ago
And this is called the good kind of macros.. i'm not sure if i want to ever see someone manipulating the AST in his code.. i don't know Lisp and he says that this is what makes Lisp the awesome language it is, but to me it sounds scary and dangerous and inconsistent..
评论 #3125333 未加载
评论 #3125375 未加载
评论 #3125317 未加载