RHS or LHS assignment?



There are extensive discussions about RHS and LHS assignment in Julia github about = (see 13168, 5532, 7341 ) and .= (see 26516, 25954, 26088, 26347).

But it seems that these are still controversial. I think it would be good to listen to the response of the community.

Which do you prefer in terms of the return of = operation?

  • LHS
  • RHS

0 voters

Which do you prefer in terms of the return of .= operation?

  • LHS
  • RHS
  • Nothing

0 voters


You should probably add nothing as an option for .= since that’s being discussed as a real option.


Should there also be an option “I haven’t thought about it enough to make a well-informed opinion”?


I’m sorry, but these things don’t get decided by popularity poll. If you have carefully considered technical arguments that aren’t in those issues yet for why one should be preferred over the other, please make them.


Actually I see that there is no right or wrong for the both choices. It is more about how the user expect, desire. I did not really convinced by RHS for both = and .=.

Chained assignment is considered the most important motivation of RHS for = to avoid unwanted type convention. But is RHS really better than LHS in this case?

For the expression a = b = c = 1, as previously discussed in the slack, if c::Float64, the return of RHS and LHS is different. If a and b do not have explicit type notation, they will have the same type of c in LHS rule, but not in the RHS rule. If a or b does have explicit type, then it will have the same result in both LHS and RHS.

Another point is the return in REPL, for the expression a[:] = 4, it returns 4. I definitely know the value of RHS. What I concerns is what is the value of LHS. So return the LHS is more intuitive.

For the return of .=, I also agree more with @stevengj said in 26088 and 25954 (prefer LHS as well).

For the return of A[I].=B, I am OK for eight return of A or A[I] when that is decided.

I am not experienced in Julia than most of the members. I may have errors in this statement. It would be good to have more people thinking about this issue.


Sorry, I cannot edit the poll any more because of exceeding the first 5 min. Could you add another option of No clue or something else like that?


Since this is mainly a technical argument which is already taking place where it should, I am not sure what you meant to accomplish with this poll.


IThe motivation is that it seems nobody can really convince others especially in the discussion of issue 26516. I think it would be good to have more people know about this. It is technical but also practical.

If many think this is meaningless, I am fine to delete it.


Designing semantics for programming languages is difficult and takes time. Please be patient, some issues take months (or even years) to be solved.