question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

So if I use the and helper like so;

{{if (and firstExpression secondExpression)}}

It will evaluate both firstExpression and secondExpression even if firstExpression is false.

Is there a way to get it to evaluate just the firstExpression and stop there when it fails? The reason I ask is because 99% of the time my secondExpression is not necessary, and is quite taxing, so I only want to evaluate it when necessary.

I am trying to do this with ember-truth-helpers because both of my expressions are actually handlebar helpers :p

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Oct 6, 2017

Sure, but definitely is annoying 😄

0reactions
Techn1xcommented, Oct 6, 2017

I guess in theory this would be an alternative approach to achieve lazy evaluation;

{{#if firstExpression}}
  {{#if secondExpression}}
    {{doSomething}}
  {{/if}}
{{/if}}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lazy evaluation - Wikipedia
In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is ......
Read more >
Functional Programming - Lazy Evaluation - Tutorialspoint
Lazy evaluation is an evaluation strategy which holds the evaluation of an expression until its value is needed. It avoids repeated evaluation.
Read more >
What is Lazy Evaluation? — Programming Word of the Day
When a compiler encounters an expression, usually it tries to evaluate it. Evaluation is the process of getting the root meaning of a...
Read more >
What is Lazy Evaluation in Python? | by Xiaoxu Gao
If you've never heard of Lazy Evaluation before, Lazy Evaluation is an evaluation strategy which delays the evaluation of an expression ...
Read more >
Scala | Lazy Evaluation - GeeksforGeeks
Lazy evaluation or call-by-need is a evaluation strategy where an expression isn't evaluated until its first use i.e to postpone the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found