<< 18-05-2018 >>

00:00:15Araqbut it depends on the representation
00:00:26Araq.bufferpacked is nice but should be done differently
00:00:52FromGitter<xmonader> Guys!! i'm almost done with my parsec for nim wanna take a look? :D
00:00:55FromGitter<xmonader> https://gist.github.com/xmonader/474f926c7481b43a0c0160ef0e416c17
00:01:01Araqthe ascii based representation is kinda shitty, but as I said, for json it has plenty of advantages
00:01:58FromDiscord<treeform> Some thing like: https://gist.github.com/treeform/1c1cb10fd18342b05efe73003ecd285b
00:02:15FromDiscord<treeform> so that the struct just grows and stays together instead of fragmenting pointers and stuff?
00:02:53FromDiscord<treeform> This would not be good for all structs, but for some it might be good? I think its very similar to json use case?
00:03:32FromDiscord<treeform> For structs that contains mostly strings and you don't change them often.
00:03:50Araqsure, sounds reasonable
00:04:07FromGitter<xmonader> i need help with just 1 thing to achieve forward declarations that's how i do it in python ⏎ https://github.com/xmonader/pyparsec#forward-declarations not sure how to do it in nim, even untyped templates doesn't work so i'm not sure?
00:05:46Araqsorry, I need to sleep.
00:05:55FromDiscord<treeform> have a good night!
00:05:56Araqforward decls only work for procs
00:06:09Araqthey are covered in the tutorial
00:06:14Araqgood night
00:06:23FromGitter<xmonader> thanks good night araq i'll try
00:17:06*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
00:33:07FromDiscord<2vg> awesome araq's packedjson
01:09:24*endragor joined #nim
01:14:09*endragor quit (Ping timeout: 268 seconds)
02:31:39*leorize quit (Quit: WeeChat 2.1)
02:35:42*leorize joined #nim
02:40:27*endragor joined #nim
02:41:44*dddddd quit (Remote host closed the connection)
03:20:16*aleandros left #nim ("Textual IRC Client: www.textualapp.com")
03:21:08*FuntDobra joined #nim
04:07:20*leorize quit (Ping timeout: 265 seconds)
04:36:54*FuntDobra quit (Ping timeout: 260 seconds)
04:52:46*xkapastel quit (Quit: Connection closed for inactivity)
04:56:38*cspar_ quit (Ping timeout: 265 seconds)
05:04:05*mal`` quit (Quit: Leaving)
05:14:24*miran joined #nim
05:17:14*mal`` joined #nim
05:24:42*leorize joined #nim
05:29:00*nsf joined #nim
05:43:08*skrylar joined #nim
05:55:25*leorize quit (Ping timeout: 256 seconds)
06:09:04*xkapastel joined #nim
06:10:09*miran quit (Ping timeout: 268 seconds)
06:12:49*yglukhov quit (Ping timeout: 248 seconds)
06:14:20*leorize joined #nim
06:26:00*gokr joined #nim
06:49:25*FuntDobra joined #nim
06:57:30*FuntDobra quit (Ping timeout: 256 seconds)
07:05:30*FuntDobra joined #nim
07:10:18*jaco60 joined #nim
07:20:05*yglukhov joined #nim
07:28:02*shodan45 quit (Remote host closed the connection)
07:28:09*shodan45 joined #nim
07:52:04*CodeVance joined #nim
07:55:12FromGitter<data-man> Morning! ⏎ parsetoml's author are no longer interested in Nim. ⏎ I propose to create the NimParsers organization and move his project to new address (or to Nim-Lang). https://github.com/ziotom78/parsetoml/issues/12
07:59:03livcdthat's a shame
07:59:07livcddid he mention why ? :)
08:01:42FromGitter<data-man> Looking at his repositories, the reason in Julia. :-)
08:02:28*athenot_ joined #nim
08:02:41FromGitter<xmonader> anyone has the time to help me a bit finishing off a parser combinator library? i'm struggling with forward declarations?
08:03:39*athenot quit (Ping timeout: 255 seconds)
08:07:27FromGitter<data-man> Sorry, I'm almost asleep. Tea is no longer helps. :)
08:13:19*FuntDobra quit (Ping timeout: 260 seconds)
08:18:45FromGitter<xmonader> cute timezones in this channel xD
08:22:00FromGitter<data-man> Just I hadn't slept > 24 hours.
08:22:11FromGitter<narimiran> @xmonader i'm not almost asleep, but i don't know if i can help you :)
08:23:28FromGitter<xmonader> @narimiran oh thanks! can u take a look at this ? https://github.com/xmonader/pyparsec#forward-declarations
08:23:41FromGitter<xmonader> i'm trying to do the same in nim but it won't let me
08:24:30*xet7 joined #nim
08:24:45FromGitter<narimiran> what exactly are you trying to do? are you looking for some kind of closures?
08:25:30FromGitter<narimiran> or partially applied functions? or something else?
08:25:36FromGitter<xmonader> yeah that doesn't evaluate until called
08:25:36FromGitter<xmonader> i tried to use template with untyped
08:25:37FromGitter<xmonader> but that didn't work too
08:26:38FromGitter<xmonader> the problem is to define `jsonValue` u need to define `jsonList` and to define `jsonList` u need the `jsonValue` to be already defined, that's why i need a way to forward declare `valp` to be used from `listp`
08:27:56FromGitter<xmonader> so what i did in python i write a closure that when evaluated will call that expression
08:28:52FromGitter<kayabaNerve> I need help for once
08:28:59FromGitter<kayabaNerve> Well. Not for once.
08:29:03FromGitter<kayabaNerve> I need help often.
08:29:10FromGitter<kayabaNerve> I need Nim help for the first time in months
08:29:59FromGitter<kayabaNerve> I have a C function which can be summarized as follows: ⏎ ⏎ char* cFunc(char* data) { ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5afe8f07b84be71db917e592]
08:30:26FromGitter<kayabaNerve> The array is filled properly, is null terminated, and printf handles it successfully
08:31:35*FuntDobra joined #nim
08:31:43FromGitter<kayabaNerve> My Nim code though? ⏎ proc cFunc(data: cstring): cstring {.header: "../c/header.h", importc: "cFunc".} ⏎ ⏎ proc nimFunc*(data: string): string = ⏎ ... [https://gitter.im/nim-lang/Nim?at=5afe8f6e8c24fe61eaf5072f]
08:32:01FromGitter<kayabaNerve> The C Function works perfectly. However, nim gets a blank string/nil in return
08:32:15FromGitter<kayabaNerve> Printing it prints a blank line. That array accessing crashes the program.
08:36:54*yglukhov quit (Read error: Connection reset by peer)
08:37:27*yglukhov joined #nim
08:37:47Araqyour C function is wrong, it returns memory to a stack frame that is about to disappear
08:38:19FromGitter<kayabaNerve> Should I pass in a cstring an edit that directly?
08:38:25Araqyou can easily write this in Nim and Nim would tell you the unsafety ('addr')
08:38:39Araqwrite it in Nim.
08:38:43FromGitter<kayabaNerve> I can't
08:38:52FromGitter<kayabaNerve> Not without adding hours to my work
08:39:08Araqwell it's broken C code
08:39:13FromGitter<kayabaNerve> This is a C SHA512 header file I cleaned and made into a singular function
08:39:18FromGitter<kayabaNerve> That singular function is my code
08:39:20FromGitter<mratsim> @brentp squeeze the [1, 300, 4] tensor or unsqueezed(0) the [300, 4] tensor
08:39:30FromGitter<kayabaNerve> I can edit my singular function
08:39:34FromGitter<mratsim> unsqueeze*
08:39:36FromGitter<kayabaNerve> Or write that in Nim
08:39:42Araqyeah, do that.
08:39:45FromGitter<kayabaNerve> But then I have 3 C functions and a datastruct
08:40:18FromGitter<kayabaNerve> Unless I rewrite the whole header. Hundreds of lines and a pain in my ass, especially as this is one of many C libraries I need
08:40:52FromGitter<mratsim> cstring is the equivalent of C 0-terminated string
08:40:54FromGitter<kayabaNerve> I wish I had the time and patience to do that
08:41:05FromGitter<kayabaNerve> @mratsim So cstring is a char*
08:41:11FromGitter<mratsim> yes
08:41:24FromGitter<kayabaNerve> And the solution here, as I can't rewrite this in Nim, is to pass in a cstring and have C edit it
08:41:30FromGitter<kayabaNerve> Because then the frame is Nim's, not C
08:41:37FromGitter<kayabaNerve> Yes? No? Am I missing something?
08:41:51FromGitter<mratsim> pass the cstring to the C function
08:41:59FromGitter<kayabaNerve> If so, my question is what's the best way to allocate 129 chars to a cstring
08:42:06FromGitter<kayabaNerve> Or do I have to use C's memalloc?
08:42:25FromGitter<kayabaNerve> Right now, I'm just using char returnData[129]
08:42:35FromGitter<mratsim> var foo: cstring = “yourNimString"
08:42:52FromGitter<kayabaNerve> That doesn't help... at all
08:42:55FromGitter<mratsim> and then pass foo[0].addr
08:43:04*yglukhov quit (Ping timeout: 260 seconds)
08:43:09FromGitter<kayabaNerve> Unless your suggestion is to write a junk string with 128 chars
08:43:22FromGitter<mratsim> or pass as cstring directly. I think it should work.
08:43:30FromGitter<kayabaNerve> Thanks for the info on passing it
08:43:40FromGitter<kayabaNerve> I do appreciate it. Right now, my issue is memory allocation though
08:43:57FromGitter<mratsim> Nim will allocate the cstring properly
08:43:59FromGitter<kayabaNerve> How do I get 129 chars allocated? Just have "128_CHAR_LENGTH" as the string?
08:44:04FromGitter<kayabaNerve> Not if I edit it from C
08:44:12FromGitter<kayabaNerve> I'm not passing data. I did that
08:44:15FromGitter<kayabaNerve> I'm getting the data back
08:44:26FromGitter<mratsim> what do you want to do with it?
08:44:29FromGitter<kayabaNerve> ...
08:44:31FromGitter<kayabaNerve> From the top
08:44:38FromGitter<kayabaNerve> I have a C function which can be summarized as follows: ⏎ ⏎ char* cFunc(char* data) { ⏎ ⏎ ```var res: cstring = cFunc(data) ⏎ echo res[0] ⏎ echo res[3] ⏎ return $res``` ... [https://gitter.im/nim-lang/Nim?at=5afe92768c24fe61eaf510ef]
08:44:42FromGitter<kayabaNerve> C works fine
08:44:45FromGitter<kayabaNerve> C prints my string
08:44:54FromGitter<kayabaNerve> Nim prints a breakline and crashes on [0] and [3]
08:44:57FromGitter<kayabaNerve> Complaining it's null
08:45:10FromGitter<kayabaNerve> Araq said the issue had to do with the frame of the variable
08:45:18FromGitter<kayabaNerve> They suggested rewriting it in Nim
08:45:20FromGitter<kayabaNerve> I can't
08:45:39FromGitter<kayabaNerve> So now I have to figure out how to get the data to Nim's frame. My idea was to pass in a cstring, and just have C edit it
08:46:04FromGitter<kayabaNerve> Then Araq disappeared (which is fine; they're probably busy and they don't have to give me support; no one does)
08:46:13FromGitter<kayabaNerve> And then you popped in to try to help me. I appreciate that
08:47:17FromGitter<mratsim> let me try something. btw you should use triple-quote for proper formatting of code
08:47:45FromGitter<kayabaNerve> Thanks. I'm used to Discord which is `.
08:50:18FromGitter<kayabaNerve> Also, Nim has two compiler bugs, as far as I can tell. My inclusion of the header is forced to be "../c/header.h" since it places the C file in nimcache/. Also, it doesn't recompile my header when it changes. ⏎ ⏎ I said as far as I can tell, because I'm guessing I'm misusing the compiler on the first (maybe some cli switch or a pragma) and the second is... not a bug but a not yet implemented feature? I actually
08:50:18FromGitter... don't know. Just wanted to bring them up in case I did find a bug. V0.17.3 (working on upgrading that today). Does anybody know for sure if either of those are bugs?
08:52:37Araq> Yes? No? Am I missing something?
08:52:40AraqYes.
08:53:09AraqC does not work "fine", you print the string before it disappeared
08:53:30Araqtry to print it in a C function that calls your function and you would see the same.
08:53:37FromGitter<mratsim> @kayabaNerve ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5afe9491b84be71db917f755]
08:54:11Araqregarding your other question, nim doesn't track headers, use -f to force a recompile
08:54:25Araqnim assumes that you don't program in C header files
08:54:30*yglukhov joined #nim
08:54:53FromGitter<kayabaNerve> Araq: Yes. The issue is with C. Not with Nim. However, the issue is appearing on the Nim-side of things, thanks to C. That was my point. That stated, I am trying to find the way to fix this.
08:55:03FromGitter<kayabaNerve> Thanks for the -f switch
08:55:07FromGitter<mratsim> if you want to stay with C header use something like this: https://github.com/status-im/nim-ttmath/blob/master/src/ttmath.nim#L5
08:55:30FromGitter<mratsim> passC: “-I” and the path to the header files
08:56:02FromGitter<kayabaNerve> @mratsim Does that solve this issue or is it something for me to test
08:56:50FromGitter<mratsim> I don’t know what your fillArray function is but that doesn’t return a blank string
08:57:40FromGitter<kayabaNerve> """char* sha512(char* hexData) { ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ }""" [https://gitter.im/nim-lang/Nim?at=5afe9584d245fe2eb7bde5a3]
08:58:04FromGitter<kayabaNerve> There we go
08:58:04FromGitter<mratsim> i.e. your C function signature were wrong, you returned char instead of char *, you accepted char instead of char *
08:58:09FromGitter<mratsim> char \*
08:58:22FromGitter<data-man> @kayabaNerve: Just use nimcrypto package
08:58:28FromGitter<mratsim> ^
08:58:51FromGitter<kayabaNerve> Doesn't have what I need
08:58:56*sendell joined #nim
08:59:30FromGitter<kayabaNerve> The point isn't SHA512 in Nim
08:59:39FromGitter<kayabaNerve> The point is C Cryptographic Libs in Nim
08:59:43FromGitter<kayabaNerve> SHA512 was just the first
08:59:51FromGitter<kayabaNerve> I need a lot more from a lot of places
09:00:02FromGitter<mratsim> how about nim-libsodium?
09:00:13FromGitter<mratsim> or nim openssl?
09:00:21FromGitter<kayabaNerve> NaCl is one of my most hated projects and most loved
09:00:26FromGitter<kayabaNerve> It does so much yet it has so many gaps
09:00:32FromGitter<kayabaNerve> Also not applicable sadly
09:00:45FromGitter<kayabaNerve> OpenSSL may be except for the required linkages and licenses involved
09:00:56FromGitter<kayabaNerve> TL:DR Options exist, this is the one my project forces me to do
09:01:32FromGitter<kayabaNerve> @mratsim What's the differences in the signatures of our two pieces of code?
09:02:29FromGitter<mratsim> probably a copy pasting artefact, your \* disappears due to Gitter
09:02:35FromGitter<kayabaNerve> Got it
09:02:49FromGitter<kayabaNerve> Oh. To be clear, I could use nimcrypto for this. I'd just be back when it comes to lib #2 @data-man
09:05:35FromGitter<kayabaNerve> That emit code broke... a lot of things
09:05:45FromGitter<kayabaNerve> Can I memalloc a cstring from Nim?
09:06:15FromGitter<mratsim> system.calloc or system.calloc0
09:06:46FromGitter<mratsim> ah, it’s alloc and alloc0
09:07:50FromGitter<mratsim> if you need C proc from Nim there is an ansi_c hidden module not sure if you can import it but you can try: https://github.com/nim-lang/Nim/blob/devel/lib/system/ansi_c.nim
09:09:44*Vladar joined #nim
09:13:41FromGitter<xmonader> @mratsim ok i figured it out and now u can define recursive grammar ^_^
09:24:04FromGitter<gogolxdong> Does the type with {.magic.} have exported fields? How to know the detail of a magic type?
09:27:13FromGitter<mratsim> search in github for mAddI if your magic was AddI
09:27:33FromGitter<mratsim> magic are defined in the compiler folder
09:29:07FromGitter<gogolxdong> ```type ⏎ NimNodeObj = object ⏎ ⏎ NimNode* {.magic: "PNimrodNode".} = ref NimNodeObj``` [https://gitter.im/nim-lang/Nim?at=5afe9ce252194a4a67f55c27]
09:32:38FromGitter<mratsim> yes search for mPNimrodNode: https://github.com/nim-lang/Nim/search?utf8=✓&q=mPNimrodNode&type=
09:32:46*xkapastel quit (Quit: Connection closed for inactivity)
09:35:10*dddddd joined #nim
09:36:20FromGitter<gogolxdong> finally, thank you @mratsim
09:36:45FromGitter<mratsim> you’re welcome
09:36:46FromGitter<gogolxdong> I thought it's just magic :)
09:37:20FromGitter<gogolxdong> since @kux said lucky finding.
09:37:21FromGitter<mratsim> well it is, I don’t really understand but it looks like mPNimrodNode are just wrappers
09:41:10FromGitter<kayabaNerve> Thanks @mratsim
09:41:35FromGitter<mratsim> Glad you sorted it out @kayabaNerve
09:43:08FromGitter<mratsim> @xmonader For your parsec: maybe check this GSoC idea, it has some guidelines: https://github.com/nim-lang/Nim/wiki/GSoC-2016-Ideas#implement-re2nim-a-lexer-generator-for-nim
09:53:14FromGitter<xmonader> @mratsim oh thanks! can u guys check https://github.com/xmonader/nim-parsec
09:59:35*leorize quit (Ping timeout: 240 seconds)
10:02:43FromGitter<mratsim> someone did much haskell in a past life :P
10:04:06FromGitter<mratsim> here is a curry macro by the way: https://github.com/Araq/metapar/blob/master/livedemo/curry.nim
10:08:07FromGitter<xmonader> @mratsim haskell is mind changer i guess won't say i fully grasp it though, but some patterns are nice thanks for the macro ^_^
10:11:34*regtools quit (Quit: Lost terminal)
10:19:32FromGitter<mratsim> Haskell was my first lang ;) https://github.com/mratsim/haskell-numbertheory
10:19:41FromGitter<mratsim> besides Bash VBA or SQL I mean.
10:22:05FromGitter<xmonader> why did u work fully on nim now? with the traction haskell is getting every where?
10:22:35*FuntDobra quit (Ping timeout: 240 seconds)
10:23:22FromGitter<mratsim> I’m not a dev, at the time I was support/sysadmin, I was just curious about programming and I always try to do hard things first (my first linux distro was Gentoo :D)
10:24:11FromGitter<mratsim> but IO in haskell was a pain, and speed too. I remember trying to get my Sieve of Atking as fast as C, and was stuck, even with mutable Vector.
10:25:39FromGitter<mratsim> then I did a programming pause for like 4 years. 2 years ago, I got back to programming, wanted to do a Go playing bot. Figured Haskell would be too slow so I looked for a new language, found Nim and Rust. I started with Rust
10:26:29FromGitter<andreaferretti> can anyone tell me what is the syntax to depend on the `#head` version of a package in nimble?
10:26:31FromGitter<mratsim> That was 3 months of fighting the borrow checker instead of learning reinforcement learning and game AI. Finished a functional but super weak and slow go bot
10:26:38FromGitter<andreaferretti> I always get that wrong
10:26:44FromGitter<mratsim> @#head ?
10:26:50FromGitter<andreaferretti> I tried that
10:27:03FromGitter<andreaferretti> `requires "nim >= 0.18.0", "nimPNG@#head"`
10:27:19FromGitter<andreaferretti> nimble would then try to donwload the non-existing package `nimPNG@`
10:27:27FromGitter<andreaferretti> so I tried
10:27:33dom96nimPNG#head in your .nimble file
10:27:34FromGitter<andreaferretti> requires "nim >= 0.18.0", "nimPNG #head"
10:27:42FromGitter<andreaferretti> ah ok without spaces
10:28:04FromGitter<andreaferretti> great, that works!
10:28:07FromGitter<andreaferretti> thank you!
10:28:08FromGitter<xmonader> 3 months with the borrow checker :(
10:28:09FromGitter<andreaferretti> :-)
10:28:26FromGitter<xmonader> compiler error driven development with Rust :D sounds like a good title for a book @mratsim
10:28:30dom96with space should work too
10:28:34dom96please make an issue
10:29:20FromGitter<mratsim> @xmonader Then, programming pause again, I learned Data Science, I had a competition with 1.5Gb 3D images, Python was too damn slow to preprocess it. Did more competitions, Scikit-learn had tensor pipelining inefficiencies, so I wanted to learn this stuff from scratch
10:29:54FromGitter<mratsim> Rut or Haskell would be too foreign a syntax if I wanted to build something so I figured I could try Nim this time
10:29:57FromGitter<mratsim> Rust*
10:30:08FromGitter<xmonader> oh would u like to share resources? i never got the chance to get into AI only some basics minmax and such
10:30:47FromGitter<mratsim> I learn everything here: https://www.kaggle.com/
10:31:21FromGitter<mratsim> For neural net: I started with this: https://karpathy.github.io/neuralnets/ and the CS231n Stanford courses
10:31:43*FuntDobra joined #nim
10:32:26FromGitter<xmonader> thanks a lot hopefully i get the time to invest in AI
10:32:39FromGitter<mratsim> For reinforcement learning and game AI, try with Monte Carlo Tree Seach for tictactoe or Othello/Reversi
10:32:51FromGitter<mratsim> and You can see a really in-depth overview of techniques here: https://drive.google.com/file/d/1xeUDVGWGUUv1-ccUMAZHJLej2C7aAFWY/view
10:33:17FromGitter<xmonader> actually nim makes sense because it's still growing and doesn't have most of basic libraries so doing it all will give u a broader experience
10:33:47*leorize joined #nim
10:34:14*regtools joined #nim
11:00:09*FuntDobra quit (Ping timeout: 260 seconds)
11:02:45*Yardanico quit (Ping timeout: 256 seconds)
11:03:49*Snircle joined #nim
11:08:47*floppydh joined #nim
11:10:16*fredrik92 joined #nim
11:12:38*FuntDobra joined #nim
11:13:27*couven92 quit (Ping timeout: 240 seconds)
11:15:30*Yardanico joined #nim
11:18:46*sendell quit (Remote host closed the connection)
11:19:55*leorize quit (Ping timeout: 265 seconds)
11:22:33*couven92 joined #nim
11:23:29*pwntus quit (Ping timeout: 260 seconds)
11:23:46*fredrik92 quit (Ping timeout: 264 seconds)
11:23:46*pwntus joined #nim
11:27:51*athenot_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:28:20*fredrik92 joined #nim
11:30:21*couven92 quit (Ping timeout: 240 seconds)
11:33:05*fredrik92 quit (Ping timeout: 240 seconds)
11:39:19*CodeVance2 joined #nim
11:39:21*CodeVance quit (Read error: Connection reset by peer)
11:48:57*Cthalupa quit (Ping timeout: 240 seconds)
11:50:11*Cthalupa joined #nim
12:01:11livcdmratsim: do you have the source for your Go bot ?
12:01:20livcdsorry "go bot"
12:05:18FromGitter<narimiran> @livcd https://github.com/mratsim/rustygo ?
12:05:42FromGitter<narimiran> and nim version: https://github.com/mratsim/golem-prime
12:12:29*athenot joined #nim
12:14:09*Vladar quit (Quit: Leaving)
12:17:06*Vladar joined #nim
12:17:47FromGitter<mratsim> yes
12:18:58FromGitter<mratsim> Note that for Rust I struggled to put code in multiple files and then couldn’t be bothered xD
12:21:16livcdjust curious. Did you get back to Rust or did not even try after sticking to Nim ?
12:30:15dom96When I tried Rust its module system was the biggest turn off for me, I guess you've found that too
12:31:17*leorize joined #nim
12:38:46*yglukhov quit (Read error: Connection reset by peer)
12:39:17*yglukhov joined #nim
12:43:05*nuxdie joined #nim
13:14:25*gokr quit (Ping timeout: 268 seconds)
13:18:24*FuntDobra quit (Ping timeout: 260 seconds)
13:24:56*sendell[m] joined #nim
13:25:55*cspar_ joined #nim
13:27:10livcdI am going to try karax in the evening but the examples look complicated :(
13:32:16*DarkArctic quit (Read error: Connection reset by peer)
13:34:09FromGitter<mratsim> @livcd, I read Rust code but I don’t want to program in Rust anymore. Though if I ever got back, after developing in Nim I will have a much better feel for lifetime, borrows, Boxed types
13:34:58FromGitter<mratsim> I can see where and how they make sense now, but I don’t need them in my face.
13:38:14FromGitter<brentp> @mratsim . thanks. unsqueeze did it. and thanks @Vindaar
13:38:14*endragor quit (Remote host closed the connection)
13:39:09*vivus joined #nim
13:39:56FromGitter<mratsim> @livcd Some of the pain points I had in Rust are in this article: https://andre-ratsimbazafy.com/why-rust-fails-hard-at-scientific-computing/
13:46:51*xet7 quit (Ping timeout: 265 seconds)
13:54:38dom96livcd: Are you familiar with React-like frameworks?
13:56:58*endragor joined #nim
13:59:28livcddom96: not really...i did one course on pluralsight on React :d
13:59:51dom96Karax is basically React
14:00:06dom96So you need to get in that way of thinking
14:00:36dom96i.e. instead of setting attributes on the DOM you re-render the whole DOM
14:00:44dom96with the attributes you want
14:01:00dom96and karax figures out the most efficient way to do so
14:01:11*xet7 joined #nim
14:01:56*endragor quit (Ping timeout: 276 seconds)
14:04:04livcdi'll go through the examples and will try to build something small
14:05:42livcdbtw what's the "include karax/prelude"... Did not really find the include keyword in the docs
14:07:21Araqhttps://nim-lang.org/docs/manual.html#modules-include-statement
14:07:36AraqI used https://nim-lang.org/docs/theindex.html and searched for 'include'
14:08:43livcdoh ok
14:08:55livcdi used the search function in "manual" and "std library" :|
14:14:33*PMunch joined #nim
14:34:32PMunchHmm, dom96 I noticed something with nim doc. Some people like to create lines in their comments by having lot's of # symbols, this breaks with "Error: new section expected". I assume this is an rst thing, but maybe it could be easily solved by expecting exactly 2 # symbols and a space before doc-comments?
14:39:36dom96Maybe Araq should answer that one
14:45:08*floppydh quit (Quit: WeeChat 2.1)
14:48:39*rockcavera quit (Ping timeout: 256 seconds)
14:49:54FromGitter<tim-st> I found a bug where the parser/compiler crashes silently: https://pastebin.com/Hp65ZZjA
14:50:09FromGitter<tim-st> I think my source code is wrong though
14:51:44subsetparkOpen an issue!
14:52:15FromGitter<tim-st> does somone know how can I use `{.NoInit.}` on the returning `result` of a return type of a proc?
14:53:06FromGitter<tim-st> result.data {.NoInit.}: ... was my idea, that doesnt work, it seems I have to explicitly create an other variable and assign it to result.data
14:55:19AraqPMunch: I don't know what you mean
14:57:20PMunchRight now it reads "##########################" which causes an error, I'm guessing because the doc format puts some meaning on # characters. If Nim were to only interpret "## " as the beginning of doc comments then those would never enter the documentation.
14:58:09PMunchThis is what is causing issues: https://github.com/NimParsers/parsetoml/blob/master/src/parsetoml.nim#L1258
14:59:59Araqwell that's invalid RST
15:00:29*athenot quit (Max SendQ exceeded)
15:01:06PMunchI know, but only because the remaining ### characters after the first two are added to the RST
15:01:24PMunchIf Nim required "## " you would still be able to do this
15:01:31PMunchAnd I believe most people do that anyways
15:02:03*athenot joined #nim
15:03:07*CodeVance2 quit (Read error: Connection reset by peer)
15:04:30*CodeVance2 joined #nim
15:06:00*CodeVance2 quit (Read error: Connection reset by peer)
15:06:09*CodeVance joined #nim
15:09:53*aleandros joined #nim
15:09:54Araqwell how would I be able to write
15:09:55Araq###############
15:10:01Araq## my awesome header
15:10:02Araq###############
15:10:05Araqotherwise?
15:10:30PMunchWhat do you mean? That's exactly the thing I want to allow :P
15:10:46PMunchOh wait, that's valid RST isn't it?
15:11:01PMunchFor headings
15:11:32Araqyep.
15:13:21*gokr joined #nim
15:13:55FromGitter<tim-st> Is there a fixed size array based Ring type in nim stdlib?
15:14:23FromGitter<tim-st> (or as a nimble package)
15:15:54Araqunlikely, Nim is pretty 'seq' heavy
15:16:35FromGitter<tim-st> here is one "fixed size" but is uses seq :(( https://github.com/megawac/RingBuffer.nim
15:17:08FromGitter<tim-st> I tried to build my own it's nearly finished, but I cant get the new Contructor to work
15:18:42*aleandros quit (Quit: Textual IRC Client: www.textualapp.com)
15:18:54Araqwhy would it use 'new' ?
15:19:08Araqyou can keep it on the stack, it's of a fixed size
15:20:45*aleandros joined #nim
15:21:09FromGitter<tim-st> I want a proc `newRingBufferE (cap: static[Positive]): RingBuffer[E]` or similar to get it very easy
15:21:22*Sembei quit (Read error: Connection reset by peer)
15:21:52FromGitter<tim-st> How would I define the type for this, if the cap is const and differs?
15:22:16*xkapastel joined #nim
15:22:24*skrylar quit (Remote host closed the connection)
15:23:26Araqpretty much like you wrote it, proc newRingBuffer[E: static[int]](): RingBuffer[E]
15:23:56*aleandros left #nim (#nim)
15:24:17*aleandros joined #nim
15:24:34FromGitter<tim-st> I meant this:
15:24:35FromGitter<tim-st> type RingBuffer[I: SomeOrdinal, E] = tuple ⏎ indexFirst: int ⏎ length: int ⏎ data: array[I, E] [https://gitter.im/nim-lang/Nim?at=5afef0331cfca775e11caa32]
15:24:52FromGitter<tim-st> and the array should be {.NoInit.}
15:25:05Araqdlm
15:25:19Araqdon't use a tuple here, that's clearly a nominal type (object)
15:25:53FromGitter<tim-st> what is the difference?
15:26:26FromGitter<tim-st> I dont want to use any object features, object size is likely bigger than tuple
15:26:46Araqit is not.
15:27:12FromGitter<tim-st> can it still be stack only when it's object?
15:27:35FromGitter<aboisvert> object is like a `struct` in C
15:27:46FromGitter<tim-st> and what is tuple then?
15:27:51FromGitter<tim-st> where is the difference
15:28:46aleandrosHey everyone! I'm experiencing something funny with nimble. I'm building a project with one dependency and everything is going normal. Then I added NimYAML and it's re-downloading it everytime I build and asking if I want to overwrite the existing version. Have you experienced it? Do you know a way around it?
15:29:42FromGitter<aboisvert> they are both struct-like, tuples can be indexed by name of field or by index of field
15:32:32FromGitter<tim-st> ok, but I still cant understand how I would define a type that holds a fixed size array. The array itself is constructed using `array[A: Ordinal, B]` I think my type would need this too, but when I tried this the compiler failed like the issue I posted
15:33:01FromGitter<aboisvert> take a look at this example: https://github.com/notTito/nim-100days/blob/master/structures/ringbuffer_concurrent.nim
15:33:47FromGitter<tim-st> This was literally the same syntax I used, but tuple instead of object also static 😟
15:34:00FromGitter<tim-st> thanks for the link that helps 👍
15:34:16*CodeVance quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
15:34:24FromGitter<aboisvert> yeah, `static[int]` is the crux of it
15:34:54FromGitter<tim-st> one last question: when I want the array to be {.NoInit.}, can I write
15:34:56FromGitter<tim-st> var buffer {.noInit.}: array[I, E] ⏎ result.data = buffer
15:35:16FromGitter<tim-st> it can not be done directly one result.data; dont know why it doesnt work
15:35:30FromGitter<tim-st> or will that create two arrays?
15:37:04FromGitter<aboisvert> i'm not 100% clear what you mean ... but `var buffer` above would allocate that array on the stack (without init)
15:37:22FromGitter<aboisvert> for `result.data = buffer` then it copies the value from one to the other
15:38:09FromGitter<aboisvert> maybe you can provide a fuller example?
15:38:11FromGitter<tim-st> I mean that my array should get the {.NoInit.} pragma, but where should I write this at? At the type definiton or at the result.data in the proc
15:38:50FromGitter<aboisvert> don't know off the top of my head, let me check if NoInit is supported at definition site
15:39:29FromGitter<tim-st> your example link was very good: https://github.com/notTito/nim-100days/blob/master/structures/ringbuffer_concurrent.nim ; the only thing he misses here is `{.NoInit.}` to the array; I want to have that in my implementation
15:39:57FromGitter<tim-st> his array is initialzed although he doesnt uses the init elements in an empty ring
15:41:33FromGitter<aboisvert> searching quickly, it doesn't appear {.NoInit.} can be used at definition site as you intend
15:42:21FromGitter<tim-st> ok, thanks, I think the only possibility then is to not supply a contructor proc and to trust the user that he uses {.NoInit.} although he likely doesnt
15:42:25FromGitter<aboisvert> but you can use it on your proc result, e.g. `proc myProd: Buffer[I, E] {.noinit.} = ...`
15:42:43FromGitter<tim-st> ah, very nice, thank you very much, now everything is clear :)
15:43:49Araqdamn it, fix .noInit
15:44:03FromGitter<tim-st> what do you mean?
15:44:09Araqthere is even some logic for it in the backend to detect the case
15:44:27FromGitter<tim-st> do mean that is not implemented? :D
15:44:28AraqI mean, the compiler can easily be smart enough to not require .noInit
15:44:40FromGitter<tim-st> ah, that would be super cool
15:44:41Araqand it already is implemented, somewhere
15:45:22Araqbtw this is why "just derive the $ operator for objects" is bad: https://ci.appveyor.com/project/Araq/nim/build/4254/tests
15:45:42Araqit's a misfeature, code that shouldn't compile, compiled and only the tests found it
15:46:29Araqit's also part of this "everything must be generic" mindset...
15:48:04FromGitter<tim-st> ok, one question I forgot: I saw many people make there arrays of size nextPowerOfTwo, I read indexing on these sizes is much quicker and of course the mod operation, is there any other thing that is better if I dont resize?
15:48:39FromGitter<tim-st> compared to a size like 50
15:49:05FromGitter<aboisvert> can prevent "false sharing" of cache lines
15:49:09Araqyou need to benchmark, bigger sizes means the cache is less effective
15:49:33FromGitter<tim-st> ok, thanks
15:49:42Araqand a 'mod' operation never showed up in my profile
15:49:53Araq(in fact the GC uses one in a critical section)
15:50:06FromGitter<tim-st> you replaced it by `(i+1) and msk`
15:51:18*jjido joined #nim
15:53:40*aleandros left #nim (#nim)
15:58:45FromGitter<tim-st> I updated https://github.com/nim-lang/Nim/issues/7839 ; it seems my source code was wrong and the compiler didnt expect the square brackets at the return typ
15:58:54FromGitter<mratsim> When I benched `div` and `mod`, often the perf counters are on the `mov` that is folling the `idiv` operation
15:59:06FromGitter<mratsim> following*
16:05:16FromGitter<krux02> @mratsim I don't know what you want to say with that
16:06:08FromGitter<mratsim> that profiling might highlight the wrong operation
16:06:17FromGitter<krux02> ah, ok
16:07:16FromGitter<krux02> I am now manually writing OpenGL code again, because I am working on a new code generater. and hey I have the famous black screen to get my debug information
16:09:15FromDiscord<emekoi> is the `noInit` pragma implemented or does it not actually do anything?
16:12:35PMunchIt does something
16:13:05PMunchWhy do you wonder
16:14:16*avsej quit (Ping timeout: 265 seconds)
16:18:02FromDiscord<treeform> krux02, openGL black screen is the best. On windows (but not mac) there is the debug callback that is kind of more helpful now.
16:18:22*noonien joined #nim
16:18:29FromDiscord<treeform> "glDebugMessageCallback"
16:19:33PMunchHmm, is there a way to pass a docstring to a template? I have a template to generate an accessor procedure for a given type and name the proc by a given name. Would be nice to also be able to pass a docstring for the generated proc
16:24:47*avsej joined #nim
16:24:56*avsej quit (Changing host)
16:24:56*avsej joined #nim
16:27:12*Trustable joined #nim
16:32:18*PMunch quit (Quit: leaving)
16:35:34*jjido quit (Ping timeout: 260 seconds)
16:39:12FromDiscord<emekoi> @PMunch I tried the example in the manual, but when I call `repr` on it and `echo` it out the array is initialized. here is the example: https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement
16:49:51*vivus quit (Quit: Leaving)
16:49:58Yardanicohttps://github.com/pascalmouret/assyria another OS (well, mostly kernel) in Nim :)
16:50:01*Trustable quit (Remote host closed the connection)
17:11:11*Ven`` joined #nim
17:11:39*Ven`` quit (Client Quit)
17:12:35*CodeVance joined #nim
17:15:48*nsf quit (Quit: WeeChat 2.1)
17:24:11FromGitter<mratsim> @emekoi what do you mean by the array is initialized? all values are 0?
17:26:33FromGitter<data-man> @mratsim Yes. ⏎ ⏎ ```var ⏎ a {.noInit.}: array[0..1023, char] ⏎ echo a``` [https://gitter.im/nim-lang/Nim?at=5aff0cc9bd10f34a68129a98]
17:28:32FromGitter<data-man> !eval var i {.noInit}: int; echo i
17:28:34NimBot0
17:29:35FromGitter<Varriount> !eval var i {.noInit}: array[0..20, int]; echo i
17:29:38NimBot[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
17:30:01FromGitter<Varriount> I think noinit might only work on non-global variables.
17:30:08leorize!eval echo NimVersion
17:30:10NimBot0.18.0
17:30:37leorizeVarriount: IIRC .noInit is only recently fixed in devel and was broken in 0.18.0
17:31:10*cspar_ quit (Ping timeout: 256 seconds)
17:31:14FromGitter<mratsim> @leorize, noInit for ref object was broken
17:31:39FromGitter<mratsim> but noInit for stack objects was working, but maybe not for arrays?
17:32:04*SenasOzys joined #nim
17:32:07FromGitter<mratsim> I had a noInit bug last week so I’m sure it worked on devel for stack object.
17:32:36leorizemaybe the allocated array happens to end up in a zero-ed area in memory?
17:32:53FromGitter<mratsim> no chance
17:33:29FromGitter<mratsim> !eval var i {.noInit}: array[0..20, float32]; echo i
17:33:31NimBot[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
17:36:12FromGitter<data-man> Docs says: ⏎ ⏎ > Var statements declare new local and global variables and initialize them. A comma separated list of variables can be used to specify variables of the same type ⏎ > If an initializer is given the type can be omitted: the variable is then of the same type as the initializing expression. Variables are always initialized with a default value if there is no initializing expression. ⏎ > The default
17:36:12FromGitter... value depends on the type and is always a zero in binary. ... [https://gitter.im/nim-lang/Nim?at=5aff0f0c1cfca775e11d2484]
17:37:06*miran joined #nim
17:37:47*FuntDobra joined #nim
17:39:26*rockcavera joined #nim
17:47:41miranseems like there is some activity here currently.... maybe somebody would like to be a volunteer to review my nim tutorial for beginners?
17:48:43FromGitter<mratsim> well {.noInit.} for stack variables is not a big optimization anyway: arrays are small due to the small stack and memset is either optimized away by the compiler (?) (which it cannot do for seq/heap arrays).
17:49:34FromGitter<tim-st> btw is there something like https://godbolt.org/ for nim?
17:49:59FromGitter<mratsim> unfortunately no
17:50:21FromGitter<tim-st> ok, thanks
17:51:21dom96https://github.com/mattgodbolt/compiler-explorer/issues/206
17:53:10FromGitter<tim-st> would be really nice
17:53:28dom96I wonder if everyone that sees "Nim compiles to C" immediately thinks "well that sucks, I'll have to manually deal with the C code and call a C compiler"
17:54:31FromGitter<mratsim> “Nim uses C as an intermediate representation"
17:56:25Araqno, Nim produces C code, but it's not its IR
18:01:27*FuntDobra quit (Ping timeout: 240 seconds)
18:06:02federico3dom96: yes and people asked me - that's why I usually say "Nim comples to C and then ..."
18:11:08FromGitter<data-man> But x64-code generation on pure Nim in future plans. ⏎ Why not?
18:13:56Yardanicomiran, I'm not really good at reviewing articles, but I can read it and give some feedback :)
18:14:24YardanicoYou should probably make a post on the forum so a lot of people can point out any issues with the article
18:15:33*nsf joined #nim
18:18:46FromDiscord<emekoi> @data-man so even with the pragma nim initialized the array?
18:19:11FromGitter<data-man> Yes
18:21:04FromGitter<data-man> Just it's not covered by tests. :(
18:21:21*SenasOzys quit (Ping timeout: 248 seconds)
18:24:10miranYardanico: it is not an article, it is more like mini-book :)
18:24:38miranand i don't want to go in public until i get some more (private) reviews, so i implement those changes/improvements
18:25:26FromDiscord<emekoi> then doesn't that mean the pragma doesn't actually work?
18:27:07Yardanicoit does
18:28:37*smt joined #nim
18:28:44*SenasOzys joined #nim
18:29:26Yardanicomiran, well, you can link it to me in PM :) also maybe dom96 or @data-man can read it if they're not busy
18:31:15FromGitter<data-man> I can read, but nothing more :)
18:31:50FromGitter<data-man> @emekoi: works for local vars
18:34:26*FuntDobra joined #nim
18:34:42FromGitter<data-man> https://lemire.me/blog/2018/05/16/validating-utf-8-strings-using-as-little-as-0-7-cycles-per-byte/ https://github.com/lemire/fastvalidate-utf-8
18:44:51*FuntDobra quit (Ping timeout: 240 seconds)
18:59:02Araqmiran: let me read it
19:02:22FromGitter<data-man> @Araq: is all ok with CritBits?
19:03:36FromGitter<tim-st> just tested `{.noInit.}` pragma in dev version and can confirm that it works for arrays
19:13:49*noonien quit (Quit: Connection closed for inactivity)
19:13:57Araqdata-man: merged it but it's offensive this nonsense got the "high priority" tag :P
19:15:05FromGitter<data-man> Thanks! ⏎ I didn't know how else to pay attention! :)
19:16:14FromGitter<data-man> So, maybe move pathMatches to ospaths?
19:20:26*skrylar joined #nim
19:25:24Yardanicowait, changelog says "nil for strings/seqs is finally gone. Instead the default value for these is "" / @[]." but it's not true for the result type of a proc (If I declare a proc which has a return type of seq[int] and don't initialize result, the returned seq will be nil)
19:26:04Yardanicois this supposed to be like this or it'll be fixed before the next release?
19:28:07FromGitter<krux02> Yardanico: did you test to not initialize seq string on the vm?
19:28:13FromGitter<krux02> (in a static block)
19:28:25FromGitter<krux02> (or in a macro)
19:29:02YardanicoNo, I just wrote "proc test(): seq[int] = discard " and did echo test()
19:31:33YardanicoIt should output @[] instead of "nil"
19:32:29mirancan you try it with {.experimental.} and see if it works then?
19:33:13Yardanicomiran, it's still "nil" for me, strange...
19:33:26FromGitter<data-man> echo test().isNil() ?
19:33:39Yardanicotrue
19:33:51Yardanicowell, it "works" if I add something to resulting sequence
19:34:10Yardanicoe.g. "proc test(): seq[int] = result.add 1" and echo test() will print @[1]
19:35:58Araqwell the $ for seqs is wrong :P
19:36:02FromGitter<data-man> echo test().len ? :)
19:36:08Araqit should print @[] for nil :P
19:36:14Araqand 'nil' shouldn't compile
19:37:07Araqunfortunately, when I completed my work on it, I got totally weird GC crashes
19:55:33*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:05:49*nolanv quit (Quit: WeeChat 2.0.1)
20:22:16*Sembei joined #nim
20:25:16FromGitter<zetashift> @miran I'd love to read it too x)
20:45:29*Vladar quit (Quit: Leaving)
20:51:51*pwntus quit (Ping timeout: 240 seconds)
20:55:14*pwntus joined #nim
20:56:34FromDiscord<awr> what's the easiest way to convert a seq of enum values to a set
20:59:05*avsej quit (Ping timeout: 240 seconds)
20:59:50skrylarfor x in someseq: incl(someset, x) # ?
21:00:42FromDiscord<awr> preferably as a single expression
21:01:22*avsej joined #nim
21:01:22*avsej quit (Changing host)
21:01:22*avsej joined #nim
21:01:22FromDiscord<awr> i tried `enumSeq.foldl(a.incl(b), {})` but i got `Error: cannot infer the type of the set`
21:03:58*gb00s quit (Remote host closed the connection)
21:04:32skrylartemplate lazybones*[T](salad: seq[T]): set[T] = foreach x in salad: incl (result, x) # ?
21:05:37skrylarmight work better as an inline proc. templates sometimes get disobedient
21:07:57*gb00s joined #nim
21:12:27*athenot joined #nim
21:35:21*gokr quit (Ping timeout: 240 seconds)
21:40:14*rockcavera quit (Remote host closed the connection)
21:40:51*miran quit (Ping timeout: 255 seconds)
21:55:05*cakesauce joined #nim
21:57:39cakesauceJust discovered nim last week and great odin’s beard, it is glorious. Well done.
21:59:57dom96welcome :D
22:06:41*sz0 joined #nim
22:09:04*cakesauce quit (Ping timeout: 260 seconds)
22:15:09*rockcavera joined #nim
22:17:44skrylari just had the weird urge to document and comment exclusively in dead/dying languages
22:17:52skrylar"It's fully commented and there's a 200 page manual"
22:18:12skrylarthe arse wrote it in cunieform what the crap
22:18:21FromDiscord<treeform> deepCopy has really odd API, why not `proc deepCopy[T](original: T): T = deepCopy(result, original)`
22:19:19FromGitter<tim-st> is nim `mod` operation defined like it says in the comment in `system.nim`?
22:19:47FromGitter<tim-st> it gives different results as Python
22:19:56FromGitter<tim-st> for -1 mod 4
22:20:03FromDiscord<treeform> are you having issues with negatives
22:20:10FromDiscord<treeform> yeah python does not do it the c way I think.
22:20:24FromDiscord<treeform> languages do negative mod differently
22:21:02FromDiscord<treeform> !eval -1 mod 4
22:21:03NimBotCompile failed: in.nim(1, 4) Error: expression '-1' is of type 'int literal(-1)' and has to be discarded
22:21:04FromGitter<tim-st> oh, I see, the problem is `div` not mod
22:21:11FromDiscord<treeform> !eval echo -1 mod 4
22:21:13NimBot-1
22:21:35FromDiscord<treeform> and python says 3
22:21:48FromGitter<tim-st> is -1 expected from math point ov view?
22:22:01FromDiscord<treeform> mod is not really a math thing
22:22:19FromDiscord<treeform> I think its not defined usually
22:22:48FromDiscord<treeform> "When either a or n is negative, the naive definition breaks down and programming languages differ in how these values are defined." from Wikipedia
22:22:51FromDiscord<treeform> https://en.wikipedia.org/wiki/Modulo_operation
22:23:27FromGitter<tim-st> ok, thanks
22:27:16FromGitter<tim-st> I have a solution: I use half of positive int64 as start than it wont get negative^^
22:28:02FromGitter<tim-st> well, no :(
22:28:36FromDiscord<treeform> maybe https://gist.github.com/treeform/51db7a31b1bb64daf5bdb662a9b8e6c8 ?
22:29:20FromGitter<tim-st> yes, that's possible but seems a bit slow, but I will take it for now, thanks!
22:32:37FromGitter<tim-st> hm, the idea with half of positive int64 could work, do you think it's harder to calc bigger numbers mod?
22:33:20FromDiscord<treeform> ok here is the fixed version:
22:33:21FromDiscord<treeform> https://gist.github.com/treeform/51db7a31b1bb64daf5bdb662a9b8e6c8
22:34:00FromGitter<tim-st> that's two times mod^^
22:34:06FromDiscord<treeform> I think there is no meaningful difference in computing big or small mods.
22:34:35FromGitter<tim-st> nice, so as long my number never become negative it should work
22:35:14FromGitter<tim-st> since all array sizes are smaller than Positive.high / 2 I could use this as start index for my ring buffer
22:36:56FromDiscord<treeform> it looks like C is more of a remainder then a modulo
22:37:04FromDiscord<treeform> and so Nim's
22:37:27FromDiscord<treeform> I think python version is more mathematically correct.
22:37:44FromGitter<tim-st> yes, and also more usable, since mod is often used for indexing
22:39:22FromGitter<tim-st> this is my start now, should always work in theory: `Positive.high shr 1`
22:39:23FromDiscord<treeform> in python you can have negative indexes, in nim you cannot.
22:39:43FromDiscord<treeform> why not div 2 more readable?
22:39:57FromDiscord<treeform> `Positive.high div 2`
22:40:02FromGitter<tim-st> ok, yes, I tried / 2 and got float
22:40:16FromDiscord<treeform> shr would work badly for non power of 2 numbers
22:40:49FromDiscord<treeform> nim has float * / and integer mul and div.
22:40:51FromGitter<tim-st> isnt shr 1 and div 2 always the same?
22:41:03FromDiscord<treeform> I don't think so.
22:41:18FromDiscord<treeform> !eval echo 13 shr 1
22:41:20NimBot6
22:41:33FromDiscord<treeform> !eval echo 13 div 2
22:41:36NimBot6
22:41:41FromGitter<tim-st> ^^
22:41:43FromDiscord<treeform> hmm your might be right
22:42:05FromDiscord<treeform> it just throws a way the .5 or .1 in binary
22:42:15FromGitter<tim-st> yes
22:42:25FromDiscord<treeform> 1101 -> 110.1
22:42:41FromDiscord<treeform> |110.1| is 110
22:42:44FromDiscord<treeform> so you you are right
22:42:57FromDiscord<treeform> 13 is 1101 in binary
22:43:37FromDiscord<treeform> but I still think div 2 is more readable
22:43:43FromGitter<tim-st> I just remembered that I tried that some years before in Python with >> and //
22:45:17federico3any way to iterate over fiels of an object type (not an instance)?
22:47:14FromGitter<tim-st> dont know, maybe you see this in marshal package
22:47:45FromGitter<tim-st> or https://nim-lang.org/docs/typetraits.html
22:48:37*CodeVance_ joined #nim
22:49:12FromDiscord<treeform> also https://stackoverflow.com/questions/42467627/how-to-iterate-over-fields-names-types-of-a-tuple-object-in-a-macro
22:50:47*CodeVance quit (Read error: Connection reset by peer)
22:54:55Notkeahello, is it possible to use a particular module from the stdlib on the devel branch while staying on the stable branch for all the other?
22:55:46FromDiscord<treeform> I kind of done this in the past by just copying the file to my folder
22:55:54FromDiscord<treeform> if its self contained enough you can do it.
22:56:36FromDiscord<treeform> i usually just use the devel branch for everything now
22:57:24*rockcavera quit (Remote host closed the connection)
22:58:30*rockcavera joined #nim
22:59:16*athenot_ joined #nim
22:59:29*athenot quit (Ping timeout: 276 seconds)
22:59:35Notkeathanks, I'll try this
23:00:16*nsf quit (Quit: WeeChat 2.1)
23:03:26*athenot joined #nim
23:04:08*athenot_ quit (Ping timeout: 265 seconds)
23:19:03*CodeVance_ quit (Quit: Leaving)
23:23:53*CodeVance joined #nim
23:24:50*athenot quit (Ping timeout: 276 seconds)
23:25:02*athenot_ joined #nim
23:27:15*deech joined #nim
23:27:46*NimBot joined #nim
23:28:28deechIs there a way to expose the non function members of object variants as C structs/unions?
23:33:41*athenot joined #nim
23:33:48*athenot_ quit (Ping timeout: 255 seconds)
23:35:55FromDiscord<awr> can you elaborate on what you mean
23:38:21*athenot quit (Ping timeout: 240 seconds)
23:42:32*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
23:44:44deechI want call a Nim proc returns an object. If I can expose that object as a struct than I don't have to do any unmarshalling.
23:44:58*xet7 quit (Remote host closed the connection)