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

Improve description of Julia keywords #29229

Merged
merged 2 commits into from
Sep 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ ans

## Keywords

This is the list of reserved keywords in Julia:
`baremodule`, `begin`, `break`, `catch`, `const`, `continue`, `do`,
`else`, `elseif`, `end`, `export`, `false`, `finally`, `for`, `function`,
`global`, `if`, `import`, `let`, `local`, `macro`, `module`, `quote`,
`return`, `struct`, `true`, `try`, `using`, `while`.
Those keywords are not allowed to be used as variable names.

The following two word sequences are reserved:
`abstract type`, `mutable struct`, `primitive type`.
Copy link
Contributor

@PallHaraldsson PallHaraldsson Oct 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

three word sequences, or "two-word" sequences

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to just open a new PR with the suggested changes instead of commenting on old merged PRs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I will make a PR to clarify it.

However, you can create variables with names:
`abstract`, `mutable`, `primitive` and `type`.

Finally `where` is parsed as an infix operator for writing parametric method
and type definitions. Also `in` and `isa` are parsed as infix operators.
Creation of variable named `where`, `is` or `isa` is allowed though.

```@docs
module
export
Expand Down Expand Up @@ -65,6 +81,7 @@ struct
mutable struct
abstract type
primitive type
where
...
;
```
Expand Down