Saturday, 15 September 2012

language agnostic - On referencing environment and scope -



language agnostic - On referencing environment and scope -

if scope "place" variable visible , referencing environment set of variables visible in point in programme there difference between them?

for illustration here said """ converse of scope referencing environment...""" don't understand assertion!

i'd consider term 'converse' misnomer, allow lone contrasting 2 materially different categories, namely (sets of) variables , locations in code access said variable(s) possible. 'complement' might improve choice.

for reason given, yes, there difference.

what reference you're citing probaly intends extol variable/parameter masking. consider variable 'a' declared local procedure. assume part of procedure body block local variable named 'a' declared.

the first variable 'a' part of procedure's (local) referencing environment. scope extends across whole procedure body, apart block own declaration of variable 'a'. in pseudocode (real-world code e.g. c, perl, plsql):

proc xy local a; ... block local a; ... endblock ... endproc

this illustration illustrative purposes only, details have been left out: assumes static scoping, abstracts away other local blocks might define 'a' special mechanisms access 'outer a' (namely perl allows runtime access whole symbol table).

language-agnostic programming-languages

No comments:

Post a Comment