On Jul 9, 2010, at 6:21 PM, MattB wrote:

> 
>> You shouldn't need to.
> 
> Because... (?)
> 
> (Not being facetious).

Because for all practical purposes they are the same thing.  They aren't of 
course, but only the class itself should know or care about that.

Look at ActiveRecord...  say I've got a Widget class with a title attribute...

W = Widget.new
w.title = "Foo"
puts w.title

*both* the 2nd and 3rd lines are actually methods.  You're not accessing a 
variable of the instance of the class.

Does it matter to you?  No.

In the first case the method is "def title=()" and in the second it's "def 
title()".  Maybe.  Rails probably abstracts even that.  But that's the general 
idea.

-philip


> 
> On Jul 10, 2:11 am, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
>> MattB wrote:
>>>> variable_name
>>>> method_name
>> 
>>> But why?! Since methods don't need (), how are we supposed to
>>> instinctively know what's a method and what isn't when reading someone
>>> elses code? (Or our own when we've forgotten what we wrote!)
>> 
>> You shouldn't need to.  The similarity is deliberate.
>> 
>> (BTW, I would do CONSTANT_NAME, not CONSTANTNAME.)
>> 
>> 
>> 
>>> Matt.
>> 
>>> PS. Anyone play spot the  Ruby Newbie, score 10 points!
>> 
>> --
>> Posted viahttp://www.ruby-forum.com/.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to