]> Lady’s Gitweb - Sutra/blob - xsd/README.markdown
Initial commit
[Sutra] / xsd / README.markdown
1 # ♓️🪡 सूत्र ∷ X·S·D
2
3 ♓️🪡 सूत्र ∷ X·S·D provides an implementation of the
4 [X·M·L Schema Definition Language][XSD-1], including the
5 [X·M·L Schema Definition Datatypes][XSD-2], for Ecmascript.
6
7 ## Notes
8
9 ### Typechecking
10
11 All of the functions provided by `./functions.js` will throw an error
12 if they are given arguments which do not match the expectations
13 established by the X·S·D spec. No type coersion occurs.
14
15 ### Efficiency
16
17 ♓️🪡 सूत्र ∷ X·S·D emphasizes algorithm correctness and takes a somewhat
18 extreme stance with regards to spec adherence. This means that the
19 algorithms used may be somewhat slow, although native platform features
20 will be leveraged when possible.
21
22 ### Numeric values
23
24 ♓️🪡 सूत्र ∷ X·S·D treats all numeric values as native Ecmascript
25 numbers. This may lead to rounding errors for decimals and extreme
26 values.
27
28 This behaviour may change in the future; see
29 <https://github.com/tc39/proposal-decimal> for progress on getting a
30 more precise decimal type into Ecmascript.
31
32 ### Positive and Negative Zero
33
34 X·S·D only formally distinguishes positive and negative zero for floats
35 and doubles, but it allows them to be represented lexically in all
36 other signed numeric types. ♓️🪡 सूत्र ∷ X·S·D silently coerces negative
37 zero to positive zero for numeric datatypes in which it is not an
38 explicit part of the value space, as well as for numeric components of
39 other datatypes (e·g durations).
40
41 ### Date∕times and Durations
42
43 ♓️🪡 सूत्र ∷ X·S·D does not provide actual classes for X·S·D
44 date/timeSevenPropertyModel values or durations, treatings both as
45 simple objects. This approach was taken to maximize compatibility with
46 other modules. Formally :—
47
48 1. A duration is any object for which getting the `months` property
49 returns an integer, getting the `seconds` property returns a finite
50 number, and these two values have the same sign. (Positive and
51 negative zero are treated as having the same sign for this
52 comparison.)
53
54 Note that `months` and `seconds` **must not** be undefined.
55
56 2. A date/timeSevenPropertyModel value is any object for which getting
57 the `year`, `month`, `day`, `hour`, `minute`, `second`, and
58 `timezoneOffset` properties returns values within the bounds
59 specified in the X·S·D specification. Absent values can be
60 represented with undefined, and need not actually be defined on the
61 object).
62
63 Functions which return durations or date/timeSevenPropertyModel values
64 will always return a plain, extensible object which :—
65
66 - Inherits from `%ObjectPrototype%`,
67 - Has all of the applicable properties defined as enumerable,
68 configurable, writable own data properties (absent properties will be
69 defined with a value of undefined), and
70 - Has no other own properties.
71
72 [XSD-1]: <https://www.w3.org/TR/xmlschema11-1/>
73 [XSD-2]: <https://www.w3.org/TR/xmlschema11-2/>
This page took 0.04806 seconds and 5 git commands to generate.