summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/parser.nim12
-rw-r--r--lib/pure/algorithm.nim6
-rw-r--r--todo.txt4
-rw-r--r--web/news.txt6
4 files changed, 19 insertions, 9 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index d1aa2d8e3..dcd5401e8 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -241,9 +241,15 @@ proc isOperator(tok: TToken): bool =
 
 proc isUnary(p: TParser): bool =
   ## Check if the current parser token is a unary operator
-  p.strongSpaces and p.tok.tokType in {tkOpr, tkDotDot} and
-    p.tok.strongSpaceB == 0 and
-    p.tok.strongSpaceA > 0
+  if p.tok.tokType in {tkOpr, tkDotDot} and
+     p.tok.strongSpaceB == 0 and
+     p.tok.strongSpaceA > 0:
+    # XXX change this after 0.10.4 is out
+    if p.strongSpaces:
+      result = true
+    else:
+      parMessage(p, warnDeprecated,
+        "will be parsed as unary operator; inconsistent spacing")
 
 proc checkBinary(p: TParser) {.inline.} =
   ## Check if the current parser token is a binary operator.
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim
index 08d224dfd..a1ab7be13 100644
--- a/lib/pure/algorithm.nim
+++ b/lib/pure/algorithm.nim
@@ -253,16 +253,16 @@ proc product*[T](x: openArray[seq[T]]): seq[seq[T]] =
   while true:
     while indexes[index] == -1:
       indexes[index] = initial[index]
-      index +=1
+      index += 1
       if index == x.len: return
-      indexes[index] -=1
+      indexes[index] -= 1
     for ni, i in indexes:
       next[ni] = x[ni][i]
     var res: seq[T]
     shallowCopy(res, next)
     result.add(res)
     index = 0
-    indexes[index] -=1
+    indexes[index] -= 1
 
 proc nextPermutation*[T](x: var openarray[T]): bool {.discardable.} =
   ## Calculates the next lexicographic permutation, directly modifying ``x``.
diff --git a/todo.txt b/todo.txt
index 065f7ec78..fc62385a8 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,16 +1,16 @@
 version 0.10.4
 ==============
 
-- improve the parser; deal with  echo $foo  gotcha
 - improve GC-unsafety warnings
 - make 'nil' work for 'add' and 'len'
-- add "all threads are blocked" detection to 'spawn'
 - overloading of '='
 
 
 version 1.0
 ===========
 
+- remove   echo $foo  gotcha
+- add "all threads are blocked" detection to 'spawn'
 - figure out why C++ bootstrapping is so much slower
 - nimsuggest: auto-completion needs to work in 'class' macros
 - The bitwise 'not' operator will be renamed to 'bnot' to
diff --git a/web/news.txt b/web/news.txt
index f1ce656a8..3d60540ec 100644
--- a/web/news.txt
+++ b/web/news.txt
@@ -42,7 +42,7 @@ News
     structure; for immediate macro parameters ``nkCall('addr', 'x')`` is
     produced instead of ``nkAddr('x')``.
   - ``concept`` is now a keyword and is used instead of ``generic``.
-  - The ``inc``, ``dec``, ``+=``, ``-=`` builtins now produces OverflowError
+  - The ``inc``, ``dec``, ``+=``, ``-=`` builtins now produce OverflowError
     exceptions. This means code like the following:
 
   .. code-block:: nim
@@ -64,6 +64,10 @@ News
     use ``a[0.. ^1]``. This also works with accessing a single
     element ``a[^1]``. Note that we cannot detect this reliably as it is
     determined at **runtime** whether negative indexing is used!
+  - The compiler now warns about code like ``foo +=1`` which uses inconsistent
+    spacing around binary operators. Later versions of the language will parse
+    these as unary operators instead so that ``echo $foo`` finally can do what
+    people expect it to do.
 
 
   Language Additions