|
|
|
|
|
by mojuba
6247 days ago
|
|
In the example you showed I'd probably do the same, true, but I think there is no evil in passing widget as an argument. In general, there's nothing wrong with functions that take everything they use as arguments. This is kind of functional programming (or a good part of it): every function is as independent as possible, which makes them easier to debug, easier to understand, and safer in terms of bugs. Functions that deal with data from outer scopes risk being less readable and less reliable. |
|