Skip to content

Rational behins Global and Globals #9

@nojaf

Description

@nojaf

I very much like this project!
Use it often, but unfortunately I aways have to look at the source code when I'm working with it.

Why are Globals and Global two modules?

An example which I struggle with:

open RescriptBun

let exportData = Bun.file(Path.join2(Globals.import.meta.dir, "export_data.json"))
if !(await exportData->Bun.BunFile.exists) {
  Console.log("export_data.json not found")
  Process.process->Process.exitWithCode(1)
}

Finding Globals.import.meta.dir is tedious.
Adding open RescriptBun.Globals after open RescriptBun leads to

this open statement shadows the value identifier import (which is later used)ReScript(44)

when using import.meta.

Would it not make sense to merge Global and Globals and export importMeta to avoid the duplicate name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions