Yeah we can move the experts out of the function, because it is a constant, and we should validate the input, but it is just a small example, so I took it easy. Thank for your suggestion.
It may be a little confusing to beginners if the only example given is one where there's no advantage to using a closure (the information-hiding aspect would be better served with a module). Maybe you could expand the article or write a sequel, with a second example that shows off the power and usefulness of closures as a feature.
I am writing the next one, it will be more detailed and it will go with practical examples in real life project and open source. Thank for your suggestion
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah we can move the
experts
out of the function, because it is aconstant
, and we should validate the input, but it is just a small example, so I took it easy. Thank for your suggestion.It may be a little confusing to beginners if the only example given is one where there's no advantage to using a closure (the information-hiding aspect would be better served with a module). Maybe you could expand the article or write a sequel, with a second example that shows off the power and usefulness of closures as a feature.
I am writing the next one, it will be more detailed and it will go with practical examples in real life project and open source. Thank for your suggestion