mr_mischief likes to think in a very right-to-left way when it comes to assignment operator. In his mental model,
- The list assignment operator returns two values to the list on its LHS, a list to assign and its scalar result.
- The LHS list takes the list returned by the list assignment and performs the assignment.
- The LHS list returns the scalar returned by the list assignment.
He realizes the implementation differs.
| [reply] |
Other than calling it specifically my model, I can fully endorse this post. I don't prefer one model over the other, as I still don't see a definite general-case benefit to one or the other. I just like to defend the model that people criticize if I see merit in it. I'll also criticize a model others endorse if I see flaws. I'll even defend the strong points and criticize the weak points of the same model.
In specific cases, I think this one helps some people. In other specific cases, I think the model ysth, tye, JavaFan, merlyn, and yourself use is more helpful (and more precise with relation to the actual implementation).
Mostly I like for people to be able to choose which one works for them. I've avoided disclosing my particular mental model up to this point because I don't think that how I personally think about it when I program is that relevant to whether or not a particular model is useful to others.
If people really must know...
You do recognize and understand the workings of the model as I understand it, though, and I think it admirable you went through the trouble to do so.
| [reply] [d/l] |
i am indeed talking about:
The assignment operator itself happens to be both in scalar and in list context. It produces both a list for the list, and a scalar
from 719455. The antecedent I intended for "it" was, however, "the assignment operator itself" and not the list on the right. In the "list for the list" part, the first "list" is the list value assigned through the side effect of the assignment operator and the second "list" is the list on the left which is assigned the value.
I think that covers the possible misunderstandings. I'm sorry if I wasn't more clear, or if I still need to be more clear. I may have misunderstood which part you misunderstood. | [reply] |