Re: Who owns the widget in this example?

2019-09-02 Thread Araq
That's what I said. ;-)

Re: Who owns the widget in this example?

2019-09-02 Thread GordonBGood
@Araq: and all... Since no one else seems to have filed an issue on this, I just did as [issue#12116](https://github.com/nim-lang/Nim/issues/12116). I further refined the problem as it has nothing to do with having global variables or seq's, but only to do with passing an owned ref to a sink pr

Maintenance Skills of Water Dispenser Tap & Faucet

2019-09-02 Thread kokoele
Water Dispenser Tap & Faucet(KOKOELECTRIC) [https://www.kokoelectric.com/product/water-dispenser-tap-faucet](https://www.kokoelectric.com/product/water-dispenser-tap-faucet)/ are indispensable commodities in modern society. Although they are only small faucets, we should pay attention to main

Re: Statically reflect on procs in scope that dispatch on some type T.

2019-09-02 Thread deech
I guess you're right that it would need a change to the compiler but AFAICT 'proc' fields of an object are in the same situation and we have an iterator (more precisely an unrolled for-loop) for field name/type pairs.

Re: Problem with var T dynamic dispatch and iterators

2019-09-02 Thread Araq
For ASTs use a Nim "case object". Nothing else works as well.

Re: Statically reflect on procs in scope that dispatch on some type T.

2019-09-02 Thread Araq
I don't think it's possible and even if it were, you couldn't invoke the procs since their parameter types would vary quite a bit.

Statically reflect on procs in scope that dispatch on some type T.

2019-09-02 Thread deech
> Is there a way to statically reflect on proc's in scope that accept some > object as their first argument? For example, I'd like to do something like: # module M1: type O = object proc p1(o:O) = discard proc p2(o:O) = discard # module M2 import M

Re: replace c2nim by gcc work tracing to automate complex library bindings (Gtk, Qt, LLVM, Boost,...)

2019-09-02 Thread shashlick
Do you mean to create the AST? Well I did look into it but it is a huge dependency, especially on Windows and Linux. tree-sitter allows for a really light dependency that can be easily deployed cross-platform. Further, I am only looking at creating wrappers, not conversion of implementation out

Re: Problem with var T dynamic dispatch and iterators

2019-09-02 Thread SilentObserver
Thanks for the response! Though I do not try to use dynamic dispatch for iterators, am I wrong? I directly check runtime type inside of the iterator, so it is always using the only iterator version , `Ast` one, isn't it? Anyway, I found my original problem. It was because type `D` can only hold

Re: Problem with var T dynamic dispatch and iterators

2019-09-02 Thread LeuGim
An illustration. type A = ref object of RootObj B = ref object of A method m(v: A) {.base.} = echo "mA" method m(v: B) = echo "mB" proc p(v: A) = echo "pA" proc p(v: B) = echo "pB" iterator items(v: A): string = yield "iA" iterator items(v: B): stri

Re: Problem with var T dynamic dispatch and iterators

2019-09-02 Thread LeuGim
But you may workaround this by having separate iterators for types: # continuing the previous example method mi(v: A) {.base.} = for i in v: echo "mi A, " & i # ``iterator items(v: A)`` is called method mi(v: B) = for i in v: echo "mi B, " & i # ``iterator items(v:

Re: Problem with var T dynamic dispatch and iterators

2019-09-02 Thread LeuGim
Because `iterator` is a kind of `proc`, not a kind of `method`? So, no dynamic dispatch for it, and its argument (`ast: Ast`) is always of statically stated type, i.e. `Ast`.

Problem with var T dynamic dispatch and iterators

2019-09-02 Thread SilentObserver
Hello everyone, so I'm trying to make a simple C compiler in Nim. I needed to change AST node types, so I wrote something like this: type Ast = ref object of RootObj A = ref object of Ast B = ref object of Ast B1 = ref object of B B2 = ref object of B

Re: Is there a help() method, or dir(), like in python?

2019-09-02 Thread Varriount
You can also use `echo repr(variable)` to print out a basic representation of a variable.

Re: Is there a help() method, or dir(), like in python?

2019-09-02 Thread Araq
Use your editor's "nimsuggest" integration.

Re: Should I include translated sources into version control?

2019-09-02 Thread federico3
> new Nim compiler version produces different nimcache sources from the same > .nim sources, so which ones are the "real" ones now? This is a feature rather than a problem. The .nim files are the "real" sources and the .c files are artifacts. If you commit the .c sources you can then inspect ho

Re: Came across a video talking about NIM

2019-09-02 Thread Hendrik
Thanks Stefan I have bookmarked them will work thru those too. What I was hoping of doing is focusing on Python and then slowly on the side work thru Nim's book and tutorials.

Re: could not load: libpcre.so(.3|.1|) why?

2019-09-02 Thread zhouhaiming
or download from https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.bz2 ./configure --prefix=/usr \ --docdir=/usr/share/doc/pcre-8.43 \ --enable-unicode-properties \ --enable-pcre16 \

Re: Undeclared field error when using template

2019-09-02 Thread aleal
This is all very instructive; thanks a lot. I'm wondering if you have benchmarked your nim codes with, say, C/C++ alternatives (or even a simplified C++ code you wrote yourself). Dealing with GC is something new to me; I'm concerned how this would impact numerical simulations, for example, if d