[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Why nil
From: Ryan Davis <ryand-ruby () zenspider ! com>
Date: 2018-07-09 19:39:24
Message-ID: 2D30BB4C-22B1-499C-B9A8-C723EB79999B () zenspider ! com
[Download RAW message or body]
> On Jul 5, 2018, at 00:21, Andy Jones <Andy.Jones@jameshall.co.uk> wrote:
>
> But as already noted, you are forced to use @var = 1 and not var = 1 inside the \
> class. I agree it might be nice to abstract out attributes to their getters and \
> setters inside the class, but since you can only do it for getters, the value of \
> that is limited.
That is decidedly false: `self.var = 1`. The ONLY place you're "forced" to use an \
ivar, is in the implementation of a custom setter:
def var= o
@var = calculate o
end
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic