Hi Mark, The article is good. However, there's still some grey areas.
The documentation for base::typeof equates a closure with a function. However, the article defines a closure as a function together with an environment. A very minor difference I know, but it creates the problem that the word closure is used inconsistently. And that's without even getting into "frames". Equating a closure with a function (only), is perhaps misleading...??? Also, re-iterating I use function objects with attributes. (I prefer this approach, because I can make copies of function objects, and if necessary modify them). My guess is that doesn't meet the definition of an R closure (if you ignore the environment)...???, and it's unclear whether it meets the definition of a closure, more generally...??? So, I've still got the same problem, of how to refer to functions that have *either* attributes *or* environments, containing data. Maybe I should just stick to "Self-Referencing Function Objects" and "Functions Bundled with Data"...??? One last thing, the last time I read S4 documentation, I couldn't tell if it was possible to have S4-based function objects, and if so, could the body of the S4-based function object (while being called) access it's own slots...??? On Sun, May 3, 2020 at 4:27 PM Mark Leeds <marklee...@gmail.com> wrote: > > Abby: Here is an article on environments/closures which might be useful to > you. I was reviewing environments recently and it > was a clear explanation of how environments/closures work in R. Even though > it's from 2000, I'm pretty certain that everything > said in it still holds. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.