[MacRuby-devel] bug? passing :"|=" to the send method of an array is broken

Mikael Høilund mikael at hoilund.org
Sun Jan 2 20:40:50 PST 2011


`a |= b` is syntactical sugar for `a = a | b`. If you replace :"|=" with :| you'll be fine. There's nothing an object can do to fully replicate the functionality of |=, though — an object has neither the knowledge nor the abilities needed to rebind a variable above its scope.

This holds true for all similar operators; +=, -=, /=, *=, **=,  |= and &=. ||= and &&= aren't, though, as these are logical operators that Ruby must treat specially.

Now stop frowning; make that |= a :>!

On Jan 3, 2011, at 5:35, Zachary Kaplan wrote:

> while i was doing some programming earlier today i noticed that passing the |= operator to the send method of an array results in an NoMethodError
> 
> here is simple gist of an irb session demonstrating the bug: https://gist.github.com/763108
> 
> also - i noticed this which is unrelated but may also be a bug: https://gist.github.com/763118
> 
> -zak
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110103/dae2b757/attachment-0001.html>


More information about the MacRuby-devel mailing list