Icon+Unicon/Intro: Difference between revisions

m
Line 25:
Icon and Unicon do not require strict static typing of variables as does languages like [[Pascal]], nor does it require type definitions to reserve space such as in languages such as [[C]]. In fact, variables may happily change type from one moment to the next. Knowing this you might expect that declarations are non-existent.
 
Declarations are optional and any undeclared variables are either (a) parameters to procedures or (b) local to procedures. This design decision ensured that Icon/Unicon are not susceptible to the kind of side-effects that the global nature of variables in [SNOBOL4] led to.
 
Still, declarations are desirable for clarity and needed for a number of special cases:
Line 36:
* procedure - used to define a procedure and its parameters
* invocable - used to control program linking to ensure procedures are included and available if they are called (e.g. through string invocation)
* class - used to define an object class (Unicon)
 
=== Self-Descriptive Safe Types ===
Anonymous user