Re: about locks and condition variables

2017-10-05 Thread rayman22201
This is an example of why multithreading is hard The Stack Overflow link from @cdunn2001 is good. It explains the concept better than me. I will try anyway: You can't rely on all the threads being in a certain state at the same time. When you create those other threads in the creation loop, th

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread Udiknedormin
@wizzardx Nim borrowing Rust's stuff? That sounds just too much like people started thinking my way ("Rust truly is the new C").

Re: range - Warning: Cannot prove that 't' is initialized.

2017-10-05 Thread Udiknedormin
It's quite simple actually. By default, all Nim variables are initialized to binary zero. For all of these ranges but for the first one, binary zero (which is numeric zero as well) is a valid value. But that's not the case for the first range sooo... The compiler complains that it can't prove th

range - Warning: Cannot prove that 't' is initialized.

2017-10-05 Thread opqx
Hi. Why do I receive a warning? I can not use positive numbers? var t: range[5..10] # Warning: Cannot prove that 't' is initialized. This will become a compile time error in the future. [ProveInit] var t: range[0..10] # no warning var t: range[-1..10] # no warning va

Re: Advent of Nim

2017-10-05 Thread LeuGim
Probably it was on moderation. Now it's visible.

Re: Advent of Nim

2017-10-05 Thread miran
I've added [day 12](https://github.com/narimiran/advent_of_nim_2016/blob/master/day12.nim) solution, and updated some earlier tasks. Any comments on the coding style? Something I could improve? * * * P.S. Why is this thread visible only if I'm logged in?

Re: Simple logging with module filename and line number

2017-10-05 Thread federico3
Spam: if you need more logging helpers: [https://github.com/FedericoCeratto/nim-morelogging](https://github.com/FedericoCeratto/nim-morelogging)

Re: Simple logging with module filename and line number

2017-10-05 Thread Tiberium
coffeepot: I'm afraid it isn't possible to implement it using a variable (e.g. something like $line). Yeah, it is possible to add this just as template, but I don't really think it would be accepted in stdlib

Re: String procs, when to modify in place, when to return modified string, when to return boolean result

2017-10-05 Thread mratsim
mremovePrefix

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread wizzardx
Probably comes down to people taking initiative. But not in ways that are counter to how the core devs need things to be run. I guess I'd mainly want to ask @core devs - what their opinion is on - I guess the general idea of "online community" management around Nim, and how they'd want to grow

Re: Simple logging with module filename and line number

2017-10-05 Thread coffeepot
Gotta say, that is pretty slick. I love how easy it is in Nim to get info such as line numbers and stack traces, checking if variables are defined or exist and stuff like that. I'll definitely be using this. Maybe there's room for it in the logging.nim module?

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread euant
> Is there perhaps some kind of Nim equivalent to "Find something Rusty to work > on"? There is not, as far as I'm aware. It's been talked about a few times, but to my knowledge nobody has ever had a chance to work on such a thing. Would certainly be nice to have.

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread wizzardx
To start with... Is there some kind of way to make a forum poll? (eg: this is a phpbb feature I've frequently used in the past, for this kind of thing)

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread wizzardx
Is there perhaps some kind of Nim equivalent to "Find something Rusty to work on"? [https://www.rustaceans.org/findwork/starters](https://www.rustaceans.org/findwork/starters)

String procs, when to modify in place, when to return modified string, when to return boolean result

2017-10-05 Thread Stefan_Salewski
I was recently looking for missing strutils.removePrefix(). Easy to create of course. strutils.removeSuffix() modifies the string in place, which makes much sense, as it only uses setlen(). But what should a removePrefix() do? The operation is more expensive, one has to create a new string and

General hacking in the Nim ecosystem.

2017-10-05 Thread wizzardx
Hi there! I saw recently in the (really awesome) "nim survey" for 2017, that there's a bunch of ecosystem things that people are requesting: [https://nim-lang.org/blog/2017/10/01/community-survey-results-2017.html](https://nim-lang.org/blog/2017/10/01/community-survey-results-2017.html) eg, top

Re: how to make nimble link against libs in $HOME

2017-10-05 Thread cdome
Take a look on this two pragmas, works for me: [https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-link-pragma](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-link-pragma) [https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-passl-pragma

Re: Safe sdl2 wrapper library?

2017-10-05 Thread wizzardx
In terms of "proper" high level SDL2; I'd probably want to do something like re-implement the rust SDL2 wrapper. What I mainly like about that is not that it's Rust, but that it's entirely safe by default. Probably wouldn't go as far as making a Result[T] type and returning that; Idiomatic gene

Re: about locks and condition variables

2017-10-05 Thread woggioni
I think the problem was that when the main thread enetered the signal loop, no thread had actually started executing yet so thaht when the signal was called there were no threads waiting on the Cond, I added a sleep(1000) between the createThread loop and the signal loop and the code seems to wo

Re: "Cross-platform C" target for Nim?

2017-10-05 Thread Araq
Nim uses the `niminst` tool to produce the tarballs. It's configured via `compiler/installer.ini`. Read `koch.nim` to see how niminst is invoked.

Re: "Cross-platform C" target for Nim?

2017-10-05 Thread mratsim
There is cross-compilation with an [ARM example](https://nim-lang.org/docs/nimc.html#cross-compilation). Is that enough?

Re: Python-like with, context managers, and the RAII pattern

2017-10-05 Thread wizzardx
@Benjaminel: I'm trying to emulate the Python "with" style, which is more general-purpose than just files. I think that "using" in C# is similar, to take any given resource for a block, and then auto-close it for you at the end of that block. @Others: Thanks for the replies so far! So, I anoth

"Cross-platform C" target for Nim?

2017-10-05 Thread wizzardx
Hi there. Generated C Nim code usually targets specific a specific OS and CPU combination with it's C gen backend. But the tarball for Nim itself (also written in Nim), is cross-platform, and doesn't require a specific CPU or OS to be present. Is there a way to tell the Nim compiler to output

Re: about locks and condition variables

2017-10-05 Thread cdunn2001
This helped me: * [https://stackoverflow.com/questions/14582505/boost-condition-variables-do-calls-to-notify-one-stack](https://stackoverflow.com/questions/14582505/boost-condition-variables-do-calls-to-notify-one-stack)

Re: about locks and condition variables

2017-10-05 Thread rayman22201
The implementation of condition variables, on linux at least, is pthreads. But the implementation is tangential in this case. I think this example would deadlock in C++ as well. You signal() all the threads in the main thread only once, and then wait for them. It's possible that the thread sch

Re: why doesn't nimble uninstall nimx remove ~/.nimble/pkgs/nimx-1.0

2017-10-05 Thread bkerin
Ah it explains on the first time through on nimble uninstall nimx: > $ nimble uninstall nimx > Info Hint: used config file '/home/bkerin/opt/nim-0.17.2/config/nim.cfg' > [Conf] > > > Warning: Package 'nimx' has an incorrect structure. It should contain a > single directory hierarchy for

Re: how to make nimble link against libs in $HOME

2017-10-05 Thread bkerin
Hmm, for ordinary nim binaries RPATH is right, as expected given the gcc command that --listCmd show. Thanks. It seems like with nimx nimble just fetches things, and the build is done by nake, so I now I suspect with nimx the culprit is nake. The nimx package says the samples should be run like

Re: why doesn't nimble uninstall nimx remove ~/.nimble/pkgs/nimx-1.0

2017-10-05 Thread dom96
Can you elaborate? That should work.

Re: Receiving strings of uncertain length over recv() | net.Socket

2017-10-05 Thread dom96
Nope, this is simply how sockets work. Your protocol needs to specify how big the message is, or use some character to act as a message separator (for example `\r\l`.)

Re: Another reason to deprecate ..

2017-10-05 Thread jlp765
_(there are two things being discussed here: speed and coding style. This post has to do with speed differences)_ I have simplified the benchmark I posted before. The statement > it's way slower than using explicit numerical bounds seems VERY difficult to prove, given the following code: