If I recall correctly, Dylan allows access to the AST, and allows for the
possibility of macros, but because they are so difficult to write, macros
are seldom written in Dylan.
Someone once made the point that Python allows you to parse statements, but
the resulting parse tree is too complicated to manipulate. I can't find
the original blogpost or essay or whatnot, but I *think* I figured out how
to parse "2+2". (I've also tried "print 'hello world!'" and a "for" loop,
but the parser doesn't work for those, and I don't know why...) Here's the
code:
import parser
parser.st2list(parser.expr('2+2')
which produces
[258, [327, [304, [305, [306, [307, [308, [310, [311, [312, [313, [314,
[315, [316, [317, [318, [2, '2']]]]], [14, '+'], [315, [316, [317, [318,
[2, '2']]]]]]]]]]]]]]]], [4, ''], [0, '']]
I have a feeling that a lot of the information there is compiler
broiler-point...but regardless, it's not going to be a picnic to manipulate!
Whereas, with a sweet-expression, '{2 + 2}' compiles to tree '(+ 2 2)',
which is *much* simpler!
On Sat, Jul 28, 2012 at 12:49 AM, Kartik Agaram <a...@akkartik.com> wrote:
> Yes, I wasn't actually advocating y'all do anything with this idea. It
> just seemed like a good group of people to show the idea to, to get
> your reactions.
>
> > Uh oh, comma for separating function parameters. That's been tried
> before in a Lisp, but that means that ,-lifting is easily missed visually.
>
> I deliberately ignored the syntax for macros. This is an *utterly*
> blue-sky idea, so you could use anything for macros. If the goal is a
> more familiar syntax, perhaps macros should be defined with #define
> and $ for unquote. Or something.
>
> > Okay, but how do you determine which function to apply?
>
> Yes, this came up on the arc forum as well: I have somehow utterly
> ignored higher-order functions.
>
> Perhaps quote would be useful here somehow..
>
> > Lisp has always let you write your own evaluator. That's no problem,
> just code it up, and send your data to it. It'd be a crisis if you tried
> to REPLACE the standard evaluator with something different, of course. But
> all you have to do is send the data to your new evaluator directly (in many
> ways it's actually easier to do this than replace the reader).
>
> I don't understand this. Is 'writing your own evaluator' the same as
> writing an interpreter atop any language?
>
> > But frankly, this is starting to sound like you want ML or Haskell. The
> thing is, if you want ML or Haskell, there are already fine implementations
> of them.
>
> Neither has lisp macros.
>
> "Everything is open to question -- but you'll have to pry macros out
> of my cold dead hands." -- me, http://github.com/akkartik/wart#readme
>
> I'm also not big on type systems.
>
> > Here I completely disagree with you. Being homoiconic is a *necessary*
> property of a Lisp notation. If complex list structures get created
> without *any* possibility of the developer knowing, it becomes impossible
> to control the result.
>
> Yeah I need to think about this more deeply.
>
> It's funny. Ten years ago I didn't understand lisp and I didn't know I
> didn't understand lisp. Five years ago I thought I understood macros
> and how lisp was the only language to have them. This year I suddenly
> find I don't in fact understand these 'obvious' matters.
>
> Anyways, I'll stop hijacking this list now :) This is all utterly
> off-topic.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Readable-discuss mailing list
> Readable-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/readable-discuss
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss