<< 15-03-2024 >>

00:03:06FromDiscord<Robyn [She/Her]> It probably depends on where you're generating it, maybe?
00:04:22arkanoidwell, if I replace the macro call with the code generated by the macro, it works correctly
00:04:46FromDiscord<Robyn [She/Her]> Ah
00:06:30arkanoidjust change true to false in line 21 https://play.nim-lang.org/#pasty=FmAcUMHcOPbY
01:00:36*LuxuryMode quit (Quit: Connection closed for inactivity)
03:52:25*SchweinDeBurg joined #nim
04:22:23arkanoidI have this C wrapped function that works perfectly fine when project is compiled with switch("checks", "on"), but returns empty object (not-nil) when compiled with switch("checks", "off") https://play.nim-lang.org/#pasty=nsCRkaqYAWBf
04:23:03arkanoidthe C function is linked as dynamic library, so switch("checks", "on") and switch("checks", "off") are calling both the very same C function
04:23:42arkanoidwhat's the difference within nim mode from enabling and disabling check in the context of openarray?
04:24:48FromDiscord<Elegantbeef> There is no difference to the layout of openArray
04:25:17arkanoidI can confirm that by replacing the function signature from openArray to seq. But then, what's the difference?
04:26:00arkanoidI'm printing the openarray before sending it as buffer to the C function, seems perfectly fine with both checks on and off
04:26:33arkanoidand the result of the C call is not nil (it's this one https://libgeos.org/doxygen/geos__c_8h.html#a4e7013b7e5172400e556f68087509895)
04:26:45FromDiscord<Elegantbeef> What is point?
04:27:56arkanoidPoint*[D: Length] = GVec2[D]
04:28:09arkanoidwhere GVec2[D] is vmath.GVec2[D]
04:28:29FromDiscord<Elegantbeef> And the exception says?
04:29:34arkanoidthat is https://github.com/treeform/vmath/blob/7282ae1247f2f384ebeaec3826d7fa38fd0e1df1/src/vmath.nim#L249
04:29:41arkanoidexception? I get zero exceptions
04:30:15FromDiscord<Elegantbeef> So you did not setup the geos exception system?
04:30:27arkanoidthat function would return a C object representing a sequence of coordinates, which is not-nil with length 0 when compiled with checks:off
04:30:41FromDiscord<Elegantbeef> Right but you are not looking at the error that geos produces πŸ˜„
04:30:56FromDiscord<Elegantbeef> Setup the error handler and look at what it's saying is wrong
04:31:01arkanoidthe result is not nil
04:31:08FromDiscord<Elegantbeef> ...
04:31:19FromDiscord<Elegantbeef> Right but there is a error reporting system in geos
04:31:34FromDiscord<Elegantbeef> If you want to see what the problem is look at that and it might help more than staring at code
04:32:15arkanoidpretty sure I'll get zero exception, but let me add the exception stuff
04:32:38FromDiscord<Elegantbeef> I mean there is supposed to be an error reported
04:32:42FromDiscord<Elegantbeef> So it should help
04:36:30arkanoidexception stuff added, zero exceptions
04:36:57FromDiscord<Elegantbeef> Lol so it returns nil but does not write an error message
04:37:21FromDiscord<Elegantbeef> You are using `vmathObjArrayBased`?
04:37:36arkanoidNOT NIL
04:38:07FromDiscord<Elegantbeef> Oh
04:38:09arkanoidthis is the logging stuff I added https://play.nim-lang.org/#pasty=vBdPqBfkddyL
04:38:21FromDiscord<Elegantbeef> I have the reading comprehension of a blind cockerspaniel
04:40:28arkanoidhaha
04:40:45FromDiscord<Elegantbeef> But yea re you using obj or array from vmath?
04:41:05arkanoidthe one linked (which is the default)
04:42:31FromDiscord<Elegantbeef> Try the pure array version
04:43:23arkanoidk
04:45:34arkanoidswitch("d", "vmathArrayBased"), runs fine with switch("checks", "on"), same no-op with switch("checks", "off")
04:45:39arkanoidso nothing changed
04:45:53FromDiscord<Elegantbeef> Ok so Nim just does not like you
04:46:05FromDiscord<Elegantbeef> What does the call site look like?
04:49:38arkanoidthis is the proc that sandwich the problem: https://play.nim-lang.org/#pasty=plmaVAhZyXqd , output log line is "toGeosCoordSec: polygonLen=21 resultSize=0" when it should be "toGeosCoordSec: polygonLen=21 resultSize=21"
04:49:56arkanoidthe difference lies in checks:on and checks:off
04:50:58arkanoidthis is my config.nims, all I am doing it commenting or not line 16 https://play.nim-lang.org/#pasty=QbVZnMQjWUpG
04:52:24FromDiscord<Elegantbeef> Well aside from digging into the generated C the last thing I can think to check is that `static: assert sizeof(Point) == sizeof(float32) 2)` πŸ˜„
04:52:35FromDiscord<Elegantbeef> yes that's times 2 not whatever the bridge says
04:53:35FromDiscord<Elegantbeef> Though it still should write an error for why the result size is 0 πŸ˜„
04:53:59arkanoidassert sizeof(Point) == 2 * sizeof(float32) test passed
04:54:13FromDiscord<Elegantbeef> Whelp
04:54:21FromDiscord<Elegantbeef> Time to put your wellies on and dig into the C
04:54:33arkanoidthis is the larger sandwitch, feel free to add salad https://play.nim-lang.org/#pasty=QIuVuQTjYgfN
04:54:58arkanoidmm ok, not quite my ground, but I can try
04:55:43FromDiscord<Elegantbeef> Well I guess you can also check what `cast[uint](polygon[0].addr)` gives you
04:57:34arkanoid139763426816232
04:57:57FromDiscord<Elegantbeef> Well that aint nil
04:58:23FromDiscord<Elegantbeef> If `polygon.len.cuint` is also not 0 the issue is wild
04:59:53FromDiscord<Elegantbeef> Would be time to compile with debugger\:native and feed it through valgrind/gdb
04:59:54arkanoidhere's the C code compiled with checks:off https://play.nim-lang.org/#pasty=VMyxWskjCBLN
05:00:07FromDiscord<Elegantbeef> `--debugger:native -d:useMalloc` πŸ˜„
05:00:52arkanoidWAIT A SEC
05:01:00arkanoidchecks:off disables assets
05:01:03arkanoid*asserts
05:01:15arkanoidhe was skipping assert sizeof(Point) == 2 * sizeof(float32)
05:01:30FromDiscord<Elegantbeef> Don't think it disables static asserts
05:01:32FromDiscord<Elegantbeef> I could be wrong
05:02:05arkanoidit does, just checked
05:02:08FromDiscord<Elegantbeef> I am wrong
05:02:19arkanoidthat assert fails with checks:on
05:02:34arkanoiddoAssert to the rescue
05:03:06FromDiscord<girvo> Is it possible to disallow `return` in a proc? Weird req I know, I think I'm just going to solve it with a wrapper that while true: sleep(forever) after the passed-in proc does/might return, but FreeRTOS tasks have a strong requirement that they never return
05:03:13arkanoidso maybe the C call now returns nil? le me try
05:03:48FromDiscord<girvo> Actually I suppose wrapper-that-calls-cb-and-sleeps is nicer because then the lifecycle hooks for the callback proc will actually operate as expected
05:04:06arkanoidnope, the result of the C call is still not nil, checking with "doAssert result != nil" now
05:04:37FromDiscord<Elegantbeef> Hmph
05:04:52FromDiscord<Elegantbeef> What's checks on vs. off look like in the generated C?
05:05:08arkanoidthat's exactly what I am re-generating now
05:05:28arkanoidnot sure if I should leave all the nim check sandwitch on or off
05:05:46arkanoidand which switches should I enable, apart from checks
05:06:15arkanoidI'll remove the most amount of code possible to get the leanest C
05:06:21FromDiscord<Elegantbeef> remove it
05:06:21FromDiscord<Elegantbeef> Less noise the better
05:06:23FromDiscord<Elegantbeef> both as release with checks off is all you need
05:08:49arkanoidwith checks:off https://play.nim-lang.org/#pasty=zXONsMuxqiFG
05:11:43FromDiscord<pulux> have here some leagacy pascal code, wich cast byte-buffer direct in an object. Is this possible in Nim?
05:12:03FromDiscord<Elegantbeef> You can cast an object to a bytebuffer but it's generally suggested not to
05:12:29FromDiscord<Elegantbeef> It's best to `copyMem` to a byte buffer
05:12:36arkanoidthe two versions side by side https://play.nim-lang.org/#pasty=JNueejeCUNmj
05:14:03arkanoidthey seem to me the very same C call
05:15:30FromDiscord<Elegantbeef> What's the callsite look like?
05:15:43FromDiscord<Elegantbeef> Maybe there is a lifetime bug seeping in somewhere
05:17:22arkanoidthis is my nim function that calls toGeosCoordSeq https://play.nim-lang.org/#pasty=tGMlvxXZXmth
05:19:31arkanoidbtw sizeof(Point) == 2 * sizeof(float32) fails for both checks:on and off, now that I replaced assert with doAssert
05:19:55FromDiscord<Elegantbeef> Right that's going to be an issue
05:20:18arkanoidbut the code works when checks are on?
05:21:58FromDiscord<Elegantbeef> Oh right that should be sizeof(float)
05:22:02FromDiscord<Elegantbeef> And it'll pass
05:22:15arkanoidat runtime sizeof(Point) is 16 for both checks:on and off
05:22:40FromDiscord<Elegantbeef> `sizeof(Point)` is a static expression unless it's an incomplete struct
05:24:35arkanoidwell it's Point*[D: Length] = GVec2[D], and Length is concept x: x.float is float
05:24:43FromDiscord<Elegantbeef> Right
05:24:52FromDiscord<Elegantbeef> That's a complete struct and 16 is what we expect
05:24:54FromDiscord<Elegantbeef> So uhhhhhhhhh
05:25:04FromDiscord<Elegantbeef> No clue
05:26:04arkanoidI must be very good in finding weird bugs
05:30:28arkanoidI get same error even when compiling debug with checks:off
05:31:01arkanoidlet me unbundle the checks into the separate checks
05:35:16arkanoidit is switch("assertions", "off")
05:37:44arkanoidI have no idea what I am dealing with. Much gratutitude as always Elegantbeef. I need at least a couple of hours of sleep now, I'll continue digging into this later
05:54:51FromDiscord<user2m> anyone every use nwatchdog? no matter what I can't seem to get a basic example working https://github.com/zendbit/nim_nwatchdog
06:26:52*advesperacit joined #nim
06:26:54*advesperacit quit (Client Quit)
06:27:11*advesperacit joined #nim
07:56:53*redj quit (Ping timeout: 240 seconds)
07:58:14*redj joined #nim
08:49:54FromDiscord<luteva> can i "return" a value from a 'block:' statement ? I mean making the result available for the caller (to the outside)?↡Any examples? I only see examples with blocks that do some echo in the block.
08:50:54FromDiscord<demotomohiro> In reply to @luteva "can i "return" a": https://nim-lang.org/docs/manual.html#statements-and-expressions-block-expression
08:53:06FromDiscord<luteva> thanks! i didn't find that! don't know why 🀷
09:07:31*PMunch joined #nim
10:14:13FromDiscord<System64 ~ Flandre Scarlet> Seems Linux works well on my Computer, I should install it
10:38:29FromDiscord<nnsee> In reply to @user2m "anyone every use nwatchdog?": is this linux?
10:38:36FromDiscord<nnsee> you might be interested in inotify if you are
10:38:42FromDiscord<nnsee> (edit) "you are" => "it is"
10:38:42FromDiscord<nnsee> https://nim-lang.org/docs/inotify.html
10:39:24FromDiscord<nnsee> should be paired with https://www.man7.org/linux/man-pages/man7/inotify.7.html for the nim doc to make sense
11:15:42*PMunch_ joined #nim
11:18:31*PMunch quit (Ping timeout: 260 seconds)
11:49:03*xet7 quit (Remote host closed the connection)
11:51:31*xet7 joined #nim
11:59:13*xet7 quit (Ping timeout: 264 seconds)
12:11:08*xet7 joined #nim
13:15:09FromDiscord<janakali> In reply to @user2m "anyone every use nwatchdog?": tried it right now, seems that Nim's `walkDirRec` has changed since examples were written, try full path in the pattern e.g. "/home/user/test\\.(txt||js)"
13:15:28FromDiscord<janakali> (edit) ""/home/user/test\\.(txt||js)"" => "`"/home/user/test\\.(txt||js)"`"
13:44:00NimEventerNew Nimble package! impulse - Signal processing primitives (FFT, ...) , see https://github.com/SciNim/impulse
13:44:00NimEventerNew Nimble package! xrayAttenuation - Library for X-ray reflectivity and transmission / absorption through matter, see https://github.com/SciNim/xrayAttenuation
13:44:04NimEventerNew Nimble package! orgtables - A library to turn Nim data into Org tables, see https://github.com/Vindaar/orgtables
13:44:08NimEventerNew Nimble package! flatBuffers - Package to turn (nested) Nim objects to flat buffers and back., see https://github.com/Vindaar/flatBuffers
13:49:25FromDiscord<bulan2> In case anybody likes to see this:↡https://ossinsight.io/analyze/nim-lang/Nim#overview
13:56:13*gshumway_ quit (Ping timeout: 256 seconds)
13:56:55*gshumway joined #nim
14:10:57FromDiscord<hutli> sent a code paste, see https://play.nim-lang.org/#pasty=LOcPRsYtxNuY
14:11:39FromDiscord<nervecenter> Hoo boy wish I could help but I ended up giving up and compiling on a Windows VM.
14:11:45FromDiscord<nervecenter> This was a few months back though
14:12:09FromDiscord<hutli> oh, wau, yea ok πŸ˜…
14:13:13FromDiscord<hutli> would prefer not having to get a Windows VM into my build system
14:13:29FromDiscord<nervecenter> Trust me I understand
14:14:21FromDiscord<nervecenter> All of my company's server infrastructure is Linux, but my boss wanted to move some of my analysis code to a desktop GUI and the first step was compiling my Nim code for Windows. Absolutely positively not very much fun.
14:14:54FromDiscord<nervecenter> We might be throwing the GUI idea out anyways, the cost-benefit ratio is totally out of whack
14:14:57FromDiscord<nervecenter> Modern GUI is a mess
14:16:36FromDiscord<Robyn [She/Her]> Zig CC might be useful for compilation, don't know much about how cross compilation works otherwise, sorry
14:16:44FromDiscord<Robyn [She/Her]> Zig CC is based on clang, by the way
14:17:21FromDiscord<A2> (I'm sitting right next to [hutli](https://matrix.to/#/%40_discord_133962599015383041%3At2bot.io) in the office, and spoilers\: it worked ❀️)
14:17:21FromDiscord<A2> maybe you want to have "amd64" instead of "i386"
14:21:52FromDiscord<hutli> yes, sorry, as A2 says it works with "amd64" - we have COFF files! πŸŽ‰ simple fix πŸ˜… is there a good way of seing the possible values for all of these flags, like `--os:`, `--cpu:` etc?
14:43:30FromDiscord<janakali> @hutli give Nim something invalid e.g. `nim c --cpu:bad 123` Error message lists all allowed options, same for `--os:`.
14:49:13FromDiscord<hutli> In reply to @janakali "<@133962599015383041> give Nim something": oh, yea ok, that works, thank you πŸ‘
14:50:34FromDiscord<demotomohiro> In reply to @hutli "yes, sorry, as A2": https://github.com/nim-lang/Nim/blob/devel/compiler/platform.nim↡You can also see here a list of Nim's supported CPUs and OSs.
14:53:18*ntat joined #nim
14:53:22FromDiscord<hutli> In reply to @demotomohiro "https://github.com/nim-lang/Nim/blob/devel/compiler": oh cool, a bit easier to look up amazing, thank you πŸ‘
15:14:44*PMunch_ quit (Quit: Leaving)
15:54:16*ntat quit (Quit: Leaving)
16:10:28*ntat joined #nim
16:21:38*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
16:24:37*deadmarshal_ quit (Ping timeout: 272 seconds)
16:25:19FromDiscord<maker_of_mischief> sent a code paste, see https://play.nim-lang.org/#pasty=gaRGbnBllIYQ
16:25:38FromDiscord<maker_of_mischief> `Error: unhandled exception: input(1, 0) Error: { expected`
16:26:01FromDiscord<maker_of_mischief> it throws a JsonParsingError and I have no clue why, it seems to be good json
16:27:43FromDiscord<Robyn [She/Her]> Is there a newline before that or?
16:28:10FromDiscord<maker_of_mischief> nope, thats the whole string
16:28:38FromDiscord<maker_of_mischief> sent a code paste, see https://play.nim-lang.org/#pasty=DGURzZytcvnm
16:28:48FromDiscord<Robyn [She/Her]> Hm not sure then, sorry
16:29:00FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=fGzTYmbnmvAr
16:29:08FromDiscord<Robyn [She/Her]> It's an existing Discord API wrapper
16:29:09FromDiscord<maker_of_mischief> In reply to @chronos.vitaqua "Out of curiosity, any": nope writing my own
16:29:12FromDiscord<Robyn [She/Her]> Ah fair
16:29:28FromDiscord<maker_of_mischief> i should go check that out though
16:29:34FromDiscord<maker_of_mischief> see if I can fix my issue
16:29:36FromDiscord<Robyn [She/Her]> Perhaps aha
17:01:08FromDiscord<user2m> In reply to @nnsee "is this linux?": this is cool didn't even know it existed. Unfortunately I'm on windows
17:09:39*deadmarshal_ joined #nim
17:10:29FromDiscord<saint.___.> Do you know if dimscord works with nim 2.0 yet @Robyn [She/Her] ?
17:10:50FromDiscord<Robyn [She/Her]> It should iirc
17:11:11FromDiscord<Robyn [She/Her]> Just gotta use refc because of some weird bugs last I checked
17:11:17FromDiscord<Robyn [She/Her]> Memory leaks I think
17:11:27FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=FezLNcdMaaPQ
17:16:43FromDiscord<odexine> Windows has no equivalent I believe
17:17:16FromDiscord<odexine> checked, it does
17:17:28FromDiscord<odexine> might be that the lib doesnt support it tho
17:19:36FromDiscord<saint.___.> Are you using nim 2.0?
17:19:41FromDiscord<saint.___.> Afaik it doesn't support nim 2.9
17:19:42FromDiscord<saint.___.> (edit) "2.9" => "2.0"
17:19:53FromDiscord<saint.___.> Even on mac/linux
17:24:34FromDiscord<nervecenter> What are the equivalents of `skip` and `take` from other languages when trying to get a subset of values from a `seq`?
17:25:38FromDiscord<saint.___.> Are you using collect?
17:31:57FromDiscord<nervecenter> Not too much but here and there
17:37:46*anddam_ is now known as anddam
18:02:33*junaid_ joined #nim
18:08:59*SchweinDeBurg joined #nim
18:09:06FromDiscord<maker_of_mischief> In reply to @nnsee "should be paired with": I love inotify
18:09:24FromDiscord<maker_of_mischief> I've been using it for a long time for a startup script that automatically sorts all my downloads
18:26:53NimEventerNew thread by Abathargh: Avr_io v0.3.0 + avrman release, see https://forum.nim-lang.org/t/11224
18:39:16FromDiscord<janakali> sent a code paste, see https://play.nim-lang.org/#pasty=ZRNbxMQKbuSt
18:39:32FromDiscord<janakali> (edit) "https://play.nim-lang.org/#pasty=HzDTWTcVTnPR" => "https://play.nim-lang.org/#pasty=FaxFpPPeNYqb"
18:55:42*ntat quit (Quit: Leaving)
19:18:51FromDiscord<saint.___.> In reply to @maker_of_mischief "I've been using it": Think you could share your script maybe?
19:19:06FromDiscord<maker_of_mischief> sure in dms
19:19:40FromDiscord<maker_of_mischief> i made it easy to edit so you can config it pretty easily
19:37:38*advesperacit quit (Ping timeout: 252 seconds)
19:38:20*advesperacit joined #nim
19:51:53FromDiscord<saint.___.> Thanks!
20:54:55*advesperacit quit (Ping timeout: 268 seconds)
20:55:01*advesperacit_ joined #nim
21:05:46FromDiscord<System64 ~ Flandre Scarlet> I'm on Linux!
21:12:49FromDiscord<Robyn [She/Her]> Eyyy
21:15:52FromDiscord<Robyn [She/Her]> Anyone know if Norm supports loading and serialising lists, or if I need to make a custom data type for it?
21:31:07*lucasta joined #nim
21:41:42*advesperacit_ quit ()
21:57:02*junaid_ quit (Remote host closed the connection)
22:04:22FromDiscord<Robyn [She/Her]> This is meant to be used with Norm, but just want someone to go over this in case it's hiding a critical flaw or something https://play.nim-lang.org/#pasty=hTOCHIKoqXiw
22:07:02*evaloop joined #nim
22:07:41*evaloop left #nim (Leaving)
22:15:40FromDiscord<Robyn [She/Her]> Just realised the account provider enum doesn't make complete sense since a GitHub-backed account is a local account :p
22:28:04FromDiscord<System64 ~ Flandre Scarlet> Oh god which one should I choose please? https://media.discordapp.net/attachments/371759389889003532/1218324867599040532/image.png?ex=66074073&is=65f4cb73&hm=ad412d2646b9a4a418ace597887a16175ccd8da02f208a331dbddb10369d96e2&
22:29:23FromDiscord<Robyn [She/Her]> In reply to @sys64 "Oh god which one": The `NimLang` one
22:45:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "The `NimLang` one": Alright, thanks!
22:58:33*xet7 quit (Remote host closed the connection)
22:58:44*deadmarshal_ quit (Ping timeout: 260 seconds)
23:00:06*krux02 joined #nim
23:24:15*xet7 joined #nim
23:26:17*krux02_ joined #nim
23:29:24*krux02 quit (Ping timeout: 268 seconds)
23:36:37FromDiscord<Robyn [She/Her]> Currently deciding on what I should use for threading hm...
23:37:03FromDiscord<Robyn [She/Her]> Malebolgia or taskpools... I think the former should work
23:41:24FromDiscord<Robyn [She/Her]> Out of curiousity, how does Mummy support threading? Does `threads:on` provide a barebones API for it or something? Since, I can't see mummy declaring it's usage of malebolgia or something similar
23:54:07*deadmarshal_ joined #nim
23:54:44FromDiscord<Robyn [She/Her]> Ah... How would I await for a thread's completion using a MasterHandle? Pretty sure I can't store the `Master` object in my type since it's a reference type that'll be accessed and passed around multiple threads