value_text() of a term value prints a session-local allocation id (term#16) instead of the expression

Open
#366 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Start by tracing value_text() for term-kind values and the related value formatting code; the issue does not name source files or tests. Compare its output with format(value_term(value)) and inspect the term representation to find where the allocation id is used. Done means equivalent terms render as their expressions across sessions and allocation orders, with format() and print() showing that text.

Written by the indexing model from the issue text.

Description

area/api-bindings good first issue help wanted kind/contract severity/4-minor

value_text() of a term-kind value returns a session-local allocation id such as "term#16" instead of the expression, so the same mathematical value prints differently depending on what was allocated before it.

library(rssn)
a <- rssn_session(); b <- rssn_session()
invisible(sym("q1", a)); invisible(sym("q2", a)); invisible(sym("q3", a))  # allocation history only
va <- value_new(parse_term("x^2 + 1", a), a)
vb <- value_new(parse_term("x^2 + 1", b), b)
value_text(va)          # "term#16"
value_text(vb)          # "term#13"   same expression, different text
format(value_term(va))  # "x^2 + 1"   the expression is available
format(value_term(vb))  # "x^2 + 1"
print(va)               # <rssn value> term: term#16

value_json() confirms the id is a raw node number, and it carries a process-local session number too:

{"term":{"session":1,"node":16}}   # session a
{"term":{"session":2,"node":13}}   # session b

value_text() is the generic string reader, and format()/print() are built on it, so a term value displays as term#16 rather than as its expression. The expression is available (value_term() returns a term that formats as x^2 + 1), and the other value kinds all render their content in value_text() ("1.5", "true", {a: 1, b: "x"}), so a term value rendering as an allocation counter is inconsistent with the rest of the ABI and is not stable across sessions or across allocation order.

rssn 0.3.0, R 4.6.2 binding, Windows x86_64.

Dominant language
Rust
Stars
36
Forks
3
Avg merge
14h 51m
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Apich-Organization/rssn

All issues in Apich-Organization/rssn

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.