<<24-03-2020>>

00:00:15FromDiscord<Rika> why so?
00:01:12leorizebecause it assumes a totally efficient system
00:01:22leorizethere are other thing running that's not your program
00:01:55leorizeif the core is blocked because the os scheduled some of its thread on it, then your work will only be invoked in small intervals
00:02:17leorizeother cpu cores might be free, but since you pinned it there, it can't go anywhere else
00:02:26leorizeand no, the os won't let you hold the core exclusive
00:02:32FromDiscord<Rika> i see
00:03:09FromDiscord<Rika> so basically you're saying pinning anything is abd
00:03:10FromDiscord<Rika> bad(
00:03:11FromDiscord<Rika> bad*
00:03:26leorizesadly, yes :p
00:03:37leorizeos schedulers can do a much better job than you
00:03:40leorizejust let them do their work
00:04:43*dadada__ joined #nim
00:05:56leorizecore pinning is even more inefficent now that we have more diverse CPUs
00:11:10rayman22201https://linux.die.net/man/1/taskset
00:11:17rayman22201but yeah, it's generally a bad idea
00:12:00rayman22201also https://linux.die.net/man/8/numactl
00:16:12*dwdv quit (Ping timeout: 256 seconds)
00:26:14*zacharycarter quit (Ping timeout: 240 seconds)
00:28:10*dadada__ quit (Ping timeout: 256 seconds)
00:34:39*dadada joined #nim
00:35:03*dadada is now known as Guest87845
00:36:33*krux02_ joined #nim
00:39:32*krux02 quit (Ping timeout: 260 seconds)
00:43:36*rnrwashere joined #nim
00:52:16FromGitter<awr1> yeah emacs for nim is broken. yet i still use it lol
00:52:29FromGitter<awr1> have had to have nimsuggest disabled for the longest time
00:58:25*Guest87845 quit (Ping timeout: 264 seconds)
00:59:15FromGitter<zetashift> nim support for emacs is the only reason I haven't switched yet :(
00:59:20FromDiscord<Rika> how do i "put the contents of a seq into an array"
00:59:31FromDiscord<Rika> just like i can "convert an array into a seq
00:59:49leorizeRika: you iterate the array, then copy each elements from the seq
01:00:13FromDiscord<Rika> thats the only way?
01:00:19leorizearrays are fixed in size, so you can't do magical "copy back" kind of thing
01:00:36shashlickCPU affinity is important when talking to PCI devices like GPUs and FPGAs
01:00:43shashlickYou don't want to go over QPI
01:00:56FromDiscord<Rika> i mean, i thought there would be a proc that did that, leorize
01:00:58leorizeshashlick: you won't be doing that in user space :P
01:01:13leorize@Rika: nope, there aren't, sadly :P
01:01:59shashlickIt's not always bad is what I'm saying
01:02:40leorizeah, yea
01:05:13krux02_awr1: yea pretty disappointing with nimsuggest in emacs.
01:08:19*krux02_ quit (Remote host closed the connection)
01:08:38leorize[m]if you don't fix it no one will
01:09:26*dadada joined #nim
01:09:50*dadada is now known as Guest84506
01:15:51shashlickwhy is it so hard to fix nimsuggest itself
01:16:44FromGitter<zetashift> the memory leaks you mean?
01:21:23shashlickyep
01:28:03*Guest84506 quit (Ping timeout: 250 seconds)
01:29:28FromGitter<zetashift> I thought this pragma was deprecated: https://github.com/Guevara-chan/Midday-Commander/blob/master/src/main.nim#L3 ?
01:29:31leorizethe memory leaks isn't that bad for me
01:29:57leorizebut I'd expect that the reason was because of how the compiler was designed
01:30:59leorize[m]zetashift: yes is was
01:31:17leorize[m]doesn't mean that you can't write code that use it though
01:31:53*rnrwashere quit (Remote host closed the connection)
01:34:38*dadada__ joined #nim
01:35:42FromDiscord<Rika> deprecated doesnt mean removed
01:35:49FromDiscord<Rika> just means slated for removal
01:57:57*dadada__ quit (Ping timeout: 250 seconds)
02:04:38*dadada__ joined #nim
02:07:36*rnrwashere joined #nim
02:09:01FromGitter<zetashift> dang okay that it was gone already
02:28:17*dadada__ quit (Ping timeout: 250 seconds)
02:34:36*dadada joined #nim
02:35:00*dadada is now known as Guest80620
02:36:07*chemist69_ quit (Ping timeout: 246 seconds)
02:38:11*chemist69 joined #nim
02:45:29*endragor joined #nim
02:52:03*zacharycarter joined #nim
02:58:20*Guest80620 quit (Ping timeout: 256 seconds)
03:04:43*dadada__ joined #nim
03:27:54*dadada__ quit (Ping timeout: 240 seconds)
03:34:32*dadada joined #nim
03:34:55*dadada is now known as Guest77250
03:43:41*endragor quit (Remote host closed the connection)
03:43:53*endragor joined #nim
03:54:35*muffindrake quit (Ping timeout: 246 seconds)
03:57:02*muffindrake joined #nim
03:57:54*Guest77250 quit (Ping timeout: 240 seconds)
04:04:37*dadada__ joined #nim
04:06:22*rnrwashere quit (Remote host closed the connection)
04:12:43*zacharycarter quit (Ping timeout: 250 seconds)
04:23:12*pydsigner quit (Excess Flood)
04:23:24*pydsigner joined #nim
04:27:50*dadada__ quit (Ping timeout: 246 seconds)
04:34:39*dadada joined #nim
04:35:02*dadada is now known as Guest96692
04:35:21*nsf joined #nim
04:57:54*Guest96692 quit (Ping timeout: 256 seconds)
05:04:44*dadada__ joined #nim
05:08:26*rnrwashere joined #nim
05:21:25*sleepyqt joined #nim
05:28:07*dadada__ quit (Ping timeout: 250 seconds)
05:34:32*dadada joined #nim
05:34:55*dadada is now known as Guest27836
05:54:25*rnrwashere quit ()
05:58:01*Guest27836 quit (Ping timeout: 250 seconds)
06:00:23*endragor quit (Remote host closed the connection)
06:01:13*silvernode joined #nim
06:04:38*dadada__ joined #nim
06:10:21*endragor joined #nim
06:10:23silvernodeGood morning
06:10:32silvernodetime to work on the game again
06:20:19silvernodeSo my code is using a lot of if statements and some while loops, but I know more experienced programmers here might have better syntax replacements for those to make the clode cleaner and more reliable.
06:20:24*narimiran joined #nim
06:21:15silvernodeI figured I should ask for guidence before I get too deep into my project
06:28:00*dadada__ quit (Ping timeout: 256 seconds)
06:34:41*dadada joined #nim
06:35:05*dadada is now known as Guest97938
06:39:18*solitudesf joined #nim
06:57:49*silvernode quit (Ping timeout: 250 seconds)
06:58:15*Guest97938 quit (Ping timeout: 250 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:03:46FromDiscord<Benumbed> Ifs aren't necessarily bad, it's if they're nested and how deep
07:04:02FromDiscord<Benumbed> You get into branch predictor performance at that point
07:04:41*dadada__ joined #nim
07:04:55*gmpreussner joined #nim
07:05:21FromDiscord<Benumbed> Loops also aren't bad (and are very much expected in games) it's whether those loops are in your main game loop, and if they are, how optimized they are
07:06:10FromDiscord<Benumbed> In fact that's generally the advice I give to people about performance, at least until you're ready to optimize: If it's not in the tight loop (the game loop), don't worry about it
07:06:32FromDiscord<Benumbed> If it's in the tight loop, just make sure it's only doing exactly what it needs to do in order to accomplish the goal
07:06:45FromDiscord<Benumbed> and with that I'll shut up, because this is #general not #offtopic 🙂
07:12:03*dddddd quit (Remote host closed the connection)
07:28:09*dadada__ quit (Ping timeout: 250 seconds)
07:34:38*dadada joined #nim
07:35:01*dadada is now known as Guest56251
07:36:22*sealmove quit (Quit: WeeChat 2.7.1)
07:39:13*crem quit (Ping timeout: 246 seconds)
07:40:25*crem joined #nim
07:59:34*PMunch joined #nim
08:12:17*Vladar joined #nim
08:24:51*PMunch quit (Quit: leaving)
08:27:46*PMunch joined #nim
08:42:07PMunchAnyone know of a cross platform way to get the MAC address of the different network cards installed in a machine?
08:47:32*chemist69 quit (Ping timeout: 246 seconds)
08:48:40*chemist69 joined #nim
09:08:07*dwdv joined #nim
09:37:54*krux02 joined #nim
09:55:32PMunchHmm, I seriously can't find an RSA library for Nim. Is that really the case?
09:56:34PMunchI found a program called NimChat that has it, but it also has a huge "DO NOT USE THIS FOR SECURITY" at the top..
10:25:55*tane joined #nim
10:31:34FromGitter<timotheecour> Hi @araq are you here? i’m trying to understand your comment
10:34:13Araqhi
10:35:23FromGitter<timotheecour> so what do u mean by https://github.com/nim-lang/Nim/pull/12076#issuecomment-603152631 ?
10:35:26disbot➥ 3`resolveSymbol(foo(args))` and `overloadExists(foo(args))` to return symbol after overload resolution ; snippet at 12https://play.nim-lang.org/#ix=2f86
10:36:13lqdev[m]I suppose https://github.com/cheatfate/asynctools is dead?
10:36:26lqdev[m]issues are not responded to, PRs are not getting merged
10:36:43Araqcheatfate is busy with Chronos
10:36:59lqdev[m]right
10:37:10Araqfork it
10:38:02Araqtimotheecour: I'm refering to the RFC that justifies your implemented feature
10:39:00FromGitter<timotheecour> so with `resolveSymbol` that I’ve implemented , I get `overloadExists` for free
10:39:30Araqhow?
10:39:35FromGitter<timotheecour> and the reverse is not possible, if i only had an alternative implementation that did `overloadExists`, i could not get resolveSymbol
10:40:02FromGitter<timotheecour> look at the extensive test suite: https://github.com/nim-lang/Nim/pull/12076/files#diff-9a85c49130f34040ffe2ca65f07eddf9
10:40:04disbot➥ 3`resolveSymbol(foo(args))` and `overloadExists(foo(args))` to return symbol after overload resolution ; snippet at 12https://play.nim-lang.org/#ix=2f86
10:40:45Araqah
10:41:12Araqbut then const newName = resolveSymbol f(1)
10:41:32Araqis unreliable, isn't it? as it can return NimNode(nil) or something like that
10:43:35FromGitter<timotheecour> but `overloadExists(f(1))` would return the correct thing (true or false) depending on whether `f(1)` would sigmatch or not
10:44:04Araqyeah I understand
10:44:28lqdev[m]https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/osproc.nim#L1059 doesn't the process here have to be killed, or something? closing its streams seems not enough.
10:44:59Araqlqdev[m], it's not "kill" the process
10:45:31Araqwell we replace system.compiles because it's too powerful and here you are implemeting overloadExists with something more powerful
10:45:32lqdev[m]I know, but just leaving the Pid handle as is feels… wrong
10:45:33FromGitter<timotheecour> There are many applications to `resolveSymbol` besides `overloadExists`, eg it’s super useful for debugging as u get access to the file:line where an overload (or field!) is defined
10:46:25FromGitter<timotheecour> overloadExists (and resolveSymbol) is cheaper than compiles, bc it doesn’t semcheck the proc body
10:46:59Araqtoday's Nim supports "select overload" via a type conversion much like C++ does
10:47:07FromGitter<timotheecour> and it’s by design. so u can have `compiles(foo(1))` return false yet `overloadExists(foo(1)` return true
10:50:04FromGitter<timotheecour> Basically, almost all cases of `compiles(expr)` ins stdlib can be replaced by `overloadExists(expr)`, and it will be faster to compile and also less error prone (in case a bug is in the body, it will give a CT error instead of silently ignoring it). That leaves some unittests that DO require `compiles`.
10:59:37AraqI want overloadExists, fieldExists and canImport though, IMHO resolveSymbol is code obfuscation
11:00:28Araqand the nil-stateof resolveSymbol is particularly troublesome
11:08:26*narimiran quit (Ping timeout: 256 seconds)
11:20:14*couven92 joined #nim
11:21:13*narimiran joined #nim
11:21:57narimiranANOUNCEMENT: A new beta of v1.2 is available from nightlies: https://github.com/nim-lang/nightlies/releases/tag/2020-03-24-version-1-2-c8f1ac3
11:21:59narimiranPlease give it a try ASAP and report any regression you might find. Thank you in advance!
11:35:30*luis_ joined #nim
11:58:12*dddddd joined #nim
12:07:44*narimiran quit (Ping timeout: 246 seconds)
12:08:43*lritter joined #nim
12:08:50*Tungki joined #nim
12:26:00*natrys joined #nim
12:28:01*arecaceae quit (Remote host closed the connection)
12:28:24*arecaceae joined #nim
12:39:43*narimiran joined #nim
12:41:19*endragor quit (Remote host closed the connection)
12:41:43*clyybber joined #nim
12:57:57jkenI have some code.. for i in 0..<mesh.vertexCount: mesh.vertices[i]
12:58:12jkenTells me: cannot evalute i at compile time
12:58:58jkenI think its because mesh.vertices is a ptr to a TVector3d
12:59:07jkenand TVector3d is a tuple[x, y, z: cfloat]
12:59:20jkenAnyone know how I can get around this?
13:04:13clyybberHa, I had this issue too just some time ago
13:04:21clyybberThe issue is that vertices is a pointer yeah
13:04:56clyybberTry defining a `[]` overload for the ptr T
13:04:59clyybberThats what I did
13:05:39clyybberWeirdly enough it didn't work with the normal syntax in some cases and I had to resort to calling it manually like `[]`(mesh.vertices, i)
13:05:56clyybberjken: Are you writing an assimp loader?
13:06:16jkenclyybber: I am trying to use this loader: https://github.com/barcharcraz/nim-assimp/blob/master/assimp.nim
13:06:51jkenHad to make some other changes to that package to make it work with modern nim
13:06:55jkenbut all minor
13:07:14clyybberYeah, I used exactly that one too
13:07:24clyybberI can give you my version
13:07:28clyybberIts already finished
13:07:33clyybberIts about 3 days old
13:07:34jkenIll definitely take a look!
13:07:48clyybberWhat a coincidence haha
13:08:27clyybberjken: http://ix.io/2f8O
13:08:33jkenThank you
13:08:37clyybbernp
13:09:02clyybberthe sassimp version it wraps is a bit old tho I think
13:09:17clyybberI just needed it to test my engine a bit
13:09:53Araqfinally managed to build z3.dll
13:10:00Araqbut it's 32bits *sigh*
13:10:17clyybberNice tho
13:10:38clyybberAraq: Is there no way to import seqs_v2 ?
13:10:58clyybberFrom usercode I mean
13:11:10clyybberTo translate things like cast[pointer](someSeq)
13:12:08Araqthere is no way to import seqs_v2
13:12:12Araqbut it's worse than that
13:12:29Araqthis cast cannot possibly be supported since a seq now is two machine words
13:12:43clyybberYeah, I just translate it as
13:12:52clyybbercast[NimSeqV2](x).p
13:13:15clyybberLike like comparisions.nim does
13:13:28jkenclyybber: can I see your code where you actually work with the vertices?
13:13:37PMunchHmm, I tried to use stint to do RSA with a 2048-bit key. Works fine with `message_int.powmod(d, n)`, but it takes a solid 4 seconds to run..
13:13:58clyybberjken: I don't have it anymore :/
13:14:06jkenah no worries
13:14:09clyybberActually, lemme check
13:14:22clyybberI use btrfs so I may be able to recover it
13:15:14clyybberHmm, looks like its already gone, sorry
13:15:28jkenThat's okay, thank you
13:15:51clyybbernp
13:20:26FromDiscord<onelivesleft> hey, I'm doing this: ```
13:20:26FromDiscord<onelivesleft> let exe_filename = current_source_path().extract_filename.change_file_ext("")```
13:20:26FromDiscord<onelivesleft> to find the name of the compiling nim file, but it gives me the name of *my* nim file, not the file which is importing it. I want the name of the end executable: is that possible?
13:21:00PMunchHmm, def-'s bigint library does it in about 2.7s
13:21:07PMunchSo that's better at least..
13:22:56Araqclyybber, that loses the length information though
13:23:27jkenclyybber: sorry to bother, even in your impl mesh.vertices is a ptr to a single tuple, is the assumption that the rest of the vertices (tuples) are stored linearly in memory from there? How the f do I iterate that in nim :/
13:23:54Araqjken, cast to 'ptr UncheckedArray[...]'
13:23:54*zacharycarter joined #nim
13:24:15jkenahh
13:25:48clyybberAraq: Yeah, I'm just looking to translate cast[pointer](someSeq)
13:25:56PMunchHmm, with -d:danger and --gc:markandsweep I get bigints down to 1.6s
13:26:37*luis_ quit (Ping timeout: 260 seconds)
13:27:25clyybberWhat about mratsims one?
13:28:19PMunchclyybber, was that for me?
13:28:48jkenthanks Araq
13:29:30clyybberPMunch: Yeah :D
13:29:45PMunchWhich one are you thinking about?
13:31:52PMunchJust realised that the bigints example I found created its own powmod implementation..
13:31:55clyybberI remember he sent you one
13:32:04clyybberOh
13:32:07PMunchHe sent me one? When?
13:32:30clyybberIt was probably the powmod impl then
13:32:37clyybberDon't mind me :)
13:33:00PMunchOh no, that was something I randomly stumbled upon on Rosetta Code :P
13:35:27PMunchWhen did mratsim send me one?
13:36:22PMunchOooh, --gc:arc took it down to 0.9s :D
13:36:59PMunchNot sure if the rest of my code will work with it though..
13:39:17FromGitter<Vindaar> I love when procrastination produces pretty results :D
13:39:32FromGitter<Vindaar> (https://files.gitter.im/nim-lang/Nim/6EaO/periodic_table.png)
13:39:50FromGitter<Vindaar> which is just an adaption of: https://plotnine.readthedocs.io/en/stable/generated/plotnine.geoms.geom_tile.html
13:39:58clyybberPMunch: Sorry I can't remember when that was
13:40:24clyybberI think it was the last time we talked about stacklang, rationals and arbitrary precision
13:40:43clyybberVindaar: Nice
13:41:25FromGitter<Vindaar> thanks!
13:41:30clyybberAraq: Its getting close: https://github.com/nim-lang/Nim/pull/13741
13:41:31disbot➥ 3Fix vm.nim for --gc:arc
13:41:33PMunchHmm
13:42:58PMunchEy @gogolxdong, going back through the IRC logs I see that you've launched a full stack Nim project. Super cool!
13:43:08PMunchEspecially that line count reduction :P
13:43:12*clyybber quit (Read error: Connection reset by peer)
13:43:13*clyybber1 joined #nim
13:43:25PMunchreference: https://irclogs.nim-lang.org/23-03-2020.html#06:33:03
13:43:31FromGitter<gogolxdong> oh, thanks.
13:45:25clyybber1nice
13:46:57PMunchCrap, I think that might've been over in #nim-offtopic clyybber1..
13:47:10PMunchWent back a while in the logs and couldn't find it..
13:47:42clyybber1Hmm, yeah I think it was in offtopic
13:47:54clyybber1You might be able to find it on gitter nim-lang/twitch
13:48:10PMunchgogolxdong, huh never heard of prologue before. Why was hat chosen over Jester?
13:48:26PMunchclyybber1, oh right :P
13:49:40FromGitter<sheerluck> is today a release day
13:49:58clyybber1think so
13:50:06krux02wasn't yesterday release day?
13:50:11PMunchWhat's the coolest new feature in 1.2.0?
13:50:24narimiranPMunch: arc and new sugar macros, IMO
13:50:53PMunchOh arc is shipping? Cool!
13:50:59PMunchSugar macros?
13:51:08narimiran`collect` and `dup`
13:51:43PMunchOh neat, I used dup the other day for... something..
13:51:46FromGitter<gogolxdong> Used Jester for static file server only, when I decided to migrate websocket apis to http apis , one core member of Chinese community was working on his prologue, I just want to try, it's not perfect, but works.
13:52:35PMunchDifferences between that and Jester? Pros, cons?
13:52:57PMunchI'm half-way through writing my own web-framework thingamajig so I'm interested :P
13:53:12PMunchHuh, thingamajig passes my spellchecker
13:53:28FromGitter<sheerluck> https://nim-lang.org/docs/whatsnew/1.2.0.html This article explains the new features in Nim 1.2.0, compared to 1.0.6.
13:53:42FromGitter<sheerluck> but it's not ready yet
13:54:03FromGitter<gogolxdong> Haven't try to migrate to Jester, prologue works for now. Want to encourage more people to work on Nim? :)
13:55:49PMunchAh right, I was just wondering if you had made any interesting observations :) Have you used Jester for anything previously? More people using Nim is always good :D
13:58:53Araqsheerluck: it's delayed once again due to regressions
14:00:38FromGitter<gogolxdong> Used Jester for static file server and upload, apis were in websocket protocol previously, haven't used Jester too much so far.
14:09:39PMunchclyybber1, I found the conversation you were talking about. mratsim mention that bigints is slow, and that's why they made stint. But in my test bigints outperformed stint by about a factor of two..
14:10:38AraqPMunch, benchmarking is hard though :P
14:11:08PMunchWell, my benchmark is just take a private/public keypair and do some powmod on a random string
14:11:18PMunchConverted to an int of course
14:18:14FromGitter<alehander92> Araq you want sourcemaps? for 1.4?
14:20:14Araqyeah
14:20:17*Zevv joined #nim
14:21:37FromGitter<alehander92> ok!
14:22:19*NimBot joined #nim
14:23:55ZevvAraq: crashes on me too
14:25:12Araqok good
14:26:38*couven92 quit (Quit: Client Disconnecting)
14:30:14*jwm224 quit (Quit: WeeChat 2.8-dev)
14:31:27Araqhttps://www.twitch.tv/araq4k
14:31:58*jwm224 joined #nim
14:32:06FromGitter<kennymalac> @shashlick you there? kinda confused on linking bson library to mongo
14:32:37*fanta1 joined #nim
14:33:21AraqI'm streaming!
14:37:04axionIs there anything builtin or some utility library that will map all permutations of some container with repetitions?
14:40:06shashlickwhat's up
14:40:33PMunchmratsim, any hints on doing powmod in constantine?
14:46:18FromGitter<kennymalac> trying to follow libarchive sorta but I'm not sure if I'm doing it right
14:46:19FromGitter<kennymalac> just a sec
14:48:09axionhmm, not seeing anything. not quite sure how to write such a proc either
14:48:58FromDiscord<clyybber> @mratsim forwarding PMunch's ping
14:49:16PMunchDoesn't the bridges auto-add @?
14:49:25FromDiscord<mratsim> it's broken
14:49:32PMunchAh..
14:50:13FromDiscord<mratsim> you need to convert the bigint to montgomery domain and then call that: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/bigints.nim#L315-L367
14:50:26clyybber1thats the one I meant!
14:50:36FromDiscord<mratsim> easier to just use finite field: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/finite_fields.nim#L164-L215
14:51:06FromDiscord<mratsim> example: https://github.com/mratsim/constantine/blob/master/tests/test_finite_fields_powinv.nim#L17
14:51:18FromGitter<kennymalac> @shashlick latest commit pushed to https://github.com/ParadigmInteractive/libmongonim
14:51:25FromDiscord<mratsim> that said, the bigint/modular part of constantine are meant to be internal
14:51:59FromGitter<kennymalac> the mongo CMakeLists is more complex than libarchive's and doesn't seem to have configuration for an external bson library linked
14:52:30FromGitter<kennymalac> so I'm not even sure if any of these flags are doing anything
14:52:43FromGitter<kennymalac> hence why I try this ("target_link_libraries (mongoc_static ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES})", "target_link_libraries (mongoc_static ${STATIC_LIBRARIES} \"{bsonPath}\"")
14:52:43shashlickyou might need to look at the cmakelist file and figure out how to point to the bson directory
14:52:46FromGitter<kennymalac> probably unnecessary
14:53:38FromGitter<kennymalac> yeah I tried to change the link_libraries to refer to the bsonPath directly for the static mongoc target
14:53:41FromGitter<kennymalac> and remove the shared lib
14:54:13PMunchWell fuck me.. Tried doing what I need in C# and it took 1ms..
14:54:25PMunchI think I better find an actual library that can do this for me..
14:54:59FromGitter<kennymalac> personally for web stuff in Nim we are using nginx-link-function and the associated nim wrapper, works great :)
14:55:03FromDiscord<onelivesleft> Does nim have a built in function to convert camelCase to snake_case? I'm working with macros and it would be nice to handle both situations.
14:55:06FromGitter<kennymalac> a bit low level though
14:55:39FromDiscord<mratsim> use eqIdent for comparison in macros
14:55:58FromDiscord<mratsim> otherwise AFAIK I did not find a "normalization" proc
14:56:13FromDiscord<onelivesleft> ty
14:56:36shashlickkennymalac: be right back
14:56:53PMunchBut seriously, is there no RSA library in Nim? Wrapped or otherwise?
14:57:00*Vladar quit (Quit: Leaving)
14:57:28FromGitter<kennymalac> kk
14:58:48axionWell this roadblock is gonna take me some time to figure out :/
15:00:07FromGitter<kennymalac> @shashlick line 29 should be lcm = outdir / "src" / "libmongoc" / "CMakeLists.txt"
15:00:21FromGitter<kennymalac> but my multireplace doesn't seem to work
15:02:14FromGitter<kennymalac> well, if i open the file it appears it didn't replace anything
15:02:49FromDiscord<mratsim> @PMunch, we use bearssl
15:03:50FromDiscord<mratsim> also if you use modular exponentiation for RSA, you need to ensure that the modular exponentiation routine is constant-time or at least uses exponent blinding to avoid leaking your secret key
15:04:49PMunchFor doing just RSA encryption? I guess that's an option..
15:04:54PMunchIs there a good wrapper for it?
15:05:11FromDiscord<mratsim> https://github.com/status-im/nim-bearssl
15:05:20FromDiscord<mratsim> it's undocumented
15:05:45FromDiscord<mratsim> grep for RSA here: https://github.com/status-im/nim-bearssl/blob/master/bearssl/decls.nim
15:05:52shashlickkennymalac: you don't need full path for getHeader - it searches for the header file
15:06:15PMunchmratsim, already grepping :D
15:06:25FromDiscord<mratsim> usage is somewhere in https://github.com/status-im/nim-eth/tree/master/eth/p2p or https://github.com/status-im/nim-libp2p
15:06:37FromDiscord<mratsim> BearSSL docs also apply
15:06:42*fanta1 quit (Quit: fanta1)
15:09:02FromGitter<kennymalac> good to know @shashlick but the mongo header is pretty deeply nested so better safe than walk 10+ dirs lol
15:09:21shashlickno loss sure
15:09:42FromGitter<kennymalac> but yeah doesn't seem it's multireplacing on the file
15:09:47FromGitter<kennymalac> the CMakeLists.txt
15:09:48*sealmove joined #nim
15:11:23sealmoveMaking a Kaitai Struct backend for Nim is impossible T_T. The code generation architecture is designed for languages that support nested classes or at least some type of namespacing.
15:11:52FromDiscord<mratsim> can't you simulate namespacing with gensym?
15:14:16axionis there a proc existing somewhere that when given the string "ab" and a count of 3, will produce all permutations with repetitions allowed. Something like: @["aaa", "aab", "aba", "abb", "baa", "bab", "bba", "bbb"]
15:14:52FromDiscord<mratsim> in algorithm there is a product that give you the cartesian product of 2 sequences
15:14:55FromDiscord<mratsim> you can apply it twice
15:15:16FromDiscord<mratsim> otherwise triple for loop
15:15:30shashlickkennymalac: how are you compiling this - command line
15:15:39axioncan you give an example of the former method?
15:16:07FromDiscord<mratsim> See there: https://nim-lang.org/docs/algorithm.html#product%2CopenArray%5Bseq%5BT%5D%5BT%5D%5D
15:16:11FromGitter<kennymalac> nim c --run -d:mongocGit -d:bsonGit libmongonim.nim --verbose > test
15:16:41FromDiscord<mratsim> ah, it gives your sequences of sequences, it doesn't merge them so you will have to apply a join
15:16:49FromDiscord<mratsim> probably better to triple for loop
15:17:44FromGitter<kennymalac> oh shit lol changed it to -d:bsonStatic and it works
15:18:02FromGitter<kennymalac> well, that problem was averted
15:18:17FromGitter<kennymalac> now there is a different error
15:18:46sealmove@mratsim: Maybe, I don't know. But let me try to describe you exactly the problem. I am given some filled in data structures (from parsing of a yaml which is done for me) and a code skeleton (a class named "ClassCompiler"), so I have to make "NimCompiler extends ClassCompiler". These datastructures and the code skeleton are setup in a way that you need namespaces to produce code, because for example
15:18:48sealmoveyou have a structure called "DataType" which does not retain info for parent types/classes.
15:19:15shashlicki'm able to cmake both libs with your code
15:19:22shashlickit fails because bson/bson.h is missing
15:19:44shashlickyou just need that cIncludeDir call
15:20:47sealmoveso mratsis my problem is not emulating namespaces, but using the given code to produce these emulated namespaces...
15:22:48FromGitter<kennymalac> you're not getting this error?
15:22:49FromGitter<kennymalac> /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/fatal.nim(39, 5) Error: unhandled exception: /home/kenster/.nimble/pkgs/nimterop-0.4.4/nimterop/build.nim(621, 12) `findFile(check, path, regex = regex).len != 0` # make failed [AssertionError]
15:23:04axionthanks
15:23:36shashlicknope
15:23:45PMunchHmm, the rsa.nim module in nim-libp2p has verify and sign, but no encrypt and decrypt
15:23:57FromGitter<kennymalac> hmm what changes did you make? are you running with bsonGit or bsonStatic?
15:24:10shashlickbefore the cImport calls in mongo.nim, I had to add **`cIncludeDir(bsonPath.parentDir().parentDir())`** and **`cIncludeDir(baseDir / "build" / "buildcache" / "src" / "libmongoc" / "src" / "mongoc")`**
15:24:15PMunchThere is a br_ssl_rsa_decrypt in BearSSL, but no _encrypt equivalent..
15:24:18shashlickjust bsonGit
15:24:25shashlickno other changes from your repo
15:24:29axion@mratsim so in this case the count is an argument to the function, so i'd need a macro right?
15:25:03shashlickof course now there's some cOverride work that's needed in mongo.nim - `Error: undeclared identifier: 'iovec'`
15:25:21shashlickbut you could try the `flags = "-s"` and see if it is good enough
15:25:36shashlickstub out missing symbols and then hand-wrap only the ones you really need
15:26:42*Vladar joined #nim
15:26:50FromGitter<kennymalac> right
15:26:57FromGitter<kennymalac> what's the flags = "-s" ?
15:27:04shashlickdoesn't look like your mongocPreBuild() is getting used
15:27:07shashlicktoast -h
15:27:36shashlick`-s, --stub bool false stub out undefined type references as objects`
15:28:57*silvernode joined #nim
15:29:26FromGitter<kennymalac> yeah now it says something about invalid indention
15:30:17FromGitter<kennymalac> oh looks like it halted
15:32:10shashlicki tried -s and looks like mongocLPath is not defined
15:35:13FromGitter<kennymalac> I guess -s is getting rid of a lot of necessary structs, so I'll generate iovec and other failing structs
15:37:06shashlickat least it tells you what stuff to stub so you can put it in cOverride
15:38:38*silvernode quit (Ping timeout: 264 seconds)
15:39:14shashlickbasically iovec, sockaddr and addrinfo in my case
15:39:36shashlickstub doesn't know what stuff is already declared in bson and other places since toast runs in isolation
15:39:51shashlickneeds some improvement there
15:42:23FromGitter<kennymalac> what's the pragma for using c def from header
15:42:29FromGitter<kennymalac> iovec* {.importc,header:"<sys/uio.h>".} = ?
15:43:12shashlickobject
15:43:37shashlickit compiles for me now but I don't think your mongocPreBuild was ever run
15:44:42FromGitter<kennymalac> why was it not ? curious
15:44:44disruptek!last zevv
15:44:45disbot9Zevv spoke in 12#nim 780 minutes ago
15:44:50disruptekoh shoot
15:44:52FromGitter<kennymalac> oh. can you paste the working version
15:45:01disruptekwe need you on araq's stream.
15:49:13FromGitter<kennymalac> @shashlick do you know why libarchive disables shared library anyway ? was just kinda following in its footsteps there with the prebuild, lol
15:53:44FromGitter<kennymalac> okay got it working :)
15:54:31FromGitter<zetashift> `stack\dev\naytracer\tests\tmatrix.nim(74, 24): Check failed: (m1 * aTuple) ⏎ == initTuple(18.0, 24.0, 18.0, 18.0) ⏎ ⏎ ```initTuple(18.0, 24.0, 18.0, 18.0) was 18.0 24.0 18.0 18.0``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e7a2d37f71b3f0d25f30829]
15:55:24FromGitter<kennymalac> I mean the build, not prebuild
16:04:27shashlickkennymalac: i had some cmake issues with libarchive, plus didn't need it for my immediate needs so left it out
16:04:50shashlickthere is an issue though - https://github.com/genotrance/nimarchive/issues/5
16:04:50disbot➥ 3Dynamic linking
16:06:12FromGitter<kennymalac> ah
16:06:45shashlickthe wrappers i make typically need to work across all OS
16:06:52shashlickand getting autoconf working on windows is a nonstarter
16:06:59shashlickand not all libs have good cmake support
16:07:10shashlickhave to do the best you can with these things
16:13:07FromGitter<kennymalac> shashlick any reason why nimble build fails with OSError?
16:13:58FromGitter<kennymalac> also the static test fails, not sure if the static lib is being output where it should be
16:13:58FromGitter<kennymalac> exec "nim c -d:mongocStatic -d:bsonStatic -p:.. -r tests/tlibmongonim.nim"
16:16:22shashlickyou don't have any bin = [] defined, what should it build?
16:16:50FromGitter<kennymalac> oh right
16:17:18shashlickfirst test worked, but you haven't checked in tests/*tlibmongoc.nim*
16:17:21FromGitter<kennymalac> so if I add it as a project dependency it should just work if I import?
16:17:32FromGitter<kennymalac> yeah I changed that part
16:17:43FromGitter<kennymalac> but the static part doesn't work
16:18:35shashlickyou still need the -d:bsonGit etc
16:18:58FromGitter<kennymalac> I tried with both
16:19:20FromGitter<kennymalac> same error
16:19:39shashlicknim c --d:mongocGit d:mongocStatic -d:bsonGit -d:bsonStatic -p:.. -r tests/tlibmongonim.nim
16:20:56FromGitter<kennymalac> yeah error :/
16:21:08shashlickwhat's the error
16:21:54FromGitter<kennymalac> /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/nimscript.nim(252, 7) Error: unhandled exception: FAILED: nim c -d:mongocGit -d:mongocStatic -d:bsonGit -d:bsonStatic -p:.. -r tests/tlibmongonim.nim [OSError]
16:22:12FromGitter<kennymalac> /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/fatal.nim(39, 5) Error: unhandled exception: /home/kenster/.nimble/pkgs/nimterop-0.4.4/nimterop/build.nim(621, 12) `findFile(check, path, regex = regex).len != 0` # make failed [AssertionError]
16:22:45shashlicksee nimgit2 wrapper
16:23:03shashlickin one case, the same cmake builds both static and dynamic libraries so they can coexist in the same directory
16:23:17shashlicklibgit2 has different targets so i had to put them in different directories
16:23:26shashlickit's possible that's what's happening here
16:23:28shashlickbut not sure
16:23:55FromGitter<kennymalac> oh okay
16:24:32shashlickbasically when you run make, it looks for the library, if it is not found, it tries to compile
16:24:40shashlickwhich goes to 100% but no static library is found
16:24:49shashlickso either it has an unual name and isn't found
16:24:51shashlickor wasn't built
16:26:10shashlicklooks like it was built
16:26:18shashlickbut has an unusual name
16:26:26shashlick./buildcache/src/libbson/libbson-static-1.0.a
16:27:47shashlickyep - the first `-` was not expected
16:28:18shashlickhttps://github.com/nimterop/nimterop/blob/master/nimterop/build.nim#L961
16:28:20FromGitter<kennymalac> hmkay so -d:bsonStatic won't work
16:28:33FromGitter<kennymalac> yea
16:29:34shashlickjust edit nimterop/build.nim and add a - in the [_]? and it will work
16:30:39FromGitter<kennymalac> lol okay, kinda means no one else can run my tests though without that in mind
16:30:47FromGitter<kennymalac> unless you are going to add -?
16:30:56shashlickyes i'll push it
16:31:08shashlickbut i'm sitting on versioning a new release since i'm in the middle of a big feature
16:31:20shashlickso it might be a couple weeks worst case
16:31:49FromGitter<kennymalac> kk
16:32:35FromGitter<matrixbot> `gphykos` Hello there
16:33:09shashlickAraq: is {.bycopy.} mandatory for structs when passed to C procs?
16:34:42shashlicktrying understand when {.bycopy.} should and should not be used
16:37:14*silvernode joined #nim
16:42:33krux02shashlick, you should not require ever to add {.bycopy.} at all.
16:44:54krux02Nim has it's own heuristics weather an object should be passed by copy or by reference. These heuristics might be wrong though. And they might even be changed in the future. So If you don't trust those compiler optimizations, or you know that it is wrong in your case, put bycopy or byref manually to the type.
16:45:31shashlicki'm trying to figure out what nimterop should do
16:45:57shashlickso what are the pragmas that should be present on types and unions by default
16:46:07shashlicki know c2nim puts in bycopy but am wondering why
16:47:15krux02because that is the C behavior
16:47:30krux02if you want 1:1 c behavior, everything should be by copy.
16:47:45shashlickhow about C++
16:47:53krux02same
16:48:03shashlickokay good to know
16:48:18shashlickso the only real pragmas types need are bycopy and incompleteStruct where appropriate
16:48:25shashlickenums might need size
16:49:01krux02well
16:49:09krux02there are also bitfields
16:49:22krux02(if you use them)
16:51:33silvernodeApparently the stiulus bill includes a new digital dollar concept. Things are starting to get srange, I don't know what to think anymore.
16:51:53silvernodestimulus*
16:51:55FromGitter<kennymalac> it was scrubbed
16:52:10silvernodeWell that's good
16:52:43FromDiscord<Recruit_main707> is it possible to make nim specify the type of a function, but dont initialise result?
16:53:58shashlickkrux02: will ping you when i get to specifics but thanks for the input
16:54:19shashlickhave rewritten the nimterop backend to use the nim compiler so getting much better results with wrapping
17:02:37*silvernode quit (Ping timeout: 256 seconds)
17:08:29*liblq-dev joined #nim
17:08:38leorizeso byaddr is a thing now?
17:08:45leorizeand we're keeping the name? :p
17:09:04disruptekbyaddr was never a problem.
17:09:09disruptek.byaddr was never a problem.
17:10:16*Trustable joined #nim
17:10:52leorizethe documentation for it is lacking though
17:13:42clyybber1leorize: Consider it experimental
17:16:33shashlickis there value in generating `proc name(a1: ptr cint)` and `proc name(a1: var cint)` wrappers from `void name(int *a1)`
17:16:59leorizemight be confusing
17:17:09leorizeI'd advice to just generate the ptr variant
17:18:09leorizeyou can only be certain in generating `var` if they have the nonnull attribute attached to them
17:18:15FromGitter<zetashift> I'm guessing I'm getting that error because of incorrectly checking for floating point equality
17:18:55shashlickokay will drop that idea
17:19:24*Tungki quit (Read error: Connection reset by peer)
17:19:48*Tungki joined #nim
17:24:01FromGitter<awr1> hello all
17:25:21*liblq-dev quit (Quit: Leaving)
17:27:59FromDiscord<Rika> hello
17:28:55FromGitter<zetashift> hiya
17:28:56leorize[m]o/
17:29:30*liblq-dev joined #nim
17:33:03*nsf quit (Quit: WeeChat 2.7)
17:35:22*Tungki quit (Ping timeout: 252 seconds)
17:35:48*sealmove quit (Quit: WeeChat 2.7.1)
17:37:03*Trustable quit (Remote host closed the connection)
17:37:59*Trustable joined #nim
17:41:33FromGitter<awr1> so i was thinking about the enum thing and i pored over the AST1 and AST2 stuff in nimterop
17:41:39Araqshashlick, C wrappers should always use .bycopy
17:42:34shashlickcool
17:42:54shashlickaw1: curious on your feedback
17:43:10FromGitter<awr1> originally i thought maybe it should be AST2 exclusive but i was thinking more about it
17:43:17shashlickenum support is in newalgo-2 branch
17:43:40*Trustable quit (Remote host closed the connection)
17:44:15shashlickast1 will be deprecated, i won't maintain it since ast2 will do all of it and much more
17:44:39*Trustable joined #nim
17:45:01*junland quit (*.net *.split)
17:45:02*vesper11 quit (*.net *.split)
17:45:02*shadowbane quit (*.net *.split)
17:45:06*liblq-dev quit (Quit: Leaving)
17:45:19*junland joined #nim
17:45:35*liblq-dev joined #nim
17:45:39FromGitter<awr1> but i think the best way to do this would be to implement it with a macro that does take in a typed const section which would require minimal changes to AST1. AST2 would also use the macro, emitting to the enumSection, and then do the semfold pass on the enum section exclusively as a kind of 'bonus'
17:46:20FromGitter<awr1> the semfold pass should be able to deal with the macro
17:46:33*shadowbane joined #nim
17:47:01*vesper11 joined #nim
17:47:38*mwbrown quit (Ping timeout: 264 seconds)
17:47:58shashlickif you can write code that can take a nim nkConstSection PNode and return an enum AST, will be great
17:48:11shashlicki don't intend doing anything for ast1 like I said
17:48:33shashlickand not a macro, by importing the compiler directly like i do in ast2
17:48:58shashlicki don't yet know how to call semfold, i tried a bit when experimenting but it didn't work
17:49:24FromGitter<awr1> you're not planning on importing nimterop / types in AST2?
17:49:55shashlickit is being imported yes
17:50:13*mwbrown joined #nim
17:50:17shashlickcheck the newalgo-2 branch
17:50:43FromGitter<awr1> but you don't want to have the constSection PNode use a macro
17:51:39FromGitter<awr1> the semfold pass should execute any macro i believe
17:52:18FromGitter<awr1> so the actual nim code that a user ends up importing should be macroless
17:52:27FromGitter<awr1> but
17:52:35FromGitter<awr1> if you really didn't want to use a macro
17:53:17shashlickyes, so the idea is to first generate the const section, get it reduced with semfold and see if the const can be convered to a nim enum - reorder, no duplicates
17:53:24*leorize_m joined #nim
17:53:33FromGitter<awr1> what i think would have to happen is that, in our "proper enum" mode, you would have first emit the enumerator values as part of a special enum section to fold
17:53:47FromGitter<awr1> well yeah, that
17:53:47*leorize_m left #nim ("User left")
17:54:17FromGitter<awr1> you would need to have a deferred enum composition after you get the folds done
17:54:19shashlickso the code should do all that at runtime (toast is runtime) and returns an AST using the compiler directly, no macros
17:54:25shashlickyes
17:57:53FromGitter<awr1> well i think first your foldable consts can't have type conversions like it does in AST1
17:58:32shashlickyes that's fair - we don't need anything in types - we can just treat everything as ints
17:58:47shashlicknot sure how it will impact bitfields or size: xyz
17:59:21shashlickideally we use it as is though so that if it cannot be reduced, we don't need to regenerate the const section with the conversions
17:59:23FromGitter<awr1> also, i see in what you get back from tree-sitter, `type_identifier?`
17:59:29FromGitter<awr1> and i forgot about anonymous enums
17:59:34FromGitter<awr1> plan on implementing them? or no
18:00:11shashlickhttps://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/ast2.nim#L1036
18:00:26FromGitter<awr1> ah i see
18:01:00shashlickhope ast2 is readable, original ast was too confusing and zero documentation
18:01:07shashlickwas too hard to maintain
18:01:23FromGitter<awr1> yes ast1 was a little weird
18:02:03FromGitter<awr1> i think maybe this should be made an optional feature, i don't know if you want new enums by default
18:02:13FromGitter<awr1> say a --properEnums cmd line flag
18:02:41shashlickwell, if it can be created as a pure enum, why do this const business
18:02:51shashlickpeople expect nim enums
18:02:56shashlickconsts are a fallback
18:03:05shashlickso if it is possible, it should be nim enum
18:03:12FromGitter<awr1> my concern is people utilizing the old procedures that are generated with defineEnum()
18:03:21FromGitter<awr1> this would be a breaking change
18:03:38shashlicki'd say the defineEnum() stuff emulates standard enum behavior
18:03:49shashlicknim enum is more seamless than the consts
18:03:57shashlickit wouldn't break anyone
18:04:03shashlickwhy do you think it would?
18:05:02FromGitter<awr1> https://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/types.nim#L33
18:05:09FromGitter<awr1> these aren't defined for nim enums
18:05:31shashlicki'm sure you can add two nim enums
18:06:19shashlickwow, just tried - you cannot add two nim enums?
18:06:34FromGitter<awr1> https://play.nim-lang.org/#ix=2fae
18:06:35FromGitter<alehander92> well, you need to `.int` them
18:06:35FromGitter<awr1> yes
18:06:36FromGitter<alehander92> i guess
18:06:47FromGitter<alehander92> it's a good limitation
18:06:53FromGitter<alehander92> but yeah it can be surprising
18:07:52shashlickoh well, cannot do much about that - most people will expect a C enum to become a Nim enum and then realize you cannot add two of them
18:08:03shashlickmeh
18:08:13shashlickAraq: any reason why this is the case?
18:08:40shashlickawr1: in this case, user would need to create those borrowed procs manually
18:09:13shashlickoverall, the only benefit to nim enums is that you can print them
18:09:23shashlickbut then you lose this behavior
18:09:33shashlicki'm wondering whether it is worth the effort
18:10:00shashlickand the time it will take to process each enum to check if it can be reduced
18:12:34FromGitter<awr1> i'd imagine its because nim enums are intended to be stronger, and without adding those procs you don't need to worry about holed enums. definitely
18:12:47FromGitter<awr1> the procs with
18:13:16FromGitter<awr1> e.g. `+` between an enum and int would be...sketchy for nim enums
18:13:21FromGitter<awr1> too C-ish
18:14:16shashlickyou can set nim enums to specific values resulting in holes
18:14:40FromGitter<awr1> you can but it's not something to encourage
18:15:23FromGitter<awr1> > overall, the only benefit to nim enums is that you can print them
18:15:36FromGitter<awr1> you can for-loop through them
18:15:41FromGitter<awr1> you can use them in sets
18:16:24shashlickfor loop, yes good one
18:16:31shashlickwhy cannot you use distinct ints in sets
18:17:31FromGitter<awr1> i mean you can try?
18:17:39FromGitter<awr1> you need to generate borrowed procs
18:17:43FromGitter<awr1> and use a smaller size
18:17:51FromGitter<awr1> e.g. int8
18:18:33FromGitter<awr1> even then that has a wealth of possible issues
18:18:53FromGitter<awr1> you can't use distinct int verbatim in sets because int will be too large
18:19:10shashlickokay I cannot say I know what you are talking about
18:19:16shashlickso i'll take your word for it
18:19:53FromGitter<awr1> set[T] is basically a bitflag thingy underneath
18:21:49FromGitter<awr1> i mean you can have printable distinct ints too
18:21:53FromGitter<awr1> just don't borrow
18:22:12FromGitter<awr1> https://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/types.nim#L67
18:22:29FromGitter<awr1> this would be replaced by something more intelligent
18:23:05shashlickyes that's possible
18:23:37FromGitter<awr1> you could also get for-loops too and possibly set notation
18:23:51FromGitter<awr1> though it would be different from set[T]
18:24:16shashlickyep, can use in set if == and $ are defined for the distinct int
18:25:05shashlick```https://play.nim-lang.org/#ix=2fan```
18:26:22FromGitter<awr1> set[T] is different from hashSet
18:27:53FromGitter<awr1> i will meditate on this but maybe we will have to end up working on 'better distinct int' instead of using nim enums
18:28:11shashlickokay, Error: set is too large
18:28:22shashlickhappy with any feedback on this
18:28:40shashlickand any other aspects of ast2
18:28:55FromGitter<awr1> sure!
18:29:09FromGitter<dumjyl> One thing you lose with distinct int that is difficult to regain is case coverage.
18:29:35shashlickyes that's true as well
18:30:23shashlicki'm just wondering how applicable these concerns are when talking about C enums - are they really used in these ways?
18:32:58FromGitter<awr1> as an alternative to set[T] you can use Flag[T] by @mratsim
18:33:21PMunchHmm, I'm getting an "unhandled exception: zlib version mismatch!" when trying to use the zip module..
18:33:26*silvernode joined #nim
18:34:28leorizeshashlick: are you trying the enum thing?
18:35:26FromDiscord<Spy653> What do you guys think of nim v rust for OS or general development
18:36:04FromDiscord<Recruit_main707> i have as much experience with OS than with rust
18:36:18FromDiscord<Spy653> Fair
18:36:26FromGitter<awr1> what do you mean OS development
18:36:30FromGitter<awr1> like kernels?
18:36:42FromGitter<awr1> or just general systems programming
18:36:49FromDiscord<Spy653> I'm thinking of using rust as my OS language and nim for applications
18:37:20FromDiscord<Spy653> OS Dev as in full systems not just kernels
18:37:24FromDiscord<Recruit_main707> nim can do OS if that helps, and with gc:arc it could be a really good option
18:37:29krux02awr1: I din't write an os yet. Though I wrote once a scheduler.
18:37:31*silvernode quit (Client Quit)
18:37:41krux02task switching on a microcontroller.
18:37:50krux02This stuff is generally very low level.
18:37:52FromGitter<awr1> interesting
18:37:52leorizecurrently rust will be in a better shape, though Zevv is working on --os:any to help with writing standalone code
18:37:55FromDiscord<Recruit_main707> well, with OS i meant kernels and chips yeah
18:37:55krux02You need assembly for it.
18:38:25FromDiscord<Spy653> I'm going to steal the Linux kernel lol can't be fucked to do kernel Dev, so much more effort
18:38:39FromDiscord<Spy653> It's free for a reason
18:38:47leorizelol then write everything with nim
18:38:53krux02Most parts of an operating system can be written in a high level language, but there are always bits and pieces here and there that need low level stuff that isn't covered by high level languages such as C.
18:39:58*clyybber1 quit (Quit: WeeChat 2.7.1)
18:40:27krux02but apart from these low level stuff, most of an operating system is just fluff around the low level features. THat can be written in any language. It is generally like application development. I though you could even write it in python if you want to. It would just such to have a kernel written in python.
18:40:52krux02"I think" not "I though"
18:41:15FromDiscord<Rika> what's the best crossplatform gui lib again?
18:41:32leorizedefine best
18:41:41FromDiscord<Rika> uh, easiest
18:41:41FromDiscord<Rika> sorry
18:41:50leorize!repo nigui
18:41:54FromDiscord<Rika> nigui? okay
18:42:02leorizedisbot: are you here?
18:42:21FromDiscord<Rika> dead
18:42:21leorizethere's also karax if you wanna do electron :P
18:42:22FromDiscord<Rika> F
18:42:27FromDiscord<Rika> OH OH THATS GOOD
18:42:35FromDiscord<Rika> wait but i need FS access
18:42:37FromDiscord<Rika> hmm
18:42:51FromDiscord<Spy653> How does fltk rank with you guys
18:43:02leorizesuper low imo
18:43:08leorizeI like native ui
18:43:12FromDiscord<Rika> it's C++
18:43:28leorizeby native I mean "native toolkit"
18:43:29FromDiscord<Rika> i also like native UI but i've seen how bad it looks in windows so im not sure anymore
18:43:44leorizegives everything a better uniforming look
18:44:40FromDiscord<Rika> i'd use Qt if there were good nim bindings or so
18:44:41*Vladar quit (Quit: Leaving)
18:45:01FromDiscord<Spy653> I like windows default, actually trying to look for one that emulates old school 2000s win UI
18:45:06FromDiscord<Rika> and if Qt Creator werent absolutely massive
18:47:03leorizethe only complete Qt5 bindings for not-C++ that I've found are all backed by some corporate
18:47:12FromDiscord<Rika> is that good or bad
18:47:14leorizelet's just say that people really don't want to wrap Qt
18:47:38leorizebecause compiling qt code requires running their preprocessor on your code
18:47:59leorizeand obviously that preprocessor can only run on C++ code
18:52:59FromDiscord<Rika> wow that sounds like a pain
18:53:25FromDiscord<Rika> i guess i dont like Qt anymore
18:57:29*al_ joined #nim
18:57:29*al_ is now known as Guest94576
19:08:32*rnrwashere joined #nim
19:16:22*rnrwashere quit (Remote host closed the connection)
19:20:00shashlickleorize: not yet - have many things to add that are higher priority
19:20:09shashlickbut open to PRs
19:22:40*blueberrypie quit (Quit: leaving)
19:22:55FromDiscord<kodkuce> there is gtk thingy pmuch did i think i tryed it
19:25:16*rnrwashere joined #nim
19:25:30*blueberrypie joined #nim
19:28:26Araqleorize, --os:any is in 1.2 and production ready IMO
19:29:05livcdRika: just find someone smart to write bindings for sciter :D
19:31:54FromDiscord<Recruit_main707> --os:any HYPE
19:32:07FromDiscord<Recruit_main707> btw Araq, i wanted to ask you something
19:33:28FromDiscord<Recruit_main707> i saw an interview where you said you planned Nim to be directly compiled without the intermediate C/C++ code, how would that affect interoperability? (and i guess things like emit would be deprecated)
19:34:17FromGitter<awr1> you should look at nlvm
19:34:33FromGitter<awr1> https://github.com/arnetheduck/nlvm
19:35:12livcdwhat is --os:any :O
19:35:45FromGitter<awr1> it already leverages the compiler for parsing purposes but produces LLVM bytecode instead
19:35:58*ptdel joined #nim
19:42:11AraqRecruit_main707: I was refering to nlvm
19:44:22Araqnot sure how .emit can be supported but maybe we can extract it to a .c file and run clang over it
19:44:59Zevvleorize: Im not working on anything.
19:45:04Araqinterop with C++'s templates is the biggest open question and that's why I'm getting quite some resistance
19:45:08Zevvits done and finished afaik
19:45:47AraqZevv, you could work on SSO though or strings that support O(1) slicing
19:45:51Araq;-)
19:45:53Zevvand I kind of dropped my nim work for now. I'm working my ass off so my customer can't decide to stop hiring me
19:46:04Araqah yeah
19:46:08FromDiscord<Recruit_main707> Araq: very interesting solution, thank you and keep it up, one day if i get good enough ill try helping
19:46:27Araqthat's a good reason, Zevv, good luck
19:46:40Zevvthanks!
19:47:29ZevvI guess I'm fine for now since i'm at this time the one keeping the project afloat. But of course the project can always be canceled, and employees go first over freelancers, of courhse
19:47:34Zevv(as they should)
19:49:24Araqso ... it's streaming time
19:49:47leorizestream!
19:49:50leorizewhere is it? :P
19:50:16FromDiscord<Recruit_main707> stream time :0
19:50:21Araqwhere is disruptek though...
19:50:45Zevv!seen disruptek
19:50:56shashlick!last disruptek
19:51:03FromDiscord<Recruit_main707> he is gone?!
19:51:05leorizedisbot is dead
19:51:17FromDiscord<Recruit_main707> ofc i meant disbot
19:53:25*Trustable quit (Remote host closed the connection)
19:56:42Araqhttps://www.twitch.tv/araq4k
20:02:47*rnrwashere quit (Remote host closed the connection)
20:08:41*Guest94576 quit (Quit: Guest94576)
20:09:44FromGitter<alehander92> ouu
20:10:31liblq-devwhy is StringStream not available for the JS backend?
20:14:12*liblq-dev quit (Quit: WeeChat 2.7.1)
20:14:13FromGitter<alehander92> i guess no support for low level
20:14:18FromGitter<alehander92> not sure
20:14:21*liblq-dev joined #nim
20:14:23leorizeI thought we fixed streams?
20:14:51liblq-devmaybe it's on devel, I'm referring to the stable doc
20:15:11FromGitter<alehander92> no idea
20:15:15FromGitter<alehander92> maybe its ok
20:15:37liblq-devnope, the doc still says that StringStream is unavailable for the JS backend http://nim-lang.github.io/Nim/streams.html#StringStream
20:16:08leorizejust try to use it
20:16:10liblq-devmaybe it's because they operate on pointers?
20:16:33liblq-devI doubt they're supported under JS
20:16:48leorizepointers are supported under js by nim btw :)
20:17:25FromDiscord<Recruit_main707> dope!
20:17:42livcdwhat is drnim ? I am late :/
20:18:56livcdand who besides Araq is talking ?
20:21:48*couven92 joined #nim
20:33:39FromGitter<kennymalac> okay, my nim mongo wrapper of mongo-c-driver works, but the interface is not so nice to use, lol https://github.com/ParadigmInteractive/libmongonim/blob/master/tests/tlibmongonim.nim
20:33:47liblq-devis there any way of checking if a process's outputStream has any more data?
20:34:02FromGitter<kennymalac> @shashlick ^ feel free to give any suggestions :)
20:34:06liblq-devp.outputStream.atEnd always returns false from me
20:34:10liblq-devs/from/for
20:34:35liblq-devwhich makes sense, since the stream is *not* at end
20:34:39*ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
20:35:44FromGitter<kennymalac> I should probably replace all class name methods such as collection_insert_one with insert_one etc.
20:44:49*sleepyqt quit (Ping timeout: 256 seconds)
20:46:14*sleepyqt joined #nim
20:46:38shashlickya nim wrappers of C libraries don't have the most pleasant APIs
20:47:12shashlickin theory, some pretty API could also be generated with the raw wrappers but i haven't spent any real time thinking about it
20:47:25shashlicknot sure if it is possible but it is a dream
20:48:06shashlicksee the nimarchive.nimble file for how to generate docs
20:50:45FromGitter<kennymalac> well, for a start, I noticed that it lets me pass nim strings into the procs, but I have to specify the length of the string
20:51:21FromGitter<kennymalac> any reason that's the case? I'd rather just do doc.bson_append_utf8(cstring("hello"), cstring("world"))
20:51:28FromDiscord<Rika> ive heard that nim strings are just cstrings with a length field
20:51:29FromGitter<kennymalac> rather than doc.bson_append_utf8("hello", 5, "world", 5)
20:51:58FromGitter<kennymalac> or "hello".len, ofc
20:52:09FromDiscord<Rika> you can always change the code of the wrapper cant you
20:52:31FromGitter<kennymalac> yeah I could, but it says like 120k lines of code were processed, it's a huge library
20:52:42*waleee-cl joined #nim
20:53:00leorizeNim can't magically figure out how to pass the length
20:53:01FromDiscord<Rika> i dont think theres another way unless you can macro it
20:53:05FromGitter<kennymalac> I'm sure the apis aren't going to be changing drastically though, so I could make a high level API on top I guess
20:53:19leorizeyea, make a high level api on top of it :)
20:53:22FromGitter<kennymalac> well the C api doesn't need the length, just a C string
20:53:47FromGitter<kennymalac> oh wait it does
20:54:04FromGitter<kennymalac> that's why the examples use BSON_APPEND_UTF8 which doesn't require it
20:54:11FromGitter<kennymalac> but that doesn't seem to be callable in nim
20:54:24FromGitter<kennymalac> hmmm
20:55:43FromGitter<kennymalac> I wonder how I should work around that. I guess bson has a lot of all caps functions which wrap the lowercase ones
20:56:58shashlickhttps://nimterop.github.io/nimterop/docs.html for docs info
20:58:28shashlicknimterop doesn't yet wrap #define func(x, y) ...
20:58:30shashlicksome day
20:59:13FromGitter<kennymalac> aw shucks
21:00:11FromGitter<kennymalac> does c2nim support #define ?
21:00:34FromDiscord<Recruit_main707> i think it does
21:01:12shashlicknope, it doesn't convert it into templates
21:01:14FromDiscord<Recruit_main707> https://github.com/nim-lang/c2nim
21:01:15FromDiscord<Recruit_main707> read the readme
21:01:45FromGitter<kennymalac> that's #define vars not functions
21:01:58FromGitter<kennymalac> good to know though
21:01:59FromDiscord<Recruit_main707> click in here
21:02:29FromDiscord<Recruit_main707> but its just what shashlick said, it converts them to templates
21:03:19FromGitter<kennymalac> he said it doesn't
21:03:23FromGitter<kennymalac> looks like it would have to be manual
21:03:24FromGitter<kennymalac> hrm
21:05:02shashlickhttps://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#id6
21:05:08shashlickbut you will need to hand edit the h file
21:14:33*MarderIII joined #nim
21:14:43*MarderIII quit (Read error: Connection reset by peer)
21:21:09liblq-devdamn, I need to wait until a Process exits, but I also need to close its stdin pipe. I suppose that's not achievable since it would trigger an exception on myProcess.exit()
21:24:30leorizeclose it with myProcess.close()
21:24:51leorizeit exits if not already, then close all handles :)
21:39:35*PMunch quit (Quit: leaving)
21:40:50liblq-devleorize: > WARNING: If the process has not finished executing, this will forcibly terminate the process. Doing so may result in zombie processes and pty leaks.
21:41:07liblq-devI don't want to terminate the process; just close the stdin handle
21:41:10*Cthalupa quit (Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in)
21:41:20leorizethen inputHandle.close?
21:41:42liblq-devyeah that worked, but I was afraid some exception would trigger on myProcess.close()
21:41:42leorizeactually inputStream.close is the crossplatform one
21:41:55liblq-devI don't need cross-platformness
21:42:00liblq-devit's just a script for my machine
21:42:05leorizeah, don't worry, no weird exception will happen
21:42:44leorizewe need a more customizable api for osproc
21:43:21AraqZevv, https://github.com/zevv/nimz3/pull/2
21:43:58liblq-devleorize: I agree
21:44:19leorizewell if you have time maybe you can work on one? :)
21:44:28liblq-devit's kinda annoying that we can't poll whether the process's stdout pipe has any data; I had to use posix for that
21:44:48leorizewe need asyncstreams to be a stable thing
21:44:59leorizethen we can have process with async stdin/out
21:45:01liblq-devthat'd be useful
21:51:14*zacharycarter quit (Ping timeout: 264 seconds)
21:53:34*narimiran quit (Ping timeout: 240 seconds)
21:58:58FromDiscord<IanIAnIAN> don't suppose the maker of ggplotnim lives here?
22:01:30*lritter quit (Quit: Leaving)
22:02:49Araqsometimes he does iirc
22:04:56FromDiscord<IanIAnIAN> I'll just leave a saucer of milk out for him then
22:05:03*liblq-dev quit (Quit: WeeChat 2.7.1)
22:06:41*zacharycarter joined #nim
22:13:42*ksandvik joined #nim
22:14:34FromGitter<kaushalmodi> IanIAnIAN: You can summon him using @Vindaar
22:18:49Araqhttps://github.com/nim-lang/Nim/pull/13743 it's alive
22:19:12*Guest56251 quit (Ping timeout: 246 seconds)
22:20:17*ksandvik quit (Quit: Leaving.)
22:20:35*ksandvik joined #nim
22:23:54*solitudesf quit (Ping timeout: 240 seconds)
22:24:39*dadada joined #nim
22:25:04*dadada is now known as Guest54059
22:27:05*ksandvik quit (Quit: Leaving.)
22:27:28*ksandvik joined #nim
22:29:44krux02Araq: Interesting
22:42:49*natrys quit (Ping timeout: 264 seconds)
22:46:01ksandvikIs this the Z3 Theorem Prover from Microsoft?
22:48:14*Guest54059 quit (Ping timeout: 240 seconds)
22:48:49*zacharycarter quit (Ping timeout: 264 seconds)
22:49:06Araqyes
22:49:37ksandvikInterestng. For cryptography work? Or just anything? Z3 is new for me....
22:49:53*couven92 quit (Read error: Connection reset by peer)
22:50:16*couven92 joined #nim
22:50:37Araqfor anything.
22:51:02Araqcrypto probably needs features guaranteeing "constant time"
22:51:07ksandvikOK. Reading https://nikolajbjorner.github.io/slides/Z3_System.pdf
22:52:05ksandvikWould Z3 help with writing more flexible unit tests?
22:54:35*dadada_ joined #nim
22:55:06*natrys joined #nim
22:56:42leorizeI'd be interested in having z3 optimize away certain checks because it can prove that they will be true :)
22:56:58rayman22201only caught the end of the stream Araq, but that is super great work! I'm excited :-)
22:58:14ksandvikI used to deal with huge unit test systems with pro apps and it was a pain to write more and more of them, wish there was a way to just define a set of APIs and a set of data and let the unit test engine loose, or let some unit tests define that there's no need to run another bunch of tests if one succeeded and covered it all.
22:58:35*natrys quit (Client Quit)
22:58:43rayman22201Z3 is more powerful than unit tests. It gives the type system superpowers. Dependent and Linear types, etc... The closest thing is Ada Spark.
22:59:07rayman22201It proves things at compile time so that you don't need unit tests (for the things it proves.)
22:59:17ksandvikOh even better.
23:06:04*rnrwashere joined #nim
23:09:14*sleepyqt quit (Ping timeout: 256 seconds)
23:11:36Araqleorize: yeah that would be good, quite easy to do too
23:12:54leorizewill z3 eventually make it into the main compiler or will it stay as a standalone tool?
23:15:25axionHey all. Simple question about type parameters. If I have 2 proc parameters that are both typed to be `a or b`, is there any way outside of the body to tell the compiler that they must be unique? That is if the first argument is `a` then the second must be `b`, and vice versa.
23:16:50Araqaxion: write 2 overloaded procs instead
23:17:33axionYeah that's what I'm currently doing for a bunch of operations. Just curious :)
23:17:35Araqleorize: unlikely, the dependency is bad and proving stuff can take time, it's better as a separate tool
23:17:48Araqgood night
23:18:50*dadada_ quit (Ping timeout: 264 seconds)
23:20:45*zacharycarter joined #nim
23:24:39*dadada joined #nim
23:25:04*dadada is now known as Guest8441
23:26:15*zacharycarter quit (Ping timeout: 250 seconds)
23:33:35*tane quit (Quit: Leaving)
23:36:30*Cthalupa joined #nim
23:37:15*zyklon joined #nim
23:39:42*uvegbot quit (Ping timeout: 260 seconds)
23:44:54FromGitter<zetashift> gnight
23:45:10*NimBot joined #nim
23:48:14*Guest8441 quit (Ping timeout: 240 seconds)
23:54:34*dadada_ joined #nim