#call-by-name #functions #scala
Typically, parameters to functions are by-value parameters; that is, the value of the parameter is determined before it is passed to the function. But what if we need to write a function that accepts as a parameter an expression that we don't want evaluated until it's called within our function? For this circumstance, Scala offers call-by-name parameters.
If you want to change selection, open document below and click on "Move attachment"
Scala Functions Call-by-NameO
Scala Useful ResourcesScala Quick GuideScala Useful Resources
Selected ReadingDeveloper's Best PracticesEffective Resume WritingComputer GlossaryWho is Who
Scala Functions Call-by-Name
Advertisements
Previous Page
Next Page
<span>Typically, parameters to functions are by-value parameters; that is, the value of the parameter is determined before it is passed to the function. But what if we need to write a function that accepts as a parameter an expression that we don't want evaluated until it's called within our function? For this circumstance, Scala offers call-by-name parameters.
A call-by-name mechanism passes a code block to the callee and each time the callee accesses the parameter, the code block is executed and the value is calculated.
object Test {
def m Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details