package visitors

  1. Overview
  2. Docs
An OCaml syntax extension for generating visitor classes

Install

Dune Dependency

Authors

Maintainers

Sources

archive.tar.gz
md5=c56a86f81e0c1531e22c89cb8691d02c
sha512=1ddd6654325ce47394239ea36b64e4c11ddbfa4f8061e0a22dac9bc1b822253abd0cbf8d4607c7fc3bb572b0e12075a3cea7632536230057e3e069536c6a5c3b

CHANGES.md.html

Changes

2021/06/08

  • Replace a reference to the Parser module in ppxlib with a reference to the Parser module in compiler-libs, so as to remain compatible with the next version of ppxlib (> 0.22.0), where the type token is abstract. (Contributed by Sonja Heinze.)

2021/01/27

  • Switch to version 0.22.0 of ppxlib, which internally uses the abstract syntax tree of OCaml 4.12. (Contributed by Sonja Heinze.)

  • Relax our requirement from OCaml 4.07 to OCaml 4.05.

2021/01/27

  • Switch to version 5.0 of ppx_deriving. (At present, this implies requiring OCaml 4.07, but this may be relaxed to OCaml 4.05 in the future, I am told.) Depend on ppxlib instead of ppx_tools. Remove the dependency on cppo. (Contributed by Kate Deplaix.)

2020/02/07

  • Avoid references to Pervasives in the generated code.

  • Switch from ocamlbuild to dune to compile visitors.

2018/05/13

  • Fixes in _tags and META so as to allow visitors to be used in jbuilder (dune) projects. (Contributed by Armaël Guéneau.)

2018/03/06

  • Warn when the visitor methods for two distinct types or two distinct data constructors have the same name, as this results in an OCaml type error or multiply-defined-method error. (Reported by Gabriel Radanne.)

2017/11/24

  • Added compatibility with OCaml 4.06.0.

  • Fixed the internal function occurs_type in the case of polymorphic types. This should make no observable difference, as this function is used only to produce an error message in a corner case.

2017/08/28

  • Added compatibility with OCaml 4.05.0.

2017/07/25

  • Updated src/Makefile to allow compilation on systems where ocamlopt is missing. (Suggested by Ralf Treinen.)

2017/04/20

  • New settings visit_prefix, build_prefix, and fail_prefix can be used to control which prefixes are used in generated method names. (This feature was suggested by Philip Hölzenspies.)

2017/04/04

  • Extended backward compatibility to OCaml 4.02.2. (Thanks to Benjamin Farinier.)

2017/03/17

  • New attributes @build and @@build can be attached to record type declarations and data constructors, so as to alter the construction code that is used in map, endo, and mapreduce visitors. See the documentation for details. (This feature was suggested by Reuben Rowe.)

2017/03/15

  • New attributes @name and @@name can be attached to types, type declarations, and data constructors, so as to alter the names of the generated methods. See the documentation for details. (This feature was suggested by Reuben Rowe.)

2017/03/08

  • A new option polymorphic = true allows generating visitor methods with polymorphic types. With polymorphic = true, a type variable 'a is handled by a visitor function visit_'a, which is passed as an argument to every visitor method; whereas, with polymorphic = false, a type variable 'a is handled by a virtual visitor method visit_'a. With polymorphic = true, visitor classes compose better, and irregular algebraic data types are supported. See the documentation for more details. (This feature was suggested by Reuben Rowe.)

2017/03/03

  • A new option data = false allows suppressing the generation of visitor methods for data constructors. This makes the generated visitor slightly simpler and faster, but less customizable.

  • A new option nude = true allows not implicitly inheriting the class VisitorsRuntime.<variety>.

2017/02/15

  • Makefile.preprocess is now installed with the package, so users can rely on it without needing to copy it. See the documentation for instructions.

2017/02/13

  • Added a new variety of visitors, mapreduce. This visitor computes a pair of a data structure (like a map visitor) and a summary (like a reduce visitor). This can be used to annotate every tree node with information about the subtree that lies below it. See the documentation for an example.

2017/02/09

  • Documentation: added a new subsection on OCaml objects, entitled "Where the expressiveness of OCaml's type system falls short". This section explains why map cannot be a subclass of fold, even though it should be.

2017/01/31

  • Documentation: added an example of constructing a lexicographic ordering.

  • Documentation: discussed generating visitors for existing types and ppx_import.

2017/01/26

  • Initial release.

OCaml

Innovation. Community. Security.