Skip to content

TSLANG_ISSUES 17: a store to an indexed Ref<T> names Deref(p[i]) = value - #573

Merged
ASDAlexander77 merged 1 commit into
mainfrom
ref-index-store-error
Oct 13, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
ref-index-store-error

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG_ISSUES.md 17: storing through Ref<u8> indexing (bytes[i] = x) said "saving to constant object".

bytes[i] of a Ref<T> is the element's reference, as a read gives it (Deref(bytes[i])). So the store has nothing to store to, and Deref(bytes[i]) = value already works. The error now names that form:

store.ts:8:5: error: indexing a 'Ref<T>' gives a reference to the element; store through it with 'Deref(p[i]) = value'

Decision to confirm: this keeps p[i] meaning the reference for reads and writes. The alternative, making p[i] = v store the element as in C, would give p[i] different meanings on each side of =.

Test: test-compile-ref-index-store (error text + location).

Full Release suite with all six TSLANG_ISSUES fixes together: 4074/4074.

🤖 Generated with Claude Code

`bytes[i]` of a `Ref<u8>` is the element's reference, as a read gives it
(`Deref(bytes[i])`), so `bytes[i] = 65` has nothing to store to and
reported "saving to constant object". It now says to store through the
reference: `Deref(bytes[i]) = value`, which works.

Found writing a std::string's characters into a tuple's bytes
(TSLANG_ISSUES.md 17).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 368ebbb into main Oct 13, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the ref-index-store-error branch October 13, 2026 17:08
ASDAlexander77 added a commit that referenced this pull request Oct 13, 2026
13, 14, 15 and 18 are fixed by #572, #568, #570 and #569. For 16, `%` is
fixed by #571 and `/` stays a number. 17 is answered (`Deref(p[i]) = v`
stores) and its error names that form since #573. 5 and 6 stay open:
they are design questions, not bugs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant