Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] import still doesn't behave predictably #38

Open
evolbug opened this issue Jul 7, 2020 · 0 comments
Open

[bug] import still doesn't behave predictably #38

evolbug opened this issue Jul 7, 2020 · 0 comments
Labels
bug Something isn't working high priority Issue that significantly hinders usability

Comments

@evolbug
Copy link
Contributor

evolbug commented Jul 7, 2020

When compiling imports should behave by this system:

compile file:       all imports are relative to initial file
compile directory:  all imports are relative to initial directory
build project:      all imports are relative to src/

The resulting require statements should also use . to separate path elements instead of / and should not contain a ./ prefix

project/
    src/
        lib/
            init.wu
            mylib.wu
        main.wu
    wu.toml

Contents:

# main.wu
import lib { mylib }

# init.wu
import mylib { MyType }

# mylib.wu
MyType: struct {}

Building project: ~/project$ wu build
Expected contents:

-- main.wu
local lib = require "lib"
local mylib = lib["mylib"]

-- init.wu
local mylib = require "lib.mylib"

-- mylib.wu
<empty>

Building directory: ~/project$ wu src/lib
Expected contents:

-- init.wu
local mylib = require "mylib"

-- mylib.wu
<empty>

Building file: ~/project$ wu src/lib/init.wu
Expected contents:

-- init.wu
local mylib = require "mylib"

-- mylib.wu
<empty>
@evolbug evolbug added bug Something isn't working high priority Issue that significantly hinders usability labels Jul 7, 2020
nilq pushed a commit that referenced this issue Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Issue that significantly hinders usability
Projects
None yet
Development

No branches or pull requests

1 participant