Enforced immutability: Difference between revisions
Content added Content deleted
(Add Scheme macro) |
|||
Line 389: | Line 389: | ||
Note that the <code>CONSTANT:</code> word does nothing to enforce immutability on the object it places on the stack, as it is functionally equivalent to a standard word definition with stack effect <code>( -- obj )</code>. |
Note that the <code>CONSTANT:</code> word does nothing to enforce immutability on the object it places on the stack, as it is functionally equivalent to a standard word definition with stack effect <code>( -- obj )</code>. |
||
=={{header|Forth}}== |
|||
Forth has constant, 2constant and fconstant for creating named constants. This can only be done for global scoped objects, not for function parameters. |
|||
<lang Forth> |
|||
256 constant one-hex-dollar |
|||
s" Hello world" 2constant hello \ "hello" holds the address and length of an anonymous string. |
|||
3.14159265 fconstant pi |
|||
</lang> |
|||
=={{header|Fortran}}== |
=={{header|Fortran}}== |