Re: TDD reference project

2019-01-03 Thread juancarlospaco
Wow!, great initiative and interesting lib!. :)

Re: TDD reference project

2019-01-03 Thread novikov
Writing a mocking library. [https://github.com/mem-memov/mocknim](https://github.com/mem-memov/mocknim) Hopefully it will be able to mock itself at least.

Re: trouble during wrapping a windows DLL

2019-01-03 Thread oyster
do you mean proc OnClick*(bHandle: var bool): cint {.exportc, cdecl.} = setupForeignThreadGc() var sel = XC_MessageBox(nil, "炫彩界面库pText", "pCaption", 1) bHandle = true result = 0 tearDownForeignThreadGc() Run it

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread Libman
I recommend the following: * Creating a simple wiki server in Nim (possibly backed by [Fossil](https://en.wikipedia.org/wiki/Fossil_%28software%29)), in similar style and UX as this forum (but Markdown support would be great). * Moving all content from [the GitHub

GSoC 2019

2019-01-03 Thread dom96
This time of the year is here again. The Google Summer of Code org applications are opening soon, with our new man-power I think it would be a great opportunity to have another shot. **The deadline is February 6 2019** [[1]](https://developers.google.com/open-source/gsoc/timeline). We have

Re: Creating instance of ptr "object" from instance of "object"

2019-01-03 Thread Stefan_Salewski
I may miss something... You know alloc and alloc0 from manual? That procs can be use to allocate memory for untraced pointers on the heap. Like var myMethodDef: PyMethodDefPtr = cast[PyMethodDefPtr](alloc0(sizeof(PyMethodDef)) myMethodDef[] = PyMethodDef(mlName :

Creating instance of ptr "object" from instance of "object"

2019-01-03 Thread calebwin
So I'm trying to embed Python in Nim using the nim-lang/python port. In src/python.nim there's this code - PyMethodDefPtr* = ptr PyMethodDef PyMethodDef*{.final.} = object # structmember.h mlName*: cstring mlMeth*: PyCFunction mlFlags*: int mlDoc*:

Re: Calling stdcall from .dll

2019-01-03 Thread lightern
Thanks, I changed my code a bit and used {.dynlib.} and it worked! Here's the code I'm using: import math proc square*(x: float64): float64 {.stdcall,exportc,dynlib.} = return x * x Run

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread lux
Hi, I've started to learn Nim since about 2 weeks, started with the 'official tutorial' which was excellent and covered all I needed to know to get started. I also looked at the other tutorials and they where great to get started from scratch. What would be even more helpful is some more code

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread refaqtor
I have noticed some improvement in compiler messages. But, I have a further suggestion. It seems, though I may be wrong, that when I hit some compiler error, it is because I don't understand the usage or syntax of something very particular - I still fumble over template syntax - though I do far

non-blocking stdin.readLine() - what's a good strategy?

2019-01-03 Thread refaqtor
"non-blocking stdin.readLine()" sounds like an oxymoron... but, what I mean is, I'm trying to have an executable that needs to keep working on other "tasks" in a list, that also can append new "tasks" from the console without blocking continual processing of the other "tasks". I had made safe

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread aredirect
Hi! Thanks for listening to the community and Good luck @miran (and everyone) in making nim better! Documentation can be classified into * Soft documentation (clean examples, tutorials how to do X, or building applications e2e this is a major factor) * Hard (reference) documentation

Re: Best practices of meta-programming

2019-01-03 Thread Araq
You probably said it already, but this idiom served me well: macro m() = ... when defined(nimDumpM): echo repr result Run Other random notes: * don't turn Nim into C with `converter toBool(x: int): bool` * Don't overload macros/templates that

Re: Compiling with GCC optimizations disabled

2019-01-03 Thread SolitudeSF
its already -O0 for debug build, by default

Re: Compiling with GCC optimizations disabled

2019-01-03 Thread lqdev
Oh, I just forgot the `-g` flag. Thank you anyways!

Compiling with GCC optimizations disabled

2019-01-03 Thread lqdev
Is it possible to pass `-O0` to C in order to disable all optimizations? I have a problem with a C library I'm compiling and accessing from Nim, and I want to see what I'm doing wrong more clearly. I tried to pass `--passC:"-O0"` and `passC="-O0"` but both seem to have no effect on debugging

New repo for RFCs

2019-01-03 Thread miran
Nim RFCs are transferred from nim-lang/Nim repo to a new home: [https://github.com/nim-lang/RFCs](https://github.com/nim-lang/RFCs) What this means is that you shouldn't open new issues in the main Nim repo to discuss your proposals for the language anymore. The idea is to have a more formal

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
Thanks for that clear statement. I'm learning and drawing my conclusions.

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread Araq
> Hint: Araq recently said that the manual on GC_ref/unref is basically wrong. And then I changed my mind, it's correct. For the default GC. It is a bad interface. > This, ladies and gentlemen is what I would call a major clusterf_ck and it > doubtlessly results in many unnecessary problems,

Re: trouble during wrapping a windows DLL

2019-01-03 Thread moerm
I see 2 major factors and the only reason I'm mentioning them is my optimistic hope that someone concerned will read and think about it: * Nim's docu is poor in many places, let's be honest. * people should understand that there is a strong relation between the quality of a question and the

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
As a somewhat rude demonstration: From the help for module system proc GC_ref[T](x: ref T) {...} # empty proc GC_ref[T](x: seq[T]) {...} # empty proc GC_ref(x: string) {...} marks the object x as referenced, so that it will not be freed until it is unmarked via

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread mratsim
>From a library writer point of view, I miss tooling for maintainable project >documentation generation. Something that goes beyond a one-pager. For example >to generate [this kind](http://docs.chainer.org/en/stable/) of >[documentation](https://ml.dask.org/preprocessing.html).

Re: trouble during wrapping a windows DLL

2019-01-03 Thread Stefan_Salewski
> I don't have too much time and experience in programing Without time and experience it is really not easy I guess. Maybe you can hire someone? Unfortunately I do know nothing about VirtualBasic. Maybe the calling convention of your OnClick proc is wrong? For C procs I used cdecl pragma, you

Re: trouble during wrapping a windows DLL

2019-01-03 Thread shashlick
Look up the setupForeignThreadGc proc. [https://nim-lang.org/docs/system.html#setupForeignThreadGc.t%2C](https://nim-lang.org/docs/system.html#setupForeignThreadGc.t%2C) This conversation also might help. [https://forum.nim-lang.org/t/3965](https://forum.nim-lang.org/t/3965)

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread arnetheduck
I enjoyed rust's documentation a lot, both when learning the language and when working with it - here's a good example: [https://doc.rust-lang.org/std/result/enum.Result.html](https://doc.rust-lang.org/std/result/enum.Result.html) * explanations that zoom in and out - both methods, classes

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread novikov
I'm trying Nim for the first time, four days to be precise. I had a couple of moments when I did not understand compiler messages. I did not know which places in my code to look at. With some luck I found good suggestions on the Internet. If I hadn't found these solutions I wouldn't be using

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
* real documentation - as opposed to just proc comments * Examples, examples, examples * Explanations for more difficult matters like async, threading, etc. Something like page or two only "generally" explaining how those work in Nim (from there the user can go to the modules normal docu

Re: it is hard to load forum.nim-lang.org for months

2019-01-03 Thread oyster
I have tried to go here with and without Lantern.

Re: trouble during wrapping a windows DLL

2019-01-03 Thread oyster
I don't know Go-lang, and I don't have time to learn it. As I always state, I _do not_ make a living on programing, I only program in my spare time, sometimes I make some app to help me or co-worker in job. That is why I use Python mainly because Python is simple and has tons of libraries which

Re: interesting exercise in Nim metaprogramming: Clojure-inspired data

2019-01-03 Thread andrea
I am not sure about the rationale for this design. Why don't you just export type PostalCode* = distinct string Run and then use this type elsewhere? In this way, you can leverage Nim type system. I am not really familiar with Clojure, but it looks like this design

Best practices of meta-programming

2019-01-03 Thread novikov
What are the best practices of meta-programming? And what are anti-patterns? So far I could find: * provide debugging info * check AST node type before doing anything with it

"Nim needs better documentation" - share your thoughts

2019-01-03 Thread miran
One of the most frequent complaint about Nim is that it lacks proper documentation. For example, it is mentioned in [2017 community survey](https://nim-lang.org/blog/2017/10/01/community-survey-results-2017.html), [2018 community

Re: trouble during wrapping a windows DLL

2019-01-03 Thread oyster
I have found that no mmatter the is cast[cstring] or not, the compiled app still crash after I click the button and the msgbox shows here is the line in C header XC_API BOOL WINAPI XEle_RegEventC(HELE hEle, int nEvent, void *pFun); Run here is what VB code does

Re: trouble during wrapping a windows DLL

2019-01-03 Thread genuinejedi
There's a complete wrapper in Golang already it might help you with developing a nim version: [https://github.com/CodyGuo/xcgui](https://github.com/CodyGuo/xcgui) Will you also write some kind of documentation ?

Re: it is hard to load forum.nim-lang.org for months

2019-01-03 Thread genuinejedi
Are you connecting from Mainland with or without a VPN ?

Re: trouble during wrapping a windows DLL

2019-01-03 Thread Stefan_Salewski
XEle_RegEventC( hBtn, XE_BNCLICK, cast[cstring](OnClick)) Run Casting onClick proc to cstring? I may vote for removing cast operation from Nim.

trouble during wrapping a windows DLL

2019-01-03 Thread oyster
I am trying to write a binding for www.xcgui.com which is a GUI lib for windows. The initial code is on [https://github.com/retsyo/xcgui_nim](https://github.com/retsyo/xcgui_nim) but I met some questions. for example import ../../xcgui import winim/inc/[windef, wingdi]