<< 22-07-2020 >>

00:00:39Yardanicohttps://docs.microsoft.com/en-us/windows/win32/fileio/file-management-functions ?
00:00:39leorizea fair bit of them do
00:08:43Yardanicoyass, the joy when you find a C compiler error when compiling a terminal tetris in nim with arc
00:15:26Yardanicowait what
00:15:53YardanicoLOL
00:15:57Yardanicothe * makes a difference
00:16:03Yardanicoconst normalMinos = @[1, 2]; var minos = normalMinos works just fine
00:16:12Yardanicoconst normalMinos* = @[1, 2]; var minos = normalMinos results in a C compiler error for ARC
00:16:18Yardanicomagic
00:17:31Yardanicoah it's because nim eliminates both normalMinos and minos if normalMinos is not exported
00:17:36Yardanicoin the frontend
00:17:58Yardanicowell it doesn't, sorry, I'm just a bit fast to come to conclusions
00:20:12Yardanicohttps://github.com/nim-lang/Nim/issues/15036
00:20:14disbot[ARC] C compiler error when creating a var of a const seq ; snippet at 12https://play.nim-lang.org/#ix=20D9
00:25:47*oddp quit (Ping timeout: 240 seconds)
00:39:04*maier joined #nim
00:43:47*maier quit (Ping timeout: 240 seconds)
00:55:23*fredrikhr quit (Ping timeout: 240 seconds)
00:59:30ForumUpdaterBotNew thread by Oyster: Wierd "SIGSEGV: Illegal storage access" information, see https://forum.nim-lang.org/t/6568
01:07:03*karmayogi joined #nim
01:07:17*karmayogi quit (Remote host closed the connection)
01:11:51*endragor joined #nim
01:24:13*apahl quit (Ping timeout: 272 seconds)
01:25:43*apahl joined #nim
01:27:09*OmegaDoug joined #nim
01:27:19mbuchel!repo judy
01:27:21disbothttps://github.com/Walkud/JudyKotlinMvp -- 9JudyKotlinMvp: 11Kotlin + Mvp + RxJava + Retrofit 心得体会 15 63⭐ 9🍴 7& 29 more...
01:27:32Yardanicolol
01:27:40mbucheli am looking for judy arrays in nim
01:27:44mbucheldoes one exist
01:28:03Yardanicohttps://github.com/search?q=language%3Anim+judy+array&type=Code
01:28:11Yardanicoseems only like a test in the test suite
01:28:24Yardanicohttps://github.com/nim-lang/Nim/blob/devel/tests/concepts/tmapconcept.nim and not sure if it's complete
01:29:09Yardanicoah it seems it's not really a judy array, just some testing for same stuff
01:31:02mbuchelshameful
01:31:06Yardanicolol
01:31:29mbucheli was shitposting about judy arrays and was wondering if one existed in nim-lang
01:32:23Yardanico"Judy arrays are extremely complicated. The smallest implementations are thousands of lines of code." lol
01:32:39mbuchelyes they are absolutely necessary for an embedded project
01:33:07*hyiltiz joined #nim
01:33:54Yardanicoseems like it's also patented but should be expiring relatively soon
01:34:09FromDiscord<Elegant Beef> > In addition, Judy arrays are optimized for machines with 64 byte cache lines
01:34:21FromDiscord<Elegant Beef> Does embedded have 64 byte cache lines?
01:34:32Yardanicohttps://patents.google.com/patent/US6735595B2/en for the patent btw
01:35:05Yardanicooh "2022-01-24 Adjusted expiration"
01:35:07Yardaniconot so soon :D
01:35:14Yardanico1.5 more years
01:36:19YardanicoFINALLY once in my life i managed to reproduce a crash without minimizing the original source, but instead using the same rough "idea" how the code behaved to reproduce it
01:36:45FromDiscord<Elegant Beef> Nice
01:38:23Yardanicojust tried to run @impbox 's nimsynth with arc :D
01:38:29Yardanicoon devel
01:38:50FromDiscord<impbox> did it work?
01:38:54FromDiscord<impbox> i'd be surprised
01:38:56Yardanicowith refc - yes, kinda
01:39:01YardanicoI had to fix some deprecations and stuff
01:39:08Yardanicoalthough for me right click drag doesn't work :D
01:39:17Yardanicobut thanks to nimsynth I think I found another bug in arc :)
01:39:21Yardanicorelated to closures
01:40:15Yardanicothis one https://play.nim-lang.org/#ix=20Nk
01:41:40Yardanicoit seems to destroy mCreator when it goes out of scope
01:41:44Yardanicowhich is of course not valid
01:41:51Yardanicosince it was captured by the add
01:43:07FromDiscord<impbox> aye
01:46:00Yardanicomaybe not the right title, but https://github.com/nim-lang/Nim/issues/15038
01:46:01disbot[ARC] Closure captured in a seq gets destroyed in the end of the scope ; snippet at 12https://play.nim-lang.org/#ix=20Nl
01:46:12Yardanicoah btw @impbox
01:46:20YardanicoI replaced marshal with json and nimsynth still compiled :D
01:46:25Yardanicojson.to and json.%
01:46:28FromDiscord<impbox> nice
01:47:37Yardanico@impbox whole diff for compiling it on devel with refc - https://gist.github.com/Yardanico/d95d07151a2f3dbfd6c92f6907707318
01:47:47Yardanicoalso you'll probably need -d:nimWorkaround14447
01:48:12FromDiscord<impbox> thanks
01:48:25Yardanicoyeah just tested, it at least compiles with this
01:48:54Yardanicohow do I connect nodes though? :D
01:49:36FromDiscord<impbox> for me right click drag works
01:50:30FromDiscord<impbox> that said it's not building for me atm
01:50:32Yardanicoah seems like my mouse coords aren't translated the right way for some reason
01:50:36Yardanicowhat error?
01:51:09YardanicoI used "nim c -p:src -d:nimWorkaround14447 -o:synth src/main.nim"
01:51:35Yardanicooh seems like some tests fail
01:51:38Yardanicoon startup
01:52:07FromDiscord<impbox> ahh the button thing you fixed
01:52:20FromDiscord<impbox> i'll apply your patch
01:52:20Yardanicoyeah, also random -> rand
01:52:23Yardanicoyeah sure
01:52:41Yardaniconot sure if the marshal -> json replacement actually worked though :D
01:52:45Yardanicobut if it compiled, it probably should
01:53:19FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=20Nn
01:53:35Yardanicoon line 4? can you show full stacktrace?
01:53:49Yardanicoand what happens if you add "import segfaults" after importing winim and run it?
01:54:10FromDiscord<impbox> \o/ compiling after your patch. and works right click dragging to join nodes
01:54:46Yardanicoyeah it seems a problem with tiling WM or sway or xwayland :P
01:55:05FromDiscord<impbox> right click works to open menu yeah?
01:55:08Yardanicoyes
01:55:16Yardanicolemme try with Xephyr
01:55:29FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=20OQ
01:56:01Yardanicobut PCRAWINPUTDEVICE is a pointer
01:56:04Yardanicoyou need to allocate it first
01:56:12Yardanicoand instead you're assinging to a nil pointer :)
01:56:21Yardanicowell, on dot access nim automatically dereferences the pointer
01:56:43FromDiscord<reilly> I was about to say that, actually. I have absolutely zero idea how pointers are used.
01:56:45YardanicoI don't really know winapi, but you need to somehow allocate that, either with winapi or with nim's own allocation procedures
01:57:06Yardanicoare you sure you don't need to call stuff like GetRawInputDeviceInfoA ?
01:57:14Yardanicobut anyway, you can try this:
01:57:56Yardanicoreplace RID line with "var RID = alloc(sizeof(RAWINPUTDEVICE))"
01:58:14FromDiscord<reilly> This: https://gist.github.com/luluco250/ac79d72a734295f167851ffdb36d77ee is about the only decent reference I have for how to do raw input, and it doesn't use `GetRawInputDeviceInfoA()` anywhere.
01:58:41Yardanicowell, but it's allocating
01:58:57Yardanicoah sorry about the code I sent
01:59:01Yardanicoit should actually be
01:59:17Yardanicovar RID = cast[PCRAWINPUTDEVICE](alloc(sizeof(RAWINPUTDEVICE))
01:59:39Yardanicoyou're casting a pointer you just allocated to the PCRAWINPUTDEVICE type, I'm not sure if this is 100% neccessary, but just in case
02:00:00Yardanicobut wait actually I think you need a different approach
02:00:01Yardanicoah right
02:00:08Yardanicoyou did it differently from C++ :P
02:02:33*NimBot joined #nim
02:02:37Yardanicohttps://github.com/nim-lang/RFCs/issues/230
02:02:38disbotNim's NRVO is C++'s inplace construction (placement new) ; snippet at 12https://play.nim-lang.org/#ix=2oor
02:02:44Yardanico@reilly try https://play.nim-lang.org/#ix=20Pt
02:03:32Yardanicoah actually it should be an array
02:04:18Yardanicoif that doesn't work also try https://play.nim-lang.org/#ix=211C
02:04:38FromDiscord<reilly> Now it's just throwing `Error: unhandled exception: Unable to register raw input. [OSError]`, which I can't decide whether to take as an improvement or not.
02:04:44FromDiscord<reilly> w/ https://play.nim-lang.org/#ix=20Pt
02:04:50FromDiscord<tomck> Yardanico: so... is it signalling that it couldn't apply a RVO here?
02:05:16Yardanicowell kinda, I'm not 100% sure, and it'll probably changed :)
02:05:16FromDiscord<tomck> Don't understand the issue
02:05:21Yardanicoit shouldn't be a warning without the proper explanation, yeah
02:05:25Yardanicoyou can comment in that issue
02:06:18Yardanico@tomck basically the thing is
02:06:31Yardanicothat before the patch Nim would still populate the fields in the result variable even if there was an exception
02:06:46FromDiscord<reilly> Same exception for https://play.nim-lang.org/#ix=211C, and to be honest, I was hoping it'd never get thrown because I have absolutely zero idea where to even begin fixing that one.
02:06:59Yardanicobut after that patch it's conforming to the spec and the result variable doesn't get populated in the case of a exception
02:07:13FromDiscord<tomck> right i see, ta
02:08:14Yardanico@reilly i'll try a bit
02:08:30Yardanicobut maybe you should set the window too?
02:09:12Yardanicoalso I found quite a lot of examples of RegisterRawInputDevices in c++, hm
02:09:49FromDiscord<tomck> I have a tree structure, and want to create a way to walk the tree, what's the best way to structure this in nim? (in C++ i'd use either an iterator, or a function which accepted a lambda)
02:10:01Yardanicoyou can make an iterator for nim
02:10:16Yardaniconim iterators are quite fast since they're inlined (not the closure iterators though)
02:10:30FromDiscord<tomck> would that be the idiomatic solution here? (rather than some template magic? i've seen mapIt in sequtils uses a template)
02:10:45OmegaDougIs nimble able to pass command line arguments to the nim compiler? I'm interested in trying out the new arc gc.
02:10:49Yardanicojust a normal iterator, yeah
02:11:09FromDiscord<tomck> There are non-normal iterators?
02:11:13Yardanicoclosure iterators :P
02:11:25FromDiscord<tomck> oh i fund the manual page, ta
02:11:28FromDiscord<tomck> (edit) 'fund' => 'found'
02:13:50FromDiscord<reilly> Yardanico: No idea what I would set for the window handle, but since 'If NULL it follows the keyboard focus,' I would assume that it would be fine, at least for now.
02:13:51mbuchel<Elegant Beef>: yes embedded devices can have 64 byte cache lines in the higher end appliances (Nvidia Jetsons)
02:14:12YardanicoI wouldn't exactly call that "embedded" lol
02:14:35Yardanicofor me embedded is more like esp32, etc
02:14:37Yardanico@reilly lemme try getting the exact error
02:15:05Yardanicoyou could also use it in the future to get the exact error code :)
02:15:07*muffindrake quit (Ping timeout: 260 seconds)
02:15:23YardanicoI got the error code 87
02:15:25FromDiscord<tomck> so the manual doesn't really explain it, what's the difference between a closure / inline iterator? Does a closure iterator have some internal state?
02:15:25YardanicoERROR_INVALID_PARAMETER
02:15:39FromDiscord<Elegant Beef> That isnt embedded that's a singleboard computer
02:15:39Yardanico@tomck closure iterator is like a closure proc, but an iterator :P
02:15:51Yardanicoinline iterator is a bit like a template, but not really
02:16:00Yardanicobasically inline iterator gets inlined instead of the loop
02:16:07Yardanicoso it's really fast and zero-cost really
02:16:32FromDiscord<tomck> Why would you ever use a closure iterator if it's slower
02:16:41Yardanicobecause sometimes you need to capture state
02:16:48Yardaniconim's async is entirely based on closure iterators btw :)
02:17:03Yardanicoand macros transforming normal nim procedures (with async pragma) into closure iterators
02:17:25*muffindrake joined #nim
02:19:05FromDiscord<tomck> So i have a tree, defined by a `Node` object that contains `ref`s to child `Node`s - If I define an iterator which took my root `ref Node`, that could be an inline iterator just fine? I'm struggling to understand what 'capture state' entails
02:19:16Yardanicoyeah sure of course
02:19:24Yardanicojust a normal iterator will work fine
02:19:33FromDiscord<tomck> Ohhh, or is it that a closure iterator can be passed around and flexibly iterated, and an inline iterator *must* be used completely in a loop
02:19:41Yardanicoyes
02:19:42Yardanico:P
02:19:49Yardanicoinline iterators are not first-class really
02:19:58Yardanicothey always expand in loops
02:20:07Yardanicoe.g. lemme show you an example
02:20:11Yardanicosimple iteration over a seq right?
02:20:24Yardanicolet a = @[1, 2, 3, 4, 5]; for x in a: echo x
02:20:26Yardanicosimple stuff really
02:20:29Yardanicoit gets transformed to:
02:21:09Yardanico(that's without release/danger and with arc) - https://gist.github.com/Yardanico/954dbd6bc1f14f0890c42db6c4e0a457
02:21:31Yardanicowith danger, so it's easier to follow - https://gist.github.com/Yardanico/ad9c3c92d35f11cab9c106d1c3c35e01
02:21:49FromDiscord<Doof Doof> does anyone know why this was removed and how to get the same functionality? https://github.com/nim-lang/Nim/issues/905↵--header option doesn't seem to output header files anymore and it's still in the documentation here: https://nim-lang.org/docs/backends.html#backend-code-calling-nim-nim-invocation-example-from-c
02:21:51disbotAdd emit header pragma
02:21:58Yardanicoso it actually gets transformed to a while loop
02:22:18Yardanicowhich gets elements by index and "assigns" them to the variable you have in for loop which is "x" in this case
02:22:51FromDiscord<tomck> I see
02:23:27Yardanico@Doof it still works for me though
02:23:38FromDiscord<tomck> In this case, it's a weird decision to have an iterator defined as inline/closure at the definition - rather than just defining an iterator, then instantiating it as either a closure/inline as it's created
02:23:51FromDiscord<Doof Doof> I tried out the example with the exact contents and command and nothing popped out :/
02:24:07Yardanicoyou need to set nimcache folder
02:24:13Yardanicootherwise the header will end up in the default nimcache folder
02:24:17Yardanicoe.g. --nimcache:mydir
02:24:22Yardanicoand then your header will be in that directory
02:24:32*OmegaDoug quit (Remote host closed the connection)
02:24:53FromDiscord<tomck> so are there any restrictions on how I *write* an inline iter vs a closure iter? or is it purely how it's used?
02:25:14Yardanico@tomck I don't think you should really care about closure iterators at this point :) normal iterators will work just fine for your case
02:25:16FromDiscord<Doof Doof> @Yardanico I'm dumb - thanks!
02:25:31Yardanicoclosure iterator is all about capturing the state and returning/storing it
02:25:34Yardanicolike storing a closure proc
02:25:47Yardanicoyou can't store or capture some data outside of the normal iterator
02:26:36Yardanicoalso for closure iterators you can get the next value of it
02:26:41Yardanicoa bit like with python iterators
02:27:02FromDiscord<tomck> hmmm, in my mind an 'iterator' is an object with a 'next' method, that's a closure iterator right?
02:27:05FromDiscord<tomck> An inline iterator is a template
02:27:15Yardanicowell, almost like a template, yes, with special rules
02:27:23FromDiscord<tomck> *but* it seems like inline iterators can store local state during their iteration?
02:27:30Yardanicoit's not "local" really
02:27:33Yardanicoas I said it gets inlined
02:27:39FromDiscord<tomck> yes
02:27:39Yardanicoand capturing and storing data is not the same
02:27:46Yardanicolemme show you an example
02:29:42Yardanicoand sorry, closure iterators don't have a "next" proc really
02:30:16FromDiscord<tomck> hmm they don't? Well that's confused me even more
02:30:31FromDiscord<tomck> so they can't be passed around and arbitrarily iterated at different parts of the code?
02:30:37Yardanicoargh
02:30:56Yardanico@tomck you can't do that with an inline iterator at all - https://paste.debian.net/plain/1157370
02:31:28Yardanicosince here you see 1) capturing external variable "data" 2) first-class closure iterator (storing it in a variable) 3) calling it until it's finished
02:31:37Yardanicowith an inline iterator it just replaced the for loop
02:32:47Yardanicoactually that should be https://play.nim-lang.org/#ix=212E, sorry
02:32:51Yardanicoalso see https://nim-by-example.github.io/for_iterators/ :)
02:33:13Yardanicoit seems pretty simple for me
02:33:46*waleee-cl quit (Quit: Connection closed for inactivity)
02:34:59FromDiscord<tomck> I don't understand why an iterator is defined to be inline/closure at its implementation
02:35:07Yardanicobecause they're very different
02:35:17FromDiscord<tomck> but it seems like the restrictions on ly apply to their usage
02:35:32Yardanicoyou can't just pass around an inline iterator
02:35:36FromDiscord<tomck> it seems like any closure iterator could be inlined if it was instantiated & immediately used in a for loop
02:35:45Yardanicobut that's not that easy to detect :P
02:35:50FromDiscord<tomck> whereas it seems any inline iterator could be trivially converted to a closure iterator
02:35:54Yardanicoand closure iterators are opt-in, not opt-out
02:36:14FromDiscord<tomck> if i wanted to create both an inline and closure iterator, would the code used to define that iterator be any different
02:36:46Yardanicodepending on the context you might not be able to create an inline iterator at all
02:37:08Yardanicoit's the same question as to why we use normal procs vs closure procs
02:37:19FromDiscord<tomck> ohhhhhhhhhhhhh i get it now
02:37:26disruptekit's an optimization.
02:37:57Yardanicodisruptek: so seems like you have major progress with cps? :)
02:38:04Yardanicotime for nim async with your cps lib? :P
02:38:38disruptekit's starting to work, but there is a lot to be done yet.
02:38:56Yardanicoalso do you use a patched compiler or something?
02:39:05disrupteknah.
02:39:34disruptekthe demo in the README doesn't work, for example.
02:39:37Yardanicoyes
02:39:44disruptekalso, it's a terrible demo.
02:39:46YardanicoI thought it'd work :P
02:39:49Yardanicowhy no, it's a good demo
02:39:53Yardanicoshowing that it's actually working
02:39:58*maier joined #nim
02:40:02disruptekit's not obvious what it's supposed to do or why.
02:40:09disruptekthe test.nim works.
02:40:11Yardanicosame as with current nim async? :P
02:40:28Yardanicofor me it's pretty obvious what it will do on high-level
02:40:33disrupteki'm gonna write a web-server as a proof-of-concept.
02:40:37Yardaniconice
02:42:47disruptekit's fun to see it kinda work, though. it's going to be a really big deal for nim, i hope.
02:43:13Yardanicoas I understand it'll work with normal (non-closure) procs right?
02:43:23disruptekyeah.
02:43:32Yardanicoprocs (at low level) will just take pointers of higher-up procs as arguments
02:43:49YardanicoI understand cps at a basic level
02:44:11disruptekit's easier to read the output than it is to read a paper.
02:44:45*maier quit (Ping timeout: 240 seconds)
02:44:54Yardanicoi already starred your repo :P
02:45:12disruptekyeah, i had to recreate it because travis is dumb.
02:45:19disruptekand yet it's still broken.
02:45:25Yardanicouse github actions then :P
02:45:40Yardanicobut wait it's not dumb I think
02:45:47disrupteki'm waiting for someone to do it for me once and then i'll just copy their work to all my repos.
02:45:55*krux02_ quit (Remote host closed the connection)
02:45:57Yardanicoit fails because "C:\Users\travis\build\disruptek\cps\cps\eventqueue.nim(121, 16) Error: undeclared identifier: 'registerTimer'"
02:46:21disruptekprobably on windows or something.
02:46:44Yardanicoyes
02:46:46disrupteki cannot link it to my travis user because i pushed it before doing so. travis bug.
02:46:51Yardanicoselectors module isn't fully available on nim
02:46:59Yardanicoin nim*
02:47:05Yardanico"Partially supported OS: Windows (only sockets and user events),"
02:47:08Yardanicono timers
02:47:26disruptekwell, we'll impl those differently on windows.
02:48:05Yardanicothis is how asyncdispatch does it for windows - https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L982
02:48:27disrupteki'll do conditional variables tomorrow, i guess.
02:48:39disrupteki don't really care how windows works. i have my hands full with linux.
02:48:46YardanicoXD
02:48:50Yardanicoyou're gonna upset 4raq
02:49:03disrupteki don't care.
02:49:17disrupteki don't ask him to run my os, either.
02:50:05disruptekwhen i get the web-server working on cps, i'll add yourang and then we should have the fastest web-server by a mile.
02:50:11disruptekon linux, at least.
02:51:06FromDiscord<tomck> I can't seem to import queues - https://nim-lang.org/0.19.0/queues.html
02:51:15FromDiscord<tomck> ```↵Error: cannot open file: queues↵```
02:51:18FromDiscord<tomck> was this removed?
02:51:22disruptekseems so.
02:51:26Yardanicohttps://nim-lang.org/docs/deques.html
02:51:31disrupteksee deques.
02:51:34Yardanicoor https://nim-lang.org/docs/heapqueue.html if you need that instead
02:51:41Yardanicoalso be aware - seqs can act as queues too
02:51:52Yardanicothey have "pop" at least
02:52:01disruptekour deques are missing a rotate() which is annoying.
02:52:31FromDiscord<tomck> which of these is just a ring-buffer queue implemented with seq? i'd assumed that was what `queues` was
02:52:40disruptekdeques
02:53:12Yardanico@tomck you can see the definition of a Deque in https://nim-lang.org/docs/deques.html#Deque :)
02:54:20FromDiscord<tomck> bril, ta
02:56:35disruptekwhere are you from with that accent?
02:56:38disruptekUK?
02:56:48FromDiscord<tomck> yeah englang
02:56:52FromDiscord<tomck> england*
02:56:54FromDiscord<tomck> wbu?
02:57:01disruptekstates
02:57:10FromDiscord<tomck> seems everyone is
02:57:49Yardaniconah
02:57:54disrupteknah, only 20% or less from the states in nim.
02:57:55Yardanicomost people here are from europe :)
02:58:18FromDiscord<tomck> Is `==` on `seq[T]` a deep-equality, or does it just compare whether the instnaces are the same? (also, are there any docs for these procedures? I can't find where any `seq` procs or other builtin procs are defined)
02:58:35FromDiscord<tomck> oh interesting, i always feel like 99% of the internet are americans
02:58:35Yardanicoin the system module
02:58:41Yardanicoand yes, it's a bit hard to find them there :)
02:59:01Yardanico@tomck it's deep equality of cousre
02:59:03Yardanicocourse*
02:59:06Yardanicosince nim seqs are value types
02:59:11Yardanico(well, they have value semantics)
02:59:15Yardanicothey're not value types since they're on heap
02:59:17Yardanicohttps://nim-lang.org/docs/system.html#%3D%3D%2Cseq%5BT%5D%2Cseq%5BT%5D
03:00:18disruptekamericans are just 99% of the noise.
03:00:20Yardanicobut they have value semantics, so if you do "var a = @[1, 2, 3]; var b = a; b.add(5)" a will not be modified
03:00:26Yardanicosame for strings
03:01:15FromDiscord<tomck> cool, makes sense
03:01:26FromDiscord<tomck> can i pass an inline iter to a function?
03:01:29Yardanicono
03:01:34Yardanicoit's not a first-class value as I said :)
03:01:41FromDiscord<tomck> ahhh but i can to a template
03:01:43Yardanicothe only way to somewhat abstract it is with templates
03:01:45Yardanicoyes, like toSeq
03:02:02YardanicotoSeq can "collect" all values of an inline iterator
03:02:05*lritter quit (Ping timeout: 240 seconds)
03:02:10Yardanicoit just expands to a template which calls that inline iterator
03:02:27Yardanicowell it's actually more complex since it works for more types
03:02:48FromDiscord<tomck> Oh lol toSeq is what i want, ta
03:03:08*lritter joined #nim
03:21:28FromDiscord<tomck> Is there a way to 'macroexpand' a file rather than compiling, so i can see how ugly my inline iterator turned out?
03:23:09FromDiscord<Yardanico> You shouldn't generally do that
03:23:15FromGitter<ynfle> either with the https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctyped or CLI argument `--expandMacro:` https://nim-lang.org/docs/nimc.html
03:23:22FromDiscord<Yardanico> I used expandArc which is only on devel and only for arc
03:23:36FromDiscord<Yardanico> @ynfle that won't work for expanding iterators
03:24:37FromDiscord<tomck> so there's no way to expand iterators?
03:24:49FromDiscord<tomck> How did you get that expanded iterator example that you linked me @Yardanico
03:24:55FromDiscord<Rika> how inefficient are closure iterators over inline ones?
03:25:09FromDiscord<Yardanico> @tomck I used expandArc on devel with arc
03:25:28FromDiscord<Yardanico> Which shows Nim after all passes and optimizing just before it goes into the backend
03:26:03FromDiscord<tomck> i see, if i got it from the main site i probably don't have this flag?
03:26:05FromGitter<ynfle> Wouldn't it expand the template?
03:26:47FromDiscord<tomck> my iterator has 14 distinct `yield`s, is this a bad sign
03:26:52FromDiscord<Yardanico> @ynfle of course
03:27:22FromDiscord<Yardanico> But not inline iterators
03:27:28FromDiscord<Yardanico> I mean expandMacros
03:27:29FromGitter<ynfle> I thought tomck wanted to expand his template with an iterator inside
03:28:34FromDiscord<tomck> hmmm, i have a variant object where each variant is an object with some fields - my iterator is designed to iterate over these fields, by switching on the variant kind and calling `yield` on each field of the variant in each arm of the `case` statement. This obviously produces a huge amount of `yield` statements - any good way around this?
03:44:57*hyiltiz quit (Ping timeout: 260 seconds)
04:00:23*hyiltiz joined #nim
04:00:23*hyiltiz quit (Changing host)
04:00:23*hyiltiz joined #nim
04:03:35FromDiscord<Elegant Beef> Can you show the iterator?
04:06:02*supakeen quit (Quit: WeeChat 2.8)
04:06:40*supakeen joined #nim
04:17:35Zevvping @varriount
04:23:06*vicfred quit (Quit: Leaving)
04:27:57FromDiscord<Varriount> I looked at the implementation of toSeq. It's bonkers
04:28:03Yardaniconot really
04:28:08Yardanicothe inline iterator case is very simple
04:28:17FromDiscord<Varriount> Zevv: pong
04:40:48*maier joined #nim
04:45:47*maier quit (Ping timeout: 240 seconds)
04:46:02Zevvoi!
04:46:08Zevvabout the resuming
04:46:41Zevva lot of it is in place, there needs to be some additional state to keep track of offsets in the current block and offsets in the total subject, for example
04:47:04Zevvbut the biggest problem is that "old" data that might be needed to complete a capture might be gone
04:47:30ZevvI have this nice picture behind my eyes of how this could be done, but I was never able to put it in properly
04:48:03ZevvI guess it needs to keep a copy around of all chunks passed in that are still referenced by one or more open captures
04:48:45Zevvalternative would be to actually store each character in the current open captures as the data comes in, but I think that'll be quite a performance hit
04:52:04*Zevv quit (Quit: Lost terminal)
04:52:17*Zevv joined #nim
04:52:29Zevvwell that was my irssii hanging, first time in decades
04:53:09Zevvanyway, its about not having old parts of the subject around when you close a capture
04:54:09Zevvso practically that will mean something like npeg making a copy of each chunk as you stream it in, and keep that copy aroun until the last capture that (potentially) references it closes out
04:54:43Zevvif we just had immutable strings and slices! :)
05:00:30Zevvi also do have another problem - there's some comments on github from a guy who clearly really understands all this and he things the capturing should be done totally different. Problem is that I really don't understand what he means
05:02:01Zevvand I'm kind of too intimidated by his remarks to ask
05:02:15Zevvbecause that would admit I have no clue what Im doing
05:04:33Zevvhe says that I'm trying to hammer a circle in a square, or something like that
05:05:03Yardanicohaha, guess what
05:05:17Yardanicoeven in brainfuck for bench.b in https://github.com/kostya/benchmarks latest arc is faster
05:06:18YardanicoI guess it's time to make a forum thread with all benchmark results arc vs refc on latest devel for this
05:06:28Yardanico~1.261s vs ~1.425s for bf.nim for bench.b btw
05:06:28disbotno footnotes for `1.261s`. 🙁
05:07:18Yardanicohmm actually wait, maybe refc takes longer to initialize or read?
05:07:42Yardanicoso the kostya benchmarks does benchmarks as in: starting the program, only then reporting over the sockets that it start, then doing the benchmarks and notifying that it ended that
05:07:52Yardanicoso if I only take that time refc vs arc are mostly tied
05:08:00Yardanicobut if we take full time for binary to execute, arc is 0.2s faster
05:08:08Yardanico(that was without this socket functionality)
05:08:16Yardanico10 runs for both
05:08:22*apahl quit (Ping timeout: 260 seconds)
05:08:57*apahl joined #nim
05:12:05*hyiltiz quit (Quit: hyiltiz)
05:15:02*hyiltiz joined #nim
05:15:07*lritter quit (Quit: Leaving)
05:28:17ForumUpdaterBotNew thread by TheSpydog: Questions about object construction, see https://forum.nim-lang.org/t/6570
05:33:12*drewr quit (Ping timeout: 260 seconds)
05:36:53ZevvWhy can I create an object with a constructor like `This(that: value)`, but why is there no constructor for *ref* objects?
05:37:00Yardanicothere is?
05:37:06Yardanicoit's the same syntax
05:37:23Yardanicoobject construction automatically allocates an object if it's a ref object
05:37:53Zevvyes but no but yes but
05:38:05Yardanico???
05:38:11Zevv(zevv is typing...)
05:38:21Yardanico¿que
05:38:26*cornfeedhobo quit (Ping timeout: 260 seconds)
05:38:34*_ofelas quit (Quit: shutdown -h now)
05:38:56*ofelas joined #nim
05:39:09Zevvhttp://ix.io/219D
05:39:17Yardanicooh, in this case
05:39:20Zevvyou can do that if the *type* is a ref object
05:39:27Yardanicoyes\\\
05:39:41Zevvyes what?! :)
05:39:46Yardanicoyes no yes but yes
05:40:03Yardanicoi mean yeah, i don't know how to use object construction here
05:40:08Yardanicomake a ThingRef type dammit :P
05:40:19ZevvYes but no but
05:40:24ZevvI want my constructor!
05:40:33ZevvSo it's not me then :)
05:40:56ZevvI propose `var t = new Thing(val: 42)`
05:41:08Yardanicoif it's possible to implement - i'm for it
05:41:17Yardanicoashtually
05:41:42YardanicoZevv: https://play.nim-lang.org/#ix=21cJ
05:41:50YardanicoI mean you probably already figured it out yourself :P
05:42:06Zevvwarempel
05:42:22FromDiscord<Rika> cant you do (ref Obj)(constructor stuff)?
05:42:37Yardanicono what
05:42:40FromDiscord<Rika> or does that make no sense
05:42:41FromDiscord<Rika> i dunno
05:42:43ZevvWhy don't we put that new of yours in the stdlib
05:42:44Zevvright away
05:42:45Yardanicowhat did you smoke sir :thinking:
05:42:46YardanicoZevv: lmao
05:42:56Yardaniconeed to make it a magic!
05:42:57Yardanicoto optimize
05:42:58FromDiscord<Rika> yardanico: massive argument happened in another server
05:43:03FromDiscord<Rika> i'm very tired
05:43:13FromDiscord<Rika> despite having been awake for 4 hours or so
05:43:29Yardanicoits okay
05:43:40Yardanicogo watch some anime or vtubers hooman
05:43:43Zevvhave a coffee, sit outside for a while, breath in
05:44:19ZevvYardanico: is this issue-worthy you think?
05:44:23Yardanicoyeah
05:44:28Yardanicoit's a nice little sugar addition
05:44:30Yardaniconot gonna hurt
05:44:47Yardanicobut I think it might need a compiler implementation to be more efficient, idk lol
05:44:55YardanicoI mean as a compiler magic
05:45:06ZevvI don't dare making issues about these things anymore. I always get obliterated with people bikeshedding the issue away and telling me not to whine about stupid small things
05:45:10YardanicoC code for gc arc with danger for my new - https://play.nim-lang.org/#ix=21cK
05:45:15YardanicoZevv: wat
05:45:34FromDiscord<Rika> kinda wish we didnt need the initXXX thing anymore
05:45:43FromDiscord<Rika> feels like a hack
05:45:46Yardanico??
05:45:52ZevvC code is not that bad even. It *is* a copy, of course
05:45:52FromDiscord<Rika> its one of the things in nim i dont really like
05:45:56Zevvit needs to come from somewhere
05:46:09FromDiscord<Rika> how initXXX and newXXX is the "idiomatic thing to do in nim"
05:46:28Yardanicowell, I mean default values for type fields would be nice, yes
05:46:32Yardanicobut why is this not idiomatic?
05:46:35Yardanicoit's pretty easily understood
05:46:40ZevvWhen I moved to Nim I noticed all these funny quirks like that, and was bothered by it
05:46:54Zevvthen just forgot about it and thought "Well, that's probably how it goes with newish languages"
05:47:02Zevvthen I did some go the other day. and it's just the same
05:47:13ZevvnewThis
05:47:33YardanicoZevv: actually current arc isn't that bad - today's arc https://play.nim-lang.org/#ix=21dq
05:47:48Yardanicohttps://play.nim-lang.org/#ix=21eg one month old arc
05:47:51*maier joined #nim
05:48:04Yardanicodon't ask why I have a "nimmonth" binary which is nim devel from a month ago
05:48:19Zevvyeah quite some work has been done there over the last weeks it seems
05:48:22Yardanicowait i sent same stuff
05:48:30Yardanicoah i didn't
05:48:34Zevvoh I have about 9 nim binaries around I believe :)
05:48:36YardanicoZevv: optimizer + cursorifier yeah
05:48:53Zevvproblem is that now I can't wait to actually write code that uses it all
05:48:59Zevvbut then it won't work properly on GC anymore
05:49:03Yardanicowhy?
05:49:08Yardanicodestructors are mapped to finalizers on refc
05:49:08Zevv=destroy[]
05:49:12Yardanicoyes
05:49:15Yardanicorefc supports them
05:49:25Yardanicodon't ask how, I don't know
05:49:29Zevvyeh but not normal GC right
05:49:33Yardanico??
05:49:34Yardanicorefc
05:49:36Yardanicothe default GC
05:49:39Zevvwaitamin
05:49:44Yardanicorefc is the default GC sire
05:49:50Yardanicoit's been the default nim GC for years
05:50:01Yardanico"deferred reference counting + mark & sweep for cycle collection" = refc
05:50:15Yardanico"automatic reference counting + move semantics" = arc
05:51:05YardanicoZevv: https://play.nim-lang.org/#ix=21kT
05:51:12Zevvhttps://play.nim-lang.org/#ix=21eh
05:51:14Zevvthis never desroys
05:51:19Yardanicobecause it's deferred
05:51:28Yardaniconim's default GC doesn't always check for garbage remember
05:51:32Zevvright
05:51:39Yardanicoit will take a bit of time unless you do GC_fullCollect() or just end the program
05:51:44Yardanicosame as finalizers
05:51:47Yardanicoit's funny actually
05:51:52Yardanicofinalizers are mapped to destructors on arc
05:51:55Zevvnope still doesnt
05:52:00Yardanicodestructors are mapped to finalizers on refc
05:52:15YardanicoZevv: seems a global scope thing
05:52:26ZevvRight. All that makes it kind of useless without arc
05:52:42Yardanicowell why? no
05:52:43ZevvI don't have a holiday project yet, I'm considering making part 2 of my nim memory writeup
05:52:46Yardanicooh
05:52:47Yardaniconice
05:52:48Zevvand go deep on arc
05:53:00*cornfeedhobo joined #nim
05:53:06Zevvbecause the only docs are ar4qs techincal notes, which are totally useless for the Normal Man
05:53:10YardanicoI've found a few new regressions though, and they're both are a bit non-trivial (I mean the codebases, even though they're relatively small)
05:53:23YardanicoZevv: what data structure would you expect a markdown parser to use?
05:53:26Yardanicojust a random question
05:53:38Yardanicoin nim
05:53:50Zevvhmm.
05:53:57Zevvtree-ish
05:54:04Zevvnested lists, nested sections
05:54:28Yardanicohow about doubly linked lists of ref tokens with methods and inheritance?
05:54:53Zevvsome people like pain, so I've heard
05:54:58Yardanicohttps://github.com/soasme/nim-markdown/blob/master/src/markdown.nim
05:55:04Yardanicoin that package I found an cursorifier bug
05:55:08Zevvmaybe these kind of people implement these kind of things with ref tokens with methods and inheritance
05:55:15Yardanicoit uses doubly linked lists + inheritance + methods
05:55:19Yardanicofor parsing markdown in nim :)
05:55:27Zevvwell, it's not *wrong*, is it
05:55:30Yardanicowell yeah
05:55:32Yardanicoit *works*
05:55:41ZevvI would just make a tree of sum types I guess
05:55:44Yardanicosame
05:55:45*narimiran_ joined #nim
05:55:51Yardanicobut I minimized it to 1.2k loc but I can't do it further really XD
05:56:00Yardanicoactually sorry it's more like 2k loc
05:56:00Yardanicohttps://gist.github.com/Yardanico/05963f165604854ef84863da34102c54
05:56:04Zevvit's a great test case I bet
05:56:14Yardanicothe one which triggers the cursorifier bug is this proc exactly https://gist.github.com/Yardanico/05963f165604854ef84863da34102c54#file-markdown-nim-L2253
05:56:21YardanicoI tested because I disabled cursorifier that that exact proc and it worked
05:56:41Yardanico(I modified it of course, it wasn't called doStuff and it didn't have hard-coded indexes)
05:56:42Zevvpff the patience you have to dig into all that shit
05:56:54YardanicoI can't easily reproduce it because the token passed to doStuff is cyclic
05:56:57YardanicoI can't repr it
05:57:16YardanicoZevv: well I mean it's manageable
05:57:29Yardanicoat least today I had the joy of making a test case without monkey work
05:57:54Yardanicojust tried running nimsynth with arc - read the stack trace - read a bit of code and made https://github.com/nim-lang/Nim/issues/15038
05:57:55disbot[ARC] SIGSEGV when calling a closure as a tuple field in a seq ; snippet at 12https://play.nim-lang.org/#ix=20Nl
05:58:01Yardanicowell not just, 4 hours ago
05:58:07Yardanicobut it was a pleasant experience
05:58:29Yardanicothe final boss still awaits us though
05:58:32YardanicoThe Nim Compiler
05:58:36Zevvyeah
05:58:39Yardanicomaking it work with ARC :P
05:58:40Zevvbut that was not written in Nim right
05:58:42Zevvthat's just pascal
05:58:44YardanicoXD
05:59:00Yardanicoyeah its delphi pascal with a windows gui
05:59:09YardanicoAST is stored in checkboxes
05:59:16Zevvghehe
05:59:59Zevvis there like this one obvious big problem that makes ARC not work, or is it just a thousand different things?
06:00:12Yardanicoit's mostly rare edge cases which weren't handled
06:00:17Yardanicono "big stuff", that's rare and most of it was fixed already
06:00:19Zevvwhich should be in the end
06:00:23Yardanicoyeah
06:00:32ZevvNim is Nim is Nim, you'd think
06:00:51Zevvbut really, only since a month or so I feel it's really going to happen this time
06:01:04Zevvthe whole "newruntime" promis that has been looming over 2018/2019
06:01:06Zevvand never pulled off
06:01:12Yardanicolet mut (#%#%!?%$#!@%
06:01:46FromDiscord<Rika> 👀
06:02:45Yardanicobut yeah Zevv, this time everyone is commited to ARC :P
06:02:49Yardanicoand ORC
06:03:17Zevvyeah, the final step would just be to throw out arc and use orc only
06:03:26YardanicoD: that's not nice
06:03:28ZevvI can live with the 2.5% overhead
06:03:37YardanicoORC will be the default anyway
06:03:42Zevvright
06:03:53Yardanicobut actually with latest optimizers 4raq said that for simple cases there's no overhead with ORC at all
06:04:00ZevvI don't want to think about all that stuff anymore. I've been thinking about all that stuff for decades and it makes me soo tired
06:04:05ZevvI just want my language to do the Right Thing
06:04:17Yardanicothe epic test
06:04:18ZevvI've been corrected and harassed by a flock of Juniors last week
06:04:22Yardanicowtf
06:04:30Yardanicoepic test - https://github.com/nim-lang/Nim/blob/devel/tests/arc/topt_refcursors.nim
06:04:32Zevvmy c++ was bad because I don't pass my strings as `const ref std::string &`
06:04:41ZevvWhy the HELL do *I* need to type all that shit in if I have a compiler?
06:05:00Yardanicosounds strange :(
06:05:14Yardanicowait what does it mean
06:05:18Yardanicoconst = non-mutable
06:05:23Yardanicostd::string - c++ string
06:05:31Zevv(Whining voice) "yeah well you can't pass your strings just like that because it will make a copy and thats baaad mkaah, so you need to pass a reference but you need to make it const if you don't want the function to mutate"
06:06:03Zevvc++ compilers are apparently not smart enough
06:06:13Zevvif you pass as string, it will *always* copy
06:06:16Yardanicouse rust instead! it'll solve all your problems
06:06:23Zevvrust hurts
06:06:28FromDiscord<Rika> and cause 99 more
06:06:38YardanicoZevv: about copy
06:06:40FromDiscord<Rika> of course rust hurts, you'd get tetanus if you had an open wound
06:06:46Yardanicocheck https://forum.nim-lang.org/t/6549 bottom of the opening post
06:06:53Yardanico"Which might not be impressive but it means the compiler optimized away all hidden constructions, destructions and copies. Try the same with C++'s std::string and Godbolt."
06:06:55Yardanico4raq savage
06:07:00ZevvI was really pleased with Go. It's hard to hate, but also hard to love tho
06:07:16Zevvah yeah I saw that remark. That was pretty funny
06:08:58Yardanicomoe works with arc btw (all tests of it pass at least)
06:09:07Zevvmoe?
06:09:09Yardanicohttps://github.com/fox0430/moe
06:09:25Yardanicoits ~9k cloc of Nim
06:09:30Zevvnice
06:09:38Yardanicoafter I reported two bugs of course ;P
06:09:42FromDiscord<Rika> nice idolmaster avatar
06:09:54Yardanicobut they're an actual japanese person
06:10:02Yardanicothey have the anime pic pass
06:10:17FromDiscord<Rika> why does it matter if theyre japanese or not
06:10:28Yardanicobecause im trying to be funny
06:10:39FromDiscord<Rika> you're trying too hard xd
06:11:21FromDiscord<Rika> god damn thats a lot of contributions though
06:11:30Yardanicoyeah I was surprised when I first saw it
06:14:10Yardanicocan anyone recommend a good way to try to understand the structure of a cyclic datastructure in nim?
06:14:13Yardanicoso I can reproduce that markdown thing
06:16:36YardanicoI guess I can recursively traverse and unsafeAddr to ignore nodes I already went through ..
06:16:57Zevvhow do you mean "try to understand"?
06:17:05Yardanicoto manually construct it
06:17:14Yardanicowithout the 2k lines of code
06:17:29Zevvah not just any, but exactly *that* data structure
06:17:33Yardanicoyes
06:17:49Zevvhm
06:17:58ZevvI dont have time today to go grok all that code
06:18:02Yardanicoit's okay
06:18:05YardanicoI will find a way
06:18:16Zevvbut I guess Id start with some visualizations with dot/graphviz
06:18:18YardanicoI once minified all nigui (well to be fair win32 and gtk3 are separated there) for an arc bug
06:22:21FromDiscord<Varriount> Zevv: don't be afraid to learn new things
06:23:07Yardanicook nice
06:23:17Yardanicoso in that token 11 freaking children point to same thing in memory
06:23:18Yardanicowtf
06:26:42FromDiscord<Varriount> Zevv: sorry for not responding, I fell asleep
06:26:48Yardanicohappens :P
06:34:03ZevvNah, I'm never afraid to learn new things, I was just whining :)
06:34:13FromDiscord<Varriount> Zevv: Reading that issue in NPeg's repo, it sounds like they are suggesting that there should be a way to execute code on match, and on backtrack
06:34:41Zevvright. The problem with the current method is that nim code block captures always run
06:34:53Zevvin practice, this is usually just fine. until its not
06:35:00Zevvand then you have no way of telling you've been backtracked
06:35:12Zevvbut I'm shunned of a bit by the added complexity it will bring
06:35:13FromDiscord<Varriount> Yes, but there's no way to run code on backtrack
06:36:59Zevvalso I'm not sure if I agree with having the stack at the rule level
06:37:22Zevvbut then again, I still didn't find or take the time to properly look into all this
06:37:49Zevvmy job has been kind of sucking up all my brain juice over the last few months
06:37:56Zevvand I guess it will keep doing that for some time
06:38:31FromDiscord<Varriount> Zevv: I understand that. Mine has too.
06:39:30Zevvsuch is life
06:39:35FromDiscord<Varriount> Zevv: What I think they meant was, currently there's a way to execute code on match. They also wanted a way to execute code on backtrack.
06:40:28ZevvI think not on backtrack, but on commit
06:40:34Zevvso when the choice has been made final
06:41:22FromDiscord<Varriount> Yeah, but that's something that can really already be done - it's no different than processing a list of captures.
06:42:04Zevvright, but that makes it harder to construct a tree, if that's what you want to do
06:42:26Zevvof course part of the problem is that a parser is a beast that can be used for lots of things
06:42:33Zevvand every use has its own additional requirements
06:44:04*Senketsu joined #nim
06:44:31FromDiscord<Varriount> I don't really see how that's possible without running through the entire input, since its entirely possible that the grammar you construct with NPeg has no "atomic" points where backtracking is guaranteed to not occur.
06:46:17FromDiscord<Varriount> Zevv: Before I go further, I just want to confirm, this is what your referring to? https://github.com/zevv/npeg/issues/24
06:46:18disbotQuestion about code blocks and backtracking
06:48:05Zevvnope, its this one:
06:48:16Zevvhttps://github.com/zevv/npeg/issues/14
06:48:18disbotInput wanted: design and implement a proper API for code blocks ; snippet at 12https://play.nim-lang.org/#ix=21zU
06:48:26Zevvshumy-tools
06:48:30Zevvthey are both related, tho
06:50:14ZevvI do like the possible synax where there are optional blocks in code captures like `commit:` or `validate:`
06:50:21Zevvthis would keep the current behaviour compatible
06:50:52Zevvinstead of running the code there, that could store a callback closure when the capture gets commited
06:50:57Zevvand only then run that snippet
06:51:30Zevvproblem is that getting the captures work as they do now has been about 50% of the total effort of making npeg - the parsing was relatively trivial.
06:51:45Zevvand is suggestions of throwing that all out and redoing it is kind of a mental struggle for me :)
07:01:07FromDiscord<Varriount> Zevv: Hm.
07:01:57FromDiscord<Varriount> I think I mostly understand what they are proposing.
07:07:38FromDiscord<Varriount> Zevv: Isn't the proposal fairly similar to what one might get if they put a capture around each rule?
07:07:54*solitudesf joined #nim
07:08:08Zevvwell, there *is* already an implicit capture around each rule
07:08:15Zevvthat's the capture[0] or $0
07:12:26*marnix joined #nim
07:12:55*icy quit (Quit: catch you on the flipside :^))
07:12:57*marnix quit (Read error: Connection reset by peer)
07:13:40*marnix joined #nim
07:17:00*icyphox joined #nim
07:17:23FromDiscord<Varriount> Bah, the problem with things like PEGs is that it's hard to come up with an example that's both realistic _and_ short.
07:17:54FromDiscord<Varriount> I wanted to describe my interpretation, but I don't think its worth the effort.
07:21:11FromDiscord<Varriount> Zevv: With regards to NPeg (and PEGs in general) I guess I don't necessarily see them as always optimal for producing an AST. If I have one criticism/caution on that proposal, it's that the most readable/performant set of PEG rules for a given language doesn't necessarily match up with the syntax tree of the language.
07:21:35Zevvalso true
07:21:52Zevvbut then again, it would be nice if npeg could at least facilitate one good method for building AST
07:22:13ZevvI now do this with the help of an additional stack on the 'outside', which does actually work fine
07:22:32Zevvremains only the problem of getting code to run for captures that might backtrack
07:22:48Zevvfunnily, I never ran into that myself
07:26:31FromDiscord<Varriount> Zevv: I guess I'll add my 2 cents to that issue, and see if it gets any reply.
07:27:03Zevvthanks!
07:27:05FromDiscord<Varriount> Once again, thanks for creating such a useful library.
07:27:21Zevvpleasure :)
07:28:29FromDiscord<Varriount> By the way, what have you used NPeg for?
07:30:49ZevvI mostly use it for ad hoc data crunching
07:34:11Zevvsome custom scripts I have to do my administration and bookkeeping
07:38:40Zevvparsing DSLs to generate wireshark protocol analizers
07:38:50Zevvoh and parsing RTSP and SIP
07:40:38ForumUpdaterBotNew thread by Tedlavarias: Problem installing Nim compiler on Linux Mint 20 with curl, see https://forum.nim-lang.org/t/6571
07:40:55*Senketsu quit (Read error: Connection reset by peer)
07:44:33*endragor quit (Ping timeout: 256 seconds)
07:46:11*marnix quit (Ping timeout: 240 seconds)
07:55:31*endragor joined #nim
07:58:24*d10n_ is now known as d10n
07:58:24*d10n quit (Changing host)
07:58:25*d10n joined #nim
08:04:09*marnix joined #nim
08:16:36*beatmox- joined #nim
08:16:43*beatmox quit (Read error: Connection reset by peer)
08:16:50*qwertfisch_ joined #nim
08:16:51*qwertfisch quit (Quit: ZNC - http://znc.in)
08:18:18Yardanicook apparently for that nim-markdown the sledgehammer approach seems to be working
08:18:21Yardanicofrom 2k loc to 200 loc
08:20:28FromDiscord<Clyybber> @Yardanico That new thing is nice, I don't think it needs to be magic
08:24:16FromDiscord<Varriount> If you want to get rid of the copy, you could always just make it a template.
08:26:33FromDiscord<Clyybber> @tomck You can use getImplTransformed
08:32:24FromGitter<bung87> `fftpack.dct` with param `norm="ortho"` which is the equals way in nim ?
08:33:02AraqcallHere(norm="ortho") is the syntax for named parameters, like in Python
08:33:36FromGitter<bung87> ah, the point is not the param thing ,
08:33:38FromDiscord<Rika> what is fftpack.dct?
08:33:44*superbia joined #nim
08:34:05FromGitter<bung87> Return the Discrete Cosine Transform of arbitrary type sequence x.
08:34:17Araqer, didn't the stdlib offer "fractions"? where are they?
08:35:40Araqah, "rationals" it is
08:38:04*superbia quit (Client Quit)
08:38:21*superbia joined #nim
08:38:52*superbia quit (Client Quit)
08:40:15YardanicoAraq: minimized this nim-markdown thing, I really don't understand why it crashes, but it does (and doesn't on a month-old nim with arc or with refc) - https://play.nim-lang.org/#ix=21Qn
08:40:38Yardanicoalso had to keep methods since they are apparently important to trigger this crash
08:40:48FromGitter<bung87> thank you
08:41:09Yardanicoah wait it still crashes if I remove seq[Chunk] now
08:41:18Yardaniconice
08:41:47Yardanicoand it is a cursorifier bug, works with cursorifier disabled
08:41:59Yardanicoi'll make an issue
08:43:26Yardanicohttps://github.com/nim-lang/Nim/issues/15039
08:43:28disbot[ARC] Weird cursorifier bug with methods + doubly-linked lists ; snippet at 12https://play.nim-lang.org/#ix=21R8
08:43:36Yardanicoi didn't know a good title for this one :P
08:43:53Araqit's good
08:47:27*oddp joined #nim
08:53:15*muffindrake quit (Ping timeout: 272 seconds)
08:54:01*muffindrake joined #nim
08:54:15*superbia joined #nim
08:55:45*nikita` joined #nim
08:58:50ForumUpdaterBotNew thread by JPLRouge: Typefino or type trait for --gc:arc choix ???, see https://forum.nim-lang.org/t/6572
08:59:32FromDiscord<Rika> what
08:59:37YardanicoI understood them :)
08:59:41FromDiscord<Rika> i dont understand what they mean
09:00:10YardanicoThey're asking if "typetraits" will remain available long-term for the --gc:arc
09:00:17Yardanicobecause they switched from typeinfo to typetraits
09:00:50FromDiscord<Rika> will it?
09:01:00Yardanicowhy wouldn't it?
09:01:09Yardanicoit doesn't matter which gc you're using for typetraits really
09:02:50FromDiscord<Rika> TIL distinctBase...
09:03:05Yardanicoalso typetraits in devel got a very good addition
09:03:23Yardanicohttps://github.com/nim-lang/Nim/pull/14791
09:03:24disbottypetraits: features and fixes
09:03:32YardanicogenericParams improvements
09:09:24FromDiscord<dom96> This is interesting and it mentions Nim https://reddit.com/r/programming/comments/hvfj2c/complexity_of_hello_world_what_comes_after/
09:09:29Yardanicooh yeah saw that
09:09:45Yardanicothat person included nim in some other videos as well
09:11:17Yardanico@dom96 https://www.youtube.com/watch?v=-9SGIB946lw :P
09:11:34Yardanicosame channel
09:20:46FromDiscord<Varriount> Hm, do YouTube videos count as secondary sources? These might be good to add to the Wikipedia page
09:20:50Yardanicoyes
09:21:07Yardanicobut well
09:21:16Yardanicowikipedia doesn't consider them reliable sources
09:21:19Yardanicohttps://en.wikipedia.org/wiki/Wikipedia:Reliable_source_examples#Are_IRC,_Myspace,_Facebook,_and_YouTube_reliable_sources?
09:21:28FromDiscord<Clyybber> Yardanico Regarding 15036 the * is needed so that the const is generated
09:21:37FromDiscord<Clyybber> otherwise deadcode elim comes into play
09:21:41Yardanico@Clyybber yeah I figured that out
09:22:30FromDiscord<Varriount> Bah. The problem with Wikipedia's rules is that they don't really apply to certain kinds of subject matter.
09:23:09FromDiscord<Varriount> */apply to/fit well with/
09:28:09superbiawhat if you don't consider wikipedia as a reliable source
09:28:13*marnix quit (Read error: Connection reset by peer)
09:28:21*marnix joined #nim
09:31:13*Vladar joined #nim
09:32:02*muffindrake quit (Quit: muffindrake)
09:37:25Araqlol, indeed
09:37:36Araqand I don't
09:38:00FromDiscord<Recruit_main707> Depends on the topic
09:41:52FromDiscord<dom96> > @dom96 https://www.youtube.com/watch?v=-9SGIB946lw :P↵@Yardanico[IRC]#0000 oh cool
09:48:19Araqdo you think #15026 is *not* caused by --exceptions:goto because it works with this switch and only fails with --gc:arc ?
09:48:21disbothttps://github.com/nim-lang/Nim/issues/15026 -- 3[ARC] Weird exception behaviour from doAssertRaises ; snippet at 12https://play.nim-lang.org/#ix=204i
09:48:34Araqwell you would be wrong then :P
09:48:53Yardanicolet me guess - exceptions:goto is ignored for refc? :P
09:49:59AraqI replied, see for yourself. --gc:arc produces a nested try-finally that you didn't see
09:52:14Araqwhy are forest ants so much bigger than the usual ants?
09:52:52Yardanicowell I see in the C code that the "wrong" is set to true outside of the exception checks for some reason
09:53:03Yardanicoso it's always set even if the exception is raised
09:53:57Araqthe control flow has to run the 'Finally' section and then inside the finally we forget to rewind further
09:54:03*waleee-cl joined #nim
09:57:14*fredrikhr joined #nim
10:01:02Araqah, it's simple
10:01:14Araqonly toplevel statements are affected and it's easy to see why
10:07:47Araqha, watch this, the most beautiful bugfix ever
10:07:52Yardanicosingle line? :D
10:09:06Araqhttps://github.com/nim-lang/Nim/pull/15040
10:09:07disbotfixes #15026, no test case since only a special case was affected and…
10:09:16Yardanicolol
10:10:00FromDiscord<Rika> That's amazing LOL
10:11:18Yardanicobtw, how does the C backend indent C code?
10:11:31Yardanicoi'm just asking because exception handling stuff isn't indented :P
10:11:32FromDiscord<Clyybber> by chance :p
10:11:49*xet7 quit (Quit: Leaving)
10:11:52Yardanicoit's a minor thing of course
10:12:04Araqthere is some logic for it but it isn't maintained really
10:12:06Yardanicobut after all the recent optimizer PRs the C code is easier to read lol
10:12:22Araqyeah it's getting beautiful :P
10:12:36*xet7 joined #nim
10:14:33Araqwe need a better backend
10:14:42*vicfred joined #nim
10:14:52Araqsomething based on types
10:15:03Araqnot on ropes
10:20:34*hyiltiz quit (Quit: No Ping reply in 180 seconds.)
10:21:50*hyiltiz joined #nim
10:21:50*hyiltiz quit (Changing host)
10:21:50*hyiltiz joined #nim
10:48:42*theelous3 joined #nim
10:53:44Zevvit's pretty amazing. I like your snippet on the forum post.
10:54:05Zevvthere's just nothing happening. zero overhead
11:03:28alehander92oooi
11:03:33alehander92what is zero
11:03:49*maier quit (Ping timeout: 264 seconds)
11:04:19Yardanicoalehander92: https://forum.nim-lang.org/t/6549
11:04:23Yardanicobottom of the first post
11:10:49*oddp quit (Ping timeout: 256 seconds)
11:17:51*superbia1 joined #nim
11:20:30*superbia quit (Ping timeout: 260 seconds)
11:22:38*qwertfisch_ is now known as qwertfisch
11:32:21*maier joined #nim
11:43:40FromDiscord<tomck> sent a long message, see http://ix.io/22es
11:43:56FromDiscord<Yardanico> https://github.com/zero-functional/zero-functional
11:44:11FromDiscord<tomck> ahhh this is the one
11:44:19FromDiscord<tomck> shame it's not in the lang
11:45:37FromDiscord<Rika> Nim is one of the languages where most things are implemented in packages rather than added to the lang, I feel
11:58:04FromDiscord<tomck> Okay, so i have a `ref object` which is a variant object
11:58:24FromDiscord<tomck> because it's a variant object, the default `==` implementation seems to not work
11:58:57FromDiscord<tomck> so, i implemented my own `==` proc, which works fine↵However, some places in the code I am checking for if `x != nil`, which triggers my `==` proc
11:59:36FromDiscord<tomck> In my proc, how do i check whether a parameter is nil? If i just use `if x == nil`, this will just recursively call my `==` proc
12:01:01FromDiscord<tomck> Aha, so i got it to work ( i think ) by checking `if x[].addr != nil`
12:06:01*supakeen quit (Quit: WeeChat 2.8)
12:06:46*supakeen joined #nim
12:21:30*maier quit (Ping timeout: 256 seconds)
12:21:39FromDiscord<Rika> Theres an isNil proc, that might be what you are looking for
12:24:48*NimBot joined #nim
12:27:29*fredrikhr quit (Read error: Connection reset by peer)
12:33:54FromDiscord<exelotl> Ouch, so that's why that exists...
12:38:44*beatmox- quit (*.net *.split)
12:38:44*swamptest1[m] quit (*.net *.split)
12:38:44*leorize[m] quit (*.net *.split)
12:38:44*Zoom[m] quit (*.net *.split)
12:38:44*skrylar[m] quit (*.net *.split)
12:38:45*planetis[m] quit (*.net *.split)
12:38:45*lnxw37d4 quit (*.net *.split)
12:38:45*Cadey quit (*.net *.split)
12:38:45*ldlework quit (*.net *.split)
12:40:30*j4nvkvc quit (Remote host closed the connection)
12:40:31*GitterIntegratio quit (Write error: Connection reset by peer)
12:40:31*k0mpjut0r quit (Write error: Connection reset by peer)
12:40:31*watzon quit (Write error: Connection reset by peer)
12:40:32*ee7[m] quit (Read error: Connection reset by peer)
12:40:32*BitPuffin quit (Write error: Connection reset by peer)
12:40:32*wontruefree[m] quit (Read error: Connection reset by peer)
12:40:33*MTRNord[m] quit (Remote host closed the connection)
12:40:35*xicheng[m] quit (Read error: Connection reset by peer)
12:40:35*slackytude[m] quit (Read error: Connection reset by peer)
12:40:37*guelosk[m] quit (Read error: Connection reset by peer)
12:40:37*reversem3 quit (Remote host closed the connection)
12:40:38*stisa[m] quit (Read error: Connection reset by peer)
12:40:38*nerdrat[m]1 quit (Remote host closed the connection)
12:40:39*oneark quit (Remote host closed the connection)
12:40:41*codic quit (Write error: Connection reset by peer)
12:40:41*unclechu quit (Write error: Connection reset by peer)
12:40:42*dzamo[m] quit (Remote host closed the connection)
12:40:43*Zambyte[m] quit (Read error: Connection reset by peer)
12:40:57*fredrikhr joined #nim
12:42:18*krux02 joined #nim
12:42:33*beatmox- joined #nim
12:42:33*Cadey joined #nim
12:42:33*ldlework joined #nim
12:45:48*maier joined #nim
12:49:47*guelosk[m] joined #nim
13:16:21*oddp joined #nim
13:20:27FromDiscord<tomck> why is there no default impl for == on variant objects?
13:21:21*watzon joined #nim
13:21:21*MTRNord[m] joined #nim
13:21:21*leorize[m] joined #nim
13:21:21*dzamo[m] joined #nim
13:21:21*planetis[m] joined #nim
13:21:22*lnxw37d4 joined #nim
13:21:22*nerdrat[m] joined #nim
13:21:22*reversem3 joined #nim
13:21:22*unclechu joined #nim
13:21:22*oneark joined #nim
13:21:22*k0mpjut0r joined #nim
13:21:22*codic joined #nim
13:21:22*Zambyte[m] joined #nim
13:21:22*j4nvkvc joined #nim
13:21:22*BitPuffin joined #nim
13:21:22*GitterIntegratio joined #nim
13:21:23FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=22Ih
13:21:28*xicheng[m] joined #nim
13:21:28*wontruefree[m] joined #nim
13:21:28*Zoom[m] joined #nim
13:21:28*sendell joined #nim
13:21:28*neceve joined #nim
13:21:28*ee7[m] joined #nim
13:21:29*slackytude[m] joined #nim
13:21:29*stisa[m] joined #nim
13:21:30*skrylar[m] joined #nim
13:21:30*swamptest1[m] joined #nim
13:24:45*filcuc joined #nim
13:43:28*muffindrake joined #nim
13:43:44*drewr joined #nim
13:51:22Araqtomck: the idiomatic way is to use system.`==`(x, nil)
13:57:37*Kaivo joined #nim
14:01:09FromDiscord<tomck> Araq: will that work for variant objects
14:01:11FromDiscord<tomck> (edit) 'objects' => 'objects?'
14:01:47Araqno, it's what you can use instead of pointer hack or instead of isNil
14:02:11FromDiscord<tomck> oh i see, why can't nim implement a generic == proc for variant objects?
14:02:44FromDiscord<tomck> Is there some edge-case i'm not considering, or could i go ahead & implement my own `==` for variant objects in my project?
14:03:51*muffindrake quit (Quit: muffindrake)
14:04:20*muffindrake joined #nim
14:06:54Araqtomck: it can do it easily. problem is system.nim cannot because it lives in the dark ages before we had type introspection in Nim's macro system
14:08:37FromDiscord<tomck> ahh ok, so nim could do this in the future? I'll take a look into my own macro for it, thanks!
14:10:02Araqyeah, it's common complaint in fact
14:11:52*superbia1 is now known as superbia
14:23:11*haxscramper joined #nim
14:28:33icyphoxI get a 'SIGSEGV: Illegal storage access. (Attempt to read from nil?)' when I try doing a `req.respond(..)`, using asynchttpserver.
14:28:42icyphoxAny ideas?
14:38:57*muffindrake quit (Quit: muffindrake)
14:46:08*haxscramper quit (Remote host closed the connection)
14:52:12*muffindrake joined #nim
14:56:38*Kaivo quit (Quit: WeeChat 2.8)
15:01:03Zevvso araq, I had a little chat with yardanico this morning; nim kind of misses a way to construct a ref object. When T is an object, you can't make a t like `new T(member: value, ...)`, you always need to make a new T first and then fill it in. Do you think we could put something like this in the stdlib: https://play.nim-lang.org/#ix=21cJ, with the new arc its basically one alloc and one copy
15:01:41Araqwhat's wrong with MyObj(field: value) ?
15:01:51Araqit works for MyObj = ref object too
15:02:17Zevvyeah but then you need to have a ref type
15:02:20disrupteki think he's talking about an obj and he wants a spontaneous ref version.
15:02:26ZevvI only have my object type and I want to make a ref
15:02:41Zevvlet t = new T; t.field = value
15:02:43disruptek(ref Obj)(...)
15:02:44Zevvthat's not so nice
15:03:38ZevvI like the let t = new Thing(field: value), it's kind of intuitive imho
15:04:13disrupteki think it's gratuitous.
15:04:23FromDiscord<lqdev> i'd prefer `let t = mkref T(a: b)` or something
15:04:25FromDiscord<lqdev> `new` is too generic
15:04:39disruptekwhen you want to hack on ast, you discover that fewer constructs is better.
15:05:20Zevvits just a teeny macro, which might get some magic to get rid of the copy, even, maybe
15:05:25Zevvbut fair enough
15:06:05*maier quit (Ping timeout: 240 seconds)
15:07:05Araqwell it's (ref Obj)(...) indeed, maybe we can add something to sugar.nim tho
15:07:28Araqsugar.create Obj(...)
15:07:36Zevvsweet, I'll PR something that can be bikeshedded into oblivion
15:07:43Zevv:)
15:07:52Araqalright
15:08:40disrupteknewref
15:08:54FromDiscord<lqdev> Zevv: https://play.nim-lang.org/#ix=22WA
15:09:04Zevvwrong order. first i pr, *then* you bikeshed
15:09:06FromDiscord<lqdev> feel free to steal
15:10:16Zevvlqdev how is that different from https://play.nim-lang.org/#ix=21cJ
15:10:43FromDiscord<lqdev> yours is more flexible.
15:10:54FromDiscord<lqdev> reading your description, I thought you wanted a macro.
15:11:04Zevvnah, I want to construct new refs
15:11:19ZevvI almost never want a macro.
15:11:37disrupteklol
15:12:45disruptekit's a lot of code to add parenthesis.
15:13:00alehander92<3
15:13:32alehander92syntax sugar
15:14:02disrupteki can't believe i'm going to have to write a test framework.
15:14:28*maier joined #nim
15:15:03disruptekit just seems impossible that there isn't someone smarter that isn't equally annoyed.
15:16:08*Zevv quit (Quit: Lost terminal)
15:16:56FromDiscord<Technisha Circuit (LGBTQIAP+)> Is there a way for me to use all of Nim's built-in types in C?
15:16:57*Zevv joined #nim
15:17:07FromDiscord<Technisha Circuit (LGBTQIAP+)> Uh- Asking for a friend-
15:17:12disruptekwhy?
15:17:34FromDiscord<Technisha Circuit (LGBTQIAP+)> Because a friend is curious-
15:17:36FromDiscord<Technisha Circuit (LGBTQIAP+)> ~~I am my own friend-~~
15:17:58disruptekyou're curious, all right.
15:18:07FromDiscord<Technisha Circuit (LGBTQIAP+)> Lmao
15:18:37FromDiscord<lqdev> ~~curiosity killed the cat~~
15:18:37FromDiscord<Technisha Circuit (LGBTQIAP+)> It's mainly because I'm an idiot, I'm wondering if i could use Nim modules that use Nim types in C
15:18:52FromDiscord<Technisha Circuit (LGBTQIAP+)> ~~Who said i wasn't already dead?~~
15:19:06disruptekof course.
15:19:26*maier quit (Ping timeout: 240 seconds)
15:19:29FromDiscord<Technisha Circuit (LGBTQIAP+)> (edit) removed 'in C'
15:19:46FromDiscord<Technisha Circuit (LGBTQIAP+)> (edit) 'types' => 'types, in C'
15:20:12FromDiscord<Technisha Circuit (LGBTQIAP+)> How would i use Nim types in C though? That's the question that needs to be answered first
15:20:39disruptekexport them.
15:20:39disruptek~manual
15:20:39disbotmanual: 11the Nim Manual is https://nim-lang.org/docs/manual.html -- disruptek
15:20:54FromDiscord<Technisha Circuit (LGBTQIAP+)> Thanks!
15:22:05disrupteki really don't understand why we don't have a plethora of emojis for software engineering.
15:23:08*NimBot joined #nim
15:23:46Zevvlike cutlery
15:24:11Zevvvalid point. Clones, forks, repos, branches
15:25:03ZevvI have an idea! We could maybe make groups of existing emojis to represent concepts
15:25:11Zevvor other unicode points
15:25:31Zevvhmm for max portability we could choose them from page 1
15:25:48Zevvlike the combination of 'f', 'o', 'r', and 'k' could mean something like "fork"
15:25:51disruptekZevv: i will kill you.
15:25:56Zevvgee am I smart
15:26:19FromDiscord<exelotl> Let's use ligatures for it! Kappa
15:26:23disrupteki will kill you with 🍴.
15:26:51disruptekmaybe i'll garrot you with 🧵 or 🧶.
15:27:03Zevvwith <empty square> or <emtpy square>
15:27:31disrupteki know these are all □ to you.
15:28:11Zevvunicode point 0x512b31 LITTLE_GREEN_OPEN_SQUARE
15:31:53FromDiscord<lqdev> ↑↓←→
15:33:00*narimiran_ is now known as narimiran
15:43:10*filcuc quit (Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/)
15:50:49*fvs joined #nim
15:53:49*fvs left #nim (#nim)
16:01:17FromDiscord<exelotl> If I have a fixed-point number type that should have a custom conversion to int, but not an implicit converter, is it OK to do ``` proc `int`(a: Fixed): int = ... ```
16:03:06disruptekwut
16:07:38FromDiscord<exelotl> If I do: ```nim↵let a: Fixed = fp(1.0)↵echo a.int```↵it prints 256 because it basically does a raw cast (Fixed is a distinct int with 8 fractional bits)
16:08:26FromDiscord<Clyybber> I think so yeah
16:08:26FromDiscord<exelotl> Currently I have a toInt() proc which does the correct conversion (shift by 8 places)
16:08:36FromDiscord<Clyybber> I like your approach
16:09:02FromDiscord<Clyybber> Oh, wait, does it not call the proc?
16:09:13FromDiscord<exelotl> It does, if I define it
16:09:16FromDiscord<Clyybber> k
16:09:27FromDiscord<exelotl> I just didn't realise I could do it until just now xD
16:09:30disruptekto me it's too magical.
16:09:46FromDiscord<Clyybber> I think maybe we should document this to be the canonical way of implementing explicit converters
16:10:00FromDiscord<Clyybber> disruptek: Less magic than implicit converters :)
16:11:55FromDiscord<exelotl> Yeah I think its worth it, after all Nim's type conversions are supposed to be human friendly, if you want to do a raw cast, use cast[]()
16:13:55FromDiscord<exelotl> My friend got tripped up wondering why `.int` was returning 256 yesterday, and it seemed really wrong that I had to explain that he should use `toInt` instead
16:14:52icyphoxhttps://github.com/nim-lang/Nim/issues/13866 -- this was fixed? i'm still facing this on 1.2.4
16:14:53disbotasynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG
16:17:56icyphoxwell, not the exact same example
16:21:27FromDiscord<Clyybber> disruptek: Why are Conts using inheritance?
16:32:05FromDiscord<lqdev> @exelotl you don't need to strop `int`, it's not a keyword
16:36:41*opDispatch quit (Quit: Konversation terminated!)
16:37:09*gsingh93 quit (Quit: ZNC - http://znc.in)
16:42:35icyphoxoh wow, had to set newHttpHeaders() for it to work
16:42:41icyphoxthis is probably an issue...
16:45:01disruptekclyybber: i might be able to optimize cloning them more easily, and it allows the user to extend them. it's currently broken in any event.
16:45:40disruptekicyphox: sounds like it.
16:46:15icyphoxdisruptek: yeah i'll open an issue in a bit
16:46:31icyphoxluckily for me, i did have to set http headers
16:46:33icyphoxso it's ok
16:46:37FromDiscord<tomck> what're my options for debug-printing an object?
16:46:44FromDiscord<tomck> 'echo' seems to not like arbitrary objects
16:46:47disruptekrepr
16:47:19FromDiscord<tomck> ahhhh brill ta
16:49:02disruptekclyybber: do you have a good reason not to inherit?
16:52:16FromDiscord<Clyybber> Performance, but I see that you are not using methods so its probably fine
16:52:53disruptekah, yeah.
16:53:00disruptekthat would be dumb.
16:53:04FromDiscord<Clyybber> disruptek: I'm seeing an issue `cps/environment.nim(199, 18) Error: type expected, but symbol 'env' has no type.` when trying to compile the readme example
16:53:14disruptekyeah, it doesn't work.
16:53:19FromDiscord<Clyybber> do you know why?
16:53:29disruptekyeah, it's not dumping all the types.
16:53:37disruptekthe test should work on HEAD.
16:53:52FromDiscord<Clyybber> weird, pretty sure I just cloneda few minutes ago
16:54:01disruptekthe test.nim, i mean.
16:54:32FromDiscord<Clyybber> oh, sure test.nim works
16:54:33disrupteki'm moving the types to get cached in the env.
16:55:12disruptekmaybe you can figure out why i cannot use an Empty in the proc prototypes.
16:55:36FromDiscord<Clyybber> ok
16:55:59disruptekfirst thing i would look at is the child count of the ast.
16:56:01FromDiscord<Clyybber> What I wonder though, why are we not getting "undeclared identifier "env" then?
16:56:11disruptekwhen?
16:56:20FromDiscord<Clyybber> When compiling the readme example
16:56:53disruptekit's a gensym.
16:57:03disruptekso it's a valid symbol, just not one with a type.
16:57:30disruptekwhat's happening is that we have a second env being generated but not output.
16:57:45FromDiscord<Clyybber> Yeah
16:57:51disruptekone has the proc params and the next has more of the env.
16:57:58FromDiscord<Clyybber> Ah ok!
16:58:08FromDiscord<Clyybber> But wait
16:58:16FromDiscord<Clyybber> We generate a typedef with the env symbol
16:58:21FromDiscord<Clyybber> then we don't put it in the result
16:58:26FromDiscord<Clyybber> but we still use the symbol
16:58:34FromDiscord<Clyybber> I guess the error is kinda appropriate then
16:58:38disruptekyeah.
16:58:41FromDiscord<Clyybber> I wonder if it could be better tho
16:58:54disruptekit could be more descriptive.
16:58:58FromDiscord<Clyybber> yeah
16:59:25disrupteki mean, it makes sense to me, but if a user gets it they are going to be pretty damned confused.
16:59:57disruptekthis project has a lot to teach me about testing.
17:03:02*xet7 quit (Quit: Leaving)
17:03:26FromDiscord<ShalokShalom> Can somebody explain me, where I find the source code of the tutorials?
17:03:27FromDiscord<ShalokShalom> https://github.com/nim-lang/website/tree/master/jekyll
17:06:23FromDiscord<ShalokShalom> It seems to be not there. I run local find tools on the cloned source, it seems to be not there.
17:06:38disruptekmaybe it's generated.
17:07:10FromDiscord<ShalokShalom> by?
17:07:22FromDiscord<ShalokShalom> Isnt all in Jekyll generated?
17:07:34*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
17:07:46disruptekhow should i know?
17:07:49disrupteki don't even work here.
17:07:56disruptekask that guy over there with the nametag.
17:15:22*maier joined #nim
17:19:04*lritter joined #nim
17:20:46*maier quit (Ping timeout: 260 seconds)
17:27:03*jken quit (Quit: ZNC - http://znc.in)
17:28:54*risorg23 joined #nim
17:31:08FromDiscord<Yardanico> @ShalokShalom you mean in learn?
17:31:11FromDiscord<Yardanico> It's all Nim doc
17:33:02solitudesfhttps://github.com/nim-lang/Nim/blob/devel/doc/tut1.rst
17:33:56FromDiscord<Yardanico> It's all RST?! 🔫 Always has been
17:37:34FromDiscord<ShalokShalom> @Solitudesf: thanks a lot
17:37:54FromDiscord<ShalokShalom> @Yardanico Yes, and its in a completely different repo.
17:38:23FromDiscord<Yardanico> ???
17:38:29FromDiscord<Yardanico> It's in the main Nim repo
17:38:51FromDiscord<Yardanico> It's not a part of the website really, and it's generated with Nim docgen
17:39:46FromDiscord<ShalokShalom> It is totally part of the website.
17:41:51FromDiscord<Yardanico> I mean it's in reality standalone - you don't need any of website sources in the website repo to generate it
17:42:16FromDiscord<Yardanico> All module documentation, tutorials, manual - everything is docgen
17:43:03*Jesin quit (Quit: Leaving)
17:43:55FromDiscord<KingDarBoja> Yesss
17:45:13FromDiscord<『Bimbo』> I'm trying to write a simple game and i'd like to know how to represent something like a game tile in a matrix in types↵i.e the tile is either empty, a body part, or food in the case of a snake game
17:45:59FromDiscord<Yardanico> We have <#706542664643772436> just for your information ;) and for your case enums might just work?
17:46:12FromDiscord<『Bimbo』> oh right.. sorry about that
17:46:29FromDiscord<Yardanico> if you know the size of the matrix, use an array, and for values you can create an enum and use its values
17:48:44FromDiscord<『Bimbo』> I'll try it out, thanks!
17:54:55*Jesin joined #nim
17:54:59*marnix quit (Ping timeout: 240 seconds)
18:03:24*hyiltiz quit (Remote host closed the connection)
18:04:26*haxscramper joined #nim
18:04:30*hyiltiz joined #nim
18:06:34FromDiscord<lqdev> otherwise you can use a seq
18:07:10FromDiscord<lqdev> the most efficient way to store that would be just a flat `seq[Tile]`. then you index it using `tiles[x + y * width]`
18:07:30haxscramperIs heavy use of `mixin` a good idea? It is not used really often in main nim repo (quick `rg mixin` gives only 72 occuriencies) - are there some edge cases or scenarios where it should be avoided?
18:08:02FromDiscord<lqdev> haxscramper: it's more like, `mixin` was designed to battle edge cases that cause ordinary symbol resolution to fail.
18:08:09FromDiscord<lqdev> so you shouldn't really avoid it.
18:08:35FromDiscord<lqdev> it's used when you need to mix in a symbol from the callsite in a template or generic proc
18:08:49FromDiscord<lqdev> and that's really the only time you need to use it
18:09:00haxscramperBecause lately I constantly find myself in situation where generic symbol resolution fails and I just started throwing `mixin` everywhere.
18:09:12FromDiscord<lqdev> it's fine
18:09:25FromDiscord<lqdev> use it whenever you need to access symbols from a template/generic proc's callsite
18:19:35*marnix joined #nim
18:34:47reversem3So I'm playing around with fidget UI lib right now and came across an error loading a font
18:35:13*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/ztTXnPBNDrwzQwwsCHxbBeCW >
18:36:51reversem3the function is loadFont found here https://github.com/treeform/fidget/tree/master/examples/padofcode/
18:37:06FromDiscord<Yardanico> Make sure you're launching it from the correct path
18:37:20FromDiscord<Yardanico> I think it's relative to the binary
18:37:32reversem3The font is in the root directory of the file
18:37:37FromDiscord<Yardanico> Or to the folder you compiled it from, don't remember now
18:37:43FromDiscord<Yardanico> @treeform ^ :P
18:39:34reversem3if parser.nim works I should be able to import it via inim right
18:39:44reversem3to test it ?
18:41:54reversem3so basically the compiler is not finding the binary parser in .nimble/pkgs directory?
18:43:37FromDiscord<Yardanico> Wdym?
18:45:55*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/pRFExyTWnNFvPUQUcEaUWrre >
18:46:28FromDiscord<treeform> @reversem3[IRC], sorry the font needs to be in the `data` directory
18:46:32reversem3pathofURL or dataDir right
18:46:48FromDiscord<treeform> the `data` directory is needed so many platforms require packaging of assets.
18:47:13FromDiscord<treeform> dataDir i think points to `data`
18:47:22reversem3dataDir , just create a new directory and put the font in it ?
18:47:25FromDiscord<treeform> see how most of the examples do it
18:47:40FromDiscord<treeform> yeah just have data dir next to your nim file
18:47:49reversem3oh , I thought that was just for organization , ok I see it
18:47:54reversem3thanks
18:58:13*xet7 joined #nim
18:59:15*haxscramper quit (Ping timeout: 256 seconds)
19:05:00ForumUpdaterBotNew thread by Snej: Avoiding RangeError getting address of empty seq, see https://forum.nim-lang.org/t/6575
19:07:11*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/cnxQyMcwCElatBmMqemyFpOb >
19:08:50reversem3so I have updated to the latest nim 1.24 and created a directory called data and put the *.ttf file inside the directory , the program compiles just fine but when I try to run it I get this error. I only get these errors from importing font files
19:10:05disruptekclyybber: tock.nim finally works. 😉
19:11:53reversem3this is weird though when I run a sample fidget program "objc[98577]: Class zmAppHelper is implemented in both /Library/ScriptingAdditions/zOLPluginInjection.osax/Contents/MacOS/zOLPluginInjection (0x11201a168) and /Library/Application Support/Microsoft/ZoomOutlookPlugin/zOutlookPlugin64.bundle/Contents/MacOS/zOutlookPlugin64 (0x11218bf78). One of the two will be used. Which one is undefined.
19:11:53reversem3objc[98577]: class `ERCalendarEventEditorWindowController' not linked into application"
19:16:12*maier joined #nim
19:18:59FromDiscord<ShalokShalom> sent a long message, see http://ix.io/28fO
19:19:58FromDiscord<Yardanico> Not sure, documentation is good but sometimes too much documentation isn't that good
19:20:08FromDiscord<Yardanico> You might PR to the readme of the website repo of you feel so
19:21:00reversem3ok so what does tables.nim in this line mean for getting a key?
19:21:01*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/RaYymbKsciHgFwigspxczIVT >
19:21:39FromDiscord<Yardanico> You shouldn't use that
19:21:49*maier quit (Ping timeout: 264 seconds)
19:22:11FromDiscord<Yardanico> You should only use exported symbols
19:22:18reversem3I'm not directory that one of the errors I get trying to run a fidget app
19:22:41reversem3 * I'm not directly , that is one of the errors I get trying to run a fidget app
19:22:57*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/zYaeqLPbnyvLWgkjJhqrClLi >
19:23:11reversem3 ./.choosenim/toolchains/nim-1.2.4/lib/pure/collections/tables.nim(262) []
19:23:58*Senketsu joined #nim
19:24:09reversem3Instead of spamming the chan I will just write up issues , but I just wanted to make sure its wasn't me doing something wrong
19:32:20FromDiscord<Varriount> Hm, what's fidget? I vaguely recall something mentioning that.
19:32:31FromDiscord<lqdev> treeform's UI framework
19:32:44FromDiscord<treeform> my UI framework
19:34:01FromDiscord<treeform> I want to rethink how we programmer do UI stuff. I think there is a room for a paradigm shift. But it's not too crazy. Here is a video about it: https://www.youtube.com/watch?v=IB8Yt2dqZbo
19:34:43reversem3its really cool , just getting some errors trying to run it
19:35:06FromDiscord<treeform> its also is really alpha
19:35:12FromDiscord<ShalokShalom> I love that also, just prefer open source stuff at the backend
19:35:14reversem3even the code is easy to follow
19:35:36reversem3I get it
19:35:41FromDiscord<lqdev> @ShalokShalom it is open-source at the backend, though
19:36:08FromDiscord<ShalokShalom> It relies on a closed source project
19:36:14FromDiscord<lqdev> it doesn't rely on it
19:36:21FromDiscord<lqdev> you can just as well use fidget without figma
19:36:23FromDiscord<ShalokShalom> Well, effectively it does
19:36:35FromDiscord<ShalokShalom> And then its no paradigm shift anymore
19:36:39FromDiscord<lqdev> figma is just an addition to make it easier to work with fidget
19:36:52FromDiscord<ShalokShalom> Its not "draw your own ui" anymore
19:37:01FromDiscord<ShalokShalom> And this is exactly what I am interested in
19:37:18FromDiscord<lqdev> noone prevents you from using fidget without figma, dude.
19:37:26reversem3treeform are you using stable or devel version of nim c ?
19:37:28reversem3I have tried both so far
19:37:36FromGitter<alehander92> his explanation is more subtle lqdev
19:39:01FromDiscord<ShalokShalom> > noone prevents you from using fidget without figma, dude.↵@lqdev That point can also be made about Nim and C. You can use C without Nim, while that is missing the point.
19:39:18FromDiscord<ShalokShalom> It is just a sneaky way to "win" the argument
19:39:34FromDiscord<Solitude> no, thats not the point
19:39:48FromDiscord<ShalokShalom> That kind of stuff is the reason why people dont take such attempts as serious as they deserve
19:40:08FromDiscord<ShalokShalom> Just say you hard depend on a non free software and be honest about it
19:40:14reversem3@treeform do you want me to write up an issue or leave it because its alpha ?
19:40:21FromDiscord<lqdev> i get what you mean, figma is fidget's main selling point. but someone can write an open-source designer that emits fidget code
19:40:24FromDiscord<ShalokShalom> What the author of fidget is, in this case.
19:40:31FromDiscord<Solitude> but it LITERALLY doesnt hard depend on non free software
19:40:31FromDiscord<ShalokShalom> Sure
19:40:44FromDiscord<ShalokShalom> But until, it is effectively depending on it
19:41:01FromDiscord<lqdev> i'm fine writing my UIs by hand, without a designer
19:41:02FromDiscord<Solitude> you sure are master of research
19:41:11*Senketsu quit (Read error: Connection reset by peer)
19:41:17FromDiscord<lqdev> thus, fidget doesn't depend on figma.
19:41:19FromDiscord<ShalokShalom> Not really saying that it is not interesting, worth exploring and promising
19:41:21FromGitter<alehander92> just use TUI-s guys
19:41:24FromGitter<alehander92> like the good old 80s
19:41:34FromDiscord<ShalokShalom> Just that it not interesting to me, until it is.
19:41:40*Zectbumo joined #nim
19:41:44*bung joined #nim
19:41:54reversem3yeah right , say that to normal users
19:42:04FromDiscord<ShalokShalom> > i'm fine writing my UIs by hand, without a designer↵@lqdev Yeah, I am also.
19:42:16FromDiscord<ShalokShalom> QML and tons of others already offer that
19:42:28FromDiscord<ShalokShalom> Where do you see the benefit of fidget there?
19:42:28FromDiscord<Varriount> @alehander42 What would be neat is a desktop TUI interface.
19:42:42FromDiscord<lqdev> @ShalokShalom it's a different paradigm
19:42:44FromGitter<alehander92> what does that mean
19:42:59FromDiscord<ShalokShalom> Yeah, is it declarative?
19:43:02FromGitter<alehander92> something like iterm?
19:43:12FromGitter<alehander92> iwm*
19:43:17FromDiscord<ShalokShalom> > yeah right , say that to normal users↵@reversem3[IRC]#0000 what do you mean?
19:43:36reversem3<alehander92> just use TUI-s guys
19:43:52FromDiscord<lqdev> @ShalokShalom it's kind of like immediate mode UIs. you just write UIs using regular imperative code and not tonnes of objects
19:44:03FromDiscord<ShalokShalom> Thats nice
19:44:05FromGitter<alehander92> xmonad ? i really forgot the name of it
19:44:19reversem3meaning regular users would not like a TUI , or CLI based
19:44:29FromDiscord<ShalokShalom> You can have both
19:44:45reversem3true
19:44:48FromDiscord<ShalokShalom> KWin offers half a dozen of scripts to make it a tiling wm
19:44:55Zevvxmonad++ !
19:45:04reversem3swaywm
19:45:27FromDiscord<lqdev> i3.
19:45:42reversem3I like swaywm because it runs on wayland
19:45:59ZevvWow my xmonad.hs started in 2007, it's that old already
19:45:59reversem3swaywm + qutebrowser + kitty term = FTW
19:46:14FromDiscord<lqdev> i don't like swaywm because it runs on wayland
19:46:20FromDiscord<lqdev> and wayland is quite young for now
19:47:01superbiaok boomer
19:47:42FromDiscord<lqdev> ok i'll admit i'm just too lazy to switch.
19:48:29FromDiscord<ShalokShalom> https://youtu.be/Obzf9ppODJU
19:49:05FromDiscord<ShalokShalom> > @ShalokShalom it's kind of like immediate mode UIs. you just write UIs using regular imperative code and not tonnes of objects↵@lqdev do you have any example code?
19:49:35FromDiscord<ShalokShalom> Like, how would a small rectangle with some text in and a button look like or so?
19:51:40FromDiscord<Solitude> https://github.com/treeform/fidget#minimal-sample
19:51:46FromDiscord<lqdev> there's plenty of example code in the repository https://github.com/treeform/fidget
19:52:32FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/735585082533871626/Screenshot_2020-07-22-21-52-23-41.jpg
19:53:10FromDiscord<ShalokShalom> I think that is a clear difference
19:53:13FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/735585260187680868/Screenshot_2020-07-22-21-52-50-33.jpg
19:53:32FromDiscord<Solitude> yes, and?
19:53:37FromDiscord<ShalokShalom> Thanks for the examples
19:54:23FromDiscord<ShalokShalom> @Solitude which one would you think could a 6 year old do on her own?
19:55:02FromDiscord<Solitude> none
19:55:18FromDiscord<ShalokShalom> I am pretty sure you know a couple
19:55:22FromDiscord<ShalokShalom> I at least do.
19:55:31FromDiscord<Solitude> i really hope our tools dont target 6 year olds
19:55:39FromDiscord<ShalokShalom> I actually know a 5 year old who could the first.
19:55:51FromDiscord<ShalokShalom> Well, if they can work for them, they work for you
19:55:59FromDiscord<Solitude> no, thats a shitty logic
19:56:05FromDiscord<ShalokShalom> And even more importantly: They work for UX designers
19:56:06*risorg23` joined #nim
19:56:13FromDiscord<ShalokShalom> Who are not even coders on their own.
19:57:02FromDiscord<juan_carlos> Code examples are doing different things, you can not compare it visually.
19:57:16FromDiscord<ShalokShalom> A shitty logic is to defend a more complex, less mature and less supported tool with the argument that those things are a benefit.
19:57:30FromDiscord<ShalokShalom> @juan_carlos Those two things do something very similar
19:57:37FromDiscord<ShalokShalom> I specifically asked for it
19:57:40FromDiscord<Solitude> im certain you are trolling at this point
19:58:05FromDiscord<ShalokShalom> And I know qml good enough to see the pattern and how similar projects would look like.
19:58:15*risorg23 quit (Ping timeout: 272 seconds)
19:58:20FromDiscord<ShalokShalom> @Solitude You are free to do so.
19:58:32FromDiscord<Yardanico> *grabs popcorn*
19:58:42FromDiscord<juan_carlos> But Nim has a QML module on Nimble.
19:58:55FromDiscord<ShalokShalom> I just think its not really benefit to be negative towards progress.
19:59:00FromDiscord<ShalokShalom> @juan_carlos I know.
19:59:05FromDiscord<ShalokShalom> Thats the point.
19:59:36FromDiscord<ShalokShalom> (edit) 'benefit' => 'beneficial'
20:00:58FromDiscord<treeform> @reversem3[IRC], I think use current stable mostly.
20:01:09FromDiscord<Yardanico> Sometimes "progress" just makes things more complex without any clear benefit
20:04:57*hyiltiz quit (Ping timeout: 260 seconds)
20:05:19*hyiltiz joined #nim
20:05:20*hyiltiz quit (Changing host)
20:05:20*hyiltiz joined #nim
20:08:08YardanicoI guess it's time to give ircord a little bit of love
20:08:23Yardanicofix this reply thing
20:10:27*NimBot joined #nim
20:16:26YardanicoI guess it would make sense for replies from discord to IRC to strip the "quote" part?
20:16:31Yardanicosince there's no direct alternative to it in irc
20:16:41disruptekyeah.
20:16:52Yardanicobtw disruptek be proud
20:17:05YardanicoI use your block: break block thing in ircord
20:17:07Yardanicoalthough only once
20:17:19Yardanicowhen searching for mentions in the message when irc -> discord
20:17:24disruptekit's not mine, but okay.
20:17:33Yardanicowell I really didn't see anyone else use it :P
20:17:36Yardanicoas much as you did
20:17:50disruptekthey probably have a better solution.
20:21:29*marnix quit (Ping timeout: 258 seconds)
20:26:25FromDiscord<lqdev> Yardanico: I used to use block: break quite often when implementing algorithms
20:26:44Yardanicoah nice
20:27:18Yardanicoalso guess I'll be using regex for this reply thing (i'm already using nim-regex in ircord), because it will be more complicated to replace with npeg or strscans
20:31:25*Senketsu joined #nim
20:31:58Yardanicofirst version - >*[\s\w]@([\w]*)\[([\w]*)]#0000 :D
20:32:37Yardanicoah sorry >?[\s\w]*@([\w]*)\[([\w]*)]#0000
20:39:57FromDiscord<ShalokShalom> > Sometimes "progress" just makes things more complex without any clear benefit↵@Yardanico do you see it in this case or do you see that the current way is more complex?
20:41:27*superbia quit (Quit: WeeChat 2.9)
20:42:30YardanicoI meant that Fidget tries to not be very complex, it tries to make UI programming straightforward
20:46:33FromDiscord<ShalokShalom> But do you see it succeeding, in the example?
20:47:09FromDiscord<lqdev> I feel like the fidget example is much more straightforward
20:47:18FromDiscord<lqdev> it doesn't hide any complexity, unlike QML's Rectangle
20:47:32FromDiscord<lqdev> what does the Rectangle do? does it change layout? how is it really rendered?
20:47:48FromDiscord<lqdev> with fidget, you just see all of that straight away
20:49:22*narimiran quit (Ping timeout: 260 seconds)
20:52:35FromDiscord<ShalokShalom> QML renders, as it says
20:53:43FromDiscord<ShalokShalom> You just try to win a lost case.
20:54:17FromDiscord<lqdev> and you're fixated on one specific paradigm that is more complex than it needs to be
20:54:36FromDiscord<lqdev> programming is all about exploration
20:54:52FromDiscord<juan_carlos> Its just the way Fidget rolls.
20:54:52FromDiscord<lqdev> going by your mentality, we'd still be stuck on COBOL in 2020.
20:55:21FromDiscord<ShalokShalom> This is UI code
20:55:26FromDiscord<lqdev> *maybe* fidget isn't gonna work. but time will tell if that's true.
20:55:30FromDiscord<ShalokShalom> Cobol is logic
20:55:49*clemens3 quit (Quit: rebot)
20:55:53*apahl quit (Ping timeout: 272 seconds)
20:55:56FromDiscord<ShalokShalom> Ui code tends to get written by UI designers
20:56:05FromDiscord<ShalokShalom> So people without a background in CS
20:56:18FromDiscord<ShalokShalom> They go into a bar and order two beer
20:56:29FromDiscord<ShalokShalom> They dont give exact instructions to the barkeeper
20:56:40FromDiscord<treeform> well the fidget example sets up way more then just a rectangle
20:56:49FromDiscord<treeform> it sets up a window, a frame and 5 other rectangles
20:56:53FromDiscord<ShalokShalom> Casual people think in declarative terms
20:56:56FromDiscord<treeform> its not a 1:1 example
20:57:16*apahl joined #nim
20:57:17FromDiscord<ShalokShalom> @treeform I asked for a rectangle with a button
20:57:18disrupteksure, and prolog is a casual language.
20:57:23FromDiscord<ShalokShalom> This is what I got.
20:57:48FromDiscord<treeform> No that is not a rectangle with a button
20:57:52FromDiscord<ShalokShalom> @disruptek[IRC]#0000 Just because something is declarative, doesn't mean its good, usable or anything
20:58:08FromDiscord<ShalokShalom> @treeform You see the benefit of the qml example?
20:58:08disruptekwho said anything about that?
20:58:12*nikita` quit (Quit: leaving)
20:58:15FromDiscord<ShalokShalom> The clarity.
20:58:28Yardanico!seen zevv
20:58:28disbotZevv spoke in 12#nim 72 minutes ago 12https://irclogs.nim-lang.org/22-07-2020.html#19:45:59
20:58:52FromDiscord<treeform> @ShalokShalom yes QT example is pretty simple fidget one would look pretty much same?
20:58:54YardanicoZevv: sorry if you're busy - is there a way to make NPeg match everything but "<@" multiple times?
20:59:14FromDiscord<ShalokShalom> @disruptek[IRC]#0000 Because you made the point that Prolog is declarative and set this as an argument that it is "not casual."
20:59:15Yardanicobasically I want to parse "> any text\n <@!1293192312>"
20:59:30Yardanicoah hm even then it's a bit not correct
20:59:32FromDiscord<ShalokShalom> @treeform Would like to see that one
20:59:43Yardanicohrm
20:59:57disruptekwell, i'm done here.
21:00:02FromDiscord<lqdev> Yardanico: `1 - "<@"`?
21:00:11FromDiscord<lqdev> that matches one
21:00:12Yardanicofrom "> 1234 any text <@!192491294> <@!177365113899057152>" I want to get that ID inside
21:00:14Yardanicothe last one only
21:00:23FromDiscord<lqdev> more than that would be `*(1 - "<@")`
21:00:24Yardanicothere might be multiple mentions inside of the reply
21:01:56Yardanico@lqdev ah right forgot about 1 thing
21:02:06Yardanicoand didn't know you can use "-" with strins as well :P
21:02:10YardanicoI only thought it's for single chars
21:02:50FromDiscord<lqdev> from the readme: `P1 - P2` matches P1 if P2 does not match
21:03:41Yardanicoah maybe I can rework how it works, hm
21:04:27ZevvYardanico: yes
21:05:12Yardanicoso is it somehow possible to match a thing like "> something <@!177365113899057151> <@!177365113899057152>" (there can be as much of these <@! things) but I only want the number of the last one?
21:05:14Zevv*(1-"<@")
21:05:35Yardanicoyeah that works for my previous question
21:09:06Yardanicoah I think I made it work kinda
21:09:58Yardaniconot sure if it's the best but it works
21:10:01Yardanico"> " * *(*(1 - "<@") * "<@" * ?"!" * >(+Digit) * ">")
21:10:03Yardanicoxd
21:10:19Yardanicoand then I just get capture[^1].s
21:17:07*maier joined #nim
21:17:45*arecacea1 quit (Read error: Connection reset by peer)
21:18:17*arecacea1 joined #nim
21:20:13FromDiscord<exelotl> @lqdev oh thx that's good to know
21:21:44*maier quit (Ping timeout: 240 seconds)
21:23:29Zevvsorry, tonight was battlefield night, nit nim night
21:23:34Zevvstill need a hand Yardanico >
21:23:35Zevv?
21:23:41Yardaniconah I think I figured it out
21:23:47Yardanicoidk if it's the best way, but seems to work
21:23:51Yardanicoeven for rare edge cases
21:23:52Zevvperfect timing :
21:24:11Zevvwhat are you parsing?
21:24:21Yardanicodiscord replies
21:24:27Yardanicodiscord -> discord and discord -> irc replies
21:24:29Yardanicoto strip the quote part
21:24:32Zevvah right
21:24:36Yardanicoand [IRC]#0000
21:24:48Zevvoh right I also use npeg for ircgraph :)
21:24:52Yardanicohttps://i.imgur.com/Z9U2xB0.png
21:25:04YardanicodiscordReply is
21:25:04FromDiscord<Varriount> Beautiful.
21:25:06Yardanico"> " * +(*(1 - "<@") * "<@" * ?"!" * >(+Digit) * ">") * ?("[" * serviceName * "]#0000")
21:25:14Yardanicomaybe it's not the best but it works :P
21:25:21Yardanicoeven for the rare case when the user is both on irc + discord
21:25:29Zevvyou are very talkative today: http://zevv.nl/div/irc.png
21:25:30Yardanicoso discord replaces the username with special discord id stuff
21:25:36FromDiscord<treeform> @ShalokShalom I think they look nearly identical:
21:25:37YardanicoZevv: haha
21:25:38FromDiscord<treeform> https://media.discordapp.net/attachments/371759389889003532/735608513006534716/unknown.png
21:25:45FromDiscord<Varriount> Yardanico: If you use variable interpolation & verbose mode regexes, they are much moree readable.
21:25:57YardanicoI mean it's not that it's not readable
21:26:01YardanicoIt's pretty understandable for me now
21:26:44Zevvbuilding pegs feels like writing forth to me
21:27:12Yardanicomatch "> ", match one or more of ((anything but "<@"), match "<@", optionally match "!" match and capture one or more digits, match ">"), optionally match "[" serviceName "]#0000"
21:27:24Zevvyou're typically accumulating a growing box of blocks that do small things, put them together into something larger. And two days after you written it, you have *no* clue what the hell you were thinking
21:27:29YardanicoXD
21:27:35Yardanicosame as writing perl? :D
21:27:48Zevvnah, has a different feel to it
21:27:57Zevvperl is more like, I donno, noodles
21:28:06Zevvand pegs and forth is like self contained thingies
21:28:18Yardanicomaybe I should fully switch to npeg, right now I (sorry) use nim-regex for some stuff
21:28:21FromDiscord<Elegant Beef> @treeform Yea, i agree they're very close, could get it 1:1 with a few aliases here and there 😄
21:28:39ZevvYardanico: when you have npeg, everything looks like a nail
21:28:44YardanicoXD
21:28:57Yardanicobut ircord is still pure nim :P it's not so performance critical
21:28:58Zevvit might be turing complete, so you will never need something else in your life
21:29:05FromDiscord<Varriount> Yardanico, Zevv: Behold, https://gist.github.com/Varriount/c74b32d19aaa484cacb2578d0d512658
21:29:13Yardanicomaybe I should look into patt
21:29:15Yardanicoof npeg
21:29:24Yardanicothe problem is that there's no simple way to "find and replace" with npeg
21:29:37Yardanicowhich I do right now for finding discord username mentions in irc
21:29:44ZevvVarriount: I think it's about as readable as npeg
21:29:47Yardanicoah sorry no I don't do that
21:29:50Zevv /unreadable/
21:30:00ZevvYardanico: nope, true
21:30:11YardanicoI mean I don't do it anyway :P
21:30:18YardanicoI think I can switch to patt in one place
21:30:29Yardaniconot sure about color stripping thing - I could set a no color mode for me via the channel mode
21:30:41Yardanicobut it's async so I don't have reliable way of telling when to send the command
21:30:43Yardanicoah wait actually
21:30:51Yardanicomaybe I can finally use the magic "once" template from system
21:30:57Yardanico(magic is sarcasm)
21:31:07ZevvI once tried once
21:31:10Zevvbut it ran twice
21:31:12Zevvbecause of threads
21:31:14Yardanicolol
21:31:14Zevvit lied
21:31:18Yardanicowell I have async
21:31:22Yardanicono need to worry about threads
21:31:37YardanicoI really feel dirty for using both nim-regex and npeg at the same time
21:31:54Yardanicoin the same program
21:31:57*Vladar quit (Quit: Leaving)
21:32:00FromDiscord<Varriount> Zevv: I am using Python + Nimterop to process a boatload of C headers, and wanted a DSL for the various transformations/directives.
21:32:05Zevvwho cares. I do nim and C and asm and JS in one program
21:32:21Zevvvarriount: it's horrendous
21:32:25Zevvand you know it
21:32:27FromDiscord<Varriount> I'm not using Nim because the os module's subprocess functionality makes me sad.
21:32:40Zevvyou're not alone
21:32:50Zevvthe problem is, to make that work properly, it needs to work with async
21:33:01Zevvcheatfate solved this
21:33:05FromDiscord<Varriount> Zevv: It is, but it took only slightly less time to write than an actual parser.
21:33:09FromDiscord<Varriount> 😛
21:33:23Zevvit's so bad that even the nim compiler can hang itself because of pipes filling up
21:33:48Zevvif you have nim code that generates tons of errors from the C compiler, 'nim c' will stall and break
21:33:52FromDiscord<Varriount> Zevv: To be fair, cross-platform subprocess interop is complicated.
21:34:00Zevvbecause it's waiting for the compile to finish, but it can't finish because it filled the pipe
21:34:12FromDiscord<Varriount> Like, if you ever look at Python's subprocess module, it's horrific.
21:34:14Yardanicothis is npegTrace of my current parser https://i.imgur.com/mLr9xiI.png
21:34:24ZevvVarriount: Yeah, i've heard about that. Cross platform. I should look that up one day
21:34:31ZevvYardanico: sweet
21:34:52Zevvthis really is the apex of my career. The npeg graphs
21:35:23Yardanicoactually I can put that [ serviceName #0000 into a separate pattern
21:35:30FromDiscord<Elegant Beef> I have 0 clue what im looking at but it's cool 😄
21:35:32FromDiscord<nero> those are some nice diagrams, is this generated by npeg? have to steal them
21:35:46Zevvnero: yes
21:35:53Yardanico-d:npegGraph
21:36:08Yardanicook now the patterns don't look that scary
21:36:11Yardanico"> " * +(*(1 - "<@") * "<@" * ?"!" * >(+Digit) * ">") * ?ircPostfix
21:36:22FromDiscord<nero> nice, started working on a ebnf to svg program but this looks way nicer
21:36:27Zevvwhat is so funny about these graphs: the code that composes the graph is almost similar to the code that composes the parser IR
21:36:35FromDiscord<Varriount> Zevv: https://github.com/python/cpython/blob/3.8/Lib/subprocess.py
21:36:56ZevvVarriount: I'm not surprised by the amount of code
21:37:12Zevvit's just too bad that Nim still has nothing similar
21:37:53Zevva good stdlib is *so* much work. I'm very impressed by the cohesion and structure of the golang stdlib. it's super tight
21:38:02*mbuchel quit (Quit: WeeChat 2.8)
21:38:04FromDiscord<Varriount> Zevv: Also, I gave up working with the os module when writing commandant, and just wrote my own wrapper: https://github.com/Varriount/commandant/blob/master/commandant/subprocess.nim#L162
21:38:20FromDiscord<Varriount> Zevv: It really is.
21:38:23Zevvmakes sense, I made a few of those
21:38:42FromDiscord<Varriount> I think I translated that implementation from some C code I found somewhere
21:38:55FromDiscord<Varriount> Well, and cleaned it up with templates and such
21:39:19Zevvit's basically the default way to do it. But really, to make this work nicely you need integrating with your stdlib native async I/O
21:39:36Zevvyou want to be able to chain pipes, read a pipe without it filling up, etc
21:39:45Zevvhave processes that run forever while consuming output
21:40:46FromDiscord<Varriount> Zevv: I've heard that D's subprocess module is really nice to work with: https://dlang.org/phobos/std_process.html
21:43:09Yardanicoah also Zevv, wanted to ask - I'm probably missing it from the readme, but what's the way to for example match Alnum + "_" ?
21:43:12Yardanicoordered choice?
21:43:37Zevvyes
21:43:43FromDiscord<Varriount> `Alnum | "_"`
21:43:43Yardanicoyeah figured it out thanks
21:43:45FromDiscord<Varriount> ?
21:43:47Zevvit's smart enough to figure out you're orring to charsets
21:43:56Zevvso it will just make a charset with Alnum and an extra bit set for '_'
21:45:02Yardanicohm, so I'm trying to port that simple regex (@[[:word:]]+)
21:45:07Yardanicobut let p = patt @("@" * +(Alnum | '_')) doesn't seem to work
21:45:12Zevvwhat does that mean?
21:45:13YardanicoI just need to find all "@mention" in a string
21:45:21Yardanicoah forgot to capture
21:45:23Yardanicodammit
21:45:32Yardanicolet p = patt @>("@" * +(Alnum | '_')) works
21:45:35YardanicoXD
21:45:42Zevvright
21:46:05Yardanicoah hmm but it doesn't seem to capture all
21:46:49Zevvit does
21:47:08Yardanicoecho p.match("@Yardanico hi @Yardanico hi").captures only shows one @Yardanico
21:47:17Zevvah
21:47:30Zevvyou're only searching for one
21:47:34Yardanicooh right
21:47:40Zevv* or + it
21:47:43Zevvthe whole thing
21:47:50Zevvlet p = patt +@>("@" * +(Alnum | '_'))
21:47:51Yardanicolet p = patt *@>("@" * +(Alnum | '_'))
21:47:57Yardanicoyeah thanks :P
21:48:01YardanicoI need zero or more
21:48:05Zevvbut really, you're writing unreadable stuff
21:48:08Yardanicowdym :D
21:48:19Yardanicostrscans doesn't work for this case really, it can't search
21:49:32Zevvhttp://ix.io/28Wh
21:50:12Zevvwithout the errors, it's about the idea of naming your stuff :)
21:50:26Yardanicowait what does the @"*" do here?
21:50:31Zevvno it's wrong
21:50:35Yardanicoah ok
21:50:37ZevvI didn't evne run it
21:50:40Yardanicoits okay
21:50:49Zevvn it's wrong
21:50:56Zevvnow it's ok: http://ix.io/28WB
21:51:11Zevvanyway, pick your poison
21:52:04Yardanicotime to test
21:52:11Zevvtime to sleep
21:52:21Yardanicogood night
21:52:22FromDiscord<ShalokShalom> @treeform thats cute
21:52:27Yardanicoits 00:52 here but I only recently woke up
21:52:34Zevvyou're a bad man
21:53:04Yardanicobed man*
21:53:19Zevvand your jokes are bad
21:53:23Yardanicoi know
21:53:25Yardanico:(
21:53:26*Cthalupa- quit (Ping timeout: 256 seconds)
21:53:28*Zevv waves goodby
21:53:51Yardanicowait it's all npeg? 🔫 always has been
21:55:29*Cthalupa joined #nim
21:55:32FromDiscord<Varriount> Anyone know what a '.in' file is? It appears to be used in the context of the C compiler (I suspect the linker)
21:56:12Zevvit's autoconf stuff
21:56:16ZevvMakefile.in, configure.in
21:56:25Zevvit goes through automake and autoconf
22:07:23Yardanicohmm I'm thinking on how to replace regex for stripping colour codes
22:07:35YardanicoI forgot /mode #channel +c is only for channel OPs and is set globally for the channel
22:07:41*Jesin quit (Quit: Leaving)
22:08:12Yardanicothere seems to be no way to tell freenode to not send colors to oneself specifically :P
22:09:16Yardanicodisruptek: you lied to me :P
22:09:33YardanicoI remember you saying that thing about /mode #channel +c but I thought it works for the bot
22:09:47disruptekit's likely i lied, but not about that.
22:09:56Yardanicowell how do you strip irc colors?
22:10:08Yardanicoin #nim for example
22:10:18disrupteki personally enjoy color.
22:10:53Yardanico~stream
22:11:00Yardanicoseems like you don't handle them at all :P
22:11:02Yardanico~stream
22:11:02disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat)
22:11:05*solitudesf quit (Ping timeout: 240 seconds)
22:11:06Yardanico~stream
22:11:09YardanicoXDD
22:11:22disruptekwhy would i strip them?
22:11:23FromDiscord<Avatarfighter> disruptek is live!?
22:11:26Yardanicono
22:11:35Yardanicohe wasn't live for a few months now I think
22:11:46FromDiscord<Avatarfighter> absolute scam http://prnt.sc/tmv3bg
22:12:03Yardanicomaybe I should stream instead
22:12:08Yardanicoas a substitute for disruptek
22:12:12Yardanico /s
22:12:33FromDiscord<Avatarfighter> lowkey I'm tempted to stream, I'm sure people would enjoy me rewriting everything 12 times in the span of an hour
22:12:46Yardanicoi streamed a bit of nim
22:12:57FromDiscord<Avatarfighter> or spending a day trying to use the endian lib only to ask in irc how it works lmfao
22:13:04disruptekyou guys don't watch me when i stream, anyway.
22:13:10Yardanicoi do
22:13:15FromDiscord<Avatarfighter> i do too
22:13:20FromDiscord<Avatarfighter> you're just never live when I do watch
22:13:22YardanicoI have freaking 30k points in your chat
22:13:25Yardanico30 THOUSAND
22:13:33FromDiscord<Avatarfighter> Mega fan
22:13:39YardanicoI have less points in forsen's chat
22:14:03Yardanico30000 / (12 * 50)
22:14:03FromDiscord<Avatarfighter> lmao
22:14:04disruptekweird, i thought it was only cool people that watched.
22:14:07FromDiscord<Avatarfighter> Nim > Forsen
22:14:09Yardanicomeaning I watched at least 50 hours of disruptek's stream
22:14:22Yardanicoof course I wasn't always active but still had his stream open
22:14:53disruptekwell, those days are over. i'm in the wilderness now.
22:15:23FromDiscord<Avatarfighter> stream the wilderness
22:15:34FromDiscord<Avatarfighter> overlay nim on the wilderness while streaming
22:15:58disrupteki have very, very little bandwidth here.
22:16:42disruptekmaybe i'll give it a shot tomorrow. might be able to juice up my network a bit.
22:18:39*apahl quit (Ping timeout: 244 seconds)
22:19:29*apahl joined #nim
22:20:15*Senketsu quit (Read error: Connection reset by peer)
22:29:53*Jesin joined #nim
23:11:30*krux02_ joined #nim
23:15:26*krux02 quit (Ping timeout: 260 seconds)
23:18:02*maier joined #nim
23:23:22*maier quit (Ping timeout: 256 seconds)
23:29:26*fredrikhr quit (Ping timeout: 260 seconds)
23:35:39Yardanicoargh
23:35:50Yardanicoguess I just need to write an irc -> markdown converter at this point
23:45:20*krux02_ quit (Remote host closed the connection)