Even thought they happen to be the same thing in practice (except when they're not), one is an assignment, and the other is a declaration (and an assignment).
Consider:
someVar = foo()
// vs.
let someVar = foo()
The former is assigning the return value of foo()
into an existing (mutable) variable someVar
. The latter is declaring a new (possibly shadowing an existing) let
and the doing the assignment.
In the case when someVar
is replaced with _
, the two are really the same. Kinda. At least the effect is the same. But to the source code parser, they're not the same, methinks.
And view builders happen to support declarations, but not assignments. I guess it should be possible to special case the _
assignment, but I guess no-one has implemented that yet.