Enforced immutability: Difference between revisions

Content added Content deleted
(Added Quackery.)
m (Moved Quackery entry into alphabetic order.)
Line 936: Line 936:
TypeError: 'Immut' object does not support item assignment
TypeError: 'Immut' object does not support item assignment
>>></syntaxhighlight>
>>></syntaxhighlight>

=={{header|Quackery}}==

Quackery does not enforce immutability. The majority of Quackery is immutable by design; operators and numbers are immutable, and nests are immutable insomuch as the words in the nest editing wordset treat them as immutable.

Certain objects; the ancillary stacks, the system dictionaries, and tables are mutable of necessity, and have a specific set of words, the ancillary stacks wordset, dedicated to handling them. The words in this wordset can also be applied to nests if the programmer chooses to disregard the guidelines for their use provided in The Book of Quackery. In short, enforcement is eschewed in favour of relying on the programmer's good sense.


=={{header|Racket}}==
=={{header|Racket}}==
Line 948: Line 954:
<syntaxhighlight lang="racket">(struct coordinate (x y)) ; immutable struct</syntaxhighlight>
<syntaxhighlight lang="racket">(struct coordinate (x y)) ; immutable struct</syntaxhighlight>
mutable struct definitions need to explicitly use a <tt>#:mutable</tt>, keyword next to a field to specify it as mutable, or as an option to the whole struct to make all fields mutable.
mutable struct definitions need to explicitly use a <tt>#:mutable</tt>, keyword next to a field to specify it as mutable, or as an option to the whole struct to make all fields mutable.

=={{header|Quackery}}==

Quackery does not enforce immutability. The majority of Quackery is immutable by design; operators and numbers are immutable, and nests are immutable insomuch as the words in the nest editing wordset treat them as immutable.

Certain objects; the ancillary stacks, the system dictionaries, and tables are mutable of necessity, and have a specific set of words, the ancillary stacks wordset, dedicated to handling them. The words in this wordset can also be applied to nests if the programmer chooses to disregard the guidelines for their use provided in The Book of Quackery. In short, enforcement is eschewed in favour of relying on the programmer's good sense.


=={{header|Raku}}==
=={{header|Raku}}==