<< 12-02-2023 >>

00:00:04*PMunch quit (Quit: leaving)
00:43:28FromDiscord<I have 50GB of nothing on my PC> how do I make nimlsp behave for a backend=js projec
00:45:21FromDiscord<Elegantbeef> Make a config with `--backend:js`
00:57:09FromDiscord<System64 ~ Flandre Scarlet> This is so good! https://media.discordapp.net/attachments/371759389889003532/1074132014959165440/image.png
01:06:12*estiquelapice quit (Ping timeout: 252 seconds)
01:06:34*estiquelapice_ joined #nim
01:56:40FromDiscord<albassort> beef help
01:56:55FromDiscord<Elegantbeef> What if i say no
01:57:02FromDiscord<albassort> i would be sad
01:57:15FromDiscord<albassort> beef
01:57:33FromDiscord<albassort> i dont see my functions in my wasm module
01:57:56FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4nNO
01:58:04FromDiscord<albassort> nothin
01:58:09FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4nNO" => "https://play.nim-lang.org/#ix=4nNP"
01:58:13FromDiscord<Elegantbeef> I dont even know what that is
01:58:39FromDiscord<albassort> im trying to call my compiled emscripten wasm
01:58:43FromDiscord<albassort> from jS
01:58:53FromDiscord<Elegantbeef> Did you export the procedure
01:59:11FromDiscord<albassort> {.exportc : "name", vargs"
01:59:14FromDiscord<albassort> (edit) "vargs"" => "vargs}"
01:59:33FromDiscord<Elegantbeef> That doesnt work with emscripten ime
01:59:51FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/exporter.nim#L3-L19
02:00:25FromDiscord<albassort> silly beef and his weird macros
02:01:56FromDiscord<Elegantbeef> One might be able to do `{.extern, exportc.}` but this works aswell
02:02:21FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1074148422216597585/image.png
02:02:23FromDiscord<albassort> wooo
02:49:47*madprops quit (Ping timeout: 246 seconds)
02:49:55*tinystoat joined #nim
02:50:13*tinytoast quit (Read error: Connection reset by peer)
02:50:28*madprops joined #nim
02:50:28*madprops quit (Changing host)
02:50:28*madprops joined #nim
03:43:41*azimut quit (Ping timeout: 255 seconds)
04:19:07*arkurious quit (Quit: Leaving)
04:25:37FromDiscord<Iliketwertles> yet again im being dumb i think
04:26:17FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4nOn
04:26:31FromDiscord<Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4nOn" => "https://play.nim-lang.org/#ix=4nOo"
04:27:17FromDiscord<Iliketwertles> would i just like `var z = "path/to/zip"` somewhere in there?
04:27:35FromDiscord<Iliketwertles> after `var z: ZipArchive`
04:32:37FromDiscord<Iliketwertles> wait
04:35:18FromDiscord<Iliketwertles> nvm i figured it oyt
04:35:20FromDiscord<Iliketwertles> (edit) "oyt" => "out"
05:20:49FromDiscord<ringabout> We should have official benchmarks like https://github.com/python/pyperformance/tree/main/pyperformance/data-files/benchmarks so that we could know whether there is performance regression among versions.
05:56:54onetwoguys im getting Error: type mismatch when i try to compile this simple nim code
05:57:06onetwoecho 5 ^ 5
05:57:30FromDiscord<amadan> Are you trying to do 5 to the power of 5?
05:57:37FromDiscord<Elegantbeef> Read the error
05:57:40FromDiscord<Elegantbeef> "Extra argument given"
05:57:40onetwothats the bitwise xor operator
05:57:44FromDiscord<Elegantbeef> \`import std/math
05:57:47FromDiscord<Elegantbeef> No it's not
05:57:50FromDiscord<Elegantbeef> `^` is power in Nim
05:57:59FromDiscord<amadan> ah, well `xor` is xor in Nim
05:57:59onetwoit is? not ** ?
05:58:01FromDiscord<Elegantbeef> It's actually a backwards index when unary
05:58:06FromDiscord<amadan> So it would be `echo 5 xor 5`
05:58:09FromDiscord<Elegantbeef> This isnt python
06:08:16FromDiscord<naman4i> Hi
06:08:49FromDiscord<demotomohiro> Hi
06:11:59FromDiscord<Elegantbeef> Lol they left the room
06:12:09FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1074211284498780221/image.png
06:12:09FromDiscord<Elegantbeef> Demo you're too scary
07:07:52*xet7 joined #nim
07:09:17FromDiscord<Rika> Lol
07:19:58FromDiscord<ringabout> Following https://github.com/faster-cpython/ideas, I creates a repo to store ideas and benchmarks for Nim https://github.com/ringabout/faster-Nim
07:22:44*xet7 quit (Remote host closed the connection)
07:39:38*xet7 joined #nim
08:19:31FromDiscord<šŸµcamelliašŸµ> In reply to @onetwo "thats the bitwise xor": https://nim-lang.org/docs/system.html#%5E.t%2Cint
08:19:46onetwoi got it already
08:23:42*azimut joined #nim
08:34:25*kenran joined #nim
08:34:57*kenran quit (Remote host closed the connection)
08:36:31*alice quit (Remote host closed the connection)
08:37:41*alice joined #nim
08:56:48FromDiscord<myxi> sent a code paste, see https://play.nim-lang.org/#ix=4nPa
08:57:09FromDiscord<myxi> is that some expected behavior? I am very new to Nim.
08:57:28FromDiscord<Elegantbeef> `e` evaluates on the VM
08:57:29FromDiscord<Elegantbeef> So yes it is
08:57:55FromDiscord<Elegantbeef> you want `nim c -d:ssl -r test.nim` or `nim r -d:ssl my.nim`
08:57:58FromDiscord<myxi> then, what'd be the fastest way to run the code?
08:58:04FromDiscord<myxi> oh
08:58:15FromDiscord<Elegantbeef> The fastest way is to use tcc
08:58:25FromDiscord<Elegantbeef> so install tcc then supply `--cc:tcc`
09:00:46FromDiscord<myxi> I see. It did feel slightly fast, maybe, the significant difference is seen with bigger projects. Thanks!
09:01:10FromDiscord<myxi> (edit) "fast, maybe," => "fast; perhaps"
09:03:07FromDiscord<Elegantbeef> Well you have two slowdowns, Nim and C. Nim's compiler is not the fastest but the main thing being worked on to speed it up is incremental compilation.
09:03:08FromDiscord<Elegantbeef> So it'll only really effect recompilation and for small things it can theoretically be slower
09:28:37FromDiscord<Phil> In reply to @ringabout "Nice, it is definitely": https://stackoverflow.com/questions/75426013/how-do-i-access-parsing-of-nimble-files-from-the-nimble-package/75426014#75426014ā†µDocumented. Not sure if that also belongs on the forum, as this is more of a "Today I learned" kinda thing, so it'd be more to "teach" others
09:28:51FromDiscord<Phil> (edit) "others" => "others, which I'm not sure is the point"
09:30:22FromDiscord<ringabout> In reply to @Isofruit "https://stackoverflow.com/questions/75426013/how-do": Nice! I have seen that the questions regarding Nim on the stackoverflow increases faster than Crystal.
09:30:36FromDiscord<Elegantbeef> 99% of that is phil šŸ˜„
09:30:57FromDiscord<Phil> Eternalizing what I'm learning from this discord for when I inevitably forget about what I learned 5 minutes later
09:31:50FromDiscord<Phil> Either way though, we might really want to get NimEventer going again because otherwise I feel like a fair amount of SO questions are going to stay unanswered
09:32:15FromDiscord<Phil> At least for me Nimeventer was pretty important to get notified about nim questions
09:32:24FromDiscord<Phil> (edit) "At least for me Nimeventer was pretty important to get notified about nim questions ... " added "and help out"
09:33:08FromDiscord<enthus1ast> i think its a great idea to write such stuff on so
09:35:12FromDiscord<Phil> I can't seem to get ahold of Yard, Anyone have an idea where the nimeventer bot could be stored?
09:35:21FromDiscord<Phil> (edit) "I can't seem to get ahold of Yard, Anyone have an idea where the ... nimeventer" added "codebase for the"
09:35:50FromDiscord<Phil> Though ideally: Do we have anyone that in contrast to me actually knows shit about discord bots and could take a look at that?
09:37:03FromDiscord<enthus1ast> it would be good in general to have an "infrastructure diagramm", that could answer such questions
09:41:12FromDiscord<ringabout> Is there a repo for https://rosettacode.org/wiki/Category:Nim
09:41:37FromDiscord<ringabout> I would like to monitor the performance of rosettacode.
09:42:35FromDiscord<ringabout> Fine, I'm using this one https://github.com/def-/nim-unsorted
09:43:25FromDiscord<myxi> In reply to @Isofruit "Though ideally: Do we": do we really need a discord bot though? i'd have a thought a simple webhook is enough to get notified about answers -- unless you are wanting other functionalities as well
09:43:45FromDiscord<myxi> (edit) "In reply to @Isofruit "Though ideally: Do we": do we really need a discord bot though? i'd have a thought ... a" added "that"
09:44:37FromDiscord<myxi> some server, https://api.stackexchange.com/docs/questions-by-answer-ids and a basic script to send discord webhook
09:44:39FromDiscord<Phil> In reply to @myxi "do we really need": I mean, I couldn't even tell you what the current thing runs on. I'm assuming a bot since we're bridging to IRC and matrix
09:44:54FromDiscord<myxi> (edit) "some server, https://api.stackexchange.com/docs/questions-by-answer-ids ... and" added ","
09:45:28FromDiscord<myxi> (edit) "https://api.stackexchange.com/docs/questions-by-answer-ids" => "https://api.stackexchange.com/docs/"
09:45:29FromDiscord<enthus1ast> @ringabout\: i found this one https://github.com/acmeism/RosettaCodeData
09:46:00FromDiscord<Phil> All I'm saying is I don't know where the source is, I don't know where the actual bot is hosted and I don't know what it runs on but regardless of what it runs on, I don't have experience with it šŸ˜›
09:47:22FromDiscord<ringabout> In reply to @enthus1ast "<@658563905425244160>\: i found this": Thank you!
09:49:08FromDiscord<Phil> Actually, we only need a bot or what have you to post to discord, right?
09:49:18FromDiscord<Phil> The bridges should take care of propagating to matrix etc.
09:49:39FromDiscord<Phil> Or other way round, post to matrix and the bridge propagates it from there
09:50:06FromDiscord<enthus1ast> @ringabout\: There is a special page that lets you downoad pages in bulk https://rosettacode.org/wiki/Special:Export
09:50:41FromDiscord<enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/1074266280376414238/image.png
09:52:48FromDiscord<enthus1ast> from there you must parse it unfortunately...
09:54:32FromDiscord<ringabout> I see
09:58:22FromDiscord<myxi> In reply to @Isofruit "I mean, I couldn't": well, all that is possible without a discord bot as long as our program is running on 24/7 somewhere. We just need to create a webhook URL and send a message to this server using it. Fortunately, that is not hard: https://discord.com/developers/docs/resources/webhook#execute-webhookā†µā†µhere's the latest post tagged as "nim-lang": https://media.discordapp.net/attachments/371759389889003532/10742
09:58:59FromDiscord<myxi> it seems that the latest post was created by you
09:59:28FromDiscord<myxi> (edit) ""nim-lang":" => ""nim-lang" using SO API:"
09:59:32FromDiscord<Phil> I think the main issue might actually be getting that webhook to be run somewhere
09:59:56FromDiscord<Phil> But either way, I'd rather fix nimeventer than rewrite it and for that yard needs to respond, haven't seen any post of him since December
10:00:40FromDiscord<myxi> there are free services, however because many people are using their servers, it'd not take long before the instance get rate-limited
10:01:00FromDiscord<hotdog> In reply to @Isofruit "But either way, I'd": Yeah better to fix the existing thing because it also handled forum posts, Reddit posts, etc IIRC
10:01:20FromDiscord<hotdog> Iā€™ve searched around but canā€™t find a repo for it anywhere
10:01:27FromDiscord<hotdog> Maybe it was not open sourced
10:01:57FromDiscord<ringabout> ^ https://github.com/Yardanico/nimeventer
10:02:46FromDiscord<hotdog> In reply to @ringabout "^ https://github.com/Yardanico/nimeventer": Oh yeah just found it too, weird it wasnā€™t coming up in search results before
10:02:57FromDiscord<Phil> https://github.com/Yardanico/nimeventer
10:02:58FromDiscord<Phil> Dangit, too slow
10:03:00FromDiscord<Phil> Wow, delayed even more by my connection being ass
10:03:53FromDiscord<myxi> https://github.com/Yardanico/nimeventer/blob/master/src/nimeventer.nim#L48 it's using a webhook for discord as well
10:03:57FromDiscord<hotdog> Oh itā€™s an irc bot. I remembered it being a discord bot
10:04:58FromDiscord<hotdog> Ah wait it posts to both?
10:05:59FromDiscord<Phil> Well, let's see if it still builds
10:06:26FromDiscord<Phil> It does!
10:06:41FromDiscord<Phil> Now I'd need the actual proper config.json file to see why the heck it's broken
10:07:31FromDiscord<hotdog> Maybe the server itā€™s running on is just down?
10:24:03FromDiscord<myxi> sent a long message, see http://ix.io/4nPr
10:24:55FromDiscord<myxi> (edit) "http://ix.io/4nPr" => "http://ix.io/4nPs"
10:25:02FromDiscord<enthus1ast> i think Yardanico does that
10:29:01FromDiscord<Phil> sent a long message, see http://ix.io/4nPt
10:30:03FromDiscord<myxi> the main file does not seem too dependent on each others' functionality; if you don't care about irc, just remove the code for it
10:30:39FromDiscord<Phil> Yeh but I have values for none of them and equally no idea what they are so I'm still stuck on all fronts šŸ˜„
10:31:18FromDiscord<myxi> i feel instead of that, it'd be easier to create a new script of it
10:33:02FromDiscord<Phil> I mean, my current plan is to wait until next friday to see if yard responds and we can coordinate.ā†µIf not... no clue, I'm really not feeling like dealing with yet another topic
10:34:15FromDiscord<Phil> I'm knee deep in helping enable norm for nim2.0 and writing an owlkettle GUI + contributing to its docs, that's besides work and I only have so much brainspace available
10:35:36FromDiscord<myxi> i am good at python and can write a script for this if you want
10:36:11FromDiscord<Phil> I mean, I'd welcome it, getting notifications here is imo pretty important to support SO folks
10:36:12FromDiscord<enthus1ast> we eat our own dogfood here xD
11:01:05*azimut quit (Ping timeout: 255 seconds)
11:02:03*azimut joined #nim
12:26:54*jmdaemon quit (Ping timeout: 260 seconds)
13:47:43FromDiscord<System64 ~ Flandre Scarlet> https://github.com/vurtun/nuklearā†µJust found that, sounds interesting
13:47:51FromDiscord<System64 ~ Flandre Scarlet> it has bindings for Nim
15:07:02*tk quit (Quit: Well, this is unexpected.)
15:11:55*tk joined #nim
15:12:54*xet7 quit (Quit: Leaving)
15:15:15*tk quit (Changing host)
15:15:15*tk joined #nim
15:16:13*tk quit (Remote host closed the connection)
15:16:20*tk joined #nim
15:17:57*tk quit (Changing host)
15:17:57*tk joined #nim
15:22:16*xet7 joined #nim
15:22:31*tk quit (Remote host closed the connection)
15:22:39*tk joined #nim
15:30:26*arkurious joined #nim
15:46:44*lain quit (Ping timeout: 246 seconds)
15:47:29*lain joined #nim
15:57:44FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4nQV
15:58:08FromDiscord<auxym> and when I try to make a `cstring` specific overload, I get an error about ambiguous calls
15:58:25FromDiscord<auxym> `Error: ambiguous call; both sercom.write(u: UsartInstance, s: openArray[T: char or byte]) [proc declared in /home/francis/source/nim-on-samd21/src/sercom.nim(215, 6)] and sercom.write(u: UsartInstance, s: cstring) [proc declared in /home/francis/source/nim-on-samd21/src/sercom.nim(220, 6)] match for: (UsartInstance, string)`
16:00:34FromDiscord<auxym> Wait, `cstring` matches for `string`? So I can't make different overloads for string and cstring?
16:17:40*PMunch joined #nim
16:21:42*tk quit (Remote host closed the connection)
16:22:15*azimut quit (Remote host closed the connection)
16:22:51*azimut joined #nim
16:28:16FromDiscord<auxym> well apparently nim doesn't mind if I have 3 separate overloads for string/cstring/openarray[char]
16:28:35*tk joined #nim
16:29:17PMunch@auxym, of course
16:37:02FromDiscord<auxym> PMunch: since you're here... I'm trying to redirect nim's `echo` to a UART by implementing libc `_write_r` in nim. it's "working" except every char sent is replaced by 0x7f. you ever done something like that?
16:37:40PMunchOoh, no I haven't but I've had it on my mental TODO
16:38:27FromDiscord<auxym> my normar uart write proc is working fine. something is happening in the call chain between echo in nim and the libc write
16:39:04PMunchHmm, 0x7f is a strange character to send
16:39:25FromDiscord<auxym> coincidentally its equal to int8.high
16:39:32PMunchYeah
16:39:37PMunchASCII Del character
16:39:46FromDiscord<auxym> wondering if its a signed/unsigned char thing
16:40:41FromDiscord<auxym> might be an occasion to figure out how debugging in openOCD works, ha
16:43:11PMunchHmm, what is actually done for an echo
16:46:00PMunchDo you have something that I can run on a normal machine?
16:49:01FromDiscord<auxym> no, but good idea. I'll try to write a demo `_write_r` that redirects everything to stdout on linux... or something like that
16:49:41PMunchYeah, just something simple that puts it in quotes or something
16:50:07FromDiscord<auxym> but the current implem is here FYI:https://github.com/auxym/nim-on-samd21/blob/add-syscalls/src/syscalls.nim#L32
16:52:48PMunchHmm, this seems to suggest that _write_r should take a pointer to a reentrant structure as the first argument: https://github.com/eblot/newlib/blob/master/newlib/libc/reent/writer.c
17:00:24FromDiscord<auxym> hm. good find, thanks, will have a look.
17:01:43FromDiscord<auxym> I wonder if I can tell nim/libc (?) to use the non-reentrant write instead
17:01:55FromDiscord<auxym> nim's echo is supposed to be thread-safe
17:02:32PMunchI'm still poking through the system to figure out where that gets called
17:02:42PMunchI've gotten to the fwrite part
17:02:58PMunchCuriously in syncio it has a declared guard around fwrite
17:03:49PMunchThis might also be relevant: https://community.st.com/s/question/0D50X0000B8kTytSQE/printf-not-working-write-never-gets-called
17:05:48FromDiscord<auxym> did you find the compiler implem of echo? i quickly grepped and didnt find it
17:06:02*azimut quit (Ping timeout: 255 seconds)
17:06:53*azimut joined #nim
17:07:04FromDiscord<eyes> is there a builtin or std function to remove a range from a string šŸ„ŗ
17:07:11FromDiscord<eyes> sorry to interrupt
17:07:30FromDiscord<eyes> we should make a forum with threads
17:07:45FromDiscord<Phil> Nah, SO questions, easier to search for imo
17:08:55PMunch@auxym, well echoBinSafe is what it ends up as
17:09:13FromDiscord<Phil> In reply to @eyes "is there a builtin": https://nim-lang.org/docs/strutils.html#delete%2Cstring%2CSlice%5Bint%5D
17:09:21FromDiscord<Phil> delete proc useable with a range
17:09:32PMunchWhich then calls c_fwrite
17:09:54PMunchWhich is defined in syncio and ansi_c
17:10:03PMunchNot sure which one is used in our case
17:11:04PMunchAh, it seems like it's duplicated. But I'm guessing that system uses ansi_c with the switches we need for these kinds of chips
17:11:33FromDiscord<ringabout> `nimVM` has 188 opcodes, doesn't it mean the dispatcher is super slow?
17:11:49PMunchEither way those end up as fwrite from stdio.h
17:11:56FromDiscord<eyes> In reply to @Isofruit "https://nim-lang.org/docs/strutils.html#delete%2Cst": very cool thank you :)
17:17:57PMunch@auxym, having `echo` be outputable over UART would be awesome though
17:34:48FromDiscord<iencec> in a macro, is there way to get the fields of `typedesc`?
17:46:25FromDiscord<BobBBob> I did some code that creates a huge sequence, like a gigabyte, does some stuff with it, but then doesnt use it anymore and does some other code which also uses a lot of memory. However looking at the task manager it seems like the original sequence wasnt freed by the garbage collector when it went to the second part of the code. I tried putting them in blocks but that didnt seem to help. is there a reason for that or am I doing something
17:49:02PMunch@iencec, yes
17:49:21PMunch@BobBBob, yes
17:49:52FromDiscord<Phil> That indicates that a ref is floating about somewhere to me
17:50:18PMunchNah, it's just Nim holding on to it in case it needs more memory for something else
17:50:46PMunchIf you use -d:useMalloc or whatever the switch is called then you should see it drop back down
17:50:55PMunchOf course as long as the reference is completely gone
17:51:08FromDiscord<BobBBob> It's a quick program, maybe it just didnt get a chance to free it, should I post the code?
17:53:34FromDiscord<BobBBob> actually I'm sending the sequence to a function and returning a new one which I know copies the sequence and use double the ram, but would that cause it to not be freed?
17:58:03FromDiscord<iencec> [PMunch[IRC]#0000](https://matrix.to/#/%40_discord_709044657232936960_%3D50%3D4dunch%3D5b%3D49%3D52%3D43%3D5d%3At2bot.io) thank you. I found `desc.getTypeInst[1].getImpl.treeRepr` on the forum.
18:07:58*dropkick joined #nim
18:14:01PMunchHuh, didn't expect to get a thanks out of that one :P
18:14:26PMunch@BobBBob, as I said, you're probably doing everything right, Nim is just a bit greedy when it comes to memory
18:15:16PMunchIn order to save time on alloc/free it will alloc, then keep it around instead of freeing and handing over slices to other parts of your program needing memory so that they don't have to call alloc themselves
18:16:08PMunchBasically if you try to alloc a 1Gb sequence, then null it out (so that the memory should be freed), and then alloc say a 500Mb sequence you will now see that your program still only uses 1Gb instead of 1.5Gb
18:16:33PMunchThis is because Nim has kept the original gigabyte allocated instead of returning it to the system
18:18:39FromDiscord<Phil> I assume that is because it's faster to re-purpose memory you already have than return memory and request a new batch of memory
18:19:49FromDiscord<System64 ~ Flandre Scarlet> Does Nim have undefined behavior?
18:20:25FromDiscord<Phil> unsafeaddr
18:20:39PMunch@System64_~_Flandre_Scarlet, not unless you invoke any of C's undefined behaviour
18:20:49PMunch@Phil, exactly
18:20:51FromDiscord<Phil> What you do with pointers is a secret only shared between and the pointer
18:21:08PMunchSyscalls are "expensive", so it's faster for Nim to keep its own memory pool
18:21:23FromDiscord<System64 ~ Flandre Scarlet> Ah alright good to knowā†µSo waaay safer than C
18:21:24FromDiscord<Phil> Basically, the second you touch a pointer all bets are off for that section of the code
18:21:37PMunchWith -d:useMalloc it will just use malloc and free directly and you can properly profile memory usage using existing tools
18:21:38FromDiscord<System64 ~ Flandre Scarlet> what does it mean?
18:21:53FromDiscord<Phil> In reply to @System64 "what does it mean?": By "it" you mean a pointer?
18:22:02FromDiscord<Phil> (edit) "In reply to @System64 "what does it mean?": By "it" you mean a pointer? ... " added "So you're asking what a pointer means?"
18:22:07FromDiscord<System64 ~ Flandre Scarlet> I know what a pointer is
18:22:43FromDiscord<System64 ~ Flandre Scarlet> I meant, the sense of this sentenceā†µLike, the second I touch a pointer, it can go wrong?
18:25:42PMunchHuh, apparently you can't `include` a const string..
18:25:46PMunchThat's annoying
18:26:02FromDiscord<Phil> In reply to @System64 "I meant, the sense": In the sense that pointers may not be there, the may have been de-allocated by something else, they may not be the data you expect (pointers don't have types, so you need to cast them, but casting a pointer is basically entirely reliant on you knowing what's expecting you. If you're wrong, your data will be wrong)
18:26:07FromDiscord<Phil> (edit) "In reply to @System64 "I meant, the sense": In the sense that pointers may not be there, the may have been de-allocated by something else, they may not be the data you expect (pointers don't have types, so you need to cast them, but casting a pointer is basically entirely reliant on you knowing what's expecting you. If you're wrong, your data will be wrong) ... " added "etc."
18:26:34FromDiscord<Phil> Meaning you're possibly paying with runtime errors since you can only know that your pointer is doing evil stuff at runtime
18:28:04FromDiscord<System64 ~ Flandre Scarlet> As long you know what you do, no problems I thinkā†µIt's not like C
18:28:49FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nRO
18:29:24FromDiscord<BobBBob> In reply to @System64 "As long you know": hey as long as you never make any mistakes EVER C is fine too šŸ˜‰
18:30:02FromDiscord<Phil> In reply to @BobBBob "hey as long as": C: Where types are suggestions
18:31:02FromDiscord<System64 ~ Flandre Scarlet> In reply to @Isofruit "C: Where types are": https://www.youtube.com/watch?v=VwffHxf54fYā†µYou can cast stuff to void (sussy)
18:31:11FromDiscord<BobBBob> In reply to @PMunch "Basically if you try": My code seems to be using a lot more memory than it should, I calculated it should be using about 1.5 Gigs if it's reusing the memory but it's using almost 4, if someone could look at it that would be helpful. It's interesting code anyways since it benchmarks some different ways of doing thingsā†µbtw dont run this code if you dont have over 4 GB to spareā†µhttps://files.catbox.moe/b6m9iw.nim
18:32:01FromDiscord<firasuke> what's a good library for parsing command line arguments? I'm looking at `cliche` and `parseopt` currently. What do you recommend?
18:32:02FromDiscord<System64 ~ Flandre Scarlet> In reply to @BobBBob "hey as long as": problem : C is so unsafe
18:32:37FromDiscord<enthus1ast> @firasuke\: for quick and easy i use cligen
18:32:55FromDiscord<sOkam!> In reply to @firasuke "what's a good library": std/parseopt works well for 90% of use cases. otherwise use cligen if you need advanced stuff
18:33:08FromDiscord<firasuke> Oh ok, thanks
18:33:16FromDiscord<firasuke> what are your thoughts on `cliche` and `bossy` though?
18:33:17FromDiscord<sOkam!> i still haven't found something that parseopts doesn't cover, so its no simple lib
18:33:56FromDiscord<enthus1ast> never used those
18:34:24FromDiscord<firasuke> Alright, thanks for your insight
18:39:32FromDiscord<Phil> How do I figure out inside of a program the currently most up to date version of a package?
18:40:07FromDiscord<Phil> E.g. say I have owlkettle, I want to check if there's a more recent version, so I need to take a look at the latest version of owlkettle
18:40:34FromDiscord<Phil> Nimble search does not contain version information
18:43:18FromDiscord<hotdog> In reply to @Isofruit "How do I figure": Probably need to get the tags from the upstream repo
18:52:30FromDiscord<Phil> So assuming I only have the name of the project, the algo would be:ā†µ1) Perform nimble search with package name, pick first resultā†µ2) Make request to github for all tags of a given repository
19:05:25FromDiscord<BobBBob> nim does automatically send sequences by reference right?
19:10:10FromDiscord<Rika> No, copied if not mutable
19:11:12FromDiscord<BobBBob> oh really? Even if they're gigantic? So do I need to create the variable with var is do I put var in the procedure?
19:12:25FromDiscord<Rika> I do wonder if the triple float size automatic reference passing thing does extend into the value semantic but internally references types but I donā€™t know
19:12:33FromDiscord<Rika> I assume they copy
19:14:29FromDiscord<Phil> In reply to @BobBBob "oh really? Even if": Just make it a ref type so that it gets treated as such and only the pointer
19:14:37FromDiscord<Phil> (edit) "In reply to @BobBBob "oh really? Even if": Just make it a ref type so that it gets treated as such and only the pointer ... " added "gets copied around"
19:15:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nRZ
19:18:03FromDiscord<BobBBob> how do I dereference it?
19:18:40FromDiscord<Phil> `[]`
19:18:47FromDiscord<Phil> It's the deref operator
19:19:38FromDiscord<hotdog> In reply to @Isofruit "So assuming I only": Yeah I think, Iā€™m not sure if thereā€™s a simpler way perhaps with some nimble feature. You might need to support mercurial too iirc some packages use it
19:19:56FromDiscord<hotdog> And not just GitHub, it has to be host agnostic
19:20:15PMunch@Rika, what? Nim passes seqs by reference. Or rather the seq structure is copied by value, but the actual data is a reference within this structure
19:20:47FromDiscord<hotdog> I guess this is the downside of not having a central package server
19:23:48FromDiscord<Phil> In reply to @hotdog "And not just GitHub,": Eh, I think I'm safe there.ā†µEither you are in the nimble package list - IIRC that can also contain packages not published to github - in which case I have your repo URL regardless of Host platform.ā†µOr you use one of the weirder ways of specifying dependencies such as hammering a repo link into your nimble file, in which case I have your repo URL already
19:24:02FromDiscord<tfp> qq, i have a bit of code like this
19:24:29FromDiscord<tfp> sent a code paste, see https://play.nim-lang.org/#ix=4nS3
19:24:31FromDiscord<tfp> because the arrays are sized differently this isn't possible
19:24:45FromDiscord<tfp> it's kind of in a hot path so i don't want to make an allocation
19:24:57FromDiscord<tfp> is there something like a slice or idk that can handle this scenario
19:25:36FromDiscord<hotdog> In reply to @Isofruit "Eh, I think I'm": I just mean that you canā€™t use something GitHub specific, like some api call to get tags instead of using git
19:30:17FromDiscord<BobBBob> honestly maybe my memory measuring is wrong, Im using kde's system monitor and it seems wildly different every time, what's a good memory monitoring thing for linux?
19:31:20FromDiscord<planetis> it was rewritten in qtquick
19:35:21FromDiscord<huantian> In reply to @Rika "I do wonder if": It should right? That would make sense for seq and string
19:35:39FromDiscord<huantian> Though it would make sense if it didnā€™t as wellā€¦
19:37:50FromDiscord<Phil> In reply to @hotdog "I just mean that": I'll have to see. Maybe there's some magic I can do via git to fetch the tags of a remote without having an actual git-project around.ā†µIf there isn't, I'll have to use site-specific solutions
19:38:10FromDiscord<Phil> Because the alternative is cloning every dependency to check their git tags and I'm not doing that
19:38:23FromDiscord<Phil> (edit) "Because the alternative ... is" added "I'm seeing"
19:40:47FromDiscord<hotdog> In reply to @Isofruit "I'll have to see.": Looks like thereā€™s some magic args you can use to request only the tags and nothing else https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch in first answer
19:41:16FromDiscord<hotdog> Never tried it though..
19:42:46FromDiscord<Phil> The issue is more that I'm not within a git repository, I just want the information, not the repo itself
19:46:27FromDiscord<hotdog> In reply to @Isofruit "The issue is more": https://stackoverflow.com/questions/10649814/get-last-git-tag-from-a-remote-repo-without-cloning looks like that is possible
19:47:39FromDiscord<Phil> Perfect
19:48:10FromDiscord<Phil> In that case a combination of `nimble search` and git ls-remote to fetch the latest version... maybe I can even fetch the latest commit
19:54:01PMunchAnyone know an easier way of doing this? http://ix.io/4nSb
19:57:27*ltriant quit (Ping timeout: 260 seconds)
20:02:34FromDiscord<myxi> In reply to @Isofruit "I mean, I'd welcome": https://github.com/eeriemyxi/discord-stackoverflow-notifierā†µYou can play with the `last_checked` file to test it. The provided sample config file is configured such that it works for this purpose, however I am yet to make few of those options to actually work for other tags other than the hard coded ones https://media.discordapp.net/attachments/371759389889003532/1074420268711292979/image.png
20:02:52FromDiscord<myxi> (edit) "https://github.com/eeriemyxi/discord-stackoverflow-notifierā†µYou" => "<https://github.com/eeriemyxi/discord-stackoverflow-notifier>ā†µYou"
20:03:23FromDiscord<myxi> (edit) "ones" => "ones; that shouldn't take long though"
20:04:05FromDiscord<myxi> one can compile it to C using Nuitka to enhance the performance
20:14:15*crem1 quit (Ping timeout: 256 seconds)
20:16:04*crem1 joined #nim
20:17:10FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nSg
20:24:28*ltriant joined #nim
20:31:20*ltriant quit (Ping timeout: 268 seconds)
20:44:56*ltriant joined #nim
20:50:53FromDiscord<sOkam!> Can someone else reproduce this error, or is my nim broken? https://media.discordapp.net/attachments/371759389889003532/1074432427474296872/bug.nim
20:51:20PMunchUgh, Discord code-pastes are broken over the bridge
20:51:48FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nSs
20:51:59*ltriant quit (Ping timeout: 252 seconds)
20:52:10FromDiscord<sOkam!> i thought it was my type at first, but this happens even with floats... so
20:52:49FromDiscord<Phil> In reply to @myxi "<https://github.com/eeriemyxi/discord-stackoverflow": Sweet! Thanks!
20:53:11FromDiscord<Phil> I think the main reason to compile to C would be to simplify the installment process
20:53:22FromDiscord<Phil> Since that would be reduced to "Here is binary, enjoy"
20:54:54FromDiscord<Phil> Unrelated sidenote:ā†µIs there an asynchronous way to essentially do a `execCmdEx` call?
20:55:09FromDiscord<Phil> I wanna run a bunch of git commands but I don't want them to run synchronously
20:55:15PMunchOn linux you can
20:55:28PMunchI mean you could just spawn the processes
20:55:42PMunchAnd then check if they have exited and check their return codes
20:56:10FromDiscord<Phil> Assume I have not ever spawned a process
20:56:19FromDiscord<Phil> Do I do while loops to check that?
20:57:44PMunchMore or less yeah
20:57:53PMunchOr you could use asyncproc from here: https://github.com/cheatfate/asynctools
20:57:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nSu
20:58:32PMunchYeah, something like that
21:15:16*ltriant joined #nim
21:18:52FromDiscord<firasuke> can you do nested argument parsing using parseopt? for example, passing a certain flag, say `-b` causes the cli to operate in a certain mode with different sub options and such
21:19:09*jmdaemon joined #nim
21:20:48FromDiscord<sOkam!> Mystery solved. It wasn't my code, its a typo bug in vmathā†µhttps://github.com/treeform/vmath/issues/63
21:24:13PMunch@firasuke, kinda
21:25:04PMunchI mean the obvious way would be to have sub-commands like e.g. `git commit`
21:25:29PMunchSo in your code you would have a case statement over the first argument and parse the rest of the options dependant on that
21:26:04FromDiscord<firasuke> In reply to @PMunch "So in your code": exactly, and do I do that with multiple opt parsers? or is there a better way
21:26:48PMunchThere's also docopt, the recently updated Cliche, and many more ways to deal with command line options
21:27:20PMunchFor notifishower I ended up using npeg to parse it
21:27:29PMunchBit of an untraditional choice, but it works
21:27:40PMunch@firasuke, well it depends
21:27:48PMunchI'd probably use multiple opt parsers
21:28:24PMunchWell I guess you could use a single one, but then have each branch only check the subset of args it cares about
21:28:47PMunchBasically parseopt just parses the options, you need to define their semantics
21:31:06PMunchIf you want an example of some more esoteric/complex options parsing: https://github.com/PMunch/notifishower/blob/master/src/options.nim
21:36:12FromDiscord<firasuke> thanks
21:46:07FromDiscord<eyes> wahoo
21:47:24FromDiscord<eyes> I am currently making a long-running program, sort of a server, which has a list of tasks to do at certain times (https POST requests)
21:47:53FromDiscord<eyes> timing is important in this case, its a program which sends reminder notifications
21:49:01FromDiscord<eyes> this leads to pretty complex code where im constantly re-creating a queue of the notifications that needs to be sent, in order of time
21:49:18FromDiscord<eyes> checking every iteration of my main loop whether it has passed that time
21:49:39FromDiscord<eyes> there must be a better way to do this... my only though so far has been to make a crontab for this program lol
21:49:46FromDiscord<eyes> it writes its own crontab
21:50:00FromDiscord<eyes> asynchronous programming maybe? another thread? im not sure
21:50:15FromDiscord<enthus1ast> even better than crontab is system timers
21:50:20FromDiscord<enthus1ast> systemd timers
21:50:43FromDiscord<enthus1ast> imho most crontabs are implemented by systemd timers these days
21:50:49FromDiscord<eyes> i would prefer something inside my program
21:50:57FromDiscord<eyes> systemd dependency šŸ˜”
21:51:08FromDiscord<enthus1ast> on linux
21:51:34FromDiscord<eyes> im willing to do systemd timers but i was looking for a more general solution in terms of coding style
21:51:42FromDiscord<eyes> what im doing right now is just.... so messy
21:52:02FromDiscord<eyes> there must be a simpler way to think about scheduling jobs for certain times
21:52:10FromDiscord<eyes> the more i think about it the more i think i need another thread
21:52:20FromDiscord<eyes> but idk maybe that will just increase complexity
21:58:10FromDiscord<enthus1ast> @eyes\: maybe this works for you\: https://github.com/soasme/nim-schedules
21:59:02FromDiscord<enthus1ast> have a look at the link i posted, this is what you want i think
22:00:03FromDiscord<Elegantbeef> does a `mixin mat4` help inside https://github.com/treeform/vmath/blob/f4c668874e48e9153d52c4d098f8202e5abec8a9/src/vmath.nim#L1334 ?ā†µ(@sOkam!)
22:00:40FromDiscord<Elegantbeef> Ah i see you solved it
22:03:44FromDiscord<sOkam!> yeah sry
22:17:08*adium quit (Quit: Stable ZNC by #bnc4you)
22:17:58FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nSS
22:18:33FromDiscord<Elegantbeef> You could define `proc mat4[T: PType](): GMat4[T]` i assume
22:18:49FromDiscord<Elegantbeef> Oh i didnt read šŸ˜„
22:18:58FromDiscord<Elegantbeef> You could implement a converter
22:19:03FromDiscord<Elegantbeef> But that's dumb
22:19:11FromDiscord<sOkam!> feels dumb ye šŸ˜¦
22:19:15*ltriant quit (Ping timeout: 252 seconds)
22:19:17FromDiscord<Elegantbeef> Vmath just doesnt seem to cover all cases of generics
22:20:01FromDiscord<Elegantbeef> it should just be `default(T)` not `0`
22:20:46FromDiscord<Elegantbeef> though line 1413 needs T 1
22:42:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nT0
22:43:26FromDiscord<Elegantbeef> !eval echo len(1..\<1)
22:43:30NimBotCompile failed: /usercode/in.nim(1, 11) Error: undeclared identifier: '..\<'
22:44:25FromDiscord<Elegantbeef> Dumb bot
22:44:31FromDiscord<sOkam!> nims script says 0
22:44:42FromDiscord<sOkam!> so len == 0 means doesn't run?
22:44:51FromDiscord<Elegantbeef> Correctomundo
22:44:57FromDiscord<sOkam!> k ty
22:51:58FromDiscord<Elegantbeef> Oh jeez i'm just aiming for good code quality i'm not an asshole! https://cme.h-its.org/exelixis/pubs/JanThesis.pdf
22:59:44*derpydoo joined #nim
23:08:28*adium joined #nim
23:19:27PMunch@Elegantbeef, do you know of a nice way to add destructors to pointer objects?
23:19:52PMunchI have something which returns a `ptr someobject` (from Futhark) and I want to add a destructor to that
23:20:06PMunchCurrently I have a dummy object which just holds the pointer
23:21:23*adium quit (Quit: Stable ZNC by #bnc4you)
23:26:15FromDiscord<Elegantbeef> `type MyPtr = distinct ptr T`
23:28:10*adium joined #nim
23:28:28FromDiscord<Elegantbeef> Also a `converter toBase(p: MyPtr): ptr T = (ptr T)(p)`
23:29:19FromDiscord<pmunch> Hmm, how would that help?
23:29:51FromDiscord<Elegantbeef> Distinct types can have destructors
23:30:02FromDiscord<pmunch> That article looks quite fun by the way
23:30:07FromDiscord<Elegantbeef> You no do not need to manually convert to the base for your C interop
23:30:21FromDiscord<pmunch> Oh really? No matter what they actually are?
23:30:29FromDiscord<Elegantbeef> Indeed
23:32:26FromDiscord<pmunch> Nice!
23:32:42FromDiscord<pmunch> Writing an article/guide on using Futhark
23:32:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nTh
23:33:41FromDiscord<Elegantbeef> Wow finally getting documentation on futhark?! The end is neigh šŸ˜„
23:34:14*derpydoo quit (Ping timeout: 260 seconds)
23:34:23*azimut quit (Ping timeout: 255 seconds)
23:35:50FromDiscord<pmunch> Ey, the README is getting pretty long I'll have you know!
23:36:09FromDiscord<Elegantbeef> I've eaten longer spaghetti noodles!
23:36:47FromDiscord<pmunch> It should document all the actual features. This article is more like a how to guide taking you from getting started to async integrated, garbage collected, Nim library
23:38:43FromDiscord<pmunch> Eaten longer dicks more like.. (sorry, just trying to improve my code quality)
23:38:47*PMunch quit (Quit: leaving)
23:38:52FromDiscord<Elegantbeef> lol
23:39:07FromDiscord<Elegantbeef> Hey you're a moderator you cannot say that, someone might think you're serious!
23:46:44FromDiscord<Hourglass [She/Her]> Oh has futhark gotten more work done on it?
23:55:39FromDiscord<BobBBob> alright I think the memory usage issues I was having just comes down to nim allocating more memory than it needs and reusing it, but I'm still not sure why sometimes running the code uses a reasonable but a bit high amount of memory and other times it uses 4 gigs. ā†µHere's some updated code if anyone wants to see, it just creates a big sequence of random numbers and benchmarks different techniques to modify itā†µhttps://files.catbox.moe/
23:56:47FromDiscord<BobBBob> also nim executables are tiny, this code is 100 lines but with flto compiles to 45KB, props to the devs
23:57:37FromDiscord<Elegantbeef> As I understand it Nim's default allocated does not return memory to OS
23:57:47FromDiscord<Elegantbeef> You might be able to `-d:useMalloc` to reduce memory consumption
23:58:46FromDiscord<Elegantbeef> If you put your code blocks into procedures it would make life better
23:59:12FromDiscord<Elegantbeef> Global variables are not freed until the program terminates
23:59:55FromDiscord<BobBBob> they're still global even if they're in a block?