Skip to content

Commit 13efe55

Browse files
committed
context arguments
1 parent cf9b070 commit 13efe55

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

doc/language/syntax/context_argument.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
`$` [_name_](name.md)
66

77
## Semantics
8-
Injected variables are used to easilly inject dependencies between functions.
9-
Functions will automatically pass injected variables into function-calls recursively.
8+
Context arguments are `ref` variables which are implied and hidden arguments of a function.
9+
If a variable
1010

1111
## Example
1212

doc/language/units_and_tags.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Units and tags
22

3-
## Realms
3+
## Usage
4+
5+
### Literals
6+
7+
Units can be used with literals. You may directly add the name of a unit
8+
or if it is unit-expression you may add those between parentheses.
9+
10+
```
11+
let foo = 1.0 m
12+
let bar = 100.0 cm
13+
let baz = 120.0 (km/h)
14+
```
15+
16+
The type of these literals is:
17+
- The base type, in the above case `real`, or a floating point number.
18+
- A unit tag, which consists of:
19+
* The realm, like: si
20+
* A quantity expression condenced to a vector of exponentions.
21+
22+
## Declarations
23+
24+
### Realms
425
A realm contains a set of units and constants. The most well know realm is
526
the "SI International System of Units". But you can imagine units like pixels
627
that do not fall within this realm.
@@ -16,7 +37,7 @@ declare realm font
1637
declare realm screen
1738
```
1839

19-
## Base Quantities
40+
### Base Quantities
2041

2142
Here we declare the base quantities, each quantity may exist in different realms.
2243
You can specify the default realm so that there is a short-cut when adding a
@@ -32,7 +53,7 @@ declare quantity amount_of_substance default si
3253
declare quantity luminous_intensity default si
3354
```
3455

35-
## Derived Quantities
56+
### Derived Quantities
3657

3758
```
3859
declare quantity frequency = time^-1
@@ -48,7 +69,7 @@ declare quantity electrical_resistance = length^2 * mass * time^-3 * electric_cu
4869
```
4970

5071

51-
## Base unit
72+
### Base unit
5273
A base unit is a standard quantity in a realm. For example `m` (meter) is the
5374
base unit `1.0` of the `length` quantity in the `si` realm.
5475

@@ -64,7 +85,7 @@ declare unit Hz = 1.0 si frequency
6485
declare unit ohm "Ω" = 1.0 si electrical_resistance
6586
```
6687

67-
## Scale unit
88+
### Scale unit
6889
There are also scaled units.
6990

7091
```

0 commit comments

Comments
 (0)