On Thu, Feb 2, 2012 at 10:03 AM, botp <botpena / gmail.com> wrote:
> On Thu, Feb 2, 2012 at 4:57 PM, botp <botpena / gmail.com> wrote:
>> On Thu, Feb 2, 2012 at 3:47 PM, Robert Klemme
>> <shortcutter / googlemail.com> wrote:
>>> On Thu, Feb 2, 2012 at 3:56 AM, botp <botpena / gmail.com> wrote:
>>>> indeed. ruby just checks the last assignment.
>>>>
>>>>> if (x,y=3D(a, b =3D foo))
>>>>> p 1
>>>>> end
>>>> SyntaxError: (irb):17: multiple assignment in conditional
>>>>
>>>> but i do not know why it has to do that checking. too much work. and
>>>> could probably slow down ruby.
>>>
>>> Probably because (a,b=3Dfoo) in all but the latest version always yield=
s
>>> an Array which is true hence does not make sense as a condition. =A0You
>>> could write if (true) as well.
>>
>> ah, portability/compatibility. i guess we're stucked then :)
>> thanks Robert.
>> best regards -botp
>
> ok, i'll take it back, since,
> if only the latest version makes sense, then wouldn't that mean it's
> not really being used in the earlier versions, =A0and therefore, =A0it
> *is* safe to implement it currently, ie remove the checking?

I think so.  But that still does not make it a brilliant idiom in my
eyes.  Granted, the example Gavin presented looks pretty reasonable.
However, I haven't missed this feature in all those years so I am a
tad uncertain how common or uncommon that is.

Kind regards

robert


--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/