Enforced immutability: Difference between revisions
Content added Content deleted
Jazzedpineda (talk | contribs) (Omitted EasyLang) |
(→{{header|Wren}}: Added a supplementary entry) |
||
Line 1,365: | Line 1,365: | ||
6 |
6 |
||
8 |
8 |
||
</pre> |
|||
{{libheader|Wren-trait}} |
|||
Since the above entry was written, a ''Const'' class has been added to ''Wren-trait'' which simulates constants to some extent though the values used need themselves to be immutable for this to be water-tight. |
|||
=={{header|Wren}}== |
|||
<syntaxhighlight lang="ecmascript">import "./trait" for Const |
|||
Const["six"] = 6 |
|||
Const["eight"] = 8 |
|||
Const["six"] = 7 // ignored, still 6 |
|||
System.print(Const.entries)</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
[eight:8, six:6] |
|||
</pre> |
</pre> |
||