4 ms·
from all the code i've seen javascript developers have more troubles with explicit "this" and bindings than ruby developers have with implicit self.
by keymone 10y ago
from all the code i've seen javascript developers have more troubles with explicit "this" and bindings than ruby developers have with implicit self.
- dagw 10y agoJavascript 'this' binding behaves in quite unexpected ways if you're coming from something like python on ruby, which is a major source of trouble for people.
- masklinn 10y agoDo people really use implicit selfs in ruby? Note that @foo is not an implicit self.
- pmontra 10y agoself.attribute = attribute in an ActiveRecord class when the left side is a field of a table and the right side is a variable. A different name for the variable fixes it without using self.
- masklinn 10y ago> self.attribute = attribute in an ActiveRecord class when the left side is a field of a table and the right side is a variable That seems to be an example of not using an implicit self. > A different name for the variable fixes it There's nothing to fix, it works just fine.
- matthewmacleod 10y agoLiterally all the time. In fact, our coding style demands that we avoid using instance variables in preference of adding `attr_accessor` to explicitly encourage the use of implicit self.
- keymone 10y agoevery time you call a method without explicit receiver you're using implicit self