I'm aware of all of this, except the Java part.

But I rather think of something like "private to the scope" is more correct.

And I doubt that the explanation of term "lexical" is ever properly explained or even intuitive.

according to Merriam Webster

Definition of lexical

1 : of or relating to words or the vocabulary of a language as distinguished from its grammar and construction Our language has many lexical borrowings from other languages.

2 : of or relating to a lexicon or to lexicography lexical methods aim to list all the relevant forms— A. F. Parker-Rhodes

But that's not the meaning, IMHO did Larry just adopt it from Lisp.°

There it's called "lexical" in the meaning of "like you read it".

perlglossary also mentions "static scoping" in contrast to "dynamic scoping", but the explanation is still confusing

from perlglossary#lexical...

  • lexical analysis

    Fancy term for tokenizing.

  • lexical scoping

    Looking at your Oxford English Dictionary through a microscope. (Also known as static scoping, because dictionaries don’t change very fast.) Similarly, looking at variables stored in a private dictionary (namespace) for each scope, which are visible only from their point of declaration down to the end of the lexical scope in which they are declared. —Syn. static scoping. —Ant. dynamic scoping.

  • lexical variable

    A variable subject to lexical scoping, declared by my. Often just called a “lexical”. (The our declaration declares a lexically scoped name for a global variable, which is not itself a lexical variable.)

  • But all of this describes only the "scoping" not the nature of my variables - which are hold "in a private dictionary (namespace) for each scope" - sic!

    Maybe clearer from another perspective: local is a way to implement "dynamic scoping", but we wouldn't start calling package vars "dynamic variables", right?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    °) see CommonLISP#lexical_scope


    In reply to Re^4: Qualified package variable access ( s/lexical/private/ ) by LanX
    in thread Qualified package variable access by jerryhone

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.