Re: Experimenting with a FreeRTOS OS Port

2020-07-10 Thread dom96
> Currently I'm using Nim on an ESP32 with posix.select for a custom TCP 
> protocol.

Have you given the selectors module a try? It should provide an even nicer API 
on top of the raw POSIX select.


Re: Is there a command line one-line to start an HTTP server using Nim?

2020-07-06 Thread dom96
Please please tag new versions. It's not enough to just bump the version in the 
.nimble file.


Re: getFileSize async and sync

2020-07-02 Thread dom96
Yes the current file IO "async" implementation isn't actually async. 


Re: Norm 2.0.0

2020-06-28 Thread dom96
> Did you have a chance to try out the new version?

Not yet, been having a bit of a break from Nim development lately. Hopefully 
soon I'll have time to dive back into my projects and will be able to give Norm 
2.0 a try :)


Re: Change Nim colour on GitHub

2020-06-25 Thread dom96
Nice, looks good. And in the meantime it seems GitHub's new design separates 
these colours better.


Re: Change Nim colour on GitHub

2020-06-25 Thread dom96
Oh, one thing, doesn't JavaScript use a similar colour? Can we see what that 
looks like? @pietroppeter?


Re: Norm 2.0.0

2020-06-25 Thread dom96
This is awesome! As someone that has used norm in a number of his apps now I 
can attest to its quality, in fact I would say this is one of the gems in Nim's 
ecosystem. Keep up the awesome work!

(And if you want a challenge, help us transition the NimForum to using Norm :D)


Re: Change Nim colour on GitHub

2020-06-24 Thread dom96
Nice! I must say, I do like that colour.


Re: Newbie question: why do I get a "No handles or timers registered in dispatcher" error?

2020-06-23 Thread dom96
See 
[https://github.com/nim-lang/Nim/issues/14564](https://github.com/nim-lang/Nim/issues/14564).

TL;DR: As the error suggests, you don't have any IO operations or timers in 
progress so the event loop has nothing to do and so you get this error (if you 
didn't get this error your program would busy wait, leading to 100% cpu usage)

What is your bigger program? What does it do? If you're not doing any IO 
operations then you might not need to be using futures at all.


Re: Idea: Nim Online Conference

2020-06-22 Thread dom96
We shouldn't forget about @miran's awesome work here. Big thanks to him for all 
his work on scheduling, planning and organising this conference. It went 
incredibly smoothly, the bar has been set very high for the next conf :D


Re: Why is my HTTP handler not gcsafe?

2020-06-16 Thread dom96
You shouldn't need to do that. Passing `--threadAnalysis:off` to the compiler 
should work too.


Re: When will the NimConf timeline get posted?

2020-06-12 Thread dom96
Likely after Tuesday which is the deadline for recording submissions.


Re: Lambda syntax is awkward

2020-06-02 Thread dom96
I wouldn't depend on the do notation. The reason it's experimental is that it 
doesn't fit the language and may be removed entirely eventually.

Personally, I don't think this is too verbose:


let fourthPower = twice(10,
  proc(n: int): int =
echo "Gratuitous echo!"
return n * n
)


Run

It would look very similar in JS. In Python it would simply not be possible.


Re: How mature is async/threading in Nim?

2020-05-22 Thread dom96
> Read mratsim's post from the same thread then, 
> [https://forum.nim-lang.org/t/6352#39200](https://forum.nim-lang.org/t/6352#39200)

@mratsim shows no examples of what ARC can do, but I assume that ARC can help 
with the third scenario that he describes...

> You need a shared state, for example a shared hash table. Now you have a 
> problem :P, if it has infinite lifetime, you can allocate it on the heap and 
> pass a pointer to it, if not you need to implement atomic refcounting which 
> is not too difficult with destructors, see for example my refcounted events 
> in Weave

You will note that I wrote "The fact is that I have so far seen no evidence 
that --gc:arc makes mixing concurrency and parallelism in Nim easier". Yes, ARC 
does offer a shared heap and makes sharing memory easier, but the 
interoperability still isn't there between concurrency and parallelism. A 
shared heap does not solve this.

As a side note, I would like to see an example of that third scenario 
implemented using ARC, why hasn't @mratsim used it by default? :)


Re: How mature is async/threading in Nim?

2020-05-21 Thread dom96
> I have limited experience with nim mobile apps. But knowing what I know don't 
> think I would use async on the client. Async is great if you are doing tons 
> of http style requests. But really a mobile client? Just regular threads are 
> probably better if you are just writing and reading from a single websocket 
> connection. I would try both methods to see which one fits you better.

@treeform nothing wrong with using async on the client. Not sure why you find 
it so weird?


Re: How mature is async/threading in Nim?

2020-05-21 Thread dom96
All this talk of `--gc:arc` makes me a little bit frustrated, I feel like 
@andrea has a similar reaction. The fact is that I have so far seen no evidence 
that `--gc:arc` makes mixing concurrency and parallelism in Nim easier (I may 
very well be missing something, so please educate me with examples if so).

So yes, as things stand in Nim, you cannot easily mix parallelism and 
concurrency right now, but to me there is a fairly simple solution to this: we 
need to implement the ability to `await` a FlowVar (what `spawn` returns) 
and/or `channel.recv`. Either a member of the core dev team needs to be 
convinced to make this work or someone who's passionate about it needs to get 
it past the finish line (there were 
[some](https://github.com/nim-lang/Nim/pull/12232) 
[efforts](https://github.com/nim-lang/Nim/pull/12372) which made great 
progress, so I would say there is just a "little" push needed to get it to 
work).

Of course, Nim's threading model is a little different than most languages. 
Threads are somewhat "heavy", with each having their own heap, so for use cases 
that require a lot of communication between threads you are better off not 
holding out hope for my suggestion above.

There are alternatives, and I have been pretty successful in creating a very 
performant HTTP server for example: 
[https://github.com/dom96/httpbeast](https://github.com/dom96/httpbeast) (which 
this forum runs on).

Now to answer some of your questions...

> The asyncnet module documentation has a couple of caveats about Windows, like 
> "on Windows it only supports select()" and "In theory you should be able to 
> work with any of these layers interchangeably (as long as you only care about 
> non-Windows platforms)." I'm not clear on how this would impact clients, and 
> whether these caveats apply to using asyncnet or just the lower-level modules.

We might need to rewrite that paragraph, but it is specifically only talking 
about the `selectors` module. We have a custom IOCP implementation in 
asyncdispatch which asyncnet uses. So you will get the greatest API support on 
Windows too.

> The async examples I've seen run on a single thread. Is there any support for 
> distributing async calls across a thread pool?

Not really. What you can achieve is something similar to what I created with 
httpbeast: each thread running its own Async event loop and allowing the system 
to load balance the socket connections. For clients that will likely be 
trickier.

> The spawn function's thread safety seems to be based on segregating heap 
> objects per thread (Erlang-style.) This can involve a lot of copying, 
> especially when passing data buffers around. Is this something baked into the 
> language or is it specific to the spawn function? Are there alternatives to 
> this, like the more Rust-style model using move semantics?

Yep, this is unavoidable right now. But I believe arc will indeed make move 
semantics possible, that's really the main advantage it will bring to threading 
in Nim. I could be wrong though. 


Re: proposal: PTAL tag to make it clear that a PR is ready again for review

2020-05-17 Thread dom96
Please no. If you want someone to have a look at your PR then bump the PR so it 
gets put at the top of our notifications or just ping the best person to review 
that PR (if you know who they are). All these title/tag changes are just noise 
and we've got enough of that already.


Re: Idea: Nim Online Conference

2020-05-17 Thread dom96
I think the consensus so far is that we will let the participants choose 
whether they wish to pre-record their talk or to do it live. I would personally 
suggest pre-recording it to give us the ability to stream the highest quality 
talk possible, but I understand that some dislike that approach so the choice 
will likely be there.


Re: Idea: Nim Online Conference

2020-05-15 Thread dom96
The time is important I agree, but the platform shouldn't matter. It's unlikely 
to be anything other than Twitch/YouTube, streaming to those services is always 
just a case of using OBS and watching just needs a browser.


Re: Markdown test

2020-05-13 Thread dom96
We can already do italics and bold via * though, so it really isn't so bad. 
What is more annoying is the inability to respond with just a code block, those 
are bugs that need to be fixed.


Re: I cannot understand ARC

2020-05-07 Thread dom96
> "Compile your code with --gc:arc". That's it, the rest are details, the 
> document describes how --gc:arc is implemented.

Don't you need to at least mention `--gc:orc` as well? The difference between 
them at least is useful knowledge, since as soon as someone compiles async code 
with `--gc:arc` they will get demotivated.

TL;DR: (as far as I understand, I'm not expert on these new mechanisms) 
`--gc:orc` is `--gc:arc` with cycle collection which is necessary for async 
(which produces many cycles).


Re: What's the async way to receive channel messages?

2020-05-02 Thread dom96
Yes, we have been after marrying the parallelism and concurrency primitives in 
Nim for a while now. You can see some efforts for this being made in 
[https://github.com/nim-lang/Nim/pull/11724](https://github.com/nim-lang/Nim/pull/11724),
 but it didn't get to a point where it could be merged. The ideal is to be able 
to `await` a `recv` on a channel and a `FlowVar`, but right now you indeed need 
to busy loop waiting for the data which is enormously inefficient.

As far as your use case though, if it is a HTTP server then you may wish to 
consider following the model that httpbeast takes: an async event loop per 
thread. That way you can get Linux/BSD to send each thread requests evenly and 
keep all of them busy.


Re: Javascript browser backend: cannot include more than a single nim compiled source ?

2020-05-02 Thread dom96
> I'm also thinking that since now JavaScript modules landed in browsers, 
> perhaps Nim could target a javascript module with export directives instead 
> of a script to include inline on a webpage.

Keep in mind that a lot of us want to have support for a large variety of 
browsers, and this includes old ones. It would be preferable to fix the issues 
to allow multiple JS files to work via Nim.


Re: Typography update - now it can render 99% the Google Fonts ttf.

2020-05-01 Thread dom96
I use this in my [upcoming game](https://twitter.com/stardust_dev), and I must 
confirm that it works beautifully (not only on Windows but also on Android!). 
@treeform is also very responsive to bug reports and fixed the fonts that I 
found were rendering incorrectly very quickly, thanks @treeform for your 
amazing work!


Re: How to use file system watcher (fsmonitor) in Nim?

2020-04-24 Thread dom96
Depends on an external dylib though, would be nice to have a native Nim 
implementation, it shouldn't be hard to implement either, someone just needs to 
commit some time.


Re: Time to stabilize the ecosystem

2020-04-19 Thread dom96
> Memory management seems to be going in the right direction but I fear "ARC" 
> needlessly fractured the small community

A lot of implication here that ARC is going to be the new default. While this 
_may_ happen, it's far from certain, and even if it does it won't be until Nim 
2.0. So there is no ecosystem split here, unless you desperately need ARC for 
something.


Re: Nim Forum build error

2020-04-19 Thread dom96
Have you tried symlinking `libsass.so` to `libsass.so.0` in 
`/usr/lib/x86_64-linux-gnu`, or just straight up changing the DLL name inside 
the sass Nim module?


Re: Time to stabilize the ecosystem

2020-04-19 Thread dom96
> 3\. I'd argue that Jester (and it's underlying httpbeast) are mostly 
> production-ready

Yeah. You're all using it right now through this forum, been running in prod 
for years.


Re: Nim programming book for kids

2020-04-19 Thread dom96
> Funny to hear that from someone who wrote a Nim book. Wisdom of the ages or 
> more a result of dissapointment by tiny selling rates :-) ?

This isn't about my experience with writing the book, it's about my experience 
as a kid learning how to program. For what it's worth, I consider Nim in Action 
to have sold very well, but I myself don't know what success here looks like 
(no idea how many books other programming language books sell) :)


Re: Nim programming book for kids

2020-04-19 Thread dom96
> Although I don't think it's for kids.

I'd have to agree, this is great work you're doing @Stefan_Salewski. But 
personally I am of the opinion that kids rarely enjoy learning by reading 
books, there is a minority that do, but I think a much better way to teach kids 
(and many adults) programming is by creating videos showing step-by-step how to 
program.

That is how I learned how to program at 12 years old by the way.


Re: Nim Forum build error

2020-04-17 Thread dom96
Yep, it's trying to install karax and that fails for some reason (I think there 
might be a Nimble bug here). Try to install it manually by running nimble 
install karax@#f6bda9a.


Re: AsyncHTTPClient crashes saying invalid http version

2020-04-17 Thread dom96
Stop mixing callbacks and async procs. Your `download` async proc finishes 
before your download operation finishes because you are not awaiting the 
`download` proc. Just do this:


await downloader.downloadFile(node.mediaLink(board, thread), downFileName)


Run


Re: generate c++ code from .nim file

2020-04-17 Thread dom96
You'll need to copy this file beside your .cpp file. This is supposed to be 
copied automatically when using `--genScript` (if you're using 1.0.6 it should 
work), with latest versions of Nim it doesn't get copied (see 
[https://github.com/nim-lang/Nim/issues/13826)](https://github.com/nim-lang/Nim/issues/13826\)).


Re: Nim Forum build error

2020-04-17 Thread dom96
Are you sure you're not getting this error because of a dependency that's being 
installed? Can you paste the full output of `nimble c -r src/buildcss --debug`?


Re: AsyncHTTPClient crashes saying invalid http version

2020-04-17 Thread dom96
> Writing a synchronous downloader script was a breeze: 
> [https://gitlab.com/snippets/1967018](https://gitlab.com/snippets/1967018)

Is this a wrong link? because that doesn't look synchronous.

You're doing a number of things incorrectly here. One important thing to know 
is that you should never use waitFor in an async procedure, use await.

What I believe is the problem though, is that you are reusing the same 
AsyncHttpClient instance for multiple concurrent requests. You need to create 
one AsyncHttpClient instance for each request that you want to be running 
concurrently. I'm going to create an issue on GitHub to show a better error 
message for this case.

The easiest way to make this work would probably be to split up 
parseJson(j)["posts"] into x many lists, then run x async procs on each list 
which create their own AsyncHttpClient and iterate through the list downloading 
each one-by-one (using await instead of storing each future and awaiting them 
all).


Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-13 Thread dom96
> I thought Digital Ocean wouldn't have been an option with Nim, but Docker 
> seems to make it possible...

You don't need Docker to run Nim on Digital Ocean (or any VPS/server hosting 
provider). You've got a whole Linux machine to do with what you wish. Most of 
the time Docker is overkill.


Re: Format() problem with Jester

2020-04-12 Thread dom96
300k/s nice, usually people see much less. What specced hardware are you 
running this on? :)


Re: Nim 1.2 is here

2020-04-08 Thread dom96

could not import: X509_check_host


Run

> > every time I invoke nimble :-(

This is because we removed dead code elimination from the openssl wrapper, why 
did we do this? I was fixing something in openssl and noticed this yesterday 
(very time I invoke nimble :-(), can we restore it?


Re: Call for testing of arm64, armhf, and i386 snaps of Nim

2020-04-04 Thread dom96
I cannot test these right now but I just want to say thank you for your work on 
this!


Nim 1.2 is here

2020-04-03 Thread dom96
Since nobody else is reaping the NimForum karma, I might as well share this. 
Nim 1.2 is here:

[https://nim-lang.org/blog/2020/04/03/version-120-released.html](https://nim-lang.org/blog/2020/04/03/version-120-released.html)

As always, update via:


choosenim update stable


Run

Happy hacking!


Re: Idea: Nim Online Conference

2020-03-30 Thread dom96
@moigagoo that heading is far too large :)

I would prefer if we have a more structured submission process (i.e. a google 
form). It's too easy for submissions to get lost in a forum thread like this 
(speaking partially from experience here).


Re: Idea: Nim Online Conference

2020-03-30 Thread dom96
Great idea. Happy to help with promoting and setting this up.

I should be able to come up with something to talk about too :)


Re: (Meta) Why is there no beginners' section in the forum?

2020-03-28 Thread dom96
Whether something is a "Beginner" question or not is largely subjective, hence 
it is a bad category.

We will have categories, but we will not be getting categories like "Beginner 
Question" or "Advanced Question", instead it'll be "Question", "Announcement" 
and probably "Off-topic" and that's it.


Re: (Meta) Why is there no beginners' section in the forum?

2020-03-26 Thread dom96
We will get categories soon. They won't be that granular though.


Re: "If you need an embedded C compiler" - from the latest zig blog includes an suggestion for Nim

2020-03-25 Thread dom96
Yep, Andrew pinged me on IRC to suggest Nim adopts this. It might not be a half 
bad idea, we can pretty easily add it to choosenim for example to make 
cross-compilation much easier. 


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread dom96
It's looking like Nimble cannot find git for some reason, are you sure it's in 
the PATH of the terminal you're running it from?


Re: Async web servers and database

2020-03-01 Thread dom96
Nope, you're correct. Someone needs to create an async mysql/sqlite/postgres 
etc. driver.


Re: Gedit syntax highlighting.

2020-02-28 Thread dom96
yes, it can. You "just" need to get it into gedit's source code, send them a 
patch.


Re: Using async Nim procedures in Python

2020-02-24 Thread dom96
This is a cool idea and doing this might actually not be too difficult. The 
main pieces to get this working are likely:

  * Calling Nim's async event loop from Python's periodically
  * Interoperability between Nim's futures and Python's (not strictly 
necessary, but would allow awaiting Nim's async procs in Python which would be 
pretty nice)



I know that it is possible to ask epoll to let you know when another epoll FD 
is ready to be polled. Python should allow you to add arbitrary FDs to its 
event loop in order to receive readable/writeable events on it, you can then 
grab Nim's asyncdispatcher's FD and ask Python to tell when it should be 
polled. Then simply poll it. I take this approach in my HTTP server: 
[https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L168-L171](https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L168-L171).

Happy to help further if you're interested in pursuing this.


Re: Nim Community Survey 2019

2020-02-20 Thread dom96
The VS Code plugin is community supported. I do agree that it would be nice to 
have an official plugin.


Re: Can I use IOCP / async on startProcess?

2020-02-11 Thread dom96
Not with the stdlib. You might have some luck using 
[https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim](https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim)
 though.


Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-02-08 Thread dom96
For completeness, here are all the talks:

  * [Nim on 
everything](https://fosdem.org/2020/schedule/event/nimoneverything/) @PMunch
  * [Move semantics in 
Nim](https://fosdem.org/2020/schedule/event/nimmovesemantics/) @Araq
  * [Designing an ultra low-overhead multithreading runtime for 
Nim](https://fosdem.org/2020/schedule/event/nimultralowoverheadruntime/) 
@mratsim
  * [Async await in Nim](https://fosdem.org/2020/schedule/event/asyncawaitnim/) 
@dom96



All talk videos bar @mratsim's are ready to view at time of writing.


Re: FOSDEM Call for Participation

2020-02-03 Thread dom96
Videos should be up soon, and we'll likely post links in a separate forum 
thread or in this once which is more recent: 
[https://forum.nim-lang.org/t/5866](https://forum.nim-lang.org/t/5866).

Please try to find a more recent thread before bumping an old one like this. 
I'm going to lock this now, feel free to discuss further in 
[https://forum.nim-lang.org/t/5866](https://forum.nim-lang.org/t/5866)


Re: Is "danger" define supposed to also define "release"?

2020-02-03 Thread dom96
Even though this happened before 1.0 (AFAIK) it would have broken a lot of 
code, so it makes perfect sense that we should consider this to be a bug and a 
serious one at that.


Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-30 Thread dom96
That's a shame, we will miss you. Maybe this could be our excuse to have a 
meetup in London finally :)


Re: Nim 1.0.6 is out!

2020-01-29 Thread dom96
To be honest I'm now confused about 1.1 being skipped. We've always only 
skipped odd numbers in the "patch" number (i.e. last number in the version). 
Wasn't the weird 1.0.99 thing used for the in-development 1.1 version?


Re: future of htmlgen

2020-01-23 Thread dom96
`htmlgen` is part of 1.0 so it won't be removed, but it may be deprecated. 
Mention that in your video but do show it off.


Re: Impossible situation trying to get minimal glfw example working±±±

2020-01-18 Thread dom96
You need to install the dynamic library to use it, homebrew is indeed the 
easiest way.

As for passing that flag to Nim via Nimble, you can simply run `nimble c 
-d:nimDebugDlOpen ` (or maybe even `nimble build -d:nimDebugDlOpen`).


Re: Ported a Python game to Nim

2020-01-17 Thread dom96
> I don't think it makes sense for a game to be in someone's ~/.nimble/bin (or 
> equivalent), and I don't expect anyone to use this project as a library.

Why not? If someone wants to play your game they may want to install it into 
their PATH :)

> Can the user provide the name of a text file containing a list of 
> dependencies and have Nimble install each of them?

You can specify the list in your .nimble file, like so (the commit 
hashes/packages are not real):


requires "foo#abcdef1234"
requires "bar#fedcba4321"


Run

Of course, currently you need to do this manually for each dependency which 
sucks, but eventually Nimble will make this much easier through lock files.


Re: Introducing --gc:arc

2020-01-17 Thread dom96
> Another update: The async bugs on Windows have been fixed and async is now in 
> the state "almost working" for all major OSes.

That's brilliant! Thanks to everyone that helped with this :)

I'd love to see someone give httpbeast a shot with --gc:arc vs. normal GC to 
see what the numbers look like.


Re: How to create and manage a http users sessions?

2020-01-11 Thread dom96
That code looks like it does what you intend. One thing to keep in mind is: 
never ever discard the result of an `async` call. You need to use `asyncCheck` 
already otherwise you'll be swallowing exceptions in your sessions_manager 
function.


Re: Goto based exception handling

2020-01-08 Thread dom96
Wonderful, short and sweet write up. I really enjoyed reading this and am 
becoming more and more excited about ARC :)


Re: Nim Community Survey 2019

2020-01-07 Thread dom96
When's the cut-off?


Re: Embedding libclang into Nim's compiler

2020-01-04 Thread dom96
I've had a very similar idea and I actually have a pretty nice libclang wrapper 
which I've used for my C/C++ code obfuscator 
([https://picheta.me/obfuscator)](https://picheta.me/obfuscator\)). I've been 
meaning to open source it for a while now...

My idea differs in one important way though: there is no need for the compiler 
to depend on libclang as Nim's macros are already powerful enough to generate 
any wrappers that we might need. Instead we should use macros to call 
clang/libclang and generate the appropriate AST based on its output.

**All this being said though, as far as I know @shashlick has something like 
this already: https://github.com/nimterop/nimterop (but it uses tree-sitter 
instead of clang).**

> Self-contained toolchain by default (with cross compilation and cross 
> linking), without the need to install external C compilers (if the user wants 
> he could always use his own).

Note that we already ship Nim with GCC on Windows. Mac OS already mostly comes 
with clang and Linux also will have GCC/clang installed via a package manager. 
Not sure there is much benefit in shipping this dependency on Linux/Mac.


Re: nimble always install @#head for url

2020-01-03 Thread dom96
hrm, that's weird. Can you report it on GitHub?


Re: nimble always install @#head for url

2020-01-02 Thread dom96
Like this?


requires "https://url/repo.git #head"


Run


Re: Game unlock gui written with gintro

2020-01-02 Thread dom96
wow, that's a significant app. Nice job :)


Re: Is there a 2D game framework recently updated for Nim ?

2019-12-31 Thread dom96
Yeah, it's definitely not perfect and indeed the deviation from original naming 
conventions was my number one annoyance too (would love to fix that if I had 
the time). Getting rid of the need to destroy pointers manually should now be 
possible with Nim's better destructors and/or ARC (but at the time it wasn't 
possible to make it better).

The main reason I said I had a good experience is because I managed to finish a 
Ludum Dare game with it. :)


Re: Nimble broken for pre-built binary installs

2019-12-29 Thread dom96
That's a poor error from Nimble, can you report this as an issue? IMO we need a 
better error message here.


Re: Introducing --gc:arc

2019-12-24 Thread dom96
This is awesome, and a great overview thanks for writing it up.

I am also curious about the shared heap, the implication from your post is that 
you are still sticking to the "one heap per thread" model and that we will 
continue to restrict the sharing of memory between threads. Is that the case?


Re: Anything to notice before using JavaScript backend of Nim?

2019-12-15 Thread dom96
`-d:release` will remove any `assert` calls, apart from that it shouldn't 
change any behaviour, so this may be a JS backend bug.

Make sure you aren't running any procedures that have side effects with 
`assert` as those statements will just be removed.


Re: Is it possible to browse the nimble.directory?

2019-12-08 Thread dom96
You can introduce a page which lists each tag, sorted by how many packages are 
in that tag. This would already give a nice way to explore our packages.


Re: TXT DNS lookup

2019-12-08 Thread dom96
Yeah, there is nothing for this in the stdlib. You will have to call out into 
posix/win api to do it, if you're up for it contributing this to the stdlib 
would be much appreciated :)


Re: Advent of Nim 2019 megathread

2019-12-01 Thread dom96
Decided to give this a proper try this year. Let's see how this goes. My repo 
is here:

[https://github.com/dom96/aoc2019](https://github.com/dom96/aoc2019)

Already found a bug in Nim heh: 
[https://github.com/nim-lang/Nim/issues/12788](https://github.com/nim-lang/Nim/issues/12788)


Re: Discord server improvements

2019-11-28 Thread dom96
If you'd like we can look into giving you the permissions needed to implement 
this, I'm not familiar with Discord's permissions, do you know what is required 
to be able to structure channels this way?


Re: recvmsg on AsyncSocket

2019-11-28 Thread dom96
> Maybe @dom96 have some experience with this ?

Never attempted to transfer FDs between processes, personally I would avoid it 
as I doubt it's well supported across different platforms, but I'm no expert on 
this particular aspect of how sockets/FDs behave when sent across processes.

You should however be able to use `newAsyncSocket` ([this 
overload](https://nim-lang.org/docs/asyncnet.html#newAsyncSocket%2CAsyncFD%2CDomain%2CSockType%2CProtocol))
 to create an `AsyncSocket` out of an FD.

I'm curious what you're trying to achieve at a high level though, maybe there 
is another way that doesn't require FDs being sent across processes?


Re: Any decent non-video async socket tutorials in c#?

2019-11-28 Thread dom96
> Any decent non-video async socket tutorials in c#

Is that a typo or are you trolling us?


Re: FOSDEM CfP deadline is 26/11/19

2019-11-26 Thread dom96
Last chance to submit is today! Bumping for visibility.


Re: FOSDEM CfP deadline is 26/11/19

2019-11-25 Thread dom96
Submitted 3 talks:

  * Nim - A walk-through of a new emerging language
  * Async await in Nim - A demonstration of the flexibility metaprogramming can 
bring to a language
  * Karax - SPAs in a compiled systems programming language



I'm quite proud of my abstract for the first one, the others I threw in as a 
backup. Hoping the first one is picked :)


Re: The authors of the Nimacros project stopped working on that book

2019-11-23 Thread dom96
Can someone explain what this project is? This is literally the first I'm 
hearing of it and I'm quite puzzled about what I've read so far, do we have 
gardeners working on a Nim programming language book?


Re: when to use 'ref object' vs plain 'object'

2019-11-23 Thread dom96
@enthus1ast You can also use `FutureVar[T]` as a workaround for this 
restriction. Eventually my hope was to have the `async` macro do this 
automatically, but I wonder if it would make more sense to push for `var T` to 
be supported in closure iterators instead.


FOSDEM CfP deadline is 26/11/19

2019-11-21 Thread dom96
We are nearing the deadline to submit a talk for the Minimalistic, Experimental 
and Emerging Languages devroom. This is a devroom that is co-run by one of our 
very own, @PMunch.

**The deadline is Tuesday, 26th November 2019.**

This devroom, alongside being aimed at Minimalistic languages (like last year) 
is also accepting talks about experimental and emerging languages. This means 
Nim, and in order to have a good presence at FOSDEM it would be great to hear 
from our community, so consider submitting a talk and join myself and many 
others who will be doing the same.

If you're not up for giving a talk, I encourage you to pop over to Brussels in 
February next year. It's a really great place to meet up with other Nim users 
and to learn some things about other open source projects as well.


Re: Running several processes asynchronously?

2019-11-20 Thread dom96
Yeah, I think this is a bug in asynctools. I recall running into similar 
things, I created an issue for this a while ago: 
[https://github.com/cheatfate/asynctools/issues/9](https://github.com/cheatfate/asynctools/issues/9).

If you have some time it would be brilliant if you could look into the cause 
and fix it :)


Re: How to avoid recursive module dependency ?

2019-11-18 Thread dom96
I would strongly recommend avoiding `include` as much as possible, and in 
particular in this case.

What works usually is to create a module for your types, or to think about how 
you structure your program, usually you will see that you aren't organising 
your code in the best way.


Re: Jester performance on FreeBSD is 1/10 of that on Linux

2019-11-16 Thread dom96
Cool, thanks for testing. I can't imagine what could cause this difference in 
httpbeast, perhaps Nim's kqueue implementation is significantly worse than its 
epoll implementation.

Maybe Amazon's EC2 has worse performance on FreeBSD? Have you tried comparing 
other http servers?


Re: the "type" of the curly-bracket structure

2019-11-16 Thread dom96
This curly bracket structure is called the "Table constructor": 
[https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor](https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor).
 You should be able use `varargs[(string, string)]` as the type for your macro.


Re: Jester performance on FreeBSD is 1/10 of that on Linux

2019-11-15 Thread dom96
This is interesting. Can you test httpbeast on its own?


Re: async/await for embedded sysmtems

2019-11-15 Thread dom96
For something like an embedded system the current async/await is likely to be 
far too heavy (it allocates far too much on the heap).

What I would personally like to see is alloc-free async/await which is, I 
believe, what Rust achieves. Since you're working on an embedded system 
already, this style would fit really well for you, and if it works out well 
maybe we can adopt it for Nim 2.0. You should be able to get a basic prototype 
up and running quite quickly using the Nim selectors module which abstract a 
lot of the IO stack for you.


Re: Jester memory usage keep rising using sqlite

2019-11-15 Thread dom96
Does it ever rise above 12mb? To be honest, 12mb isn't bad and I don't think 
the GC will aggressively free that. Maybe it's too much for you?


Re: Memory leak

2019-11-14 Thread dom96
Are you using async await in your program?

In any case, the best way I've found to diagnose memory leaks for long-running 
programs is by logging the memory usage of each object to something like 
prometheus. My [prometheus package](https://github.com/dom96/prometheus) can do 
that automatically for you, but you'll need to set it up and have a web server 
running in your process for it to work properly. If you're not using async then 
this probably isn't the best approach.

You can alternatively just print out the same data that my package collects, 
see how I do this here: 
[https://github.com/dom96/prometheus/blob/master/src/prometheus/collectors/gccollector.nim#L84](https://github.com/dom96/prometheus/blob/master/src/prometheus/collectors/gccollector.nim#L84).
 The dumpHeapInstances function gives you the raw data, but there is one that 
returns a human-readable string as well if you look around. You can just call 
it to get how much memory each type is using.


Re: donation

2019-11-13 Thread dom96
Guessing @JPLRouge means that our donations page does not list their donation. 
We need to update that page more often.


Re: let & const on C backend

2019-11-06 Thread dom96
You can always workaround this by creating a nice macro which will generate 
something like:


{.emit: """
const int a[] = {1,2,3};
""".}


Run


Re: Nim v. 1.0.2 is out!

2019-10-23 Thread dom96
The link to share, now that we've got an article: 
[https://nim-lang.org/blog/2019/10/23/version-102-released.html](https://nim-lang.org/blog/2019/10/23/version-102-released.html)


Re: Nim Podcast

2019-10-23 Thread dom96
Since this thread has popped up again, I should ask, what ever happened to 
these lost episodes? Among them is one of mine, would love to hear it again.


Re: Telegram group

2019-10-20 Thread dom96
Done. Sorry it took so long :)


Re: FOSDEM Call for Participation

2019-10-18 Thread dom96
Where has this been emailed out? Is there not a page which has this description 
on the FOSDEM website somewhere? It would be great to update it if so, and also 
the description in your original post.


Re: Winning the Base64 benchmarks.

2019-10-17 Thread dom96
> benchmarks are a game. > > you can always beat or come close to C with Nim.

Agree with you 100% and especially these statements. For compiled languages 
like C/Nim/Rust/Go it really is just a case of putting in the time to optimise 
the code for a specific architecture or compiler. Even languages like Python 
can cheat and call into a C library, with enough effort you can make anything 
run fast, it's effort that matters though. So comparing performance of 
languages doesn't really make sense.

What does make sense is to compare the stdlib performance, but it's important 
not to blame the language for this and be aware that fixing the performance 
likely just needs someone knowledgeable to put in the effort like you have done 
here.


Re: nim cannot reference libraries installed with nimble.

2019-10-14 Thread dom96
Did you follow Choosenim's instructions to modify your PATH?


Re: FOSDEM Call for Participation

2019-10-14 Thread dom96
In that case, IMO, this whole paragraph needs to be removed or rewritten:

> Minimalism is an important topic for this devroom. Minimalism matters. 
> Minimalism allows for smaller systems that take less resources and consume 
> less energy. More importantly, free and open source minimalism allows for 
> secure systems that are easy to understand. Finally, we believe that 
> minimalism is educational and brings back the fun of the early days of 
> computing where people learn to understand systems from the ground up. 
> Speakers will be asked to accentuate the educational side of their projects.

I guess it was copy and pasted from last year's description. Can we make sure 
so much emphasis isn't placed on "minimalism"? Also, can we change the name in 
[https://fosdem.org/2020/news/2019-10-01-accepted-developer-rooms/](https://fosdem.org/2020/news/2019-10-01-accepted-developer-rooms/)?


Re: How to turn thread spawn call into an async call [redux; Nim 1.0.0]

2019-10-12 Thread dom96
Not yet AFAIK. We're still waiting on @rayman22201's patches to be finalised.


  1   2   3   4   5   6   7   >