Skip to content

Commit b2ed565

Browse files
ntrelJinShil
authored andcommitted
[function.dd] Improve Lazy Parameters section (#2439)
* Improve Lazy Parameters section * Add two sub-headings. * Be more precise about lazy parameters. * Add link from lazy params to lazy variadics. * fix trailing whitespace
1 parent b77c40d commit b2ed565

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

spec/function.dd

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,8 @@ void bar(C c)
12021202

12031203
$(H2 $(LNAME2 parameters, Function Parameters))
12041204

1205+
$(H3 $(LNAME2 param-storage, Parameter Storage Classes))
1206+
12051207
$(P Parameter storage classes are $(D in), $(D out),
12061208
$(D ref), $(D lazy), $(D const), $(D immutable), $(D shared),
12071209
$(D inout) or
@@ -1283,10 +1285,11 @@ def(z);
12831285
apply only to the reference and not the contents.
12841286
)
12851287

1286-
$(P $(D lazy) arguments are evaluated not when the function is called,
1287-
but when the parameter is evaluated within the function. Hence,
1288-
a $(D lazy) argument can be executed 0 or more times. A $(D lazy) parameter
1289-
cannot be an lvalue.)
1288+
$(H3 $(LNAME2 lazy-params, Lazy Parameters))
1289+
1290+
$(P An argument to a $(D lazy) parameter is not evaluated before the function is called.
1291+
The argument is only evaluated if/when the parameter is evaluated within the function. Hence,
1292+
a $(D lazy) argument can be executed 0 or more times. )
12901293

12911294
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
12921295
---
@@ -1312,9 +1315,13 @@ $(CONSOLE
13121315
2
13131316
)
13141317

1318+
$(P A $(D lazy) parameter cannot be an lvalue.)
1319+
13151320
$(P A $(D lazy) parameter of type $(D void) can accept an argument
13161321
of any type.)
13171322

1323+
$(P See Also: $(RELATIVE_LINK2 lazy_variadic_functions, Lazy Variadic Functions))
1324+
13181325
$(H3 $(LNAME2 function-default-args, Function Default Arguments))
13191326

13201327
$(P Function parameter declarations can have default values:)

0 commit comments

Comments
 (0)