miscon:programming.objects.constant-reference-is-immutable · draft · trust low · v0.1.1 · kind overgeneralization

A constant reference means an unchangeable object

Declaring an object variable final or const makes the object it refers to unchangeable, so its fields or elements cannot be modified.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.objects.constant-reference-is-immutable
UUID
371c613b-da3c-49d9-917e-3758758a1a81
Domain
programming.objects
Level band
secondary, undergraduate
Locale
en
About
https://open-misconceptions.github.io/miscon-data/c/programming.objects.immutability (Miscon)

Evidence patterns

Pattern 0: predict a mutation through a final/const reference

predicts an error

Itemconst items = [1, 2]; items.push(3); console.log(items);
Expected[1, 2, 3]
ResponseTypeError (or 'not allowed')

Discriminators

vs a slip. Consistent across items and the learner says const 'freezes' the value. A slip is a single wrong prediction.

Relations

conflicts_with
A constant reference does not make the referenced object immutable (external)
resolved_by
A constant reference does not make the referenced object immutable (external)
An object variable holds a reference; assignment copies the reference (external)

Alignments

Provenance

Origin: llm-drafted

  1. Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386. doi:10.1145/3430665.3456343
    Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently.

Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.

Review status

Status draft, trust low (computed from the reviews below against the reviewer registry).

No reviews yet.

Formats

Cite

miscon:programming.objects.constant-reference-is-immutable
https://open-misconceptions.github.io/miscon-data/m/programming.objects.constant-reference-is-immutable