On Fri, Jul 27, 2012 at 10:11 AM, Alan Manuel Gloria <almkg...@gmail.com>wrote:

> But in Lisp, how should we act if
> only some submodule (and not the entire program) is reloaded, and the
> newly loaded changes the precedence of some notation that another
> submodule (which wasn't reloaded) uses.  Do we suddenly change its
> AST?  Or not?
>

My thought was that the (infixl .. ) and (infixr ...) instructions would be
consumed by the reader, before any macro evaluation happens. So the
conversion of the infix expressions to prefix notation would also happen in
the reader, and the AST that the macros see would already be converted to
prefix format. This way, the infix macro syntax would be purely syntactic
sugar, not unlike what sweet-expressions is already doing.

This also implies that for any code unit which wishes to use infix format,
the infix(l/r) declarations must be clearly stated somewhere in that code
unit, so it's easy to see in any given module that that particular symbol
is being used as an infix operator. So you can't "import" the operator
declarations from other modules, which seems like a bad idea anyway.


>
> In addition, because macros get access to what is essentially the AST
> of Lisp, this means that automatic infix detection will also require
> that macros match on the (nfx ...) AST node.  In practice this is
> rare, of course, since most macros will just rearrange expressions,
> but macros may have a surprising interpretation of nfx nodes.
>

I think that by implementing everything in the reader, macros will only see
the LISP-ified AST and won't need any special processing.

>
> Sincerely,
> AmkG
>
------------------------------------------------------------------------------
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

Reply via email to