[go: up one dir, main page]

Kaitai: Make modules recursive

Context

Follows !9722 (merged). This MR sets a stage for kaitai support of Data_encoding.z and its siblings (!9924 (merged)). As can be seen in the work break-down, in order to write a valid Kaitai struct description of big numbers, kaitai needs to support user defined types.

As can be seen in the reference implementation, there is a cyclic dependency between DataType.t and ClassSpec.t. In order to model same abstraction in OCaml, we use recursive modules.

This MR does:

  • Adds types.mli
    • Without changing existing docstrings.
  • Links modules recursively so that we can write | UserType of ClassSpec.t.
  • Improves docstring a bit and adds a TODO issue for further refinement.

Observe that full documentation of kaitai types is out of scope of this MR, since we want to bootstrap the work on lib-kaitai-of-data-encoding ASAP and we are learning more about kaitai reference implementation daily.

Notice that we may want to introduce _intf.ml && include pattern to avoid code duplication.

Follow-up

!9972 (merged) followed by !9924 (merged)

Manually testing the MR

CI should pass.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Martin Tomazic

Merge request reports

Loading