Feature #6270
closed
add "??a" support for "not defined?(a) or a.nil?"
Added by jacksonwillis (Jackson Willis) over 12 years ago.
Updated over 12 years ago.
Description
It would work like this:
??foo #=> nil
foo = nil
??foo #=> nil
foo = 3
??foo #=> true
Not sure if this would be useful, just a suggestion.
So ??foo' is basically a macro for
not defined?(foo) or foo.nil?'.
=begin
This syntax seems too similar to the ?a character string syntax
Currently ?a returns "a", so how would the parsing of this expression change:
true ??a:?b
Which currently returns "a", or:
question_method??a
Which currently parses the same as:
question_method? "a"
=end
- Status changed from Open to Rejected
As Eric pointed out, it's conflicting existing syntax. I don't reject the basic idea (though I am excited), so try again with new syntax if you really want this.
Matz.
Also available in: Atom
PDF
Like0
Like0Like0Like0