Re: Workflow: how do I make a cpp lib in nim?

2018-09-18 Thread ggibson
@jyapayne Thank you for detailing all that! I had been using 0.18.0 because I'm on Win and that was the version available to download in zipped binary format. But apparently this requires new fixes in latest devel, as 0.18.1 worked nicely.

Re: Workflow: how do I make a cpp lib in nim?

2018-09-18 Thread jyapayne
Oops, I didn't see that you changed the source. It should still work though, but let me check.

Re: Workflow: how do I make a cpp lib in nim?

2018-09-18 Thread jyapayne
@gibson, here's what seemed to work for me. I changed `mylib.nim` to be like this, but I only did so to get rid of the duplicate name: import strutils, sequtils, os, parsecsv, streams, future proc parseCSVListLine*(str: cstring): cstringArray {.exportc.} = var ss =

Re: Workflow: how do I make a cpp lib in nim?

2018-09-18 Thread ggibson
@jyapayne I think "can easily extend the example to c++" is giving me too much credit as I don't often deal with FFI scenarios. Does anyone have an example where this has been done? Either wrapping a nim->c library in c++, or wrapping a nim->c++ library in c++?

Re: Confused with Nim OOP tutorials. Please clarify straight forward examples

2018-09-18 Thread bpr
> For a library, when you need to build a heterogeneous collection of objects > with types that can be user defined. Why don't object variants work here, instead of OOP? I don't see the need to introduce method for this case. The only thing OO provides is open recursion, which I haven't needed

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread lscrd
Here is your example translated to Nim using a method for "cry". type Animal* = ref object of RootObj weightOfAnimal*: int method cry(x: Animal) {.base.} = echo "Animal is crying..." type Dog* = ref object of Animal name*: string

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread mratsim
Sorry it should have been methods instead of proc. But seems like conversion doesn't work.

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread kcvinu
@mratsim, Error: attempting to call undeclared routine: 'base'

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread cdome
You need to use procCall. It was recently document in the dev doc: [https://github.com/nim-lang/Nim/commit/4ae9198493d85382c80a5c9436b86c5a6f3483c1](https://github.com/nim-lang/Nim/commit/4ae9198493d85382c80a5c9436b86c5a6f3483c1)

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread mratsim
You can convert before calling: type Animal = ref object of RootObj Dog = ref object of Animal proc cry(x: Animal) {.base.} = echo "Foobar" proc cry(x: Dog) = echo "Bark" let x = Dog() x.cry x.Animal.cry Run

Re: [Status Grant Proposal] Make Nim suitable for interactive programming

2018-09-18 Thread zahary
I'm bumping this to keep it visible for couple of more weeks

Re: please advise: threading/GC - how make it work?

2018-09-18 Thread nais314
sleep(0) won, with other mods. thanks for visiting github, made a lot of progress lately - still no docs, but you are welcomed :)

Re: release only runtime crash

2018-09-18 Thread yglukhov
This may happen if nim GC loses track of your json objects, "deallocates" them, and later reuses their memory for something else. As a test, patch `json.nim` by adding a finalizer to all allocated JsonNodes, and see if it is getting called when it's not supposed to. Revealing your source code

Re: How to call a proc of Base class from a derived class ?

2018-09-18 Thread Stefan_Salewski
jlp765, I think that link and your post is not that helpful for his question. I think question is more related to "super" methods as it is called for example in Ruby. For Nim we have the procCall defined in module system, I think it may be applied for this case, but I have never tried, as I

Re: Cannot call function with argument of Nim from Python3

2018-09-18 Thread yglukhov
> But I got error message That one is fixed. Now regarding your first question. When calling nim function from a foreign runtime you have to make sure that nim's GC is configured properly. Quick way to check it is to do `GC_disable()` as the very first operation of your externally called