From: dementiev.vm@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95234] [Ruby master Feature#16241] Shorter syntax for anonymous refinements
Date: Sat, 05 Oct 2019 19:04:04 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-16241.20191005190403.cb988ab09ed1bd2f@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16241.20191005190403@ruby-lang.org
Issue #16241 has been reported by palkan (Vladimir Dementyev).
----------------------------------------
Feature #16241: Shorter syntax for anonymous refinements
https://bugs.ruby-lang.org/issues/16241
* Author: palkan (Vladimir Dementyev)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
The original discussion is here https://bugs.ruby-lang.org/issues/14344.
tl;dr
- Refinements are often used in-place with anonymous modules
- Having shorter syntax could lower the barrier of entry for Rubyist wanting to explore this feature
- Previous syntax suggestions were not accepted.
I suggest adding a shorter syntax (technically, API):
```ruby
# before
using(Module.new do
refine Array do
def foo;"bar";end
end
end)
# after
refining Array do
def foo; "bar"; end
end
```
The original idea was to use `using_refined` instead of `refining` but after discussing with Matz we decided that it's too verbose, and `refining` seems better. But is it good enough? Any thoughts?
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2019-10-05 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16241.20191005190403@ruby-lang.org>
2019-10-05 19:04 ` dementiev.vm [this message]
2019-10-05 22:05 ` [ruby-core:95236] [Ruby master Feature#16241] Shorter syntax for anonymous refinements zverok.offline
2019-10-05 22:40 ` [ruby-core:95237] " shevegen
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.issue-16241.20191005190403.cb988ab09ed1bd2f@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).