You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For performance reasons, we usually do not need to evaluate the second argument of the something function. For example, in this pattern I sometimes use for propagating default arguments:
function foo(; bar=nothing)
bar = something(bar, defaultbar())
...
end
I propose a lazy version of this, @something:
macro something(valornothing, ex)
return valornothing == :nothing ? ex : valornothing
end
to be used as follows:
function foo(; bar=nothing)
bar = @something(bar, defaultbar())
...
end
so that defaultbar() need not be called when it is not needed.
The text was updated successfully, but these errors were encountered:
For performance reasons, we usually do not need to evaluate the second argument of the
something
function. For example, in this pattern I sometimes use for propagating default arguments:I propose a lazy version of this,
@something
:to be used as follows:
so that
defaultbar()
need not be called when it is not needed.The text was updated successfully, but these errors were encountered: