ava/general-syntax.md

58 lines
1.3 KiB
Markdown

# General Syntax
## Type Binding
Some name may be bound to some type by using the `:` (colon) syntax.
```
name: Type
```
Type bindings are used for all such occurrences. This includes:
- [Defining Variables](variables.md)
- [Defining Records](records.md)
- [Defining Functions](functions.md)
## Value Binding
Some name may be bound to some value by using the `:=` syntax.
```
name := value
name: Type := value
```
Value bindings are used for all such occurrences. This includes:
- [Defining Variables](variables.md)
- [Instantiating Records](records.md)
## Comments
Comments are lines where the first non-whitespace characters are `--`. This was
selected for ease of typing paired with low visual noise.
```
-- this is a comment
-- this is another comment
let x := "foo" -- this will not compile, comments cannot be mixed with code
```
Ava does not support multi-line comments.
## Code Documentation
Code documentation is written using comments that both directly-precede certain
definitions and have 3 `-` characters:
```
--- This function does some foo as well as some bar.
--- @param x Documentation for the `x` parameter.
fn foo_bar: (x: String) => Int32
```
- Code documentation respects Markdown.
- TODO: Link syntax.
- TODO: Supported definitions (example for each)
- TODO: Parameter documentation