ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: rob@flowof.info
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81571] [Ruby trunk Feature#12739] deprecate_constant :Fixnum, :Bignum
Date: Sun, 04 Jun 2017 21:54:27 +0000	[thread overview]
Message-ID: <redmine.journal-65273.20170604215427.1bb01acb33da374d@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-12739.20160908144250@ruby-lang.org

Issue #12739 has been updated by robertgleeson (Robert Gleeson).


robertgleeson (Robert Gleeson) wrote:
> znz (Kazuhiro NISHIYAMA) wrote:
> > How about `class Object; deprecate_constant :Fixnum, :Bignum; end`?
> > 
> > * naruse supports: https://twitter.com/nalsh/status/773800491671101441
> > * akr objects: https://twitter.com/tanaka_akr/status/773817391218249729
> > 
> > I don't mind either way.
> > Do you have any comment about it?
> 
> It would be nice to have `constant_deprecated?`.
> To avoid all of these warnings while supporting &lt;2.4 and &gt;=2.4 i track what constants are deprecated in an array, and 
> then avoid using them or not by checking the array at runtime. It's bit of a pain..

I realise my comment isn't clear, here's very simple code to show what i mean:

deprecated_constants = [:Fixnum, :TimeoutError, :Bignum, :FALSE, :TRUE, :NIL]
Object.constants.each do |constant|
  const_get(constant) unless deprecated_constants.include?(constant) 
end

the real code i have is more complex, but in essence this is the problem,
and deprecated_constants has to be maintained by me manually, which
will become out of date over time.


----------------------------------------
Feature #12739: deprecate_constant :Fixnum, :Bignum
https://bugs.ruby-lang.org/issues/12739#change-65273

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
How about `class Object; deprecate_constant :Fixnum, :Bignum; end`?

* naruse supports: https://twitter.com/nalsh/status/773800491671101441
* akr objects: https://twitter.com/tanaka_akr/status/773817391218249729

I don't mind either way.
Do you have any comment about it?



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2017-06-04 21:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-12739.20160908144250@ruby-lang.org>
2016-09-08 14:42 ` [ruby-core:77219] [Ruby trunk Feature#12739] deprecate_constant :Fixnum, :Bignum zn
2016-09-10  4:33 ` [ruby-core:77240] " nobu
2017-06-04 21:44 ` [ruby-core:81570] " rob
2017-06-04 21:54 ` rob [this message]
2017-06-16 13:28 ` [ruby-core:81711] " zn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-65273.20170604215427.1bb01acb33da374d@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).