00:01:22 | FromDiscord | <girvo> ooooh |
00:01:49 | FromDiscord | <girvo> `-rw-r--r-- 1 root root 1.8M Mar 6 00:00 @m..@s..@s..@[email protected]@[email protected]@smsgpack4nim.nim.c.obj`↵↵Just found out msgpack4nim is part of why our binary is much bigger than we want lol |
00:02:03 | FromDiscord | <Elegantbeef> Time to use my non standard vsbf |
00:02:11 | FromDiscord | <girvo> And we are going to make a breaking protocol change for the network side shortly, might be worth examining protobufs again |
00:02:56 | FromDiscord | <leorize> have you looked at flatbuffers or capt'n proto? |
00:04:44 | FromDiscord | <Elegantbeef> cap'n proto too 😛 |
00:05:05 | FromDiscord | <girvo> we have, and I can't remember why I ruled them out lmao |
00:05:09 | FromDiscord | <girvo> I'll have another look |
00:08:31 | FromDiscord | <morgan> i really oughta split up my code, futhark and type overrides in one, and ported example plugin in the other |
00:08:52 | FromDiscord | <girvo> Oh I think its because I didn't see a FlatBuffers Nim impl aside from the HugoP707 one that says its incomplete? |
00:09:29 | FromDiscord | <girvo> and Cap'n'Proto has capnp which is old as the hills and unmaintained, which worried me |
00:11:39 | FromDiscord | <leorize> if you like the format, then maintain the impls yourself |
00:11:42 | FromDiscord | <leorize> esp for commerical usage |
00:11:54 | FromDiscord | <leorize> you can't rely on contributors being interested forever |
00:12:31 | FromDiscord | <girvo> Absolutely |
00:12:43 | FromDiscord | <girvo> (which is why we implemented Modbus RTU among other protocols ourselves) |
00:13:34 | FromDiscord | <girvo> As well as our Nesper fork, and the in progress port of Chronos to FreeRTOS + newlib, among other things |
00:14:14 | FromDiscord | <girvo> Just don't have the bandwidth for a serialisation library as well, at the moment, so messagepack/possibly protobufs end up being the choice for today |
00:18:45 | FromDiscord | <Langosta> apologies if this is in the wrong chat, but is https://github.com/alaviss/nim.nvim the most updated nvim plugin for nim? |
00:21:26 | FromDiscord | <Elegantbeef> He does have a treesitter grammar and there is a LSP client so that's probably best |
00:22:44 | * | jmdaemon joined #nim |
00:23:42 | FromDiscord | <Robyn [She/Her]> Isn't the treesitter grammar intensely memory hungry or something? |
00:24:11 | FromDiscord | <leorize> where did you hear that? |
00:24:24 | FromDiscord | <saint.___.> In reply to @alendrik "apologies if this is": the treesitter grammar is built in now |
00:24:39 | FromDiscord | <saint.___.> And you can use an lsp with the built in nvim lsp |
00:24:44 | FromDiscord | <saint.___.> I don't think u need that plugin anymore |
00:25:18 | FromDiscord | <leorize> the plugin is still useful for its indentation plugin and nimsuggest integration (which could be more stable than LSP) |
00:25:28 | FromDiscord | <leorize> but otherwise, I'm working on making the plugin not required anymore |
00:25:31 | termer | girvo Yeah, like Elegantbeef said, there's a lib that generates it without protoc |
00:25:32 | termer | uses macros |
00:25:33 | termer | really nice |
00:25:55 | FromDiscord | <Langosta> sounds good! thank yall :) |
00:48:14 | FromDiscord | <girvo> In reply to @termer "really nice": yeah I'm already examining it, looks perfect for what we're after |
00:52:56 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "where did you hear": Not sure, think there was a Nim parser that was memory hungry? Dunno which one |
00:58:42 | FromDiscord | <Elegantbeef> I think you're thinking about how much memory leo's TS grammar was using when it was being compiled |
01:05:08 | FromDiscord | <Robyn [She/Her]> Oooh that'd explain it |
01:05:55 | FromDiscord | <leorize> generating the parser takes about 7-10GB of ram |
01:06:24 | FromDiscord | <leorize> the generated parser is pretty fast, though |
01:30:26 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "generating the parser takes": Yikes... Why? |
01:51:06 | FromDiscord | <kumolonimbus> Hey, I am having issues with winim and string format/concatenation. I am trying to call the windows API `CreateProcess` with the process name set by using a string format. When I just hardcode the string it works fine, but if I use format/concatentation then it fails. When I asked about this earlier someone suggested I place a reference to the string after the `CreateProcess` call so that it doesn't free, however that hasn't worked s |
01:52:29 | FromDiscord | <kumolonimbus> sent a code paste, see https://play.nim-lang.org/#pasty=aApkdMWNlKOq |
01:54:50 | FromDiscord | <Elegantbeef> Why not just use `osproc`? |
02:03:29 | FromDiscord | <kumolonimbus> I need to start the process in a suspended state |
02:07:30 | FromDiscord | <Robyn [She/Her]> Why aren't the bugs raised in Nim from the cps library having any development done on them, out of curiosity |
02:07:58 | FromDiscord | <Robyn [She/Her]> Is it just because they only really affect cps and Nim isn't bothered about supporting it? |
02:20:29 | FromDiscord | <Elegantbeef> Now I imagine it's cause they only care about the skull |
02:20:37 | FromDiscord | <kumolonimbus> In reply to @kumolonimbus "Hey, I am having": I figured it out! I was retrieving the `WINDIR` environment variable by using `GetEnvironmentVariableA`, which means I had to create a new string using `var windir = newString(MAX_PATH)` so I could pass it to the Win32 API call, then when trying to format this string with others it goes all screwey. The solution is to get `WINDIR` by using `os.getEnv("WIDIR")` |
02:39:35 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Now I imagine it's": Why wouldn't Araq fix it though? |
02:43:13 | FromDiscord | <zumi.dxy> "PRs welcome" :p |
02:50:10 | FromDiscord | <Robyn [She/Her]> Fair |
02:51:33 | FromDiscord | <leorize> turns out nim grammar is really hard to generate a small parser for↵(@Robyn [She/Her]) |
02:52:25 | FromDiscord | <leorize> it's the same reason as those IC promises years back↵(@Robyn [She/Her]) |
02:53:06 | FromDiscord | <leorize> for those who don't know, Araq actually promised to make CPS bugs a priority |
02:53:45 | FromDiscord | <leorize> all we get by now is a nice tag to remind us of how we were neglected |
02:54:24 | NimEventer | New thread by SalMolhado: Best REGEX library for targeting both JS and C, see https://forum.nim-lang.org/t/11160 |
02:55:35 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "turns out nim grammar": Ah |
02:56:10 | FromDiscord | <leorize> "grammar" to be precise, don't trust that stuff you see in the manual |
02:56:28 | FromDiscord | <leorize> it's not correct and missing a ton of details that are ad-hoc parser rules |
02:59:21 | FromDiscord | <Robyn [She/Her]> Like whitespace indentation? |
02:59:56 | rockcavera | like this: https://nim-lang.org/docs/manual.html#templates-lookup-rules-for-template-parameters ? |
03:00:35 | * | jmdaemon quit (Ping timeout: 264 seconds) |
03:00:47 | FromDiscord | <leorize> that's not a parser thing |
03:00:56 | FromDiscord | <leorize> yes↵(@Robyn [She/Her]) |
03:01:16 | FromDiscord | <leorize> and there are rules about which operators can be parsed as which |
03:03:14 | FromDiscord | <leorize> depending on where they appear |
03:03:26 | FromDiscord | <leorize> and depending on the spaces around them |
03:05:27 | NimEventer | New thread by hyu1996: This forum has an XSS injection vulnerability, see https://forum.nim-lang.org/t/11161 |
03:07:52 | FromDiscord | <zumi.dxy> man, the timing... |
03:15:52 | FromDiscord | <varriount> In reply to @leorize "all we get by": It's a shame the computer isn't understandable enough for more people to contribute. |
03:19:46 | FromDiscord | <haoyu233> https://media.discordapp.net/attachments/371759389889003532/1214774393029394452/image.png?ex=65fa55d0&is=65e7e0d0&hm=260fa1c13e0d5458caa6cee83a3b92b874cde0e4adbc6f024db05fd4316c3dc8& |
03:20:03 | termer | you're about to get pwned |
03:20:09 | termer | clients aren't supposed to do that |
03:20:27 | termer | where is this |
03:20:34 | FromDiscord | <leorize> it would have been if the people who care about that wasn't pushed away↵(@varriount) |
03:22:40 | FromDiscord | <varriount> In reply to @leorize "it would have been": Who specifically? |
03:27:10 | FromDiscord | <leorize> we got saem, disruptek, cabbose, clyybber, haxscramper and maybe zevv |
03:28:16 | FromDiscord | <leorize> saem in particular was spearheading some big refactoring to clean up the compiler\: https://github.com/nim-lang/compilerdev/issues/16 |
03:29:14 | FromDiscord | <leorize> and disruptek wrote IC and name mangling, only to be left out there to rot |
03:30:23 | FromDiscord | <varriount> Yeah, I'm not surprised. This is kinda why I've become mostly disengaged with Nim. |
03:31:43 | FromDiscord | <leorize> when a bunch of us decided to go our separate ways to make nimskull, it's a message that something is really wrong with nim that we decided it was better to not be involved with the main project anymore |
03:41:24 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#pasty=BPzumOfueBQZ |
03:44:29 | FromDiscord | <leorize> nope |
03:44:29 | FromDiscord | <Elegantbeef> Make a overload that just calls it |
03:44:45 | FromDiscord | <user2m> In reply to @Elegantbeef "Make a overload that": yeah tthat's what i've been doing |
04:40:28 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
04:41:01 | * | SchweinDeBurg joined #nim |
05:29:31 | NimEventer | New Nimble package! sunny - JSON in Nim with Go-like field tags, see https://github.com/guzba/sunny |
05:30:03 | FromDiscord | <odexine> interesting commit titles |
05:30:27 | FromDiscord | <guzba8> i may work alone 🙃 |
05:30:34 | FromDiscord | <Elegantbeef> press f to pay respects |
05:30:41 | FromDiscord | <Elegantbeef> I mean I work alone but still attempt to have readable history |
05:30:57 | FromDiscord | <odexine> then theres me who works alone and doesnt even commit |
05:30:58 | FromDiscord | <odexine> :baqua: |
05:31:20 | FromDiscord | <Elegantbeef> just `git commit --allow-empty-message` 😄 |
05:31:29 | FromDiscord | <guzba8> lol i have a `git commit -am 'f'` almost reflex at this piont |
05:32:15 | FromDiscord | <guzba8> i could spend more time on the commit messages if i knew people ever looked, and i guess ppl do at least check |
05:32:42 | FromDiscord | <Elegantbeef> You do you |
05:32:46 | FromDiscord | <Elegantbeef> I do it for myself as much as for others |
05:33:27 | FromDiscord | <guzba8> i have spent years being good about them but i guess ive brain-rotted to `f` the last year or two |
05:34:00 | FromDiscord | <Elegantbeef> This is your redemption arc |
05:34:08 | FromDiscord | <guzba8> now that is some motivation |
05:34:36 | FromDiscord | <guzba8> having a redemption arc sounds like it comes with a theme song |
05:36:02 | FromDiscord | <Elegantbeef> Only if you write it |
05:36:19 | FromDiscord | <Elegantbeef> Is it pronounced "goozba" or "gusba"? |
05:36:46 | FromDiscord | <Elegantbeef> Who am I kidding you are not going to find good rhymes |
05:36:53 | FromDiscord | <guzba8> guz-ba |
05:36:56 | FromDiscord | <guzba8> as if that helps |
05:37:12 | FromDiscord | <Elegantbeef> Ah so as I imagined |
05:37:42 | FromDiscord | <Elegantbeef> The sad part about the json tags is they don't work on generics |
05:37:44 | FromDiscord | <guzba8> my 13 year old self concluded a good handle had to include a z and not be a word other ppl would have already taken |
05:37:51 | FromDiscord | <guzba8> that is the full extent of the logic in guzba |
05:37:55 | FromDiscord | <Elegantbeef> Generic instantiations do not get their own ast |
05:38:06 | FromDiscord | <Elegantbeef> I see you're guzba 8 |
05:38:12 | FromDiscord | <Elegantbeef> So there were a few people that thought the same |
05:38:19 | FromDiscord | <guzba8> i think its like 6 char min or something? |
05:38:22 | FromDiscord | <guzba8> got bit by that a few times |
05:38:45 | FromDiscord | <guzba8> or maybe someone did take it or i long ago lost that login, its hard to say |
05:39:01 | FromDiscord | <guzba8> 👴 problems |
05:39:36 | FromDiscord | <guzba8> generics as fields is interesting. i got option working specifically and seq, array etc |
05:39:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=anWWNdOnzsFb |
05:40:13 | FromDiscord | <Elegantbeef> If it does not have the pragma and `jsonName` does not compile you use the field name |
05:40:50 | FromDiscord | <guzba8> ah ok so its a hook based backup if i understand correctly |
05:40:56 | FromDiscord | <Elegantbeef> Yea |
05:41:20 | FromDiscord | <Elegantbeef> But the hook is matched based of the static value of the field name to make it easy and intuitive to write |
05:42:09 | FromDiscord | <guzba8> it is clear you have a solid grasp of the problem and potential solution. i see the potential solution but am lacking in coming up wth a clear example of the problem |
05:42:23 | FromDiscord | <guzba8> could you help me with a little example? a bit drained after a long day |
05:42:36 | FromDiscord | <Elegantbeef> In the above example you cannot do `x {.json: "MYJsonName".}: T` |
05:42:59 | FromDiscord | <Elegantbeef> As the pragma is lost in generic ast |
05:43:10 | FromDiscord | <guzba8> ahh, so its the field itself that is generic, not the contents of a generic holder thing |
05:43:27 | FromDiscord | <guzba8> so a type Vec[T] = object, x: T, y: T kind of problem? |
05:43:31 | FromDiscord | <Elegantbeef> Yes you cannot use pragmas on generic fields and redetect them later |
05:43:45 | FromDiscord | <Elegantbeef> As such you need an escape hatch for generics |
05:43:57 | FromDiscord | <guzba8> ok cool i think i understand and could produce an example etc now |
05:44:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=SsoogpMVscXw |
05:44:49 | FromDiscord | <Elegantbeef> Whoops `assert not a.x.hasCustomPragma(myPragma)` |
05:45:51 | FromDiscord | <guzba8> https://github.com/guzba/sunny/issues/2 |
05:45:56 | FromDiscord | <guzba8> wont forget now |
05:46:39 | FromDiscord | <Elegantbeef> If we're still complaining about the way you run git .... |
05:46:51 | FromDiscord | <guzba8> lol are my issues unsatisfactory too? hahaha |
05:47:01 | FromDiscord | <Elegantbeef> "From Discord" pisses me off to no end |
05:47:17 | FromDiscord | <guzba8> ohhh sorry yeah i can accomodate |
05:47:19 | FromDiscord | <guzba8> what would you prefer |
05:47:24 | FromDiscord | <Elegantbeef> It's relying on discord for context |
05:47:29 | FromDiscord | <Elegantbeef> Just writing a few sentences about it |
05:47:57 | FromDiscord | <Elegantbeef> I mean I have a discord account and client but it's just annoying having to click on a link to see context |
05:48:24 | FromDiscord | <Elegantbeef> I wouldn't like it if it was a matrix link either 😄 |
05:48:48 | FromDiscord | <guzba8> improved |
05:49:31 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=jUdRHAxoPstg |
05:49:47 | FromDiscord | <Elegantbeef> `expandArc` dear lad |
05:49:53 | FromDiscord | <girvo> Yep I've done that too |
05:49:59 | FromDiscord | <girvo> Let me explain the specifics |
05:50:10 | FromDiscord | <Elegantbeef> Destructors are scoped based |
05:50:32 | FromDiscord | <Elegantbeef> so whilst `t = ...` re assignes it there is a hidden temp that is destroyed if memory serves |
05:50:52 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mhcDcGDWFeOz |
05:51:04 | FromDiscord | <Elegantbeef> Actually my guess is wrong |
05:51:32 | FromDiscord | <girvo> We re-assign over `var mbHandle` which seems to be calling destroy after the second mbHandle assign happens |
05:52:06 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=zoCtPCtXwSuo |
05:52:47 | FromDiscord | <Elegantbeef> Oh wait this makes sense |
05:53:03 | FromDiscord | <Elegantbeef> the first one is create then the second is created before it's moved |
05:53:11 | FromDiscord | <Elegantbeef> It's then moved and destroys the first one |
05:53:17 | FromDiscord | <Elegantbeef> then the second one is destroyed |
05:53:34 | FromDiscord | <girvo> So we can't really use destructors/assign over it this way? |
05:53:41 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=MNlyKvaBZGrz |
05:53:46 | FromDiscord | <girvo> Thats --expandArc |
05:53:59 | FromDiscord | <Elegantbeef> `=sink` is not a template so it does not lazily evaluate |
05:54:14 | FromDiscord | <Elegantbeef> Parameters are evaluated at call site then passed in |
05:54:25 | FromDiscord | <Elegantbeef> Still uncertain what you're trying to do |
05:54:50 | FromDiscord | <girvo> Trying to have a new config uninstall the old uart driver and install the new one |
05:55:14 | FromDiscord | <girvo> Without calling some "uninstall" proc directly. Though I guess I have to |
05:55:25 | FromDiscord | <Elegantbeef> It does though? |
05:55:58 | FromDiscord | <girvo> Because they both reference the same `uart.port` -- the order it happens in means it uninstalls the second instance's driver 🥲 |
05:56:39 | FromDiscord | <Elegantbeef> Is this where I mockingly say "you do control the sink so make it not" |
05:56:40 | FromDiscord | <girvo> second instance initialises, then the first instance destroys, which uninstalls the uart driver on that port |
05:56:52 | FromDiscord | <girvo> In reply to @Elegantbeef "Is this where I": Do I control =sink in 1.6? |
05:56:58 | FromDiscord | <Elegantbeef> yes |
05:57:06 | FromDiscord | <girvo> Okay cool |
05:57:19 | FromDiscord | <girvo> =sink is move, right? |
05:57:24 | FromDiscord | <Elegantbeef> https://nim-lang.org/1.6.18/destructors.html |
05:57:54 | FromDiscord | <nnsee> In reply to @Elegantbeef "*If we're still complaining": there's just no pleasing some people |
05:58:13 | FromDiscord | <girvo> I guess I should have it check whether its the same port, and set the "inited" flag to false to avoid it being uninstalled if it is |
05:58:17 | FromDiscord | <Elegantbeef> Hey if I could I'd self host my own git instance on a local machine and shun you all away |
05:58:31 | FromDiscord | <nnsee> why can't you though |
05:58:35 | FromDiscord | <girvo> you can lol |
05:58:46 | FromDiscord | <nnsee> or just hop on mine |
05:58:50 | FromDiscord | <nnsee> currently it's just me on there |
05:58:54 | FromDiscord | <Elegantbeef> I don't want to mirror it and don't want to give out my actual IP |
05:59:29 | FromDiscord | <Elegantbeef> Excuse me whilst I rent a VPS just to proxy my git server 😄 |
05:59:55 | * | ntat joined #nim |
06:00:09 | FromDiscord | <nnsee> whispers ORACLE FREE TIER |
06:00:10 | FromDiscord | <Elegantbeef> What do you use for your git instance? |
06:00:26 | FromDiscord | <nnsee> used to be gitea, now I've moved to forgejo |
06:00:28 | FromDiscord | <nnsee> "moved" |
06:00:39 | FromDiscord | <nnsee> i just renamed the image name in my docker compose file |
06:01:24 | FromDiscord | <Elegantbeef> Girvo I half expect you to use the MSB as a flag to indicate whether it's init'd 😄 |
06:02:10 | FromDiscord | <Elegantbeef> This is why people should not write binary forrmats at 3am, it really makes you want to bit twiddle |
06:02:28 | FromDiscord | <Elegantbeef> What's the domain so I can throw some code there to make you feel less alone? |
06:03:03 | FromDiscord | <Elegantbeef> Proceeds to upload an inhumane amount of corn |
06:04:01 | FromDiscord | <Elegantbeef> This does remind me that it's pretty cool to see git clients moving towards using activitypub, hopefully that'll solve all centralisation woes |
06:05:01 | FromDiscord | <Elegantbeef> git instances\ |
06:05:05 | FromDiscord | <girvo> In reply to @Elegantbeef "Girvo I half expect": haha you'd be right at home in embedded i swear |
06:05:05 | FromDiscord | <nnsee> In reply to @Elegantbeef "What's the domain so": well registrations are closed so you'll have a hard time doing that, but |
06:05:13 | FromDiscord | <nnsee> https://git.dog |
06:05:27 | FromDiscord | <Elegantbeef> It's a domain made for me |
06:05:32 | FromDiscord | <nnsee> indeed |
06:05:34 | FromDiscord | <girvo> whats the default `=sink` impl? It seems doing `=destroy(a)` `wasMoved(a)` means I get odd behaviour |
06:05:55 | FromDiscord | <girvo> (I get "Called destructor 0" instead of "Called destructor 2") |
06:07:01 | FromDiscord | <girvo> Oh I needed to acutally assign to `a` |
06:07:49 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=CbpjmJmQDPzn |
06:08:19 | FromDiscord | <Elegantbeef> sink is destroy A then move B to A |
06:08:22 | FromDiscord | <Elegantbeef> There is an example on the docs |
06:08:25 | FromDiscord | <Elegantbeef> `wasMoved` zeros |
06:08:31 | FromDiscord | <Elegantbeef> So if you need to check that it's not zero'd do that |
06:08:31 | FromDiscord | <girvo> Yeah I'm looking at the example |
06:08:32 | FromDiscord | <Elegantbeef> I'll have you know Girvo, my binary encoder/decoder can unsafely use stack memory so take that embedded comment and raise it higher |
06:08:32 | FromDiscord | <Elegantbeef> To be a dick "Dest is probably the one you can write to" |
06:08:39 | FromDiscord | <Elegantbeef> `a: Var T, b: T` |
06:08:43 | FromDiscord | <Elegantbeef> `a` is dest |
06:08:55 | FromDiscord | <girvo> Yeah I get that 😛 |
06:09:17 | FromDiscord | <girvo> Ahhhh wait I get it |
06:09:24 | FromDiscord | <girvo> Yeah this makes sense now |
06:09:25 | FromDiscord | <demotomohiro> `a` need to be destroyed because it need to takes `b` and loose current value. |
06:09:25 | FromDiscord | <girvo> Okay sweet |
06:09:30 | FromDiscord | <girvo> yeah 🙂 |
06:10:51 | FromDiscord | <nnsee> > to be a dick↵well that's a bit redundant, we knew this already! |
06:11:04 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=EjYTOzLlzVHJ |
06:11:09 | FromDiscord | <Elegantbeef> I also certainly rediscovered a nice part about RAII you can have optional `close` procedures which return heap allocated data to the call site |
06:11:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QJpYpnSTbVSD |
06:12:44 | FromDiscord | <girvo> I think really this whole system needs to be adjusted, where the uart driver is passed in and dealt with seperately |
06:12:57 | FromDiscord | <girvo> Because having ModbusRTU own it introduces some problems |
06:14:00 | FromDiscord | <girvo> skipping the uart_driver_uninstall in the destructor on =sink if the ports match is fine as a hack, but fails if we want to change the uart parameters (baud rate, etc) |
06:14:09 | FromDiscord | <girvo> (edit) "skipping the uart_driver_uninstall in the destructor on =sink if the ports match is fine as a hack, but fails if we want to change the uart parameters (baud rate, etc) ... " added "and still connect to the same uart port" |
06:14:29 | FromDiscord | <Elegantbeef> What's the issue with closing then reopening? |
06:14:32 | FromDiscord | <Elegantbeef> Waste of cycles? |
06:14:41 | FromDiscord | <girvo> I'd be happy to close it lol |
06:14:47 | FromDiscord | <girvo> I was just trying to do it purely via =destroy |
06:14:57 | FromDiscord | <girvo> Can do it in the `init` of course |
06:15:00 | FromDiscord | <Elegantbeef> Can you query the properties? |
06:15:04 | FromDiscord | <girvo> Probably have to really |
06:15:10 | FromDiscord | <girvo> Yeah I can query if its installed on a given port |
06:15:25 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=BvfkloMJZZIy |
06:15:25 | FromDiscord | <Elegantbeef> Can you query it's baud rate and friends? |
06:15:37 | FromDiscord | <girvo> Not sure. I'll check |
06:15:45 | FromDiscord | <Elegantbeef> It's not wise to have side effects inside the destructor but you could query the stats to see if it's different and only then set the stuff you need |
06:16:28 | FromDiscord | <girvo> Yeah its a bit naff, but I can |
06:17:30 | FromDiscord | <girvo> In reply to @Elegantbeef "It's not wise to": Yeah though the guaranteed "uart_driver_install" in `init` is going to fail -- can't install it more than once on one port |
06:18:09 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=uAPjlrYvVrNO |
06:18:34 | FromDiscord | <girvo> I think I'm just going to pull all of this out to make it explicit for now; or have modbus take a uart as a param and handle it seperately |
06:19:42 | FromDiscord | <girvo> really Uart should be a single reference/variable/thing per UART port anyway -- you can't have more than one driver installed against it |
06:21:22 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mTTUOiYVVCzQ |
06:22:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=bJdjRYrNBijR |
06:22:48 | FromDiscord | <girvo> The nesper uart stuff doesn't even have a "uninstall" proc or anything anyway |
06:23:03 | FromDiscord | <girvo> Hah I started down that path already 😛 |
06:24:42 | FromDiscord | <girvo> I want the uart stuff to have raii too, disable copying, and have modbusrtu use it by reference. Then the destructor stuff can be dealt with at the uart level instead of the higher modbusrtu one which is confusing things |
06:25:30 | FromDiscord | <Robyn [She/Her]> In reply to @varriount "It's a shame the": That's a reason Nimskull was forked too, iirc |
06:26:26 | FromDiscord | <Elegantbeef> Yea movement semantics does very well with "Only one instance should exist" |
06:26:27 | * | advesperacit joined #nim |
06:27:09 | FromDiscord | <girvo> Agreed. I honestly forgot that the nesper uart stuff is based on ref object |
06:27:35 | FromDiscord | <girvo> the rest of our drivers that map one to one with some hardware thing are done with move semantics/no copying |
06:28:26 | FromDiscord | <Robyn [She/Her]> In reply to @NimEventer "New Nimble package! sunny": Sunny looks cool |
06:29:27 | FromDiscord | <Robyn [She/Her]> In reply to @nnsee "*whispers* ORACLE FREE TIER": They won't accept my card because Monzo isn't a real bank 😔 |
06:29:32 | FromDiscord | <Elegantbeef> To flip this on it's head I also think someone might be able to make a nice allocation where you emit a sequence and each `MyRef[T]` is an index of the sequence |
06:29:36 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mDvaSmIDYbOc |
06:29:56 | FromDiscord | <Elegantbeef> `ensureMove` in 2.0 does enable that behaviour for moving |
06:30:00 | FromDiscord | <girvo> yeah cool |
06:30:06 | FromDiscord | <girvo> good to know for the future 🙂 |
06:30:10 | FromDiscord | <Elegantbeef> But not for what you did there |
06:30:20 | FromDiscord | <girvo> yeah I figured as much |
06:30:40 | FromDiscord | <Elegantbeef> Though you could do `wasMoved(ensureMove x)` |
06:31:33 | FromDiscord | <girvo> Anyway, back to re-doing nesper/uarts |
06:31:43 | FromDiscord | <girvo> thanks for the help as always |
06:32:29 | FromDiscord | <Elegantbeef> hmmm actually that doesn't work in 2.0 |
06:34:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=XwMcUJZyrnba |
06:36:43 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=NjsLmHcpHgEk |
06:37:31 | FromDiscord | <girvo> Yeah docs suggest that you have to set them before the driver_install |
06:39:36 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=CrEDoIUnMfsQ |
06:39:57 | FromDiscord | <Elegantbeef> I'd argue this is where typestates come in |
06:41:18 | FromDiscord | <Elegantbeef> If Uart had a `State` static you could disallow `sink` then just have a `myUart.setup(...)` which would close `myUart` then take in a `Uart[Uninit]` |
06:41:46 | FromDiscord | <Elegantbeef> You of course would need to manually do `myUart.setup()` so I guess not much better |
06:42:23 | FromDiscord | <girvo> Ah yeah I'm with ya. Yeah... explicit setup or explicit shutdown, six of one half a dozen of the other, no? |
06:43:03 | FromDiscord | <Elegantbeef> Well there is slightly less code in the type state version |
06:43:04 | FromDiscord | <girvo> I do wish this wasn't driven by runtime network-received config 🥲 |
06:44:18 | FromDiscord | <Elegantbeef> But in the future you can just do `myUart.setup(Uart.init(...))` |
06:44:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=hBqdrOVZqsQI |
06:47:04 | FromDiscord | <girvo> For now I think I'm going to make this more explicit and away from the RAII approach coz we've got devices in the field that this is a problem for |
06:47:14 | FromDiscord | <girvo> But definitely something I want to sort out |
06:50:43 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=fqPpUSTJYCBs I of course have too much time |
06:51:26 | * | azimut quit (Ping timeout: 260 seconds) |
07:06:50 | * | rockcavera quit (Remote host closed the connection) |
08:24:17 | * | ntat quit (Quit: Leaving) |
08:39:40 | * | xet7 quit (Quit: Leaving) |
09:20:54 | NimEventer | New thread by thegraynode: Have I written a silly program or is there a "controlled" memory leak?, see https://forum.nim-lang.org/t/11163 |
10:09:09 | * | om3ga joined #nim |
11:01:57 | * | junaid__ joined #nim |
11:13:55 | * | def- quit (Quit: -) |
11:14:07 | * | def- joined #nim |
11:27:01 | * | xet7 joined #nim |
11:42:59 | * | junaid__ quit (Remote host closed the connection) |
12:31:49 | FromDiscord | <030030chri> How long will you continue to work hard before you can earn money when you have the opportunity to earn income from home? Start earning your own income now. You can earn between $770 and $980 per day without interfering with your daily activities. Anyone can do this from home or office. 100% legitimate For more information write to me directly. |
12:32:32 | FromDiscord | <A2> Mooodddsss |
12:32:55 | FromDiscord | <A2> What should I expect to happen, if I'm using the `--mm:orc` memory management, and I from C++ call my nim function, which returns a `pointer` to a object I defined in nim? |
12:33:29 | FromDiscord | <A2> I'm getting some weird memory errors, and am beginning to suspect that it's because orc is freeing my object when it leaves nim scope |
12:33:57 | FromDiscord | <A2> is there a something like a pragma that tells nim "just let me manually free this one object" ? |
12:35:34 | FromDiscord | <odexine> MM doesn’t (shouldn’t) do anything with pointers |
12:37:03 | FromDiscord | <ringabout> Is it pointing to a local object on the stack or a ref object? |
12:37:38 | * | ntat joined #nim |
12:38:10 | FromDiscord | <A2> it's a ref object |
12:38:34 | FromDiscord | <A2> which I then `cast[pointer](myRefObj)` before returning (is that even necessary?) |
12:39:09 | FromDiscord | <Robyn [She/Her]> In reply to @A2 "it's a ref object": That explains it |
12:39:24 | FromDiscord | <ringabout> In reply to @A2 "it's a ref object": Consider using `GC_ref` and `GC_unref` if you want to control it manually |
12:42:13 | FromDiscord | <A2> ooh! that appears to solve my problem! awesome! |
12:42:27 | FromDiscord | <A2> at least in my small-ish repro example |
12:42:50 | FromDiscord | <A2> now I'm gonna go get lunch, and then I can fix it in prod. Thanks ppl! |
12:43:08 | FromDiscord | <ringabout> See also https://nim-lang.github.io/Nim/backends.html#memory-management-custom-data-types |
12:46:02 | FromDiscord | <A2> It's a bit surprising that my code ever worked, when I was using \`--mm\:refc\` |
12:46:26 | FromDiscord | <A2> I would expect that to have the same problem as I'm running into now |
12:46:29 | FromDiscord | <A2> ¯\\\_(ツ)\_/¯ |
12:59:18 | FromDiscord | <odexine> In reply to @A2 "I would expect that": It’s likely because of the determinism from ORC/ARC |
13:00:05 | FromDiscord | <odexine> I assume in refc in the period that you get issues, theres only a chance that it will bug but it usually doesnt |
13:40:15 | FromDiscord | <zumi.dxy> and they say ARC/ORC isn't "production ready"... |
13:57:14 | FromDiscord | <A2> sent a code paste, see https://play.nim-lang.org/#pasty=ccieVvgPrMaQ |
13:57:19 | FromDiscord | <A2> sent a code paste, see https://play.nim-lang.org/#pasty=UTNZZMgCoyiZ |
13:58:32 | FromDiscord | <bung8954> need use refc I guess |
14:00:00 | FromDiscord | <A2> sent a code paste, see https://play.nim-lang.org/#pasty=SDhcmVrfYtgg |
14:01:15 | FromDiscord | <A2> hmm I really want to use ORC, because it [solves some parallelism problems](https://github.com/nim-lang/threading) for my project |
14:02:06 | FromDiscord | <A2> all of the problems I'm running into now are specifically related to moving from `--mm:refc` to `--mm:orc` |
14:02:09 | FromDiscord | <ringabout> In reply to @A2 "Now I'm having a": The documentation is outdated, you should check https://nim-lang.github.io/Nim/system.html |
14:02:15 | FromDiscord | <A2> I guess I could manually malloc the string or something |
14:02:57 | FromDiscord | <ringabout> `GC_ref` doesn't support strings, seqs in ARC/ORC |
14:04:46 | FromDiscord | <A2> ah, good to know that nim-lang.org is incorrect, I hadn't realized! |
14:05:20 | FromDiscord | <A2> I wonder what the idiomatic way to return a string/cstring to the backend is, when using arc/orc |
14:05:57 | FromDiscord | <A2> https://nim-lang.github.io/Nim/backends.html#memory-management-strings-and-c-stringsnim-lang.github.io also says "you will need to manually prevent the string data from being freed with GC\_ref and GC\_unref." |
14:06:26 | FromDiscord | <A2> I guess I could make an issue on github.com/nim-lang/nim about it? |
14:06:55 | FromDiscord | <ringabout> In reply to @A2 "https://nim-lang.github.io/Nim/backends.html#memory": I have a PR to remove this => https://github.com/nim-lang/Nim/pull/23373 |
14:07:57 | FromDiscord | <A2> oh wow, you're quick |
14:09:55 | FromDiscord | <A2> soo... might the best approach be for me to do something like this?`proc malloc(size: csize_t): pointer {.importc: "malloc".}` |
14:10:03 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
14:10:09 | * | derpydoo joined #nim |
14:10:13 | * | SchweinDeBurg joined #nim |
14:11:26 | FromDiscord | <ringabout> Yeah, you can allocate a char and your point `cstring/pointer` to the data |
14:13:48 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#pasty=foLkcVHWPuCU |
14:14:56 | FromDiscord | <A2> yeah I was considering doing something like that too |
14:15:25 | FromDiscord | <A2> it's probably cleaner than doing FFI ti libC |
14:15:34 | FromDiscord | <A2> but I still need to use the string from c |
14:15:57 | FromDiscord | <A2> and I guess if I do a `get_text(s: String): cstring {.exportc.}` I will have the same problem |
14:16:39 | FromDiscord | <A2> oh actually maybe not actually, since the string would still be referenced by the `ref object` |
14:16:39 | FromDiscord | <A2> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1214939398261444638): it's probably cleaner than doing FFI to libc |
14:17:25 | * | al1ranger joined #nim |
14:25:16 | * | lucasta joined #nim |
14:26:41 | FromDiscord | <ringabout> I don't know what's your program. But strings are not ref'ed in ARC/ORC, which means if it might not cause troubles when procs return `string` or use it as a parameter if you are familiar with the lifetime of the strings that you create |
14:29:38 | FromDiscord | <ringabout> Though you perhaps need to `exportc` a `=destroy` wrapper for you strings |
14:34:19 | * | al1ranger quit (Quit: Leaving) |
14:34:41 | * | al1ranger joined #nim |
14:37:43 | * | al1ranger quit (Client Quit) |
14:54:55 | arkanoid | speaking of nim >= 2.0, what is "nim runtime" today? Cycle collector when using ORC, and then? |
15:00:18 | FromDiscord | <A2> [ringabout](https://matrix.to/#/%40_discord_658563905425244160%3At2bot.io) I think I need to go learn a bit more about what it means to be `ref`'ed in Nim. Maybe I'm actually good without doing anything special to the strings I return to C-land.↵↵Thanks for all of your help! |
15:04:39 | NimEventer | New thread by can-lehmann: Owlkettle 3.0.0, see https://forum.nim-lang.org/t/11170 |
15:05:48 | FromDiscord | <ezquerra> Do you know why we use Complex[float32] and Complex[float64] instead of Complex32 and Complex64 in most of the arraymancer generic functions? And why then we import complex _except_ Complex32 and Complex64? |
15:20:55 | * | junaid_ joined #nim |
15:21:17 | FromDiscord | <TӨMΛ ☠> Sorry for forgetting such trivialities, but how is called sequence that allow only one the same entry? |
15:21:27 | FromDiscord | <odexine> set |
15:21:32 | FromDiscord | <TӨMΛ ☠> Thank you ❤️ |
15:21:34 | FromDiscord | <odexine> kind of |
15:21:46 | FromDiscord | <odexine> its not exactly a sequence |
15:22:13 | FromDiscord | <TӨMΛ ☠> I mean, it needs to be appendable, that's what matters |
15:23:13 | FromDiscord | <odexine> for sets, its `incl` and `excl` because they are not ordered |
15:28:59 | FromDiscord | <TӨMΛ ☠> Oh, but set can't use `string` type ;-; |
15:29:22 | FromDiscord | <odexine> HashSet in the sets module |
15:31:08 | arkanoid | if am indexing mytensor[a,b,c] for multiple tensors. How can I save a,b,c into a var so I can just mytensor[foo] ? |
15:31:32 | arkanoid | what is that, a slice? a tuple? |
15:38:04 | FromDiscord | <odexine> it |
15:38:06 | FromDiscord | <odexine> fuck |
15:38:28 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=PRbIrsSStoEM |
15:39:37 | arkanoid | I mean, here the [] proc accepts a vararg. How can I use an array var instead for a vararg argument? https://mratsim.github.io/Arraymancer/accessors_macros_read.html#%5B%5D.m%2CAnyTensor%5BT%5D%2Cvarargs%5Buntyped%5D |
15:40:09 | FromDiscord | <odexine> i assume you've tried plainly passing an array already? |
15:40:49 | arkanoid | yes, it complains. I'm trying to understand the error actually |
15:41:18 | FromDiscord | <odexine> do you mind sending it here so we can read it as well? |
15:41:46 | FromDiscord | <odexine> it might be related to the fact that its a varargs of untyped... |
15:41:51 | arkanoid | odexing its better if I create an independent example. Wait a minute |
15:42:12 | FromDiscord | <odexine> so i think the variable has to be effectively const |
15:42:25 | FromDiscord | <odexine> or maybe that wouldnt even work |
15:43:45 | arkanoid | but generally it works at runtime. I mean when doing manually mytensor[a,b,c] a,b,c are not consts |
15:46:48 | * | derpydoo quit (Ping timeout: 260 seconds) |
15:47:21 | * | azimut joined #nim |
15:49:03 | FromDiscord | <odexine> i mean that it can deal with the values on run time but it needs to know the structure of the array on ct |
15:53:52 | arkanoid | the problem is not [] non accepting array, but that the output is actually not what you'd expect https://play.nim-lang.org/#pasty=xgMHvBNjlSWG |
15:59:29 | FromDiscord | <odexine> the docs show a lot of patterns as to what [] accepts, and i assume that passing an array variable matches something else than basic indexing |
16:00:55 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=rBFJyAkBOCRs |
16:01:25 | FromDiscord | <odexine> if you're using scope vars then add {.dirty.} or pass in those variables as well |
16:03:02 | * | disso-peach quit (Quit: Leaving) |
16:20:59 | * | lucasta quit (Quit: Leaving) |
17:19:09 | FromDiscord | <saint.___.> @morgan Are you pushing your work to a repo anywhere? |
17:19:33 | FromDiscord | <saint.___.> If I could take a look at the WIP or do something to contribute I'd love to |
17:24:53 | * | advesperacit quit (Ping timeout: 240 seconds) |
17:53:02 | * | advesperacit joined #nim |
18:02:53 | FromDiscord | <morgan> yea i should set up a repo for it |
18:37:01 | * | krux02 joined #nim |
18:41:03 | * | rockcavera joined #nim |
18:58:34 | * | derpydoo joined #nim |
19:16:58 | * | xet7 quit (Quit: Leaving) |
19:18:03 | FromDiscord | <morgan> In reply to @saint.___. "<@277133333773811712> Are you pushing": https://github.com/morganholly/nim-clap |
19:31:49 | * | deadmarshal_ quit (Ping timeout: 246 seconds) |
19:34:54 | FromDiscord | <saint.___.> In reply to @morganalyssa "https://github.com/morganholly/nim-clap": Awesome! I'll take a look at this |
19:36:03 | FromDiscord | <morgan> i'm slowly making my way thru stuff needed for the example plugin, right now i'm working on the event types |
19:36:25 | FromDiscord | <saint.___.> Gotcha |
19:36:34 | FromDiscord | <morgan> something i should do eventually is split up the types and consts so they are grouped into related stuff a bit better |
19:36:49 | FromDiscord | <morgan> at least i'm doing separate const blocks for each set |
19:36:57 | FromDiscord | <morgan> so they can be minimized in the editor |
19:40:00 | FromDiscord | <morgan> oh and i skipped over types for transport related stuff |
19:40:03 | FromDiscord | <morgan> since i don't need that |
19:40:07 | FromDiscord | <morgan> that |
19:52:08 | NimEventer | New thread by guzba: Show Nim: Sunny, JSON in Nim with Go-like field tags, see https://forum.nim-lang.org/t/11171 |
19:53:13 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#pasty=nmmPkoFXlCDH |
19:59:40 | * | deadmarshal_ joined #nim |
20:01:30 | * | rockcavera quit (Remote host closed the connection) |
20:22:25 | * | derpydoo quit (Quit: derpydoo) |
20:52:34 | * | ntat quit (Quit: Leaving) |
21:03:26 | * | derpydoo joined #nim |
21:29:48 | NimEventer | New thread by lou15b: Problem with closures and ORC, see https://forum.nim-lang.org/t/11172 |
21:34:12 | * | junaid_ quit (Remote host closed the connection) |
21:45:30 | FromDiscord | <demotomohiro> In reply to @arathanis "Can you read the": https://nim-lang.org/docs/compilesettings.html |
21:50:26 | FromDiscord | <demotomohiro> There is sample code: https://nim-lang.org/docs/estp.html |
22:07:44 | * | derpydoo quit (Ping timeout: 252 seconds) |
22:14:32 | * | advesperacit quit () |
22:18:39 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
22:19:07 | * | dtomato joined #nim |
22:23:54 | FromDiscord | <arathanis> In reply to @demotomohiro "https://nim-lang.org/docs/compilesettings.html": thank you! |