<< 04-01-2020 >>

00:18:37FromDiscord<mratsim> should I nil a pointer after a destruction with arc/newruntime?
00:18:45FromDiscord<Clyybber> not needed
00:19:07FromDiscord<Clyybber> But you should during destruction
00:19:28FromDiscord<mratsim> and with the normal runtime is it zero-ed? (i.e. due to the seq not respecting =destroy, i call them manually)
00:19:40FromDiscord<mratsim> ah in the destructor I nil stuff
00:20:19FromDiscord<Clyybber> I don't know about the normal runtime
00:20:34FromDiscord<Clyybber> sorry
00:21:15FromDiscord<mratsim> well if I want compatibility between both normal and new I have to nil
00:21:23FromDiscord<mratsim> and in destroy i check if it's not nil
00:21:39FromDiscord<mratsim> so that I don't double destroy (in my case decrement refcount multiple time)
00:46:14skrylar[m]disruptek: mumble mumble delta debugger mumble
00:46:23disruptekoh yeah?
00:46:45disruptekthis is what golden is supposed to do, if anyone would get a round tuit.
00:47:15skrylar[m]i've used picire on nim code. although that was with linewise
00:47:31skrylar[m]if you have an antlr grammar it will use that to try and fuzz stuff with the syntax tree instead
00:48:33disruptekyou're a wildman, but i'm not too worried about fuzz.
00:48:48skrylar[m]it doesn't do fuzz testing
00:49:15skrylar[m]if it has a parser it will try to use the ast nodes for the remove and test steps, otherwise it has to use either blocks of lines or chars
00:49:40disruptekoh, that's nuts.
00:49:51disrupteki am okay with commit resolution.
00:50:07skrylar[m]bisects?
00:50:11disruptekyeah.
00:50:44skrylar[m]those are also nice, but the dd will strip a test case down to the minimum function to exhibit a breakage, assuming the test script is looking for the right thing
00:50:53disruptekright, i get it now.
00:51:09disruptekmaybe something to add once bisects work.
00:51:23skrylar[m]bisects don't work? o.O
00:51:27disruptekit should be pretty awesome to watch it hone in on performance regressions.
00:51:34disrupteki mean, when golden can run unattended.
00:51:54skrylar[m]well, now you know of the tools to exhibit less effort. i dun care why you don't use it ^^
00:52:03disrupteklol thanks.
01:00:54*ng0 quit (Quit: leaving)
01:09:20disrupteknimph needs more windows users.
01:12:24*smitop quit (Quit: Connection closed for inactivity)
01:20:19*Lord_Nightmare quit (Read error: Connection reset by peer)
01:31:51*d-nice2[m] joined #nim
02:21:14*dwdv quit (Ping timeout: 240 seconds)
02:32:13*couven92 quit (Ping timeout: 260 seconds)
02:38:44FromGitter<beshrkayali> Hey folks! I'm a new Nim fan! started writing something and wanted to share: https://github.com/beshrkayali/webdavclient/ :)
02:39:02disruptekneat, welcome.
02:39:22disruptekhow are you finding the github actions?
02:39:39FromGitter<beshrkayali> thanks!
02:40:12FromGitter<beshrkayali> pretty neat, had some trouble with sdl stuff for another project, but for this one it worked fine
02:40:47disruptekdid you just muddle through it from scratch?
02:43:50FromGitter<beshrkayali> more or less yeah, had to because of work, but my use is still pretty basic for it
02:44:04disruptekdoes it seem fast?
02:44:49FromGitter<beshrkayali> yeah, you'd get queued up sometimes, but I haven't had to wait for more than a minute
02:45:11FromGitter<beshrkayali> and i assume orgs / paying customers have special treatment
02:45:39disrupteknice. i think i want to integrate nimph into actions directly.
02:48:52FromGitter<beshrkayali> it works nicely so far for me, also kind of easier to have ci close to repo
02:50:35disruptekright; i like it. i don't like that it's graphql, but what can you do...
02:53:30*endragor joined #nim
02:54:51FromGitter<beshrkayali> oh, you mean github api? graphql is pretty nice i think :)
02:55:27disruptekit's more work for me to support.
02:55:53disruptekiirc, we don't have a native graphql yet, either.
02:58:34*endragor quit (Ping timeout: 258 seconds)
03:00:28FromGitter<beshrkayali> ah true, I don't think i've encountered something like that...
03:00:49FromGitter<beshrkayali> there's a native c query parser tho
03:01:00disruptekshashlick has a lib, but nimql is empty iirc.
03:09:16FromGitter<beshrkayali> i guess it'd be easier to just make a wrapper for the official c parser
03:10:28disruptekthat's what shashlick's lib is.
03:10:38disruptek!repo genotrance/nimgraphql
03:10:39disbothttps://github.com/genotrance/nimgraphql -- 9nimgraphql: 11Nimgraphql is a Nim wrapper for the libgraphqlparser library 15 15⭐ 2🍴
03:14:24FromGitter<beshrkayali> ah cool, didn't know
03:15:38disruptekit's tricky; we can't be choosey yet as to how we get this stuff working, but on the other hand, non-native libs are significantly harder to support.
03:21:26FromGitter<beshrkayali> true
03:22:18FromGitter<beshrkayali> just remembered, for github actions, found this action before that sets up a nim env, works great https://github.com/marketplace/actions/setup-nim-environment
03:22:53disrupteknice, that'll help.
03:45:52*endragor joined #nim
03:53:43*dddddd quit (Remote host closed the connection)
04:00:36*muffindrake quit (Ping timeout: 248 seconds)
04:02:49*muffindrake joined #nim
04:09:14*endragor quit (Remote host closed the connection)
04:09:20*endragor joined #nim
04:11:31*sagax quit (Remote host closed the connection)
04:25:05*marmotini_ joined #nim
04:38:28*chemist69 quit (Ping timeout: 248 seconds)
04:40:44*chemist69 joined #nim
04:53:25FromDiscord<snluu> when I ran `nim js` with `-d:release`, i'm getting the error `/usr/local/Cellar/nim/1.0.4/nim/lib/system.nim(3411, 42) Error: 'asmNoStackFrame' should be: 'asmNoStackframe'`
04:53:42FromDiscord<snluu> compiles just fine in debug mode
05:13:16*cyraxjoe joined #nim
05:13:16*marmotini_ quit (Remote host closed the connection)
05:13:50*marmotini_ joined #nim
05:15:38*MightyJoe quit (Ping timeout: 268 seconds)
05:16:18*marmotini_ quit (Remote host closed the connection)
05:16:36*marmotini_ joined #nim
05:22:32*sagax joined #nim
05:24:24*marmotini_ quit (Remote host closed the connection)
05:25:00*marmotini_ joined #nim
05:28:32disruptekthis is kinda horrible.
05:28:36disruptek!code in:file "proc reverse" algorithm
05:28:37disbothttps://github.com/nim-lang/Nim/blob/b03de8a4d9926b03da2ed5cd8cde16ab22d31a97/lib/pure/algorithm.nim -- 11lib/pure/algorithm.nim
05:28:49disruptek!code in:file isTurnedOn
05:28:50disbothttps://github.com/nim-lang/Nim/blob/0ff23e696c1e239214dfc2f1d2bb3e8fc6bf9493/compiler/pragmas.nim -- 11compiler/pragmas.nim
05:29:40disruptek!code in:path pure/sugar
05:29:40disbotno results 😒
05:29:50disruptek!code in:path sugar
05:29:51disbothttps://github.com/nim-lang/Nim/blob/a0aa8fa857b5bd6db4395ca62e2b4618f6876873/lib/pure/sugar.nim -- 11lib/pure/sugar.nim
05:30:00*marmotini_ quit (Ping timeout: 268 seconds)
05:31:32*marmotini_ joined #nim
05:36:35FromDiscord<Stuffe> Normally when I compile it only takes a second or two. But every few times it takes a full minute, which very painful. Does anyone have any idea why?
05:38:40disruptekno, but is it reproducible?
05:40:13disrupteki've never heard of such a thing, fwiw.
05:52:43FromDiscord<crates> any of you guys use godot-nim? Getting an error when I try to build it:
05:52:43FromDiscord<crates> https://cdn.discordapp.com/attachments/371759389889003532/662896167348076544/unknown.png
05:52:54FromDiscord<crates> I've checked the directory it's searching for the c file in and there is a nim file but no c file
05:54:56*marmotini_ quit (Remote host closed the connection)
05:55:25FromDiscord<Stuffe> disruptek, No it is not reproducible. It happens regardless of the code
05:55:29*marmotini_ joined #nim
06:00:02*marmotini_ quit (Ping timeout: 268 seconds)
06:11:30*marmotini_ joined #nim
06:17:08*vesper11 quit (Ping timeout: 248 seconds)
06:17:19*vesper joined #nim
06:52:11*marmotini_ quit (Remote host closed the connection)
06:53:17*marmotini_ joined #nim
06:53:18*marmotini_ quit (Remote host closed the connection)
06:53:31*marmotini_ joined #nim
07:02:55AraqStuffe: antivir software?
07:10:20*narimiran joined #nim
07:39:32*jjido joined #nim
07:41:47*solitudesf joined #nim
07:50:02FromDiscord<Stuffe> No antivirus. Do "echo" commands flush and show up in the terminal immediately? I am echoing first thing in my code, but the hang occurs between compile warning messages and the first echo message
07:54:39ZevvStuffy: I assume you use `nim c -r` to compile and run in one go?
07:55:02ZevvSplit them up, first compile with `nim c stuff.nim` and then run with `./stuff`
07:55:14*marmotini_ quit (Ping timeout: 240 seconds)
07:55:15Zevvthen you can tell if its the compilation or the running
07:55:21Zevv(although its probably the first)
07:55:31*sealmove joined #nim
07:55:55*marmotini_ joined #nim
07:57:55Zevvleorize[m]: https://github.com/brammool/vim9/blob/master/README.md
07:58:53*icyphox left #nim ("Leaving")
08:00:00*gmpreussner quit (Quit: kthxbye)
08:01:23sealmovehola Zevv, happy 2020!
08:05:18*gmpreussner joined #nim
08:06:09Zevvsame dude!
08:06:37*nsf joined #nim
08:08:36ZevvMy accountant warned be to be explicit about writing dates this year, always write out the full "2020" because "20" can be changed in any other year. He's not wrong.
08:09:07Zevvso you made a good start, otherwise I could have changed your best wishes in "happy 2019", imagine that!
08:16:47FromDiscord<Stuffe> Zevv, Ok I will try that
08:17:31sealmoveoh that's smart
08:43:35*endragor quit (Remote host closed the connection)
08:45:43sealmoveif you have a nim expression as a NimNode, is there a magical way to get the type it resolve to?
08:49:45sealmovebasically I want to do type algebra T_T
08:49:49sealmoveterrifying
08:58:50FromDiscord<Stuffe> Zevv and Araq, in case you want to know, I was compiling with -d:debug and --debuginfo, turning that off seems to have fixed it
09:02:18sealmovenim's equivelant of C++ auto is auto?
09:02:22sealmoveor any?
09:06:56*marmotini_ quit (Remote host closed the connection)
09:07:29*marmotini_ joined #nim
09:12:26*marmotini_ quit (Ping timeout: 268 seconds)
09:14:16AraqStuffe: are you on OSX?
09:14:51FromDiscord<Stuffe> Yes, OSX Catalina
09:15:08Araqare you on Nim devel?
09:15:23FromDiscord<Stuffe> no, stable
09:16:33FromDiscord<Stuffe> it says: 1.0.4 [MacOSX: amd64]
09:16:48sealmoveAraq: can I somehow reuse Nim's typechecker to obtain an expressions type?
09:16:58sealmoveexpression's*
09:17:04FromDiscord<Stuffe> You can use macros
09:17:21FromDiscord<Stuffe> https://nim-lang.org/docs/tut3.html
09:18:36sealmoveI have a nim expression as NimNode and want to get the type it resolves to so I can implement a type declaration of a variable of that type in a macro.
09:21:54sealmovecan `proc getType(n: NimNode): NimNode` help me?
09:23:10lqdev[m]only if the expression is literal or `typed`
09:23:50sealmoveI am constructing the expression myself
09:24:00lqdev[m]though I think it can work for any `untyped` expressions without nnkIdent
09:24:28sealmovemakes sense
09:24:36sealmovebut
09:24:45sealmoveI have stuff like nnkInfix
09:24:53lqdev[m]otoh this only includes literals, once you start adding operators you use idents
09:25:23FromDiscord<Stuffe> sealmove, I don't know if "getType" is the compile time type or the run time type, but why don't you just write a little test for it?
09:25:25sealmove:( so what do I do? Am I on my own?
09:25:34lqdev[m]no, there's another way
09:25:47sealmoveStuffe: it's CT
09:25:54FromDiscord<Stuffe> Oh, ok
09:26:29lqdev[m]that way is to somehow force the compiler to do a semcheck on the expression, the way you do that is generate the expression from one macro, and generate an nnkCall calling your macro
09:27:23lqdev[m]protip: if you don't want the extra macro to be public, use bindSym
09:27:25sealmovewell, I want to generate an object declaration. The typed or its fields depend on some expression I've got
09:27:38sealmoveThe types*
09:27:44sealmovetypes of its fields*
09:28:30sealmove`auto` of course doesn't work in this case
09:30:45sealmovelqdev: how does this help?
09:31:23lqdev[m]if you already have the expression in the macro that generates the declaration, you can make that parameter `typed`
09:32:58sealmoveand if it's typed I have access to? the type? how?
09:34:08sealmovebasically I generate the expression by hand
09:34:25sealmoveit's not automatically created by Nim's parser
09:34:30lqdev[m]`untyped` parameters are not semchecked, while `typed` parameters are. semchecking includes resolving types, that's why the params are called `typed`
09:35:04sealmoveso it's a NimNode that includes some AST I make using procs in macros module
09:35:19lqdev[m]how do you have it set up now? there's just one macro with untyped parameters that processes some DSL?
09:35:44sealmoveno, I parse the DSL with npeg
09:35:53sealmoveit's in a file
09:36:00sealmoveNim can't parse the DSL
09:36:06lqdev[m]I see
09:37:59sealmoveso... I suppose nim can't help me here and I have to implement some sort of type algebra on the DSL expression, right?
09:38:17lqdev[m]so what you can do in this case is to split the macro into two, I'll call them `parsePeg` and `genObject`. `parsePeg` handles the parsing and expression generation, `genObject` handles the object declaration generation
09:38:36lqdev[m]the trick is to make `genObject`'s parameters typed
09:38:57lqdev[m]and call it indirectly by generating an nnkCall from `parsePeg`
09:39:17FromDiscord<Skaruts> is there a way to tell the compiler to automatically discard a return value if the user doesn't explicitly do so?
09:39:47lqdev[m]@Skaruts annotate the proc that returns something with {.discardable.}
09:40:31Araqdon't use .discardable
09:40:44*endragor joined #nim
09:41:05lqdev[m]Araq: then why is it a thing?
09:41:12sealmovefor interop?
09:42:15sealmovelqdev thanks a lot for the help, I'll try your suggestion <3
09:42:35Araqlqdev[m], C interop
09:42:47FromDiscord<Skaruts> is there an alternative?
09:42:56Araqgood API design
09:43:01lqdev[m]sealmove: np, feel free to ask for help if you have any trouble
09:43:11FromDiscord<Skaruts> I made a few procs that returns the object it's associated with, so that one can chain during instatiation like
09:43:14FromDiscord<Skaruts> `var img = new_image():merge_layers():set_transparency()`
09:43:31FromDiscord<Skaruts> but then it becomes a nuissance to use them separately
09:43:35Araqyeah I know, it's junk
09:43:38lqdev[m]Araq: what about macros.add?
09:43:48Araqfor chaining use a chain macro
09:43:59FromDiscord<Skaruts> oh
09:44:04Araqchaining shouldn't have any influence on API design whatsoever
09:44:34Araqchaining also bites with ownership, in C++ you return unowned and unchecked &'s everywhere because of this
09:44:42FromDiscord<Skaruts> not sure where to look for it in the docs
09:45:10Araqlqdev[m], macros.add was a mistake, newTree is the much better design
09:46:04lqdev[m]Araq: I stopped using macros.add after a while but sometimes it's still necessary. though, I don't need its return val in these cases
09:46:13Araqexactly
09:46:47AraqSkaruts: the stdlib has no 'chain' (yet!)
09:46:59AraqZevv has a 'with' package for it iirc
09:47:00lqdev[m]I need to fix initRWindow in rapid, it's a mess. default parameters are a way better option
09:47:12lqdev[m]right now it makes use of chaining
09:47:31FromDiscord<Skaruts> can you give me a quick example of how to make chaining possible?
09:48:57Araqhttps://github.com/zevv/with this does something else
09:49:10Araqbut maybe useful for inspiration
09:52:25FromDiscord<Skaruts> hmm... was hoping for something that could already be available in the language itself
09:52:41AraqPRs are accepted
09:53:36Araqbut the point remains: enabling chaining in the API directly is bad for all sort of reasons
09:54:57*endragor quit (Remote host closed the connection)
09:54:58FromDiscord<Skaruts> this is for a very simple script that loads/parses files from another app, so would it still make a difference?
10:00:44Araqif you don't publish your code, it's fine ;-)
10:00:56FromDiscord<Skaruts> lol
10:01:26Araqstill sugar.chain would be nice, anybody up for that?
10:02:53FromDiscord<Skaruts> I just tried using .discardable and everything seems to be working 100%
10:03:11FromDiscord<Skaruts> what exactly could go wrong with using it?
10:03:23Araqthe 'auto' return type inference, for example
10:04:02*solitudesf quit (Ping timeout: 240 seconds)
10:04:11FromDiscord<Skaruts> meaning that if the proc in question doesn't explicitly say "return", the compiler could miss it?
10:04:28Araqthat too
10:04:45*ng0 joined #nim
10:05:17FromDiscord<Skaruts> well nothing exploded, but I can live with making it explicit
10:05:46FromDiscord<Skaruts> actually they already are lol
10:06:15FromDiscord<mratsim> only if you are in a typed context
10:06:25FromDiscord<mratsim> argh, wasn't at the bottom
10:06:42Zevvso you were, like, in the wrong context
10:06:46FromDiscord<mratsim> was replying to the type algebra comment
10:06:59FromDiscord<mratsim> since @Skaruts is still there I can save πŸ˜›
10:07:25Araqso mratsim, how do your 'yield points' look like?
10:10:12FromDiscord<Skaruts> here's what I'm doing: <https://gist.github.com/Skaruts/c219fe3f8fdd3292596ecd95af9a391a#file-rpnim-nim-L149>
10:11:02Araqas I said, why return confusing redundant information?
10:11:12Araqthe caller already has the RPImage
10:11:24Araqtotal messy design just so that you can save some keystrokes
10:12:17FromDiscord<Skaruts> so that one could do it all in one line
10:12:39Araqand what's up with the 'warn's?
10:13:06FromDiscord<Skaruts> just so I don't have to type "\n"s all over the place
10:13:19Araquse 'assert'
10:13:51FromDiscord<Skaruts> the warns aren't supposed to stop the app, just inform the user about something
10:14:10Araqwhen I'm on Linux I sometimes run GTK apps
10:14:15Araqthey do the same
10:14:25Araqendless junk on my terminal
10:14:33Araqdon't do it.
10:14:38FromDiscord<Skaruts> the whole thing about the discarding, is just so that, if possible, I would't mind supporting this:
10:14:39FromDiscord<Skaruts> let rp_img = load_xp("data/thief map3.xp").set_transparency(0, 0, 0, 0).merge()
10:14:52AraqI know
10:15:19AraqI really understand it. And I really dislike it.
10:15:27FromDiscord<Skaruts> πŸ™‚
10:15:41Araqyour RPColor is a ref object and holds 4 integers
10:16:06FromDiscord<Skaruts> I only don't like it when overdone (ahem, rust...)
10:16:11Araqremove the 'ref' please
10:16:37FromDiscord<Skaruts> hmm, why so?
10:17:12FromDiscord<Skaruts> I usually just make everything ref tbh
10:17:32Araqvar colorB = colorA
10:17:38FromDiscord<Skaruts> basically because I don't quite know when to and when not to
10:17:42AraqcolorB.r = 4 # mutates colorA
10:18:00FromDiscord<Skaruts> ah yes, that
10:18:10Araq'ref' introduces aliasing
10:18:16FromDiscord<Skaruts> Maybe I should do that to the cells too
10:18:19FromDiscord<Skaruts> good point
10:18:25Araqsometimes that's what you want, most of the time it's not
10:18:39Araqand even if you want it *now*, later on it becomes a liability
10:18:50Araqsee the Nim compiler for a good example for that...
10:19:09FromDiscord<Skaruts> both ref object and object are GC'd?
10:19:26Araqnope, objects are not GC'd
10:19:59FromDiscord<Skaruts> so what do I do with them?
10:20:14Araqnothing, they are handles by the stack
10:20:23Araq*handled
10:20:40Araqso they are automatically freed too
10:20:49FromDiscord<Skaruts> oh ok, nice then
10:21:09FromDiscord<Skaruts> btw I used SomeInt and SomeFloat, is that proper?
10:21:12*natrys joined #nim
10:21:51Araqdunno, seems ok for now
10:27:16*krux02 joined #nim
10:28:41FromDiscord<Skaruts> yea there's an element of redundancy to those warnings...
10:29:25AraqListen to me. Warnings are bad. Either 'assert' on wrong API usage or don't
10:30:41sealmovelqdev: your github description is confusing
10:31:13sealmovepeople might think you are 15-year-old who has been programming games from when he was 12.
10:31:20*krux02 quit (Remote host closed the connection)
10:31:54sealmove':)
10:32:52lqdev[m]lol
10:33:33lqdev[m]but I clearly wrote `since`, not `from` :)
10:36:59FromDiscord<Skaruts> @Araq using object for colors seems to clash with nil default values (line 113)
10:37:55sealmovei meant the part "15 years old passionate programmer"
10:38:08FromDiscord<Skaruts> `rpnim.nim(153, 63) Error: type mismatch: got <typeof(nil)> but expected 'RPColor = object'`
10:38:19FromDiscord<Skaruts> (113 on the gist)
10:38:33sealmove"passionate programmer for 15 years" instead would avoid misunderstandings :P
10:39:18*endragor joined #nim
10:39:24AraqSkaruts: you said it yourself ("create overloads if not")
10:39:58FromDiscord<Skaruts> well I was wondering if it could be done -- I'm still a noob at nim πŸ˜‰
10:40:12*owl_000 joined #nim
10:40:35FromDiscord<Skaruts> overloading it is then
10:40:43Araqyou can also use an Option[T]
10:40:47sealmovegtg, bye all
10:40:50*sealmove quit (Quit: WeeChat 2.7)
10:41:13*dwdv joined #nim
10:41:35lqdev[m]sealmove: dude, but I am 15 years old
10:42:02lqdev[m]how else can I say this
10:42:52dom96Just noticed this on our wiki: https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Nim_(programming_language)_(4th_nomination)
10:43:15dom96Some guy arguing that even the book doesn't prove notability because I wrote it so it's a primary source lol
10:43:27*marmotini_ joined #nim
10:43:39dom96Looks like this person was just trying to get revenge for their page being deleted
10:44:30*endragor quit (Remote host closed the connection)
10:45:34FromDiscord<Skaruts> @Arak I don't know how to use that though
10:45:37dom96also, TIL this book has a section on Nim https://books.google.co.uk/books?id=xrd9DwAAQBAJ&pg=PA18#v=onepage&q&f=false
10:45:39*beshr joined #nim
10:46:09*endragor joined #nim
10:47:42dom96It mentions Nimble pretty heavily, guess I should buy it
10:52:54*endragor quit (Remote host closed the connection)
10:53:25FromDiscord<Skaruts> I'm thinking of buying your book, but man... it delves into technical web stuff, which to me is the boring stuff in programming πŸ™‚
10:55:17dom96That's fair, I figured it would be the easiest to get into (and most popular) but I can understand if some find it boring
10:55:41FromDiscord<Stuffe> if it explains how to get the step debugger in VS code to work with nim I would buy it
10:55:49FromDiscord<Stuffe> literally wasted hours and failed
10:56:20Araqgdb works ok'ish
10:56:27FromDiscord<Skaruts> well to be fair, it's like Stephen King once said "write what you know". If you made the book about something you weren't soversed on it might not be as good
10:56:42FromDiscord<Skaruts> so versed on*
10:57:18FromDiscord<Skaruts> maybe it is easy, maybe it's just that I never went there
10:58:47FromDiscord<Stuffe> Araq, you mean in the terminal, right?
10:58:56Araqyeah
10:59:01FromDiscord<Stuffe> Its all C symbols though?
10:59:10Araqno, we have a script
10:59:31FromDiscord<Stuffe> Oh, any link about that?
10:59:44Araqtools/nim-gdb.py
11:00:04*Trustable joined #nim
11:00:38FromDiscord<Stuffe> Ah ok, I will check that out later
11:10:01dom96https://twitter.com/d0m96/status/1213417218169593857
11:12:05dom96Nim's popularity is growing :)
11:12:39FromDiscord<Skaruts> indeed, I found quite a few tutorials on youtube from ~2 months ago
11:12:47FromDiscord<Skaruts> people seem to be picking it up
11:27:29FromGitter<Albus70007> does a nim socket decode the information by itself?
11:27:40*nsf quit (Quit: WeeChat 2.7)
11:28:15*natrys quit (Quit: natrys)
11:35:31*endragor joined #nim
11:40:19dom96Albus70007: decode how? It gives you whatever the POSIX/WinAPI returns
11:40:34dom96(or openSSL for SSL)
11:41:16FromGitter<Albus70007> i am having issues trying to receive information supposedly encoded in utf8 from a python socket server, nim will just throw me an string
11:42:02dom96that should just work, Nim's strings are basically UTF8
11:42:28FromGitter<Albus70007> but i need the data as bytes to properly read the header
11:43:54dom96!eval var x = "πŸ“™"; echo(x[0].repr)
11:43:57NimBot'\240'
11:45:57FromGitter<Albus70007> ill try it, thank you and lets see if we can pass D in popularity soon!
11:46:16dom96:D
11:48:26*endragor quit (Remote host closed the connection)
11:53:39FromGitter<Albus70007> and if i want to revert the bytes to string again?
11:55:27FromDiscord<mratsim> @Araq, my yield points are there: https://github.com/mratsim/weave/blob/059d4521fd285b393339bd916f85588c97c5da75/weave/runtime.nim#L82-L122
11:55:27FromDiscord<mratsim> A worker polls for incoming steal requests, send tasks if it has some or forward them to another poor victim if it has none, and then back to user code.
11:57:04FromDiscord<mratsim> there shouldn't be any problem to add an IO task queue that I can check as well there
12:01:46*endragor joined #nim
12:03:37FromDiscord<mratsim> or just yield to asyncdispatch event loop
12:04:55FromDiscord<Skaruts> is there a way to get an object from a seq by reference? (it's not a ref object)
12:05:16FromDiscord<mratsim> mySeq[i].addr
12:05:24FromDiscord<Skaruts> ah thanks
12:06:34FromDiscord<mratsim> you can also have an accessor that return a var T.
12:07:22FromDiscord<mratsim> proc indexMut(s: var seq[T], index: int): var T = s[index]
12:08:14FromDiscord<mratsim> but you can assign it, you have to pass it as a var param
12:08:17FromDiscord<mratsim> can't*
12:10:12*chemist69 quit (Ping timeout: 248 seconds)
12:10:57*chemist69 joined #nim
12:13:26FromGitter<Varriount> Skaruts: Are you coming from Go?
12:15:01*endragor quit (Remote host closed the connection)
12:15:11*jjido quit (Quit: Textual IRC Client: www.textualapp.com)
12:16:58*lritter joined #nim
12:23:25Araqmratsim: can you make this without the '_' typedesc parameter?
12:23:58*marmotini_ quit (Remote host closed the connection)
12:24:08Araqand can we make this a .compilerProc and patch the compiler to call it automatically?
12:24:33*marmotini_ joined #nim
12:28:50*marmotini_ quit (Ping timeout: 240 seconds)
12:31:02*endragor joined #nim
12:31:24*endragor quit (Remote host closed the connection)
12:36:59FromDiscord<inv> Hello, just first 3 hours in nim, but did the same like in 1 month in Rust πŸ™‚
12:41:42FromDiscord<inv> I have a question: I see that nim has a lot of for meta-programming. Is it possible to handle this thing somehow:
12:41:42FromDiscord<inv> type T = tuple: a: int; b: int; c: int
12:41:42FromDiscord<inv> var counter = initTable[string, T]()
12:41:42FromDiscord<inv>
12:41:42FromDiscord<inv> I have a stream of string data which includes key:string and values: which is enum of "a","b","c"
12:41:43FromDiscord<inv> Is it possible to do something like counter.mgetOrPut(data.key, (0,0,0))[data.value] += 1 for it?
12:41:46FromDiscord<inv> I understand that tuples does not work this way and all information about fields are lost after compilation, but, probably I can do some template-trick for it ?
12:42:14FromDiscord<inv> I suppose I can define function which would return ref to thee tuple-field, but not sure if it is the best way
12:45:04FromDiscord<Generic> can you give an example of one your entries?
12:51:23*endragor joined #nim
12:57:01FromDiscord<mratsim> @Araq yes I can
12:57:37FromDiscord<mratsim> by the way, would it be interesting to allow multiple Weave or scheduler instances
12:57:55FromDiscord<mratsim> like weave1.spawn foo(a, b, c)
12:58:07FromDiscord<mratsim> and weave2.spawn bar(a, b, v)
12:58:39FromDiscord<mratsim> I know one use case, testing πŸ˜›
12:58:53FromDiscord<mratsim> (testing weave, globals are a pain to test)
13:00:08*dddddd joined #nim
13:00:14FromDiscord<mratsim> @inv, from you description I don't see any issue
13:00:31FromDiscord<mratsim> you don't need template or metaprogramming either
13:01:02FromDiscord<inv> just a sec, will try playground
13:01:28FromDiscord<inv> does not work 😦
13:01:52FromDiscord<Generic> https://play.nim-lang.org/#ix=26nn
13:02:18FromDiscord<Generic> I used a template πŸ™‚
13:02:30FromDiscord<Generic> but only because of what I call Nim's greatest weakness
13:02:37FromDiscord<inv> @Generic I would like to avoid the boiler-plate (not so big really)
13:03:22FromDiscord<inv> I have tupple with named fields. and would like to put into the field by string-variable
13:04:29FromDiscord<inv> to do ```entry[value]``` somehow, but I know - it is tupple, not dict
13:06:31FromDiscord<mratsim> use enums values as a map
13:07:21FromDiscord<inv> I was sure it is not so easy
13:07:56FromDiscord<Generic> https://play.nim-lang.org/#ix=26np
13:08:01FromDiscord<Generic> you can try this instead
13:08:11FromDiscord<Generic> this is a bit more general solution
13:08:45FromDiscord<inv> oh, interesting, thank you
13:09:02FromDiscord<mratsim> example: https://play.nim-lang.org/#ix=26nq
13:09:34FromDiscord<Generic> @mratsim this only works, because you supply a constant as the index
13:09:38FromDiscord<mratsim> or use an array instead of a tuple
13:09:58FromDiscord<inv> have to understand how it works πŸ™‚ Thank you
13:10:15FromDiscord<mratsim> right, let me change it then
13:10:45FromDiscord<Generic> @inv https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT this explains most of it
13:11:01FromDiscord<mratsim> here you go: https://play.nim-lang.org/#ix=26ns
13:11:29FromDiscord<mratsim> if a tuple works and type are homegeneous, you can use an Array indexed by enums instead
13:11:39FromDiscord<inv> is it reaaly necessary to iterate over it?
13:11:56FromDiscord<inv> looks like so, but I suppose it is not very good
13:11:57*arecaceae joined #nim
13:12:17arecaceaeis there something similar to golang interfaces?
13:12:38FromDiscord<Generic> @inv you're just seeing the real cost of it for the first time
13:13:40FromDiscord<Generic> arecaceae: you can make an object with function pointers in it
13:13:59arecaceaeahhh, that is the recommended way?
13:14:12FromDiscord<Generic> well there are libraries like this one: https://github.com/andreaferretti/interfaced
13:14:32FromDiscord<Generic> but a lot of the time you can generics instead
13:14:40FromDiscord<Generic> what are you trying to archive?
13:15:21FromDiscord<Generic> there are a lot of situations where interfaces a the "solution" in go when other languages (especially Nim) have better ways of doing it
13:15:51arecaceaebasically an exported type that consumers like other packages can reimplement
13:16:03FromDiscord<inv> Y, I suppose it is too complicate - I just do += 1 on one of the tupple fields
13:16:18arecaceaeI guess I could just use `object of` ?
13:16:23arecaceaeeven with a final object type
13:18:31FromDiscord<Generic> arecaceae: for example see: https://github.com/nim-lang/Nim/blob/version-1-0/lib/system.nim#L3154
13:18:58arecaceaeGeneric: ah gotcha, thanks
13:18:59FromDiscord<Generic> find doesn't need an interface for T
13:20:26FromDiscord<Generic> @inv inc is for ints synonymous with += 1
13:21:22FromDiscord<Generic> if this is what you asked
13:26:09*koltrast quit (Quit: ZNC - http://znc.in)
13:28:14FromDiscord<inv> is it possible to covert ```proc mget(stat: var Stat, name: string): var int =```
13:28:15FromDiscord<inv> into `[]=` ?
13:30:11FromDiscord<Generic> this is your proc
13:30:12FromDiscord<Generic> ?
13:30:38FromDiscord<Rika> Why do you need to get it if you're only modifying
13:31:11FromDiscord<Rika> mget would be a `[]=` and a `[]` in the rhs
13:31:21FromDiscord<Generic> by standard naming definitions that proc would have to be named ``[]``
13:31:41FromDiscord<Generic> ````[]````
13:31:54FromDiscord<Rika> Yeah I think it's a `[]` with a var first argument
13:32:17FromDiscord<Rika> And returns a var T
13:32:31FromDiscord<inv> ``` Error: cannot evaluate at compile time: value```
13:32:43FromDiscord<inv> ^^^ is I change mget to `[]`
13:32:50FromDiscord<inv> ^^^ if I change mget to `[]`
13:33:15FromDiscord<Rika> Copy the proc signature again
13:33:43FromDiscord<inv> ```nim
13:33:44FromDiscord<inv> proc mget(stat: var Stat, name: string): var int =
13:33:44FromDiscord<inv> case name
13:33:44FromDiscord<inv> of "full": return stat.full
13:33:44FromDiscord<inv> of "ticker": return stat.ticker
13:33:44FromDiscord<inv> of "heartbeat": return stat.heartbeat
13:33:45FromDiscord<inv> ```
13:33:54FromDiscord<Rika> No I mean
13:34:01FromDiscord<Rika> The top line, after changing it to []
13:34:16FromDiscord<inv> counter.mgetOrPut(pid,(0,0,0)).mget(typ).inc()
13:34:30FromDiscord<inv> ```
13:34:30FromDiscord<inv> counter.mgetOrPut(pid,(0,0,0)).mget(typ).inc()
13:34:30FromDiscord<inv> of Opcode.Ping:
13:34:30FromDiscord<inv> echo "ping"
13:34:31FromDiscord<inv> of Opcode.Pong:
13:34:31FromDiscord<inv> echo "pong"
13:34:31FromDiscord<inv> else:
13:34:33FromDiscord<inv> echo "else"
13:34:34FromDiscord<inv> ```
13:34:35FromDiscord<Generic> btw you don't need the return
13:34:44FromDiscord<Rika> What are you even sending now
13:34:54FromDiscord<inv> @Generic I was trying to do without it
13:35:30FromDiscord<Generic> you need to make else an exception
13:35:48FromDiscord<Generic> this way the Nim compiler recognises that the case statement always evaluates to a value
13:36:08FromDiscord<Rika> @inv you can remove the returns AFTER adding an `else: 0 # do something` and substituting the 0 with any desired value
13:36:26FromDiscord<Rika> An exception, a 0, another int, can be anything
13:36:31FromDiscord<inv> I was not sure should I create result.new or new exception // tryng to find how to make custom except now
13:36:55*koltrast joined #nim
13:37:09FromDiscord<Rika> raise newException(ValueError, "error text")
13:37:15FromDiscord<inv> I was sure I cannot return 0 because it is var, 1 sec, I will check
13:38:17FromDiscord<inv> ```nim
13:38:17FromDiscord<inv> proc mget(stat: var Stat, name: string): var int =
13:38:17FromDiscord<inv> case name
13:38:17FromDiscord<inv> of "full": stat.full
13:38:17FromDiscord<inv> of "ticker": stat.ticker
13:38:17FromDiscord<inv> of "heartbeat": stat.heartbeat
13:38:19FromDiscord<inv> else: raise newException(ValueError, "error field-name")
13:38:19FromDiscord<inv> ```
13:38:21FromDiscord<inv> Error: expression has no addres
13:38:26FromDiscord<inv> like with case name
13:38:32FromDiscord<inv> line with case name
13:38:37*Vladar joined #nim
13:39:01FromDiscord<Rika> What, that's odd
13:39:03FromDiscord<inv> the same with return 0
13:39:43FromDiscord<Generic> that's odd indeed
13:40:07FromDiscord<inv> but return works πŸ™‚
13:40:21FromDiscord<Rika> I usually use the block version of case (add a colon to the end of the case name line and indent everything one level) but I doubt that would change anything
13:41:21FromDiscord<Generic> I think it's a compiler bug
13:41:24FromDiscord<Generic> it should work
13:42:14FromDiscord<Generic> it works if the return type is changed to only int
13:43:17narimiran0 is not `var int`
13:43:25FromDiscord<Generic> but an exception should work
13:43:36FromDiscord<Clyybber> probably
13:44:44FromDiscord<Rika> It should work for the exception
13:44:54FromDiscord<Rika> That's what's making me confused
13:45:06FromDiscord<Rika> Did I somehow not get the syntax right lmao
13:45:13FromDiscord<Generic> @inv your first compiler bug πŸ™‚
13:45:15FromDiscord<Rika> I'm on mobile, pls forgif
13:45:44FromDiscord<Clyybber> @Generic hmm, not sure if its a bug
13:46:11FromDiscord<Clyybber> if we allow it you could do memory corruption I think
13:46:27FromDiscord<Generic> oh I see
13:46:34FromDiscord<Clyybber> by catching the exception and writing to the returned var
13:47:16FromDiscord<Clyybber> maybe I'm wrong though
13:47:46FromDiscord<Generic> hm, the only case I can come up with
13:48:27FromDiscord<Generic> oh, that was stupid what I thought
13:49:05FromDiscord<Generic> hm, though the var T can only occur in a scope which is left by the exception
13:49:24FromDiscord<inv> @Generic I had a lot of bugs even in rust πŸ™‚
13:49:28planetis[m]btw some stuff is done for a nim friendly cairo interface https://github.com/b3liever/cairo2
13:50:07FromDiscord<Clyybber> @Generic You could do `try: mget(...) = something except e: ...`
13:50:29FromDiscord<Clyybber> I'm not sure if the assignment will continue though, if mget raises
13:50:38FromDiscord<Clyybber> lemme test that
13:51:05FromDiscord<Generic> I would expect this to work fine, the lhs is evaluated before the rhs
13:51:09FromDiscord<inv> will run away for 1/2h
13:51:16FromDiscord<Generic> bye
13:51:20FromDiscord<Clyybber> bb
13:51:22ZevvPMunch here?
13:51:32FromDiscord<Clyybber> @Generic yeah, probably
13:51:38FromDiscord<Clyybber> ok, then it may be safe
13:51:51FromDiscord<Generic> I file a bug report then
13:53:06planetis[m]could someone tell me if thats the correct way to wrap a reference counted type with destructors? https://github.com/b3liever/cairo2/blob/master/cairo2.nim#L15-L23
13:54:33FromDiscord<inv> could you explain there is a bug? Do not undesrstand what nim checks here
13:55:01FromDiscord<inv> ... and is it possible to make `[]`
13:55:21FromDiscord<Generic> that has nothing to do with the ``[]``
13:55:22planetis[m]isn't bad that a library does its own memory management btw?
13:55:49FromDiscord<Generic> planetism other wrapper do that as well
13:56:05FromDiscord<Generic> @inv did you put backtick around the []?
13:56:25FromDiscord<Generic> that's incredible hard to write on discord
13:59:26*endragor quit (Remote host closed the connection)
14:01:51skrylar[m]planetism is an awesome name
14:02:28FromDiscord<Clyybber> believer in planetism
14:02:32*endragor joined #nim
14:05:25planetis[m]pbl should make them match
14:06:44planetis[m]but thanks skrylar, what yours mean? It reminds me of a musician
14:07:42*endragor quit (Remote host closed the connection)
14:10:13FromDiscord<Rika> @Generic \`[] \`
14:10:21FromDiscord<Rika> Oops, space
14:10:48*endragor joined #nim
14:11:49FromDiscord<Generic> yes, it's supposed to be this way
14:12:09lqdev[m]skrylar, @Clyybber: his name is actually planetis, it's just the matrix freenode bridge that appends [m] to our names
14:12:47FromDiscord<Clyybber> I know
14:13:04FromDiscord<Clyybber> but I think its done on purpose
14:13:53lqdev[m]yeah, to notify people that this is a bridge user
14:14:49FromDiscord<Clyybber> nah, I mean like having the m complete your name
14:15:00*sagax quit (Read error: Connection reset by peer)
14:21:18lqdev[m]well, lqdevm doesn't sound that good.
14:21:50lqdev[m]the [m] stands for matrix.
14:21:52FromDiscord<Clyybber> liqde[m]
14:22:48FromDiscord<Rika> xirta[m]
14:25:41planetis[m]relax its only a name, he pbl didn't want to ping me for no reason, no big deal.
14:26:59FromDiscord<Rika> Is it me or are diff libraries kinda obscure and hard to find
14:29:22FromDiscord<Clyybber> yeah, its you, you are obscure; not but really: https://nim-lang.github.io/Nim/diff
14:29:26FromDiscord<Clyybber> its in the stdlib :p
14:35:02planetis[m]i want to use that dark theme, but its broken when running ``nim doc`` πŸ˜₯
14:35:45planetis[m]it so good
14:36:03planetis[m]😭
14:36:37FromDiscord<Clyybber> now if only it would remember to stay dark
14:36:40FromDiscord<Clyybber> on firefox that is
14:37:29FromDiscord<inv> @Generic I put ``, it started to const it
14:38:26FromDiscord<Rika> @Clyybber i meant binary diffing/delta
14:38:29FromDiscord<Rika> sorry
14:38:33FromDiscord<Clyybber> oh, sorry
14:39:01FromDiscord<inv> counter.mgetOrPut(pid,(0,0,0))[typ].inc() cannot evaluate at compile time: typ
14:39:03FromDiscord<Rika> those are much harder to find
14:39:17FromDiscord<Clyybber> @Rika I think you can use it for binary data too though
14:39:41FromDiscord<Rika> i'd have to convert it into a seq[int] lmao
14:40:19FromDiscord<mratsim> @planetis check there: reviewed by Araq yesterday: https://github.com/mratsim/weave/pull/92/commits/4aad01ed9b09354e183c0a8f225c6ed06da8f725
14:40:20disbotβž₯ [WIP] Dataflow graph parallelism
14:41:07FromDiscord<mratsim> replace the fetchAdd/fetchSub by inc/dec if you don't need atomic refcounting
14:42:01FromDiscord<mratsim> see: https://irclogs.nim-lang.org/03-01-2020.html#21:24:21
14:47:24*nsf joined #nim
14:50:23planetis[m]mratsim: i think the destructors should be attached to an stack object that references heap allocated memory
14:51:41planetis[m]although i am confused
14:52:19*solitudesf joined #nim
14:54:56FromDiscord<Clyybber> thats how mratsim does it
14:55:22FromDiscord<Clyybber> lp is a ptr object
14:57:31planetis[m]what about this line: system.`=sink`(dst.lp, src.lp)
14:59:37FromDiscord<Clyybber> what about it?
15:00:20FromDiscord<Clyybber> its not really necessary
15:00:41planetis[m]very intersting library though, mratsim good one!
15:00:41FromDiscord<Clyybber> a memCopy with zeroing src.lp would do it too
15:00:45FromDiscord<Clyybber> but its more succint
15:01:02*letto quit (Quit: Konversation terminated!)
15:03:59planetis[m]clybber: do you think this is correct https://github.com/nim-lang/cairo/issues/13#issuecomment-570685009
15:04:00disbotβž₯ Use destructors for automaticaly closing of resources ; snippet at 12https://play.nim-lang.org/#ix=26eu
15:05:15FromDiscord<Clyybber> planetis[m]: Yeah, afaict
15:05:23FromDiscord<Clyybber> Your `=` could be a little simpler
15:05:30FromDiscord<Clyybber> if it would use `=destroy`
15:06:16planetis[m]good point
15:06:18FromDiscord<Clyybber> well, depends on what cairo_reference does
15:06:40planetis[m]thanks, i appreciate it
15:06:51FromDiscord<Clyybber> I mean it depends on what cairo_reference does, wether or not this is correct
15:06:58FromDiscord<Clyybber> planetis[m]: Np πŸ™‚
15:07:57FromDiscord<Clyybber> planetis[m]: I think dispose is wrong though
15:08:08FromDiscord<Clyybber> It shouldn't destroy it, I think, just unref it
15:08:13FromDiscord<Clyybber> so set it to nil
15:08:48FromDiscord<Clyybber> oh, I'm apparently too dumb to read your post πŸ˜„
15:08:52FromDiscord<Clyybber> nvrmind
15:09:30*letto joined #nim
15:09:43*ng0_ joined #nim
15:09:43*ng0_ quit (Changing host)
15:09:43*ng0_ joined #nim
15:09:44*marmotini_ joined #nim
15:10:10*sagax joined #nim
15:12:22lqdev[m]does assigning a `var` object from one variable to another copy it?
15:12:42planetis[m]nonsense programmers are not dumb, but maybe tired and overworked :)
15:12:59disrupteki beg to differ.
15:13:02*ng0 quit (Ping timeout: 258 seconds)
15:13:14planetis[m]lqdev: yes
15:13:35FromDiscord<mratsim> it's interesting but head scratching, now I have distributed system problems in my library :/. btw, I need a good way to represent a dependency graph.
15:13:35FromDiscord<mratsim>
15:13:36FromDiscord<mratsim> If I use your patgraph lib, is there a way if I give an input value "A" to iterate on all nodes connected to it, and also check if we are the last remaining connection?
15:15:06disruptekcompare with these:
15:15:09disruptek!repo graflib
15:15:10disbothttps://github.com/mashingan/graflib -- 9graflib: 11Very simple graph implementation library. 15 1⭐ 0🍴
15:15:11planetis[m]haha, in which part disruptek ?
15:15:23disruptek!repo graph-analysis
15:15:24disbothttps://github.com/D-K-E/graph-analysis -- 9graph-analysis: 11A repo on analysis of graphs as in graph theory 15 1⭐ 0🍴
15:15:53disrupteki'm neither tired or overworked: explain my stupidity.
15:16:49planetis[m]mratsim: its actually a rewrite of petgraph btw
15:17:17disruptekhearts and minds, people; hearts and minds!
15:17:33*ng0_ is now known as ng0
15:17:54planetis[m]should mention it in readme
15:18:07FromDiscord<inv> ok, can I ask another question I did not find in google:
15:18:07FromDiscord<inv> I have a table - I want to output in sort order by tuple-value
15:18:18FromDiscord<inv> better immutable, but mutable is also ok
15:19:02FromDiscord<inv> table[string, (int,int,int)] . I would like to output in order by sum of tuple
15:19:05FromDiscord<mratsim> you need to use an OrderedTable and before output sort it (there is a proc for that)
15:19:21*letto quit (Quit: Konversation terminated!)
15:19:36FromDiscord<mratsim> There is no SortedTable (that keeps insertion order automatically) at the moment
15:19:36FromDiscord<Clyybber> Araq: I imagine a chain macro could be easily implemented by inserting strategic outplace's
15:19:49disruptek!repo sorta
15:19:49disbothttps://github.com/narimiran/sorta -- 9sorta: 11SortedTables in Nim, based on B-Trees 15 12⭐ 1🍴
15:20:09FromDiscord<inv> @mratsim thanks!
15:20:09FromDiscord<Clyybber> beat me to it
15:20:10narimiranyeah, more testers for that needed :)
15:20:11planetis[m]the're many other procs that i didn't port though
15:20:48FromDiscord<inv> Does the channel has cross-post with telegram? I prefer telegram πŸ™‚
15:21:01narimiranno, telegram is separated
15:21:08FromDiscord<Clyybber> nope
15:21:19narimiranbut you can ask questions there if you want/prefer
15:21:36disruptekitym if you want/prefer cats.
15:21:37narimiransome of us are in both
15:24:23*Vladar quit (Quit: Leaving)
15:26:18planetis[m]mratsim: if you have a node "a' and want to know if neighbor "b" has only one edge, you check if edge.next has invalid index
15:26:25planetis[m]so i think its possible
15:30:26FromDiscord<inv> are there any way to put tuple fields in proc definition? proc ((a,b):(string, int)) ... ?
15:31:56lqdev[m]inv: `proc p(a: tuple[x, y: int])`
15:32:04lqdev[m]or `proc p(a: (int, int))`
15:32:14FromDiscord<inv> hm, I way trying
15:32:17*ng0 quit (Ping timeout: 265 seconds)
15:32:51FromDiscord<inv> ah
15:33:55FromDiscord<inv> ```nim
15:33:55FromDiscord<inv> proc cmp(x:tuple[xx: string, a: Stat], b: (string, Stat)): int =
15:33:55FromDiscord<inv> system.cmp(a.full,b[1].full)
15:33:55FromDiscord<inv> ```
15:33:55FromDiscord<inv> does not work
15:34:30narimiranthe latter is anonymous tuple
15:34:31FromDiscord<inv> I wanted to match fields of tuple in declaration
15:34:44FromDiscord<inv> Sorry, did not get
15:35:14narimiranand shouldn't it be `cmp(xx.a.full, ...)`?
15:35:23*beshr quit (Ping timeout: 268 seconds)
15:35:38narimiran(make that just one `x`, not two)
15:36:38FromDiscord<inv> @gitterirc it is cmp for table => (key,value), but I do not need key
15:36:47narimiran btw, did you know you can do something like `a, b: tuple[xx: string, a: Stat]`?
15:36:55FromDiscord<inv> ```proc sort[A, B](t: var OrderedTable[A, B]; cmp: proc (x, y: (A, B)): int;```
15:37:07planetis[m]mratsim: only one edge ```for edge in nodeA.neighbors: graph.nodes[edge.node[1]].next[1] == edix``
15:37:16narimiran(gitterirc is bot, not a person)
15:39:23FromDiscord<inv> it works if I do a.a.full, but I wanter to apply simple pattern-matching here:
15:39:23FromDiscord<inv> proc((x,a):(string, Stat), (y,b):(string, Stat)): int = system.cmp(a,b)
15:39:45*beshr joined #nim
15:39:58FromDiscord<inv> a.a.full is ~ the same like a[1].full
15:40:44planetis[m]uhm no you need a HashSet
15:40:48FromDiscord<mratsim> @planetis thanks.
15:43:41FromDiscord<exelotl> Is there a portable way to get the path to nimbase.h (regardless of how nim was installed)
15:45:35FromDiscord<exelotl> Feels like there should be a compiler flag that would output the path to the lib directory
15:46:03planetis[m]also consider this: https://github.com/petgraph/petgraph/blob/master/src/matrix_graph.rs
15:47:19narimiran`(x,a):(string, Stat)` - you can't do tuple unpacking there, AFAIK
15:48:02*beshr quit (Ping timeout: 240 seconds)
15:48:28FromDiscord<mratsim> I think I have a protocol which wouldn't require me to use a graph library: https://github.com/mratsim/weave/pull/92#issuecomment-570795718
15:48:28disbotβž₯ [WIP] Dataflow graph parallelism
15:53:36shashlickexelotl: there's https://github.com/nimterop/nimterop/blob/master/nimterop/docs.nim#L13
15:54:22shashlickThere's also $nim substitution
15:56:57*drewr quit (Ping timeout: 260 seconds)
15:58:33FromDiscord<inv> Are there any way to do: for k,v in table.take(10): echo k,v ?
15:58:50FromDiscord<inv> ... without defining own iterator
16:03:29FromDiscord<Rika> thats not how the take proc works
16:04:00*letto joined #nim
16:05:10FromDiscord<Rika> @inv ordinary tables dont have an order so a `take` proc like that wouldnt work
16:05:24FromDiscord<Rika> prolly make a proc for `OrderedTable`
16:06:17*ng0 joined #nim
16:06:17*ng0 quit (Changing host)
16:06:17*ng0 joined #nim
16:06:24FromDiscord<inv> But I have OrderedTable - doesn't it mean that it has iterator? I would like to output only first 10 from the table
16:06:30FromGitter<timotheecour> is there a way to convert a `Slice` to a `Set` (eg: smthg like `toSet`) ? use case: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e10b806c23234403cca63bf]
16:08:18FromDiscord<mratsim> @inv, you need to implement your own, it's not too hard, you just do like the "items" iterator with a counter and break when it reaches the limit
16:08:55FromDiscord<inv> @mratsim Yes, I did it already, I was tryng to find build-in solution. Thank you
16:08:59FromDiscord<mratsim> @timotheecour, doesn't {1..3} work?
16:09:32FromDiscord<mratsim> but then you can't use "in" with case of
16:12:34FromGitter<timotheecour> @mratsim thanks, duh, didnt’ think of that :) ⏎ ⏎ > but then you can't use "in" with case of ⏎ ⏎ what do u mean? [https://gitter.im/nim-lang/Nim?at=5e10b9724e9ea12051b3e66b]
16:13:37*ng0 quit (Ping timeout: 268 seconds)
16:16:26FromGitter<timotheecour> Oh, and to answer my own question, this works; probably should be in stdlib ⏎ ⏎ ``` proc toSet[T](s: Slice[T]): set[T] = ⏎ {s.a .. s.b}``` [https://gitter.im/nim-lang/Nim?at=5e10ba5a316c147327157c08]
16:17:22FromGitter<timotheecour> (although for above use case the simplest is `of {nkCharLit..nkUInt64Lit} - {nkIntLit}` ; but there are use cases for `toSet`
16:22:01FromDiscord<mratsim> or so "of {1..3}" works?
16:22:19FromDiscord<mratsim> I'm always confused with case of because .. is builtin so ..< doesn't work for example
16:22:49FromDiscord<mratsim> toSet will conflict with the old deprecated toSet (which is no toHashSet)
16:22:53FromDiscord<mratsim> now*
16:23:36FromDiscord<Clyybber> Araq: I have implemented the loop analysis using an extra instruction, but it misses one case:
16:23:58FromDiscord<Clyybber> ```
16:23:58FromDiscord<Clyybber> while cond:
16:23:59FromDiscord<Clyybber> var a = ...
16:23:59FromDiscord<Clyybber> b = a
16:23:59FromDiscord<Clyybber> #b = a
16:23:59FromDiscord<Clyybber> ```
16:24:37FromDiscord<Clyybber> Here `var a = ...` is technically a firstWrite, but that depends on `b = a` being a lastRead which in turn depends on `#b = a` being commented out
16:25:02FromDiscord<Clyybber> Analysing the loop thrice would solve the problem
16:25:42FromDiscord<mratsim> but a is shadowed
16:25:47FromDiscord<mratsim> so it's not the same a
16:25:56FromDiscord<Clyybber> no, it is
16:26:08FromDiscord<Clyybber> it gets extracted out of the loop later on
16:26:10FromDiscord<Clyybber> afaik
16:26:19FromGitter<alehander92> hmm, when is needed to do it thrice
16:26:21FromDiscord<mratsim> ah, compiler magic
16:26:26FromGitter<alehander92> ahh thats interesting
16:26:34FromDiscord<Clyybber> Yeah, indeed
16:26:35FromGitter<alehander92> i thought twice is enough in cfg-s
16:27:29*NimBot joined #nim
16:27:39FromGitter<alehander92> btw
16:27:48FromGitter<alehander92> nvm offtopic
16:28:27FromDiscord<mratsim> i've seen much worse offtopic than that on the nim channel
16:29:29FromDiscord<Clyybber> all ontopic and no play makes clyybber a dull boy
16:29:32FromGitter<alehander92> no i planned
16:29:35FromGitter<alehander92> to say somethign!
16:29:39FromGitter<alehander92> but said it in offtopic
16:32:14FromDiscord<mratsim> btw, if someone is bored, I could use another pair of eyes on this protocol: https://github.com/mratsim/weave/pull/92#issuecomment-570795718
16:32:14FromDiscord<mratsim>
16:32:14FromDiscord<mratsim> The idea is to represent data dependencies between parallel tasks via a promise. Pseudo code for the expected syntax is there: https://github.com/mratsim/weave/pull/92#issuecomment-570779099
16:32:15disbotβž₯ [WIP] Dataflow graph parallelism
16:32:16disbotβž₯ [WIP] Dataflow graph parallelism
16:32:56FromDiscord<mratsim> This is something that has been plaguing me for a month now: https://github.com/mratsim/weave/issues/31
16:32:59disbotβž₯ Nested for-loops: Expressing reads-after-writes and writes-after-writes dependencies ; snippet at 12https://play.nim-lang.org/#ix=26ok
16:33:18FromDiscord<mratsim> (only read the last link if you have a LOT of time)
16:40:46FromDiscord<Clyybber> ```
16:40:46FromDiscord<Clyybber> if cond:
16:40:46FromDiscord<Clyybber> var a = ...
16:40:46FromDiscord<Clyybber> b = a
16:40:47FromDiscord<Clyybber> if cond:
16:40:47FromDiscord<Clyybber> var a = ...
16:40:47FromDiscord<Clyybber> b = a
16:40:48FromDiscord<Clyybber> if cond:
16:40:50FromDiscord<Clyybber> var a = ...
16:40:50FromDiscord<Clyybber> b = a
16:40:51FromDiscord<Clyybber> #b = a
16:40:53FromDiscord<Clyybber> ```
16:40:54FromDiscord<Clyybber> sry, mispaste
16:41:05*owl_000 quit (Remote host closed the connection)
16:41:53FromGitter<timotheecour> @mratsim ⏎ ⏎ > or so "of {1..3}" works? ⏎ ⏎ Yes :) [https://gitter.im/nim-lang/Nim?at=5e10c050865af87363ba5a0c]
16:48:28FromDiscord<Clyybber> alehander92: Hmm, I fear not even analyzing it unrolled thrice will solve this
16:50:02FromGitter<alehander92> Clyybber please .. no pastes here
16:50:21FromDiscord<Clyybber> Ah, sorry, it was a misclick, I didn't mean to press enter
16:51:00FromGitter<alehander92> no problem, just pastes dont seem to look good at irc/gitter afaik
16:51:09FromDiscord<Clyybber> yeah
16:54:11*ikan-keli_ quit (Quit: ZNC 1.8.x-git-125-e415d9f5 - https://znc.in)
16:54:13FromDiscord<Clyybber> ah, nevermind, unrolling the loop is the solution
16:54:26*ikan-keli_ joined #nim
16:57:07*kobi joined #nim
16:57:16kobihowdy
16:57:33*Simerax joined #nim
16:57:55kobilol, it's raining and connection becomes so sporadic
16:58:35FromDiscord<Clyybber> I hate when it rains into my internet pipes
17:01:00kobihehe, it's israel. so primitive :-)
17:01:51kobieven if it returns every year, it feels unexpected. the mentality of arid country is too strong to forget :)
17:02:19kobiso roads become rivers etc :-)
17:02:45kobianyway, forgive me if I disconnect mid-sentence
17:03:55kobiDoes anyone know the state of py2nim? is it able to translate something big like django for example?
17:05:15kobinowadays, there are apparently a few ways of adding type annotations to python. mypy, and MonkeyType
17:06:08FromDiscord<Clyybber> kobi: alehander92 is the guy to ask
17:06:31kobiI wonder if it makes it easier to port. Nim after all lacks a large "eco system" of libraries. Python code is readable and high level. Maybe that's the answer?
17:07:20kobiThanks Clybber
17:07:23FromGitter<alehander92> wow kobi israel seems interesting i planned to go there one day
17:07:40FromGitter<alehander92> so yeah the thing is
17:07:58FromGitter<alehander92> we have a older py2nim which is in the py2nim_deprecated repo
17:09:35FromGitter<alehander92> buut
17:10:22FromGitter<alehander92> we tried to make it more general with "frontends" like py2nim and rb2nim, but its a little bit unmaintained / unfinished (we mostly worked on the rb2nim thing last time): so say if you have a concrete project in mind
17:11:21kobiwell, I imagine it can be a good coordinated effort, to port packages and dependencies.
17:11:50kobifigure out which ones bring most results in shortest time.... stuff like that
17:12:11FromGitter<alehander92> i think we found out its not really so obvious
17:12:26kobihmmm
17:12:35FromGitter<alehander92> like, its an useful idea if you want to port many similar programs(like plugins or rubocop lints)
17:12:38FromGitter<alehander92> and script it a bit
17:12:50FromGitter<alehander92> or for porting algorithms/logic
17:13:03FromGitter<alehander92> but you still need to think of a nim-ish API/dsl on top to make a quality lib
17:13:05FromGitter<alehander92> / tool
17:13:18disruptekmratsim: i would use promise semantics if you call it a promise; else, give it your own name.
17:13:44disrupteks/semantics/syntax/
17:13:51FromGitter<alehander92> you can take a look at https://metacraft-labs.github.io/fast-rubocop/ruby-kaigi-2019
17:14:02FromGitter<alehander92> from slide 23 => kobi
17:14:15FromGitter<alehander92> for some examples of our rb2nim experiments
17:14:26kobiI think quality could be less important, in this pragmatic endeavor.
17:14:30FromGitter<alehander92> which might be applicable to py2nim porting
17:14:33kobiI also think it's a very cool project that you did
17:14:51kobiI saw that nimterop used treesitter
17:15:36disruptekmaybe you could port some transforms from py2nim into nimterop.
17:15:39kobibut if i understand correctly - mostly used the querying part, instead of actual stepping thru the code
17:16:02kobiright now nimterop is c/c++ only
17:16:04FromGitter<alehander92> disruptek py2nim/rb2nim are absed on `languist`
17:16:12FromGitter<alehander92> which is supposed to be a more general framework for
17:16:17FromGitter<alehander92> X => Y porting
17:16:31FromGitter<alehander92> but it just lacks people/time
17:16:39disrupteki know languist, but iirc treesitter is further along.
17:16:48FromGitter<alehander92> languist is completely different thing
17:16:56FromGitter<alehander92> treesitter is just for parsing
17:16:58kobibut tree-sitter has language parsers for go-lang, lua, java, c# ..
17:17:06disruptekyes, that's what i meant.
17:17:10FromGitter<alehander92> but the point of languist is that
17:18:17FromGitter<alehander92> different no
17:18:23shashlickYes it might be possible to translate from other langs to Nim with tree-sitter
17:18:33FromGitter<alehander92> it defines a language-independent stdlib/API
17:18:40kobiI wonder if tree-sitter uses the same "AST" in all these languages, it may be possible to kind of "normalize" them to Nim constructs, and generate from that. maybe. i haven't explored yet.
17:18:45shashlickBut I have limited my efforts to wrapping
17:18:52FromGitter<alehander92> and makes it easier to define "rules" and "idioms" mapping from X language to Intermediate and Intemediate to Y
17:19:08FromGitter<alehander92> so if you define such X supports for e.g. Nim, Python, Ruby and Rust
17:19:25FromGitter<alehander92> it gives you Nim -> Ruby Rust -> Python Rust -> Ruby etc port-ers
17:19:45shashlickUnclear if it has the same tree structure across languages
17:19:52FromGitter<alehander92> and additionally some middleware to make it easier to define additional pass-es specific to your project
17:20:00FromGitter<alehander92> shashlick its not about the tree or parsing
17:20:05FromGitter<alehander92> its more high level
17:20:14kobithat's really smart, alehander92
17:20:20FromGitter<alehander92> the "frontend" task is to return a intermediate AST
17:20:44FromGitter<alehander92> so yes, in the frontend you use whatever you can: treesitter/nim compiler's parser/the lang specific parser etc
17:20:52FromGitter<alehander92> iirc
17:21:12shashlickI'm not a fan of full translation
17:21:36FromGitter<alehander92> but its mostly about some local type rules/idiom translation / scripting how you want your project to be translated
17:21:36shashlickAssumes languages always have equivalent structures to map across
17:21:47FromGitter<alehander92> but i agree its a very opinionated thing
17:21:57FromGitter<alehander92> shashlick it doesnt really assume this
17:22:17FromGitter<alehander92> please, try to not assume
17:23:16shashlickI am telling you just based on C to Nim, nothing else
17:23:18FromGitter<timotheecour> > *<shashlick>* I'm not a fan of full translation ⏎ ⏎ @shashlick note: for handling C++ templates, full translation is needed anyways I’m afraid
17:23:27FromGitter<alehander92> by design it should be possible to translate between relatively different styles e.g. functional => oop, error code return => exceptions etc
17:23:37FromGitter<alehander92> so the idea is not to just blindly map stuff to stuff
17:23:48FromGitter<alehander92> but as i said in the beginning i agree with your conclusion
17:24:25FromGitter<alehander92> its good for porting similar files that your scripted it a bit for (like lints/plugins/etc) or to automatize ~X% of the work on porting something
17:24:53FromGitter<alehander92> but it still is just a tool that eventually might help with the always needed manual work
17:24:54shashlickjust mapping simple structures from C to Nim is a pain, and C has a variety of ways to define a simple thing
17:25:11FromGitter<alehander92> but i think its a bit different, as nimterop is supposed to be automatic
17:25:37FromGitter<alehander92> while here at least i dont see realistically languist working without manual refinements
17:25:52FromGitter<alehander92> yes, we tried to do that to some extent, but i admit its much harded indeed
17:26:26FromGitter<alehander92> and if the goal of nimterop was to kinda get you 50-80% of the way with requiring manual finishing
17:26:32shashlickeven if it was easy to implement
17:26:35FromGitter<alehander92> i guess nimterop would be very very simple
17:27:02shashlickI don't see the value in reimplementing libs and then sitting and maintaining it when the upstream is already managed by a dedicated person or team
17:27:13FromGitter<alehander92> i agree , but i more see it for
17:27:17FromGitter<alehander92> bootstrapping a new lib
17:27:26FromGitter<alehander92> or porting a project once
17:27:44shashlickI'm sure there are valid reasons and use cases
17:27:48FromGitter<timotheecour> ya, definitely use cases for it
17:27:58FromGitter<timotheecour> (and C++ templates is a big big reason)
17:27:59FromGitter<alehander92> the rubocop example was focused on the maintanence thing indeed and there were some ideas about patching and stuff but it just didnt go far
17:28:02FromGitter<alehander92> so i am a skeptic
17:28:20FromGitter<alehander92> but i think c++ templates are more nimterop-like level
17:28:28shashlickI've said the same point to many people, and I've spent the last two years dedicated to just wrapping C libs
17:28:34shashlickand it's been a long long road
17:29:06shashlickI've not even touched C++, let alone other langs
17:29:29shashlickof course, you can say I'm doing this on the side so someone who is dedicated or more experienced in the domain can pull it off faster
17:29:34FromGitter<timotheecour> (parts of) opencv would be a usability milestone
17:30:07*ng0 joined #nim
17:30:07*ng0 quit (Changing host)
17:30:07*ng0 joined #nim
17:32:12FromGitter<alehander92> kobi but sorry again for going offtopic, if you need it for particular projects maybe one can fix a more stable version of py2nim just to semitranslate the syntax/types for easier manual work
17:34:47*couven92 joined #nim
17:35:23FromGitter<alehander92> i admit its just a bit vaporware currently :( :D
17:36:12disruptektoday is a good day to build something awesome.
17:36:26FromDiscord<Clyybber> I agree, but the days about to end
17:36:30FromDiscord<Clyybber> at least here
17:37:57*ng0 quit (Ping timeout: 265 seconds)
17:39:37FromDiscord<Clyybber> gotta hurry
17:40:15ZevvRemember, farts and grinds people, sharts and blinds!
17:54:40FromGitter<alehander92> okk
17:54:40disruptekyou be you, zevv.
17:54:44FromGitter<alehander92> no
17:54:50FromGitter<alehander92> disruptek where are you
17:54:57FromGitter<alehander92> in a truck somewhere in illinois?
17:55:00Zevvdisruptek: sure, that's what I'm best at :)
17:55:20FromGitter<alehander92> i always imagine you .. maybe a bit like those hurricane catchers
17:55:20ZevvAnd you be you, you'll never know how much I appreciate you!
17:55:37FromGitter<alehander92> sitting on a computer somewhere in the back of a truck in the middle of rural .. um something
17:55:43disrupteki'm in philly until we can get this house sold.
17:55:55Zevvand where you're heading then?
17:55:56FromGitter<alehander92> i am in philly too
17:56:02disruptekare you?
17:56:09FromGitter<alehander92> phillipopolis
17:56:17FromGitter<alehander92> :( bad pun, its called plovdiv now
17:56:54FromDiscord<exelotl> bleh I have an annoying structural issue with my game
17:57:00disruptekthat looks like a typo.
17:57:34FromDiscord<exelotl> basically every room/area has a file that looks like this: https://gist.github.com/exelotl/3e3ce45b02e82f77de3dd512b510eafd
17:57:49FromGitter<alehander92> you need an interior designer man
17:57:55FromGitter<alehander92> my rooms dont look like this
17:58:16FromGitter<alehander92> oh sorry your sentence said `file`, i really have to take a rest from puns
17:58:25FromDiscord<exelotl> lmao
17:58:39Zevvdisruptek: where will you be moving to?
17:59:35disruptekmy sister's last name is O'Neill. she got a tattoo `&39;` on her shoulder 'cause she is always getting mail addressed to Hilary O&39;Neill.
17:59:51*beshr joined #nim
18:00:06FromDiscord<exelotl> it just gets really unweildy as I add more systems to the game, cause I need to manually call open/close/update/draw for each one... if I add a new system I have to make the change in every single scene that uses it
18:00:08Zevvpics or it didn't happen!
18:00:10disrupteki am planning on taking a southern route to vegas.
18:00:20disruptekwanna buy shashlick a drink in austin.
18:01:50disruptekthinking of opening a new shop in vegas so i can be closer to rayman.
18:01:51Zevvha
18:02:28*kobi quit (Quit: Leaving)
18:03:49FromGitter<alehander92> raymanshop
18:04:01FromGitter<alehander92> for ramen and xray scanners
18:06:38FromDiscord<Clyybber> alehander92 shop; for bad puns :p
18:07:12disrupteki think this'll be more like a hackspace where you can share tools, equipment, and dubious "expertise".
18:07:30FromDiscord<Clyybber> dubios..
18:07:32shashlickLong way from Vegas man
18:07:57disrupteki've been back and forth across the country many time.
18:08:01disruptektimes, too.
18:08:48FromGitter<alehander92> Clyybber i am trying to stop but i just shop
18:09:35FromDiscord<Clyybber> snap
18:15:53FromDiscord<mratsim> @disruptek, what is a Promise syntax?
18:16:17disruptekyou know, the whole then/done thing.
18:16:53FromDiscord<mratsim> that can come after
18:17:15FromDiscord<mratsim> same with futures "andThen"
18:18:43FromDiscord<mratsim> I can call it "pledge" πŸ˜›
18:18:45disrupteki guess i'm just responding to not having expected terms, in the same way that we all know what `await` means.
18:18:57disruptekyeah, i use pledge, vow in my code.
18:19:41FromDiscord<mratsim> It's use the same as in habanero java i think
18:20:01FromDiscord<inv> are there any possibility to work with table in functional way? trying sequtils+sugar, but cannot make it work on tables
18:20:09disrupteknaming is hard.
18:20:26FromDiscord<mratsim> at its core a Promise is a placeholder and you can attach deferred function to it
18:20:39disruptekyep.
18:20:48FromDiscord<mratsim> contrary to futures which are deferred results
18:21:16*couven92 quit (Ping timeout: 268 seconds)
18:21:17FromDiscord<mratsim> but I'll leave name bikeshedding for another time, it's a luxury problem
18:21:39FromDiscord<mratsim> @inv what's a functional way to use tables?
18:22:05FromDiscord<inv> table.map((k,v) => v).sum()
18:22:40FromDiscord<inv> table.map(x => x[1]).foldl(a+b)
18:22:47FromDiscord<mratsim> myTable.foldIt(0, a + b)
18:23:03FromDiscord<mratsim> something like this
18:23:40FromDiscord<inv> cannot find foldit for table
18:24:08FromDiscord<mratsim> it's a template, it works for any collection for which the "items" iterator is defined
18:24:23FromDiscord<mratsim> though templates use values so maybe it wouldn't work
18:24:49*odc left #nim (#nim)
18:24:53FromDiscord<Clyybber> I guess you could define items yourself
18:25:03FromDiscord<Clyybber> and use values for it
18:25:18FromDiscord<Clyybber> or keys
18:25:22FromDiscord<Clyybber> depending on what you need
18:26:06FromDiscord<inv> do you have any example?
18:27:37FromDiscord<Clyybber> ```
18:27:37FromDiscord<Clyybber> iterator items*[A, B](t: Table[A, B]): A =
18:27:37FromDiscord<Clyybber> for k in t.keys: yield k
18:27:37FromDiscord<Clyybber> ```
18:28:09*FromGitter quit (Read error: Connection reset by peer)
18:28:28*FromGitter joined #nim
18:28:34FromDiscord<inv> is n't implemented for tables already?
18:28:47FromDiscord<Clyybber> no, only keys and values
18:29:20FromDiscord<Clyybber> it kinda surprised me too tbh, but I guess it makes sense, since it isn't clear wether items should iterate over the keys or the values
18:29:22disruptekpairs is impl, silly.
18:30:33FromDiscord<inv> I think the same - pairs
18:40:46disruptekZevv: https://imgur.com/gallery/9w6Qia3
18:41:12Zevvdude!
18:41:17Zevvthat's pretty cool :)
18:44:21disruptekyeah, she's an angular chick.
18:44:52*couven92 joined #nim
18:45:32*Vladar joined #nim
18:53:12rayman22201lol disruptek. I will definitely take you out for a beer if you come down :-)
18:55:04Zevvand his sister!
18:55:31rayman22201Well of course! I'm a gentleman :-P
18:59:44FromGitter<timotheecour> @araq how about: `nilsafe` ?
19:00:25FromGitter<timotheecour> notnil already has other meanings...
19:01:04FromGitter<timotheecour> or `nilwrap`
19:09:38*couven92 quit (Ping timeout: 240 seconds)
19:11:07*couven92 joined #nim
19:15:46*Minimisthupper joined #nim
19:16:05*nsf quit (Quit: WeeChat 2.7)
19:20:43MinimisthupperHey, I've got this error: type mismatch: got (Row) but expected 'string' and wrote a little toString proc. But how can I find the data type of the "(Row)" (there is a string in it).
19:20:45*marmotini_ quit (Remote host closed the connection)
19:21:17*marmotini_ joined #nim
19:26:48*sp4c38 joined #nim
19:27:02*abm joined #nim
19:27:23*endragor quit (Remote host closed the connection)
19:28:03*marmotini_ quit (Ping timeout: 268 seconds)
19:29:40*sp4c3851 joined #nim
19:30:38*sp4c3851 quit (Remote host closed the connection)
19:34:44FromGitter<alehander92> .ensure ?
19:34:47FromGitter<alehander92> @timotheecour ?
19:34:57FromGitter<alehander92> maybe too common
19:37:57rayman22201Hey @timotheecour, that mongodb guy never responded to my PR request and it's now been months... I think the project is dead. Any thoughts on forking it?
19:43:08*ng0 joined #nim
19:43:20*ng0 quit (Client Quit)
19:45:33*couven92 quit (Ping timeout: 265 seconds)
19:46:18*couven92 joined #nim
19:46:34*Minimisthupper quit (Remote host closed the connection)
19:48:09*sp4c38 quit (Quit: sp4c38)
19:51:47FromDiscord<Clyybber> Araq: Since I now go through the entire CFG I'm encountering infinite recursion with this: https://hastebin.com/geyaciruka.pl
19:53:02FromDiscord<Clyybber> Oh, wait. Thats my bug
20:03:59*fredrik92 joined #nim
20:04:19*couven92 quit (Read error: Connection reset by peer)
20:04:46*Vladar quit (Quit: Leaving)
20:06:59*Simerax quit (Quit: https://quassel-irc.org - Komfortabler Chat. Überall.)
20:08:03*Vladar joined #nim
20:11:04*endragor joined #nim
20:16:02*endragor quit (Ping timeout: 240 seconds)
20:28:11*abm quit (Quit: Leaving)
20:31:12FromDiscord<sealmove> Guys, can you explain this C++ syntax? `std::ifstream ifs ("text.txt", std::ifstream::in);`
20:33:14FromGitter<alehander92> didnt this replace define
20:33:20FromGitter<alehander92> ifs as an input stream
20:33:24FromGitter<alehander92> or replace stdin
20:33:27FromGitter<alehander92> not sure
20:35:18FromDiscord<sealmove> No I meant the initialization syntax
20:35:23FromDiscord<sealmove> Without new
20:35:39FromDiscord<sealmove> Is it stack allocation like nim?
20:38:02FromDiscord<sealmove> `Type varname (arg1)`
20:39:18FromDiscord<sealmove> Instead of say `Type varname` = `Type(arg1)`
20:39:30FromDiscord<sealmove> Pretty weird...
20:40:35FromDiscord<sealmove> I don't understand why C++ must have such an incoherent syntax.
20:40:45*ng0 joined #nim
20:41:24FromDiscord<sealmove> Or rather semantics
21:01:07*robin1 joined #nim
21:01:29*robin1 quit (Client Quit)
21:17:51*fredrik92 is now known as couven92
21:29:57*narimiran quit (Ping timeout: 265 seconds)
21:31:00*couven92 quit (Ping timeout: 258 seconds)
21:36:56disruptekI MADE IT
21:36:59*rockcavera quit (Remote host closed the connection)
21:45:51*nsf joined #nim
21:47:39*sschwarzer joined #nim
21:49:09ZevvGOOD FOR YOU!
21:50:21sschwarzerHi everyone, happy new year!
21:50:25sschwarzer:-)
21:54:12Zevv"Making sure procs work; spoiler: they do"
21:54:23Zevvwho puts puns in their commit messages?!
21:54:50*Trustable quit (Remote host closed the connection)
21:55:50sschwarzerZevv: *lol* Ouch
22:01:38disruptek"add HubCode and hope i die in my sleep"
22:03:35sschwarzerdisruptek :-D
22:03:53disrupteksup sshwarzer
22:03:58disruptek^c
22:04:25disruptekit's not enough to move bad code into new files.
22:04:30disruptekwe must move it into new libraries.
22:04:31sschwarzerdisruptek: I sent you a PM :)
22:04:41disruptekwas there money inside?
22:05:00sschwarzerdisruptek: no :) on IRC
22:05:24disruptekwhy no money?
22:05:38disruptekWHY NO
22:06:44disruptekhow about `ifen` instead of `maybe`?
22:07:48*ptdel joined #nim
22:08:47disruptek!repo todotxt
22:08:50disbothttps://github.com/benrhughes/todotxt.net -- 9todotxt.net: 11An implementation of todo.txt for Windows using the .NET framework 15 401⭐ 99🍴 7& 29 more...
22:09:08disruptekwhat does it all mean?
22:11:27*gangstacat quit (Quit: Ĝis!)
22:15:18*gangstacat joined #nim
22:24:24skrylar[m]should redefining something defined with `let` really be an error :thonk:
22:25:30disruptekyes, but we should be able to define a let in one scope and set it (once) in another.
22:33:50disruptekso devel doesn't require a mutable table for clear() but 1.0 does?
22:35:31*endragor joined #nim
22:35:40skrylar[m]Β―\_(ツ)_/Β― @freenode_disruptek:matrix.org: typically functional languages (of which let is borrowed from) don't throw a fuss if you re-bind a name, since they just consider the old binding obsolete
22:36:09skrylar[m]inb4 someone says someting stupid like 'were not haskell'
22:36:36disruptekyou can rebind using a new let in a new scope.
22:36:45disruptekotherwise, use var.
22:37:43disruptekmy question is, why can i not define a let's type at the top of a scope and then assign it a value later in the same (or lower) scope?
22:38:09skrylar[m]i guess i need to start appending a standard disclaimer to messages now because i was explicitly not asking for workarounds (i know how to use `var`, thanks, i did not write five something public modules now by being a retard) i was pointing out it doesn't make sense that you can't replace a constant binding with another constant binding
22:38:24*skrylar[m] goes back to writing cbor encoders
22:38:30disrupteki don't think `constant` means what you think it means.
22:39:44FromDiscord<Clyybber> offtopic, but is someone here familiar with java streams?
22:40:00*endragor quit (Ping timeout: 258 seconds)
22:45:17*Lord_Nightmare joined #nim
22:47:57*Vladar quit (Quit: Leaving)
23:01:29sschwarzer!repo npeg
23:01:30disbothttps://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 75⭐ 4🍴
23:14:35*nsf quit (Quit: WeeChat 2.7)
23:16:55sschwarzer!help
23:20:24*lritter quit (Quit: Leaving)
23:22:05*solitudesf quit (Ping timeout: 265 seconds)
23:25:11FromDiscord<sealmove> Clyybber yes, java streams
23:25:45*sealmove joined #nim
23:29:23*sschwarzer quit (Quit: leaving)
23:36:50*couven92 joined #nim
23:38:30FromGitter<matrixbot> `arkaroo` Hrm, I feel like I'm missing something here. I'm trying to use Jester, Redis and nim-metrics together. Nim-metrics requires me to run with --threads:on, which means that jester starts to encorce the {.gcsafe.} pragma. That means that I can't use the redis client from within the jester routes functions, because I get errors like the following: `Error: 'matchIter' is not GC-safe as it calls 'smembers'`
23:38:31FromDiscord<Clyybber> ah, great. I basically solved the issue I having myself, but boy did I have to dig through documentation
23:38:45FromDiscord<Clyybber> all in all, I think streams are the best part about java though
23:39:08FromGitter<matrixbot> `arkaroo` does that mean that the redis client is not thread-safe and I'm just screwed/need to find a different redis library, or is there something I can do to make redis gc-safe?
23:39:43FromGitter<matrixbot> `arkaroo` * Hrm, I feel like I'm missing something here. I'm trying to use Jester, Redis and nim-metrics together. Nim-metrics requires me to run with --threads:on, which means that jester starts to enforce the {.gcsafe.} pragma. That means that I can't use the redis client from within the jester routes functions, because I get errors like the following: `Error: 'matchIter' is not GC-safe as it calls 'smembers'`
23:39:48disruptektry --gc:boehm for starters.
23:40:11FromDiscord<Clyybber> @sealmove Ah, nevermind, still got a question; can I get the count() of a stream without consuming it?
23:40:27disruptekclyybber: who are you?
23:40:46FromDiscord<Clyybber> disruptek: ?
23:40:51sealmoveClyybber: java typically uses methods like hasInt etc
23:40:54FromDiscord<Clyybber> I hate java but I have to bear with it
23:40:56sealmovenextInt *
23:41:07FromDiscord<Clyybber> I mean the size
23:41:11FromDiscord<Clyybber> the size of a stream
23:41:11disruptekpeeking?
23:41:17sealmovehasNextInt
23:41:19sealmoveyes
23:41:32disruptekhe wants to know how many more bytes he could read, in total.
23:41:37disrupteknutjob.
23:41:53disruptekhe wants file semantics on his stream.
23:41:59FromDiscord<Clyybber> basically yeah
23:42:04FromDiscord<Clyybber> dumb thing I know
23:42:14FromDiscord<Clyybber> well, I'll guess I'll just read the file twice
23:42:29FromDiscord<Clyybber> one time to print out the amount of entries
23:42:41FromDiscord<Clyybber> and another time to print out the entries lol
23:42:52sealmovethat's lame :|
23:43:05sealmovebut of course you can cache results and print at the end
23:43:05FromDiscord<Clyybber> not sure how to do it otherwise
23:43:12disruptekthe file/entries are too big for memory but you're willing to i/o it twice?
23:43:16FromDiscord<Clyybber> I have to print the size before
23:43:24FromDiscord<Clyybber> disruptek: Nah, its tiny
23:43:27sealmoveyeah so don't print while iterating file
23:43:51FromDiscord<Clyybber> ah, university assignment, not my idea
23:44:13disruptekoutput it backwards and ask your use to flip their display.
23:44:19FromDiscord<Clyybber> lol
23:44:30FromDiscord<Clyybber> or quit university
23:44:33FromDiscord<Clyybber> problem solved
23:44:58disruptekglad i never went to school.
23:45:12FromGitter<matrixbot> `arkaroo` @disruptek no change, but does changing the gc mode change what the gcsafe pragma errors on?
23:45:22sealmovewell Clyybber
23:45:36sealmovedid you try the typical C way?
23:45:45disrupteki don't think so, but it may let you hack the lib to let it be looser with gc demands.
23:45:50FromDiscord<Clyybber> nope, I have to use streams
23:45:50disruptek(and yet not crash)
23:45:52sealmovegoing to end of stream, get position, then go back?
23:45:56FromDiscord<Clyybber> oof
23:45:56disruptekboehm is more thread-friendly.
23:46:07FromDiscord<Clyybber> i'm too lazy, im just gonna read it twice heh
23:46:22disrupteki thought you already graduated.
23:46:54FromGitter<matrixbot> `arkaroo` it continues to give the same error even with gc:none
23:47:18disruptekyes, you will have to modify the lib.
23:47:58sealmovehttps://www.geeksforgeeks.org/stream-count-method-java/
23:48:00sealmovethis>
23:48:02sealmove?*
23:48:02FromDiscord<Clyybber> disruptek: from college (or whatever the equivalent of germanys "gymnasium" is)
23:49:10FromGitter<matrixbot> `arkaroo` @Clyybber: is there any chance the file will mutate under you while you do that? I'd suggest reading it into a buffer and then working on the buffer to make sure it doesn't
23:49:46FromDiscord<Clyybber> nah, it wont. its a dumb assignment, I don't want to waste time on that shit
23:50:05FromDiscord<Clyybber> but thanks for all the help
23:50:53sealmoveyeah there is no clean way without consuming, but if you consume twice then at least use count() since it's the simplest/most obvious way
23:51:26FromDiscord<Clyybber> yeah, doing that now
23:52:29FromGitter<matrixbot> `arkaroo` @disruptek: sadface, I might shop around for different redis libraries then I guess, cheers for the info
23:56:41*Lord_Nightmare quit (Quit: ZNC - http://znc.in)