I would guess that the difference is that `MyMod.b = 7.6` changes the value that the variable is bound to, where `MyMod.a.val = 4.5` modifies the value of the variable. This subtle difference is similar to a function that takes and Int and an Array being able to make externally visible modifications to the contents of the array, but not the Int.
(I'm sorry for explaining this poorly, I don't have a good vocabulary for doing so.) On Tue, Jun 10, 2014 at 1:10 PM, Brian Piper <[email protected]> wrote: > > > This seems unexpected to me: > > module MyMod > > type AType > val > end > > global a = AType(5.0) > > global b = 10.0 > > end > > Then in the REPL... > > julia> MyMod.b = 7.6 > ERROR: cannot assign variables in other modules > > julia> MyMod.a.val = 4.5 > 4.5 > > So, in summation, no errors when assigning to fields of a composite type > in another module, but an error with assigning to a variable in that > module. Any insight as to what's going on here? Is this intended behavior, > and if so, why? >
