freshtonic commented on issue #934:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/issues/934#issuecomment-2841882050

   @ramnes oh and one more thing that's very important.
   
   For workloads such as analysing an AST (in my case, deriving type 
information for a subset of node types) a `Visitor` implementation has to be 
able to associate information with AST nodes, so an implementation would have, 
say, a field like `derived_node_info: HashMap<&Expr, SomeDerivedInfo>`.
   
   The problem is that `&Expr` _must_ have a lifetime and that lifetime must be 
at least as long as the parsed AST lasts.
   
   That means the `Visitor` trait has to have some lifetime associated with the 
trait itself (e.g. `Visitor<'ast>`) and the enter/exit methods must use that 
lifetime for the node references, e.g. `fn enter(&mut self, node: &'ast N) ...`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to