From: Tom Sawyer Date: 2003-01-11T03:30:39+09:00 Subject: Re: attr_reader/writer vs. attr_accessor w/ access control On Friday 10 January 2003 10:42 am, Mauricio Fern�ndez wrote: > Then take into account that this goes against matz's word [55201], for > if @var were never to be used, it would not exist in the language and > instance vars. would be class-local by default. > I have to ponder about this some more, but I have the feeling @iv is > needed sometimes. its not that it is not used but only that is solely used within setter and getter methods. in such case they might as well be class local (freeing up more namespace). it works perfectly fine. i've used the principle some, the only reason i am not using it more now is that i am writing a speed sensitive web app and every little bit helps. using @s are a touch faster and more efficient, but that is merely due to the design of Ruby. it is actualy very good code practice NOT to use @ within your code, in this way your code is much more extensible, and types can be truly enforced, etc., etc. -- tom sawyer, aka transami transami@transami.net .''. .''. . *''* :_\/_: . :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'. .''.: /\ : ./)\ ':'* /\ * : '..'. -=:o:=- :_\/_:'.:::. | ' *''* * '.\'/.' _\(/_'.':'.' : /\ : ::::: = *_\/_* -= o =- /)\ ' * '..' ':::' === * /\ * .'/.\'. '._____ * | *..* : |. |' .---"| * | _ .--'| || | _| | * | .-'| __ | | | || | .-----. | |' | || | | | | | || | ___' ' /"\ | '-."". '-' '-.' '` |_. ------------------------------------------------------------