august.values
August 1.0: Supplied with the compiler. Import public names from august.values.
Signatures show result types and checked errors. See packages to pin a release and language constructs for built-in types.
CivilDate
record CivilDate(int year, int month, int day) unless ConversionErrorGregorian calendar date, including dates before the historical calendar cutover.
Parameters
year: Year from 1 to 9999.month: Month from 1 to 12.day: Day from 1 to the actual month's length.
Throws
ConversionError: Any field is outside the calendar range.
parseCivilDate
parseCivilDate(string text) returns CivilDate unless ConversionErrorParse exactly ten ASCII bytes in YYYY-MM-DD form. No whitespace or time suffix is accepted.
Throws
ConversionError: Malformed text or an invalid Gregorian date.
formatCivilDate
formatCivilDate(CivilDate value) returns stringFormat a validated calendar date as YYYY-MM-DD, padding each field with zeroes.
compareCivilDates
compareCivilDates(CivilDate left, CivilDate right) returns intCompare calendar fields chronologically; return -1, 0 or 1 without arithmetic overflow.
Duration
record Duration(int milliseconds)Exact signed int64 milliseconds. This value has no calendar, clock or scheduling effects.
parseDuration
parseDuration(string text) returns Duration unless ConversionErrorParse a seconds-only duration: optional minus, PT, 1 to 16 integer digits, optional 1 to 3 fractional digits, then S. Leading zeroes are accepted; other units, plus signs, spaces and excess precision are rejected.
Parameters
text: At most 24 ASCII bytes, such as PT1.25S.
Throws
ConversionError: Invalid syntax or a millisecond value outside int64.
formatDuration
formatDuration(Duration value) returns stringFormat exact milliseconds as optional minus and PTseconds.fffS, including three fractional digits. Zero has no sign; the complete int64 range is representable without rounding.
durationFromSeconds
durationFromSeconds(int seconds) returns Duration unless ArithmeticErrorConvert whole seconds to exact milliseconds.
Throws
ArithmeticError: Multiplication by 1000 overflows int64.
addDurations
addDurations(Duration left, Duration right) returns Duration unless ArithmeticErrorAdd milliseconds without wrapping.
Throws
ArithmeticError: The total cannot fit int64.
compareDurations
compareDurations(Duration left, Duration right) returns intCompare exact millisecond values; return -1, 0 or 1.
TokenId
record TokenId(string text) unless ConversionErrorCase-sensitive application identifier: 1 to 128 ASCII letters, digits, hyphen, period, underscore or tilde. This is the RFC 3986 unreserved character set. The original spelling is retained.
Throws
ConversionError: Empty, oversized or unsupported text.
parseTokenId
parseTokenId(string text) returns TokenId unless ConversionErrorValidate an identifier without normalizing it. Raises ConversionError for the same inputs as TokenId.
formatTokenId
formatTokenId(TokenId value) returns stringReturn the original identifier text.
BoundedText
record BoundedText(string text, int minBytes, int maxBytes) unless ConversionErrorValid UTF-8 text with inclusive byte bounds. Preserve combining sequences and embedded NUL.
Parameters
minBytes: Minimum UTF-8 storage bytes, including zero.maxBytes: Maximum storage bytes; require minBytes <= maxBytes <= 1048576.
Throws
ConversionError: Invalid bounds, length or UTF-8. Equality includes both bounds.
parseBoundedText
parseBoundedText(string text, int minBytes, int maxBytes) returns BoundedText unless ConversionErrorValidate original UTF-8 text and inclusive byte bounds without normalization.
Throws
ConversionError: Invalid bounds, length or UTF-8.
formatBoundedText
formatBoundedText(BoundedText value) returns stringReturn the original text, including embedded NUL and combining sequences.
HttpUrl
record HttpUrl(string text) unless ConversionErrorAbsolute HTTP(S) URL in August's ASCII DNS-host profile; preserve the original spelling.
Parameters
text: 1 to 8192 bytes. Hosts use 1 to 253 bytes, labels of 1 to 63 letters/digits/hyphens and at least one letter. Optional ports are 1 to 65535. Path/query use RFC 3986 characters and checked percent triplets.
Throws
ConversionError: Invalid profile text. IP addresses, userinfo, fragments, relative URLs and IDNA are unsupported. Construction performs no DNS lookup or request. Equality compares original text; it is not URI equivalence.
parseHttpUrl
parseHttpUrl(string text) returns HttpUrl unless ConversionErrorParse the same ASCII HTTP(S)/DNS profile as HttpUrl, preserving case, escapes and an empty query.
Throws
ConversionError: Invalid or unsupported URL syntax.
formatHttpUrl
formatHttpUrl(HttpUrl value) returns stringReturn the original URL text without decoding, normalizing or accessing a network.
PortableRelativePath
record PortableRelativePath(string text) unless ConversionErrorLexical portable relative path. This value grants no filesystem access or containment guarantee.
Parameters
text: 1 to 1024 ASCII bytes in 1 to 64 slash-separated segments of 1 to 255 bytes. Segments use letters, digits, period, underscore or hyphen. Empty/dot/dot-dot segments, trailing periods and Windows device basenames are rejected.
Throws
ConversionError: Invalid characters, reserved names or exceeded bounds. Equality retains case and spelling; filesystem equivalence, symlinks and host limits remain adapter responsibilities.
parsePortableRelativePath
parsePortableRelativePath(string text) returns PortableRelativePath unless ConversionErrorValidate the same lexical profile as PortableRelativePath, preserving the original spelling.
Throws
ConversionError: Invalid or unsupported path syntax.
formatPortableRelativePath
formatPortableRelativePath(PortableRelativePath value) returns stringReturn the original slash-separated relative path without accessing a filesystem.
joinPortablePaths
joinPortablePaths(PortableRelativePath left, PortableRelativePath right) returns PortableRelativePath unless ConversionErrorJoin two validated paths with one slash and revalidate all byte, segment and name limits.
Throws
ConversionError: The combined path exceeds the supported bounds.
RetryPolicy
record RetryPolicy(int maxAttempts, immutable List<Duration> delays) unless ConversionErrorCaller-selected retry delays, stored as deeply immutable data. Attempts are numbered from one; maxAttempts includes the initial attempt.
Parameters
maxAttempts: Total allowed attempts, from 1 to 64.delays: Exactly maxAttempts - 1 durations, each from 0 to 604800000 milliseconds. Order, duplicates and zero delays are preserved. Construction performs no operation or wait.
Throws
ConversionError: Invalid attempt count, delay count or delay duration.
retryDelay
retryDelay(RetryPolicy policy, int failedAttempt) returns optional Duration unless ConversionErrorRead the delay after a failed attempt, or null after the final allowed attempt. This only reads policy data: it does not retry, sleep, classify an error or choose a recovery value.
Parameters
failedAttempt: One-based attempt number, from 1 to policy.maxAttempts.
Throws
ConversionError: The attempt number is outside the policy.