-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df4f8e8
commit 13f8771
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Namespaces | ||
|
||
C++ definitions can sometimes be in a namespace. In this case, it is necessary to add the namespace for code generation to be correct. The `namespace` directive is used to specify the namespaces of the definitions. | ||
|
||
**Supported types:** | ||
- Functions | ||
- Structures | ||
|
||
## Using `namespace` Directive | ||
|
||
The `namespace` directive is simple to use. It precedes the supported definition and specifies the namespace in which the definition resides. | ||
|
||
::: warning | ||
Jule also uses the namespace you type directly in code generation, without checking if it writes the namespaces in the correct format. Adds `::` in addition to the namespace. | ||
::: | ||
|
||
For example: | ||
```jule | ||
//jule:namespace foo::bar | ||
cpp fn exit(code: int) | ||
fn main() { | ||
const EXIT_CODE = 1 | ||
cpp.exit(1) | ||
} | ||
``` | ||
For the above function call, the code `foo::bar::exit` will be generated. |