[#66678] [ruby-trunk - Feature #10481] Add "if" and "unless" clauses to rescue statements — alex@...
Issue #10481 has been updated by Alex Boyd.
3 messages
2014/12/04
[#66762] Re: [ruby-changes:36667] normal:r48748 (trunk): struct: avoid all O(n) behavior on access — Tanaka Akira <akr@...>
2014-12-10 0:44 GMT+09:00 normal <ko1@atdot.net>:
3 messages
2014/12/10
[#66851] [ruby-trunk - Feature #10585] struct: speedup struct.attr = v for first 10 attributes and struct[:attr] for big structs — funny.falcon@...
Issue #10585 has been updated by Yura Sokolov.
3 messages
2014/12/15
[#67126] Ruby 2.2.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 2.2.0.
8 messages
2014/12/25
[#67128] Re: Ruby 2.2.0 Released
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2014/12/25
I can't install it in any of our Ubuntu servers using rbenv:
[#67129] Re: Ruby 2.2.0 Released
— SHIBATA Hiroshi <shibata.hiroshi@...>
2014/12/25
> I can't install it in any of our Ubuntu servers using rbenv:
[ruby-core:66706] [ruby-trunk - Feature #10570] [Open] Allow `+=` etc. to be methods
From:
davidm@...
Date:
2014-12-04 22:30:49 UTC
List:
ruby-core #66706
Issue #10570 has been reported by David MacMahon.
----------------------------------------
Feature #10570: Allow `+=` etc. to be methods
https://bugs.ruby-lang.org/issues/10570
* Author: David MacMahon
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
In MRI, it is currently possible to create `#+=` methods in C extensions and even `+=` aliases for existing methods in Ruby source code. These methods are only callable via `#send('+=', ...)` because the parser interprets `a += b` as `a = a + b` before the "operator method" is called. Thus, `a += b` is currently equivalent to `a = a.send('+', b)` rather than `a.send('+=', b)`. This feature request is to allow and support `<OP>=` methods, where `<OP>` is any of Ruby's operators that can be defined as methods (e.g. `#+`, `#-`, etc).
A related feature request would be to allow `#<attribute><op>=` methods in addition to the already supported`#<attribute>=` methods. As it is now, `foo.bar += x` is equivalent to `foo.send('bar=', foo.send('bar').send('+', x))`, which requires that the return value of `foo.bar` implements `#+` and that `foo` implements `#bar=`. If this related feature were implemented, `foo.bar += x would be equivalent to `foo.send('bar+=', x)`.
I guess this would be tricky to add in a backwards compatible way. What happens if `#+=` is not defined for the would-be receiver? How would that condition be detected in a way that could fall back to the old default behavior?
What other possible complications could make this request impractical?
--
https://bugs.ruby-lang.org/