[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
Thanks to explain that.
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:91047] [Ruby trunk Feature#15526] New way to destruct an object hash
From:
janfri26@...
Date:
2019-01-12 15:05:00 UTC
List:
ruby-core #91047
Issue #15526 has been updated by janfri (Jan Friedrich).
zverok (Victor Shepelev) wrote:
> 1) Ruby has very consistent "argument **deconstruction**" rules. Basically, "it is deconstructed the same way it is constructed", e.g., if you can _call_ (construct) with arguments like `meth(a, *b, c: 1, d: 2, **e)`, you can also _receive_ (deconstruct) arguments exactly the same way: `a, *b, c:, d: nil, **e`.
>
> 2) The deconstruction is fully enabled in arguments (including keyword arguments) to procs and methods
>
> 3) Initially (before keyword arguments), the variable assignment had the same "expressive power", e.g. you could define a method like
>
> ```ruby
> def meth(a, b, *rest)
> ```
> ...and you could assign variables the same way:
>
> ```ruby
> a, b, *rest = [1, 2, 3, 4]
> ```
>
> 4) When keyword arguments were introduced, there was no matching syntax for variable assignment. If it **would** exist, it most probably **should** look this way (same as arguments, remember):
>
> ```ruby
> a:, b:, **kwrest = {a: 1, b: 2, c: 3, d: 4}
> ```
> It obviously looks confusing (and would probably be hard for the parser), and I believe that's the reason it was NOT added to the language.
>
> 5) I don't think adding "orphan feature" (looking like nothing else in the language) just for the sake of this particular case would be ever accepted; and I don't think it should.
>
> 6) In the meantime, "chainable" code style (with `Enumerable` and `#then`) allows to embrace argument deconstruction in its full force:
> ```ruby
> config.then { |host:, port: 8080, **rest|
> ```
> ...which is NOT the main (and obviously not the only) reason to use this style, just a nice side-effect of its consistency with the rest of the language.
+1 Great analysis.
----------------------------------------
Feature #15526: New way to destruct an object hash
https://bugs.ruby-lang.org/issues/15526#change-76267
* Author: alissonbruno.sa (Alisson Santos)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
JavaScript has a nice a neat way to destruct objects.
~~~ javascript
const person = { name: "John Doe", age: 33 };
const { name, age } = person;
~~~
Erlang has a similar way to destruct a tuple:
~~~ erlang
Person = {"John Doe", 33}
{Name, Age} = Person
~~~
I think it's very handy and would be nice if we have something similar in Ruby.
~~~ ruby
config = { host: 'localhost', port: 3000 }
{ host, port } = config
~~~
I know Ruby has Hash#values_at, but I think this way it's more readable and understandable
What do you guys think?
--
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>