Re: parallel: bounds checker

2020-03-05 Thread daef
for completeness sake, a working version of the first example (helping the proof engine a bit) still gonna give weave a try I guess import strutils import threadpool {.experimental: "parallel".} proc main = let w = 16 h = 8 var s = "a".re

Re: parallel: bounds checker

2020-03-05 Thread daef
damn you globals! I feel like I should have smelled that... thanks!

Re: parallel: bounds checker

2020-03-05 Thread Araq
Fwiw this works fine :P import threadpool {.experimental: "parallel".} proc main = var s = newSeq[char](3) parallel: for i in 0..s.high: s[i] = spawn chr(i) echo s main() Run

Re: parallel: bounds checker

2020-03-05 Thread daef
thanks, I'll give weave a try :)

Re: parallel: bounds checker

2020-03-04 Thread mratsim
In my experience, I never managed to use the `parallel` construct. One of the goals of 2020 is to introduce Z3 theorem prover in the compiler and its first use-case would be to prove array accesses (it's not in the milestones yet so hopefuly @Araq can confirm: [https://github.com/nim-lang/RFCs/

Re: parallel: bounds checker

2020-03-04 Thread daef
neither with a seq? > test.nim(8, 7) Error: (i)..(i) not disjoint from (i)..(i) import threadpool {.experimental: "parallel".} var s = newSeq[char](3) parallel: for i in 0..s.high: s[i] = spawn chr(i) Run I must be completely missing

Re: parallel: bounds checker

2020-03-04 Thread daef
okay, it doesn't seem to work for strings at all? i don't get it... > test.nim(8, 7) Error: cannot prove: i <= len(s) + -1 (bounds check) import threadpool {.experimental: "parallel".} var s = "abc" for i in 0..s.high: parallel: s[i] = spawn chr(i)

Re: parallel: bounds checker

2020-03-04 Thread daef
trying to place the min into the range doesn't seem to do the trick either: > test.nim(14, 12) Error: cannot prove: y * w + x <= len(s) + -1 (bounds check) import strutils import threadpool {.experimental: "parallel".} let w = 3 h = 3 var s = 'a'

Re: parallel: bounds checker

2020-03-04 Thread daef
I've seen that already. But bounding the expression doesn't work that simple because it (more or less obviously) breaks the disjoint check.

Re: parallel: bounds checker

2020-03-03 Thread Stefan_Salewski
You may see Araq's reply in [https://forum.nim-lang.org/t/4827#30222](https://forum.nim-lang.org/t/4827#30222)

parallel: bounds checker

2020-03-03 Thread daef
how can i satisfy parallel bounds checker in this example? it fails with test.nim(18, 19) Error: cannot prove: y * w8 + x <= len(s) + -1 (bounds check) strutils import math import threadpool {.experimental: "parallel".} proc getc() : char = &#x