template/generic instantiation from here

2017-01-11 Thread stbalbach
Hi, Given two templates splitre() and splitnre() which are almost identical import strutils, re, nre proc makeDiscardable[T](a: T): T {.discardable.} = a template splitre*(source: string, dest: untyped, match: string): int = when compiles(dest):

Re: How To Share a Nim Module Functionality

2017-01-11 Thread dom96
You can share a Nim source file containing only the procedure headers. What the body of those procedures should be is up for debate. What comes to mind is leaving the body empty and specifying a `importc` and `dynlib` pragma which imports a Nim DLL built by you. Something in the language to mak

Re: How could we make code readability better on third-party plateforms? (Github/Gitlab/Bitbucket/etc.)

2017-01-11 Thread dom96
Thank you for taking the time to write this up. Unfortunately I don't have any suggestions on what we can do to improve the current situation. > The solution? Prefixing or more-explicit-but-far-less-obvious naming. This is > exactly what's happening in Julia (which shares a lot of concepts with

Re: How could we make code readability better on third-party plateforms? (Github/Gitlab/Bitbucket/etc.)

2017-01-11 Thread Araq
> This invariably ends by Araq stating that there is no problem since an IDE is > just the right tool to code. Well to encourage further discussions: If a decent proposal arrives, I am willing to accept and even implement changes.

How To Share a Nim Module Functionality

2017-01-11 Thread ivanitto
I have a question about following Nim compiler/language use case: suppose, I created a library and want to share it's functionality with others. But, I do not want to share the source code, but just a binary distribution plus an interface. This use case can be solved by creating a C-header file

How could we make code readability better on third-party plateforms? (Github/Gitlab/Bitbucket/etc.)

2017-01-11 Thread lltp
As I understand it, Nim's development has always been done with tooling in mind. This has some wonderful advantages: uniform function call syntax, awesome IDE support built-in, unobtrusive syntax, convenient import system, etc. All of these would not be possible without proper tooling in the fir

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread _tulayang
@dom96 By the way, I think event-driven models are useful for plug-in programming. How about adding events to asyncdispath and asynchttpserver? Such as : proc handleError() {.async.} = await sleepAsync(1000) echo "handleError" proc handleRequest(req) {.async.} =

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread zielmicha
I started this project with the following assumptions: * use libuv (or something similar) to avoid having to support code for every platform (this is really important, I don't want to test everything on >3 platforms even when making small changes) * have API as clean as possible. I don't

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread dom96
I really appreciate your efforts but I must ask, why did you decide to write a new library instead of helping improve the standard lib async modules? My fear is that we will end up with 30% of libraries supporting reactor.nim, 40% of libraries supporting stdlib async and 30% supporting async fut

Re: Please , can we stop spams?

2017-01-11 Thread jibal
> I think is very unethical. It's not "unethical" at all. The thread had nothing to do with Nim and only does Nim harm. > In the hacker culture, you should be judged by your work and your work alone. And what work was shown in that thread? Never mind, I'm quite familiar with the inconsistencie

Re: Any possibility of a Rust backend for Nim?

2017-01-11 Thread jibal
@Krux02 That sounds like a good idea; certainly something worth looking into.

Re: New library for random variables

2017-01-11 Thread andrea
Well, `filter` samples until a condition is true. Where conditions on a _different_ random variable. It does exactly what you say: it samples from p until the condition in true, then return what g samples in that point. The example above is really artificial, since the two random variables are

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread andrea
Thank you! Right now [Rosencrantz](https://github.com/andreaferretti/rosencrantz) is based on the stdlib HTTP server, but I have been wanting to base it on something multithreaded for a while

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread zielmicha
There is no direct compatiblity with standard async, but porting code from stdlib should be easy (many features have similar syntax). Currently there is support for running tasks in a thread pool, but the tasks can't use event loop at all ([https://networkos.net/nim/reactor.nim/doc/api/reactor/

Re: New library for random variables

2017-01-11 Thread Krux02
Ok, I looked at it, and I do not really get what `where` does. All I got was that it samples from `p` until the condition is true, but then as far as I can see it does not use that value.

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread andrea
Does reactor support any kind of compatibility with the standard async? In particular, there is the module `asynchttpserver`: how hard would it be to port it to reactor? As a second question: what, if any, is the interaction between reactor event loop and threading? Would it be possible to buil

New library for random variables

2017-01-11 Thread andrea
Hi, I just wanted to mention that I have just published [Alea](https://github.com/unicredit/alea), a library to work with random variables. It is still in a pretty early stage, and some things may not work very well, but this is an example of use: import alea, future import ra

Re: Nim VFS (virtual file system)

2017-01-11 Thread LeuGim
This would be extremely cool! There was [some discussion](http://forum.nim-lang.org/t/937) on the forum about multiple modules per file, which could give some of the same advantages. And source-files archives treated as folders exist yet for Java and PHP (.jar and .phar).

Nim VFS (virtual file system)

2017-01-11 Thread jlp765
# The question is * (what is it)? * should Nim have a vfs? and part of answering the above question * is it a Nim way of doing things * if so, should it be part of stdlib or a nimble package # What is a vfs * packaging multiple files into an embedded or archived file (zip, tar, b

Re: collections.nim and reactor.nim v0.3.0 released

2017-01-11 Thread Krux02
I looked into your collections library, and I saw your View library. I have my own implementation of the same thing [here](https://github.com/krux02/opengl-sandbox/blob/master/glwrapper.nim#L8). Maybe it has minor differences, but generally it is the same thing. `openArray` in parameters also s