Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:04:22+00:00 2026-06-02T19:04:22+00:00

One criticism of using the static chain to access nonlocal variables is that references

  • 0

One criticism of using the static chain to access nonlocal variables is that
references to variables in scopes beyond the static parent cost more than references
to locals. The static chain must be followed, one link per enclosing scope from the reference to the declaration. Fortunately, in practice, references to
distant nonlocal variables are rare, so this is not a serious problem. Another
criticism of the static-chain approach is that it is difficult for a programmer
working on a time-critical program to estimate the costs of nonlocal references,
because the cost of each reference depends on the depth of nesting between the
reference and the scope of declaration. Further complicating this problem is
that subsequent code modifications may change nesting depths, thereby changing
the timing of some references, both in the changed code and possibly in
code far from the changes.

Are there any more potential problems with this approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:04:23+00:00Added an answer on June 2, 2026 at 7:04 pm

    Excluded two problems are:
    A nonlocal reference is slow if the number of scopes between the reference and the declaration of the referenced variable is large. Time-critical code is difficult, because the costs of nonlocal references are not equal, and can change with code upgrades and fixes.

    However, the static chain must be modified for each subprogram call and return. The action required at a subprogram call is complex. Although the correct parent scope is easily determined at compile time, the most recent activation record instance of the parent scope must be found at the time of the call. The long walk through the static chain would be an overhead. Some alternatives to static chains have been developed, most notably an approach that uses an auxiliary data structure called a display (Static chain is better, unless the display can be kept in registers). However, none of the alternatives has been found to be superior to the static-chain method, which is still the most widely, used approach. Also, deep access which also superior in dynamic scoping acts in a similar way in creating the dynamic link.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of the first things I learned in C++ was that #include <iostream> int
One thing that bothers me about nHibernate is that it is not 100% compile
One of the libraries we are using for our product uses a singleton for
One of the arguments I've heard about blueprint css is that it lets you
One of Googles Let's make the internet faster talks included something about using echo
I need to do a LINQ2DataSet query that does a join on more than
I'm interested in using dynamic (as opposed to lexical) scoped variables in Ruby. It's
Lately, I've decided to start using Perl::Critic more often on my code. After programming
One of the reasons that I tend to dread writing Javascript for anything other
One of the most awesome features of Netbeans is to generate code using some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.