Reference Resolver Prototype by stasm · Pull Request #263 · projectfluent/fluent
@Pike, I'd like to share some progress on the reference resolver, and ask you for early feedback on the code.
The core abstraction here is the Scope, which is kind of like a visitor for different AST nodes. Scope is created every time format() is called, and contains all the data stored by the bundle required for resolving, plus the variables, and errors.
All three existing implementations of the resolver employ a concept of a FluentType, which holds the raw value and offers a toString API. FluentNone is a special kind of a FluentType; it means null by may hold a fallback value. In this prototype I separated two concepts:
- The
Valueinterface wraps raw values and formats them. - The
Resultinterface handles successes and failures. (It's very similar to theResultclass used in the reference parser).
I feel like this division has worked well for the clarity of the code, but I'm interested in your opinion. Thanks, and please let me know if you have any questions.