wu-lang/wu

[feature] visibility classifiers

evolbug opened this issue · 1 comments

Currently every symbol in a module is exported. Symbols should become private by default and export classifiers should be implemented, to be able to hide certain details.

Example:

bar: module {
    pub foo: fun() -> int { 42 }
        oof: fun() -> int { 24 }
}

a := bar foo() # 42
b := bar oof() # error: accessing private function <oof>
# bar.wu
pub foo: fun() -> int { 42 }
    oof: fun() -> int { 24 }

# main.wu
import bar { foo, oof } # error: importing private function <oof>

# main.wu 2
import bar

bar oof() # error: accessing private function <oof>
nilq commented

This has been added and is now working for module content 👯‍♀️