internal/core/adt: support interpolation of bytes and bool

Also fixes bytes interpolation, which was still WIP.

For bool: use JSON representation

For bytes: assume bytes are UTF-8 and replace illegal characters according to the recommendations of the Unicode consortium and W3C requirement for character encodings. (So not the Go standard for replacement.)

Details clarified in spec.

Fixes #475.

Change-Id: I94c068f8a73a3948194b179a33e556c37692c05f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6951
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
diff --git a/doc/ref/spec.md b/doc/ref/spec.md
index 11712e2..f7f0326 100644
--- a/doc/ref/spec.md
+++ b/doc/ref/spec.md
@@ -2609,8 +2609,21 @@
 String interpolation may be used in single- and double-quoted strings, as well
 as their multiline equivalent.
 
-A placeholder consists of "\(" followed by an expression and a ")". The
-expression is evaluated within the scope within which the string is defined.
+A placeholder consists of "\(" followed by an expression and a ")".
+The expression is evaluated in the scope within which the string is defined.
+
+The result of the expression is substituted as follows:
+- string: as is
+- bool: the JSON representation of the bool
+- number: a JSON representation of the number that preserves the
+precision of the underlying binary coded decimal
+- bytes: as if substituted within single quotes or
+converted to valid UTF-8 replacing the
+maximal subpart of ill-formed subsequences with a single
+replacement character (W3C encoding standard) otherwise
+- list: illegal
+- struct: illegal
+
 
 ```
 a: "World"