[#68845] [Ruby trunk - Feature #11056] [PATCH] lib/net/*: use io/wait methods instead of IO.select — normalperson@...
Issue #11056 has been updated by Eric Wong.
3 messages
2015/04/11
[#68945] [Ruby trunk - Feature #11083] [Open] Gemify net-telnet — shibata.hiroshi@...
Issue #11083 has been reported by Hiroshi SHIBATA.
4 messages
2015/04/21
[#68951] Re: [Ruby trunk - Feature #11083] [Open] Gemify net-telnet
— Eric Wong <normalperson@...>
2015/04/21
shibata.hiroshi@gmail.com wrote:
[#69012] [Ruby trunk - Feature #11105] [Open] ES6-like hash literals — shugo@...
Issue #11105 has been reported by Shugo Maeda.
5 messages
2015/04/29
[ruby-core:68762] [Ruby trunk - Feature #11034] Nil Conditional
From:
recursive.madman@...
Date:
2015-04-05 08:40:44 UTC
List:
ruby-core #68762
Issue #11034 has been updated by Recursive Madman.
This is similar to a pattern I have seen somewhere else:
```
var = 123.4
var.try.round #=> 123
var = nil
var.try.round #=> nil
```
Which doesn't introduce a new operator and can be implemented like this:
```
class Object
def try
self
end
end
class NilClass
def try
IgnoreCall
end
class IgnoreCall
def method_missing(*a)
nil
end
end
end
```
By the way, fun fact:
```
?????:?? #=> '?'
```
----------------------------------------
Feature #11034: Nil Conditional
https://bugs.ruby-lang.org/issues/11034#change-52044
* Author: Grzegorz Bizon
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Hi everyone !
Some time ago I was thinking about Nil Conditional Operator in Ruby (`??`). This would be particularly useful to avoid frequent checking for nil, and should behave and look like Null Conditional Operator introduced in C# 6.0.
I was thinking about something like this (assume `var` is nil or doesn't exist):
~~~ruby
var??.method1.method2(123, 345).method3 { |i| i == 1 }
=> nil
~~~
When `var` is nil or doesn't exist, code above should return nil or NilConditionalClass object instead of raising NoMethodError or NameError.
This can also work with methods (assume `var` exists):
~~~ruby
var.method1??.method2(a, b)
=> nil
~~~
When `var` exists and can receive `method1`, but `method1` returns nil - this shouldn return nil instead of raising `NoMethodError: undefined method `method2' for nil:NilClass`
When `var` exists and is not nil, and can receive `method1`, and object returned by `method1` can receive `method2` this, of course should behave as expected (like version without `??` operator) and return value according to implementation of method2.
When `var` doesn't exist - this should raise NameError.
I tried to create gem for that (https://github.com/grzesiek/nil-conditional) but from now on, only native implementation seems reasonable.
What do you think about that feature ? Maybe it is already considered, but I couldn't find anything similar at Google/this issue tracker (in that case I'm sorry for duplicate).
Thanks in advance for feedback !
Kind regards,
Grzegorz
--
https://bugs.ruby-lang.org/