Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Scope (computer science)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Module scope === The scope of a name binding is a module, which is known as '''module scope'''. Module scope is available in [[Modular programming|modular programming languages]] where modules (which may span various files) are the basic unit of a complex program, as they allow [[information hiding]] and exposing a limited interface. Module scope was pioneered in the [[Modula]] family of languages, and Python (which was influenced by Modula) is a representative contemporary example. In some [[object-oriented programming]] languages that lack direct support for modules, such as C++ before C++20,<ref>{{cite web|url=https://isocpp.org/files/papers/n4720.pdf|title=N4720: Working Draft, Extensions to C++ for Modules|publisher=|access-date=2019-04-30|archive-date=2019-04-30|archive-url=https://web.archive.org/web/20190430095053/https://isocpp.org/files/papers/n4720.pdf|url-status=live}}</ref> a similar structure is instead provided by the class hierarchy, where classes are the basic unit of the program, and a class can have private methods. This is properly understood in the context of [[dynamic dispatch]] rather than name resolution and scope, though they often play analogous roles. In some cases both these facilities are available, such as in Python, which has both modules and classes, and code organization (as a module-level function or a conventionally private method) is a choice of the programmer.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)