Re: VS Code integration is great

2018-01-25 Thread Demos
I've been looking for a more free editor with c++ and nim support. It's hard to find, and I don't like that emacs is totally impossible to make user friendly (for example it won't scroll less than one whole line at a time). I'll try Kakoune!

Re: Windows: "import posix" => 'arpa/inet.h': No such file or directory

2018-01-25 Thread Demos
Also some versions of windows are actually somewhat posix compliant, although not in very useful ways

os.putEnv limited to application's scope?

2018-01-25 Thread deooo
Hi there, I would like to permanently store some data in environment variables. I'm running the code with nim-0.17.2 on windows, and I'm fine storing data as user environment variables. The data is not visible outside of the nim application, and it's not available when I run the program for the

Re: Json key names encoding

2018-01-25 Thread dom96
Nim offers similar functionality via the `to` macro, but indeed it doesn't support fields that begin with a number. I created an issue for this: [https://github.com/nim-lang/Nim/issues/7139](https://github.com/nim-lang/Nim/issues/7139). Depending on your JSON you may be able to use a combination

Re: postContent with custom header

2018-01-25 Thread dom96
There is no need for this procedure to be exported. You should use the `post` procedure which uses this `format` proc: [https://github.com/nim-lang/Nim/blob/master/lib/pure/httpclient.nim#L1197](https://github.com/nim-lang/Nim/blob/master/lib/pure/httpclient.nim#L1197)

Re: Json key names encoding

2018-01-25 Thread frogEye
Thanks yglukhov for the reply. It just an observation as I have just started with nim-lang. So may be I was looking at things which I could do really fast in go to be in nim. I will take some time to get used to nim

Re: Json key names encoding

2018-01-25 Thread yglukhov
@frogEye. That is true because nim ideology differs a lot from go. Instead of providing some high level feature the nim compiler will tend to provide you with rich metaprogramming capabilities, and with those you can implement high level features that look and feel like native nim constructs. E.

Re: Json key names encoding

2018-01-25 Thread frogEye
Thanks, dom96 . But still, the ease with which we can unmarshal and marshal json into a data structure in Go-lang is uncomparable.

Re: postContent with custom header

2018-01-25 Thread Hlaaftana
This would work if format in httpclient was exported. For now copy and paste [this proc](https://github.com/nim-lang/Nim/blob/master/lib/pure/httpclient.nim#L438-L457) (and import random) import httpclient let data = newMultipartData({ "data1": "value1", "data2

Re: Partial casing is foo_bar

2018-01-25 Thread Lando
> There is an easy solution to this problem: case insensitive and style > insensitive search (which is supported by nimgrep) Most people edit their code in an editor or IDE, not with an external program. And they don't like it when a language pushes another tool on them that, from their perspec

Re: Nim bindings to a DLL?

2018-01-25 Thread matkuki
Thanks for the explanation @yglukhov ! Did the **pragma** pragma maybe work differently two years ago when the wrapper was made? Why else would _{.pragma: stdcall.}_ be used there? **{.push stdcall.}** seems to be invalid, so I used: when defined(windows): ... {

Re: problem with template (or types)(i think)

2018-01-25 Thread SolitudeSF
> b is a bad name for a proc/template anyway. well, kinda, but it should only work on specified type, so i dont think its a problem. and why would changing type of `img` parameter change the behavior if its not even used in proc's body?

Re: Nim bindings to a DLL?

2018-01-25 Thread yglukhov
The standalone {.pragma: stdcall.} doesn't do anything, so you end up with default nim calling convention, which is fastcall on windows iirc. The pragma should be either pushed {.push stdcall.} or appended to every proc. Now regarding why both cdecl and stdconv. They really should not, but maybe

Re: Weird problem with WNDPROC assignment

2018-01-25 Thread nucky9
I have also been trying to implement the HandmadeHero series using Nim. The reason why WNDCLASS was failing to initialize, is because it is required that it is gcsafe. However, WNDCLASS needs to call MainWindowCallBack, and MainWindowCallBack accesses the Win32OffScreenBuffer type. The problem

Re: Error: 'XXX' is not GC-safe as it accesses 'YYY' which is a global using GC'ed memory

2018-01-25 Thread nucky9
The issue isn't with the assert specifically, but rather because you are comparing your function pointer to nil (see here: [https://github.com/nim-lang/Nim/issues/6955)](https://github.com/nim-lang/Nim/issues/6955\)). If you want, you can disable the warning by using the {.gcsafe.} pragma:

Re: postContent with custom header

2018-01-25 Thread mashingan
My bad, I thought from multipart data it was obvious. What I wanted to do was like this import httpclient var data = newMultipartData({ "data1": "value1", "data2": "value2", "data3": "value3" }) var customHeaders = newHttpHeaders({ "Conte

Re: Nim bindings to a DLL?

2018-01-25 Thread matkuki
@yglukhov, THANK YOU for nudging me into trying something! If you look at the [pdcurses](https://github.com/lcrees/pdcurses/blob/master/pdcurses.nim), it has this code: when defined(windows): ... const PDCURSED = "pdcurses.dll" {.pragma: stdcall.} else