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
@wizzardx Nim borrowing Rust's stuff? That sounds just too much like people
started thinking my way ("Rust truly is the new C").
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
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
Probably it was on moderation. Now it's visible.
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?
Spam: if you need more logging helpers:
[https://github.com/FedericoCeratto/nim-morelogging](https://github.com/FedericoCeratto/nim-morelogging)
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
mremovePrefix
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
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?
> 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.
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)
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)
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
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
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
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
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
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.
There is cross-compilation with an [ARM
example](https://nim-lang.org/docs/nimc.html#cross-compilation). Is that enough?
@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
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
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)
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
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
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
Can you elaborate? That should work.
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`.)
_(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:
30 matches
Mail list logo