Project

General

Profile

Actions

Feature #18070

open

`attr` should be removed

Added by schwad (Nick Schwaderer) over 2 years ago. Updated about 1 year ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:104837]

Description

I'm digging through some older Ruby versions and discovered that attr was deprecated in Ruby 1.9. We still are seeing support for it in Ruby 3.0

Unless there are internals that require its existence, is it time to remove this deprecated feature?

If there's agreement, I'm more than happy to fire up the PR myself. (Also happy to be corrected if there's something I'm missing here :) )

Actions #1

Updated by jeremyevans0 (Jeremy Evans) over 2 years ago

  • Tracker changed from Bug to Feature
  • ruby -v deleted (3.0.0p0)
  • Backport deleted (2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN)

Updated by rubyFeedback (robert heiler) about 1 year ago

There may be backwards compatibility considerations. Personally I never
use attr. I use the longer variants (attr_accessor, attr_writer and
attr_reader), but even these I use less often compared to older code.
I tend to put variables for larger classes into an internal hash usually
these days.

I think the pickaxe also recommended the longer variants, but I am not
100% sure. (And perhaps we should look at how frequently "attr" is
actually in use in gems, to get an estimate of how popular it may
still be.)

Perhaps if backwards compatibility is a concern, there should be a
deprecation window announced, before it may then be removed (if it
is decided to remove it)?

Actions

Also available in: Atom PDF

Like0
Like0Like0