Eric Schulte <schulte.e...@gmail.com> writes: Hi Eric,
> Hmmm, this looks suspiciously like the case in some Babel functions :) well ... ;) > in which we originally has instances of the first style and then had to > manually transition to the second. IMO the first is very poor form, the > variables are technically "free variables" when defined in the helper, > and just through undocumented variable capture does the execution work > out correctly, this can lead to unpleasant bugs. > > The means the helper may only be used when variables of certain names > are in scope. > > If you do want to use a helper which uses variables in scope which > aren't passed as arguments (again just my opinion) you should defined > the helper function using `flet' *inside* of the main function and the > scope of the variables. That sounds like an operational prescription to me, and I think will follow this advice in the future. >> Would that be considered bad style from the original author, or is that >> up to personal choice and not considered a problem? >> > > I don't believe we have an official canon of such rules, but personally > I would consider this to be bad style. If the helper function is only > used in one main function then it should be defined using flet, if it is > used across multiple functions then the in-scope variables should be > passed as explicit arguments (preferably with names other than those > which it has in scope so you can be sure you are actually using the > arguments). > > Finally, I believe the emacs-lisp compiler would complain about such > free variables. > > Hope this helps, Best -- Eric yes that helped, thanks cheers -- Thorsten