Enforced immutability: Difference between revisions

Content added Content deleted
(Added 11l)
No edit summary
Line 4: Line 4:
Demonstrate any means your language has to prevent the modification of values, or to create objects that cannot be modified after they have been created.
Demonstrate any means your language has to prevent the modification of values, or to create objects that cannot be modified after they have been created.
<br><br>
<br><br>
=={{header|6502 Assembly}}==
Most assemblers allow you to define labels which can refer to constant values for clarity.
<lang 6502asm>
bit7 equ %10000000
bit6 equ %01000000


lda #$FF
AND #bit7
;accumulator contains #$80</lang>

The CPU isn't aware that these labels exist, however, as the assembler automatically replaces them with the assigned value.
=={{header|68000 Assembly}}==
Most assemblers allow you to define labels which can refer to constant values for clarity.
<lang 68000devpac>
bit7 equ %10000000
bit6 equ %01000000

MOVE.B (A0),D0
AND.B #bit7,D0
;D0.B contains either $00 or $80</lang>

The CPU isn't aware that these labels exist, however, as the assembler automatically replaces them with the assigned value.
=={{header|11l}}==
=={{header|11l}}==