D
dblack
Hi --
That's not a syntax vagary, though. Consider:
class C
x = "y"
attr_accessor x
end
C.new.y = 1
You only get the "inert" identifier behavior with keywords
x = 1
def x # not 1, of course
end
alias old_x x # ditto
attr_accessor is just using normal method-argument syntax/semantics.
David
--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)
Anyhow, here's a couple of examples of things pretty much "standard Ruby"
that I still find confusing coming from other descendants of Algol 60 syntax:
1. attribute_accessorerson
self.person = "Ed"
I really want it to be "attribute_accessor person" -- the constant mixing of
the same name with and without a preceding colon in Ruby is as confusing to
me as Perl's "$hash{'key'}" referring to an entry in "%hash" vs. another
variable entirely called "$hash".
That's not a syntax vagary, though. Consider:
class C
x = "y"
attr_accessor x
end
C.new.y = 1
You only get the "inert" identifier behavior with keywords
x = 1
def x # not 1, of course
end
alias old_x x # ditto
attr_accessor is just using normal method-argument syntax/semantics.
David
--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)