Skip to content

Make a trade off between module alias and linking behavior #3852

@mlms13

Description

@mlms13

Minimal demo repo: https://github.com/mlms13/bsb-520-include

Per this comment in #3839, I've been trying to clean up impure modules to avoid the unnecessary explosion of imports in the compiled JS. I noticed that the following OCaml:

include SemiringExtras.Make(IntSemiring)

let v = increment 3

Produces the following JS:

var include = SemiringExtras.Make(IntSemiring);

var increment = include.increment;

var v = Curry._1(increment, 3);

...

/* include Not a pure module */

You can see more context in the sample repo, but in this case IntSemiring is pure and SemiringExtras is pure, so I'm not sure what's causing the include to make the module impure. At first I thought this was a regression with 5.2.0, but I've been able to reproduce it with 5.0.4 as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions