Unclear error if a cycle dependency between namespaces #444
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reproduction
Includes.aes
Library.aes
Sublibrary.aes
CLI prints an unclear error
it works if I include
number
from another namespace (without cycle deps). Sophia should disallow cycle dependencies explicitly or the above reproduction should work.First, this has nothing to do with includes. You can put the namespaces in the same file and it will still not work.
The error is produced because a namespace can only recognize what was written before it, so if you want to have a base namespace and a dependent namespace, you should have them in order.
Is there a specific situation where you need 2 namespaces to depend on each other, and you're not better off refactoring the code?
I would say that it's better to keep it this way in order to prevent messy designs, and the error messages are clear enough once you know that a namespace can only recognize what's written before it.
@radrow Do you have any opinion on this?
Created by: radrow
I think it would be much more user friendly if we explicitly point out that dependency cycles are not supported. For example functions within one namespace do support mutual recursion, so I can imagine this being confusing.