Scope modifiers: Difference between revisions

Content deleted Content added
Underscore (talk | contribs)
m →‎{{header|C}}: "it's value" → "its value"
No edit summary
Line 133: Line 133:
=={{header|E}}==
=={{header|E}}==
E has no scope modifiers; all variables (including function definitions) are lexical. When more than one file is involved, all import/export of definitions is handled by explicit return values, parameters, or reified environments.
E has no scope modifiers; all variables (including function definitions) are lexical. When more than one file is involved, all import/export of definitions is handled by explicit return values, parameters, or reified environments.


=={{header|Ela}}==

Variables in Ela are lexically scoped (pretty similar to Haskell) and can be declared using let/in and where bindings. Additionally Ela provides a 'private' scope modifier for global bindings:

<lang ela>let private pi = 3.14159

let private sum x y = x + y</lang>

Names declared with 'private' modifier are not visible outside of a module. All other bindings are visible and can be imported. It is an error to use 'private' modifier on local bindings.

=={{header|Go}}==
=={{header|Go}}==
Go is lexically scoped and has just one scope modification feature, exported identifiers. Identifiers&mdash;variables and field names&mdash;are not visible outside of the package in which they are defined unless they begin with an upper case letter, as defined by Unicode class "Lu".
Go is lexically scoped and has just one scope modification feature, exported identifiers. Identifiers&mdash;variables and field names&mdash;are not visible outside of the package in which they are defined unless they begin with an upper case letter, as defined by Unicode class "Lu".



=={{header|Haskell}}==
=={{header|Haskell}}==