From: Austin Ziegler <halostatue@gmail.com>
To: Ruby developers <ruby-core@ruby-lang.org>
Subject: [ruby-core:101244] Re: [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings
Date: Fri, 4 Dec 2020 12:34:00 -0500 [thread overview]
Message-ID: <CAJ4ekQu5zpsnXxy2BNEP59jsupx+Gh3yThx=Fd9WDhbEvZK2tA@mail.gmail.com> (raw)
In-Reply-To: <X8lvDBrcgJQBwtUG@jeremyevans.local>
[-- Attachment #1.1: Type: text/plain, Size: 2210 bytes --]
Thanks. It’s only partially unrelated, because while it would be great for
RDoc to do the right thing (always treat `foo/foo=` method pairs as if they
were attribute writers), the `undef` was done *specifically* to avoid the
“redefining a method” warning.
-a
On Thu, Dec 3, 2020 at 6:05 PM Jeremy Evans <code@jeremyevans.net> wrote:
> On 12/03 05:44, Austin Ziegler wrote:
> > What does this mean?
> >
> > > Considering that you can alias a method to itself to avoid the warning,
> > and therefore do not need to remove the method first (which would cause a
> > race condition), I am dropping my request to add
> > `expected_redefined_method?(method_name)`.
>
> As shown by Urabe-san:
>
> ```ruby
> def foo
> end
>
> # This avoids the redefinition warning
> alias foo foo
>
> # This would normally result in a redefinition warning in verbose mode,
> # if not for the alias above.
> def foo
> end
> ```
>
> > I have code that I???ve written to get around some rdoc silliness that
> does:
> >
> > # rdoc documentation for foo.
> > attr_writer :foo
> > undef :foo=
> > def foo=(x) #:nodoc:
> > # specialized foo assignment code
> > end
> >
> > If I didn???t do this, RDoc documents both the attribute and the `foo=`
> > method (or it did the last time I checked) even though all I want
> > documented is the attribute for readability. How would I make it so that
> I
> > don???t need to do `undef :foo=` here, as that has been one thing that
> has
> > failed this code (_hard_) with both type analyzers for Ruby.
>
> This seems to be an unrelated issue. I would avoid the attr_writer and
> the undef. If you just want RDoc to mark this as an attribute method
> instead of general method, then you may want to submit a pull request to
> rdoc to add markup syntax to be able to flag a regular method as an
> attribute method.
>
> Thanks,
> Jeremy
>
> Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
>
--
Austin Ziegler • halostatue@gmail.com • austin@halostatue.ca
http://www.halostatue.ca/ • http://twitter.com/halostatue
[-- Attachment #1.2: Type: text/html, Size: 3223 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2020-12-04 17:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 22:03 [ruby-core:99375] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings merch-redmine
2020-07-29 2:26 ` [ruby-core:99386] " shyouhei
2020-07-29 6:54 ` [ruby-core:99387] " kamipo
2020-07-29 9:17 ` [ruby-core:99388] " jean.boussier
2020-07-29 20:48 ` [ruby-core:99395] " eregontp
2020-07-29 20:55 ` [ruby-core:99396] " eregontp
2020-07-29 21:37 ` [ruby-core:99397] " merch-redmine
2020-07-30 18:04 ` [ruby-core:99400] " headius
2020-07-30 18:16 ` [ruby-core:99401] " headius
2020-08-01 14:36 ` [ruby-core:99439] " eregontp
2020-08-01 14:54 ` [ruby-core:99440] " eregontp
2020-08-02 15:38 ` [ruby-core:99445] " merch-redmine
2020-08-03 11:22 ` [ruby-core:99453] " eregontp
2020-08-03 16:30 ` [ruby-core:99457] " merch-redmine
2020-08-03 16:48 ` [ruby-core:99458] " tenderlove
2020-08-03 17:01 ` [ruby-core:99459] " merch-redmine
2020-08-03 18:31 ` [ruby-core:99460] " tenderlove
2020-08-04 2:59 ` [ruby-core:99472] " merch-redmine
2020-08-15 10:54 ` [ruby-core:99595] " eregontp
2020-08-15 12:23 ` [ruby-core:99596] " eregontp
2020-08-15 15:42 ` [ruby-core:99597] " merch-redmine
2020-09-01 15:56 ` [ruby-core:99819] " merch-redmine
2020-09-02 14:57 ` [ruby-core:99844] " eregontp
2020-09-02 15:35 ` [ruby-core:99845] " merch-redmine
2020-12-02 21:25 ` [ruby-core:101207] " merch-redmine
2020-12-03 22:44 ` [ruby-core:101231] " Austin Ziegler
2020-12-03 23:04 ` [ruby-core:101233] " Jeremy Evans
2020-12-04 17:34 ` Austin Ziegler [this message]
2020-12-10 4:35 ` [ruby-core:101353] " matz
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='CAJ4ekQu5zpsnXxy2BNEP59jsupx+Gh3yThx=Fd9WDhbEvZK2tA@mail.gmail.com' \
--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).