deprecate ranges (#31)

Without lifetime tracking, ranges pose a number of issues with regards
to memory safety - use openArray instead which is limited but safe.

In its present form, ranges take a copy of whatever is passed to them
which obscures the copies that they take, leading to misleading and slow
code.

If openArray is not applicable, simply do a seq copy - it's fine and
really doesn't matter in 95% of all cases, then profile and use other
techniques where needed.
This commit is contained in:
Jacek Sieka 2020-05-07 07:11:43 +02:00 committed by GitHub
parent 720f1a254d
commit 638e7acc8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,5 @@
{.deprecated: "unattractive memory unsafety - use openArray and other techniques instead".}
import
ranges/memranges,
ranges/typedranges

View File

@ -1,3 +1,5 @@
{.deprecated: "unattractive memory unsafety - use openArray and other techniques instead".}
import
ptr_arith

View File

@ -1,3 +1,5 @@
{.deprecated: "unattractive memory unsafety - use openArray and other techniques instead".}
import ../ptrops, typetraits, hashes
const rangesGCHoldEnabled = not defined(rangesDisableGCHold)