dcsimg
Main » TERM » D »

Dynamic Scope Definition & Meaning

Dynamic scope in programming mentions and defines variables depending on how recently that variable was called. Dynamic scope is a rarity in programming; static, or lexical, scoping is the norm. Static scope, the area in which a variable has a certain value, depends on the logical structure and organization of the program. For example, if a variable x = 5 in a given function, and a subsequent conditional definition for x is also provided, x = 5 wherever the program's scope defines it as such. This is standard for most programming languages.

In contrast, dynamic scope would use the most recent definition of x that had been called, even if it did not make lexical sense. The last value of x that was assigned in the program's run time would then belong to the variable. The program pulls the most recent variable definition from the call stack, which is a compiled list of the most recent functions in the program.

An important note about scope: it can also refer to the way variables are used within the program, not just the local area in which they exist. Because scope indicates the area covered, not the action performed, it is not the most accurate term. But developers understand it to mean also the definition and usage of the variable.










LATEST ARTICLES
Texting & Chat Abbreviations

From A3 to ZZZ we list 1,559 text message and online chat abbreviations to help you translate and understand today's texting lingo. Includes Top... Read More »

Huge List of Computer Certifications

Have you heard about a computer certification program but can't figure out if it's right for you? Use this handy list to help you decide. Read More »

STUDY GUIDES
Computer Architecture Study Guide

Computer architecture provides an introduction to system design basics for most computer science students. Read More »

Network Fundamentals Study Guide

Networking fundamentals teaches the building blocks of modern network design. Learn different types of networks, concepts, architecture and... Read More »

The Five Generations of Computers

Learn about each of the five generations of computers and major technology developments that have led to the computing devices that we use... Read More »