<< 17-01-2022 >>

00:00:14*tk quit (Quit: Well, this is unexpected.)
00:00:38*tk joined #nim
00:00:41FromDiscord<Elegantbeef> Correct me if i'm wrong but isnt the issue the same even in C?
00:05:21arkanoidElegantbeef, no, you can use LGPL libraries inside closed source project, you just need to deliver LGPL'd source code. Dynamic linkage between closed source and LGPL one is suggested for this. To accomplish this, you include LGPL'd headers in closed source project and then dynamic link it
00:06:13arkanoidwith nim there are no separate headers and implementation, your compiled nim code includes all the nim dependencies, no matter the license
00:06:20FromDiscord<Elegantbeef> I meant that even in C you need the library author to support it, otherwise you have to make the headers?
00:06:58FromDiscord<Elegantbeef> I mean Nim still has the same capabilities, the author just needs to support it afaict
00:08:21arkanoidyes but when writing C you generally write headers .h and .c files separately, the main reason is that you use your own .h inside the project itself
00:09:12arkanoidso the library naturally support delivering headers and compiled binaries separately, just like any package and package-dev in any linux distro
00:10:24arkanoidfor example Qt is LGPL, you can link it dynamically with your closed source project, and deliver your project + sources of the linked Qt library
00:10:39FromDiscord<Elegantbeef> I mean get on the author is all i can say
00:10:45FromDiscord<Elegantbeef> Or do it yourself
00:14:30*noeontheend joined #nim
00:14:36arkanoidI'm curious on the second approach
00:19:06arkanoidActually, it's also important to find out if static linkage breaks the LGPL. It's a grey area apparently. If it is not, so using LGPL nim libraries into close-source nim projects should be possible, given that the original LGPL source (and possibly compiled .o) is delivered with it
00:21:24arkanoidthe other interesting thing to consider here, is if nim cache folder constains generated .c/.o files that are independently build from each used lib, so I can separate closed and lgpl generated C and object files
00:37:13arkanoidElegantbeef, I see that this problem is at least 6 years old https://news.ycombinator.com/item?id=8935842
00:42:11*vicecea quit (Remote host closed the connection)
00:42:41*vicecea joined #nim
00:42:56*noeontheend quit (Ping timeout: 250 seconds)
00:58:10FromDiscord<auxym> Wait, unless I'm missing something, you can dynamically link in nim too, using `{.dynlib.}`. You do have to generate header-like proc definitions that work sort of like headers. Manually or with c2nim.
01:02:59*Mister_Magister quit (Quit: bye)
01:04:40*Mister_Magister joined #nim
01:15:02*Lord_Nightmare quit (Ping timeout: 240 seconds)
01:15:10arkanoidauxym, sure, but that's something you do when FFI with C/C++
01:15:47arkanoidquestion is when you have a LGPL nim library that needs to be fulfilled with a closed-source nim application
01:16:45arkanoidjust by doing "import lgpllib" and compiling with default options, you're basically doing static linking from closed-source with lgpl, and that's ok
01:17:09arkanoidposting now in the forum to ask which options do I have
01:22:16*Lord_Nightmare joined #nim
01:23:32NimEventerNew thread by Giaco: How to dynamically link LGPL nim library to closed-source nim application?, see https://forum.nim-lang.org/t/8816
01:27:12FromDiscord<that_dude> sent a code paste, see https://paste.rs/vXh
01:31:01FromDiscord<Elegantbeef> does `runProc` return bool?
01:32:13FromDiscord<that_dude> yes
01:33:15*krux02_ quit (Remote host closed the connection)
01:33:38FromDiscord<Elegantbeef> do `echo repr wrapedMeat` and see what the AST is
01:37:15FromDiscord<that_dude> Are you sure you want this? Because this was just part of the macro
01:37:40FromDiscord<Elegantbeef> I dont want it
01:38:03FromDiscord<that_dude> I think it expands to like 600+ lines iirc
01:38:22FromDiscord<Elegantbeef> How the hell does that little bit of code expand to 600 lines
01:38:43FromDiscord<that_dude> https://media.discordapp.net/attachments/371759389889003532/932448816483938314/message.txt
01:38:56FromDiscord<that_dude> Not just the little bit
01:39:16FromDiscord<Elegantbeef> But it is just a little bit
01:39:17FromDiscord<that_dude> wrapped meat is basically the main part of the result
01:39:27FromDiscord<Elegantbeef> you literally create it there
01:39:41FromDiscord<Elegantbeef> put the echo write after the creation of the variable
01:39:47FromDiscord<that_dude> Good point
01:40:29FromDiscord<Elegantbeef> Side note why the hell are you using a template instead of a procedure for `inj_block-wrapper`
01:40:56FromDiscord<that_dude> because I was doing no calculations in there
01:41:11FromDiscord<that_dude> Wait
01:41:39FromDiscord<that_dude> fair point
01:41:58FromDiscord<that_dude> That said, I don't think it changes it too much rn. I'll write that down tho
01:43:17FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3MvW
01:44:14FromDiscord<Elegantbeef> That's not the `repr`
01:44:30FromDiscord<that_dude> not tree repr
01:45:16FromDiscord<that_dude> sent a code paste, see https://paste.rs/3ZQ
01:45:28FromDiscord<Elegantbeef> Well there you go
01:45:32FromDiscord<Elegantbeef> Your AST is 100% wrong
01:46:16FromDiscord<that_dude> Could you please elaborate? also I gtg for a bit so I'll read it then
01:46:21FromDiscord<Elegantbeef> You have an extra `inj_actions_default`
01:46:50FromDiscord<Elegantbeef> you're writing `if x: doThing() else: true; inj_actions_default.runProc()`
01:47:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MvZ
01:47:34FromDiscord<Elegantbeef> That's invalid AST
01:47:44FromDiscord<Elegantbeef> So it's going "hey true isnt handled"
01:57:22FromDiscord<leorize> lgpl only require you to allow relinking with different version of the same library
01:57:31*Lord_Nightmare quit (Ping timeout: 256 seconds)
01:58:19FromDiscord<leorize> so yes, you technically can statically link lgpl stuff, as long as your program can be obtained as a collection of objects to be linked, but no one does so in practice
02:03:16FromDiscord<leorize> arkanoid ^
02:04:04arkanoidleorize, thanks but my question is how and if this is currently possible with nim
02:06:04arkanoidI mean, if I build a nim project, I end up with many object files in cache folder. I can pack them and upload them and that's ok. But if someone wants to replace one of those object file with a different one build from a modified version of the original LGPL nim code, would it work?
02:16:47FromDiscord<that_dude> Damn. Thanks
02:21:10*Gustavo6046 joined #nim
02:24:40*neurocyte0917093 joined #nim
02:26:56*neurocyte091709 quit (Ping timeout: 250 seconds)
02:26:56*neurocyte0917093 is now known as neurocyte091709
02:30:50arkanoidI am testing custom finalizers using new(result,myFinalizer) with --gc:orc, but I see that some of my custom finalizers al called and some are not. If I do --expandArc:main I see that `=destroy`(objectWherecustomFinalizerIsNotCalled) and `destroy_1`(correctlyWorkingCustomFinalizer)
02:31:18arkanoidI'm checking that if works or not by echoing something in finalizer
02:32:49arkanoidwhat's the difference from `=destroy` and `destroy_1` ? why the second is working but the first is not my custom finalizer?
02:34:43FromDiscord<demotomohiro> Maybe finalizer is not much tested with orc or arc
02:35:31FromDiscord<demotomohiro> In arc/orc destructor seems better.
02:40:29arkanoiddemotomohiro, I'm talking about creating objects with https://nim-lang.org/docs/system.html#new%2Cref.T%2Cproc%28ref.T%29
02:43:10arkanoidlet me try to reduce this to a minimal test, I smell bug here
02:57:31arkanoiddemotomohiro, possibly a problem when using forward declarations
02:59:43*noeontheend joined #nim
03:01:05arkanoidjust spotted an internal error
03:20:49*arkurious quit (Quit: Leaving)
03:30:29NimEventerNew thread by Giaco: Unexpected behavior when using custom finalizers + ARC/ORC + RootObj, see https://forum.nim-lang.org/t/8817
04:17:47FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Mwk
04:18:07FromDiscord<Rika> well it says there no it doesnt
04:18:16FromDiscord<Rika> you could prollyg et it to work by derefing
04:18:22FromDiscord<Rika> refobj[].fieldPairs
04:19:58FromDiscord<ajusa> Ah wasn't sure if ref object counted as an object type, I'll try deferencing
04:20:32FromDiscord<Rika> they do not
04:20:49FromDiscord<Elegantbeef> Ref can be anything
04:21:13FromDiscord<Elegantbeef> `ref int` for instance isnt an object 😛
04:50:02*noeontheend quit (Ping timeout: 240 seconds)
04:57:47arkanoidwhy can't I declare a destructor for ref type?
04:58:12arkanoidError: signature for '=destroy' must be proc[T: object](x: var T)
05:03:22FromDiscord<Elegantbeef> I dont recall why they cannot, but i do remember there was a workaround
05:03:31FromDiscord<Elegantbeef> I dont recall what that is either 😀
05:06:33arkanoidgot my answer: https://forum.nim-lang.org/t/4132#25743
05:07:45arkanoidbut now I am not sure if I should create non-ref type for each "ref type of RootObj" and declare `=destroy`, or I should stick with finalizer
05:08:31FromDiscord<Elegantbeef> You can also do the ugly way but yea
05:10:38arkanoidElegantbeef: apparently the ugly way does not even work https://play.nim-lang.org/#ix=3Mwv
05:11:38FromDiscord<Elegantbeef> Are you using `arc/orc`?
05:11:46arkanoid(is it possible to compile with arc in play.nim-lang?)
05:11:51arkanoidyes, offline I'm using arc
05:12:00FromDiscord<Elegantbeef> No it's not
05:12:49arkanoidoh, wait, I was editing the wrong config.nims, now it works
05:13:43arkanoidit works also with refc + GC_fullCollect
05:13:46FromDiscord<Elegantbeef> If you dont want the `FooObj` approach you can do https://play.nim-lang.org/#ix=3Mwx
05:14:24arkanoidwhat a ninja trick!
05:14:45FromDiscord<huantian> is there a mod I can dm about possible scammers
05:14:50arkanoidbtw, I think I've just found that finalizers are flawed
05:15:14FromDiscord<Elegantbeef> You can ping Yardanico, Pmunch, Impbox
05:15:20FromDiscord<huantian> kk
05:31:37arkanoid=destroy seems not called on parent objects
05:32:32arkanoidhttps://play.nim-lang.org/#ix=3MwA
05:33:50FromDiscord<Elegantbeef> Yea this makes sense
05:34:11FromDiscord<Elegantbeef> `object of FooObj` does not inherit anything but fields
05:35:23FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3MwB
05:36:07FromDiscord<Elegantbeef> If you want to make it less tedious you could probably use https://github.com/beef331/oopsie s `super`
05:38:08FromDiscord<huantian> Yet another amazingly named package by beef
05:38:27FromDiscord<Elegantbeef> If i have any skill it's coming up with names
05:38:46FromDiscord<Elegantbeef> Someone had a chess + card game they wanted a name for and my first name was "deckmate"
05:41:37arkanoidwhat do you mean with "`object of FooObj` does not inherit anything but fields" ? How this imply not calling super destructor?
05:42:12FromDiscord<Elegantbeef> I dont know if it's a bug or intended but it's a distinct type
05:42:26FromDiscord<Elegantbeef> As such calling base procedures is an explicit operation unless there is an overload
05:42:57FromDiscord<Elegantbeef> Like if you remove the destroy for `BarObj` it outputs the `Foo` message
05:44:15FromDiscord<huantian> Wonder if making destroy a method works
05:45:33arkanoidyeah, I do confirm that removing destroy would execute the destroy of the parent class, but while that's working with =destroy, it is not with finalizers
05:45:41FromDiscord<Elegantbeef> Nah the issue i think is you're overloading or overridding destroy
05:47:08FromDiscord<Elegantbeef> I've never used a finalizer so no comment
05:47:39arkanoidcheck here, n = 2: https://play.nim-lang.org/#ix=3MwE
05:48:10FromDiscord<Elegantbeef> Yea of course it'd never call the other one
05:48:14FromDiscord<Elegantbeef> You afterall pass in the procedure in
05:48:37arkanoidis there another way to link a finalizer?
05:48:46FromDiscord<Elegantbeef> `proc new[T](a: var ref T; finalizer: proc (x: ref T) {.nimcall.})` the type def is this
05:48:59FromDiscord<Elegantbeef> Well you''d have to manually call the base
05:49:05arkanoidI'm not trying to be picky, I just need to find the correct way fo fix a lib while maintaining backward compatibility
05:49:41FromDiscord<Elegantbeef> Yea i understand i'm just explaining why it's behaving as it is
05:49:48arkanoidI've just found that finalizers won't work with forward declaraction
05:49:58FromDiscord<Elegantbeef> The finalizers dont even have to match name, hell they can be anonymous
05:50:39FromDiscord<Elegantbeef> They do
05:50:52FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3MwF compiles fine
05:53:15FromDiscord<Elegantbeef> Anyway you slice it you'll have to call the base finalizers, you could make a `newFinalized` macro which propagates up seeing if there is a finalizer calling it if possible
05:54:02FromDiscord<Elegantbeef> Which isnt that complex thanks to super being able to get parent objects 🙂
06:03:34arkanoidElegantbeef, check here for example of internal error + silent skip finalize cases for ARC https://forum.nim-lang.org/t/8817
06:03:47arkanoidif you think is a bug, I should move it to new github issue
06:05:18*DeluxeSk8rBird joined #nim
06:05:28FromDiscord<Elegantbeef> Where's the internal error?
06:07:52FromDiscord<Elegantbeef> I mean an internal error is always a bug
06:08:12FromDiscord<Elegantbeef> The compiler never should create an internal error with the exception of things like macros doing stupid things i'd guess
06:10:05FromDiscord<leorize> even that shouldn't create an internal error
06:10:24FromDiscord<Elegantbeef> Agreed, but it's the case where you can do the most fuckery
06:10:53FromDiscord<Elegantbeef> I more just mean it's a bit more acceptable for confuckery of macros to have an internal error versus non fancy user code
06:11:06FromDiscord<Elegantbeef> Like it's still an issue but it's a more understandabel
06:11:39FromDiscord<Elegantbeef> Peak beefism, incorrectly writing understandable
06:14:16arkanoidhaha
06:16:36arkanoidwell, here's the shortest version that goes internal error: https://play.nim-lang.org/#ix=3MwO
06:16:53arkanoid(with --gc:arc, it goes ok with refc)
06:18:15FromDiscord<Elegantbeef> Odd
06:20:29arkanoidand here another case where finalizer is not called: https://play.nim-lang.org/#ix=3MwP
06:21:39FromDiscord<Elegantbeef> The odd thing is this doesnt error https://play.nim-lang.org/#ix=3MwQ
06:21:42FromDiscord<Elegantbeef> So it's purely with relation to the finalizer magic
06:24:36arkanoidI'll add this to the list of things that are pushing my willing to use nim for large work project out of scope
06:26:23FromDiscord<Elegantbeef> I personally dont see why this is an issue but ok
06:26:49FromDiscord<Elegantbeef> Forward declaring the finalizer doesnt make any sense to me right now
06:27:26arkanoidElegantbeef, I reached this bug why spending quite some time finding out why my nimqml based application was leaking, I ended up with this. It took many hours so yes, it is a problem
06:29:13arkanoidbut silent skipping it is even worse, here the nimqml developer went the wrong way adding many leaks depending on the use of forwarding proc or not for finalizer https://github.com/filcuc/nimqml/commit/aaab5dbae4ae5c22d7aab67635f24c54a7f369f6#diff-1dc629e086d3454f1196ccfcc3f365fccc444ab3d70710bd3dd211b5221413b3
06:29:16*Doraemon joined #nim
06:30:06FromDiscord<Elegantbeef> "silent skipping"?
06:31:00arkanoidyes, like here https://play.nim-lang.org/#ix=3MwP
06:31:39arkanoidcode compiles, works ok for refc, skips `delete` call completely with arc, this only when using forward proc
06:31:45FromDiscord<Elegantbeef> Of course it's an issue
06:31:46*NeoCron quit (Ping timeout: 250 seconds)
06:31:57FromDiscord<Elegantbeef> I dont get why anyone would forward declare these like this
06:32:21arkanoidhttps://github.com/filcuc/nimqml/blob/master/src/nimqml/private/constructors.nim
06:33:33arkanoidfor example the nimqml dev preferred to include all the code instead of import, so he ended up with that software architecture https://github.com/filcuc/nimqml/blob/master/src/nimqml.nim
06:33:54FromDiscord<Elegantbeef> I see
06:34:10FromDiscord<Elegantbeef> I'll go back to my previous statement
06:34:44FromDiscord<Elegantbeef> It is indeed an issue that it doesnt work, but jesus this is some code
06:36:08arkanoiddo you think that code smell?
06:36:29arkanoidI have no clue, I just think it is a C++ pattern
06:36:32FromDiscord<Elegantbeef> I think it very much isnt written in such a way to be easy to work with
06:36:54FromDiscord<Elegantbeef> Like https://github.com/filcuc/nimqml/blob/master/src/nimqml/private/qmetaobjectconnection.nim is the entire module
06:37:35arkanoidyes, he included everything in a single large nimqml file
06:37:43arkanoidI mean, no import, just include
06:37:44FromDiscord<Elegantbeef> Yea i know
06:38:29FromDiscord<Elegantbeef> Imo there isnt much reason to do what they did other than to be silly
06:38:34arkanoidthe fact that status is using that lib made me say "hey should be good" but apparently I'm very good in spotting errors
06:40:08FromDiscord<Elegantbeef> The worst part about using include is it's so hard to get your bearings
06:40:24FromDiscord<Elegantbeef> You dont know what's exposed to you, you dont know where anything comes from unless you look at every module before you
06:42:04FromDiscord<Elegantbeef> Not that I dont have code that smells though
06:47:47arkanoidI think I want to refactor it all, point is how to maintain backward compatibility
06:48:44FromDiscord<Elegantbeef> `export` goes brrr
07:15:12arkanoid:)
07:19:08arkanoidElegantbeef, do you think I should open 2 issues for the 2 cases?
07:20:04FromDiscord<Elegantbeef> Probably
07:20:11arkanoidok, thanks
07:40:09*PMunch joined #nim
07:47:10*DeluxeSk8rBird quit (Ping timeout: 250 seconds)
07:52:03*pro joined #nim
07:57:52*DeluxeSk8rBird joined #nim
08:01:19*DeluxeSk8rBird1 joined #nim
08:04:33*DeluxeSk8rBird quit (Ping timeout: 256 seconds)
08:39:53FromDiscord<mratsim> In reply to @arkanoid "the fact that status": We're moving away from it to pure C++ for the UI layer.
08:54:44*neurocyte091709 quit (Quit: The Lounge - https://thelounge.chat)
09:01:34*neurocyte091709 joined #nim
09:01:48*neurocyte091709 quit (Client Quit)
09:01:56*pro quit (Quit: WeeChat 3.4)
09:05:36*neurocyte091709 joined #nim
09:34:39*DeluxeSk8rBird1 quit (Ping timeout: 256 seconds)
09:38:23*DeluxeSk8rBird1 joined #nim
09:44:03PMunchAny reason in particular @mratsim?
09:51:28*DeluxeSk8rBird1 quit (Remote host closed the connection)
09:51:43*DeluxeSk8rBird1 joined #nim
09:52:21NimEventerNew post on r/nim by vanyle_: Static analysis tool, see https://reddit.com/r/nim/comments/s60cx1/static_analysis_tool/
09:52:52arkanoidmratsim, I'm not sure if trusting NimQml and go with split C++/Nim. I'd like to avoid C++
09:53:03arkanoids/and/or
09:55:04FromDiscord<mratsim> In reply to @PMunch "Any reason in particular": QT6 support required changing DOtherside and so taking other that lib maintenance.↵↵Also it's hard enough to recruit designers frontend dev with QML and some C++. If we add Nim to the mix it gets really tough. And we need to be really agile on the UI layer since it's what users see first.
09:56:05FromDiscord<mratsim> Ah and also documentation. If we see weird things happening, we don't have to "how does that translate to Nim, is the issue Nim or really QT/QML"
09:57:21arkanoidmakes sense. I've also read some of your code for desktop client, and I see that it's a lot of setup and delete due to nimqml design
09:58:25PMunchIf only we had Futhark for C++ :P
09:58:43PMunchThat should make Qt work the same as in C++
09:59:35*DeluxeSk8rBird1 quit (Ping timeout: 256 seconds)
10:00:20arkanoidPMunch: it would be wow
10:01:15PMunchShould work, but converting all the C++ concepts into Nim is going to require some work
10:01:16arkanoidhave you seen my toy project where I wrap gdal library with futhark and load geographical data and draw it with Qt5 Map via nimqml?
10:01:32PMunchWhat? No I haven't seen that!
10:02:23arkanoidPMunch: https://github.com/arkanoid87/nimmap
10:02:58arkanoidactually is an exercise in learning how to properly use nimqml, I've been cherry picking bugs and leaks so far
10:03:21arkanoidbut at the end it seems to be a nim bug, not a nimqml one
10:19:31*Gustavo6046 quit (Quit: Leaving)
10:22:36PMunchAha, so nlib/gdal is just the output of Futhark?
10:56:00arkanoidPMunch: yes, and I had to copy it from cache folder due to the vscode/nim check issue. Are you considering changing futhark for vscode users? Saem, autor of the nim version of vscode extension, seems not to agree with futhark using cache folder that way
10:57:03PMunchWhy doesn't they agree that using the cache folder for cache files is a good idea?
10:57:12PMunchSounds like a weird thing to oppose
10:57:50PMunchI guess I could throw in a flag you can put in your nim.cfg to look elsewhere for the cache
10:59:42arkanoidPMunch: https://github.com/saem/vscode-nim/issues/69
11:17:06PMunchLeft a reply
11:23:12*jjido joined #nim
11:34:05NimEventerNew thread by Jarv: Using waitForExit when a timeout is given, on a process blocked by IO, see https://forum.nim-lang.org/t/8818
12:07:56*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:05:45FromDiscord<inv> How can I make prefetch in Nim ?
13:05:56FromDiscord<inv> (edit) "How can I make prefetch ... in" added "data from mem"
13:07:25FromDiscord<inv> (edit) "How can I make ... prefetch" added "manually"
13:13:01szahidGuys how to write this better? https://play.nim-lang.org/#ix=3MyO
13:15:41FromDiscord<Rika> First time I’ve seen someone actually use my library wow lmao
13:15:55FromDiscord<Rika> What looks ugly to you right now?
13:16:42szahidSuru is yours ?
13:17:47szahidNevermind. My script is very.. slow? i have problem with loop i think.
13:17:51FromDiscord<Isofruit> As somebody with no clue of what the code is supposed to do, do all the variables you declare with var actually have to be mutable? Or would let also do?
13:19:12FromDiscord<Isofruit> e.g. `url`, `response` and `r` look like they're only read from, as a personal preference thing I like to have only the things mutable that need to be mutable
13:19:23FromDiscord<Rika> From what I read only the client has to be var
13:19:44FromDiscord<Isofruit> errors also, afaik you can't add to a seq that isn't var
13:19:46FromDiscord<ynfle> Is there a way to inject a space in between code block with `nnkEmpty` or somthing like that for repr?
13:22:22FromDiscord<Rika> In reply to @ynfle "Is there a way": I don’t think so
13:22:30FromDiscord<Rika> In reply to @szahid "Suru is yours ?": Yup
13:22:51FromDiscord<Rika> In reply to @szahid "Nevermind. My script is": Maybe remove suru first, I’m skeptical of its performance right now
13:23:47*adigitoleo quit (Remote host closed the connection)
13:24:30*adigitoleo joined #nim
13:26:12szahidRika. I dont know other ways to count speed of script. I think this is not problem with suru beacuse in python i have the same issue.
13:29:25FromDiscord<Rika> I noticed this, you’re using wait for…
13:30:02FromDiscord<Rika> I’m a bit busy right now so if someone helps you while I am gone nice but I’ll help you in a bit otherwise
13:37:30*jjido joined #nim
13:39:04FromDiscord<Rika> Ah great ix decided to wipe my progress
13:39:37szahid:(
13:43:58FromDiscord<Rika> Second time my progress is wiped, how fun it is to program on a phone
13:46:42PMunchI really should make it so the playground doesn't blindly refresh if the ix paste fails..
13:48:58FromDiscord<Rika> I’m not sure if this compiles fine since the playground kills it, but I think it should
13:49:00FromDiscord<Rika> https://play.nim-lang.org/#ix=3Mz1
13:49:30FromDiscord<Rika> I shall go for a bit again
13:50:26PMunch@Rika, you wrote a progress bar that slows down performance? :P
13:51:42*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:54:25FromDiscord<Rika> In reply to @PMunch "<@259277943275126785>, you wrote a": I don’t think it’s possible to not?
13:54:48FromDiscord<Rika> Unless you somehow found 0 cycle instructions
13:54:54PMunchWell of course
13:55:04PMunchBut one that slows it down more than is to be expected
13:58:19FromDiscord<Rika> No I’m just extremely not confident
13:58:30FromDiscord<Rika> It’s probably way better than tqdm
13:59:11szahidRika.. What tha hell? form 3it/s to 1k it/s :D
14:00:35FromDiscord<Isofruit> You just made a 300x performance jump?
14:00:36FromDiscord<Isofruit> Sounds nice
14:01:22FromDiscord<hmmm> i want to use rika sama stuff to, what does it do
14:01:49FromDiscord<Rika> In reply to @szahid "Rika.. What tha hell?": Measure runtime not the for loop
14:02:06FromDiscord<Rika> It does some extra things out of the measured loop
14:02:41szahidRika... do you know some libs for that ?
14:03:21FromDiscord<Rika> Uh https://nim-lang.org/docs/monotimes.html
14:17:32szahid:D to much connection to server Connection refused
14:17:38*Guest9 joined #nim
14:17:42szahidfrom 10min to 17seconds :D
14:17:45szahidNim <3
14:18:09*Guest9 quit (Client Quit)
14:18:23PMunchHaha, that's the kind of speedup where you start to wonder if you did something wrong and your program just doesn't do anything anymore :P
14:41:36*xet7 quit (Quit: Leaving)
14:44:41*arkurious joined #nim
14:45:20*xet7 joined #nim
14:47:24FromDiscord<Rika> well the issue with what he did was he didnt use async at all soooo
14:47:51FromDiscord<Rika> yeah the solution i gave might need some ratelimiting since you might be murdering a server if you had 1297751839741 url nodes
14:48:08PMunchAah, good ol' async
15:01:59FromDiscord<inv> google did not help with Nim's prefetch 😦
15:02:29FromDiscord<Rika> ?
15:02:42FromDiscord<inv> Can I add one C-line into Nim code somehow?
15:02:46FromDiscord<Rika> yeah sure
15:02:54FromDiscord<Rika> {.emit: "code".}
15:03:03FromDiscord<Rika> i think thats the syntax i forgot
15:03:48FromDiscord<inv> I wanted to test "builtin_prefetch"
15:15:38FromDiscord<exelotl> @inv since it's function-like you can probably just `importc` it
15:16:10FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3MzD
15:16:23FromDiscord<exelotl> that's what I'd try ^
15:19:54FromDiscord<inv> Thank you. did not change anything in my case
15:44:32*noeontheend joined #nim
15:57:14FromDiscord<Patitotective> I want `chr` to be `\n`, not `\`, How am I supposed to parse the string?↵https://play.nim-lang.org/#ix=3MzP
16:02:23FromDiscord<Rika> remove the second \?
16:02:25FromDiscord<Rika> (edit) "\?" => "\\?"
16:02:43FromDiscord<Patitotective> I can't, that's how I'm getting the string
16:02:52FromDiscord<Rika> string replace
16:03:23FromDiscord<Rika> replace the escape code "\n" into the literal '\n'
16:03:32FromDiscord<Rika> manually i guess, i dont know of any procs that do such
16:04:27FromDiscord<Patitotective> what about https://nim-lang.org/docs/strutils.html#unescape%2Cstring%2Cstring%2Cstring ?
16:05:19FromDiscord<Rika> sounds good
16:07:41FromDiscord<Patitotective> but looking at `parseChar` source it does only get the char at the given index (by default 0), so it will never get `\n` since they're two characters 😕
16:08:04FromDiscord<Patitotective> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/parseutils.nim#L245}
16:08:12FromDiscord<Patitotective> (edit) "https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/parseutils.nim#L245}" => "https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/parseutils.nim#L245"
16:08:52FromDiscord<Patitotective> (edit) "get" => "work with"
16:10:33FromDiscord<Rika> `str = unescape str` after str>
16:10:34FromDiscord<Rika> (edit) "str>" => "str?"
16:15:02FromDiscord<Rika> ah i get what you mean
16:15:08FromDiscord<Rika> ah no i dont
16:15:09FromDiscord<Patitotective> `unescape` requires `str` to have quotes around the actual string, anyways doesn't work that way either
16:15:13FromDiscord<Rika> it doesnt
16:15:24FromDiscord<Rika> unescape(str, "", "")
16:15:37FromDiscord<Rika> it doesnt seem to replace \n anyway though
16:16:16FromDiscord<enthus1ast> \\n cannot be in a char (on all systems) since sometimes its two chars
16:16:22*rockcavera joined #nim
16:16:22*rockcavera quit (Changing host)
16:16:23*rockcavera joined #nim
16:17:13FromDiscord<Patitotective> !eval echo '\n'
16:17:15NimBot↵
16:17:23FromDiscord<Patitotective> but it does work
16:18:39FromDiscord<enthus1ast> ok, i meant \\p
16:19:09FromDiscord<enthus1ast> \\n is not correct for every system btw
16:19:36FromDiscord<enthus1ast> !eval echo '\\p'
16:19:37NimBotCompile failed: /usercode/in.nim(1, 9) Error: missing closing ' for character literal
16:19:47FromDiscord<enthus1ast> ok screw this
16:20:48FromDiscord<qb> https://play.nim-lang.org/#ix=3MA2
16:21:21FromDiscord<Rika> \n may not be correct for every system but that is out of scope
16:21:51FromDiscord<Patitotective> what i want is to parse an escaped character as `char` type https://nim-lang.org/docs/manual.html#lexical-analysis-character-literals
16:22:01FromDiscord<Rika> In reply to @qb "https://play.nim-lang.org/#ix=3MA2": use monotimes for benchmarking
16:22:03FromDiscord<Patitotective> \n was an example
16:23:24FromDiscord<Rika> @qb https://play.nim-lang.org/#ix=3MA3
16:23:36FromDiscord<Rika> ~~not sure where this is from btw, i dont know the context lol~~
16:23:52FromDiscord<qb> oh wow
16:24:06FromDiscord<qb> so the function is actually faster than casting
16:24:32*lucerne joined #nim
16:24:44FromDiscord<Rika> i wouldnt know why]
16:26:18FromDiscord<mratsim> In reply to @inv "Thank you. did not": prefetch doesn't help except when it does
16:27:32FromDiscord<mratsim> you need to optimize data locality first before prefetch helps
16:27:33FromDiscord<Rika> lmfao
16:28:54FromDiscord<mratsim> it also only helps when the processor cannot prefetch based on simple logic (i.e. the next item of a seq).
16:29:08FromDiscord<mratsim> So it might help with tree algorithms like https://github.com/numforge/laser/blob/e23b5d63f58441968188fb95e16862d1498bb845/benchmarks/random_sampling/fenwicktree.nim#L135-L137
16:29:52FromDiscord<mratsim> or more complex algo where you partition work and prefetching before jumping from partition to partition
16:30:35FromDiscord<mratsim> example: https://github.com/numforge/laser/blob/e23b5d63f58441968188fb95e16862d1498bb845/benchmarks/transpose/transpose_bench.nim#L293
16:31:30FromDiscord<mratsim> prefetch was a 10% perf improvement here
16:32:23FromDiscord<enthus1ast> saw a video lately that talked about execution speed changes based on the position in memory
16:32:45FromDiscord<enthus1ast> and the author gave a "location randomizer" application, to better benchmark withouth the location bias
16:33:24FromDiscord<ajusa> Hey mratsim, I was looking at taskpools and was confused by one of the non-goals: does it not support strings as an argument to the task?
16:33:36FromDiscord<mratsim> In reply to @enthus1ast "saw a video lately": that reminds me of the infamous fibonacci bench in the Nim forum that linked to some weird benchmark artifacts
16:33:53FromDiscord<mratsim> In reply to @ajusa "Hey mratsim, I was": only if you use arc/orc/boehm
16:34:36FromDiscord<mratsim> otherwise they are allocated on a thread-local heap and cannot be passed to threads without voodoo ceremony
16:35:00FromDiscord<ajusa> Ah okay, thanks for clarifying. Neat library, I'll be trying to use it soon!
16:36:24FromDiscord<mratsim> the voodoo ceremony: https://github.com/nim-lang/Nim/blob/devel/lib/system/channels_builtin.nim#L210-L229
16:37:48FromDiscord<Rika> In reply to @mratsim "that reminds me of": huh
16:37:54FromDiscord<Rika> interestiong
16:39:41FromDiscord<Patitotective> new question: how can i convert `"\\n"` into `"\n"`? https://play.nim-lang.org/#ix=3MA8
16:39:50FromDiscord<Patitotective> !eval echo repr "\n"
16:39:52NimBot0x55ebd8f70870"\10"↵""
16:40:33FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3MA8" => "https://play.nim-lang.org/#ix=3MAb"
16:40:45FromDiscord<Patitotective> `unescape` doesn't seem to be working
16:41:04FromDiscord<enthus1ast> i would just build a replacement table (on compile time)
16:41:11FromDiscord<mratsim> In reply to @Rika "interestiong": this one: https://forum.nim-lang.org/t/4253
16:41:45FromDiscord<enthus1ast> then iterate through your string look up the stuff, emit a new string
16:42:52FromDiscord<Patitotective> In reply to @enthus1ast "then iterate through your": can you give me an example?
16:42:55FromDiscord<Patitotective> (edit) "can" => "could"
16:43:12*noeontheend quit (Ping timeout: 250 seconds)
16:43:42FromDiscord<enthus1ast> not now, i'm on the move sorry
16:49:23FromDiscord<mratsim> In reply to @enthus1ast "saw a video lately": @Rika https://easyperf.net/blog/2018/01/18/Code_alignment_issues and https://news.ycombinator.com/item?id=18092684
16:49:38FromDiscord<mratsim> and @enthus1ast
16:49:47FromDiscord<Rika> intriguing
16:51:48FromDiscord<Rika> holy shit man performance is such a fickle beast
16:55:40*noeontheend joined #nim
17:14:12FromDiscord<enthus1ast> @Patitotective\: not what i though of initially, but maybe a simple multiReplace could also work here
17:14:22FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3MAs
17:15:53FromDiscord<Patitotective> now is time to write all the two characters hex combinations o_o
17:16:28FromDiscord<enthus1ast> yes this is what i meant with macro, you could loop over all combinations and generate a proc that does this
17:16:37FromDiscord<enthus1ast> or loop and parse the hex
17:20:32FromDiscord<Tanguy> In reply to @enthus1ast "saw a video lately": Saw it too https://youtu.be/r-TLSBdHe1A
17:21:08FromDiscord<Tanguy> Good talk
17:24:17FromDiscord<Patitotective> In reply to @enthus1ast "yes this is what": but if I don't type `\00` manually i cannot get the actual value so i dont understand what that macrou would do
17:32:13*vicecea quit (Remote host closed the connection)
17:32:44*vicecea joined #nim
17:37:31*pro joined #nim
17:41:58FromDiscord<enthus1ast> Was working on an example
17:42:09FromDiscord<enthus1ast> (During trainride)
17:42:25FromDiscord<Patitotective> (im writing it manually hehe)
17:42:35FromDiscord<Patitotective> (edit) "hehe)" => "hehe, thanks anyways)"
17:42:40FromDiscord<enthus1ast> But it's not yet fully done and I have a thight schedule this evening
17:42:55FromDiscord<enthus1ast> Maybe I can post what I have
17:43:03FromDiscord<Patitotective> sure 🙃
17:54:13FromDiscord<Patitotective> lol https://play.nim-lang.org/#ix=3MAJ
17:56:59*Lord_Nightmare joined #nim
18:04:27FromDiscord<Szahid> when should i use proc with parentheses? https://play.nim-lang.org/#ix=3MAQ
18:06:31FromDiscord<mratsim> when you spot the Spanish Inquisition
18:07:08FromDiscord<mratsim> you also have `add(x, "Hello")` and `add x, "Hello"`
18:07:19FromDiscord<sigkill> sent a long message, see http://ix.io/3MAX
18:07:34FromDiscord<sigkill> How supported is compiling shared libraries for use in C/C++?
18:08:37FromDiscord<mratsim> The "garbage collector" is type dependent and implementation dependent.↵If you don't use sequences, strings and ref types, there is no garbage to collect and you can't do pure manual memory management.
18:09:55FromDiscord<mratsim> the default garbage collector is refcounting with cycle detection via mark-and-sweep.↵↵You can use --gc:arc for deterministic refcounting (with the compiler doing escape analysis to avoid inserting useless increment/decrement)
18:09:59FromDiscord<Szahid> @mratsim Can I use it the way I want?
18:10:05FromDiscord<mratsim> In reply to @Szahid "<@570268431522201601> Can I": sure.
18:10:23arkanoid"when you spot the Spanish Inquisition" hahaha
18:11:55FromDiscord<mratsim> In reply to @sigkill "Hey - i'm looking": That part is because the default garbage collector uses thread-local heaps and so memory has to be reclaimed from the thread that allocated it.↵↵For your use-case, compile with --gc:arc or if you have cycle --gc:orc or if you don't use ref types --gc:destructors
18:12:05FromDiscord<mratsim> (edit) "In reply to @sigkill "Hey - i'm looking": That part is because the default garbage collector uses thread-local heaps and so memory has to be reclaimed from the thread that allocated it.↵↵For your use-case, compile with --gc:arc or if you have cycle --gc:orc or if you don't use ref types ... --gc:destructors" added "at all"
18:12:52FromDiscord<mratsim> In reply to @sigkill "How supported is compiling": For the shared libs part, I think the gamedev channel use Nim as plugins the most, can't help on that part.
18:13:52FromDiscord<mratsim> basically once you compile with --app:lib, before calling Nim functions you need to call NimMain() to initialize some runtime stuff and that's all.
18:14:47FromDiscord<mratsim> I wonder if with --gc:destructors/--gc:none NimMain() is actually needed and for what.
18:17:44FromDiscord<mratsim> In reply to @sigkill "Hey - i'm looking": Also you can use Nim pretty much like C and switch to full manual memory management.↵↵That's what I do here wit writing my own low-level memory pool: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim
18:19:49FromDiscord<mratsim> On a side note, I've been having fun replacing CMake with Nim: https://github.com/numforge/agent-smith/blob/master/third_party/ale_build.nim↵↵And then calling the built stuff: https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim
18:23:49FromDiscord<ajusa> In reply to @ajusa "Ah wasn't sure if": Hm, I might be doing something wrong but treeform somehow has this figured out in jsony, as far as filling in a ref object using fieldPairs
18:25:25FromDiscord<sigkill> ok - pinged the gamedev channel.
18:28:12FromDiscord<sigkill> In reply to @mratsim "On a side note,": lol this is neat
18:29:01FromDiscord<ajusa> In reply to @ajusa "Hm, I might be": figured this out differently from treeform, though I have no clue how well it works.
18:31:14*Gustavo6046 joined #nim
18:47:13FromDiscord<hmmm> In reply to @Szahid "when should i use": I always use parentheses 😃 , I have an irrational fear things will crash and burn without them
18:47:58FromDiscord<leorize> still needed in case you import any module that have code to be run at top-level scope↵(@mratsim)
18:54:06*jjido joined #nim
19:04:56*krux02_ joined #nim
19:05:26*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
19:08:12*pro quit (Quit: WeeChat 3.4)
19:42:36*noeontheend quit (Ping timeout: 250 seconds)
19:44:23*Lord_Nightmare quit (Ping timeout: 256 seconds)
19:46:30*noeontheend joined #nim
20:10:56FromDiscord<Patitotective> I was wondering which GUI library is a good choice for making not-so small applications? With active development and various widgets
20:11:16*jjido joined #nim
20:15:15*jjido quit (Client Quit)
20:17:18FromDiscord<leorize> what platforms are you planning to run it on?
20:19:06FromDiscord<Patitotective> ubuntu and windows
20:19:09FromDiscord<Patitotective> (edit) "ubuntu" => "linux (ubuntu)"
20:19:21FromDiscord<Patitotective> mainly linux
20:19:41FromDiscord<leorize> wxwidgets and/or qml is gonna work for x-platform
20:19:51FromDiscord<leorize> gintro is great for linux
20:20:28*dtomato joined #nim
20:21:21FromDiscord<Patitotective> i was looking at https://github.com/yglukhov/nimx too but i guess the ones you are saying are in a stabler state
20:32:46arkanoidPatitotective, qt + nimqml?
20:33:22*adigitoleo quit (Remote host closed the connection)
20:33:41FromDiscord<Patitotective> when you say qt, do you mean actual c++ code?
20:34:05*adigitoleo joined #nim
20:39:49FromDiscord<01> what's your favorite framework for making native android apps?
20:41:03FromDiscord<Patitotective> In reply to @01 "what's your favorite framework": ~~kivy~~
20:41:20FromDiscord<01> nice
20:41:29FromDiscord<01> i don't meet a lot of people who use Kivy
20:41:40FromDiscord<Patitotective> actually i dont make mobile applications
20:42:19FromDiscord<Patitotective> but kivy seems the best mobile framework for python, dont know for nim
20:43:22FromDiscord<01> i'm not really asking in context of nim tbh
20:43:40FromDiscord<01> as i don't expect any viable framework for nim, maybe something that compiles to JS, but that's hardly "native"
20:43:59FromDiscord<Patitotective> gintro?
20:45:00FromDiscord<Elegantbeef> There are always webviews
20:45:26FromDiscord<Patitotective> https://github.com/Niminem/Neel
20:48:16FromDiscord<Elegantbeef> Ehh that uses chrome as a library
20:49:08FromDiscord<Elegantbeef> https://github.com/marcomq/nimview doesnt rely on chrome
20:51:29FromDiscord<Patitotective> also how is https://github.com/nim-lang/ui going? doesnt seem too active
20:52:44FromDiscord<HuskyHacks> Where can I find information on the linking options? Is there official documentation on static linking vs dynamic linking?
20:55:43FromDiscord<mratsim> In reply to @HuskyHacks "Where can I find": https://nim-lang.org/docs/nimc.html#dynliboverride↵↵static means embedding the dependency in the app, dynamic means linking against the system DLL or .so (you can read any C documentation)
20:56:02FromDiscord<HuskyHacks> excellent, thank you for the ref
21:06:20*joast quit (Quit: Leaving.)
21:15:20*noeontheend quit (Ping timeout: 250 seconds)
21:24:26*joast joined #nim
21:26:40FromDiscord<auxym> In reply to @Patitotective "also how is https://github.com/nim-lang/ui": The wrapped library itself is considered "mid-alpha" by its own readme and last commit was a year ago: https://github.com/andlabs/libui. I'd use wxnim personally...
21:37:12*yassernasc joined #nim
21:37:23FromDiscord<inv> I have a question: I have type T = object = a: byte, b: int↵then I have let v = seq[T]↵↵I want to make a template I can pass field name and to make smth like for example sum of fields a on the `v`. But I cannot find any good way - just to generate smth like sumA and sumB function, which does not look good
21:48:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MC2
21:50:41*jjido joined #nim
21:50:43FromDiscord<Elegantbeef> @inv\: There you go
21:55:06*yassernasc quit (Remote host closed the connection)
22:34:51FromDiscord<sigkill> sent a code paste, see https://play.nim-lang.org/#ix=3MCg
22:35:52FromDiscord<Elegantbeef> They already do
22:36:07FromDiscord<Elegantbeef> But they're only predictable with `--gc:arc` or `--gc:orc`
22:36:17FromDiscord<sigkill> the doc describes them as upcoming
22:36:20FromDiscord<sigkill> is it just out of date?
22:36:47FromDiscord<Elegantbeef> the "new runtime" is used with arc/orc so yes
22:36:58FromDiscord<Elegantbeef> Though the new runtime isnt defaulted yet so maybe not
22:37:12FromDiscord<mratsim> In 1.6 they are the default
22:37:18FromDiscord<mratsim> no?
22:37:32FromDiscord<mratsim> In reply to @Elegantbeef "But they're only predictable": also --gc:destructors 😉
22:38:02FromDiscord<mratsim> In reply to @sigkill "the doc describes them": that was written 2 years ago.
22:38:25FromDiscord<Elegantbeef> is the new runtime defaulted in 1.6?↵(@mratsim)
22:38:34NimEventerNew thread by Elcritch: Should constructors be `newObject` or `initObject`?, see https://forum.nim-lang.org/t/8819
22:39:10FromDiscord<sigkill> sent a long message, see http://ix.io/3MCi
22:39:37FromDiscord<mratsim> In reply to @Elegantbeef "is the new runtime": destructors are, as are seq and strings backed by destructors
22:40:12FromDiscord<Elegantbeef> Orc is arc + cycle collector
22:40:38FromDiscord<Elegantbeef> Hence the `O` indicating a cycle 😛
22:42:10FromDiscord<mratsim> sent a long message, see http://ix.io/3MCj
22:42:33FromDiscord<mratsim> (edit) "http://ix.io/3MCj" => "http://ix.io/3MCk"
22:42:54FromDiscord<mratsim> (edit) "http://ix.io/3MCk" => "http://ix.io/3MCl"
22:44:12FromDiscord<mratsim> You can implement your own refcounting scheme, including with that elision like this:↵↵https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/flow_events.nim#L173-L201
22:44:23FromDiscord<mratsim> (edit) "scheme," => "scheme (say you need atomic refcounting),"
22:55:59*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:18:17*noeontheend joined #nim
23:21:47*PMunch quit (Quit: leaving)