Re: questions on binding C DLL

2019-01-17 Thread oyster
Thanks I don't mean to throw tons of code line, so I extract some typical ( at least I think) function declaration lines, even in C header files they looks the same. The other lines, which I did not enclose here, can be treated by c2nim or my newbie's brain. As for the C header files, actually

Re: Nim nightly builds

2019-01-17 Thread shashlick
You would basically start with [https://api.github.com/repos/nim-lang/nightlies/releases](https://api.github.com/repos/nim-lang/nightlies/releases).

Re: Modified version of Kru02's interfaced

2019-01-17 Thread slangmgh
The following post have detailed explanation of Go interface. [https://forum.nim-lang.org/t/2422](https://forum.nim-lang.org/t/2422)

Re: Modified version of Kru02's interfaced

2019-01-17 Thread slangmgh
Current implementation doesn't support generic, because the vtable must be build at compile time when impl is called, but with generic, this is not possible, maybe we need the compiler to do it. :)

Re: questions on binding C DLL

2019-01-17 Thread moerm
We are not in your head nor do we have the C (or Basic?) source code in front of us. So if you throw some code line at us without any context it'll be hard for us to help you. Also note that the intersection of Nim and Basic developers is probably very small (as opposed to Nim and C) so asking q

Re: Building Minimal Docker Containers for nim Applications

2019-01-17 Thread juancarlospaco
Nim does not depend on any `*.go` Theres `nimlang/nim` docker image.

Building Minimal Docker Containers for nim Applications

2019-01-17 Thread geohuz
I've tried using the following Dockerfile: FROM scratch ADD jesterapp /jesterapp EXPOSE 5000 CMD ["/jesterapp"] but I got error message: 'standard_init_linux.go:207: exec user process caused "no such file or directory"' when running the container

Re: FOSDEM 2019

2019-01-17 Thread cdome
Thanks, very useful.

Re: How to get the address of an proc with same name and different parameter type

2019-01-17 Thread dom96
Might be simpler to just rename your procedures :)

Re: generic instantiation with object inheritance

2019-01-17 Thread rayman22201
duh. Of course. I forgot about method! I don't use OOP enough with Nim lol. not my favorite paradigm :-P

Re: yet another question on code substitution with templates

2019-01-17 Thread mratsim
Technically you could hack something by having DOP_COLOR generate code as string and then using parseStmt to convert that string to code. That's really hacking though. If you have a lot of statements it might be worthwhile to create your own mini declarative language and have a macro parse it.

Re: generic instantiation with object inheritance

2019-01-17 Thread mratsim
oh right it's either leaf or node, sorry hallucinated the code, there wouldn't be an extra dereference. I thought it was a node containing either node or payload.

Re: Modified version of Kru02's interfaced

2019-01-17 Thread kaushalmodi
I am not familiar with Go interfaces. Can you please add a README that briefly explains what your module is doing, and add few examples too? I see that you have an example.nim, may be put that inline in your README and explain that a little bit? Thanks.

Re: Nim nightly builds

2019-01-17 Thread kaushalmodi
Yes, that is known. That's the beauty of the nightlies repo; it caught a regression that happened only for 32-bit Windows. It was reported here: [https://github.com/nim-lang/Nim/issues/10340](https://github.com/nim-lang/Nim/issues/10340). And @GULPF is already working on fixing it in [https:/

Re: Modified version of Kru02's interfaced

2019-01-17 Thread boia01
That's a great set of improvements! Kudos. One thing I wanted to share -- to stimulate further improvements -- is that when I looked at interfaced earlier, I ended up passing up on it because it's not possible to provide type parameters for the interface itself, and for interface methods. This

Re: generic instantiation with object inheritance

2019-01-17 Thread e
Thank you @GULPF... this got me much further along.

Re: ability to undefine a symbol?

2019-01-17 Thread lotzz
Fair enough thanks for the time

Re: Modified version of Kru02's interfaced

2019-01-17 Thread slangmgh
Here is the source: [https://github.com/slangmgh/interfaced](https://github.com/slangmgh/interfaced)

Re: Nim nightly builds

2019-01-17 Thread zolern
Unfortunately for the last two builds only Windows x64 was built

Modified version of Kru02's interfaced

2019-01-17 Thread slangmgh
I have created a modified version of Kru02's interfaced. The original post is here: [https://forum.nim-lang.org/t/2422](https://forum.nim-lang.org/t/2422) This version include more feature: 1. interface can inherited from other interfaces 2. interface to base interface can be converted impli

Re: generic instantiation with object inheritance

2019-01-17 Thread GULPF
`proc` and `func` uses static dispatch. To enable dynamic dispatch, `method` must be used instead: [https://nim-lang.org/docs/manual.html#multiminusmethods](https://nim-lang.org/docs/manual.html#multiminusmethods) This appears to be working: type BBTree*[K,V] = BBLeaf[K, V]

Re: yet another question on code substitution with templates

2019-01-17 Thread oyster
the code is not too long for me to replace all DOP_COLOR(sth) with HIWORD(sth), LOWORD(sth) by hand. But it is some long for concat thus the code will be a mess. But to speak generaly, there is no something like #define A B directive in C, which only replace A with B literally, in nim, isn't? Y

Nim plugin for web bundler

2019-01-17 Thread nepeckman
For people not in the web dev space, web bundlers are a useful tool that helps manage the front end assets. They handle the compiling, dependency resolution, minification, cache busting, and any other transformation you want to do with your code. It's already possible to use Nim with a web bundl

Re: yet another question on code substitution with templates

2019-01-17 Thread alehander42
you need the template. do you need an array or a seq? your template should probably return a seq then in both cases you need to concat somehow dopColor with the other elemnts var opcodes = @[FL..].concat(DOP_COLOR(FL_RED)).concat(@[FL..]) Run you can't generate a a,

Re: generic instantiation with object inheritance

2019-01-17 Thread e
@mratsim, that's interesting... why is there an extra dereference? My mental model is that the initial version has six contiguous fields (header, key, val, size, left, right), whereas the space saving version has either three (header, key, val) or six (header, key, val, size, left, right) depend

questions on binding C DLL

2019-01-17 Thread oyster
first, some questions about pointer **question 1** void Fl_Widget_TrackerDelete(Fl_Widget_Tracker* & wt); Run c2nim says Error: token expected: ) **question 2** void flFileChooserCallback(void(*cb)(const char* f)); Run c2nim say

Re: generic instantiation with object inheritance

2019-01-17 Thread e
@rayman22201, thanks. Yikes, what a hassle. I would have expected Nim to do that discrimination in its method dispatch. Where is this kind of thing documented?

Re: yet another question on code substitution with templates

2019-01-17 Thread oyster
sorry, I can't still grasp the idea if emit is used, then how to use DOP_COLOR in nim code obviously, {. emit: """ #define DOP_COLOR(col) HIWORD(col), LOWORD(col) """ .} var opcodes = [ FL_DOP_COLOR ,DOP_COLOR(FL_RED), FL_DOP_LINE, ]

Re: yet another question on code substitution with templates

2019-01-17 Thread mratsim
Nim templates are hygienic and not plain text substitutions. The output of a template must be valid Nim syntax, the most similar would be a tuple: template DOP_COLOR(col: untyped):untyped= (HIWORD(col), LOWORD(col)) Run

Re: FOSDEM 2019

2019-01-17 Thread federico3
We created a dedicated Telegram group at [https://t.me/NimFOSDEM2019](https://t.me/NimFOSDEM2019) to avoid spamming the general discussion group.

yet another question on code substitution with templates

2019-01-17 Thread oyster
I have read [https://forum.nim-lang.org/t/3199](https://forum.nim-lang.org/t/3199) but I am still puzzled my situation is, I need the #define part works like that in C/FreeBasic, so if #define DOP_COLOR(col) HIWORD(col), LOWORD(col) Run then the code to create array

Re: yet another question on code substitution with templates

2019-01-17 Thread juancarlospaco
{. emit: """ #define DOP_COLOR(col) HIWORD(col), LOWORD(col) """ .} Run ?