Re: do we need travis+appveyor in nim repo now that we have azure-pipelines?

2020-03-02 Thread miran
Yes, we'll remove those.

nimkernel capabilities

2020-03-02 Thread Divy
So I'm new to Nim and OS development. The nimkernel seems exciting... [https://github.com/dom96/nimkernel](https://github.com/dom96/nimkernel) Though I would like to know... 1. how can I handle keyboard input? 2. how to do some networking with it?

Re: USB Error on Epson Printer

2020-03-02 Thread ElenaGillbert
Hi.. I am recently facing some errors like epson printer error code 0xf3 on my new Epson printer and I have tried a lot to solve the error by searching on the Internet for its fix, but it failed. Can anyone suggest me a better solution to fix these type of errors? you can take the more

do we need travis+appveyor in nim repo now that we have azure-pipelines?

2020-03-02 Thread timothee
Do we need .travis+appveyor in nim repo now that we have azure-pipelines? can we remove these? This leads to odd cases where PR's are green but nim's build is broken, since nim's build (triggered on PR merge IIUC) runs on travis+appveyor (at least) but PR's run azure-pipelines (+freebsd

Re: how to deal with C string with \0?

2020-03-02 Thread JohnS
[psutil](https://github.com/juancarlospaco/psutil-nim) has this function in case you'd rather use that (or see how we did it). import psutil echo disk_partitions() Run produces: @[(device: "C:\\", mountpoint: "C:\\", fstype: "NTFS", opts:

Re: Some rant about nim

2020-03-02 Thread timothee
@Somerandomguy > I mean this does compile, seems like I'm a bit too emotional last morning type iX = range[1..5] var a: iX = 3 let b = 10 # will give RT error # const b = 4 # will work # const b = 10 # will give CT error a = b Run not-a-bug. it

Re: How to create adjacency list in Nim?

2020-03-02 Thread e
There are many ways to keep an adjacency list. The method I chose for a in a [quickie graph library](https://github.com/dcurrie/AdventOfCode/blob/master/Utils/dgraph.nim#L13-L14) was to use hash sets for in- and out- edges from a graph node.

module winregistry - how get the type of a key?

2020-03-02 Thread BugFix
Hi, i'm trying to deal with the winregistry module. But I've one problem. If i have a enumeration of names (enumValueNames), i don't know the the types of this values. I've not found any function inside the module to ask for this. Here my dirty solution to get the type: import

Re: Some rant about nim

2020-03-02 Thread Somerandomguy
Yeah, I wrote quite some OCaml and want to find something new, seems like nim just isn't for me. Also OCaml is slow and multicore support is still under construction.

Re: Some rant about nim

2020-03-02 Thread Hlaaftana
I have to piggyback off @zetashift's post here. Nim is just not the language you expect it to be yet. Your "major problems" can be boiled down to "limited dependent typing and type analysis" which is not the core philosophy of Nim. Nim is first and foremost a productivity language like Python

Re: How to declare a thread-global variable?

2020-03-02 Thread trtt
I don't have libgo.so.

Re: Some rant about nim

2020-03-02 Thread leorize
The compiler enforces code paths to not have `nil``s (ie. forcing ``ref` to be initialized). In the case where you use an FFI API that might return `nil`, you have to add the checks in yourself, and the compiler will do analysis to determine if it's enough. Currently Nim has `not nil`

Re: TimeFormatParseError using period character '.' as date separator

2020-03-02 Thread cmc
Ah, the peril of lightly glossing over concisely written documents. Thanks!

Re: TimeFormatParseError using period character '.' as date separator

2020-03-02 Thread Vindaar
That's because there's only a few characters, which can be used directly in a format string. To use other characters / longer strings, you have to put them between ' ', like so: echo dt.format("'.'mm'.'dd") Run See below the table here:

Re: TimeFormatParseError using period character '.' as date separator

2020-03-02 Thread leorize
According to the [documentation](https://nim-lang.org/docs/times.html#parsing-and-formatting-dates): > Other strings can be inserted by putting them in `''`. For example `hh'->'mm` > will give `01->56`. The following characters can be inserted without quoting > them: `:` `-` `(` `)` `/` `[`

Re: Some rant about nim

2020-03-02 Thread mashingan
just a genuine question > > Not null safe by default How compiler know whether the data is nil or not if the data for example taken from IO? Or is it adding the additional `if thedata == nil` in the code? But the checking still done in run-time right? Or is it just limited to data/object

Re: Some rant about nim

2020-03-02 Thread zetashift
I also use [https://github.com/alehander92/gara](https://github.com/alehander92/gara) from time to time. Object variants take awhile to get used to but it's far from bad. I think type inference is fine in Nim. It might not be something like in F#/OCaml but I find that even in those languages

TimeFormatParseError using period character '.' as date separator

2020-03-02 Thread cmc
Hi everyone! I was writing a little command line tool that involves parsing and formatting dates, and ran across something weird- format works fine with the dash 2019-10-10 as date separator, but it crashes using a period sign 2019.10.10. Why could this be? I used the ugly workaround below for

Re: How to declare a thread-global variable?

2020-03-02 Thread leorize
> So the ownership model has been changed again? What is the replacement? `--gc:arc`: [https://forum.nim-lang.org/t/5734](https://forum.nim-lang.org/t/5734) And here's the official docs on destructors:

How to create adjacency list in Nim?

2020-03-02 Thread hany33
How to create adjacency list in Nim?

Re: Some rant about nim

2020-03-02 Thread juancarlospaco
Maybe with all that knowledge you can help improve things, send PR to whatever you think you can improve!. :D

Re: How to declare a thread-global variable?

2020-03-02 Thread juancarlospaco
Try `--gc:go`.

Re: How to declare a thread-global variable?

2020-03-02 Thread trtt
@juancarlospaco I know what is the boehm gc and that's why I was surprised that you mentioned it - it's a bad gc and I can already see its bad performance with my app. @dawkot that's basically what I did, the createShared should be used for thread-global access.

Re: Some rant about nim

2020-03-02 Thread Somerandomguy
I mean this does compile, seems like I'm a bit too emotional last morning type iX = range[1..5] var a: iX = 3 let b = 10 a = b Run others are minor points which I don't think as nearly as as bad, they just seems weird. I know patty and it's still

Re: How to declare a thread-global variable?

2020-03-02 Thread dawkot
You can create a pointer. import tables var t = create Table[int, int] t[] = toTable {1: 2, 3: 4} echo t[] Run

Re: How to declare a thread-global variable?

2020-03-02 Thread juancarlospaco
Boehm is not about ownership models. Boehm was _not_ recently added nor removed. `--gc:boehm` refers to [https://en.wikipedia.org/wiki/Boehm_garbage_collector](https://en.wikipedia.org/wiki/Boehm_garbage_collector) On internet theres some articles saying is terribly slow in theory, but for

Re: How to declare a thread-global variable?

2020-03-02 Thread trtt
So the ownership model has been changed again? What is the replacement? Is --gc:boehm refers to that boehm gc? If so, it's known to perform poorly and has a lot of other issues(can it handle multi-threading now?). I tried the single-threaded form of my app with boehm and the performance was 50%

Re: Using sendTo() to send custom types?

2020-03-02 Thread enthus1ast
Please try addr reallyWannaSendThis

Re: Some rant about nim

2020-03-02 Thread Hlaaftana
> Have a subrange type that is broken, but no literal type. So following > compiles That literally doesn't compile. [https://play.nim-lang.org/#ix=2d9m](https://play.nim-lang.org/#ix=2d9m) > choose defer over try with resource/with. defer is documented as sugar for wrapping everything in a