Why Sponsor Oils? | source | all docs for version 0.22.0 | all versions | oilshell.org
Oils Reference — Chapter Errors
This chapter describes errors for data languages. An error checklist is often a nice, concise way to describe a language.
Related: Oils Error Catalog, With Hints describes errors in code.
(in progress)
J8 Notation is built on UTF-8, so let's summarize UTF-8 errors.
Oils stores strings as UTF-8 in memory, so it doesn't encode UTF-8 often.
But it may have a function to encode UTF-8 from a List[Int]. These errors
would be handled:
A UTF-8 decoder should handle these errors:
42 as
042, 0042, 00042, etc. This is not allowed.J8 strings extend JSON strings, and are a primary building block of J8 Notation.
J8 strings can represent any string — bytes or unicode — so there are no encoding errors.
\u{dc00} should not be in the surrogate range.
\yff should be used instead.\u{110000} is greater than the maximimum Unicode code
point.\yff should not be in u'' string.
b'' strings.Roughly speaking, J8 Lines are an encoding for a stream of J8 strings. In
YSH, it's used by @(split command sub).
Like J8 strings, J8 Lines have no encoding errors by design.
"mystr" extra.JSON encoding has these errors:
Str List Dict are Oils objects can be serialized, but
Eggex Func Range can't.null like JavaScript.Note that invalid UTF-8 bytes like 0xfe produce a Unicode replacement
character, not a hard error.
"abc\n").+"\z" or a truncated escape "\u1"u''}{42] or {}]JSON8 has the same encoding errors as JSON.
However, the encoding is lossless by design. Instead of invalid UTF-8 being
turned into a Unicode replacment character, it can use J8 strings with byte
escapes like b'byte \yfe\yff'.
JSON8 has the same decoding errors as JSON, plus J8 string decoding errors.
See err-j8-str-decode.