file-local / package-local decls
This commit is contained in:
@@ -208,14 +208,14 @@ mem :: import "@std/mem"
|
||||
value :: math.sum(other_math.value, 1)
|
||||
```
|
||||
|
||||
Top-level declarations are public by default. Prefix a declaration with `hide`
|
||||
to keep it local to its package; sibling files can use it, but importing packages
|
||||
cannot. Leading underscores have no visibility meaning. Imports are always file-local
|
||||
and cannot be hidden or re-exported:
|
||||
Top-level declarations are public by default. Prefix a declaration with bare `hide`
|
||||
to make it package-local, or spell the scope explicitly with `hide(package)` or
|
||||
`hide(file)`. Leading underscores have no visibility meaning. Imports are always
|
||||
file-local and cannot use visibility modifiers or be re-exported:
|
||||
|
||||
```bro
|
||||
hide helper func() i32 { return 42 }
|
||||
hide State :: struct { value i32 }
|
||||
hide shared_helper func() i32 { return 42 }
|
||||
hide(file) implementation_detail func() i32 { return shared_helper() }
|
||||
```
|
||||
|
||||
Current prototype features:
|
||||
|
||||
Reference in New Issue
Block a user