Good question. I think the answer is just "syntactic clarity". The
former looks more readable to me, if all you want is to "define b.foo
in terms of x".
Incidentally, I think my fake syntax leaves something to be desired in
that sometimes you just want a "plain old assignment"; in other words
you just want to assign the *current binding of x* plus 5, not have it
always be defined in terms of whatever x is. For this distinction I
like Scala's syntax:
def foo = x + 5;
this essentially makes foo a no-arg function, but you can think of it
as just "foo will always be whatever x is plus 5"... since in Scala
you can leave the parens off a no-arg method, whether foo is a
variable or "reactive function" is an implementation detail. The
following, however, merely declares a constant which is assigned the
current binding of x plus 5:
val foo = x + 5;
var foo = x + 5;
On Nov 30, 12:49 pm, Yan Tordoff <
t0r...@googlemail.com> wrote:
> Out of interest, what's the difference between
> b.foo = x + 5;
> as a reactive assignment and
> ?x { b.foo = x + 5 };
> as an observation?
>