-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, imports are done like this:
import { id } from './path';
As of now, it has shortcomings
- Using functions return type is impossible if it isn't also imported. For example
fn foo(): A, if module importsfoo, it must also importA, otherwise it can't do anything with the type (if its a enum, it can't match. If its a struct, it can't access its attributes).
However, how to solve this? The design of type inference unfortunately does not make this much easy. Transitive imports then plague the namespace of the module (remember, there are no namespaces, so we must be careful with this). Importing the return type could also work, but has same drawbacks as the transitive imports, although on smaller scale.
Maybe import the standard library in its whole by default, that would cut it down a little.
It would be nice if we could at least use the members and methods of the returned value. That would probably be best solution. However, the implementation is not ready for it. It would have to be added on several layers (inference, ast interpreter).