last stdlib cleanups

This commit is contained in:
Araq 2019-09-20 20:22:37 +02:00 • committed by Andreas Rumpf
commit 5abe880469
31 changed files with 136 additions and 42 deletions

View file

@ -67,6 +67,31 @@ type
- 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
- Inline iterators returning `lent T` types are now supported, similarly to iterators returning `var T`:

View file

@ -7,6 +7,8 @@
# distribution, for details about the copyright.
#
## Unstable API.
type
AllocatorFlag* {.pure.} = enum ## flags describing the properties of the allocator
ThreadLocal ## the allocator is thread local only.

View file

@ -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):
import
macros

View file

@ -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
# TODO: This shouldn't need to be included, but should ideally be exported.

View file

@ -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 deques

View file

@ -9,6 +9,8 @@
## This module implements a base64 encoder and decoder.
##
## Unstable API.
##
## Base64 is an encoding and decoding technique used to convert binary
## data to an ASCII string format.
## Each Base64 digit represents exactly 6 bits of data. Three 8-bit

View file

@ -9,6 +9,8 @@
## This module implements a simple proc for opening URLs with the user's
## default browser.
##
## Unstable API.
import strutils
@ -24,6 +26,8 @@ proc openDefaultBrowser*(url: string) =
## command is used. Under Unix, it is checked if ``xdg-open`` exists and
## used if it does. Otherwise the environment variable ``BROWSER`` is
## used to determine the default browser to use.
##
## This proc doesn't raise an exception on error, beware.
when defined(windows):
var o = newWideCString("open")
var u = newWideCString(url)

View file

@ -10,6 +10,8 @@
## Module that implements a fixed length array whose size
## is determined at runtime. Note: This is not ready for other people to use!
##
## Unstable API.
const
ArrayPartSize = 10

View file

@ -8,6 +8,8 @@
#
## Shared list support.
##
## Unstable API.
{.push stackTrace: off.}

View file

@ -11,6 +11,8 @@
## 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
## lockfree hash table, you're doing it wrong.
##
## Unstable API.
import
hashes, math, locks

View file

@ -8,6 +8,8 @@
#
## Types and operations for atomic operations and lockless algorithms.
##
## Unstable API.
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.} =
## Atomically decrements the atomic integer by some `value`.
discard location.fetchSub(value)

View file

@ -9,6 +9,8 @@
## This module implements a helper for a thread pool to determine whether
## creating a thread is a good idea.
##
## Unstable API.
when defined(windows):
import winlean, os, strutils, math

View file

@ -14,6 +14,8 @@
## * `channels module <channels.html>`_
## * `locks module <locks.html>`_
## * `asyncdispatch module <asyncdispatch.html>`_
##
## Unstable API.
when not compileOption("threads"):
{.error: "Threadpool requires --threads:on option.".}

View file

@ -6,6 +6,7 @@
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## Nim coroutines implementation, supports several context switching methods:
## -------- ------------
## ucontext available on unix and alike (default)
@ -17,6 +18,8 @@
## -d:nimCoroutinesUcontext Use ucontext backend.
## -d:nimCoroutinesSetjmp Use setjmp backend.
## -d:nimCoroutinesSetjmpBundled Use bundled setjmp implementation.
##
## Unstable API.
when not nimCoroutines and not defined(nimdoc):
when defined(noNimCoroutines):

View file

@ -9,6 +9,8 @@
## This module contains helpers that deal with different byte orders
## (`endian`:idx:).
##
## Unstable API.
when defined(gcc) or defined(llvm_gcc) or defined(clang):
const useBuiltinSwap = true

View file

@ -7,8 +7,8 @@
# distribution, for details about the copyright.
#
## This module parses an HTML document and creates its XML tree representation.
## It is supposed to handle the *wild* HTML the real world uses.
## **NOTE**: The behaviour might change in future versions as it is not
## 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
## document (well, if you are lucky):

View file

@ -9,6 +9,8 @@
## Contains functionality shared between the ``httpclient`` and
## ``asynchttpserver`` modules.
##
## Unstable API.
import tables, strutils, parseutils

View file

@ -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
# template with signature (x, y: untyped): untyped, which would lead to
# ambigous calls.
# ambiguous calls.

View file

@ -9,6 +9,8 @@
## The ``parsesql`` module implements a high performance SQL file
## parser. It parses PostgreSQL syntax and the SQL ANSI standard.
##
## Unstable API.
import
strutils, lexbase

View file

@ -8,8 +8,9 @@
#
## OS-Path normalization. Used by ``os.nim`` but also
## generally useful for dealing with paths. Note that this module
## does not provide a stable API.
## generally useful for dealing with paths.
##
## Unstable API.
# Yes, this uses import here, not include so that
# we don't end up exporting these symbols from pathnorm and os:

View file

@ -7,6 +7,9 @@
# distribution, for details about the copyright.
#
## Implements a representation of Unicode with the limited
## ASCII character subset.
import strutils
import unicode
@ -23,7 +26,7 @@ const
Delimiter = '-'
type
PunyError* = object of Exception
PunyError* = object of ValueError
proc decodeDigit(x: char): int {.raises: [PunyError].} =
if '0' <= x and x <= '9':

View file

@ -15,6 +15,8 @@
## is guaranteed to remain in the same memory location. The buffer
## will be able to grow up to the size of the initially reserved
## portion of the address space.
##
## Unstable API.
from ospaths import raiseOSError, osLastError

View file

@ -13,6 +13,8 @@
##
## Tested on these OSes: Linux, Windows, OSX
{.used.}
# do allocate memory upfront:
var se: ref NilAccessError
new(se)

View file

@ -9,6 +9,8 @@
## This module defines compile-time reflection procs for
## working with types.
##
## Unstable API.
export system.`$` # for backward compatibility

View file

@ -9,6 +9,11 @@
## :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.
##
## 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 timeStr = time.formatFloat(ffDecimal, precision = 8)
formatter.stream.writeLine("\t\t<testcase name=\"$#\" time=\"$#\">" % [xmlEscape(testResult.testName), timeStr])
case testResult.status:
case testResult.status
of OK:
discard
of SKIPPED:

View file

@ -7,8 +7,10 @@
# 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.
##
## Unstable API.
const
maxVarIntLen* = 9 ## the maximal number of bytes a varint can take

View file

@ -44,15 +44,7 @@ else:
{.pragma: inl, inline.}
{.pragma: compilerRtl, compilerproc.}
when not defined(nimsuperops):
{.pragma: operator.}
when defined(nimlocks):
{.pragma: benign, gcsafe, locks: 0.}
else:
{.pragma: benign, gcsafe.}
when defined(nimTableGet):
{.pragma: deprecatedGet, deprecated.}
else:
{.pragma: deprecatedGet.}

View file

@ -156,6 +156,7 @@ lib/experimental/diff.nim
lib/pure/algorithm.nim
lib/pure/stats.nim
lib/windows/winlean.nim
lib/windows/registry.nim
lib/pure/random.nim
lib/pure/complex.nim
lib/pure/times.nim