-1

The text book for my class warns not to mix up @attr = ... and attr := ... when working with class attributes. It does not, however, explain what the difference is. I know that when working with cells, MyCell := ... changes the contents of the cell, but I have never seen @something = ....

Hubro
  • 56,214
  • 69
  • 228
  • 381

1 Answers1

1
C={NewCell 4}
@C=3
{Browse @C}

The code above outputs nothing, because @C=3 is the same as

{Cell.access C $}=3

and as the function {Cell.access C $} return 4, it is the same as

4=3

To assign a new value to a Cell, you must use `:='

yakoudbz
  • 903
  • 1
  • 6
  • 14
  • To a cell, yes. But does the same go for class attributes? Are they just cells? Also, wouldn't `{Browse @C}` output 4, since the previous assignment did nothing? – Hubro Apr 14 '14 at 11:43
  • I'm not sure but I think it's the same. So they might be cells :p – yakoudbz Apr 14 '14 at 11:45
  • (http://mozart.github.io/mozart-v1/doc-1.4.0/base/node14.html#chapter.infix) give an element of response. It's not the same as a cell, but it works kind of the same way – yakoudbz Apr 14 '14 at 11:49