[#105450] [Ruby master Feature#18228] Add a `timeout` option to `IO.copy_stream` — "byroot (Jean Boussier)" <noreply@...>
SXNzdWUgIzE4MjI4IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku
11 messages
2021/09/27
[ruby-core:105217] [Ruby master Feature#14579] Hash value omission
From:
"knu (Akinori MUSHA)" <noreply@...>
Date:
2021-09-13 04:10:25 UTC
List:
ruby-core #105217
Issue #14579 has been updated by knu (Akinori MUSHA).
baweaver (Brandon Weaver) wrote in #note-19:
> * `@var:` - Would this work with instance/class/global/constant variables if they're valid symbols?
No, because we didn't change the symbol key syntax. `{ @var: @var }` is not valid, so `{ @var: }` isn't either. The same goes for `$var` and `@@var`.
> * `a = 1; {a:, b: 3}` - Does it support mixing omissions and regular values?
Yes.
> * `p a:, b: 3` - Does it work with implied hashes / keywords? (I think yes).
Yes, but beware when you omit the last value without the closing parenthesis. The interpreter will look further past the line end for a value.
----------------------------------------
Feature #14579: Hash value omission
https://bugs.ruby-lang.org/issues/14579#change-93624
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
How about to allow value omission in Hash literals:
```ruby
x = 1
y = 2
h = {x:, y:}
p h #=> {:x=>1, :y=>2}
```
And in keyword arguments:
```ruby
def login(username: ENV["USER"], password:)
p(username:, password:)
end
login(password: "xxx") #=> {:username=>"shugo", :password=>"xxx"}
```
---Files--------------------------------
hash_value_omission.diff (619 Bytes)
--
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>