Debugging with VS Code

2017-10-13 Thread ChristianB
Hello! Could someone be so kind to write a step-by-step tutorial on how to debug Nim code in VS Code using gdb and either the C/C++ extension or the NativeDebug extension? Some people seem to get it running this was, but I have not been sucessful yet. Thank you very much! Christian

Re: Builtin "regions" can model lent and unique pointers

2017-10-13 Thread Stefan_Salewski
You may search for the term borrowed pointer

Builtin "regions" can model lent and unique pointers

2017-10-13 Thread monster
The manual says: "Builtin "regions" can model lent and unique pointers". I know of unique pointers. What is a "lent" pointer? Googling that returns stuff like: * "Some Pointers To The True Meaning Of Our Lenten Practices" * "PRAYER POINTERS ยท As the season of Lent... - St. Philip's ..."

Re: "Person = object" still has a type field by default?

2017-10-13 Thread Tiberium
Yes, not using object of meant you were "pure"

"the upcoming OpenCL target"

2017-10-13 Thread monster
The Nim manual mentions "the upcoming OpenCL target". Is that still a coming? And what about [Vulkan](https://www.khronos.org/vulkan/), which seems to be it's successor?

Re: [Noob] Am I doing string interpolation wrong?

2017-10-13 Thread vlad
Okay, it's seems to be solved now. I should've used JSON's [getStr](https://nim-lang.org/docs/json.html#getStr,JsonNode,string) proc instead of doing $(...).

[Noob] Am I doing string interpolation wrong?

2017-10-13 Thread vlad
Hey, I'm trying to get a string interpolated. There are two values which have string type and I'm trying to do interpolation with % operator: import json import strutils var configFile: JsonNode = parseFile("settings.json") API_KEY: string =

Re: Why splitWhitespace() from strutils lacks maxsplit parameter?

2017-10-13 Thread olwi
`split` on `Whitespace` and `splitWhitespace` are not equivalent: from strutils import split, splitWhitespace let s = " a couple of \t words " echo s.split.len# prints 9 echo s.splitWhitespace.len # prints 4 In case of leading whitespace

Re: Ideas for calling CGAL from Nim?

2017-10-13 Thread Stefan_Salewski
Yesterday I tried a very similar approach as I used for Ruby: ++ // g++ -c -lCGAL -lgmp cdt.cpp // ar rvs cdt.a cdt.o #include #include //#include //#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef

Re: Why splitWhitespace() from strutils lacks maxsplit parameter?

2017-10-13 Thread mashingan
Use `split` proc proc split(s: string; seps: set[char] = Whitespace; maxsplit: int = - 1): seq[string] {..} to use from strutils import split for token in "My string when splitted".split(maxsplit = 1): echo token

Re: Error: expression has no address with openArray

2017-10-13 Thread jlp765
Two ways (at least): * make it a `var openArray[]` * use `unsafeAddr`

Error: expression has no address with openArray

2017-10-13 Thread sflennik
How do I swap the first two bytes of the openArray in the following code? # t.nim(5, 35) Error: expression has no address import strutils import endians proc num(buffer: openArray[uint8]): uint16 = swapEndian16(addr(result), addr(buffer)) var buffer =