could Nim benefit from upcoming C++ modules to speedup compilation times?

2018-04-04 Thread timothee
Nim doesn't rely on headers but has to (re-)declare all the referenced symbols in each .c or .cpp file C++ modules ([https://clang.llvm.org/docs/Modules.html](https://clang.llvm.org/docs/Modules.html)) aim among other things at improving Compile-time scalability, > Compile-time scalability:

Re: Twinprimes generator that showcases Nim

2018-04-04 Thread jzakiya
Hey @miran, thanks. I'll look at your code when I get some time today. It would be really helpful if people could run the code on different (Intel cpus, AMD, ARM, etc) platforms with different number of threads, cache size, etc, and if possible a|b it against `primesieve` on their systems, and

Re: atomic and ref pointer

2018-04-04 Thread andrea
Great, this should go into the official docs!

Re: Twinprimes generator that showcases Nim

2018-04-04 Thread miran
> But I encourage, implore, welcome, people to beat on the code to improve it > and make it faster. What idioms are faster than the ones I used, etc. Here is [my gist](https://gist.github.com/narimiran/f9c1df45036cff34a725baad2e89af44) \- I took your improved version, went quickly through it,

Re: Though about identifiers in text editors.

2018-04-04 Thread DTxplorer
> Yeah, that's precisely why it's done and you should follow it. It's that > simple. > > Why not make the compiler enforce it? Because there are genuine cases where > it's just easier to not follow the convention (eg. wrappers). But the > convention is there to motivate people >to follow it,

Re: atomic and ref pointer

2018-04-04 Thread boia01
The way I understand `protect` and `dispose` is they are the inter-thread equivalent to `GC_ref` and `GC_unref` respectively. Nim's per-thread GC only looks for roots in the current thread. If some objects can't be tracked using traced `ref`'s, i.e. using typed `ptr`'s or raw `pointer`'s, then

Re: Though about identifiers in text editors.

2018-04-04 Thread Stefan_Salewski
> Why not calling Nimsuggest on space hits and carriage returns only ? Yes this is one solution, but I was not really happy with it. In the general case one single keystroke can change highlight of the whole file. For example when we modify a var or type definition all occurrences of that var

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-04 Thread Araq
Lol, please don't. I'm tired of nano improvements that make me touch thousands of lines of code. We need to ship what we have and call it a day. I don't remember mistyping these names all too often. And for other defines you can do: when defined(foo): const useFoo = true

Re: fill proc that passed an empty seq failed with IndexError

2018-04-04 Thread hoge99
Thank you.

Re: Twinprimes generator that showcases Nim

2018-04-04 Thread miran
> show that Nim can be a player in the numerical analysis arena, particularly > for parallel algorithms IMO, it would be nice if you would convert this to a blog post, which could be shared on Reddit/HN/etc. Maybe something similar to this:

Re: Though about identifiers in text editors.

2018-04-04 Thread dom96
> This choice force the user to follow the naming convention, otherwise, the > highlighting becomes inconsistent and annoying. Yeah, that's precisely why it's done and you should follow it. It's that simple. Why not make the compiler enforce it? Because there are genuine cases where it's just

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-04 Thread dom96
Go for it. It's a boring job but if you can create a PR to introduce these new symbols then please do

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-04 Thread timothee
thanks, didn't know about [https://github.com/nim-lang/Nim/blob/devel/lib/system/platforms.nim](https://github.com/nim-lang/Nim/blob/devel/lib/system/platforms.nim) ; it's an improvement over status quo, however: * since it uses an enum, the values are mutually exclusive; eg we can't have

Re: fill proc that passed an empty seq failed with IndexError

2018-04-04 Thread GULPF
It's a bug, [I've submitted a fix now.](https://github.com/nim-lang/Nim/pull/7495)

Re: Though about identifiers in text editors.

2018-04-04 Thread Stefan_Salewski
> In my opinion the highlighting must follow the languages rules only, You can ask nimsuggest for high quality highlighting. I did that in a private version of my NEd editor ([https://github.com/StefanSalewski/NEd](https://github.com/StefanSalewski/NEd)) about one year ago, it was working

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-04 Thread Araq
You can also use `when hostOs == "linux"` but it shares the typo fragility.

Re: [RFC] use `when predef.os.macosx` instead of `when defined(macosx)` ; more robust and scalable

2018-04-04 Thread Arrrrrrrrr
There is already a better approach [https://github.com/nim-lang/Nim/blob/devel/lib/system/platforms.nim](https://github.com/nim-lang/Nim/blob/devel/lib/system/platforms.nim)

fill proc that passed an empty seq failed with IndexError

2018-04-04 Thread hoge99
I passed an empty seq to the fill proc in algorithm module. I expected that the seq do not change the seq, but it failed with IndexError. The description of the fill seq is _fills the array a with value_. [(link)](https://nim-lang.org/docs/algorithm.html#fill,openArray\[T\],T) Is this a

Re: atomic and ref pointer

2018-04-04 Thread andrea
Can we have any detail on how protect and dispose work? I see them mentioned from time to time, but their documentation is currently empty

Re: Warning: parseopt2 is deprecated

2018-04-04 Thread timothee
see also: [https://github.com/nim-lang/Nim/issues/7494](https://github.com/nim-lang/Nim/issues/7494) deprecated modules don't show up as being deprecated in docs + other related points #7494

how to use compiler/nimeval: execute ? getting: Error: cannot 'importc' variable at compile time

2018-04-04 Thread timothee
D20180403T180936 echo "before" import compiler/nimeval execute("echo 1+2") this compiles but gives runtime error upon calling execute: before Hint: used config file '/Users/timothee/.config/nim.cfg' [Conf] Hint: used config file

Re: atomic and ref pointer

2018-04-04 Thread 2vg
> Well if you protect and dispose the ref properly, "dispose" Does it mean that the tracking of the GC disappears when casting ref to ptr ? Should I use boehm gc ? type Foo = object head, tail: ptr Foo var f = cast[ptr Foo](Foo.new()) pf =

Re: NimShooter

2018-04-04 Thread dom96
Nice! Works well on my Mac Tough game, but I love the score mechanic, having to get closer to enemies to increase your score. It's cool.

Re: NimShooter

2018-04-04 Thread erasmo85
I successfully compiled the game on a Mac, so Apple people you can try it as well without compiling the source code yourselves ! About the Z-A issue, I posted a warning on the page instead of modifying the game, I hope it works as well!

Re: Memory usage skyrocketed with nim 0.18.0 (in my async tcp service test)

2018-04-04 Thread dom96
That is interesting. Async has indeed changed significantly, I have no idea what could account for such a large memory usage difference though. Will you dig deeper?

Re: Memory usage skyrocketed with nim 0.18.0 (in my async tcp service test)

2018-04-04 Thread aguspiza2
For anyone interested I found that: import asyncdispatch, asyncnet, os var server = newAsyncSocket() #or newAsyncNativeSocket() let x = readFile("/proc/self/status") echo x Uses 44MB with 0.18.x Uses 4MB with 0.17.2

how to find symbol definition on cmd line? can nimsuggest help?

2018-04-04 Thread timothee
I'd like a command line tool to find where a symbol is defined. The compiler should know it so it should be a matter of exposing it to user. I couldn't find how to use nimsuggest for that although its jump to definition should use that I believe. For a more complete tool these would be nice:

Re: Twinprimes generator that showcases Nim

2018-04-04 Thread jzakiya
`New and Improved` (current) version, with significantly reduced memory footprint as numbers get larger. Now I create|initialize `nextp` arrays of 1st prime multiples in each thread, which gets gc'd (garbage collected) at end of thread, thus using a much lower constant runtime memory. (I could

Re: best practice for writing tests: isMainModule? runnableExamples? tests/ ?

2018-04-04 Thread GULPF
Tests inside `runnableExamples` are included in the documentation, so it's not really suitable for tests that aren't useful as examples. It was added recently so it's not used as much as it should be yet. I think `isMainModule` is generally preferred for the stdlib. It's not followed