A value belongs to the declaration of its type that it was made under, which
it carries with it. After the declaration changes, when a package is updated
or a type is declared again at the console, a value made before, such as one
read from a file, can be looked at. It prints, gives its fields, and is refused
where it is used: as a field or an argument, in a method call, and in an assignment,
comparison, hash, or document. r8update() gives its value under the
registered declaration where its fields mean the same under both, validated.
Value
The value or the list, in which every R8 value is of the registered
declaration of its type; x itself when each is. A value whose fields may
mean something else raises r8_other_declaration_error.
Details
The fields mean the same when each is declared under the same name, as the same kind of type, in the same unit, and with its factor levels in the same order, and every field that the registered declaration adds is optional or has a default, which it takes. A change of bounds, of rules, or of the order of fields, and a factor level that is added or removed, do not change the meaning; a value that the registered declaration does not admit is an error that lists its problems. A value of another version of its type is refused, since raising a version states that the meaning changed. The values that the fields hold are converted in the same way.
A type whose values Rust holds (storage = "rust") reads a value from a file
under the declaration it was saved with; such a value is made again from its
source.
Examples
op <- options(r8.namespace = "demo")
Visit <- new_struct("Visit", fields = list(age = type_integer()))
v <- Visit(age = 40L)
Visit <- new_struct("Visit", fields = list(
age = type_integer(min = 0L),
site = option(type_character())
))
try(r8to_json(v))#> Error : Cannot write `demo::Visit`: 1 problem
#> - The value must be a value of `demo::Visit`, found one made under another declaration of `demo::Visit` than the registered one: `age` was integer, and is integer [0, Inf); `site` was added as an optional field; r8update() gives its value under the registered one. [declaration_changed]r8update(v)#> <demo::Visit>
#> age: 40
#> site: NULLoptions(op)