The Visitor pattern creates a scenario where adding operations (new visitors) over the set of existing data types is easy.
访问者模式将创建一个场景,简化对现有数据类型集合添加操作(新访问者)的过程。
Adding new data types (classes) with visitors is difficult, however, as the visitor pattern requires a visit method for all concrete types.
然而,通过访问者添加新数据类型(类)较为困难,因为访问者模式要求所有具体类型都具有一个visit方法。
It is not hard to integrate a pattern-matching library with the tree visitor to get to a point where visitors can leverage tree patterns.
您可以轻松集成模式匹配库与树访问者,使访问者能够利用树模型。
应用推荐