Re: thounghs about Nim language in godot

2017-08-04 Thread endragor
Who cares how many files it creates? Only what you use (import) gets compiled. C++ and D bindings have to generate the same number of classes. "The settings need so much steps" \- not sure what this refers to. If you have Nim and Godot you basically only have to install nake and set GODOT_BIN e

Re: netwatch 1.0.0 - network monitor written in nim

2016-10-10 Thread endragor
Great work! It would be nice if pieces of this tool are turned into libraries (hopefully, copyfree). Right now there are no Nim libraries that allow to get network interface information in a structured way. For example, a procedure that returns a seq of interfaces with their info (what ifconfig

Re: StackOverflow Nim Documentation Proposal

2016-09-07 Thread endragor
The "Edit" button idea is actually **very** nice. I often see issues in documentation, but am too lazy to go to terminal, cd Nim, create branch, make change, push branch, create PR (or do the same from GitHub UI) for a small change. If there is a button on each page that goes straight to editing

Re: How to change the buffer malloc from c code?

2016-09-01 Thread endragor
Use zeroMem,`copyMem`, moveMem, equalMem to operate on raw memory. In your case: const myString = "I change this" copyMem(cs, cstring(myString), myString.len + 1) # +1 because null byte has to be copied, too

Re: async I/O API: why strings?

2016-08-31 Thread endragor
vega, Alright, it seems I overstated about the burden. As long as async macro it used, users are fine, because addr result points to heap (to iterator's closure environment). But great caution should be taken if async is not being used. Even if it's not networking lib, it should clearly define

Re: programming ligatures

2016-08-31 Thread endragor
Yeah, I've been using this font since VSCode Nim plugin was created. The best font I've seen so far for Nim and as a programming font in general.

Re: async I/O API: why strings?

2016-08-30 Thread endragor
vega, Could you show a safe non-GC version of readInt proc (btw, it shouldn't exist in a networking lib because of undefined size and endianness of int)? As I see it, by introducing raw pointer **async** send/recv procs, stdlib would just move burden to the user. To safely implement readInt you

Re: async I/O API: why strings?

2016-08-29 Thread endragor
Last I heard there was a plan to make asyncdispatch provide low-level unsafe methods that accept raw pointers, while higher-level modules (like asyncnet) would provide methods that work with GC-safe stuff. In your case it seems the problem is that you pass pointer to GC data to an async proc wi

Re: reactor.nim 0.0.1 - an asynchronous networking library - is released

2016-08-29 Thread endragor
andrea, You could try to setup server sockets from multiple threads with SO_REUSEPORT|SO_REUSEADDR flags, instead of having single server socket in the main thread. That way, different threds may accept connections on the same address/port pair, while OS tries to evenly distribute load between

Re: Is it possible to import C #define constants without knowing their values?

2016-07-31 Thread endragor
This is a similar issue: [https://github.com/nim-lang/Nim/issues/4441](https://github.com/nim-lang/Nim/issues/4441) There is a workaround offered in comments that is to import the constant as a procedure instead of a variable: proc foo(): cint {.importcpp: "FOO@".}

Re: VSCode Editor Nim Extension (free Visual Studio Code Editor by Microsoft)

2016-07-15 Thread endragor
didlyborn, did you restart VSCode after installing the plugin? The plugin supports autocompletion, go to definition, error/warning highlight and few other things. If it doesn't even highlight errors for you, it most likely is not enabled or cannot find Nim. Error highlight relies on nim check co

Re: Determining backend configuration at compile time

2016-07-14 Thread endragor
I don't know if such constant is already defined (seems not), but you could use something like this: type Backend {.pure.} = enum C, CPP, OBJC, JS, PHP const backend = when defined(cpp): Backend.CPP elif defined(objc): Backend.OBJC