nim-lang / fusion

Fusion is for now an idea about how to grow Nim's ecosystem without the pain points of more traditional approaches.
MIT License
128 stars 16 forks source link

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

Open timotheecour opened 4 years ago

timotheecour commented 4 years ago

/cc @Araq

rationale

avoid code duplication and re-inventing the wheel

how it'd work

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)

Araq commented 4 years ago

Nah. Recursive dependencies between fusion and std mean there is no point in "fusion". And maybe indeed there isn't but then argue for that instead. :-)

timotheecour commented 4 years ago

can we at least agree on compiler/, tools/ and anything except koch and stdlib can import fusion?

Note that a recursive dependency between fusion and std doesn't imply cyclic module dependencies; it does add some package-level complexity but reduces likelihood of duplication.

argue for that instead

the way I see it, fusion is useful for following reasons:

alaviss commented 4 years ago

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)

I decided against this and make use of copyDir simply because nimble does not support "system-installed" dependencies. Also it's widely incompatible with how Linux distributions package Nim, so unless we got those sorted out copying is the foolproof way.

Araq commented 4 years ago

can we at least agree on compiler/, tools/ and anything except koch and stdlib can import fusion?

tools are fine, I don't see why the compiler needs it just yet, maybe once fusion becomes more useful with support for compression etc.

arnetheduck commented 3 years ago

The absolutely simplest and most obvious solution here is that the compiler starts using a package manager - this solves pretty much everything and absolves the need for fusion and similar ideas that rest on contradictory premises.

Consider gcc and glibc - there's no expectation that one follows the other, and indeed, they each support a range of versions of the other. This flexibility allows them to progress at different paces - when a critical issue is identified in one, the other doesn't have to rush to make a release etc.

edit: It's important to point out that some of these packages can live in a single git repo as long as the PM supports it