Skip to content

Evaluate a "or" value lazily.#11

Open
hiro0107 wants to merge 1 commit into
pzol:masterfrom
hiro0107:lazy-eval-or
Open

Evaluate a "or" value lazily.#11
hiro0107 wants to merge 1 commit into
pzol:masterfrom
hiro0107:lazy-eval-or

Conversation

@hiro0107

Copy link
Copy Markdown

Sometime we want to evaluate a value of "or"'s parameter. For example,
the value should be a newly created object, but if Nothing.or(...) is
called, we don't want to create the object.
Because the current implemented "or" method is not lazily evaluated, we
have to use "if-then" statement in such a case.
In scala, a parameter of the "orElse" method is evaluated lazily. This
commit contains a new method "or_lazy" which evaluate the value lazily.

Sometime we want to evaluate a value of "or"'s parameter. For example,
the value should be a newly created object, but if Nothing.or(...) is
called, we don't want to create the object.
Because the current implemented "or" method is not lazily evaluated, we
have to use "if-then" statement in such a case.
In scala, a parameter of the "orElse" method is evaluated lazily. This
commit contains a new method "or_lazy" which evaluate the value lazily.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant