Solved

which declaration of x is the correct one for a reference to x

Posted on 2010-11-13
14
876 Views
Last Modified: 2012-05-10
Procedure Main is
X : Integer;
Procedure Sub3;  -- This is a declaration of Sub3
--  It allows Sub1 to Call it
Procedure Sub1 is
X : Integer;
Procedure Sub2 is
      begin    -- of Sub2
      …
      end;          -- of Sub2

begin         -- of Sub1

end;         -- of Sub1
Procedure Sub3 is
begin       -- of Sub3
            …
end;        -- of Sub3      
begin  -- of Main

end;   -- of Main

      Assume that the execution of this program is in the following unit order;

      Main calls Sub1
Sub1 calls Sub2
Sub2 calls Sub3

a.      Assuming static scoping, which declaration of x is the correct one for a reference to x in the following:
i.      Sub1
ii.      Sub2
iii.      Sub3
b.      Repeat part a, but assume dynamic scoping.
0
Comment
Question by:SweetsJamRock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34128588
Someone asked the exact same question here
http://www.experts-exchange.com/Programming/Multimedia_Programming/Q_22554578.html
There is a fairly complete discussion that should answer all your questions.
0
 

Author Comment

by:SweetsJamRock
ID: 34197853
i am closing out this question there is no suitable solution to these question, i have already solved them
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34197909
My post linked to a thread on EE where the exact same question (from the same book obviously) was asked and answered thoroughly. What was it missing that you needed?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:SweetsJamRock
ID: 34202239
Hey TommySzalapski:,

i realized that you object to my removing this question, bro sorry to say but you have not provided the correct solution to none of these question.  I Know it my be your right to do so bro, but i can't award you the point for none of those 2 question.

i will say however; i do appreciate your assistance continually and hope you understand. I am alway generouse with awarding point for my question without reservation. sorry u decided though to object.
Peace bro.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34202255
I am curious what the discussion I linked to was missing? It contained a complete and thorough discussion of your question, including the answer. What else do you need?
0
 

Author Comment

by:SweetsJamRock
ID: 34202273
Tommy,

  I too thought that the link you provided was the same question, however it was not, it was just a similiar question, also what was asked for was also different and result was not based on elimination or recursive but a combination of ALGO and ADA snippet structure.  

0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34202301
From your post
 a.   Assuming static scoping, which declaration of x is the correct one for a reference to x in the following:
i.      Sub1
ii.      Sub2
iii.      Sub3
b.      Repeat part a, but assume dynamic scoping.

From the one I linked
a. Assuming static scoping, which declaration of X is the correct one for a reference
    to X in the following:

i. Sub1
ii. Sub2
iii. Sub3

b. Repeat part a, but assume dynamic scoping.

What's different? Do you just want your points refunded? You abandoned the question for 10 days without giving me a chance to add any information.
What was your solution? EE would prefer that the actual solution exists somewhere in the thread, so please post what the solution actually is and accept that. Moderators?
0
 

Author Comment

by:SweetsJamRock
ID: 34202407
TommySzalapski:,

Bro, i think we are on 2 different pages with this discussion bro,  I did not delete this question, the question that i deleted was the pairwise question.  

As in regards to this question  which is a ADA algorithm even though i had already solved this question also your solution is correct.  I just did not get the time to accept or deny any of the post.  I only started to review all of the post in the this evening.

Just for clarity,  the ADA Snippet is not the question I deleted please check and see the pairwise question
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34202415
Oh okay. I see. You meant to delete the pairwise question. I understand now. Thank you.
0
 

Author Comment

by:SweetsJamRock
ID: 34202427
TommySzalapski:,

 if you want these points what is the solution for part B of the question?
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34202441
The second declaration will be used. I quote
With DYNAMIC SCOPE RULES, bindings depend on the current state of
program execution.  They cannot always be resolved by examining the
program because they are dependent on calling sequences.  To resolve a
reference, we use the most recent, active binding made at run time.
Dynamic scope rules are usually encountered in interpreted languages;
in particular, early LISP dialects assumed dynamic scope rules.  Such
languages do not normally have type checking at compile time because
type determination isn't always possible when dynamic scope rules are
in effect.
0
 

Accepted Solution

by:
SweetsJamRock earned 0 total points
ID: 34202472
this is not LISP but ADA

 Any way the solution for B:

 is as follows

:           i.  sub1
           ii.    sub1
         iii.    sub1
LISP is different from ADA
0
 

Author Closing Comment

by:SweetsJamRock
ID: 34224750
ADA coding is different from LISP.  as programmer even though different languages bears similarities, it does not mean that the syntactical reference and logic  can always apply.  Each language has its own characteristic and uniqueness
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Issue with word wrapping contents of text file in Java 6 430
very simple linked list - stackoverflow errror 6 133
Date base rolling algorithm 8 100
AvlTree-Node Data type 4 47
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every mont…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question