Re: How do I create and raise a custom exception?

2017-03-16 Thread vega
See [https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L438](https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L438) and [https://github.com/nim-lang/Nim/blob/master/lib/pure/os.nim#L137](https://github.com/nim-lang/Nim/blob/master/lib/pure/os.nim#L137) for example

Nim can be Haskell :-)

2017-03-16 Thread vega
Nim can be Haskell This is an example from the real project. This code reads application config from json with defaults handling in functional style. It uses `data` macro from the `nimboost` library to generate immutable data structures, constructors, `copy` operators, and functional types and

Re: Nim Syntax ''Skins''

2017-02-22 Thread vega
Wow, didn't know about syntax skins. This feature needs to be documented What do you think about the possibility to specify syntax skin described in external nim source? This can be used like the reader macros in Lisp or like readtables in sweet.js

Re: Can't get generic parameters of ref object in macro

2017-02-22 Thread vega
@Krux02, thanks, that's it!

Can't get generic parameters of ref object in macro

2017-02-21 Thread vega
How can I get generic parameters of ref object in this example? import macros type A[T] = object x: T type B[T] = ref object x: T macro genConstructor(`type`: typed): untyped = let t = `type`.getType[1] if t.typeKind == ntyGenericBody:

Re: Nim core developer wanted

2017-02-14 Thread vega
> We will introduce you to the compiler internals, garbage collector internals > and anything else that may be required to work on Nim. @dom96, please record these introductions in some form and publish them. It will be the great help for newbies

Re: [RFC]: What's wrong with me or with httpclient :-)

2017-02-10 Thread vega
Interesting. I got the results above on Ububtu 16.04. Rechecked on Windows 8. The problem is that SyncClient test is so slow only on linux! And it's faster then DeprecatedAPI on windows. Debugging shows that it hangs for some time here:

[RFC]: What's wrong with me or with httpclient :-)

2017-02-09 Thread vega
I don't want to file an issue, because maybe the problem is in my code. Below is the minimal test (also available [as gist](https://gist.github.com/vegansk/8d4126fa5205f1d86145891b02467f46)). So, the problem is that if I use deprecated API from httpclient, I get maximum performance while

Re: Concept[T] design question

2016-12-07 Thread vega
@andrea, see this log from gitter Anatoly Galiulin @vegansk Nov 30 17:03 Hi to all. It was a long road back to Nim I have a question about generic-concepts branch (https://github.com/nim-lang/Nim/tree/generic-concepts). Is it dead? GitHub says "836 commits behind devel".

Re: StackOverflow Nim Documentation Proposal

2016-09-14 Thread vega
@Araq, can the search be optional? For example, I don't need it here: [http://vegansk.github.io/nimboost/docs/0.3.0/boost/data/rbtreem.html](http://forum.nim-lang.org///vegansk.github.io/nimboost/docs/0.3.0/boost/data/rbtreem.html)

Different naming schemes for buffers in I/O

2016-09-06 Thread vega
While working on PR [https://github.com/nim-lang/Nim/pull/4683](https://github.com/nim-lang/Nim/pull/4683), I found some different naming schemes in I/O while working with buffers. For example: * `readBuffer/writeBuffer` in system.nim, asyncfile.nim (from PR) * `recv/send` in net.nim *

Re: async I/O API: why strings?

2016-08-31 Thread vega
@endragor, I agree about the endianness problem. For now, `asyncstreams` copies API from `streams`. Next, we can add BE/LE functions to the both these modules to unify the API.

Re: async I/O API: why strings?

2016-08-31 Thread vega
@endragor, here it is. And it's not for network lib, it's from my new library `asyncstreams`.

Re: async I/O API: why strings?

2016-08-30 Thread vega
@Krux02, `seq[byte]` deals with GC. And If I need to implement readInt for the stream for example, first of all I'll read seq of sizeof(int) bytes and then `copyMem` them into result. Too much overhead. I need the pointer and size pair to remove that overhead.

Re: async I/O API: why strings?

2016-08-30 Thread vega
Now there are another questions about current asyncdispatch implementation :) 1. Isn't it a leak here: [https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L835](https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L835)? GC_unref will be called only if

Re: async I/O API: why strings?

2016-08-30 Thread vega
Thanks to all, I got it. I agreed with @_tulayang, we need both low and high level APIs.

Re: async I/O API: why strings?

2016-08-29 Thread vega
@dom96, you are the author of async libraries, don't you? Maybe you can help me with it. Here is my experiments with it: [https://github.com/vegansk/Nim/tree/async_buffers](https://github.com/vegansk/Nim/tree/async_buffers). I don't want to create the PR right now. Here is the problem. The

async I/O API: why strings?

2016-08-29 Thread vega
What is the reason to use the `string` as the buffer to send data and `Future[string]` to receive data asynchronously? And it's the standard for asyncdispatch, asyncnet and asyncfile. For example, synchronous API works with strings and with data pointers. So, is it related with interoperability

Re: dts2nim: A TypeScript -> Nim bridge

2016-08-26 Thread vega
Wow, cool! Thats what I wanted to do in the nearest future :) But I want to create this tool as a Nim macro that imports .d.ts files at compile time

Re: asynchttpserver and big request body

2016-08-26 Thread vega
@_tulayang, I think that `asyncstreams` must implement generic streams, not http. And API that you suggest can be implemented in asynchttpserver or another http related module, but not in generic streams. More opinions?

Re: asynchttpserver and big request body

2016-08-25 Thread vega
WIP is here: [https://github.com/vegansk/asyncstreams](https://github.com/vegansk/asyncstreams)

Re: asynchttpserver and big request body

2016-08-25 Thread vega
I created the fork of asynchttpserver for the test: [https://github.com/vegansk/asynchttpserver2](https://github.com/vegansk/asynchttpserver2) where you can read entire body using `request.body.readAll`, get the length of the request without reading it via `request.body.len`. And the main

asynchttpserver and big request body

2016-08-24 Thread vega
Request body is readed in memory at once. So, we can't receive big `POST` requests. Maybe we can introduce new type, `RequestBody`, that can be used to get body as a string/file/stream/whatever, or maybe even handle `application/x-www-form-urlencoded` or `multipart/form-data mime types`?

Re: Calling Nim compiled to dll from Java programs?

2016-07-20 Thread vega
@alexsad, you can do it using low level bindings (jnim.private.jni_wrapper) from jnim library for now, but it's no good. I'll make high level API for that ASAP.

Re: What are the important features that are missing in Nim?

2016-06-27 Thread vega
moigagoo, did you try this? [https://github.com/vegansk/nrpl](https://github.com/vegansk/nrpl)