по Donaldo Cruz 3 лет назад
332
Больше похоже на это
Tuples
F#
ML
Most languages
Ruby
Python
Ada
C
Functions can possibly cause side effects and aliasing
No side effects from parameters or aliasing of parameters/globals
Modern versions are written as subprograms
Not the same as methods.
First programmable computer used via reusable cards
Mathematic equation
Can change outside parameters
Formal Parameter attached to Actual Parameter in Subprogram call
Actual parameters which take the values of their corresponding formal parameter in order
Parameters initialized within subprogram
Ones in function call, exist only while the subprogram is called
Specifies return value
Specifies subprogram variety
Names parameters
Chooses call name
Considered active during call
Request subprogram execution
Describes interface
Nested Subprogram
Subprogram which can be used with any input type
Same name for multiple subprograms
If no type info included, assume generic
is a wildcard type
Typename Identifier
Class Identifier
Able to use different parameters per call instance
The type of an object can be derived from T
Ad Hoc Binding
The environment of the call statement that passed the subprogram as an actual parameter
Deep Binding
The environment of the definition of the passed subprogram
Shallow Binding
The environment of the call statement that enacts the passed subprogram
The actual parameter is textually substituted for the corresponding formal parameter in all its occurrences in the subprogram
transmits an access path (an address) to the called subprogram
Combination between pass-by-value and pass-by-result
(For inout-mode parameters) Actual values are copied
(For out-mode parameters) No value is transmitted to the subprogram
Value of actual parameter is used to initialize the corresponding former parameter
Receive and transmit data from and to the parameter
Transmit data to actual parameter
Receive data from the corresponding actual parameter
Bound to storage at start of execution(of subprogram) and unbound when execution terminates
Require no run-time overhead for allocation and deallocation