[Rails-core] Is it a sane idea to add to_an? as an alias to to_a?

2018-04-19 Thread Artur Martsinkovskyi
As far as I am concerned, Rails try to be as clear and readable as possible 
in the means of DSL practices. They give the developer all tools for his 
code to be read like English. We even have aliases like "days" and 
"minutes" to "day" and "minute" to make forms like 5.days to be read more 
naturally. 
Writing something like "is_a? Integer" doesn't sound really euphonic to my 
ear and mind. "is_an? Integer" sounds much better. 

Is it OK to submit such a pull request as a part of ActiveSupport core 
extensions?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails-core] Is it a sane idea to add to_an? as an alias to to_a?

2018-04-19 Thread Rafael Mendonça França
Ruby used to have `exists?` and `exist?`. The former was deprecatted even that 
in some care it is more natual to read.

I’d follow the same rule here. I believe consistence is more important than 
readability in this case. It make code easier to search, since you only need to 
search for `is_a?` and not `is_an?` and it doesn’t introdoce the overhead of 
having to change which method you use when you rename the constant.

Rafael França

On Apr 19, 2018, 15:51 -0400, Artur Martsinkovskyi , 
wrote:
> As far as I am concerned, Rails try to be as clear and readable as possible 
> in the means of DSL practices. They give the developer all tools for his code 
> to be read like English. We even have aliases like "days" and "minutes" to 
> "day" and "minute" to make forms like 5.days to be read more naturally.
> Writing something like "is_a? Integer" doesn't sound really euphonic to my 
> ear and mind. "is_an? Integer" sounds much better.
>
> Is it OK to submit such a pull request as a part of ActiveSupport core 
> extensions?
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.