<< 06-03-2024 >>

00:01:22FromDiscord<girvo> ooooh
00:01:49FromDiscord<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:03FromDiscord<Elegantbeef> Time to use my non standard vsbf
00:02:11FromDiscord<girvo> And we are going to make a breaking protocol change for the network side shortly, might be worth examining protobufs again
00:02:56FromDiscord<leorize> have you looked at flatbuffers or capt'n proto?
00:04:44FromDiscord<Elegantbeef> cap'n proto too 😛
00:05:05FromDiscord<girvo> we have, and I can't remember why I ruled them out lmao
00:05:09FromDiscord<girvo> I'll have another look
00:08:31FromDiscord<morgan> i really oughta split up my code, futhark and type overrides in one, and ported example plugin in the other
00:08:52FromDiscord<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:29FromDiscord<girvo> and Cap'n'Proto has capnp which is old as the hills and unmaintained, which worried me
00:11:39FromDiscord<leorize> if you like the format, then maintain the impls yourself
00:11:42FromDiscord<leorize> esp for commerical usage
00:11:54FromDiscord<leorize> you can't rely on contributors being interested forever
00:12:31FromDiscord<girvo> Absolutely
00:12:43FromDiscord<girvo> (which is why we implemented Modbus RTU among other protocols ourselves)
00:13:34FromDiscord<girvo> As well as our Nesper fork, and the in progress port of Chronos to FreeRTOS + newlib, among other things
00:14:14FromDiscord<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:45FromDiscord<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:26FromDiscord<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:42FromDiscord<Robyn [She/Her]> Isn't the treesitter grammar intensely memory hungry or something?
00:24:11FromDiscord<leorize> where did you hear that?
00:24:24FromDiscord<saint.___.> In reply to @alendrik "apologies if this is": the treesitter grammar is built in now
00:24:39FromDiscord<saint.___.> And you can use an lsp with the built in nvim lsp
00:24:44FromDiscord<saint.___.> I don't think u need that plugin anymore
00:25:18FromDiscord<leorize> the plugin is still useful for its indentation plugin and nimsuggest integration (which could be more stable than LSP)
00:25:28FromDiscord<leorize> but otherwise, I'm working on making the plugin not required anymore
00:25:31termergirvo Yeah, like Elegantbeef said, there's a lib that generates it without protoc
00:25:32termeruses macros
00:25:33termerreally nice
00:25:55FromDiscord<Langosta> sounds good! thank yall :)
00:48:14FromDiscord<girvo> In reply to @termer "really nice": yeah I'm already examining it, looks perfect for what we're after
00:52:56FromDiscord<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:42FromDiscord<Elegantbeef> I think you're thinking about how much memory leo's TS grammar was using when it was being compiled
01:05:08FromDiscord<Robyn [She/Her]> Oooh that'd explain it
01:05:55FromDiscord<leorize> generating the parser takes about 7-10GB of ram
01:06:24FromDiscord<leorize> the generated parser is pretty fast, though
01:30:26FromDiscord<Robyn [She/Her]> In reply to @leorize "generating the parser takes": Yikes... Why?
01:51:06FromDiscord<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:29FromDiscord<kumolonimbus> sent a code paste, see https://play.nim-lang.org/#pasty=aApkdMWNlKOq
01:54:50FromDiscord<Elegantbeef> Why not just use `osproc`?
02:03:29FromDiscord<kumolonimbus> I need to start the process in a suspended state
02:07:30FromDiscord<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:58FromDiscord<Robyn [She/Her]> Is it just because they only really affect cps and Nim isn't bothered about supporting it?
02:20:29FromDiscord<Elegantbeef> Now I imagine it's cause they only care about the skull
02:20:37FromDiscord<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:35FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Now I imagine it's": Why wouldn't Araq fix it though?
02:43:13FromDiscord<zumi.dxy> "PRs welcome" :p
02:50:10FromDiscord<Robyn [She/Her]> Fair
02:51:33FromDiscord<leorize> turns out nim grammar is really hard to generate a small parser for↵(@Robyn [She/Her])
02:52:25FromDiscord<leorize> it's the same reason as those IC promises years back↵(@Robyn [She/Her])
02:53:06FromDiscord<leorize> for those who don't know, Araq actually promised to make CPS bugs a priority
02:53:45FromDiscord<leorize> all we get by now is a nice tag to remind us of how we were neglected
02:54:24NimEventerNew thread by SalMolhado: Best REGEX library for targeting both JS and C, see https://forum.nim-lang.org/t/11160
02:55:35FromDiscord<Robyn [She/Her]> In reply to @leorize "turns out nim grammar": Ah
02:56:10FromDiscord<leorize> "grammar" to be precise, don't trust that stuff you see in the manual
02:56:28FromDiscord<leorize> it's not correct and missing a ton of details that are ad-hoc parser rules
02:59:21FromDiscord<Robyn [She/Her]> Like whitespace indentation?
02:59:56rockcaveralike 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:47FromDiscord<leorize> that's not a parser thing
03:00:56FromDiscord<leorize> yes↵(@Robyn [She/Her])
03:01:16FromDiscord<leorize> and there are rules about which operators can be parsed as which
03:03:14FromDiscord<leorize> depending on where they appear
03:03:26FromDiscord<leorize> and depending on the spaces around them
03:05:27NimEventerNew thread by hyu1996: This forum has an XSS injection vulnerability, see https://forum.nim-lang.org/t/11161
03:07:52FromDiscord<zumi.dxy> man, the timing...
03:15:52FromDiscord<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:46FromDiscord<haoyu233> https://media.discordapp.net/attachments/371759389889003532/1214774393029394452/image.png?ex=65fa55d0&is=65e7e0d0&hm=260fa1c13e0d5458caa6cee83a3b92b874cde0e4adbc6f024db05fd4316c3dc8&
03:20:03termeryou're about to get pwned
03:20:09termerclients aren't supposed to do that
03:20:27termerwhere is this
03:20:34FromDiscord<leorize> it would have been if the people who care about that wasn't pushed away↵(@varriount)
03:22:40FromDiscord<varriount> In reply to @leorize "it would have been": Who specifically?
03:27:10FromDiscord<leorize> we got saem, disruptek, cabbose, clyybber, haxscramper and maybe zevv
03:28:16FromDiscord<leorize> saem in particular was spearheading some big refactoring to clean up the compiler\: https://github.com/nim-lang/compilerdev/issues/16
03:29:14FromDiscord<leorize> and disruptek wrote IC and name mangling, only to be left out there to rot
03:30:23FromDiscord<varriount> Yeah, I'm not surprised. This is kinda why I've become mostly disengaged with Nim.
03:31:43FromDiscord<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:24FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=BPzumOfueBQZ
03:44:29FromDiscord<leorize> nope
03:44:29FromDiscord<Elegantbeef> Make a overload that just calls it
03:44:45FromDiscord<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:31NimEventerNew Nimble package! sunny - JSON in Nim with Go-like field tags, see https://github.com/guzba/sunny
05:30:03FromDiscord<odexine> interesting commit titles
05:30:27FromDiscord<guzba8> i may work alone 🙃
05:30:34FromDiscord<Elegantbeef> press f to pay respects
05:30:41FromDiscord<Elegantbeef> I mean I work alone but still attempt to have readable history
05:30:57FromDiscord<odexine> then theres me who works alone and doesnt even commit
05:30:58FromDiscord<odexine> :baqua:
05:31:20FromDiscord<Elegantbeef> just `git commit --allow-empty-message` 😄
05:31:29FromDiscord<guzba8> lol i have a `git commit -am 'f'` almost reflex at this piont
05:32:15FromDiscord<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:42FromDiscord<Elegantbeef> You do you
05:32:46FromDiscord<Elegantbeef> I do it for myself as much as for others
05:33:27FromDiscord<guzba8> i have spent years being good about them but i guess ive brain-rotted to `f` the last year or two
05:34:00FromDiscord<Elegantbeef> This is your redemption arc
05:34:08FromDiscord<guzba8> now that is some motivation
05:34:36FromDiscord<guzba8> having a redemption arc sounds like it comes with a theme song
05:36:02FromDiscord<Elegantbeef> Only if you write it
05:36:19FromDiscord<Elegantbeef> Is it pronounced "goozba" or "gusba"?
05:36:46FromDiscord<Elegantbeef> Who am I kidding you are not going to find good rhymes
05:36:53FromDiscord<guzba8> guz-ba
05:36:56FromDiscord<guzba8> as if that helps
05:37:12FromDiscord<Elegantbeef> Ah so as I imagined
05:37:42FromDiscord<Elegantbeef> The sad part about the json tags is they don't work on generics
05:37:44FromDiscord<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:51FromDiscord<guzba8> that is the full extent of the logic in guzba
05:37:55FromDiscord<Elegantbeef> Generic instantiations do not get their own ast
05:38:06FromDiscord<Elegantbeef> I see you're guzba 8
05:38:12FromDiscord<Elegantbeef> So there were a few people that thought the same
05:38:19FromDiscord<guzba8> i think its like 6 char min or something?
05:38:22FromDiscord<guzba8> got bit by that a few times
05:38:45FromDiscord<guzba8> or maybe someone did take it or i long ago lost that login, its hard to say
05:39:01FromDiscord<guzba8> 👴 problems
05:39:36FromDiscord<guzba8> generics as fields is interesting. i got option working specifically and seq, array etc
05:39:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=anWWNdOnzsFb
05:40:13FromDiscord<Elegantbeef> If it does not have the pragma and `jsonName` does not compile you use the field name
05:40:50FromDiscord<guzba8> ah ok so its a hook based backup if i understand correctly
05:40:56FromDiscord<Elegantbeef> Yea
05:41:20FromDiscord<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:09FromDiscord<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:23FromDiscord<guzba8> could you help me with a little example? a bit drained after a long day
05:42:36FromDiscord<Elegantbeef> In the above example you cannot do `x {.json: "MYJsonName".}: T`
05:42:59FromDiscord<Elegantbeef> As the pragma is lost in generic ast
05:43:10FromDiscord<guzba8> ahh, so its the field itself that is generic, not the contents of a generic holder thing
05:43:27FromDiscord<guzba8> so a type Vec[T] = object, x: T, y: T kind of problem?
05:43:31FromDiscord<Elegantbeef> Yes you cannot use pragmas on generic fields and redetect them later
05:43:45FromDiscord<Elegantbeef> As such you need an escape hatch for generics
05:43:57FromDiscord<guzba8> ok cool i think i understand and could produce an example etc now
05:44:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=SsoogpMVscXw
05:44:49FromDiscord<Elegantbeef> Whoops `assert not a.x.hasCustomPragma(myPragma)`
05:45:51FromDiscord<guzba8> https://github.com/guzba/sunny/issues/2
05:45:56FromDiscord<guzba8> wont forget now
05:46:39FromDiscord<Elegantbeef> If we're still complaining about the way you run git ....
05:46:51FromDiscord<guzba8> lol are my issues unsatisfactory too? hahaha
05:47:01FromDiscord<Elegantbeef> "From Discord" pisses me off to no end
05:47:17FromDiscord<guzba8> ohhh sorry yeah i can accomodate
05:47:19FromDiscord<guzba8> what would you prefer
05:47:24FromDiscord<Elegantbeef> It's relying on discord for context
05:47:29FromDiscord<Elegantbeef> Just writing a few sentences about it
05:47:57FromDiscord<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:24FromDiscord<Elegantbeef> I wouldn't like it if it was a matrix link either 😄
05:48:48FromDiscord<guzba8> improved
05:49:31FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=jUdRHAxoPstg
05:49:47FromDiscord<Elegantbeef> `expandArc` dear lad
05:49:53FromDiscord<girvo> Yep I've done that too
05:49:59FromDiscord<girvo> Let me explain the specifics
05:50:10FromDiscord<Elegantbeef> Destructors are scoped based
05:50:32FromDiscord<Elegantbeef> so whilst `t = ...` re assignes it there is a hidden temp that is destroyed if memory serves
05:50:52FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mhcDcGDWFeOz
05:51:04FromDiscord<Elegantbeef> Actually my guess is wrong
05:51:32FromDiscord<girvo> We re-assign over `var mbHandle` which seems to be calling destroy after the second mbHandle assign happens
05:52:06FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=zoCtPCtXwSuo
05:52:47FromDiscord<Elegantbeef> Oh wait this makes sense
05:53:03FromDiscord<Elegantbeef> the first one is create then the second is created before it's moved
05:53:11FromDiscord<Elegantbeef> It's then moved and destroys the first one
05:53:17FromDiscord<Elegantbeef> then the second one is destroyed
05:53:34FromDiscord<girvo> So we can't really use destructors/assign over it this way?
05:53:41FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=MNlyKvaBZGrz
05:53:46FromDiscord<girvo> Thats --expandArc
05:53:59FromDiscord<Elegantbeef> `=sink` is not a template so it does not lazily evaluate
05:54:14FromDiscord<Elegantbeef> Parameters are evaluated at call site then passed in
05:54:25FromDiscord<Elegantbeef> Still uncertain what you're trying to do
05:54:50FromDiscord<girvo> Trying to have a new config uninstall the old uart driver and install the new one
05:55:14FromDiscord<girvo> Without calling some "uninstall" proc directly. Though I guess I have to
05:55:25FromDiscord<Elegantbeef> It does though?
05:55:58FromDiscord<girvo> Because they both reference the same `uart.port` -- the order it happens in means it uninstalls the second instance's driver 🥲
05:56:39FromDiscord<Elegantbeef> Is this where I mockingly say "you do control the sink so make it not"
05:56:40FromDiscord<girvo> second instance initialises, then the first instance destroys, which uninstalls the uart driver on that port
05:56:52FromDiscord<girvo> In reply to @Elegantbeef "Is this where I": Do I control =sink in 1.6?
05:56:58FromDiscord<Elegantbeef> yes
05:57:06FromDiscord<girvo> Okay cool
05:57:19FromDiscord<girvo> =sink is move, right?
05:57:24FromDiscord<Elegantbeef> https://nim-lang.org/1.6.18/destructors.html
05:57:54FromDiscord<nnsee> In reply to @Elegantbeef "*If we're still complaining": there's just no pleasing some people
05:58:13FromDiscord<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:17FromDiscord<Elegantbeef> Hey if I could I'd self host my own git instance on a local machine and shun you all away
05:58:31FromDiscord<nnsee> why can't you though
05:58:35FromDiscord<girvo> you can lol
05:58:46FromDiscord<nnsee> or just hop on mine
05:58:50FromDiscord<nnsee> currently it's just me on there
05:58:54FromDiscord<Elegantbeef> I don't want to mirror it and don't want to give out my actual IP
05:59:29FromDiscord<Elegantbeef> Excuse me whilst I rent a VPS just to proxy my git server 😄
05:59:55*ntat joined #nim
06:00:09FromDiscord<nnsee> whispers ORACLE FREE TIER
06:00:10FromDiscord<Elegantbeef> What do you use for your git instance?
06:00:26FromDiscord<nnsee> used to be gitea, now I've moved to forgejo
06:00:28FromDiscord<nnsee> "moved"
06:00:39FromDiscord<nnsee> i just renamed the image name in my docker compose file
06:01:24FromDiscord<Elegantbeef> Girvo I half expect you to use the MSB as a flag to indicate whether it's init'd 😄
06:02:10FromDiscord<Elegantbeef> This is why people should not write binary forrmats at 3am, it really makes you want to bit twiddle
06:02:28FromDiscord<Elegantbeef> What's the domain so I can throw some code there to make you feel less alone?
06:03:03FromDiscord<Elegantbeef> Proceeds to upload an inhumane amount of corn
06:04:01FromDiscord<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:01FromDiscord<Elegantbeef> git instances\
06:05:05FromDiscord<girvo> In reply to @Elegantbeef "Girvo I half expect": haha you'd be right at home in embedded i swear
06:05:05FromDiscord<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:13FromDiscord<nnsee> https://git.dog
06:05:27FromDiscord<Elegantbeef> It's a domain made for me
06:05:32FromDiscord<nnsee> indeed
06:05:34FromDiscord<girvo> whats the default `=sink` impl? It seems doing `=destroy(a)` `wasMoved(a)` means I get odd behaviour
06:05:55FromDiscord<girvo> (I get "Called destructor 0" instead of "Called destructor 2")
06:07:01FromDiscord<girvo> Oh I needed to acutally assign to `a`
06:07:49FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=CbpjmJmQDPzn
06:08:19FromDiscord<Elegantbeef> sink is destroy A then move B to A
06:08:22FromDiscord<Elegantbeef> There is an example on the docs
06:08:25FromDiscord<Elegantbeef> `wasMoved` zeros
06:08:31FromDiscord<Elegantbeef> So if you need to check that it's not zero'd do that
06:08:31FromDiscord<girvo> Yeah I'm looking at the example
06:08:32FromDiscord<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:32FromDiscord<Elegantbeef> To be a dick "Dest is probably the one you can write to"
06:08:39FromDiscord<Elegantbeef> `a: Var T, b: T`
06:08:43FromDiscord<Elegantbeef> `a` is dest
06:08:55FromDiscord<girvo> Yeah I get that 😛
06:09:17FromDiscord<girvo> Ahhhh wait I get it
06:09:24FromDiscord<girvo> Yeah this makes sense now
06:09:25FromDiscord<demotomohiro> `a` need to be destroyed because it need to takes `b` and loose current value.
06:09:25FromDiscord<girvo> Okay sweet
06:09:30FromDiscord<girvo> yeah 🙂
06:10:51FromDiscord<nnsee> > to be a dick↵well that's a bit redundant, we knew this already!
06:11:04FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=EjYTOzLlzVHJ
06:11:09FromDiscord<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:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QJpYpnSTbVSD
06:12:44FromDiscord<girvo> I think really this whole system needs to be adjusted, where the uart driver is passed in and dealt with seperately
06:12:57FromDiscord<girvo> Because having ModbusRTU own it introduces some problems
06:14:00FromDiscord<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:09FromDiscord<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:29FromDiscord<Elegantbeef> What's the issue with closing then reopening?
06:14:32FromDiscord<Elegantbeef> Waste of cycles?
06:14:41FromDiscord<girvo> I'd be happy to close it lol
06:14:47FromDiscord<girvo> I was just trying to do it purely via =destroy
06:14:57FromDiscord<girvo> Can do it in the `init` of course
06:15:00FromDiscord<Elegantbeef> Can you query the properties?
06:15:04FromDiscord<girvo> Probably have to really
06:15:10FromDiscord<girvo> Yeah I can query if its installed on a given port
06:15:25FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=BvfkloMJZZIy
06:15:25FromDiscord<Elegantbeef> Can you query it's baud rate and friends?
06:15:37FromDiscord<girvo> Not sure. I'll check
06:15:45FromDiscord<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:28FromDiscord<girvo> Yeah its a bit naff, but I can
06:17:30FromDiscord<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:09FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=uAPjlrYvVrNO
06:18:34FromDiscord<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:42FromDiscord<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:22FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mTTUOiYVVCzQ
06:22:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=bJdjRYrNBijR
06:22:48FromDiscord<girvo> The nesper uart stuff doesn't even have a "uninstall" proc or anything anyway
06:23:03FromDiscord<girvo> Hah I started down that path already 😛
06:24:42FromDiscord<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:30FromDiscord<Robyn [She/Her]> In reply to @varriount "It's a shame the": That's a reason Nimskull was forked too, iirc
06:26:26FromDiscord<Elegantbeef> Yea movement semantics does very well with "Only one instance should exist"
06:26:27*advesperacit joined #nim
06:27:09FromDiscord<girvo> Agreed. I honestly forgot that the nesper uart stuff is based on ref object
06:27:35FromDiscord<girvo> the rest of our drivers that map one to one with some hardware thing are done with move semantics/no copying
06:28:26FromDiscord<Robyn [She/Her]> In reply to @NimEventer "New Nimble package! sunny": Sunny looks cool
06:29:27FromDiscord<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:32FromDiscord<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:36FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=mDvaSmIDYbOc
06:29:56FromDiscord<Elegantbeef> `ensureMove` in 2.0 does enable that behaviour for moving
06:30:00FromDiscord<girvo> yeah cool
06:30:06FromDiscord<girvo> good to know for the future 🙂
06:30:10FromDiscord<Elegantbeef> But not for what you did there
06:30:20FromDiscord<girvo> yeah I figured as much
06:30:40FromDiscord<Elegantbeef> Though you could do `wasMoved(ensureMove x)`
06:31:33FromDiscord<girvo> Anyway, back to re-doing nesper/uarts
06:31:43FromDiscord<girvo> thanks for the help as always
06:32:29FromDiscord<Elegantbeef> hmmm actually that doesn't work in 2.0
06:34:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=XwMcUJZyrnba
06:36:43FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=NjsLmHcpHgEk
06:37:31FromDiscord<girvo> Yeah docs suggest that you have to set them before the driver_install
06:39:36FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=CrEDoIUnMfsQ
06:39:57FromDiscord<Elegantbeef> I'd argue this is where typestates come in
06:41:18FromDiscord<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:46FromDiscord<Elegantbeef> You of course would need to manually do `myUart.setup()` so I guess not much better
06:42:23FromDiscord<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:03FromDiscord<Elegantbeef> Well there is slightly less code in the type state version
06:43:04FromDiscord<girvo> I do wish this wasn't driven by runtime network-received config 🥲
06:44:18FromDiscord<Elegantbeef> But in the future you can just do `myUart.setup(Uart.init(...))`
06:44:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=hBqdrOVZqsQI
06:47:04FromDiscord<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:14FromDiscord<girvo> But definitely something I want to sort out
06:50:43FromDiscord<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:54NimEventerNew 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:49FromDiscord<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:32FromDiscord<A2> Mooodddsss
12:32:55FromDiscord<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:29FromDiscord<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:57FromDiscord<A2> is there a something like a pragma that tells nim "just let me manually free this one object" ?
12:35:34FromDiscord<odexine> MM doesn’t (shouldn’t) do anything with pointers
12:37:03FromDiscord<ringabout> Is it pointing to a local object on the stack or a ref object?
12:37:38*ntat joined #nim
12:38:10FromDiscord<A2> it's a ref object
12:38:34FromDiscord<A2> which I then `cast[pointer](myRefObj)` before returning (is that even necessary?)
12:39:09FromDiscord<Robyn [She/Her]> In reply to @A2 "it's a ref object": That explains it
12:39:24FromDiscord<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:13FromDiscord<A2> ooh! that appears to solve my problem! awesome!
12:42:27FromDiscord<A2> at least in my small-ish repro example
12:42:50FromDiscord<A2> now I'm gonna go get lunch, and then I can fix it in prod. Thanks ppl!
12:43:08FromDiscord<ringabout> See also https://nim-lang.github.io/Nim/backends.html#memory-management-custom-data-types
12:46:02FromDiscord<A2> It's a bit surprising that my code ever worked, when I was using \`--mm\:refc\`
12:46:26FromDiscord<A2> I would expect that to have the same problem as I'm running into now
12:46:29FromDiscord<A2> ¯\\\_(ツ)\_/¯
12:59:18FromDiscord<odexine> In reply to @A2 "I would expect that": It’s likely because of the determinism from ORC/ARC
13:00:05FromDiscord<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:15FromDiscord<zumi.dxy> and they say ARC/ORC isn't "production ready"...
13:57:14FromDiscord<A2> sent a code paste, see https://play.nim-lang.org/#pasty=ccieVvgPrMaQ
13:57:19FromDiscord<A2> sent a code paste, see https://play.nim-lang.org/#pasty=UTNZZMgCoyiZ
13:58:32FromDiscord<bung8954> need use refc I guess
14:00:00FromDiscord<A2> sent a code paste, see https://play.nim-lang.org/#pasty=SDhcmVrfYtgg
14:01:15FromDiscord<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:06FromDiscord<A2> all of the problems I'm running into now are specifically related to moving from `--mm:refc` to `--mm:orc`
14:02:09FromDiscord<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:15FromDiscord<A2> I guess I could manually malloc the string or something
14:02:57FromDiscord<ringabout> `GC_ref` doesn't support strings, seqs in ARC/ORC
14:04:46FromDiscord<A2> ah, good to know that nim-lang.org is incorrect, I hadn't realized!
14:05:20FromDiscord<A2> I wonder what the idiomatic way to return a string/cstring to the backend is, when using arc/orc
14:05:57FromDiscord<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:26FromDiscord<A2> I guess I could make an issue on github.com/nim-lang/nim about it?
14:06:55FromDiscord<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:57FromDiscord<A2> oh wow, you're quick
14:09:55FromDiscord<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:26FromDiscord<ringabout> Yeah, you can allocate a char and your point `cstring/pointer` to the data
14:13:48FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#pasty=foLkcVHWPuCU
14:14:56FromDiscord<A2> yeah I was considering doing something like that too
14:15:25FromDiscord<A2> it's probably cleaner than doing FFI ti libC
14:15:34FromDiscord<A2> but I still need to use the string from c
14:15:57FromDiscord<A2> and I guess if I do a `get_text(s: String): cstring {.exportc.}` I will have the same problem
14:16:39FromDiscord<A2> oh actually maybe not actually, since the string would still be referenced by the `ref object`
14:16:39FromDiscord<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:41FromDiscord<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:38FromDiscord<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:55arkanoidspeaking of nim >= 2.0, what is "nim runtime" today? Cycle collector when using ORC, and then?
15:00:18FromDiscord<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:39NimEventerNew thread by can-lehmann: Owlkettle 3.0.0, see https://forum.nim-lang.org/t/11170
15:05:48FromDiscord<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:17FromDiscord<TӨMΛ ☠> Sorry for forgetting such trivialities, but how is called sequence that allow only one the same entry?
15:21:27FromDiscord<odexine> set
15:21:32FromDiscord<TӨMΛ ☠> Thank you ❤️
15:21:34FromDiscord<odexine> kind of
15:21:46FromDiscord<odexine> its not exactly a sequence
15:22:13FromDiscord<TӨMΛ ☠> I mean, it needs to be appendable, that's what matters
15:23:13FromDiscord<odexine> for sets, its `incl` and `excl` because they are not ordered
15:28:59FromDiscord<TӨMΛ ☠> Oh, but set can't use `string` type ;-;
15:29:22FromDiscord<odexine> HashSet in the sets module
15:31:08arkanoidif 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:32arkanoidwhat is that, a slice? a tuple?
15:38:04FromDiscord<odexine> it
15:38:06FromDiscord<odexine> fuck
15:38:28FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=PRbIrsSStoEM
15:39:37arkanoidI 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:09FromDiscord<odexine> i assume you've tried plainly passing an array already?
15:40:49arkanoidyes, it complains. I'm trying to understand the error actually
15:41:18FromDiscord<odexine> do you mind sending it here so we can read it as well?
15:41:46FromDiscord<odexine> it might be related to the fact that its a varargs of untyped...
15:41:51arkanoidodexing its better if I create an independent example. Wait a minute
15:42:12FromDiscord<odexine> so i think the variable has to be effectively const
15:42:25FromDiscord<odexine> or maybe that wouldnt even work
15:43:45arkanoidbut 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:03FromDiscord<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:52arkanoidthe 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:29FromDiscord<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:55FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=rBFJyAkBOCRs
16:01:25FromDiscord<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:09FromDiscord<saint.___.> @morgan Are you pushing your work to a repo anywhere?
17:19:33FromDiscord<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:53FromDiscord<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:03FromDiscord<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:54FromDiscord<saint.___.> In reply to @morganalyssa "https://github.com/morganholly/nim-clap": Awesome! I'll take a look at this
19:36:03FromDiscord<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:25FromDiscord<saint.___.> Gotcha
19:36:34FromDiscord<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:49FromDiscord<morgan> at least i'm doing separate const blocks for each set
19:36:57FromDiscord<morgan> so they can be minimized in the editor
19:40:00FromDiscord<morgan> oh and i skipped over types for transport related stuff
19:40:03FromDiscord<morgan> since i don't need that
19:40:07FromDiscord<morgan> that
19:52:08NimEventerNew thread by guzba: Show Nim: Sunny, JSON in Nim with Go-like field tags, see https://forum.nim-lang.org/t/11171
19:53:13FromDiscord<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:48NimEventerNew 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:30FromDiscord<demotomohiro> In reply to @arathanis "Can you read the": https://nim-lang.org/docs/compilesettings.html
21:50:26FromDiscord<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:54FromDiscord<arathanis> In reply to @demotomohiro "https://nim-lang.org/docs/compilesettings.html": thank you!