-
-
Notifications
You must be signed in to change notification settings - Fork 203
Description
First of all, I would like to thank the authors of this crate.
I'm using it to parse programs written in my own programming language.
My parser utilizes Recursive::declare/define and the caching pattern (but with thread-locally stored parsers as Recursive is not Send nor Sync).
-
The first thing is missing documentation about cloning behavior of
Recursive. Especially that one can safely clone the result ofRecursive::declareand then callRecursive::defineon one of the clones (becauseRc<_>is used internally). I think this is an important information for the crate users. Or am I wrong about this? -
The second thing is that
Recursive::definetakes&mut self. It is not necessary and counter-intuitive as the common case is "declare, then use it, and finally define". In my parser I ended up with code like:fn define_expr(parser: &Recursive<...>, cache: &ParserCache) { let mut parser = parser.clone(); parser.define(...); }
I can write appropriate PR if the ideas get accepted.