Replies: 1 comment
-
I don't think there is any intent to support cyclic imports (similar to Haskell, etc). @daanx am I correct on this? Mutually recursive definitions should be defined in the same module. It is a bit tricky for the core modules, (which is why they used to be in just one big module). However, in the problem above, there really isn't a mutually recursive definition, it is just that some definitions from one module want to depend on definitions from the other module in a way that dependencies are a non-cyclic tree. For example, join could be placed into the core "types" module, since it mostly relegates to the extern definitions, and then imported from both Another solution could be to also make the
I think this is a nice solution to the problem. In other words:
I think moving the types and core functions into a more 'base' module is probably the best solution for the most part. Remember we are assuming there are not mutually recursive definitions that would require this anyways. I think the solution using implicits is probably mostly for special cases (such as due to some design or organizational aspects of the std libraries). |
Beta Was this translation helpful? Give feedback.
-
A show implementation for vector could look like this:
However, it is currently not possible to add this to the
std/core/vector
module, because thejoin
function is imported fromstd/core/string
, which in turn importsstd/core/vector
, constituting a cyclic dependency.What is the current vision of the language developers on how to deal with this issue?
Is there an intention to support cyclic imports in the future?
Beta Was this translation helpful? Give feedback.
All reactions