15.6.2.1909.40 NAME>STRING name-to-string TOOLS EXT
NAME>STRING returns the name of the word nt in the character string c-addr u. The case of the characters in the string is implementation-dependent. The buffer containing c-addr u may be transient and valid until the next invocation of NAME>STRING. A program shall not write into the buffer containing the resulting string.
See:
ContributeContributions
ruv
[374] `NAME>STRING` result is transientRequest for clarification2025-01-22 16:50:21
15.6.2.1909.40 NAME>STRING says:
The buffer containing c-addr u may be transient and valid until the next invocation of
NAME>STRING.
What is the point of allowing the returned string to be in a transient buffer? Which implementation approach benefits from that?
In typical implementations, the lifetime of the returned string is the same as the lifetime of nt.
EkkehardSkirl
[423] The buffer containing c-addr u may be transient and valid until the next invocation of NAME>STRINGRequest for clarification2026-02-09 11:33:18
(1) Being transient until the next call to 'NAME>STRING' necessitates that this word requires its own transient space and cannot use the transient spaces of other words or a central transient space while, for example, a word search is running " (see also (3)(a)). So more precise may be "... and is valid ...".
(2) Not being transient leads to duplicate longtime storage of the same information in cases where the name is stored in a system-specific way other than returned.
(3) What is the purpose of this word? To retrieve the name of a compiled word. But for what purpose? Since the name of a word only plays a role in interpretation and is then only implicitly stored as 'xt', I currently find only two reasons:
(3a) Word searches during interpretation or compilation, especially in systems that use a different form of name storage.
(3b) Debugging or recompiling a word.
However, neither of these necessitates storing the name string non-transiently as long as NAME>STRING uses its own transient area.
(4) The standard does not impose a transient storage area on any system, because it states "The buffer containing c-addr u may be ...".