mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
doc: move the Parameter evaluation order
section before References
(#16306)
This commit is contained in:
parent
cb5c6b605b
commit
3061859f25
38
doc/docs.md
38
doc/docs.md
@ -85,8 +85,8 @@ To do so, run the command `v up`.
|
||||
* [Variable number of arguments](#variable-number-of-arguments)
|
||||
* [Anonymous & higher-order functions](#anonymous--higher-order-functions)
|
||||
* [Closures](#closures)
|
||||
* [References](#references)
|
||||
* [Parameter evaluation order](#parameter-evaluation-order)
|
||||
* [References](#references)
|
||||
* [Constants](#constants)
|
||||
* [Required module prefix](#required-module-prefix)
|
||||
* [Builtin functions](#builtin-functions)
|
||||
@ -2619,6 +2619,23 @@ i = 10
|
||||
print_counter() // 10
|
||||
```
|
||||
|
||||
### Parameter evaluation order
|
||||
|
||||
The evaluation order of the parameters of function calls is *NOT* guaranteed.
|
||||
Take for example the following program:
|
||||
```v
|
||||
fn f(a1 int, a2 int, a3 int) {
|
||||
dump(a1 + a2 + a3)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
f(dump(100), dump(200), dump(300))
|
||||
}
|
||||
```
|
||||
V currently does not guarantee, that it will print 100, 200, 300 in that order.
|
||||
The only guarantee is that 600 (from the body of `f`), will be printed after all of them.
|
||||
That *may* change in V 1.0 .
|
||||
|
||||
## References
|
||||
|
||||
```v
|
||||
@ -2669,25 +2686,6 @@ struct Node<T> {
|
||||
|
||||
To dereference a reference, use the `*` operator, just like in C.
|
||||
|
||||
see also [Stack and Heap](#stack-and-heap).
|
||||
|
||||
### Parameter evaluation order
|
||||
|
||||
The evaluation order of the parameters of function calls is *NOT* guaranteed.
|
||||
Take for example the following program:
|
||||
```v
|
||||
fn f(a1 int, a2 int, a3 int) {
|
||||
dump(a1 + a2 + a3)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
f(dump(100), dump(200), dump(300))
|
||||
}
|
||||
```
|
||||
V currently does not guarantee, that it will print 100, 200, 300 in that order.
|
||||
The only guarantee is that 600 (from the body of `f`), will be printed after all of them.
|
||||
That *may* change in V 1.0 .
|
||||
|
||||
## Constants
|
||||
|
||||
```v
|
||||
|
Loading…
Reference in New Issue
Block a user