From: Brian Mitchell Date: 2006-10-06T23:46:59+09:00 Subject: Re: Compound Parallel Operators On 10/6/06, Carlos wrote: > Phrogz wrote: > [...] > > Now, I would consider it a valid argument to say "Let's not codify a > > particular interpetation of some syntax that conflicts with another > > reasonable interpretation, because it will be surprising to a notable > > percentage of programmers." Would anyone say that they personally have > > a different expectation for what "a,b += x,y" might mean? > > "The same as > a,b = a,b + x,y > but with a,b evaluated only once"? An example of how we already have behavior that most don't realize: var = :red var, var[:ruby] = {}, var Note that this will actually work which means you have to decompose to a much more complex structure... one with things like temp vars: # Right one = {} two = var # Left var = one var[:ruby] = two Or course we could optimize that to: # Temps two = var # Left var = {} var[:ruby] = two ... but that is about all the complexity we need. It gets ever more confusing with parallel operators. Now it gets confusing because the time things get referred to is all messed up: # Not real code! var = 'ruby' var, var += var, var.reverse one = var two = var.reverse var += one #=> ruby + ruby var += two #=> (ruby + ruby) + ybur Confusing enough for me. I'm not sure I would really use parallel operators. I do use, parallel assignment quite a bit (nice for argument handling and just avoiding temp vars in general). With all of that said, I am not sure if I am really against the concept either. It just isn't really important to me. Brian.