@@ -31,13 +31,13 @@ object ByNameParameter
31
31
def takesUnitByNameParameter (res0 : Either [Throwable , Int ]) = {
32
32
def calc (x : () => Int ): Either [Throwable , Int ] = {
33
33
try {
34
- Right (x()) // An explicit call of the x function
34
+ Right (x()) // An explicit call of the x function
35
35
} catch {
36
36
case b : Throwable => Left (b)
37
37
}
38
38
}
39
39
40
- val y = calc { () => // Having explicitly declaring that Unit is a parameter with ()
40
+ val y = calc { () => // explicitly declaring that Unit is a parameter with ()
41
41
14 + 15
42
42
}
43
43
@@ -48,7 +48,7 @@ object ByNameParameter
48
48
*/
49
49
def byNameParameter (res0 : Either [Throwable , Int ]) = {
50
50
def calc (x : => Int ): Either [Throwable , Int ] = {
51
- // x is a call by name parameter
51
+ // x is a call by- name parameter
52
52
try {
53
53
Right (x)
54
54
} catch {
@@ -57,16 +57,16 @@ object ByNameParameter
57
57
}
58
58
59
59
val y = calc {
60
- // This looks like a natural block
61
- println(" Here we go!" ) // Some superfluous call
62
- val z = List (1 , 2 , 3 , 4 ) // Another superfluous call
60
+ // This looks like a natural block
61
+ println(" Here we go!" ) // Some superfluous call
62
+ val z = List (1 , 2 , 3 , 4 ) // Another superfluous call
63
63
49 + 20
64
64
}
65
65
66
66
y should be(res0)
67
67
}
68
68
69
- /** By name parameters can also be used with `object` and `apply` to make interesting block-like calls:
69
+ /** By- name parameters can also be used with `object` and `apply` to make interesting block-like calls:
70
70
*/
71
71
def withApplyByNameParameter (res0 : String ) = {
72
72
object PigLatinizer {
0 commit comments