winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.06k stars 198 forks source link

Compiler should error if a source file from a different library is imported #7147

Open Chriscbr opened 2 months ago

Chriscbr commented 2 months ago

I tried this:

If you have two different Wing packages:

foo/
|- wing.toml
|- main.w
bar/
|- wing.toml
|- other.w

Directly importing files between them should be compile time error:

// file: foo/main.w
bring "../bar/other.w" as other; // error: cannot directly import files from another Wing package

It feels like it may be a safer boundary if we require that a library must take an explicit dependency on another in order to be used, and imports must be made through the library name.

This happened:

No error is raised today

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.85.9

Node.js Version

No response

Platform(s)

No response

Community Notes