From: nahi <nakahiro@gmail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:43439] [ruby-trunk - Feature #4475][Assigned] default variable name for parameter
Date: Sun, 18 Mar 2012 19:05:34 +0900 [thread overview]
Message-ID: <redmine.journal-24906.20120318190534@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-4475.20110306224849@ruby-lang.org
Issue #4475 has been updated by nahi.
Description updated
Category set to core
Status changed from Open to Assigned
Assignee set to matz
----------------------------------------
Feature #4475: default variable name for parameter
https://bugs.ruby-lang.org/issues/4475#change-24906
Author: jordi
Status: Assigned
Priority: Normal
Assignee: matz
Category: core
Target version:
=begin
There is a very common pattern in Ruby:
object.method do |variable_name|
variable_name doing something
end
Many times in fact the name of the object is so self explanatory that we don't care about the name of the variable of the block. It is common to see things like :
@my_sons.each { |s| s.sell_to_someone }
or
Account.all.each { |a| my_account << a.money }
People tend to choose s or a because we have the class or the object name just there to remind you about the context.
I would like to know if can be a good idea to have a default name for that parameter. I think it is Groovy that does something like:
Account.all.each { my_account << it.money }
Where it is automagically filled and it doesn't need to be declared.
I think it is as readable or more (for newbies who don't know what is ||) and we save some typing :)
=end
--
http://bugs.ruby-lang.org/
next parent reply other threads:[~2012-03-18 10:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-4475.20110306224849@ruby-lang.org>
2012-03-18 10:05 ` nahi [this message]
2012-11-20 12:26 ` [ruby-core:49705] [ruby-trunk - Feature #4475] default variable name for parameter mame (Yusuke Endoh)
2018-04-19 7:51 ` [ruby-core:86598] [Ruby trunk Feature#4475] " knu
2018-04-19 11:42 ` [ruby-core:86607] " matz
2018-09-13 5:44 ` [ruby-core:88969] " niinikazuki
2018-11-06 14:15 ` [ruby-core:89723] " shevegen
2018-11-06 14:33 ` [ruby-core:89724] " hanmac
2019-01-19 5:58 ` [ruby-core:91171] " merch-redmine
2019-02-07 7:35 ` [ruby-core:91458] " matz
2019-02-07 12:48 ` [ruby-core:91470] " Ale Miralles
2019-02-07 12:55 ` [ruby-core:91471] " Ale Miralles
2019-02-08 16:35 ` [ruby-core:91497] " janfri26
2019-02-08 16:55 ` [ruby-core:91498] " merch-redmine
2019-03-11 4:47 ` [ruby-core:91743] " matz
2019-03-11 14:36 ` [ruby-core:91785] " nobu
2019-03-18 11:42 ` [ruby-core:91865] " shevegen
2019-03-18 15:43 ` [ruby-core:91868] " richard.schneeman+ruby-lang
2019-03-18 17:12 ` [ruby-core:91870] " bozhidar
2019-03-18 22:48 ` [ruby-core:91878] " gray.kemmey
2019-03-22 0:19 ` [ruby-core:91919] " harlemsquirrel
2019-03-22 0:31 ` [ruby-core:91920] " duerst
2019-03-22 6:56 ` [ruby-core:91923] " pascal.betz
2019-03-22 13:11 ` [ruby-core:91932] " mail
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-24906.20120318190534@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).