[R] static vs. lexical scope

Martin Møller Skarbiniks Pedersen tr@xp|@yer @end|ng |rom gm@||@com
Thu Sep 26 13:55:26 CEST 2019


On Wed, 25 Sep 2019 at 11:03, Francesco Ariis <fa-ml using ariis.it> wrote:
>
> Dear R users/developers,
> while ploughing through "An Introduction to R" [1], I found the
> expression "static scope" (in contraposition to "lexical scope").
>
> I was a bit puzzled by the difference (since e.g. Wikipedia conflates the
> two) until I found this document [2].


I sometimes teach a little R, and they might ask about static/lexical scope.
My short answer is normally that S uses static scoping and R uses
lexical scoping.
And most all modern languages uses lexical scoping.
So if they know Java, C, C# etc. then the scoping rules for R are the same.

I finally says that it is not a full answer but enough for most.

Regards
Martin



More information about the R-help mailing list