@if expression evaluates both sides
The @if expression evaluates both possible outputs even though it only needs to do one or the other.
An example where this became an issue is:
I wanted to return a @join of an array property, if it existed. I found join would fail if the property didn't exist. So I wrapped it in an @if which will check if it doesn't exist and return an empty string. But I still got the error, because it still evaluated the false condition.
I would have it so @if only evaluates the side that meets the if's evaluation only.
Thomas Johnson commented
I found I could use @coalesce to achieve what I needed.
I still think @if shouldn't evaluate both sides, if possible.