Scope/Function names and labels: Difference between revisions

Line 119:
If you are trying to figure out what happened, you now understand goto.
</pre>
 
=={{header|Eiffel}}==
 
Functions (routines which return a result), procedures (routines which have no result) and variables are considered features of a class and follow the same visibility rules. Eiffel allows for information hiding, where features can be selectively hidden from particular classes.
 
All features are assigned (at compile-time) to a particular scope defined by the most-recently preceding feature clause. Various feature clauses are given below, from least restrictive (most visible) to most restrictive (most hidden).
<lang Eiffel>--assume A, B and C to be valid classes
class X
feature -- alias for "feature {ANY}"
-- ANY is the class at the top of the class hierarchy and all classes inherit from it
-- features following this clause are given "global" scope: these features are visible to every class
 
feature {A, B, C, X}
-- features following this clause are only visible to the specified classes (and their descendants)
-- classes not in this set do not even know of the existence of these features
 
feature {A, B, C}
-- similar to above, except other instances of X cannot access these features
 
feature {X}
-- features following this clause are only visible to instances of X (and its descendants)
 
feature {NONE}
-- NONE is the class at the bottom of the class hierarchy and inherits from every class
-- features following this clause are only visible to this particular instance of X
 
end</lang>
 
 
=={{header|Erlang}}==
41

edits