00:00:04 | * | PMunch quit (Quit: leaving) |
00:43:28 | FromDiscord | <I have 50GB of nothing on my PC> how do I make nimlsp behave for a backend=js projec |
00:45:21 | FromDiscord | <Elegantbeef> Make a config with `--backend:js` |
00:57:09 | FromDiscord | <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:40 | FromDiscord | <albassort> beef help |
01:56:55 | FromDiscord | <Elegantbeef> What if i say no |
01:57:02 | FromDiscord | <albassort> i would be sad |
01:57:15 | FromDiscord | <albassort> beef |
01:57:33 | FromDiscord | <albassort> i dont see my functions in my wasm module |
01:57:56 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4nNO |
01:58:04 | FromDiscord | <albassort> nothin |
01:58:09 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4nNO" => "https://play.nim-lang.org/#ix=4nNP" |
01:58:13 | FromDiscord | <Elegantbeef> I dont even know what that is |
01:58:39 | FromDiscord | <albassort> im trying to call my compiled emscripten wasm |
01:58:43 | FromDiscord | <albassort> from jS |
01:58:53 | FromDiscord | <Elegantbeef> Did you export the procedure |
01:59:11 | FromDiscord | <albassort> {.exportc : "name", vargs" |
01:59:14 | FromDiscord | <albassort> (edit) "vargs"" => "vargs}" |
01:59:33 | FromDiscord | <Elegantbeef> That doesnt work with emscripten ime |
01:59:51 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/exporter.nim#L3-L19 |
02:00:25 | FromDiscord | <albassort> silly beef and his weird macros |
02:01:56 | FromDiscord | <Elegantbeef> One might be able to do `{.extern, exportc.}` but this works aswell |
02:02:21 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1074148422216597585/image.png |
02:02:23 | FromDiscord | <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:37 | FromDiscord | <Iliketwertles> yet again im being dumb i think |
04:26:17 | FromDiscord | <Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4nOn |
04:26:31 | FromDiscord | <Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4nOn" => "https://play.nim-lang.org/#ix=4nOo" |
04:27:17 | FromDiscord | <Iliketwertles> would i just like `var z = "path/to/zip"` somewhere in there? |
04:27:35 | FromDiscord | <Iliketwertles> after `var z: ZipArchive` |
04:32:37 | FromDiscord | <Iliketwertles> wait |
04:35:18 | FromDiscord | <Iliketwertles> nvm i figured it oyt |
04:35:20 | FromDiscord | <Iliketwertles> (edit) "oyt" => "out" |
05:20:49 | FromDiscord | <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:54 | onetwo | guys im getting Error: type mismatch when i try to compile this simple nim code |
05:57:06 | onetwo | echo 5 ^ 5 |
05:57:30 | FromDiscord | <amadan> Are you trying to do 5 to the power of 5? |
05:57:37 | FromDiscord | <Elegantbeef> Read the error |
05:57:40 | FromDiscord | <Elegantbeef> "Extra argument given" |
05:57:40 | onetwo | thats the bitwise xor operator |
05:57:44 | FromDiscord | <Elegantbeef> \`import std/math |
05:57:47 | FromDiscord | <Elegantbeef> No it's not |
05:57:50 | FromDiscord | <Elegantbeef> `^` is power in Nim |
05:57:59 | FromDiscord | <amadan> ah, well `xor` is xor in Nim |
05:57:59 | onetwo | it is? not ** ? |
05:58:01 | FromDiscord | <Elegantbeef> It's actually a backwards index when unary |
05:58:06 | FromDiscord | <amadan> So it would be `echo 5 xor 5` |
05:58:09 | FromDiscord | <Elegantbeef> This isnt python |
06:08:16 | FromDiscord | <naman4i> Hi |
06:08:49 | FromDiscord | <demotomohiro> Hi |
06:11:59 | FromDiscord | <Elegantbeef> Lol they left the room |
06:12:09 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1074211284498780221/image.png |
06:12:09 | FromDiscord | <Elegantbeef> Demo you're too scary |
07:07:52 | * | xet7 joined #nim |
07:09:17 | FromDiscord | <Rika> Lol |
07:19:58 | FromDiscord | <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:31 | FromDiscord | <šµcamelliašµ> In reply to @onetwo "thats the bitwise xor": https://nim-lang.org/docs/system.html#%5E.t%2Cint |
08:19:46 | onetwo | i 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:48 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#ix=4nPa |
08:57:09 | FromDiscord | <myxi> is that some expected behavior? I am very new to Nim. |
08:57:28 | FromDiscord | <Elegantbeef> `e` evaluates on the VM |
08:57:29 | FromDiscord | <Elegantbeef> So yes it is |
08:57:55 | FromDiscord | <Elegantbeef> you want `nim c -d:ssl -r test.nim` or `nim r -d:ssl my.nim` |
08:57:58 | FromDiscord | <myxi> then, what'd be the fastest way to run the code? |
08:58:04 | FromDiscord | <myxi> oh |
08:58:15 | FromDiscord | <Elegantbeef> The fastest way is to use tcc |
08:58:25 | FromDiscord | <Elegantbeef> so install tcc then supply `--cc:tcc` |
09:00:46 | FromDiscord | <myxi> I see. It did feel slightly fast, maybe, the significant difference is seen with bigger projects. Thanks! |
09:01:10 | FromDiscord | <myxi> (edit) "fast, maybe," => "fast; perhaps" |
09:03:07 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> So it'll only really effect recompilation and for small things it can theoretically be slower |
09:28:37 | FromDiscord | <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:51 | FromDiscord | <Phil> (edit) "others" => "others, which I'm not sure is the point" |
09:30:22 | FromDiscord | <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:36 | FromDiscord | <Elegantbeef> 99% of that is phil š |
09:30:57 | FromDiscord | <Phil> Eternalizing what I'm learning from this discord for when I inevitably forget about what I learned 5 minutes later |
09:31:50 | FromDiscord | <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:15 | FromDiscord | <Phil> At least for me Nimeventer was pretty important to get notified about nim questions |
09:32:24 | FromDiscord | <Phil> (edit) "At least for me Nimeventer was pretty important to get notified about nim questions ... " added "and help out" |
09:33:08 | FromDiscord | <enthus1ast> i think its a great idea to write such stuff on so |
09:35:12 | FromDiscord | <Phil> I can't seem to get ahold of Yard, Anyone have an idea where the nimeventer bot could be stored? |
09:35:21 | FromDiscord | <Phil> (edit) "I can't seem to get ahold of Yard, Anyone have an idea where the ... nimeventer" added "codebase for the" |
09:35:50 | FromDiscord | <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:03 | FromDiscord | <enthus1ast> it would be good in general to have an "infrastructure diagramm", that could answer such questions |
09:41:12 | FromDiscord | <ringabout> Is there a repo for https://rosettacode.org/wiki/Category:Nim |
09:41:37 | FromDiscord | <ringabout> I would like to monitor the performance of rosettacode. |
09:42:35 | FromDiscord | <ringabout> Fine, I'm using this one https://github.com/def-/nim-unsorted |
09:43:25 | FromDiscord | <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:45 | FromDiscord | <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:37 | FromDiscord | <myxi> some server, https://api.stackexchange.com/docs/questions-by-answer-ids and a basic script to send discord webhook |
09:44:39 | FromDiscord | <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:54 | FromDiscord | <myxi> (edit) "some server, https://api.stackexchange.com/docs/questions-by-answer-ids ... and" added "," |
09:45:28 | FromDiscord | <myxi> (edit) "https://api.stackexchange.com/docs/questions-by-answer-ids" => "https://api.stackexchange.com/docs/" |
09:45:29 | FromDiscord | <enthus1ast> @ringabout\: i found this one https://github.com/acmeism/RosettaCodeData |
09:46:00 | FromDiscord | <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:22 | FromDiscord | <ringabout> In reply to @enthus1ast "<@658563905425244160>\: i found this": Thank you! |
09:49:08 | FromDiscord | <Phil> Actually, we only need a bot or what have you to post to discord, right? |
09:49:18 | FromDiscord | <Phil> The bridges should take care of propagating to matrix etc. |
09:49:39 | FromDiscord | <Phil> Or other way round, post to matrix and the bridge propagates it from there |
09:50:06 | FromDiscord | <enthus1ast> @ringabout\: There is a special page that lets you downoad pages in bulk https://rosettacode.org/wiki/Special:Export |
09:50:41 | FromDiscord | <enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/1074266280376414238/image.png |
09:52:48 | FromDiscord | <enthus1ast> from there you must parse it unfortunately... |
09:54:32 | FromDiscord | <ringabout> I see |
09:58:22 | FromDiscord | <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:59 | FromDiscord | <myxi> it seems that the latest post was created by you |
09:59:28 | FromDiscord | <myxi> (edit) ""nim-lang":" => ""nim-lang" using SO API:" |
09:59:32 | FromDiscord | <Phil> I think the main issue might actually be getting that webhook to be run somewhere |
09:59:56 | FromDiscord | <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:40 | FromDiscord | <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:00 | FromDiscord | <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:20 | FromDiscord | <hotdog> Iāve searched around but canāt find a repo for it anywhere |
10:01:27 | FromDiscord | <hotdog> Maybe it was not open sourced |
10:01:57 | FromDiscord | <ringabout> ^ https://github.com/Yardanico/nimeventer |
10:02:46 | FromDiscord | <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:57 | FromDiscord | <Phil> https://github.com/Yardanico/nimeventer |
10:02:58 | FromDiscord | <Phil> Dangit, too slow |
10:03:00 | FromDiscord | <Phil> Wow, delayed even more by my connection being ass |
10:03:53 | FromDiscord | <myxi> https://github.com/Yardanico/nimeventer/blob/master/src/nimeventer.nim#L48 it's using a webhook for discord as well |
10:03:57 | FromDiscord | <hotdog> Oh itās an irc bot. I remembered it being a discord bot |
10:04:58 | FromDiscord | <hotdog> Ah wait it posts to both? |
10:05:59 | FromDiscord | <Phil> Well, let's see if it still builds |
10:06:26 | FromDiscord | <Phil> It does! |
10:06:41 | FromDiscord | <Phil> Now I'd need the actual proper config.json file to see why the heck it's broken |
10:07:31 | FromDiscord | <hotdog> Maybe the server itās running on is just down? |
10:24:03 | FromDiscord | <myxi> sent a long message, see http://ix.io/4nPr |
10:24:55 | FromDiscord | <myxi> (edit) "http://ix.io/4nPr" => "http://ix.io/4nPs" |
10:25:02 | FromDiscord | <enthus1ast> i think Yardanico does that |
10:29:01 | FromDiscord | <Phil> sent a long message, see http://ix.io/4nPt |
10:30:03 | FromDiscord | <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:39 | FromDiscord | <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:18 | FromDiscord | <myxi> i feel instead of that, it'd be easier to create a new script of it |
10:33:02 | FromDiscord | <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:15 | FromDiscord | <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:36 | FromDiscord | <myxi> i am good at python and can write a script for this if you want |
10:36:11 | FromDiscord | <Phil> I mean, I'd welcome it, getting notifications here is imo pretty important to support SO folks |
10:36:12 | FromDiscord | <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:43 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/vurtun/nuklearāµJust found that, sounds interesting |
13:47:51 | FromDiscord | <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:44 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4nQV |
15:58:08 | FromDiscord | <auxym> and when I try to make a `cstring` specific overload, I get an error about ambiguous calls |
15:58:25 | FromDiscord | <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:34 | FromDiscord | <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:16 | FromDiscord | <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:17 | PMunch | @auxym, of course |
16:37:02 | FromDiscord | <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:40 | PMunch | Ooh, no I haven't but I've had it on my mental TODO |
16:38:27 | FromDiscord | <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:04 | PMunch | Hmm, 0x7f is a strange character to send |
16:39:25 | FromDiscord | <auxym> coincidentally its equal to int8.high |
16:39:32 | PMunch | Yeah |
16:39:37 | PMunch | ASCII Del character |
16:39:46 | FromDiscord | <auxym> wondering if its a signed/unsigned char thing |
16:40:41 | FromDiscord | <auxym> might be an occasion to figure out how debugging in openOCD works, ha |
16:43:11 | PMunch | Hmm, what is actually done for an echo |
16:46:00 | PMunch | Do you have something that I can run on a normal machine? |
16:49:01 | FromDiscord | <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:41 | PMunch | Yeah, just something simple that puts it in quotes or something |
16:50:07 | FromDiscord | <auxym> but the current implem is here FYI:https://github.com/auxym/nim-on-samd21/blob/add-syscalls/src/syscalls.nim#L32 |
16:52:48 | PMunch | Hmm, 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:24 | FromDiscord | <auxym> hm. good find, thanks, will have a look. |
17:01:43 | FromDiscord | <auxym> I wonder if I can tell nim/libc (?) to use the non-reentrant write instead |
17:01:55 | FromDiscord | <auxym> nim's echo is supposed to be thread-safe |
17:02:32 | PMunch | I'm still poking through the system to figure out where that gets called |
17:02:42 | PMunch | I've gotten to the fwrite part |
17:02:58 | PMunch | Curiously in syncio it has a declared guard around fwrite |
17:03:49 | PMunch | This might also be relevant: https://community.st.com/s/question/0D50X0000B8kTytSQE/printf-not-working-write-never-gets-called |
17:05:48 | FromDiscord | <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:04 | FromDiscord | <eyes> is there a builtin or std function to remove a range from a string š„ŗ |
17:07:11 | FromDiscord | <eyes> sorry to interrupt |
17:07:30 | FromDiscord | <eyes> we should make a forum with threads |
17:07:45 | FromDiscord | <Phil> Nah, SO questions, easier to search for imo |
17:08:55 | PMunch | @auxym, well echoBinSafe is what it ends up as |
17:09:13 | FromDiscord | <Phil> In reply to @eyes "is there a builtin": https://nim-lang.org/docs/strutils.html#delete%2Cstring%2CSlice%5Bint%5D |
17:09:21 | FromDiscord | <Phil> delete proc useable with a range |
17:09:32 | PMunch | Which then calls c_fwrite |
17:09:54 | PMunch | Which is defined in syncio and ansi_c |
17:10:03 | PMunch | Not sure which one is used in our case |
17:11:04 | PMunch | Ah, 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:33 | FromDiscord | <ringabout> `nimVM` has 188 opcodes, doesn't it mean the dispatcher is super slow? |
17:11:49 | PMunch | Either way those end up as fwrite from stdio.h |
17:11:56 | FromDiscord | <eyes> In reply to @Isofruit "https://nim-lang.org/docs/strutils.html#delete%2Cst": very cool thank you :) |
17:17:57 | PMunch | @auxym, having `echo` be outputable over UART would be awesome though |
17:34:48 | FromDiscord | <iencec> in a macro, is there way to get the fields of `typedesc`? |
17:46:25 | FromDiscord | <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:02 | PMunch | @iencec, yes |
17:49:21 | PMunch | @BobBBob, yes |
17:49:52 | FromDiscord | <Phil> That indicates that a ref is floating about somewhere to me |
17:50:18 | PMunch | Nah, it's just Nim holding on to it in case it needs more memory for something else |
17:50:46 | PMunch | If you use -d:useMalloc or whatever the switch is called then you should see it drop back down |
17:50:55 | PMunch | Of course as long as the reference is completely gone |
17:51:08 | FromDiscord | <BobBBob> It's a quick program, maybe it just didnt get a chance to free it, should I post the code? |
17:53:34 | FromDiscord | <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:03 | FromDiscord | <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:01 | PMunch | Huh, didn't expect to get a thanks out of that one :P |
18:14:26 | PMunch | @BobBBob, as I said, you're probably doing everything right, Nim is just a bit greedy when it comes to memory |
18:15:16 | PMunch | In 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:08 | PMunch | Basically 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:33 | PMunch | This is because Nim has kept the original gigabyte allocated instead of returning it to the system |
18:18:39 | FromDiscord | <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:49 | FromDiscord | <System64 ~ Flandre Scarlet> Does Nim have undefined behavior? |
18:20:25 | FromDiscord | <Phil> unsafeaddr |
18:20:39 | PMunch | @System64_~_Flandre_Scarlet, not unless you invoke any of C's undefined behaviour |
18:20:49 | PMunch | @Phil, exactly |
18:20:51 | FromDiscord | <Phil> What you do with pointers is a secret only shared between and the pointer |
18:21:08 | PMunch | Syscalls are "expensive", so it's faster for Nim to keep its own memory pool |
18:21:23 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright good to knowāµSo waaay safer than C |
18:21:24 | FromDiscord | <Phil> Basically, the second you touch a pointer all bets are off for that section of the code |
18:21:37 | PMunch | With -d:useMalloc it will just use malloc and free directly and you can properly profile memory usage using existing tools |
18:21:38 | FromDiscord | <System64 ~ Flandre Scarlet> what does it mean? |
18:21:53 | FromDiscord | <Phil> In reply to @System64 "what does it mean?": By "it" you mean a pointer? |
18:22:02 | FromDiscord | <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:07 | FromDiscord | <System64 ~ Flandre Scarlet> I know what a pointer is |
18:22:43 | FromDiscord | <System64 ~ Flandre Scarlet> I meant, the sense of this sentenceāµLike, the second I touch a pointer, it can go wrong? |
18:25:42 | PMunch | Huh, apparently you can't `include` a const string.. |
18:25:46 | PMunch | That's annoying |
18:26:02 | FromDiscord | <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:07 | FromDiscord | <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:34 | FromDiscord | <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:04 | FromDiscord | <System64 ~ Flandre Scarlet> As long you know what you do, no problems I thinkāµIt's not like C |
18:28:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nRO |
18:29:24 | FromDiscord | <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:02 | FromDiscord | <Phil> In reply to @BobBBob "hey as long as": C: Where types are suggestions |
18:31:02 | FromDiscord | <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:11 | FromDiscord | <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:01 | FromDiscord | <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:02 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @BobBBob "hey as long as": problem : C is so unsafe |
18:32:37 | FromDiscord | <enthus1ast> @firasuke\: for quick and easy i use cligen |
18:32:55 | FromDiscord | <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:08 | FromDiscord | <firasuke> Oh ok, thanks |
18:33:16 | FromDiscord | <firasuke> what are your thoughts on `cliche` and `bossy` though? |
18:33:17 | FromDiscord | <sOkam!> i still haven't found something that parseopts doesn't cover, so its no simple lib |
18:33:56 | FromDiscord | <enthus1ast> never used those |
18:34:24 | FromDiscord | <firasuke> Alright, thanks for your insight |
18:39:32 | FromDiscord | <Phil> How do I figure out inside of a program the currently most up to date version of a package? |
18:40:07 | FromDiscord | <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:34 | FromDiscord | <Phil> Nimble search does not contain version information |
18:43:18 | FromDiscord | <hotdog> In reply to @Isofruit "How do I figure": Probably need to get the tags from the upstream repo |
18:52:30 | FromDiscord | <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:25 | FromDiscord | <BobBBob> nim does automatically send sequences by reference right? |
19:10:10 | FromDiscord | <Rika> No, copied if not mutable |
19:11:12 | FromDiscord | <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:25 | FromDiscord | <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:33 | FromDiscord | <Rika> I assume they copy |
19:14:29 | FromDiscord | <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:37 | FromDiscord | <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:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nRZ |
19:18:03 | FromDiscord | <BobBBob> how do I dereference it? |
19:18:40 | FromDiscord | <Phil> `[]` |
19:18:47 | FromDiscord | <Phil> It's the deref operator |
19:19:38 | FromDiscord | <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:56 | FromDiscord | <hotdog> And not just GitHub, it has to be host agnostic |
19:20:15 | PMunch | @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:47 | FromDiscord | <hotdog> I guess this is the downside of not having a central package server |
19:23:48 | FromDiscord | <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:02 | FromDiscord | <tfp> qq, i have a bit of code like this |
19:24:29 | FromDiscord | <tfp> sent a code paste, see https://play.nim-lang.org/#ix=4nS3 |
19:24:31 | FromDiscord | <tfp> because the arrays are sized differently this isn't possible |
19:24:45 | FromDiscord | <tfp> it's kind of in a hot path so i don't want to make an allocation |
19:24:57 | FromDiscord | <tfp> is there something like a slice or idk that can handle this scenario |
19:25:36 | FromDiscord | <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:17 | FromDiscord | <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:20 | FromDiscord | <planetis> it was rewritten in qtquick |
19:35:21 | FromDiscord | <huantian> In reply to @Rika "I do wonder if": It should right? That would make sense for seq and string |
19:35:39 | FromDiscord | <huantian> Though it would make sense if it didnāt as wellā¦ |
19:37:50 | FromDiscord | <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:10 | FromDiscord | <Phil> Because the alternative is cloning every dependency to check their git tags and I'm not doing that |
19:38:23 | FromDiscord | <Phil> (edit) "Because the alternative ... is" added "I'm seeing" |
19:40:47 | FromDiscord | <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:16 | FromDiscord | <hotdog> Never tried it though.. |
19:42:46 | FromDiscord | <Phil> The issue is more that I'm not within a git repository, I just want the information, not the repo itself |
19:46:27 | FromDiscord | <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:39 | FromDiscord | <Phil> Perfect |
19:48:10 | FromDiscord | <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:01 | PMunch | Anyone know an easier way of doing this? http://ix.io/4nSb |
19:57:27 | * | ltriant quit (Ping timeout: 260 seconds) |
20:02:34 | FromDiscord | <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:52 | FromDiscord | <myxi> (edit) "https://github.com/eeriemyxi/discord-stackoverflow-notifierāµYou" => "<https://github.com/eeriemyxi/discord-stackoverflow-notifier>āµYou" |
20:03:23 | FromDiscord | <myxi> (edit) "ones" => "ones; that shouldn't take long though" |
20:04:05 | FromDiscord | <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:10 | FromDiscord | <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:53 | FromDiscord | <sOkam!> Can someone else reproduce this error, or is my nim broken? https://media.discordapp.net/attachments/371759389889003532/1074432427474296872/bug.nim |
20:51:20 | PMunch | Ugh, Discord code-pastes are broken over the bridge |
20:51:48 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nSs |
20:51:59 | * | ltriant quit (Ping timeout: 252 seconds) |
20:52:10 | FromDiscord | <sOkam!> i thought it was my type at first, but this happens even with floats... so |
20:52:49 | FromDiscord | <Phil> In reply to @myxi "<https://github.com/eeriemyxi/discord-stackoverflow": Sweet! Thanks! |
20:53:11 | FromDiscord | <Phil> I think the main reason to compile to C would be to simplify the installment process |
20:53:22 | FromDiscord | <Phil> Since that would be reduced to "Here is binary, enjoy" |
20:54:54 | FromDiscord | <Phil> Unrelated sidenote:āµIs there an asynchronous way to essentially do a `execCmdEx` call? |
20:55:09 | FromDiscord | <Phil> I wanna run a bunch of git commands but I don't want them to run synchronously |
20:55:15 | PMunch | On linux you can |
20:55:28 | PMunch | I mean you could just spawn the processes |
20:55:42 | PMunch | And then check if they have exited and check their return codes |
20:56:10 | FromDiscord | <Phil> Assume I have not ever spawned a process |
20:56:19 | FromDiscord | <Phil> Do I do while loops to check that? |
20:57:44 | PMunch | More or less yeah |
20:57:53 | PMunch | Or you could use asyncproc from here: https://github.com/cheatfate/asynctools |
20:57:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nSu |
20:58:32 | PMunch | Yeah, something like that |
21:15:16 | * | ltriant joined #nim |
21:18:52 | FromDiscord | <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:48 | FromDiscord | <sOkam!> Mystery solved. It wasn't my code, its a typo bug in vmathāµhttps://github.com/treeform/vmath/issues/63 |
21:24:13 | PMunch | @firasuke, kinda |
21:25:04 | PMunch | I mean the obvious way would be to have sub-commands like e.g. `git commit` |
21:25:29 | PMunch | So 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:04 | FromDiscord | <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:48 | PMunch | There's also docopt, the recently updated Cliche, and many more ways to deal with command line options |
21:27:20 | PMunch | For notifishower I ended up using npeg to parse it |
21:27:29 | PMunch | Bit of an untraditional choice, but it works |
21:27:40 | PMunch | @firasuke, well it depends |
21:27:48 | PMunch | I'd probably use multiple opt parsers |
21:28:24 | PMunch | Well I guess you could use a single one, but then have each branch only check the subset of args it cares about |
21:28:47 | PMunch | Basically parseopt just parses the options, you need to define their semantics |
21:31:06 | PMunch | If you want an example of some more esoteric/complex options parsing: https://github.com/PMunch/notifishower/blob/master/src/options.nim |
21:36:12 | FromDiscord | <firasuke> thanks |
21:46:07 | FromDiscord | <eyes> wahoo |
21:47:24 | FromDiscord | <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:53 | FromDiscord | <eyes> timing is important in this case, its a program which sends reminder notifications |
21:49:01 | FromDiscord | <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:18 | FromDiscord | <eyes> checking every iteration of my main loop whether it has passed that time |
21:49:39 | FromDiscord | <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:46 | FromDiscord | <eyes> it writes its own crontab |
21:50:00 | FromDiscord | <eyes> asynchronous programming maybe? another thread? im not sure |
21:50:15 | FromDiscord | <enthus1ast> even better than crontab is system timers |
21:50:20 | FromDiscord | <enthus1ast> systemd timers |
21:50:43 | FromDiscord | <enthus1ast> imho most crontabs are implemented by systemd timers these days |
21:50:49 | FromDiscord | <eyes> i would prefer something inside my program |
21:50:57 | FromDiscord | <eyes> systemd dependency š |
21:51:08 | FromDiscord | <enthus1ast> on linux |
21:51:34 | FromDiscord | <eyes> im willing to do systemd timers but i was looking for a more general solution in terms of coding style |
21:51:42 | FromDiscord | <eyes> what im doing right now is just.... so messy |
21:52:02 | FromDiscord | <eyes> there must be a simpler way to think about scheduling jobs for certain times |
21:52:10 | FromDiscord | <eyes> the more i think about it the more i think i need another thread |
21:52:20 | FromDiscord | <eyes> but idk maybe that will just increase complexity |
21:58:10 | FromDiscord | <enthus1ast> @eyes\: maybe this works for you\: https://github.com/soasme/nim-schedules |
21:59:02 | FromDiscord | <enthus1ast> have a look at the link i posted, this is what you want i think |
22:00:03 | FromDiscord | <Elegantbeef> does a `mixin mat4` help inside https://github.com/treeform/vmath/blob/f4c668874e48e9153d52c4d098f8202e5abec8a9/src/vmath.nim#L1334 ?āµ(@sOkam!) |
22:00:40 | FromDiscord | <Elegantbeef> Ah i see you solved it |
22:03:44 | FromDiscord | <sOkam!> yeah sry |
22:17:08 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
22:17:58 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nSS |
22:18:33 | FromDiscord | <Elegantbeef> You could define `proc mat4[T: PType](): GMat4[T]` i assume |
22:18:49 | FromDiscord | <Elegantbeef> Oh i didnt read š |
22:18:58 | FromDiscord | <Elegantbeef> You could implement a converter |
22:19:03 | FromDiscord | <Elegantbeef> But that's dumb |
22:19:11 | FromDiscord | <sOkam!> feels dumb ye š¦ |
22:19:15 | * | ltriant quit (Ping timeout: 252 seconds) |
22:19:17 | FromDiscord | <Elegantbeef> Vmath just doesnt seem to cover all cases of generics |
22:20:01 | FromDiscord | <Elegantbeef> it should just be `default(T)` not `0` |
22:20:46 | FromDiscord | <Elegantbeef> though line 1413 needs T 1 |
22:42:33 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nT0 |
22:43:26 | FromDiscord | <Elegantbeef> !eval echo len(1..\<1) |
22:43:30 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: undeclared identifier: '..\<' |
22:44:25 | FromDiscord | <Elegantbeef> Dumb bot |
22:44:31 | FromDiscord | <sOkam!> nims script says 0 |
22:44:42 | FromDiscord | <sOkam!> so len == 0 means doesn't run? |
22:44:51 | FromDiscord | <Elegantbeef> Correctomundo |
22:44:57 | FromDiscord | <sOkam!> k ty |
22:51:58 | FromDiscord | <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:27 | PMunch | @Elegantbeef, do you know of a nice way to add destructors to pointer objects? |
23:19:52 | PMunch | I have something which returns a `ptr someobject` (from Futhark) and I want to add a destructor to that |
23:20:06 | PMunch | Currently I have a dummy object which just holds the pointer |
23:21:23 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
23:26:15 | FromDiscord | <Elegantbeef> `type MyPtr = distinct ptr T` |
23:28:10 | * | adium joined #nim |
23:28:28 | FromDiscord | <Elegantbeef> Also a `converter toBase(p: MyPtr): ptr T = (ptr T)(p)` |
23:29:19 | FromDiscord | <pmunch> Hmm, how would that help? |
23:29:51 | FromDiscord | <Elegantbeef> Distinct types can have destructors |
23:30:02 | FromDiscord | <pmunch> That article looks quite fun by the way |
23:30:07 | FromDiscord | <Elegantbeef> You no do not need to manually convert to the base for your C interop |
23:30:21 | FromDiscord | <pmunch> Oh really? No matter what they actually are? |
23:30:29 | FromDiscord | <Elegantbeef> Indeed |
23:32:26 | FromDiscord | <pmunch> Nice! |
23:32:42 | FromDiscord | <pmunch> Writing an article/guide on using Futhark |
23:32:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nTh |
23:33:41 | FromDiscord | <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:50 | FromDiscord | <pmunch> Ey, the README is getting pretty long I'll have you know! |
23:36:09 | FromDiscord | <Elegantbeef> I've eaten longer spaghetti noodles! |
23:36:47 | FromDiscord | <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:43 | FromDiscord | <pmunch> Eaten longer dicks more like.. (sorry, just trying to improve my code quality) |
23:38:47 | * | PMunch quit (Quit: leaving) |
23:38:52 | FromDiscord | <Elegantbeef> lol |
23:39:07 | FromDiscord | <Elegantbeef> Hey you're a moderator you cannot say that, someone might think you're serious! |
23:46:44 | FromDiscord | <Hourglass [She/Her]> Oh has futhark gotten more work done on it? |
23:55:39 | FromDiscord | <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:47 | FromDiscord | <BobBBob> also nim executables are tiny, this code is 100 lines but with flto compiles to 45KB, props to the devs |
23:57:37 | FromDiscord | <Elegantbeef> As I understand it Nim's default allocated does not return memory to OS |
23:57:47 | FromDiscord | <Elegantbeef> You might be able to `-d:useMalloc` to reduce memory consumption |
23:58:46 | FromDiscord | <Elegantbeef> If you put your code blocks into procedures it would make life better |
23:59:12 | FromDiscord | <Elegantbeef> Global variables are not freed until the program terminates |
23:59:55 | FromDiscord | <BobBBob> they're still global even if they're in a block? |