summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim5
-rw-r--r--web/news.txt5
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 3e8c17324..1805dd813 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -3266,9 +3266,10 @@ template `..<`*(a, b: expr): expr =
   ## '..' and '<' is required.
   a .. <b
 
-proc xlen*(x: string): int {.magic: "XLenStr", noSideEffect.}
-proc xlen*[T](x: seq[T]): int {.magic: "XLenSeq", noSideEffect.}
+proc xlen*(x: string): int {.magic: "XLenStr", noSideEffect.} = discard
+proc xlen*[T](x: seq[T]): int {.magic: "XLenSeq", noSideEffect.} =
   ## returns the length of a sequence or a string without testing for 'nil'.
   ## This is an optimization that rarely makes sense.
+  discard
 
 {.pop.} #{.push warning[GcMem]: off.}
diff --git a/web/news.txt b/web/news.txt
index 6b109aa1c..257591de7 100644
--- a/web/news.txt
+++ b/web/news.txt
@@ -127,6 +127,7 @@ News
     things from backwards: ``a[^1]`` is like Python's ``a[-1]``.
   - A first version of the specification and implementation of the overloading
     of the assignment operator has arrived!
+  - ``system.len`` for strings and sequences now returns 0 for nil.
 
 
   Library additions
@@ -137,6 +138,10 @@ News
     with a ``newMultipartData`` proc.
   - Added `%*` operator for JSON.
   - The compiler is now available as Nimble package for c2nim.
+  - Added ``..^`` and ``..<`` templates to system so that the rather annoying
+    space between ``.. <`` and ``.. ^`` is not necessary anymore.
+  - Added ``system.xlen`` for strings and sequences to get back the old ``len``
+    operation that doesn't check for ``nil`` for efficiency.
 
 
   Bugfixes