I was considering the possibility that references within macros could be optimized. Given the following:

#macro(foo $a $b)
  $a $b
#end

#foo($c $d.e)

Currently both $a $b within the macro are referenced by AST. However, with some compile time analysis it can be determined that $a and $b can be referenced directly from the macro context (just like variables outside of a macro). The analysis can determine that $c and $d are not modified during the macro call by walking the AST tree and insuring these references do not exist within the macro. Not only could the AST be removed, but the value $d.e could be passed in to $b which would avoid looking up the 'e' property on $d every time $b is referenced. This would also save memory since the AST nodes for all the references in the macro could be removed. Anyone see a problem with this?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to