Autoload
Encyclopedia
In computer programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...

, autoloading is the capability of loading and linking portions of a program from mass storage
Mass storage
In computing, mass storage refers to the storage of large amounts of data in a persisting and machine-readable fashion. Devices and/or systems that have been described as mass storage include tape libraries, RAID systems, hard disk drives, magnetic tape drives, optical disc drives, magneto-optical...

 automatically when needed, so that the programmer is not required to define or include those portions of the program explicitly. Many high level programming languages include autoload capabilities, which sacrifice some run-time speed for ease of coding and speed of initial compilation/linking.

Typical autoload systems intercept procedure calls to undefined subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s. The autoloader searches through a path
Path (computing)
A path, the general form of a filename or of a directory name, specifies a unique location in a file system. A path points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent...

 of directories in the computer's file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

, to find a file containing source
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 or object
Object code
Object code, or sometimes object module, is what a computer compiler produces. In a general sense object code is a sequence of statements in a computer language, usually a machine code language....

 code that defines the subroutine. The autoloader then loads and links the file, and hands control back to the main program so that the subroutine gets executed as if it had already been defined and linked before the call.

Many interactive and high-level languages operate in this way. For example, IDL
IDL
- General :* International Date Line, the time zone date boundary* Intermediate density lipoprotein* John F. Kennedy International Airport, from when it was named "Idlewild Airport" * International Drivers License...

 includes a primitive path searcher, and Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 allows individual modules
Perl module
A Perl module is a discrete component of software for the Perl programming language. Technically, it is a particular set of conventions for using Perl's package mechanism that has become universally adopted....

 to determine how and whether autoloading should occur. The UNIX shell
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...

 may be said to consist almost entirely of an autoloader (program), as its main job is to search a path of directories to load and execute command files. In PHP5, autoload functionality is triggered when referencing an undefined class. One or more autoload functions—implemented as the __autoload magic function or any function registered to the SPL autoload stack—is called and given the opportunity to define the class, usually by loading the file it is defined in.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK