last stdlib cleanups
This commit is contained in:
parent
9776f926a2
commit
5abe880469
31 changed files with 136 additions and 42 deletions
25
changelog.md
25
changelog.md
|
|
@ -67,6 +67,31 @@ type
|
||||||
|
|
||||||
- Consistent error handling of two `exec` overloads. (#10967)
|
- Consistent error handling of two `exec` overloads. (#10967)
|
||||||
|
|
||||||
|
- Officially the following modules now have an unstable API:
|
||||||
|
|
||||||
|
- std/varints
|
||||||
|
- core/allocators
|
||||||
|
- core/hotcodereloading
|
||||||
|
- asyncstreams
|
||||||
|
- base64
|
||||||
|
- browsers
|
||||||
|
- collections/rtarrays
|
||||||
|
- collections/sharedlist
|
||||||
|
- collections/sharedtable
|
||||||
|
- concurrency/atomics
|
||||||
|
- concurrency/cpuload
|
||||||
|
- concurrency/threadpool
|
||||||
|
- coro
|
||||||
|
- endians
|
||||||
|
- httpcore
|
||||||
|
- parsesql
|
||||||
|
- pathnorm
|
||||||
|
- reservedmem
|
||||||
|
- typetraits
|
||||||
|
|
||||||
|
Every other stdlib module is API stable with respect to version 1.
|
||||||
|
|
||||||
|
|
||||||
## Language additions
|
## Language additions
|
||||||
|
|
||||||
- Inline iterators returning `lent T` types are now supported, similarly to iterators returning `var T`:
|
- Inline iterators returning `lent T` types are now supported, similarly to iterators returning `var T`:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
type
|
type
|
||||||
AllocatorFlag* {.pure.} = enum ## flags describing the properties of the allocator
|
AllocatorFlag* {.pure.} = enum ## flags describing the properties of the allocator
|
||||||
ThreadLocal ## the allocator is thread local only.
|
ThreadLocal ## the allocator is thread local only.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Nim's Runtime Library
|
||||||
|
# (c) Copyright 2019 Nim contributors
|
||||||
|
#
|
||||||
|
# See the file "copying.txt", included in this
|
||||||
|
# distribution, for details about the copyright.
|
||||||
|
#
|
||||||
|
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
when defined(hotcodereloading):
|
when defined(hotcodereloading):
|
||||||
import
|
import
|
||||||
macros
|
macros
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Nim's Runtime Library
|
||||||
|
# (c) Copyright 2015 Dominik Picheta
|
||||||
|
#
|
||||||
|
# See the file "copying.txt", included in this
|
||||||
|
# distribution, for details about the copyright.
|
||||||
|
#
|
||||||
|
|
||||||
import os, tables, strutils, times, heapqueue, options, deques, cstrutils
|
import os, tables, strutils, times, heapqueue, options, deques, cstrutils
|
||||||
|
|
||||||
# TODO: This shouldn't need to be included, but should ideally be exported.
|
# TODO: This shouldn't need to be included, but should ideally be exported.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Nim's Runtime Library
|
||||||
|
# (c) Copyright 2015 Dominik Picheta
|
||||||
|
#
|
||||||
|
# See the file "copying.txt", included in this
|
||||||
|
# distribution, for details about the copyright.
|
||||||
|
#
|
||||||
|
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import asyncfutures
|
import asyncfutures
|
||||||
|
|
||||||
import deques
|
import deques
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## This module implements a base64 encoder and decoder.
|
## This module implements a base64 encoder and decoder.
|
||||||
##
|
##
|
||||||
|
## Unstable API.
|
||||||
|
##
|
||||||
## Base64 is an encoding and decoding technique used to convert binary
|
## Base64 is an encoding and decoding technique used to convert binary
|
||||||
## data to an ASCII string format.
|
## data to an ASCII string format.
|
||||||
## Each Base64 digit represents exactly 6 bits of data. Three 8-bit
|
## Each Base64 digit represents exactly 6 bits of data. Three 8-bit
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## This module implements a simple proc for opening URLs with the user's
|
## This module implements a simple proc for opening URLs with the user's
|
||||||
## default browser.
|
## default browser.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import strutils
|
import strutils
|
||||||
|
|
||||||
|
|
@ -24,6 +26,8 @@ proc openDefaultBrowser*(url: string) =
|
||||||
## command is used. Under Unix, it is checked if ``xdg-open`` exists and
|
## command is used. Under Unix, it is checked if ``xdg-open`` exists and
|
||||||
## used if it does. Otherwise the environment variable ``BROWSER`` is
|
## used if it does. Otherwise the environment variable ``BROWSER`` is
|
||||||
## used to determine the default browser to use.
|
## used to determine the default browser to use.
|
||||||
|
##
|
||||||
|
## This proc doesn't raise an exception on error, beware.
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
var o = newWideCString("open")
|
var o = newWideCString("open")
|
||||||
var u = newWideCString(url)
|
var u = newWideCString(url)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
## Module that implements a fixed length array whose size
|
## Module that implements a fixed length array whose size
|
||||||
## is determined at runtime. Note: This is not ready for other people to use!
|
## is determined at runtime. Note: This is not ready for other people to use!
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
const
|
const
|
||||||
ArrayPartSize = 10
|
ArrayPartSize = 10
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
## Shared list support.
|
## Shared list support.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
{.push stackTrace: off.}
|
{.push stackTrace: off.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
## you'll be in trouble. Uses a single lock to protect the table, lockfree
|
## you'll be in trouble. Uses a single lock to protect the table, lockfree
|
||||||
## implementations welcome but if lock contention is so high that you need a
|
## implementations welcome but if lock contention is so high that you need a
|
||||||
## lockfree hash table, you're doing it wrong.
|
## lockfree hash table, you're doing it wrong.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import
|
import
|
||||||
hashes, math, locks
|
hashes, math, locks
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
## Types and operations for atomic operations and lockless algorithms.
|
## Types and operations for atomic operations and lockless algorithms.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import macros
|
import macros
|
||||||
|
|
||||||
|
|
@ -375,4 +377,3 @@ proc `+=`*[T: SomeInteger](location: var Atomic[T]; value: T) {.inline.} =
|
||||||
proc `-=`*[T: SomeInteger](location: var Atomic[T]; value: T) {.inline.} =
|
proc `-=`*[T: SomeInteger](location: var Atomic[T]; value: T) {.inline.} =
|
||||||
## Atomically decrements the atomic integer by some `value`.
|
## Atomically decrements the atomic integer by some `value`.
|
||||||
discard location.fetchSub(value)
|
discard location.fetchSub(value)
|
||||||
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## This module implements a helper for a thread pool to determine whether
|
## This module implements a helper for a thread pool to determine whether
|
||||||
## creating a thread is a good idea.
|
## creating a thread is a good idea.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean, os, strutils, math
|
import winlean, os, strutils, math
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@
|
||||||
## * `channels module <channels.html>`_
|
## * `channels module <channels.html>`_
|
||||||
## * `locks module <locks.html>`_
|
## * `locks module <locks.html>`_
|
||||||
## * `asyncdispatch module <asyncdispatch.html>`_
|
## * `asyncdispatch module <asyncdispatch.html>`_
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
when not compileOption("threads"):
|
when not compileOption("threads"):
|
||||||
{.error: "Threadpool requires --threads:on option.".}
|
{.error: "Threadpool requires --threads:on option.".}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## Nim coroutines implementation, supports several context switching methods:
|
## Nim coroutines implementation, supports several context switching methods:
|
||||||
## -------- ------------
|
## -------- ------------
|
||||||
## ucontext available on unix and alike (default)
|
## ucontext available on unix and alike (default)
|
||||||
|
|
@ -17,6 +18,8 @@
|
||||||
## -d:nimCoroutinesUcontext Use ucontext backend.
|
## -d:nimCoroutinesUcontext Use ucontext backend.
|
||||||
## -d:nimCoroutinesSetjmp Use setjmp backend.
|
## -d:nimCoroutinesSetjmp Use setjmp backend.
|
||||||
## -d:nimCoroutinesSetjmpBundled Use bundled setjmp implementation.
|
## -d:nimCoroutinesSetjmpBundled Use bundled setjmp implementation.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
when not nimCoroutines and not defined(nimdoc):
|
when not nimCoroutines and not defined(nimdoc):
|
||||||
when defined(noNimCoroutines):
|
when defined(noNimCoroutines):
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## This module contains helpers that deal with different byte orders
|
## This module contains helpers that deal with different byte orders
|
||||||
## (`endian`:idx:).
|
## (`endian`:idx:).
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
when defined(gcc) or defined(llvm_gcc) or defined(clang):
|
when defined(gcc) or defined(llvm_gcc) or defined(clang):
|
||||||
const useBuiltinSwap = true
|
const useBuiltinSwap = true
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## This module parses an HTML document and creates its XML tree representation.
|
## **NOTE**: The behaviour might change in future versions as it is not
|
||||||
## It is supposed to handle the *wild* HTML the real world uses.
|
## clear what "*wild* HTML the real world uses" really implies.
|
||||||
##
|
##
|
||||||
## It can be used to parse a wild HTML document and output it as valid XHTML
|
## It can be used to parse a wild HTML document and output it as valid XHTML
|
||||||
## document (well, if you are lucky):
|
## document (well, if you are lucky):
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## Contains functionality shared between the ``httpclient`` and
|
## Contains functionality shared between the ``httpclient`` and
|
||||||
## ``asynchttpserver`` modules.
|
## ``asynchttpserver`` modules.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import tables, strutils, parseutils
|
import tables, strutils, parseutils
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,4 @@ proc `<=`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.noSideEffect, inlin
|
||||||
|
|
||||||
# Note that we must not defined `>=` and `>`, because system.nim already has a
|
# Note that we must not defined `>=` and `>`, because system.nim already has a
|
||||||
# template with signature (x, y: untyped): untyped, which would lead to
|
# template with signature (x, y: untyped): untyped, which would lead to
|
||||||
# ambigous calls.
|
# ambiguous calls.
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## The ``parsesql`` module implements a high performance SQL file
|
## The ``parsesql`` module implements a high performance SQL file
|
||||||
## parser. It parses PostgreSQL syntax and the SQL ANSI standard.
|
## parser. It parses PostgreSQL syntax and the SQL ANSI standard.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
import
|
import
|
||||||
strutils, lexbase
|
strutils, lexbase
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
## OS-Path normalization. Used by ``os.nim`` but also
|
## OS-Path normalization. Used by ``os.nim`` but also
|
||||||
## generally useful for dealing with paths. Note that this module
|
## generally useful for dealing with paths.
|
||||||
## does not provide a stable API.
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
# Yes, this uses import here, not include so that
|
# Yes, this uses import here, not include so that
|
||||||
# we don't end up exporting these symbols from pathnorm and os:
|
# we don't end up exporting these symbols from pathnorm and os:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
## Implements a representation of Unicode with the limited
|
||||||
|
## ASCII character subset.
|
||||||
|
|
||||||
import strutils
|
import strutils
|
||||||
import unicode
|
import unicode
|
||||||
|
|
||||||
|
|
@ -23,7 +26,7 @@ const
|
||||||
Delimiter = '-'
|
Delimiter = '-'
|
||||||
|
|
||||||
type
|
type
|
||||||
PunyError* = object of Exception
|
PunyError* = object of ValueError
|
||||||
|
|
||||||
proc decodeDigit(x: char): int {.raises: [PunyError].} =
|
proc decodeDigit(x: char): int {.raises: [PunyError].} =
|
||||||
if '0' <= x and x <= '9':
|
if '0' <= x and x <= '9':
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
## is guaranteed to remain in the same memory location. The buffer
|
## is guaranteed to remain in the same memory location. The buffer
|
||||||
## will be able to grow up to the size of the initially reserved
|
## will be able to grow up to the size of the initially reserved
|
||||||
## portion of the address space.
|
## portion of the address space.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
from ospaths import raiseOSError, osLastError
|
from ospaths import raiseOSError, osLastError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
##
|
##
|
||||||
## Tested on these OSes: Linux, Windows, OSX
|
## Tested on these OSes: Linux, Windows, OSX
|
||||||
|
|
||||||
|
{.used.}
|
||||||
|
|
||||||
# do allocate memory upfront:
|
# do allocate memory upfront:
|
||||||
var se: ref NilAccessError
|
var se: ref NilAccessError
|
||||||
new(se)
|
new(se)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
## This module defines compile-time reflection procs for
|
## This module defines compile-time reflection procs for
|
||||||
## working with types.
|
## working with types.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
export system.`$` # for backward compatibility
|
export system.`$` # for backward compatibility
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@
|
||||||
|
|
||||||
## :Author: Zahary Karadjov
|
## :Author: Zahary Karadjov
|
||||||
##
|
##
|
||||||
|
## **Note**: Instead of ``unittest.nim``, please consider to use
|
||||||
|
## the ``testament`` tool which offers process isolation for your tests.
|
||||||
|
## Also ``when isMainModule: doAssert conditionHere`` is usually a
|
||||||
|
## much simpler solution for testing purposes.
|
||||||
|
##
|
||||||
## This module implements boilerplate to make unit testing easy.
|
## This module implements boilerplate to make unit testing easy.
|
||||||
##
|
##
|
||||||
## The test status and name is printed after any output or traceback.
|
## The test status and name is printed after any output or traceback.
|
||||||
|
|
@ -306,7 +311,7 @@ method testEnded*(formatter: JUnitOutputFormatter, testResult: TestResult) =
|
||||||
let time = epochTime() - formatter.testStartTime
|
let time = epochTime() - formatter.testStartTime
|
||||||
let timeStr = time.formatFloat(ffDecimal, precision = 8)
|
let timeStr = time.formatFloat(ffDecimal, precision = 8)
|
||||||
formatter.stream.writeLine("\t\t<testcase name=\"$#\" time=\"$#\">" % [xmlEscape(testResult.testName), timeStr])
|
formatter.stream.writeLine("\t\t<testcase name=\"$#\" time=\"$#\">" % [xmlEscape(testResult.testName), timeStr])
|
||||||
case testResult.status:
|
case testResult.status
|
||||||
of OK:
|
of OK:
|
||||||
discard
|
discard
|
||||||
of SKIPPED:
|
of SKIPPED:
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,10 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## Note this API is still experimental! A variable length integer
|
## A variable length integer
|
||||||
## encoding implementation inspired by SQLite.
|
## encoding implementation inspired by SQLite.
|
||||||
|
##
|
||||||
|
## Unstable API.
|
||||||
|
|
||||||
const
|
const
|
||||||
maxVarIntLen* = 9 ## the maximal number of bytes a varint can take
|
maxVarIntLen* = 9 ## the maximal number of bytes a varint can take
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,7 @@ else:
|
||||||
{.pragma: inl, inline.}
|
{.pragma: inl, inline.}
|
||||||
{.pragma: compilerRtl, compilerproc.}
|
{.pragma: compilerRtl, compilerproc.}
|
||||||
|
|
||||||
when not defined(nimsuperops):
|
|
||||||
{.pragma: operator.}
|
|
||||||
|
|
||||||
when defined(nimlocks):
|
when defined(nimlocks):
|
||||||
{.pragma: benign, gcsafe, locks: 0.}
|
{.pragma: benign, gcsafe, locks: 0.}
|
||||||
else:
|
else:
|
||||||
{.pragma: benign, gcsafe.}
|
{.pragma: benign, gcsafe.}
|
||||||
|
|
||||||
when defined(nimTableGet):
|
|
||||||
{.pragma: deprecatedGet, deprecated.}
|
|
||||||
else:
|
|
||||||
{.pragma: deprecatedGet.}
|
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ lib/experimental/diff.nim
|
||||||
lib/pure/algorithm.nim
|
lib/pure/algorithm.nim
|
||||||
lib/pure/stats.nim
|
lib/pure/stats.nim
|
||||||
lib/windows/winlean.nim
|
lib/windows/winlean.nim
|
||||||
|
lib/windows/registry.nim
|
||||||
lib/pure/random.nim
|
lib/pure/random.nim
|
||||||
lib/pure/complex.nim
|
lib/pure/complex.nim
|
||||||
lib/pure/times.nim
|
lib/pure/times.nim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue