You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by sebb <se...@gmail.com> on 2017/06/18 18:41:04 UTC
Use of @var rather than @@var at class level
There are several classes that define @var instance variables at class level.
For example:
https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/svn.rb#L12
This defines
@semaphore = Mutex.new
in the body of the class.
I would expect to see a class variable at this point, i.e.
@@semaphore = Mutex.new
This is done later for a different variable:
https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/svn.rb#L17
What is the reason for using instance variables here?
AFAICT in this case the class is only expected to be used as a singleton.
It could/should be a Module instead?