[#79440] [Ruby trunk Bug#13188] Reinitialize Ruby VM. — shyouhei@...
Issue #13188 has been updated by Shyouhei Urabe.
6 messages
2017/02/06
[#79441] Re: [Ruby trunk Bug#13188] Reinitialize Ruby VM.
— SASADA Koichi <ko1@...>
2017/02/06
On 2017/02/06 10:10, shyouhei@ruby-lang.org wrote:
[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>
Hi,
15 messages
2017/02/15
[#79541] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/15
Em 15-02-2017 05:05, Daniel Ferreira escreveu:
[#79543] Re: Immutable Strings vs Symbols
— Daniel Ferreira <subtileos@...>
2017/02/16
Hi Rodrigo,
[#79560] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/16
Em 15-02-2017 22:39, Daniel Ferreira escreveu:
[ruby-core:79525] [Ruby trunk Feature#13212][Closed] Syntax proposal: don't require begin-end to rescue exceptions inside do-end blocks
From:
hsbt@...
Date:
2017-02-14 06:51:34 UTC
List:
ruby-core #79525
Issue #13212 has been updated by Hiroshi SHIBATA.
Status changed from Open to Closed
It's accepted by https://bugs.ruby-lang.org/issues/12906
You can use this syntax after Ruby 2.5.
----------------------------------------
Feature #13212: Syntax proposal: don't require begin-end to rescue exceptions inside do-end blocks
https://bugs.ruby-lang.org/issues/13212#change-62973
* Author: Damian Nowak
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Blocks are ubiquitous in Ruby world. There's as many blocks in every Ruby code as methods - if not even more. It would be very nice to treat blocks as first class citizens like methods and reduce the undesirable begin-end boilerplate inside blocks for exception handling. Here's the syntax proposal:
~~~ ruby
arr.each do |e|
do_something(e)
rescue MyException => e
# handle exception
end
~~~
Just like in methods:
~~~ ruby
def method
do_something
rescue MyException => ex
# handle exception
end
~~~
Currently `begin-end` block is required for handling exceptions inside blocks:
~~~ ruby
arr.each do |e|
begin
do_something(e)
rescue MyException => ex
# handle exception
end
end
~~~
Whether the same syntax would apply for {} block/lambda syntax is debatable. {} are typically one-liners and I barely ever saw a begin-rescue-end inside them.
Thank you
-Damian Nowak
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>