Re: [C backend] On const qualifier again

2019-12-09 Thread foldl
I won't write `const` everywhere. If I see a parameter `a_type_t *p` in a function is decorated with `const`, I am happy because its side effects seem to be _under control_. > We can simply make all parameters `const` since that's Nim semantics anyway. I can't understand this. The first

Re: [C backend] On const qualifier again

2019-12-09 Thread Araq
We can simply make all parameters `const` since that's Nim semantics anyway. But I doubt it will work better. > Oh, by the way, in C, I like to use const whenever possible. Good for you, but there is no evidence whatsoever that the cost of writing `const` everywhere (and the cognitive load

How to run nim code in Atom editor

2019-12-09 Thread kcvinu
Hi all, I am struggling to find a way to run my nim code in Atom editor. I've installed the nim extension, so i can see colors in my code, the linter is also working perfectly. But i find its quite hard for me to run my code. In VS code, it was very easy. For nim files, we can add our cmd

[C backend] On const qualifier again

2019-12-09 Thread foldl
Hi all, There are already lots of discussions on this. I find that we need to discuss it further in a generalized manner: interfacing with C without a `const` equivalent qualifier. * **Case 1: Global constant values** const int value[] = {1,2,3}; Run This has

Re: Recommended GUI library?

2019-12-09 Thread dawkot
Is there a good reason people often don't even mention QML in these threads?

Re: Recommended GUI library?

2019-12-09 Thread Stefan_Salewski
> Same pattern goes for gtk3. The only upto date gtk binding lacks any form of > API reference, and it's been a couple years. We had the discussion (again) some days ago at GTK forum:

Re: Recommended GUI library?

2019-12-09 Thread Araq
> None of them has any API documentation, let alone any websites. It's > frustrating not to see any form of documentation other than "looking at > existing the project that uses both". Both have documentation at the github entry page but it's a very good point regardless. I'll see if I'll

Re: Nim compiling using MS VS2015 (windows)

2019-12-09 Thread Lecale
I don't think mingw32 is perfect , at least, I blame it for getting stuck with this issue [https://gitlab.com/define-private-public/stb_image-Nim/issues/8](https://gitlab.com/define-private-public/stb_image-Nim/issues/8)

Re: Recommended GUI library?

2019-12-09 Thread adnan
What's Nim's killer app/library? Jester and Karax? None of them has any API documentation, let alone any websites. It's frustrating not to see any form of documentation other than "looking at existing the project that uses both". Same pattern goes for gtk3. The only upto date gtk binding lacks

Re: Recommended GUI library?

2019-12-09 Thread marks
I'm starting to experiment with NiGui. I'm trying to create "widgets" that maintain some state and that can communicate events between the child widgets they contain. I also want to modularise the code into separate functions and objects. Here's my first hack on your example 10 (see also a

Re: Godot and Blender

2019-12-09 Thread rayman22201
This is a huge pet peeve of mine. Nim and Python are very different languages! There is some similarity in the syntax, but that is where it ends. Nim is much closer to Ada or Pascal :-P I looked into adding Nim support to Blender a long time ago. Here is what I found: TLDR; It would be

Re: Recommended GUI library?

2019-12-09 Thread rayman22201
nimx: [https://github.com/yglukhov/nimx](https://github.com/yglukhov/nimx) The documentation is lacking, but it's maintained, performant, and cross platform

Re: How to get rid of [ProveInit] warning?

2019-12-09 Thread rayman22201
I understand what you are saying now. Based on your last reply, I modified the macro to take a "default initialization expression" parameter: [https://play.nim-lang.org/#ix=23Zl](https://play.nim-lang.org/#ix=23Zl) The syntax could be made "more beautiful" but I think it closely approximates

Re: Recommended GUI library?

2019-12-09 Thread phillvancejr
Hey @marks, you're right it should be added there. It is an old package and is just in maintenance mode so it definitely needs some updating. I'm not the original creator of the bindings but I plan on making a pull sometime in the near future to update it with my changes and instructions for

Re: Nim compiling using MS VS2015 (windows)

2019-12-09 Thread demotomohiro
If you want Nim to C/C++ compiler in MS visualstudio, just call nim with \--cc:vcc option. If you want to see how Nim call cl.exe, add \--listcmd option. For example: nim c --cc:vcc --listcmd test.nim Run If you want Nim always use cl.exe, add cc = vcc in nim.cfg.

Re: Recommended GUI library?

2019-12-09 Thread Trustable
I'm the author of NiGui. @rockcavera Please create an GitHub issue for the refresh issue you described. Maybe it's easy to fix. @marks You're right, the documentation is still a missing part.

Re: Fastest way to check for int32 overflows

2019-12-09 Thread e
I keep this CMU SEI bookmark _ as a reference for whenever I need to deal with overflow in C... it's probably useful for safe cross platform Nim coding, too.

Re: Recommended GUI library?

2019-12-09 Thread marks
I didn't even know there was a wxWidgets port. When I searched the nimble package site for "gui" it didn't find it (maybe it isn't there) and nor is it mentioned in the Curated Packages. Probably good if you put it in one or both those places so people could find it:-) Also might help if you

Re: Docker image for cross compiling

2019-12-09 Thread jinnguyen019
please provide some guide for cross arm building

Re: Nim forum confirmation email has no date

2019-12-09 Thread anthonix
Yeah but I don't have a github account, so I am reporting here. If possible can someone here report it?

Re: Fastest way to check for int32 overflows

2019-12-09 Thread Stefan_Salewski
> Anyway, why are i32 integers the fastest when performing calculations? Some CPU may have no 64 bit data type at all, like some ARM and embedded chips. So for int64 addition we would get two operations at least, one plain addition and one add with carry. Even for a CPU with 64 bit support a

Re: How to debug a segmentation fault?

2019-12-09 Thread AmbrusFernas
I'm working on a Reverse Polish Notation calculator for my Data Structures class and I get a segfault when I pass arguments to the program at runtime. How do you guys troubleshoot errors without line numbers?

Re: Fastest way to check for int32 overflows

2019-12-09 Thread AmbrusFernas
I tried searching it but I couldn’t find anything, could have been me not using the right words though  Anyway, why are i32 integers the fastest when performing calculations? I think this is the case for C/C++ too so I’m assuming it’s an architectural thing.

Re: Nim compiling using MS VS2015 (windows)

2019-12-09 Thread AmbrusFernas
iv made some progress. so uh... [https://gyazo.com/47eb4eac97fa584b10f26e9a6b8b765e](https://gyazo.com/47eb4eac97fa584b10f26e9a6b8b765e) i was following the guide and this step doesnt seem doable (bin/nim c koch) the bin is empty. also tried using the aphoria ide but there isnt and exe to run

Re: generic typevariable binding

2019-12-09 Thread e
Thanks, I created [https://github.com/nim-lang/Nim/issues/12863](https://forum.nim-lang.org/postActivity.xml#https-github-com-nim-lang-nim-issues-12863)

Re: Nim forum confirmation email has no date

2019-12-09 Thread juancarlospaco
Report the Bug, its Open Source. :)

Re: How to export custom exception types?

2019-12-09 Thread mp035
Duh (feeling silly). Thank you.

Re: How to export custom exception types?

2019-12-09 Thread SolitudeSF
you didnt export extraData field.

Nim forum confirmation email has no date

2019-12-09 Thread anthonix
The email that is sent after registering at forum.nim-lang.org contains no date header.

Re: How to export custom exception types?

2019-12-09 Thread lscrd
Exporting the type is not enough. You need to mark the fields you want to export with an * too. So, here, put an * after "extraData": type myModuleException* = ref object of Exception extraData* : uint32 Run

How to export custom exception types?

2019-12-09 Thread mp035
Hi, I'm having trouble using custom exceptions; any clue what I'm doing wrong here: mymodule.nim: type myModuleException* = ref object of Exception extraData : uint32 proc myModuleFunc*() = var ex : myModuleException new(ex) ex.extraData = 12

Re: Recommended GUI library?

2019-12-09 Thread JPLRouge
I tested back and forth and it works. I even got into the code and it works. moreover you can use a designer or do everything by hand ...

Re: Recommended GUI library?

2019-12-09 Thread phillvancejr
Hello, I personally use the wxWidgets bindings. There isn't a ton of documentation on the Nim bindings specifically, but between the examples and wxWidgets c++ documentation, it is easy enough to navigate. Check out he wxWidgets window creation example I just uploaded to Rosetta Code,

Re: TXT DNS lookup

2019-12-09 Thread enthus1ast
There is also cheatfate's asyncdns in asynctools repo. But have not tried it lately.

Re: Recommended GUI library?

2019-12-09 Thread enthus1ast
The best/most advanced gui library for nim is afaik gintro (gtk). I can also recommend web view for smaller things.

Re: How to peek and/or advance an iterator inside a for loop

2019-12-09 Thread mratsim
Write you own iterator (pseudo code, not checked even for indentations) import parseUtils # for parseint suitable to advance cursors iterator customSplit(splitToken: char, tokenStream: string): int = var cursor = 0 var code = low(int) # just a default value to

Re: generic typevariable binding

2019-12-09 Thread mratsim
Yes please create an issue, thanks for the example. Seems like an instance of too strong type bindings for int. This RFC covers what Nim type bindings rules are in-depth [https://github.com/nim-lang/RFCs/issues/153](https://github.com/nim-lang/RFCs/issues/153) but I unlike the examples given

How to peek and/or advance an iterator inside a for loop

2019-12-09 Thread adnan
Something similar to [https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next](https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next) and

Re: Using setLen after newSeqOfCap is not safe?

2019-12-09 Thread mratsim
`setLen` only changes the length, it does not initialize with zero except in one case, when Nim needs to reallocate the seq because the reserved buffer was too small but AFAIK that's the OS that gives zero-ed out memory pages by default. That can be seen with s =

Re: Recommended GUI library?

2019-12-09 Thread marks
I've now tried the "hello world" program for all those that claim to be cross-platform (at least Linux & Windows). Most don't actually work on Windows, and all but one requires at least one `.so` or `.dll`. The one exception is [NiGui](https://github.com/trustable-code/NiGui). This is pure Nim