Skip to content

RFC: fusion should be importable by compiler sources, and even stdlib and koch #22

Open
@timotheecour

Description

@timotheecour

/cc @Araq

rationale

avoid code duplication and re-inventing the wheel

how it'd work

  • build_all.sh builds csources
  • the it builds koch
  • then it calls koch boot
  • koch boot clones dependencies in dist including fusion at a fixed hash baked in koch.nim (equivalent to a git submodule)
  • import fusion/foo is made available for import, in fact it already is implemented in:
proc bundleFusion(latest: bool) =
  let commit = if latest: "HEAD" else: FusionStableCommit
  cloneDependency(distDir, "https://github.com/nim-lang/fusion.git", commit,
                  allowBundled = true)
  copyDir(distDir / "fusion" / "src" / "fusion", "lib" / "fusion")
  • then nim c compiler/nim can use import fusion/foo
  • likewise with stdlib modules; it's just a question of avoiding cyclic dependencies as usual except now there are 2 base dirs.

koch importing fusion

note

instead of copyDir(distDir / "fusion" / "src" / "fusion", "lib" / "fusion"), we should probably use the usual nimble logic which allows adding import dirs to nim's --path, so that nimble develop fusion works as intended (NIMBLE_DIR=customdir can always be used during bootstrap to avoid user's environment messing up with bootstrap)

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