Scope modifiers: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added comment about names of subroutines. -- ~~~~) |
|||
Line 167: | Line 167: | ||
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: |
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> |
<lang ela> |
||
pi # private |
|||
pi = 3.14159 |
|||
sum # 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. |
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. |