[#122900] [Ruby Bug#21529] Deprecate the /o modifier and warn against using it — "jpcamara (JP Camara) via ruby-core" <ruby-core@...>

Issue #21529 has been reported by jpcamara (JP Camara).

10 messages 2025/08/03

[#122925] [Ruby Feature#21533] Introduce `Time#am?` and `Time#pm?` — "matheusrich (Matheus Richard) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxNTMzIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IG1hdGhldXNyaWNoIChNYXRoZXVzIFJp

10 messages 2025/08/06

[#122932] [Ruby Bug#21534] ppc64le Ractor ractor_port_receive aborted (core dumped) — "jaruga (Jun Aruga) via ruby-core" <ruby-core@...>

Issue #21534 has been reported by jaruga (Jun Aruga).

12 messages 2025/08/07

[#122953] [Ruby Bug#21540] prism allows `foo && return bar` when parse.y doesn't — "Earlopain (Earlopain _) via ruby-core" <ruby-core@...>

Issue #21540 has been reported by Earlopain (Earlopain _).

12 messages 2025/08/12

[#122964] [Ruby Feature#21543] Point ArgumentError to the call site — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

Issue #21543 has been reported by mame (Yusuke Endoh).

8 messages 2025/08/14

[#122969] [Ruby Feature#21545] `#try_dig`: a dig that returns early if it cannot dig deeper — "cb341 (Daniel Bengl) via ruby-core" <ruby-core@...>

Issue #21545 has been reported by cb341 (Daniel Bengl).

10 messages 2025/08/15

[#122987] [Ruby Bug#21547] SEGV after 2083fa commit — "watson1978 (Shizuo Fujita) via ruby-core" <ruby-core@...>

Issue #21547 has been reported by watson1978 (Shizuo Fujita).

10 messages 2025/08/20

[#123042] [Ruby Feature#21550] Ractor.sharable_proc/sharable_lambda to make sharable Proc object — "ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxNTUwIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGtvMSAoS29pY2hpIFNhc2FkYSkuDQoN

16 messages 2025/08/21

[#123122] [Ruby Feature#21556] Add true? and false? methods to NilClass, TrueClass, FalseClass, and String — "Phalado (Raphael Cordeiro) via ruby-core" <ruby-core@...>

Issue #21556 has been reported by Phalado (Raphael Cordeiro).

9 messages 2025/08/29

[#123146] [Ruby Bug#21559] Unicode normalization nfd -> nfc -> nfd is not reversible — "tompng (tomoya ishida) via ruby-core" <ruby-core@...>

Issue #21559 has been reported by tompng (tomoya ishida).

8 messages 2025/08/31

[ruby-core:123130] [Ruby Feature#21555] Add support for predicate attribute reader names

From: "shan (Shannon Skipper) via ruby-core" <ruby-core@...>
Date: 2025-08-29 22:57:08 UTC
List: ruby-core #123130
Issue #21555 has been updated by shan (Shannon Skipper).


Dan0042 (Daniel DeLorme) wrote in #note-2:
> Also related to #5781 #11167 #12046 #15991 #19708
> Popular eh?

Wow! There's already an open ticket for this exact issue even. I apologize for not properly searching before filing. I should have just added a PR link there in retrospect.

byroot (Jean Boussier) wrote in #note-3:
> > This feature is only supported for attr_reader and attr, not attr_writer or attr_accessor, since setter methods cannot have question marks.
> 
> Using the same logic, `attr_accessor :enabled?` could generate `#enabled?` and `#enabled=` without problem. `attr_writer :enabled?` would be weird though.

I was thinking of `attr_writer :enabled?` being weird and dismissed `attr_accessor :enabled?`. I didn't think of the case where you want `attr_reader :enabled?` and `attr_writer :enabled` without `attr_writer :enabled`. I wouldn't mind doing an `attr_reader :enabled?` with `attr_writer :enabled` but agree `attr_accessor :enabled?` makes sense based on the pattern.

----------------------------------------
Feature #21555: Add support for predicate attribute reader names
https://bugs.ruby-lang.org/issues/21555#change-114457

* Author: shan (Shannon Skipper)
* Status: Open
----------------------------------------
After manually aliasing predicate methods many times, I wanted to propose letting `attr_reader` take predicate method names that correspond to instance variables of the base name without a trailing question mark. https://github.com/ruby/ruby/pull/14391

If the base name method doesn't already exist, a predicate name defines a base name method attribute reader to alias then undefines the base name.

For example, this creates an `enabled?` method that reads `@enabled`:
```ruby
attr_reader :enabled?
```

This feature is only supported for `attr_reader` and `attr`, not `attr_writer` or `attr_accessor`, since setter methods cannot have question marks.

Example:
```ruby
class Example
  attr_reader :valid?, :meaning

  def initialize
    @valid = [true, false].sample
    @meaning = 42
  end
end

Example.new.valid? #=> true
```



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread