jonludlam / odoc

Documentation compiler for OCaml and Reason
Other
0 stars 0 forks source link

Use smaller Ident type when possible #29

Closed Julow closed 4 years ago

Julow commented 4 years ago

Add "typed_module", "functor_parameter" and "directmodule" ident and identifier types that are smaller than the corresponding "module" type.

They are used in Lang and Component.

The names are not ideal, especially "direct_module" which has no meaning (it's just a random word)

jonludlam commented 4 years ago

Another possibility we might think about is having the name of the module separate from the parent identifier, so split Module.id into Module.name : ModuleName.t and Module.parent : Identifier.Signature.t - what do you think? Would this be cleaner?

Julow commented 4 years ago

Do we need the name often ? I think keeping identifiers is clearer because most code don't need to think about passing or keeping in sync several fields. eg. they are constructed at one place and deconstructed in specific places too. However in Component.Signature, we sometimes need the name, which is the main motivation for this change.

jonludlam commented 4 years ago

After some discussion elsewhere, this is what we think:

This enables functions on every signature element akin to Module.t -> ModuleName.t, ModuleType.t -> ModuleTypeName.t and so on.

The changes should also be reflected in the Components type definitions.

Julow commented 4 years ago

I implemented this.

Julow commented 4 years ago

Removed the unecessary coercions (they were left overs from trying to constraint the types further)

jonludlam commented 4 years ago

The build was failing earlier on scratch.md - you can just nuke that file, it was just for experimentation

jonludlam commented 4 years ago

Great thanks!