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
I can see however how this is more verbose and perhaps not as flexible as vecty.If's current method signature. Just interested in opening a discussion about how this could be improved.
The text was updated successfully, but these errors were encountered:
The current way of using
vecty.If()
andvecty.MarkupIf()
is unsafe under certain circumstances that a normalif
would prevent against.For example, take a simple nil check in go:
the same principle does not however apply in Vecty.
This is because foo.Bar is evaluated before the method call, regardless of whether foo is nil or not.
One way to avoid this would be to make the second parameter to vecty.If a function, e.g.
Doing this would allow for safer uses of vecty.If without requirement of extra checks elsewhere, as the func is only called if the condition is met.
e.g.
I can see however how this is more verbose and perhaps not as flexible as vecty.If's current method signature. Just interested in opening a discussion about how this could be improved.
The text was updated successfully, but these errors were encountered: