<< 25-04-2022 >>

00:21:05FromDiscord<exelotl> Wow that's cool
00:24:20*Zectbumo quit (Remote host closed the connection)
00:34:30FromDiscord<ShalokShalom> In reply to @Elegantbeef "https://nim-lang.org/docs/distros.html": Thats super cool. That reminds me, what about a section somewhere that says 'hidden gems' or something of that sorts?
00:34:47FromDiscord<ShalokShalom> Like neat little tricks and special features of Nim, that are less known?
00:41:07FromDiscord<ShalokShalom> Would find that a cool additon
00:50:50FromDiscord<demotomohiro> You might find cool libraries like distros module in https://nim-lang.org/docs/lib.html↵or https://nim-lang.github.io/Nim/lib.html
00:51:23FromDiscord<Elegantbeef> The most nuggety is https://nim-lang.org/docs/browsers.html
00:52:28*GreaseMonkey quit (Remote host closed the connection)
00:53:35*greaser|q joined #nim
00:59:54FromDiscord<huantian> wait I just realized I could probably use std/cookies.parseCookies for content disposition
01:00:18FromDiscord<huantian> If i want to be lazy
01:00:53nrds<Prestige99> Elegantbeef: How do you check if the type of an object is Foo ?
01:00:58nrds<Prestige99> I thought if foo is Foo
01:01:25FromDiscord<huantian> use `of` for runtime check
01:01:43nrds<Prestige99> foo of Foo?
01:01:50FromDiscord<huantian> correct
01:02:32nrds<Prestige99> ty
01:03:18FromDiscord<Elegantbeef> Imagine using inheritance 😄
01:04:08*duuude joined #nim
01:06:30*Gustavo6046 joined #nim
01:07:04FromDiscord<exelotl> > this post was made by the bounded polymorphism gang
01:09:16*vicfred quit (Quit: Leaving)
01:29:29FromDiscord<Hamid_Bluri> what is this weird generic syntax? ↵↵colon `:` before type↵https://mashingan.github.io/excelin/src/htmldocs/excelin.html#getCell%2CRow%2Cstring%2Ctypeof%28nil%29
01:30:06FromDiscord<Elegantbeef> It's generic call + method call syntax
01:30:23FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#templates-limitations-of-the-method-call-syntax
01:31:04FromDiscord<Hamid_Bluri> beef knows everything
01:31:09FromDiscord<Hamid_Bluri> thanks
01:31:45FromDiscord<Elegantbeef> Wait it's not there
01:32:47FromDiscord<Hamid_Bluri> no
01:33:24FromDiscord<Elegantbeef> Eitherway it's just for resolving ambiguity
01:33:41FromDiscord<Hamid_Bluri> what ambiguity here?
01:34:32FromDiscord<Hamid_Bluri> isn't `[string]` enough?
01:34:40FromDiscord<Hamid_Bluri> why `[:string]`
01:34:40FromDiscord<Elegantbeef> `row.getCell[string]` is parsed as `[](row.getCell, string`
01:34:55FromDiscord<Elegantbeef> `row.getCell[: string]` is parsed as a generic instantiation of `getCell`
01:35:08FromDiscord<Hamid_Bluri> oh God
01:37:03FromDiscord<Elegantbeef> Ah it's explained here https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
01:37:43FromDiscord<Hamid_Bluri> thanks
01:43:46FromDiscord<huantian> Thinking about making a wrapper over enum indexed arrays with a table-like API
01:43:59FromDiscord<huantian> Not sure how useful it would be
01:44:05FromDiscord<Hamid_Bluri> ?
01:46:04FromDiscord<Elegantbeef> Using `Option[T]` for the value for a table equivlent?
01:46:09FromDiscord<huantian> Mhm
01:48:40FromDiscord<huantian> I was thinking about using two arrays but that just felt unnecessary
01:49:34FromDiscord<huantian> It shouldn’t be too complicated
01:49:59FromDiscord<Elegantbeef> You can just use a `set[Enum]` for values
01:50:04FromDiscord<Elegantbeef> Much more efficient
01:50:19FromDiscord<Elegantbeef> `hasKey` is `key in myBitSet`
01:52:56FromDiscord<huantian> How would that be more efficient?
01:53:24FromDiscord<Elegantbeef> it's more memory efficient
01:53:51FromDiscord<Elegantbeef> with 8 enums you have 8 bits vs 64bits for `Option[T]`
01:54:18FromDiscord<huantian> oh are `Option`s that big?
01:54:44FromDiscord<Elegantbeef> Well it's 1 extra byte per value since it's a union delimited by `bool`
01:54:52FromDiscord<Elegantbeef> Unless it's `Option[ref]`
01:54:53FromDiscord<huantian> oh yeah
01:54:59FromDiscord<huantian> that makes sense
01:55:01FromDiscord<Elegantbeef> Then it's just an alias for the type
01:55:38FromDiscord<huantian> I guess this won't be as memory efficient when compared to a normal table anyways
01:57:01FromDiscord<Elegantbeef> It's about being faster and with the same functionality though 😄
01:57:06FromDiscord<huantian> yep!
01:57:23FromDiscord<Elegantbeef> You can have the same logic for `Option[ref]`
01:57:33FromDiscord<Elegantbeef> Where you just use `isNil` instead of `inMySet`
02:00:26FromDiscord<huantian> yeah that seems good
02:10:55*marcinaj joined #nim
02:14:56madpropshttps://news.ycombinator.com/item?id=31149332
02:15:15madprops"Includes: Parser/Compiler, REPL, Virtual Machine, Bytecode Disassembler"
02:16:43FromDiscord<VideoCarp> is there a Qt6 (not QML) binding for Nim?↵If not, what good GUI libs can I use for Nim?
02:32:09*duuude quit (Remote host closed the connection)
02:32:25FromDiscord<Elegantbeef> @VideoCarp\: i dont really know what's the best but there is a small list here https://github.com/xflywind/awesome-nim#gui
02:32:35*duuude joined #nim
02:35:29FromDiscord<huantian> In reply to @Elegantbeef "Where you just use": this won't work if someone wants to store a `nil` though right
02:35:43FromDiscord<Elegantbeef> Correct
02:36:40FromDiscord<VideoCarp> I looked and it seems they only have QML bindings for Qt.↵And most of these are either Electron, mono-platform or not very well documented. So I'm wondering if there is a full Qt6 binding because I'm familiar with it.
02:39:50FromDiscord<Elegantbeef> I don't there there are qt6 bindings, isnt it relatively new?
02:46:18FromDiscord<VideoCarp> no it was released dec 8 2020
02:49:23*marcinaj quit (Quit: Client closed)
02:53:27termerthat's recent in gui toolkit world
02:54:20FromDiscord<VideoCarp> well are there any Qt5 bindings? it was released dec 12 2012.
02:58:48FromDiscord<Elegantbeef> Doesnt seem so
03:03:47FromDiscord<VideoCarp> well, Fidget looks promising but I can't tell if it's CLI, web or desktop
03:04:03FromDiscord<Elegantbeef> It's both web/desktop/mobile
03:04:15FromDiscord<Elegantbeef> Well all 3 😄
03:04:57FromDiscord<VideoCarp> thanks
03:05:33FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/9059 might also interest you
03:09:29FromDiscord<VideoCarp> I think I'll define them myself, I don't like the paradigm that uses very much.
03:10:22FromDiscord<VideoCarp> But this looks great. I had no idea Nim could do things like this, it's like you can just embed a declarative language, even though that's not happening.
03:12:03FromDiscord<Elegantbeef> Yea owlkettle is also pretty nifty in that regard
03:12:07FromDiscord<Elegantbeef> Declarative GUI is nice
03:12:19FromDiscord<VideoCarp> owlkettle?
03:13:32FromDiscord<Elegantbeef> https://github.com/can-lehmann/owlkettle/tree/main/examples
03:13:49FromDiscord<Elegantbeef> It uses gtk but could technically be used for anything with a bit of modification
03:17:06FromDiscord<VideoCarp> looks quite clean
03:21:03*v9fk quit (Remote host closed the connection)
03:21:46*v9fk joined #nim
03:24:43*Zectbumo joined #nim
03:33:03FromDiscord<huantian> https://play.nim-lang.org/#ix=3Wah↵why does this compile when there's no chance SomeObject will have a field named asdf
03:33:31FromDiscord<huantian> is that just how generics work
03:34:07FromDiscord<huantian> since each type is not generated if it's not used
03:34:15FromDiscord<Elegantbeef> `asdf` can be a procedure
03:34:35FromDiscord<huantian> true
03:35:29FromDiscord<huantian> still feels kinda weird
03:36:28FromDiscord<huantian> it breaks --styleCheck 😔
03:39:46FromDiscord<huantian> huh does that mean then all the type checking can only happen if I use the proc?
04:29:48FromDiscord<Prestige> https://play.nim-lang.org/#ix=3War why does this not work? (the last bit)
04:30:03FromDiscord<Prestige> I thought this worked previously but maybe I'm crazy
04:30:43FromDiscord<Elegantbeef> Literals convert numerics dont
04:30:49termeryou're trying to add an int with a float
04:30:53FromDiscord<Elegantbeef> \`import std/leniantops" if you want conversions like this
04:30:54FromDiscord<Prestige> Either way, gets annoying having to cast ints all the time when a param type takes a float
04:30:54termerremember that `+` is a proc
04:30:58FromDiscord<Prestige> ah cool
04:31:08FromDiscord<Prestige> I'll try `import std/leniantops`
04:31:10termeryou can make your own `+` if you want that does the conversion for you
04:31:17termeroh
04:31:23termerI guess leniantops works too lol
04:32:37FromDiscord<Prestige> neat ty
04:32:41FromDiscord<Prestige> I will use this everywhere
04:33:49FromDiscord<Prestige> Is there a way to just globally enable that with a compiler flag?
04:34:06FromDiscord<Elegantbeef> `--import:"std/leniantops"`
04:34:14FromDiscord<Elegantbeef> Not great for portable code but yea it works
04:34:25FromDiscord<Elegantbeef> Throw that in your `nim.config` and there you go
04:35:15FromDiscord<Prestige> ty ty
05:14:54*slowButPresent quit (Quit: leaving)
05:37:23*jjido joined #nim
05:37:31FromDiscord<Prestige> Can you have an iterator that can be overridden with inheritance?
05:37:40FromDiscord<Prestige> like both a method and an iterator
05:37:55FromDiscord<Elegantbeef> Iterators are inlined so no
05:38:29FromDiscord<Elegantbeef> You could use a method to generate an inline iterator then iterator on that i think
05:40:52FromDiscord<Prestige> How about a concept, so a method returns something that can be iterated over?
05:41:34FromDiscord<Prestige> Like a something could return a seq, array, or HashSet
05:41:50FromDiscord<Elegantbeef> I think the return type of a method has to match
05:41:50FromDiscord<Prestige> so long as it has an iterator that returns T
05:41:54FromDiscord<Prestige> hmm
05:42:54FromDiscord<Elegantbeef> It still needs to be delimited at compile time
05:42:54FromDiscord<Elegantbeef> You can make a for loop macro if you must
05:57:56FromDiscord<Rika> beef your picostdlib readme is funny
05:57:57FromDiscord<Rika> "Please contribute."
05:58:13FromDiscord<Elegantbeef> Dont recall who added that
05:58:18FromDiscord<Elegantbeef> Laugh at casey or auxym
05:58:20FromDiscord<Rika> git blame
05:58:44FromDiscord<Rika> you added it you fucker
05:58:54FromDiscord<Elegantbeef> I did?
05:59:02FromDiscord<Rika> says on the blame its you
05:59:47FromDiscord<Elegantbeef> Nah casey added it in https://github.com/beef331/picostdlib/commit/ff346704eb85d49ef4965590a0a32a5be332e7c7
06:00:18FromDiscord<Rika> boo
06:00:23FromDiscord<Elegantbeef> Speaking of auxym.... they never got back to me with how autoimporting worked
06:00:26FromDiscord<Rika> beef being boring as usual
06:00:35FromDiscord<Elegantbeef> Fuck yea
06:01:42FromDiscord<Elegantbeef> Lol kate's fold coding is eating my code
06:02:02FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/968029098628747264/image.png
06:02:07FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/968029119629656104/image.png
06:02:17FromDiscord<Elegantbeef> Me think it's fucked up
06:02:27FromDiscord<Rika> your folding is fucked up yes
06:02:52FromDiscord<Elegantbeef> Dont even think i can disable code folding
06:03:25FromDiscord<Solitude> epic editor
06:13:14*neurocyte8614492 joined #nim
06:24:06*duuude quit (Ping timeout: 250 seconds)
06:29:18*duuude joined #nim
06:29:31*nsyd joined #nim
06:31:54*PMunch joined #nim
06:50:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
06:50:29*def- quit (Quit: -)
06:50:59FromDiscord<SirElephant> what language was nim made in?
06:51:16*def- joined #nim
06:51:37FromDiscord<SirElephant> In reply to @Elegantbeef "image.png": what theme?
06:53:08FromDiscord<Elegantbeef> Nim was originally written in object pascal it's now selfhosted
06:54:17FromDiscord<SirElephant> bruh i forgot that nim as written in nim eheheheh
06:54:27FromDiscord<SirElephant> In reply to @Elegantbeef "Nim was originally written": wut theme are you using?
06:54:34FromDiscord<Elegantbeef> ayu mirage
06:54:50FromDiscord<SirElephant> https://tenor.com/view/pink-city-pop-pink-gif-23314592
06:54:56FromDiscord<SirElephant> asethetic
06:55:00FromDiscord<SirElephant> (edit) "asethetic" => "assthetic"
06:59:19*jmdaemon quit (Ping timeout: 272 seconds)
07:39:28*krux02 joined #nim
07:42:37*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
07:54:00PMunch@SirElephant, one benefit of compiling to C. Nim is written in Nim, but also hosts a csources repo which is just a compiled to C version that can be used to build a Nim compiler which can build the newest Nim compiler
07:56:51*jjido joined #nim
08:07:49FromDiscord<d4rckh> Is there any way I can read the stdin if the user didn't press enter yet?
08:08:11FromDiscord<Elegantbeef> `stdin.readChar` for blocking
08:08:45FromDiscord<Elegantbeef> also `getCh` if you dont want to print it
08:09:35FromDiscord<d4rckh> Thanks, I want to have a cli interface which also logs stuff pretty quickly so i want to save the stdin and restore it every time i print a new log
08:14:29PMunchAh, in order to avoid half typed messages scrolling up the screen?
08:14:51FromDiscord<TryAngle> does a standalone llvm ir bindings library exist?
08:16:08FromDiscord<Rika> What do you mean
08:17:00FromDiscord<TryAngle> In reply to @Rika "What do you mean": https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.html
08:17:31FromDiscord<TryAngle> sent a code paste, see https://paste.rs/2F6
08:19:07FromDiscord<Rika> Maybe the Nim LLVM backend has some
08:19:44FromDiscord<TryAngle> In reply to @Rika "Maybe the Nim LLVM": I know it has that↵that's why I ask for standalone 😭
08:20:07FromDiscord<TryAngle> so I can `nimble install llvm` or smth like that
08:20:26FromDiscord<Rika> Just pull it out of the repo?
08:21:52FromDiscord<TryAngle> In reply to @Rika "Just pull it out": it's MIT license lol I thought it was unlicensed
08:22:01FromDiscord<TryAngle> ok hippity hoppity ur code is now my property
08:23:14FromDiscord<TryAngle> or wait, I'm actually on a linux system now so things like this should be easy manually I try that first...
08:33:59FromDiscord<d4rckh> sent a long message, see http://ix.io/3Wbe
08:41:02*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:42:56*Zectbumo quit (Remote host closed the connection)
08:52:39FromDiscord<N00nehere> j
08:52:48FromDiscord<Elegantbeef> a
08:53:32FromDiscord<Solitude> v
08:54:05PMunche
09:04:29FromDiscord<Rika> Why
09:07:04*neurocyte8614492 quit (Quit: The Lounge - https://thelounge.chat)
09:18:36*duuude quit (Ping timeout: 240 seconds)
09:21:38*neurocyte8614492 joined #nim
09:21:50*krux02 quit (Remote host closed the connection)
09:24:36*nsyd quit (Ping timeout: 240 seconds)
09:34:59FromDiscord<N00nehere> b
09:40:08FromDiscord<enthus1ast> @d4rckh\: you want readline/linenoise like behaviour?
09:40:48FromDiscord<d4rckh> Yeah
09:41:18FromDiscord<enthus1ast> but you do not want to patch existing applications ?
09:41:58FromDiscord<d4rckh> what do you mean patch an existing app?
09:42:33FromDiscord<d4rckh> I just need to save the stdin, and restore it
09:43:06FromDiscord<enthus1ast> i dont think thats neccesary for what you want↵(@d4rckh)
09:43:15FromDiscord<d4rckh> Oh
09:43:22FromDiscord<enthus1ast> if i understand correctly what you want of course \:)
09:43:34FromDiscord<d4rckh> In reply to @PMunch "Ah, in order to": I want to avoid this
09:43:55FromDiscord<d4rckh> My program reads commands, and sometimes logs things
09:44:25FromDiscord<enthus1ast> try something like this then\: https://github.com/jangko/nim-noise
09:44:33FromDiscord<d4rckh> And if you type something, and then there's a log, it gets printed over what you typed
09:44:51FromDiscord<enthus1ast> yes, but the stdin is still as it was before this↵(@d4rckh)
09:51:25FromDiscord<enthus1ast> @d4rckh\: another question
09:51:38FromDiscord<enthus1ast> is your app printing from another thread?
09:51:57FromDiscord<d4rckh> No, it's async
09:52:21FromDiscord<enthus1ast> how do you then readLine without blocking?
09:52:31FromDiscord<d4rckh> One sec
09:52:43PMunch~*magic*~
09:56:22*jjido joined #nim
09:57:05FromDiscord<Rika> You set the terminal mode to raw xd
09:57:17FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WbE
09:57:18FromDiscord<d4rckh> In reply to @enthus1ast "how do you then": something like this
09:57:22FromDiscord<Rika> It’s a lot of work actually
09:57:25FromDiscord<Rika> I mean if you don’t do that
09:57:29FromDiscord<enthus1ast> this is a thread
09:57:43FromDiscord<d4rckh> oh yeah, right
09:57:46FromDiscord<d4rckh> `spawn`
09:57:48FromDiscord<d4rckh> sorry
09:57:49FromDiscord<Rika> In reply to @enthus1ast "this is a thread": Well it’s not wrong still
09:57:55FromDiscord<enthus1ast> no
09:57:57FromDiscord<d4rckh> wrote this last night
09:58:10FromDiscord<d4rckh> its working completely fine tho
09:58:42FromDiscord<enthus1ast> yes, actually i'm not sure if nim-noise can help, but its worth a try
09:59:20FromDiscord<d4rckh> hmm
09:59:47FromDiscord<d4rckh> is there any other way which i can achieve this?
10:00:06FromDiscord<enthus1ast> with async reading chars (eg with illwill)
10:00:35FromDiscord<enthus1ast> but then you must build a line input yourself
10:01:34FromDiscord<enthus1ast> i would try nim-noise / lineoise etc first \:)
10:02:02FromDiscord<enthus1ast> and please report back if it works (if you go this route), would also interest me
10:02:10FromDiscord<d4rckh> history would be my logs in nim-noise?
10:02:44FromDiscord<enthus1ast> history is the command history imho
10:03:04FromDiscord<enthus1ast> like pressing the arrow up, and arrow down in normal terminal
10:03:40FromDiscord<d4rckh> oh yeah
10:05:27FromDiscord<d4rckh> can i use nim noise with threads
10:05:28FromDiscord<d4rckh> (edit) "threads" => "threads?"
10:13:59FromDiscord<jmgomez> hey guys, how would you covert a string like this "2022-04-25T11:12:44.5285705Z" into a DateTime in nim?
10:14:51FromDiscord<enthus1ast> with times parse()
10:15:41FromDiscord<jmgomez> ohh I was looking at parseTime, will give that a shot
10:19:29FromDiscord<d4rckh> Okay i was able to implement Nim noise, it's pretty cool! How can I make it threaded tho, so it doesn't interrupt my other stuff
10:20:27FromDiscord<enthus1ast> you could start it in a thread and send the commands to the worker via channels
10:24:16FromDiscord<d4rckh> hmm, i will do that
10:24:24FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=3WbN
10:26:56FromDiscord<ambient> It either SEGV or complains that the variable can't be captured, if I do it like a constructor it says "cannot be captured as it would violate memory safety"
10:29:10FromDiscord<d4rckh> looks like noise's functions arent gcsafe and i cant really call them in a thread? `Error: 'procStdin' is not GC-safe as it calls 'readLine'`
10:30:32FromDiscord<Solitude> In reply to @ambient "I'm having a hard": try this maybe? https://nim-lang.org/docs/sugar.html#capture.m%2Cvarargs%5Btyped%5D%2Cuntyped
10:32:26FromDiscord<Solitude> In reply to @ambient "I'm having a hard": probably wont help, this jus doesnt look right at all
10:35:03FromDiscord<aph> have anyone got nim running on console (like nintendo, ps5, or whatever) btw
10:35:43FromDiscord<Rika> There’s a Nintendo switch compile path
10:35:54FromDiscord<aph> wow i didnt know it existed lol
10:36:06FromDiscord<aph> should've took a look in the docs. might've listed
10:37:41FromDiscord<ajusa> I've got it running on 3DS, exelotl has it running on GBA
10:37:49FromDiscord<exelotl> yee
10:38:10FromDiscord<d4rckh> In reply to @enthus1ast "yes, actually i'm not": okay, nim noise is not working for me, but its very cool
10:38:17FromDiscord<exelotl> I still find the switch support in the compiler to be really odd, why did this need to be in the compiler? is there something I'm missing?
10:39:05FromDiscord<Elias> Hello. When I download https://nim-lang.org/download/nim-1.6.4_x64.zip using a browser it works, but when I use pythons urllib it does not work. I get a 403.
10:40:17FromDiscord<Elias> is there something to block downloads that are not from browsers?
10:40:38FromDiscord<Solitude> wget works, so no
10:40:44FromDiscord<Elias> strange
10:41:16FromDiscord<Elias> sent a code paste, see https://paste.rs/ONz
10:41:18FromDiscord<ajusa> In reply to @exelotl "I still find the": No clue, here's the PR for more context https://github.com/nim-lang/Nim/pull/8069
10:41:21FromDiscord<Elias> other urls work
10:41:31FromDiscord<Solitude> ask in python chat?
10:41:52FromDiscord<ajusa> Looking at it now I think I may have found the issue I had on 3ds with memory alignments
10:42:00FromDiscord<Elias> In reply to @Solitude "ask in python chat?": probably smart, just wanted to check if there were blocking stuff first
10:43:57FromDiscord<aph> maybe use choosenim? idk if it works on windows though
10:44:06NimEventerNew thread by Krakengore: How to iterate a slice of children of a NimNode ?, see https://forum.nim-lang.org/t/9125
10:44:14FromDiscord<aph> In reply to @ajusa "I've got it running": good news, might make some console games later with nim
10:44:28FromDiscord<exelotl> In reply to @ajusa "No clue, here's the": it's annoying because it seems coupled to devkitPro which would mean I can't use it with the official switch SDK anyways 😅
10:45:07FromDiscord<exelotl> I should be able to try it out with the official SDK later in the year though
10:45:07FromDiscord<ajusa> In reply to @exelotl "it's annoying because it": Oh right forgot you were planning on making an official release of good boy galaxy. To be fair, there is no way official support would land in the Nim compiler
10:45:29FromDiscord<ajusa> I wonder if futhark would work for that though?
10:46:11FromDiscord<Elias> In reply to @aph "maybe use choosenim? idk": ill look into that. Seems to make things easier
10:46:52FromDiscord<exelotl> afaik the official SDK comes with a bog standard GCC and you can use SDL2 and other normal libraries with it
10:47:13FromDiscord<exelotl> so it should be possible to add "official" support without actually baking in any confidential stuff
10:48:16FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WbX
10:48:20FromDiscord<d4rckh> (edit) "https://paste.rs/2qQ" => "https://paste.rs/kVb"
10:50:22FromDiscord<ambient> Ok, the problem was I missed app.run(), so GTK dumped on me. Wasn't a Nim issue after all 🙂
10:51:20FromDiscord<ambient> would have solved this much quicker if I just dutifully went through the _entire_ stacktrace
10:52:38FromDiscord<enthus1ast> You could cast gcsafe or put the other stuff in a thread↵(@d4rckh)
10:53:05FromDiscord<d4rckh> well i put everything in a thread and it still complains about that function
10:53:22FromDiscord<d4rckh> now it looks something like this
10:53:23FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WbY
10:53:40FromDiscord<d4rckh> this errors with `Error: 'thr' is not GC-safe as it calls 'readLine'`
10:53:51FromDiscord<d4rckh> thats the only readLine in the thr pro
10:53:52FromDiscord<d4rckh> (edit) "pro" => "proc"
10:58:03FromDiscord<Yardanico> In reply to @d4rckh "this errors with `Error:": lemme check nim-noise
10:58:13FromDiscord<d4rckh> https://github.dev/jangko/nim-noise
10:58:21FromDiscord<Yardanico> yeah i know, already cloned
10:58:42FromDiscord<d4rckh> sure
11:01:45PMunch@ajusa, Futhark requires clang and that clang is able to understand the sources you're wrapping. If you need to use a special compiler for your C code then it's quite likely Futhark won't work unfortunately.
11:02:22FromDiscord<Yardanico> @d4rckh the full stack trace:
11:02:30FromDiscord<Yardanico> sent a code paste, see https://paste.rs/P50
11:02:48FromDiscord<Yardanico> if you don't care about editProc, then you can just cast the gcsafe error away
11:03:44*vicecea quit (Remote host closed the connection)
11:03:48FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wc1
11:04:16*vicecea joined #nim
11:04:33PMunchYardanico, there is a [] slice operator for NimNodes in the macros module ;)
11:04:41FromDiscord<Yardanico> :D
11:04:46FromDiscord<Yardanico> i thought there already was macros import
11:05:24FromDiscord<d4rckh> cool, lets see if this solves my original problem
11:05:43PMunchYeah I was thrown for a second as well, I just wrote code like he used a couple minutes ago so I didn't see why his code wouldn't work :P
11:09:53PMunchHmm, I have two symbols, both are symKind == nskType. But calling getTypeImpl on on returns typedesc[MySymbol] and the other returns the full object definition..
11:13:02PMunchAnd comparing the two symbols with sameType returns false..
11:16:50PMunchHmm, but I can run getImpl on the first node and get a definition..
11:18:04*neurocyte8614492 quit (Quit: The Lounge - https://thelounge.chat)
11:19:52*neurocyte8614492 joined #nim
11:23:15PMunchIs it just me who finds this weird? https://play.nim-lang.org/#ix=3Wc8
11:23:48FromDiscord<ajusa> In reply to @PMunch "<@102899813149855744>, Futhark requires clang": Well it should be fairly normal C code, just on an ARM target but I see your point
11:23:55FromDiscord<Morvalds> is there a nim interpreter?
11:24:17PMunch@Morvalds, define interpreter
11:24:33FromDiscord<Yardanico> not in the strict sense of it @Morvalds , but nim compiler has a VM embedded into it
11:24:35FromDiscord<Morvalds> In reply to @PMunch "@Morvalds, define interpreter": opposite of compiler
11:24:36PMunch@ajusa, I had some trouble using it for AVR chips for example
11:24:44FromDiscord<Rika> In reply to @Morvalds "opposite of compiler": Now define compiler 😄
11:24:45FromDiscord<Yardanico> @Morvalds that's a wrong definition :)
11:24:51FromDiscord<Yardanico> a lot of stuff is the same in interpreters and compilers
11:24:57PMunch@Morvalds, opposite of a compiler would be a decompiler
11:25:13FromDiscord<Morvalds> In reply to @PMunch "@Morvalds, opposite of a": decompilers dont exist, only disassemblers
11:25:16PMunchThere is `nim secret` which works like the Python REPL
11:25:17FromDiscord<Yardanico> they do exist
11:25:29FromDiscord<Yardanico> for languages that are compiled into bytecode like C#, Java, etc
11:25:36FromDiscord<Rika> Aren’t we digressing
11:25:38FromDiscord<Yardanico> but anyway, let's not argue about that
11:25:48FromDiscord<Yardanico> @Morvalds the closest thing to what you want is probably NimScript
11:25:56FromDiscord<Yardanico> any reason you'd want "interpreted" Nim though?
11:26:11PMunch@Morvalds, you can also embed the NimScript interpreter into your own Nim programs, see e.g. Nimscripter
11:26:36FromDiscord<Yardanico> if you just want to write nim like a script, you can then just add a shebang to make it automatically compile and run just
11:26:38FromDiscord<Yardanico> (edit) removed " just"
11:26:42*neurocyte8614492 quit (Quit: The Lounge - https://thelounge.chat)
11:26:45FromDiscord<Morvalds> In reply to @Yardanico "any reason you'd want": because i hate generating files
11:26:51FromDiscord<Yardanico> huh?
11:27:08FromDiscord<Morvalds> no program should ever touch files
11:27:10FromDiscord<Yardanico> that's really weird reasoning - if you don't like files, just throw them to somewhere you don't see
11:27:12FromDiscord<Rika> There’s a sub command that doesn’t pollute your current working directory
11:27:18FromDiscord<Yardanico> In reply to @Morvalds "no program should ever": but they all do
11:27:55FromDiscord<Morvalds> oh and also compiling an entire app takes a lot of time im willing to sacrifice speed to stop compiling apps
11:28:01PMunch@Morvalds, have a look at nimcr
11:28:20FromDiscord<Yardanico> In reply to @Morvalds "oh and also compiling": maybe you should use Python then (a serious question)
11:28:28FromDiscord<Yardanico> while there's nimscript, Nim is made to be compiled
11:28:32PMunch@Morvalds, the Nim compiler is silly fast
11:28:40FromDiscord<d4rckh> how can i pass things to a thread by reference?
11:28:46FromDiscord<Morvalds> In reply to @Yardanico "maybe you should use": would never do that
11:29:13FromDiscord<Rika> In reply to @d4rckh "how can i pass": I think with ARC you do it normally
11:29:38FromDiscord<Yardanico> In reply to @d4rckh "how can i pass": you can with ARC, but you still need to ensure that there are no data races possible
11:29:59PMunch@Morvalds, it's no like compiling C++ programs which can take days :P
11:30:15FromDiscord<Morvalds> well
11:30:55FromDiscord<d4rckh> In reply to @Yardanico "you can with ARC,": i switched to arc, how do i pass it now?
11:31:07FromDiscord<Yardanico> if it's a global you just use it there
11:32:12FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Wcb
11:32:25FromDiscord<Rika> Sequences are by value
11:32:36FromDiscord<Yardanico> In reply to @Rika "Sequences are by value": but he's passing Server which i assume is a ref object
11:32:42FromDiscord<Rika> I didn’t assume that
11:32:44FromDiscord<d4rckh> In reply to @Yardanico "but he's passing Server": yes, correct
11:32:58FromDiscord<d4rckh> sent a code paste, see https://paste.rs/Qi6
11:33:19FromDiscord<Rika> Threads might still be deep copying parameters then perhaps
11:34:33FromDiscord<d4rckh> why? 🤔
11:35:08FromDiscord<Yardanico> hm, not sure then
11:35:13FromDiscord<Yardanico> but you can make it work by making server a global :P
11:38:46FromDiscord<d4rckh> wouldnt it complain about it not being gcsafe and stuff?
11:39:24FromDiscord<Yardanico> In reply to @d4rckh "wouldnt it complain about": you can make it not complain, although you still need to make sure you're not accessing the same sequence from multiple threads at the same time
11:39:35FromDiscord<dom96> Hm, why the need for threads @d4rckh?
11:40:05FromDiscord<dom96> If you need it for libnoise or whatever I would recommend keeping the data you transfer between thread to a minimum
11:40:20FromDiscord<dom96> i.e. just transfer the stdin, why passing the whole server?
11:42:20FromDiscord<d4rckh> In reply to @dom96 "If you need it": well, im just trying to have the logs print while i can input commands
11:42:34FromDiscord<d4rckh> and i was told noise can help me with this 🤔
11:43:56FromDiscord<d4rckh> but with noise i need to use threads like this
11:44:01FromDiscord<d4rckh> because i cant just spawn the readline function
11:44:02FromDiscord<d4rckh> like i did before
11:44:06FromDiscord<d4rckh> and now im in a rabbithole
11:47:22FromDiscord<dom96> hmm, in that case perhaps you should dedicate a thread to libnoise and send what you want printed to the thread and send back the commands that are input by the user
11:48:02FromDiscord<dom96> that way you only need to send strings back and forward, if you want more strictness you can create an object variant modelling a command
11:48:20FromDiscord<d4rckh> this is getting really complicated
11:48:25FromDiscord<d4rckh> isnt there an easier way of doing this?
11:49:23*duuude joined #nim
11:50:17FromDiscord<dom96> oh, nim-noise is implemented in Nim
11:50:20FromDiscord<dom96> that gives you more options
11:50:58FromDiscord<dom96> if you find the procs inside that library which do the stdin reading you can replace them with an async-compatible proc which does what you are already doing for stdin reading
11:51:04FromDiscord<dom96> would be a nice PR for that library
11:51:46FromDiscord<dom96> although it might not be that easy, I guess the library needs to handle inputs like up-arrow, down-arrow etc.
11:54:42FromDiscord<d4rckh> sent a long message, see https://paste.rs/ilT
11:55:35FromDiscord<dom96> maybe, give it a try, I don't know exactly what your goal is 🙂
11:57:48*rockcavera joined #nim
11:57:48*rockcavera quit (Changing host)
11:57:48*rockcavera joined #nim
12:04:04FromDiscord<d4rckh> im trying to my socket server print new stuff while i receive commansd
12:04:06FromDiscord<d4rckh> (edit) "commansd" => "commands"
12:05:11FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/968120483646148618/unknown.png
12:05:28FromDiscord<d4rckh> i want to avoid this
12:05:32FromDiscord<d4rckh> where it prints stuff while im typing
12:22:56FromDiscord<enthus1ast> @d4rckh\: maybe write a real gui?
12:23:13FromDiscord<enthus1ast> Or do the printing yourself with illwill
12:24:00FromDiscord<enthus1ast> Or, put the output of the thread in a queue and print them only after pressing enter
12:25:02FromDiscord<enthus1ast> Or split your app in two, connect via network, then have two windows with tmux
12:25:28FromDiscord<enthus1ast> What kind of application you want to do?
12:27:56FromDiscord<jmgomez> sent a code paste, see https://paste.rs/8J3
12:29:29FromDiscord<d4rckh> In reply to @enthus1ast "What kind of application": It's some sort of a remote control app
12:32:55FromDiscord<enthus1ast> Map it to irc and use your favourite irc client ;)
12:34:09FromDiscord<jmgomez> In reply to @jmgomez "Hey guys, I have": ohh Im a noob it is but I wasnt importing times
12:35:37PMunch@Elegantbeef, assuming you will see this when you wake up, here is my current working version of the autorouter/deriveable types: http://ix.io/3Wcs/nim
12:37:33PMunchI'm probably going to split the logic in two, one library that just does the derivable types part (which is what the above does). Then another "autorouter" which just tries to minimize the boilerplate of binding it to Jester/Prologue routes
12:37:47*v9fk quit (Remote host closed the connection)
12:40:26*slowButPresent joined #nim
12:40:28FromDiscord<d4rckh> In reply to @enthus1ast "<@648552095531663361>\: maybe write a": i think i might try to make a web ui oof
12:40:40FromDiscord<d4rckh> and connect the UI using websocket
12:40:41FromDiscord<d4rckh> (edit) "websocket" => "websockets"
12:49:20FromDiscord<enthus1ast> the irc stuff was no joke actually, for "some kind of remote control app" i actually like to do this
12:49:40FromDiscord<enthus1ast> thats the reason i've build a small irc server in nim
12:50:33FromDiscord<enthus1ast> what you also "could" do is, to make a gui popup for connections
12:51:05FromDiscord<jmgomez> What would be the date format for the round trip O in nim? https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings#Roundtrip
12:54:38*v9fk joined #nim
12:58:06FromDiscord<d4rckh> In reply to @enthus1ast "what you also "could"": i could do that, but i want it to be cli only
12:59:03FromDiscord<Morvalds> In reply to @d4rckh "i could do that,": well then print info to stdout
12:59:46FromDiscord<d4rckh> In reply to @d4rckh "": thats what i am doing already, but i want to avoid when its printing while im typing
12:59:52FromDiscord<d4rckh> but still get updates in real time
13:00:49FromDiscord<Morvalds> hmm
13:00:50PMunchAnd the problem is that you're unable to read what the user types before they hit enter?
13:02:01*kayabaNerve quit (Read error: Connection reset by peer)
13:02:10*kayabaNerve_ joined #nim
13:03:36FromDiscord<Morvalds> i have an idea but its stupid
13:04:02FromDiscord<Morvalds> take input everytime they press a key
13:04:20FromDiscord<Morvalds> and just render the same thing they typed there, and let them continue typing
13:04:26FromDiscord<Morvalds> like this
13:05:43FromDiscord<Morvalds> sent a code paste, see https://paste.rs/e1W
13:05:56FromDiscord<Morvalds> genius
13:10:38PMunchProblem is getting what someone type without them having to hit enter
13:11:12FromDiscord<Morvalds> hmm
13:11:14FromDiscord<Morvalds> map every key to enter
13:14:43PMunchI think this would be pretty easy on Linux, seeing how you can read asynchronously
13:15:02FromDiscord<Morvalds> In reply to @PMunch "I think this would": never used any distro that lets that happen
13:15:04PMunchHmm, well you still need to enter old legacy mode first..
13:15:20PMunch@Morvalds, if you run something like bluetoothctl it does this
13:15:29FromDiscord<Morvalds> and i know for a fact that redhat doesnt let you do that
13:15:36FromDiscord<Morvalds> and rhel is the most popular server distro
13:15:46PMunchYou run "scan on" and it starts scanning and writes out lines, pushing your prompt further down the screen
13:15:50PMunchSo it certainly isn't impossible
13:16:11PMunchWhat do you mean "doesn't let you do that"
13:16:19PMunchIt's Linux, you can do pretty much whatever you want :P
13:16:57FromDiscord<dom96> In reply to @d4rckh "and connect the UI": Yeah. That’s a great option.
13:17:10*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:18:35FromDiscord<enthus1ast> the issue is, that you then need to support ansi terminal commands
13:18:36FromDiscord<enthus1ast> if you want to use them
13:18:36FromDiscord<enthus1ast> if its only text then ok
13:18:41FromDiscord<enthus1ast> but stuff like ctrl+c etc will not work there (so easily)
13:18:57FromDiscord<d4rckh> hmm, tell me more
13:19:16FromDiscord<enthus1ast> or even vim
13:20:19FromDiscord<enthus1ast> https://xtermjs.org/
13:20:42FromDiscord<enthus1ast> xtermjs is fully featured (i use it quite often in proxmox)
13:21:03FromDiscord<enthus1ast> but only as a user, never have looked into embedding it
13:21:42FromDiscord<enthus1ast> maybe you can leverage on this and have a full terminal (but then you might have the same issues like before , but only on the web....)
13:21:57FromDiscord<enthus1ast> so i guess you could do multiple channels
13:22:12FromDiscord<enthus1ast> for status mesage, and a command channel for terminal input
13:24:18FromDiscord<Knedlik> Hey guys, how easy is it to make a modular nim app?
13:26:21FromDiscord<Entikan> I was wondering this too. Nimble should make it pretty easy.
13:26:58FromDiscord<Knedlik> How tho? I'm thinking DLCs and mods, that load dynamically
13:27:16FromDiscord<enthus1ast> but depending on how featureful your "some kind of remote control" app is, you might either want to create custom guils for controlling your machines
13:27:16FromDiscord<enthus1ast> @Knedlik\: what does modular mean?
13:27:37FromDiscord<Knedlik> An app that loads all mods/DLCs in a directory
13:27:55FromDiscord<Entikan> oh
13:28:10FromDiscord<Entikan> I thought you meant breaking up large software into smaller independent parts
13:28:55FromDiscord<Entikan> mods/DLC depends greatly on how you write your game
13:29:09FromDiscord<Knedlik> I know that Java has modules, but what about Nim? T
13:29:28FromDiscord<Knedlik> (edit) "T" => "What Java calls modules is essentially "Load if present""
13:30:36FromDiscord<Entikan> nim has nimble
13:31:21FromDiscord<Entikan> and instead of modules, it calls it packages
13:31:35FromDiscord<enthus1ast> i've done it like this for a small module system\: https://play.nim-lang.org/#ix=3WcN
13:31:45FromDiscord<Knedlik> I mean... is it possible to use a nim-built .dll if it is present and not if it's not?
13:31:46FromDiscord<enthus1ast> something like this could work
13:32:21FromDiscord<enthus1ast> modPoll i call periodically somewhere else, because it drives async code inside the module
13:33:10FromDiscord<Knedlik> What exactly is dynlib?
13:33:26FromDiscord<enthus1ast> https://nim-lang.org/docs/dynlib.html
13:33:58FromDiscord<Knedlik> This seems hella useful
13:34:38FromDiscord<Knedlik> Now I need to somehow get a list of folders in a folder...
13:35:17PMunchwalkFiles is probably your friend
13:35:24PMunchOr walkFilesRec or whatever it is called
13:35:54PMunchBy the way, you probably want to use ARC if you plan on loading dynamic libraries
13:37:16FromDiscord<clippy_droid> what would be the nim implementation of a java `IdentityHashMap`?↵here java api link for it <https://docs.oracle.com/javase/7/docs/api/java/util/IdentityHashMap.html>
13:37:21FromDiscord<clippy_droid> (edit) "<https://docs.oracle.com/javase/7/docs/api/java/util/IdentityHashMap.html>" => "https://docs.oracle.com/javase/7/docs/api/java/util/IdentityHashMap.html"
13:38:24FromDiscord<Knedlik> Is that just normal hashmap?
13:38:30FromDiscord<enthus1ast> table?
13:38:32FromDiscord<Entikan> Table
13:40:18FromDiscord<clippy_droid> In reply to @Knedlik "Is that just normal": no not really↵`IdentityHashMap` uses `==` for comparing keys and values inside `Map` while `HashMap` uses equals method for comparing keys and values.
13:41:37FromDiscord<enthus1ast> thats, quite unhelpful
13:41:57FromDiscord<enthus1ast> withouth knowing java at least
13:42:05FromDiscord<Knedlik> I do know Java
13:42:26FromDiscord<enthus1ast> i guess because you cannot overload == in java?
13:42:34FromDiscord<Knedlik> don't think so
13:43:05FromDiscord<Knedlik> I'm not sure if you can overload any operator
13:43:33FromDiscord<clippy_droid> is there a hashmap package for nim
13:46:12FromDiscord<enthus1ast> I think in nim the hash function of your type controls the table behavior in this case
13:47:01FromDiscord<d4rckh> In reply to @enthus1ast "https://xtermjs.org/": interesting
13:47:47FromDiscord<d4rckh> whats a cool web server for nim, that i can run asynchronously
13:48:10FromDiscord<enthus1ast> Asynchttpserver, prologue, jester
13:48:23FromDiscord<d4rckh> i think ill give jester a try
13:48:51FromDiscord<d4rckh> actually, ill go with prologue
13:49:18*PMunch quit (Quit: Leaving)
13:49:52FromDiscord<enthus1ast> Both are good, I personally use prologue more often but I also have some projects with jester and asynchttpserver
13:52:35FromDiscord<Knedlik> Hmmm, if I put Type1 into a seq of Type0, where Type1 inherits Type0, and I access the Type1 from the seq, I should get all it's variables in the previous state, right?
13:53:36FromDiscord<dom96> In reply to @d4rckh "actually, ill go with": if you just need websockets I would go with an http server like httpbeast and a websockets lib
13:53:50*arkurious joined #nim
13:55:29FromDiscord<dom96> use the lightest dependency you can 🙂
14:00:52NimEventerNew thread by Jmgomez: Datetime parse format for round-trip "O", see https://forum.nim-lang.org/t/9126
14:04:04FromDiscord<d4rckh> In reply to @dom96 "if you just need": i think ill stay with prologue
14:04:33FromDiscord<d4rckh> if i have a sequence of objects, how can i modify a specific object's property? trying to update my client's properties
14:12:47FromDiscord<Yardanico> In reply to @d4rckh "if i have a": seq[idx].field = 5
14:13:34FromDiscord<d4rckh> Hmm, right, thanks
14:14:06FromDiscord<Knedlik> uhh guys can I somehow redefine a field of a type without anyone complaining?
14:14:19FromDiscord<Knedlik> Or is it just extending and I can't?
14:15:56FromDiscord<Yardanico> In reply to @Knedlik "uhh guys can I": huh?
14:17:16FromDiscord<Knedlik> sent a code paste, see https://paste.rs/WiI
14:17:47FromDiscord<Knedlik> Can I change it so that in a type inheriting `something`, the `objVar` is of a different type, let's say `int`?
14:19:37FromDiscord<Knedlik> sent a code paste, see https://paste.rs/zSl
14:20:12FromDiscord<Knedlik> (edit) "https://paste.rs/rmw" => "https://play.nim-lang.org/#ix=3Wd8"
14:23:14FromDiscord<Knedlik> I guess no now that I think about it, since it would cause problems when converting
14:46:25FromDiscord<d4rckh> the example from ws' readme is not working 🤔 ↵https://github.com/treeform/ws
14:46:35FromDiscord<d4rckh> its complaining about `connections` not being gc safe
14:47:09FromDiscord<d4rckh> `C:\nim-1.6.4\lib\pure\asyncmacro.nim(200, 31) Error: 'cbIter' is not GC-safe as it accesses 'connections' which is a global using GC'ed memoryPS`
14:50:41FromDiscord<enthus1ast> @d4rckh\: put a {.gcsafe.} on your async proc
14:51:09*rb quit (Quit: ZNC - https://znc.in)
14:51:29FromDiscord<d4rckh> I have it put, it's just like the example
14:51:29FromDiscord<enthus1ast> (and make sure that you only access connections with one thread at the same time, prolly witch locks)
14:52:18FromDiscord<enthus1ast> do you call it from somewhere ?
14:52:24*fallback quit (Ping timeout: 250 seconds)
14:52:30FromDiscord<enthus1ast> that is not gcSafe yet?
14:53:29FromDiscord<enthus1ast> i get the same message, but for me its a warning
14:53:57FromDiscord<enthus1ast> and it runs and compiles
14:55:06FromDiscord<enthus1ast> it compiles with both 1.6.4 and 1.7.1 (?) for me
14:57:57FromDiscord<d4rckh> In reply to @enthus1ast "(and make sure that": https://media.discordapp.net/attachments/371759389889003532/968163966540980294/unknown.png
14:57:59FromDiscord<d4rckh> this is my code
14:58:09*rwb joined #nim
15:00:04FromDiscord<d4rckh> not very different from the example
15:00:06FromDiscord<enthus1ast> yes the ws example
15:00:26FromDiscord<enthus1ast> which nim version do you use?
15:00:36FromDiscord<d4rckh> 1.6.4
15:02:12FromDiscord<enthus1ast> ok strange
15:02:18FromDiscord<enthus1ast> and the example as it is?
15:02:25FromDiscord<enthus1ast> same gcunsafe error?
15:02:57*fallback joined #nim
15:15:15FromDiscord<dom96> Wrap the code in a proc to get rid of the global
15:17:51FromDiscord<huantian> It still feels like it’ll give a gc error
15:35:05*jjido joined #nim
15:49:13FromDiscord<d4rckh> In reply to @enthus1ast "and the example as": the only change i made was change waitFor to asyncCheck
15:49:15FromDiscord<d4rckh> thats all
15:54:44FromDiscord<huantian> I’ve found async is weird when capturing other variables
15:55:02FromDiscord<huantian> Though actually that was just me being bad
15:55:38FromDiscord<d4rckh> `C:\nim-1.6.4\lib\pure\asyncmacro.nim(200, 31) Error: 'cbIter' is not GC-safe as it accesses 'connections' which is a global using GC'ed memory`
15:55:41FromDiscord<d4rckh> this is the error btw
16:02:34*PMunch joined #nim
16:19:08*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
16:28:49FromDiscord<SirOlaf> Is it possible to check if a generic type is passed by value
16:29:07FromDiscord<SirOlaf> So anything from int to non-ref object
16:30:22*vicfred joined #nim
16:32:41FromDiscord<Yardanico> In reply to @SirOlaf "Is it possible to": hmm, I don't think there's a builtin to do that
16:32:46FromDiscord<Yardanico> the closest would be https://nim-lang.org/docs/typetraits.html#supportsCopyMem%2Ctypedesc but it's a bit different
16:33:23FromDiscord<Yardanico> In reply to @SirOlaf "Is it possible to": also nim doesn't guarantee "pass by value" for non-ref objects in procedures
16:33:33FromDiscord<Yardanico> unless you use byref/bycopy for that object's definition
16:33:42FromDiscord<SirOlaf> Well I just mean that I can cast it to bytes without accidentally breaking the structure
16:33:57FromDiscord<SirOlaf> So anything with ref would be bad
16:35:02FromDiscord<Solitude> T: not ref
16:35:08FromDiscord<Yardanico> well I think building upon supportsCopyMem might be a good start
16:35:10FromDiscord<SirOlaf> sent a code paste, see https://paste.rs/TFm
16:35:16FromDiscord<Yardanico> In reply to @Solitude "T: not ref": what if it's a normal object that contains a ref
16:35:18FromDiscord<Yardanico> supportsCopyMem handles those cases
16:35:42FromDiscord<Solitude> epic
16:35:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WdV
16:36:07FromDiscord<Yardanico> it'll also return false for sequences and strings
16:36:20FromDiscord<Yardanico> because those also have an internal structure
16:36:25FromDiscord<Solitude> what a stupid name
16:36:56FromDiscord<Yardanico> In reply to @Solitude "what a stupid name": rather we're abusing it for another use :)
16:36:58FromDiscord<SirOlaf> That solution is perfect
16:37:18FromDiscord<SirOlaf> Needed that to avoid accidentally converting trash
16:37:20FromDiscord<SirOlaf> So thanks
16:37:22FromDiscord<Yardanico> also @SirOlaf there's a problem with supportsCopyMem
16:37:26FromDiscord<SirOlaf> Yeah?
16:37:35FromDiscord<Solitude> no, the name is stupid. you can describe the process generally, but its named after some specific usecase
16:37:37FromDiscord<Yardanico> it's made for one specific use-case so it'll also return false for normal non-ref objects that have a destructor defined
16:37:44FromDiscord<Yardanico> this is the implementation in the compiler:
16:37:48FromDiscord<Yardanico> sent a code paste, see https://paste.rs/u1o
16:38:02FromDiscord<Yardanico> it's made specifically for use in destructors
16:38:11FromDiscord<Yardanico> https://github.com/nim-lang/Nim/search?q=supportsCopyMem
16:38:18FromDiscord<Solitude> oh, its a magic
16:38:20FromDiscord<Yardanico> yes
16:38:24FromDiscord<Solitude> epic
16:39:14FromDiscord<SirOlaf> Why would I have a destructor
16:39:21FromDiscord<SirOlaf> Sounds like a non-issue
16:39:27FromDiscord<Yardanico> other code might have a destructor 🤔
16:39:41FromDiscord<Yardanico> like if you specifically want the proc to be generic so I assume it would be used by the users of your library
16:39:43FromDiscord<SirOlaf> Yeah but don't you only really need them for pointers and stuff
16:39:59FromDiscord<Yardanico> you also use destructors if you want custom semantics for your object
16:40:36FromDiscord<SirOlaf> Guess so
16:40:45FromDiscord<SirOlaf> So why supportsCopyMem does check for it
16:40:51FromDiscord<SirOlaf> (edit) "So why ... supportsCopyMem" added "does" | removed "does"
16:41:03FromDiscord<Yardanico> because, as I said, it's not made for the purpose you want :)
16:41:08FromDiscord<Yardanico> it's made to be used in destructors
16:41:20FromDiscord<SirOlaf> No I get that, but how is the object turned complex because it has a destructor
16:41:50FromDiscord<Yardanico> so you can't just blindly copy its memory without calling its sink or destroy?
16:42:27FromDiscord<SirOlaf> But that's the whole point of copying
16:42:33FromDiscord<SirOlaf> That it doesn't matter
16:42:53FromDiscord<Solitude> no one stops you
16:42:56FromDiscord<Yardanico> ehm, you can define =copy for your own object so you expect it to be called
16:43:21FromDiscord<Yardanico> but yeah i don't see other easy way without having to write a macro that has to recurse over the type definition and check each field recursively if it's a ref (or string or seq)
16:43:32FromDiscord<Yardanico> maybe there's some proc for that, but I don't remember
16:43:59FromDiscord<SirOlaf> It seems like the type of thing someone would have needed by now
16:44:15FromDiscord<Yardanico> it depends on the usecase
16:44:21FromDiscord<Yardanico> arraymancer has this
16:44:22FromDiscord<Yardanico> `KnownSupportsCopyMem = SomeNumber | char | Complex[float64] | Complex[float32] | bool`
16:44:26FromDiscord<Yardanico> and it's enough for arraymancer
16:45:04*duuude quit (Ping timeout: 250 seconds)
16:45:08FromDiscord<Yardanico> (yeah, there's also an issue related to supportsCopyMem here) https://media.discordapp.net/attachments/371759389889003532/968190934841970748/unknown.png
16:47:09FromDiscord<d4rckh> what's the easiest way to get the hostname of the computer?
16:47:48FromDiscord<Yardanico> In reply to @d4rckh "what's the easiest way": good question
16:47:53*duuude joined #nim
16:47:55FromDiscord<Solitude> https://nim-lang.org/docs/nativesockets.html#getHostname
16:47:57FromDiscord<Yardanico> if you mean the network one, then https://nim-lang.org/docs/nativesockets.html#getHostname seems to work for me at least
16:48:00FromDiscord<Yardanico> on loonix
16:48:20FromDiscord<Yardanico> ah yeah it's the one, should work on posix and windows at least
16:48:43FromDiscord<d4rckh> i was thinking using winim 🤔
16:48:53FromDiscord<Yardanico> why
16:48:56FromDiscord<Yardanico> nim stdlib isn't as small as you think
16:49:05FromDiscord<Solitude> ugh, what the hell is this shit https://github.com/nim-lang/Nim/blob/version-1-6/lib/std/private/gitutils.nim
16:49:41FromDiscord<Yardanico> In reply to @Solitude "ugh, what the hell": bad name probably again
16:49:41FromDiscord<Yardanico> https://github.com/nim-lang/Nim/search?q=diffFiles
16:50:13FromDiscord<Yardanico> ah nvm it uses git
16:50:14FromDiscord<Yardanico> lol
16:50:26FromDiscord<d4rckh> that works. thank you! @Yardanico
16:58:48FromDiscord<SirOlaf> https://github.com/disruptek/frosty this does some pretty similar stuff to what I want
16:58:52FromDiscord<SirOlaf> So yeah this is macro hell
17:03:36*jjido joined #nim
17:03:58FromDiscord<d4rckh> okay, illwill and terminal libraries conflict a bit
17:04:25FromDiscord<d4rckh> i think they both have the `fg..` `bg..` consts defined
17:04:43FromDiscord<Yardanico> that doesn't make them conflict though
17:04:59FromDiscord<Yardanico> you can always refer to symbols including the module they're coming from to disambiguate
17:05:13FromDiscord<Yardanico> `illwill.fgBlack` instead of just fgBlack
17:05:14FromDiscord<d4rckh> okay i can use `terminal.ForegroundColor.fgWhite`
17:05:15FromDiscord<Yardanico> or same for terminal
17:05:19FromDiscord<d4rckh> (edit) "okay i can use `terminal.ForegroundColor.fgWhite` ... " added "for terminal"
17:05:23FromDiscord<d4rckh> thats a bit ugly but it works ig
17:05:23FromDiscord<Yardanico> In reply to @d4rckh "okay i can use": no need for ForegroundColor here though
17:21:35*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:39:27FromDiscord<d4rckh> worked, thanks
17:40:12*duuude quit (Ping timeout: 240 seconds)
17:43:00FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Wei
17:43:22FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3Wei" => "https://play.nim-lang.org/#ix=3Wej"
17:57:11FromDiscord<demotomohiro> Dir is actually not a program just a command of cmd.exe.
17:58:35FromDiscord<demotomohiro> If I remember correctly, "cmd /k dir" would work.
17:58:36FromDiscord<d4rckh> oh, right
17:58:57FromDiscord<demotomohiro> Not /k, "cmd /c dir".
17:59:03FromDiscord<d4rckh> it dir 😄
17:59:08FromDiscord<d4rckh> (edit) "dir" => "did"
17:59:10FromDiscord<d4rckh> /k worked 🤔
17:59:18FromDiscord<d4rckh> /c didnt
17:59:27FromDiscord<d4rckh> wait, both worked
17:59:28FromDiscord<Yardanico> btw, instead of `dir` you can just use os.walkDir
17:59:45*xet7 quit (Remote host closed the connection)
17:59:48FromDiscord<Yardanico> https://nim-lang.org/docs/os.html#walkDir.i%2Cstring
18:00:04FromDiscord<choltreppe> hey there, is there any way to run a comand at compiletime? I suppose there isnt, because that is always a impure proc, but maybe I missed something
18:00:34FromDiscord<demotomohiro> There is `staticExec`.
18:00:37FromDiscord<Yardanico> yep
18:00:41FromDiscord<choltreppe> oh nice
18:01:03FromDiscord<demotomohiro> !eval echo static: staticExec("uname")
18:01:05NimBotCompile failed: /usercode/in.nim(1, 24) Error: 'staticExec' can only be used in compile-time context
18:01:22FromDiscord<Yardanico> !eval const t = staticExec("uname"); echo t
18:01:24NimBotLinux
18:01:39FromDiscord<Yardanico> In reply to @demotomohiro "!eval echo static: staticExec("uname")": nimbot doesn't output compile-time messages anyway
18:02:42FromDiscord<demotomohiro> !eval echo static staticExec("uname")
18:02:45NimBotLinux
18:02:49FromDiscord<choltreppe> thx
18:03:02FromDiscord<Yardanico> In reply to @demotomohiro "!eval echo static staticExec("uname")": no need for static here though
18:03:07*duuude joined #nim
18:03:14FromDiscord<Yardanico> oh there is, nvm
18:03:48FromDiscord<demotomohiro> In reply to @Yardanico "no need for static": `echo staticExec("uname")` is compile error.
18:03:57FromDiscord<Yardanico> In reply to @Yardanico "oh there is, nvm": ^ but yes
18:04:49FromDiscord<d4rckh> is there something similar to `await asyncdispatch.sleepAsync(100)` that waits until a function is called from another async function? for example i could do `await waitForClientResponse()` in my main async while loop and in another async while loop which listens for client response call something like `receivedResponse()` which would let the first while loop continue executing?
18:04:57FromDiscord<d4rckh> (edit) "executing?" => "executing"
18:05:25FromDiscord<Yardanico> In reply to @d4rckh "is there something similar": "waits until a function is called from another async function?" not sure what you mean here
18:05:28FromDiscord<Yardanico> maybe what you want is futures?
18:05:38FromDiscord<Yardanico> you can create an arbitrary future and wait for its completion from one async proc
18:05:42FromDiscord<Yardanico> and complete it from another async proc
18:05:43FromDiscord<Tyrone Biggums> In reply to @Yardanico ""waits until a function": wait nim has async?
18:05:46FromDiscord<Yardanico> of course?
18:05:48FromDiscord<Rika> In reply to @Tyrone Biggums "wait nim has async?": Yes?
18:05:51FromDiscord<Yardanico> https://nim-lang.org/docs/asyncdispatch.html
18:05:53FromDiscord<d4rckh> In reply to @Yardanico "you can create an": yes, something like this
18:05:58FromDiscord<Yardanico> In reply to @d4rckh "yes, something like this": yeah just use `Future`
18:05:59FromDiscord<Tyrone Biggums> i aint ever seen a language that can do that
18:06:09FromDiscord<Rika> In reply to @Tyrone Biggums "i aint ever seen": Every modern language can do this
18:06:26FromDiscord<d4rckh> In reply to @Yardanico "yeah just use `Future`": are there any examples?
18:06:27FromDiscord<Tyrone Biggums> In reply to @Rika "Every modern language can": really cuz i heard javascript gets a lot of flak for not being able to do that
18:06:35FromDiscord<Rika> In reply to @Tyrone Biggums "really cuz i heard": JavaScript has async
18:06:36FromDiscord<Rika> What
18:06:45FromDiscord<Yardanico> light trolling? 🤔
18:06:47FromDiscord<Rika> JavaScript has one of the larger async ecosystems
18:06:51FromDiscord<Tyrone Biggums> does c have asynce
18:06:52FromDiscord<Rika> In reply to @Yardanico "light trolling? 🤔": Probably not
18:06:54FromDiscord<Tyrone Biggums> (edit) "asynce" => "async"
18:07:00FromDiscord<Rika> In reply to @Tyrone Biggums "does c have async": Yes but it’s not nice
18:07:07FromDiscord<Yardanico> In reply to @d4rckh "are there any examples?": i have one example in ircord, although it's not the cleanest
18:07:09FromDiscord<Tyrone Biggums> really
18:07:12FromDiscord<Yardanico> and it's for a different purpose
18:07:13FromDiscord<Tyrone Biggums> hmm
18:07:24FromDiscord<Yardanico> https://github.com/Yardanico/ircord/blob/master/src/ircord.nim#L111-L114 @d4rckh
18:07:26FromDiscord<Rika> Of course, how else would Nim have async if C couldn’t model it
18:07:34FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/968211681132032030/unknown.png
18:07:41FromDiscord<Tyrone Biggums> In reply to @Rika "Of course, how else": cpp
18:07:44FromDiscord<Yardanico> here I am making it so that only one handleIrcCmd can execute at the same time
18:07:45FromDiscord<Yardanico> via a future
18:07:48FromDiscord<Rika> In reply to @Tyrone Biggums "cpp": Same story
18:08:04FromDiscord<Yardanico> well actually i complete it from a different place https://media.discordapp.net/attachments/371759389889003532/968211808806649976/unknown.png
18:08:07FromDiscord<Tyrone Biggums> idk cpp has ventured so far from c it might aswell be a different language
18:08:12FromDiscord<Yardanico> so it's waiting for a response from another async proc
18:08:14FromDiscord<Yardanico> via a future
18:08:27FromDiscord<Yardanico> and this way you can share data between async procedures as well
18:08:36FromDiscord<d4rckh> should ircAccResp be global?
18:08:50FromDiscord<Rika> In reply to @Tyrone Biggums "idk cpp has ventured": I don’t see what stops it from having async though
18:08:55FromDiscord<Yardanico> well it doesn't have to be global, you can instead pass it around in your async procs
18:08:57FromDiscord<Yardanico> because Future is a ref
18:09:01FromDiscord<Rika> Well this is a digression so
18:10:48FromDiscord<d4rckh> how should i define that? something like this doesnt work `var clResp: Future`
18:10:57FromDiscord<Yardanico> Future[void]
18:11:09FromDiscord<Yardanico> or Future[bool] if you want to check for success/failure of something
18:11:12FromDiscord<d4rckh> oh thanks
18:11:15FromDiscord<Yardanico> you can create a future of any type
18:11:23FromDiscord<Tyrone Wiggums> so should i learn nim?
18:11:40FromDiscord<2F42BBA1> In reply to @Tyrone Wiggums "so should i learn": depends on your goals
18:11:42FromDiscord<d4rckh> In reply to @Tyrone Wiggums "so should i learn": maybe try javascript first
18:11:44FromDiscord<2F42BBA1> i use rust and nim
18:11:55FromDiscord<Tyrone Wiggums> In reply to @d4rckh "maybe try javascript first": i used its dad, java
18:12:06FromDiscord<Tyrone Wiggums> used a bit of c and like ruby
18:12:24FromDiscord<Yardanico> In reply to @Tyrone Wiggums "i used its dad,": good joke, but old
18:13:33FromDiscord<d4rckh> wow thanks @Yardanico!!
18:13:34FromDiscord<d4rckh> it worked
18:14:05FromDiscord<d4rckh> `Error: unhandled exception: An attempt was made to complete a Future more than once. Details:`
18:14:10FromDiscord<d4rckh> what should i do after i complete it?
18:14:35FromDiscord<Yardanico> not sure, if you want to reuse it you can set it to a new one again
18:14:56FromDiscord<d4rckh> ill just set it to nil
18:15:05FromDiscord<Yardanico> well you can't complete a `nil` future
18:15:24FromDiscord<Yardanico> so maybe then check if it was already completed, although I don't know how your code is structured
18:15:30FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WeC
18:15:31FromDiscord<d4rckh> i just do this
18:15:34FromDiscord<d4rckh> similarly to how you did it
18:15:41FromDiscord<Yardanico> ah okay
18:15:46FromDiscord<Yardanico> if that works for you it's fine :)
18:15:58FromDiscord<Yardanico> ah @d4rckh there's a better way apparently
18:15:59FromDiscord<Yardanico> `clean`
18:16:06FromDiscord<Yardanico> just do `clResp.clean()` and then await it
18:16:18FromDiscord<Yardanico> err, sorry, that's for FutureVar
18:18:03FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WeD
18:18:09FromDiscord<Yardanico> In reply to @2F42BBA1 "i have a simple": can't help without code
18:18:15FromDiscord<Yardanico> you have a syntax error
18:18:16FromDiscord<2F42BBA1> hold on
18:18:19FromDiscord<2F42BBA1> let me find it
18:18:21FromDiscord<d4rckh> In reply to @Yardanico "err, sorry, that's for": haha np
18:18:31FromDiscord<Yardanico> In reply to @2F42BBA1 "let me find it": just port the part of the code where it errors
18:19:33FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WeE
18:19:39FromDiscord<Rika> True is lowercase in Nim
18:19:42FromDiscord<Yardanico> that's not how you define procedures in nim
18:19:45FromDiscord<Rika> Also yeah
18:19:48FromDiscord<Yardanico> `proc trolleybus(msg, webhook) = `
18:19:53FromDiscord<2F42BBA1> FUCK
18:19:59FromDiscord<2F42BBA1> I forgot about that
18:19:59FromDiscord<Rika> Misspelled except as expect
18:20:03FromDiscord<Yardanico> xd
18:20:09FromDiscord<ynfle> You need the types of the parameters also
18:20:33FromDiscord<Yardanico> that too
18:20:36FromDiscord<Yardanico> Nim is not Python
18:20:39FromDiscord<Yardanico> :)
18:21:05FromDiscord<Tyrone Wiggums> In reply to @Yardanico "Nim is not Python": this truly is an interesting development
18:21:07FromDiscord<Yardanico> yes
18:21:12FromDiscord<2F42BBA1> In reply to @Rika "Misspelled except as expect": I used nano while writing that xD
18:21:24FromDiscord<Yardanico> well, that doesn't really matter though
18:21:25FromDiscord<ynfle> In reply to @2F42BBA1 "I used nano while": Sorry to hear that
18:21:31FromDiscord<Yardanico> I doubt anyone has a spell checker in their code editor
18:21:43FromDiscord<Yardanico> instead people use syntax checkers
18:21:54FromDiscord<ynfle> In reply to @Yardanico "I doubt anyone has": I have one in VSCode, but I usually use vim
18:21:56FromDiscord<Tyrone Wiggums> In reply to @Yardanico "I doubt anyone has": is that a bad thjing
18:22:01FromDiscord<Yardanico> just not usual
18:22:01FromDiscord<Rika> In reply to @Yardanico "I doubt anyone has": I would have one if I wasn’t lazy
18:24:30FromDiscord<Tyrone Wiggums> the weird thing is
18:24:40FromDiscord<Tyrone Wiggums> i have a spell checker but no syntax checker
18:28:26FromDiscord<Yardanico> @2F42BBA1 generally there's a very useful command to check for syntax errors if your editor doesn't do that
18:28:28FromDiscord<Yardanico> `nim check file.nim`
18:28:41FromDiscord<Yardanico> it doesn't stop on the first error unlike the compiler
18:29:55FromDiscord<0000> i farded
18:32:13FromDiscord<0000> https://tenor.com/view/tang916-happy-easter-easter-bunny-dancing-dancing-bunny-gif-25366607
18:32:17FromDiscord<0000> embed fail
18:34:15*jjido joined #nim
18:37:11FromDiscord<d4rckh> okay, if i made my future local (passed using an argument in my proc), how can i reset it? @Yardanico
18:37:33FromDiscord<d4rckh> wait, if i define it as `clResp: var Future[void]` will it work?
18:38:10FromDiscord<d4rckh> negative
18:38:10FromDiscord<Yardanico> no, you can't pass `var` to async procs
18:38:24FromDiscord<d4rckh> what can i do about it then?
18:39:21FromDiscord<choltreppe> Can someone explain why this works:
18:39:56FromDiscord<Yardanico> @choltreppe deleting is generally useless, as this chat is relayed to IRC where messages don't get deleted
18:40:04FromDiscord<Yardanico> just fyi :)
18:40:19FromDiscord<Yardanico> In reply to @d4rckh "what can i do": not really sure
18:40:30FromDiscord<d4rckh> A pointer or something?
18:40:38FromDiscord<Yardanico> one way would be to cast it to the internal future type and "clean" it, but that's a slight hack
18:40:52FromDiscord<Yardanico> or cast it to FutureVar and clean
18:41:08FromDiscord<d4rckh> I want to pass it via an argument to my proc so i can have that huge proc in a different file
18:41:49FromDiscord<Yardanico> sent a code paste, see https://paste.rs/LLa
18:42:15FromDiscord<Yardanico> ah nvm it doesn't
18:42:22FromDiscord<Yardanico> or does it
18:43:11FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WeL
18:43:27FromDiscord<2F42BBA1> i am pretty sure i fucked up somewhere
18:43:49FromDiscord<Yardanico> because you're using readLine right after your first echo?
18:44:01FromDiscord<Yardanico> that's not how you use readLine
18:44:17FromDiscord<2F42BBA1> Then how do I use it properly for this?
18:45:00FromDiscord<Yardanico> and please don't use `fmt` and parenthesis for `echo` where you don't need to
18:45:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WeN
18:45:29FromDiscord<Yardanico> stdout.write doesn't output a newline so the thing user inputs is displayed right after the colon with a space
18:45:58FromDiscord<Yardanico> `fmt` in Nim is only needed for string interpolation, if you just have a normal string you don't need it
18:46:09FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WeQ
18:46:31FromDiscord<Yardanico> well you can actually make it a ref Future
18:46:37FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WeR
18:46:38FromDiscord<Yardanico> In reply to @2F42BBA1 "Thanks works as intended": huh?
18:46:38FromDiscord<2F42BBA1> 👍
18:46:47FromDiscord<Yardanico> you only need to change to `var` if you plan on modifying the value later
18:47:01FromDiscord<2F42BBA1> In reply to @Yardanico "you only need to": i meant the var's name
18:47:03FromDiscord<Yardanico> In reply to @Yardanico "well you can actually": it'll just be double pointer indirection, so not that pretty
18:47:18FromDiscord<2F42BBA1> because in my proc i specified it will read msg and webhook vars
18:47:43FromDiscord<d4rckh> In reply to @Yardanico "well you can actually": ref Future?
18:48:03FromDiscord<d4rckh> oh
18:48:03FromDiscord<Yardanico> yes
18:48:04FromDiscord<d4rckh> okay
18:49:26FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WeT
18:49:28FromDiscord<Yardanico> but again, this is a bit ugly
18:50:08*duuude quit (Ping timeout: 260 seconds)
18:51:12FromDiscord<d4rckh> weird syntax but it works
18:51:17FromDiscord<d4rckh> (edit) removed "but it works"
18:51:29FromDiscord<Yardanico> `[]` is a dereferencing operator in Nim
18:51:39FromDiscord<d4rckh> and it works 😄
18:52:35FromDiscord<Yardanico> actually there's a much simpler way without double indirection or futures, you just make a normal `ref int` or `ref bool` and just pass that around and change it
18:55:38FromDiscord<Yardanico> but then you can have races between completing the future and modifying it in the async proc
18:55:42FromDiscord<Yardanico> even with the simple ref bool approach
18:58:34FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WeW
18:58:48FromDiscord<Yardanico> this is what I mean, but if you have big enough intervals before making the future "complete" again then it'll work
18:59:08FromDiscord<Yardanico> without the `await sleepAsync(10)` call in the main proc waitAndLoop will forever wait for second `await`
18:59:43FromDiscord<Yardanico> @d4rckh ^ idk if you prefer this approach to futures
18:59:48FromDiscord<Yardanico> but at least this has less overhead :P
19:06:12FromDiscord<2F42BBA1> what nim doesn't like here....↵`Error: expression 'trolleybus(msg, webhook)' is of type 'Future[system.void]' and has to be used (or discarded)`
19:06:35FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WeY
19:06:41FromDiscord<Yardanico> because if it's an async proc, you need to `await` it
19:06:49FromDiscord<Yardanico> or `waitFor` or `asyncCheck`, but in your case `await`
19:06:57FromDiscord<Yardanico> https://nim-lang.org/docs/asyncdispatch.html read some async docs there
19:07:09FromDiscord<2F42BBA1> well async check worked for me
19:07:12FromDiscord<2F42BBA1> await one didn't
19:07:18FromDiscord<Yardanico> and this https://peterme.net/asynchronous-programming-in-nim.html
19:07:19FromDiscord<2F42BBA1> proc is already asynced
19:07:29FromDiscord<Yardanico> In reply to @2F42BBA1 "await one didn't": you should make your main proc async as weell then
19:07:39FromDiscord<2F42BBA1> `proc trolleybus(msg: string, webhook: string) {.async.} =`
19:07:42FromDiscord<2F42BBA1> well it is already
19:07:43FromDiscord<Yardanico> yes
19:07:48FromDiscord<Yardanico> but I meant the main proc
19:07:52FromDiscord<Yardanico> the one that calls trolleybus
19:07:56FromDiscord<Yardanico> it needs to be `async` as well
19:08:08FromDiscord<2F42BBA1> okie
19:08:16FromDiscord<2F42BBA1> 🚎
19:08:45FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wf0
19:09:20FromDiscord<2F42BBA1> finally
19:09:26FromDiscord<2F42BBA1> i made my first nim thing
19:09:38FromDiscord<2F42BBA1> hooray
19:11:09FromDiscord<Tyrone Wiggums> In reply to @2F42BBA1 "i made my first": Nice!
19:16:06FromDiscord<choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=3Wf3
19:18:01FromDiscord<Tyrone Wiggums> Why is nim used for servers so much
19:18:23*duuude joined #nim
19:19:09FromDiscord<Tyrone Wiggums> I've seen 2 ppl with servers and clients in their code
19:19:36FromDiscord<choltreppe> I dont know I like nim and wanted to do that 🤷‍♂️
19:20:07FromDiscord<Tyrone Wiggums> thats 2 more pppl than i have friends
19:20:08FromDiscord<Tyrone Wiggums> :(
19:20:34FromDiscord<choltreppe> 😂
19:20:58FromDiscord<Tyrone Wiggums> sorry i was one off
19:21:01FromDiscord<Tyrone Wiggums> 3 more people than i have friends
19:21:25FromDiscord<Tyrone Wiggums> that moment when you have -1 friends
19:23:11PMunch@choltreppe, wild guess is that Nim doesn't wait for staticExec to complete
19:23:51PMunchTry to store the result of the `nim js` compilation in a const as well and print that out, maybe Nim will wait if it figures you wanted the result..
19:24:21PMunch@Tyrone_Biggums, fast but still expressive language
19:24:38PMunchTends to draw in people who wants to do stuff that requires speed, or who just wants to write nice code
19:24:49FromDiscord<Yardanico> In reply to @choltreppe "does someone know why": btw, any reason you overcomplicated this instead of just using a block of code? lemme show
19:24:50FromDiscord<Tyrone Wiggums> java code is nice
19:25:01PMunch@Tyrone_Biggums, to each their own I guess
19:25:09FromDiscord<Tyrone Wiggums> even better asm code
19:25:28FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wf7
19:25:29PMunchSomeone likes dripping molten wax into their eyes, someone likes to program in Java, I'm not going to tell people what to do
19:25:36FromDiscord<Yardanico> won't this work for you? @choltreppe
19:25:52FromDiscord<choltreppe> ah yes that looks cleaner
19:26:00FromDiscord<Tyrone Wiggums> In reply to @PMunch "Someone likes dripping molten": dont compare programming in java and dripping motel wax into your eyes
19:26:16FromDiscord<Tyrone Wiggums> you dont want it with james gosling
19:26:22FromDiscord<Tyrone Wiggums> ask nas, he dont want it with james gosling
19:26:50FromDiscord<choltreppe> fortunatly does work
19:26:57FromDiscord<Tyrone Wiggums> In reply to @choltreppe "fortunatly does work": fortunetly
19:27:05FromDiscord<choltreppe> what pmunch sugested
19:27:21FromDiscord<choltreppe> dont understand how to reply propery
19:27:38FromDiscord<choltreppe> (edit) "fortunatly does" => "fortunetly doesnt"
19:27:48PMunch@choltreppe good to know
19:28:04PMunch@Tyrone_Biggums, I'm half kidding, Java isn't half bad. Lot's of boilerplate though
19:28:54FromDiscord<choltreppe> but why would nim just not wait for execution anyways?
19:29:08FromDiscord<Tyrone Wiggums> In reply to @PMunch "@Tyrone_Biggums, I'm half kidding,": i mean james gosling did say he wanted to create a boilerplate driven programming language for microsystems
19:29:41PMunch@choltreppe, if you don't actually want the results of the execution why would it?
19:30:07PMunchI mean in this case it means you have to not discard output, in other cases it means the compiler is faster
19:30:46PMunch@Tyrone_Biggums, boilerplate-driven? Now that's a concept I've never heard of
19:30:56FromDiscord<Tyrone Wiggums> its what james gosling wanted
19:31:00PMunchWhy on earth would you want that? Is James sponsored by big-RSI
19:31:05FromDiscord<Tyrone Wiggums> no
19:31:07FromDiscord<Tyrone Wiggums> he just
19:31:12FromDiscord<Tyrone Wiggums> really likes boilerplate
19:31:15FromDiscord<Tyrone Wiggums> i mean i understand it
19:31:20FromDiscord<Tyrone Wiggums> boilerplate is downtime
19:31:29FromDiscord<Tyrone Wiggums> where you dont have to think too much about errors
19:35:06*jmdaemon joined #nim
19:57:02PMunchI like programming, I don't like writing code
19:58:52FromDiscord<choltreppe> 🙌 it works now. I dont realy know why. I tried out a bunch of stuff and am now back to pretty much what I started with but it works. thanks for the help anyways
20:00:49FromDiscord<Prestige> In reply to @PMunch "I like programming, I": True that
20:01:01FromDiscord<Tyrone Wiggums> In reply to @PMunch "I like programming, I": :(
20:01:24*Zectbumo joined #nim
20:05:07FromDiscord<Prestige> Do we have a system where I could pay one of the devs to fix an issue I've opened with nimsuggest?
20:05:43PMunchBountysource?
20:05:52PMunchOr whatever the thing is called
20:05:58PMunchWhat's the issue?
20:06:11FromDiscord<Prestige> https://github.com/nim-lang/Nim/issues/19371
20:07:06PMunchHmm
20:07:33FromDiscord<Prestige> Just made the editor experience much worse for me since 1.6
20:08:12FromDiscord<Tyrone Wiggums> In reply to @Avahe "Just made the editor": so sad
20:08:17FromDiscord<Prestige> Fingers crossed IC brings stable/good editing support
20:14:06FromDiscord<Elegantbeef> @Prestige\: not ideal but you can use that one bodge fix I had to build nimsuggest
20:14:32FromDiscord<Elegantbeef> Where we make a `==` that compares if the ids of `PType`/`PSym` aswell as pointers
20:20:11nrds<Prestige99> Would that potentially break other things?
20:20:14NimEventerNew thread by Krakengore: Introspection over a proc type, see https://forum.nim-lang.org/t/9127
20:22:24FromDiscord<Elegantbeef> No prestige it should just work
20:22:31FromDiscord<Elegantbeef> It'll slow it down slightly but it'll work
20:23:17FromDiscord<Elegantbeef> Negligibly slow it down only an extra int comparison
20:23:29FromDiscord<Elegantbeef> It's just a bodge though and doesnt resolve the actual issue which is why there is no PR for it
20:23:32nrds<Prestige99> tbh I think it should just be accepted and merged till a "proper" fix is added
20:23:42nrds<Prestige99> since they broke it
20:23:46FromDiscord<Elegantbeef> Feel free to PR it
20:25:43FromDiscord<Elegantbeef> I think it shouldnt break anything just add some tests and PR it if you want it PR'd
20:26:26nrds<Prestige99> I'm just going to comment on your PR my recommendation to merge
20:27:22*Zectbumo quit (Remote host closed the connection)
20:28:08FromDiscord<Elegantbeef> That PR doesnt have the proper fix iirc
20:28:57FromDiscord<Elegantbeef> Yea that PR doesnt have the `==` operator override i just documented it
20:29:30FromDiscord<Elegantbeef> I'll look at it again today
20:29:54nrds<Prestige99> Tyvm
20:31:21FromDiscord<Elegantbeef> It's just an odd bug that for some reason old types/symbols arent being reused, it's probably due to IC comically enough
20:41:33*vicfred quit (Quit: Leaving)
20:50:45PMunchOh hi @Elegantbeef, did you see the message I sent you earlier?
20:51:22PMunchWell, not sent you, but tagged you in
20:54:24FromDiscord<Elegantbeef> nope
20:54:47PMunchhttps://irclogs.nim-lang.org/25-04-2022.html#12:35:37
20:59:25FromDiscord<clippy_droid> what would `isinstance()` from python look like in nim
21:00:20PMunchWell it would probably be `isInstance()`
21:00:51FromDiscord<clippy_droid> no like i need its implementation
21:01:02PMunchI figured, just messing with you
21:01:12PMunch`typeof(x) == int`
21:01:33FromDiscord<clippy_droid> 👍
21:02:18PMunchOh sorry it has be is
21:02:21*kayabaNerve_ quit (Ping timeout: 276 seconds)
21:02:39PMunch!eval echo typeof(5) is int
21:02:42NimBottrue
21:04:24FromDiscord<clippy_droid> oh
21:04:40FromDiscord<clippy_droid> also how do i turn a string into a byte string
21:05:01PMunchDefine byte string
21:05:07PMunchAll strings are made up of bytes
21:05:21PMunchIn fact, everything on your computer is made up of bytes
21:05:51PMunchWell, there might be some loose bits hanging around, but typically you don't have to worry about those
21:05:59FromDiscord<clippy_droid> ok so `"hello"` should become `b"hello"` in python
21:06:22FromDiscord<Rika> the concept doesnt exist in nim
21:06:29PMunch!eval echo "b\" & "my string" & "\""
21:06:31NimBotCompile failed: /usercode/in.nim(1, 14) Error: undeclared identifier: 'my'
21:06:43PMunch!eval echo "b\"" & "my string" & "\""
21:06:45NimBotb"my string"
21:06:53PMunchThere you go
21:06:59FromDiscord<Rika> thats not what he means
21:07:06PMunchI know :P
21:07:24FromDiscord<Rika> damn bro you got the whole room laughing
21:07:24FromDiscord<clippy_droid> In reply to @Rika "the concept doesnt exist": ah damn
21:07:27PMunchI'm just trying to tease them into being more precise in their questions
21:07:59FromDiscord<Rika> wow its working so well
21:08:06*nsyd joined #nim
21:08:29PMunchWell saying that Nim doesn't have byte strings is a bit incorrect, it's more like every string in Nim is a byte string
21:08:41PMunchNim doesn't have an abstract non-byte-related string concept
21:10:08PMunch@clippy_droid, what do you think you need a byte string for?
21:10:39FromDiscord<Rika> thats what i meant by the concept
21:10:56FromDiscord<Rika> im just a bit busy to word
21:10:57FromDiscord<Rika> (edit) "im just a bit busy to word ... " added "it"
21:11:10*Gustavo6046 joined #nim
21:12:20*Gustavo6046 quit (Remote host closed the connection)
21:12:46*Gustavo6046 joined #nim
21:14:07FromDiscord<sheerluck> In reply to @PMunch "@clippy_droid, what do you": to get `b'\xe3\x82\x8a\xe3\x81\x8b'` out of `"りか".encode("utf-8")`
21:14:35PMunchBut that's just "りか" in Nim isn't it?
21:15:50FromDiscord<sheerluck> okay I have to go to sleep bye
21:15:52PMunch!eval import strutils; let x = "りか"; echo x.toHex
21:15:56NimBotE3828AE3818B
21:16:03PMunchEh, same
21:16:26PMunchI was just waiting around to see if @Elegantbeef would comment on my little project, but apparently not :(
21:17:01*PMunch quit (Quit: leaving)
21:19:30FromDiscord<dom96> I can comment
21:19:34FromDiscord<dom96> just tell me what it is
21:24:07nrds<Prestige99> Want to comment on my nimsuggest issue dom96? :P
21:28:30FromDiscord<!Patitotective> In reply to @PMunch "But that's just "りか"": リカ 💀
21:30:40FromDiscord<Elegantbeef> Eh sorry pmunch went for a dog walk
21:34:40FromDiscord<Elegantbeef> Anyway pmunch i stand by the "would be nice if we could do this without annotations" 😄
21:35:36FromDiscord<dom96> Prestige: I can comment on anything you like
21:36:22FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pull/19624#issuecomment-1109008668 this PR is what he wants commented on
21:36:29FromDiscord<Elegantbeef> Not much the PR but the "Hey fix the nimsuggest"
21:36:53*greaser|q quit (Changing host)
21:36:53*greaser|q joined #nim
21:37:04FromDiscord<Elegantbeef> There is what i'd consider a showstopper wiht nimsuggest in that it thinks some code is error ridden but is not
21:37:09*greaser|q is now known as GreaseMonkey
21:37:22FromDiscord<Elegantbeef> Which ruins nimlsp and nimsuggest's check
21:40:39FromDiscord<Elegantbeef> I've looked into it prior but have not found the culprit, it's very much some phantom pointers being made
21:57:37*vicfred joined #nim
21:59:21*Zectbumo joined #nim
22:03:26*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:04:10*kayabaNerve joined #nim
22:04:26FromDiscord<SirOlaf> I got a related question, why does my nimsuggest.log contain thousands of `internal error: D:\a\nightlies\nightlies\nim-1.7.1\compiler\vmgen.nim(1653, 23)`
22:05:27FromDiscord<Rika> That means what it means, the compiler had an internal error
22:05:27FromDiscord<Elegantbeef> Probably cause an optimization caused a crash in vmgen
22:06:40FromDiscord<SirOlaf> Well it's not good, I think it's related to my install of the nimsaem extension being painfully slow
22:10:22nrds<Prestige99> probably. nimsuggest bogs down my whole computer
22:10:26nrds<Prestige99> so I have it turned off now
22:20:08FromDiscord<SirOlaf> Yeah so I'm gonna need to figure out why this error happens
22:20:14FromDiscord<SirOlaf> Extension works perfectly until that appears
22:22:22FromDiscord<ynfle> You can try nimlsp
22:22:49FromDiscord<ynfle> I use it with vim. It works well except for goto definition, but that could be my config's fault
22:24:00nrds<Prestige99> I'm using it with neovim, but have issues with nimsuggest there as well
22:24:12nrds<Prestige99> so actually I'm no longer using nimlsp for that reason
22:37:45FromDiscord<Elegantbeef> Yea the issue effects nimsuggest which is what nimlsp uses so by extension it effects "all" tooling
22:37:55FromDiscord<SirOlaf> Turns out commenting that line makes it better to some extent but it also gives wrong output
22:37:55FromDiscord<Elegantbeef> Think the vscode extension by default uses `nim check`
22:38:19FromDiscord<SirOlaf> But much more usable even with that wrong output
22:47:21FromDiscord<SirOlaf> What are the odds of this commit having caused damage https://github.com/nim-lang/Nim/commit/a9ae5fe5be783c7b7923f377b0cf7d4abc806e81
22:48:08FromDiscord<Elegantbeef> Dont think it should since it just grows it
22:48:44FromDiscord<SirOlaf> Well something must have broken at some point
22:48:49FromDiscord<SirOlaf> This is a pretty good candidate
22:49:27FromDiscord<Elegantbeef> Git bisect
22:49:27FromDiscord<Elegantbeef> Though it's' tedious to do if it's between 1.4 and 1.6
22:51:20FromDiscord<SirOlaf> Would probably die of old age by the time I find it that way, but you're probably right
22:51:47FromDiscord<Elegantbeef> Well you can test the commit before of course
22:52:35FromDiscord<Tyrone Wiggums> can you embed nim in other apps
22:52:57FromDiscord<huantian> Define other apps
22:53:00FromDiscord<Elegantbeef> You mean the VM or the compiled program?
22:53:08FromDiscord<Tyrone Wiggums> the VM
22:53:12FromDiscord<Elegantbeef> You can make system libraries, and you can embed the VM
22:53:13FromDiscord<Tyrone Wiggums> i want to be able to execute nim code
22:53:20FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter
22:53:22FromDiscord<Tyrone Wiggums> withinside another app
22:57:38FromDiscord<Elegantbeef> Remember that nimscript is a subset of Nim so it may not be capable of what you want to do, and my bridge doesnt handle reference/mutable code presently
23:28:30FromDiscord<Elegantbeef> Prestige you about?
23:30:40nrds<Prestige99> Yeah
23:30:47nrds<Prestige99> What's up Elegantbeef
23:31:01FromDiscord<Elegantbeef> Eh i forgot the second issue, but remembered it after pinging
23:31:08nrds<Prestige99> oh ok
23:31:10FromDiscord<Elegantbeef> Going to make the PR for you to pester people about 😛
23:31:16nrds<Prestige99> I love you
23:31:36nrds<Prestige99> side question, can we use `collect` to create an array at compile time? instead of a seq
23:31:58FromDiscord<Elegantbeef> I'd use collect then an `unpack` macro that converts it to an array
23:32:04FromDiscord<Elegantbeef> You can in theory use any collection iirc
23:33:24FromDiscord<Elegantbeef> that macro of course doesnt exist 😄
23:34:35FromDiscord<huantian> I mean it can't be that hardd
23:34:37nrds<Prestige99> hmm okay
23:34:43FromDiscord<Elegantbeef> To do what?
23:35:02nrds<Prestige99> I actually need a seq now that I think about it, so it's fine
23:35:04FromDiscord<huantian> to make the macro that odesn't exist
23:35:11FromDiscord<Elegantbeef> Ah
23:43:02FromDiscord<Elegantbeef> There you go presetige
23:59:07*nsyd quit (Ping timeout: 240 seconds)