Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
> "gtkmm" which is a C++ wrapper and I'm quite sure it uses C++ destructors. That is a fine hint. I don't know much about gtkmm, so I am not sure if they really use C++ destructors or just plain gtk internal ref counting as C does. Will ask Mr E.Bassi at gtk forum. Found comment of mratsim: [h

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> Will this become default and if so when? I hope it reaches production quality in a couple of months and we can make it the default. I haven't used it myself but I had [https://github.com/status-im/nim-json-serialization](https://github.com/status-im/nim-json-serialization) in mind.

Re: How Can i compile nim code as a lib.so and use it in C code ?

2019-12-25 Thread rgv151
you need to add dynlib prama too, and compile with \--app:lib option. more details [here](https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export)

Re: Introducing --gc:arc

2019-12-25 Thread JohnLuck
Will this become default and if so when? > Ever since we added macros.getType we had more efficient ways to produce > serialization code, it's not a big loss (IMHO, I never use it), there are > also third party modules that do what marshal.nim does, but better. I am using marshal myself, which

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> The main problem is, that we can pass objects to gtk lib, and can GET BACK > the same object later. For example a widget in a grid container -- we create > a widget, put it into grid container, forget it, and get it back later, maybe > put it into another container then. That seems to be reall

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
Just tested [https://github.com/StefanSalewski/cdt](https://github.com/StefanSalewski/cdt) That one is indeed not really tested yet, so I did not make a nimble package out of it to not pollute the nimble database. And it is again a bit complex. # with import fix: import dt, vectors

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> Second, what does arc in Nim mean for us mortals? Will compiling or running > programs become faster? Easier to debug, better latency, less memory consumption, better multi-core support. > Will we have to use a different mechanism to get type information now that > typeinfo is unavailable wi

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
> That test is also part of our test suite and is so complex that it doesn't > run on 32 bits, nor in C++ I was not aware that it is in test suite. But I was aware that it does not compile with C++, and that nimsuggest has big problems with it. Will try to investigate which problems with 32 bit

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> The RTree test.nim from > [https://github.com/StefanSalewski/RTree/tree/master/tests](https://github.com/StefanSalewski/RTree/tree/master/tests) > compiles but running the executable gives an assertion error. Funny. That test is also part of our test suite and is so complex that it doesn't run

Re: Cannot build old project - TChannel problem

2019-12-25 Thread Peter
Thanks a lot, it compiles with Channel.

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
Did just a first test. The RTree test.nim from [https://github.com/StefanSalewski/RTree/tree/master/tests](https://github.com/StefanSalewski/RTree/tree/master/tests) compiles but running the executable gives an assertion error. Funny. Unfortunately gintro apps seems not to compile, seems that f

Re: Cannot build old project - TChannel problem

2019-12-25 Thread Stefan_Salewski
You may look for available symbols at [https://nim-lang.org/docs/lib.html](https://nim-lang.org/docs/lib.html) I think most P and T prefixes have vanished, was a legacy from Pascal notation. Channel is available, TChannel not, so I assume TChannel is replaced with plain Channel.

Cannot build old project - TChannel problem

2019-12-25 Thread Peter
Hello, I'm trying to build an old project, created with 0.11.2 version, using Nim 1.0.2. I'm blocked with the following error: Error: undeclared identifier: 'TChannel' I'm using the following options to build the project: \--threads:on --opt:none --debuginfo --gc:markAndSweep| ---|---

Re: Introducing --gc:arc

2019-12-25 Thread moigagoo
First, congrats! Seems like an important milestone, even if there's much to be done ahead. Second, what does arc in Nim mean for us mortals? Will compiling or running programs become faster? Will we have to use a different mechanism to get type information now that typeinfo is unavailable with

Re: Error converting json to types

2019-12-25 Thread JohnAD
BSON uses Extended Json (v2); and BSON does have a UTC Time/Date function. Granted, it converts to Time rather than DateTime. BSON also has marshalling support to/from objects. If interested in that: [https://nimble.directory/pkg/bson](https://nimble.directory/pkg/bson) Example of use with obj

Re: Error converting json to types

2019-12-25 Thread JohnAD
(disclaimer: I'm the author of BSON)

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread b3liever
In the end, I think, it makes no sense to write an 1:1 port of petgraph, I will do a library that is usable at least by a noob (me). I think its best not to export `EdgeIndex` and keep edges private, if the weight must be updated, updateEdge is available, findEdge though will be private. Removin

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread b3liever
Now I get it thanks, I've seen a couple of ways to model an adjacency list, but I think this must be the most efficient. Actually it models a doubly linked list with indices, there is no need for a seq, it has no limitations. You can see how the example at the end represented in memory, take a l

Re: Introducing --gc:arc

2019-12-25 Thread Araq
It's explained here [https://github.com/nim-lang/RFCs/issues/177](https://github.com/nim-lang/RFCs/issues/177), a bit.

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread b3liever
Nice idea, thanks! I also tried converters (like the original library does) but it failed to compile. will submit a bug report

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread mashingan
> What do you mean? If I understand correctly, you defined the Node with information of incoming / outgoing Edge type Node*[N] = object ## The graph's node type. weight*: N ## Associated node data. next: array[2, EdgeIndex] ## Next edge in outgoing and inco

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread dawkot
Why not overload procs like fromEdges to accept pairs of integers?

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread b3liever
> The array of two nodes index for incoming/outgoing will be unused the more > you add APIs to your graph. What do you mean by this?

Re: Introducing --gc:arc

2019-12-25 Thread didlybom
> Correct, it's very close to how C++ works. This is awesome then! Can’t wait to try it :-) Can you explain what the .cursor pragma does and how it must be used?

Re: What is the meaning of this C code ?

2019-12-25 Thread kcvinu
Thanks for the reply.

Re: Object Variants and redefinition of labels or reusbility of field names

2019-12-25 Thread treeform
I would just create 26 different types and make conversions between them? There is no need to stuff everything into a single type... I do this with Chroma: [https://github.com/treeform/chroma](https://github.com/treeform/chroma)

Re: How to check if a proc has no return type?

2019-12-25 Thread treeform
You can use the compiles special function to do a ton of this work: [https://play.nim-lang.org/#ix=25sG](https://play.nim-lang.org/#ix=25sG) proc echo2(s: string): string = "" template returnsVoid(f: untyped): bool = compiles: let v = f echo returnsVoi

How to check if a proc has no return type?

2019-12-25 Thread dawkot
This approach doesn't compile: echo echo(":)") is void Run

{.global.} in global scope

2019-12-25 Thread dawkot
What does the global pragma do the way it is used [here](https://github.com/Araq/ormin/blob/master/examples/forum/forum.nim)? import "../ormin/ormin", json importModel(DbBackend.sqlite, "forum_model") var db {.global.} = open("stuff", "", "", "") ...

Re: Distinct for indices, is it good library Api?

2019-12-25 Thread mashingan
IMO, It's not worthy to make it distinct, moreover, you should use generic instead of int for nodes label. Unrelated to the question, you should keep the Node definition is literally as a node, and keep Edge definition is the connection from Node1 and Node2. The array of two nodes index for inc

Re: What is the meaning of this C code ?

2019-12-25 Thread cantanima
`WNDCLASSEX` must be a struct whose first field is numerical, and `={0}` initializes it to 0. [You can read about this and more on this page.](https://en.cppreference.com/w/c/language/struct_initialization)

What is the meaning of this C code ?

2019-12-25 Thread kcvinu
Hi all, I would like to know what is the meaning of this C code. WNDCLASSEX wcx={0}; Run All i can understand is, this line declares an instance of WNDCLASSEX type variable. But i can't understand the "{0}" part. What is it ?

Distinct for indices, is it good library Api?

2019-12-25 Thread b3liever
Hi and merry Christmas, I was trying to port [petagraph](https://github.com/petgraph/petgraph) rust library to nim and although I made some [progress](https://gist.github.com/b3liever/de2d4e2267b13832f7d52f10ba3140fe) I am struggling with some fundamental decisions. for example, when adding a

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> Just to make sure I'm not confused - there are no changes to the source code > needed, though "sink" and "lent" annotations do provide optimization? Correct. > And it's independent of the bacon/dingle "owned" system (and is b/d going to > stay or is it deprecated and going away?) It's indepe

How Can i compile nim code as a lib.so and use it in C code ?

2019-12-25 Thread KyrillosWalid
Hi! iam traying compile this code as a lib.so to use it in C code **lib.nim** `proc fib(): cstring {.exportc.} = return "Hi From Nim"` how can i do it ?

Re: Introducing --gc:arc

2019-12-25 Thread cumulonimbus
Just to make sure I'm not confused - there are no changes to the source code needed, though "sink" and "lent" annotations do provide optimization? And it's independent of the bacon/dingle "owned" system (and is it going to stay or is it deprecated and going away?) In what way does "async" need

Re: Introducing --gc:arc

2019-12-25 Thread Araq
> For example, if I create a local seq or string variable on a procedure A, and > that variable is only used within that procedure A or at most is used by > procedures called within that procedure A, will it’s memory be freed > immediately when the procedure A is done (and before other code is e

File and directory structure for a hybrid project

2019-12-25 Thread marks
I have a project that consists of a library (that will be split over several files but will have a single file as its entry point) and an executable that uses the library but which doesn't share its name. At the moment I have this layout: src/myexe.nim src/mypkg/mypkg.nim

Re: Introducing --gc:arc

2019-12-25 Thread didlybom
This looks awesome! Can you give more info on what you mean when you say that this new GC will provide a “deterministic memory management”? For example, if I create a local seq or string variable on a procedure A, and that variable is only used within that procedure A or at most is used by pro