<< 26-04-2022 >>

00:02:04nrds<Prestige99> Should be merged and backported imo
00:05:09FromDiscord<Elegantbeef> Yea no clue i just pretend to fix things
00:11:39*duuude quit (Ping timeout: 260 seconds)
00:16:24*xet7 joined #nim
00:22:12*nsyd joined #nim
00:27:54*nsyd left #nim (WeeChat 3.5)
00:29:29*fowl1 joined #nim
00:29:59*fowl quit (Ping timeout: 246 seconds)
00:29:59*fowl1 is now known as fowl
00:30:21FromDiscord<SirOlaf> If I did this bisect right then this commit is evil https://github.com/nim-lang/Nim/commit/8e474fbb57c2f7b58a840b5b30230c2267633c8e
00:30:34FromDiscord<SirOlaf> Which is odd
00:44:04*duuude joined #nim
00:47:31FromDiscord<SirOlaf> Probably wrong though, hard to tell when the issue actually happens
01:08:27*vicfred quit (Quit: Leaving)
01:15:24*duuude quit (Ping timeout: 240 seconds)
02:27:08FromDiscord<xflywind> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/pull/19624#issuecom": @ElegantBeef, I don't know how to reproduce the issue (#19371). What am I missing?
02:27:44FromDiscord<Elegantbeef> Copy the code to a `.nim` file use `nimsuggest ./myfile.nim` and then `chk 1`
02:29:01FromDiscord<xflywind> I see, thanks. The command works.
02:29:13FromDiscord<Elegantbeef> It produces a false positive error
02:30:05FromDiscord<xflywind> yeah
02:30:07FromDiscord<Elegantbeef> Can i see your terminal output and nim version?
02:30:50FromDiscord<xflywind> I mean you are right 😂
02:30:51FromDiscord<Elegantbeef> Rather nim suggest version
02:30:57FromDiscord<Elegantbeef> Oh
02:31:07FromDiscord<Elegantbeef> Thought you meant "The command works" as in "No issue"
02:31:13FromDiscord<Elegantbeef> Disregard that request them
02:33:01FromDiscord<Elegantbeef> If unclear the issue is cause nimsuggest creates multiple types/syms and as such the pointers are different which means we need the `id` check
02:33:35FromDiscord<xflywind> ok
02:43:15*arkurious quit (Quit: Leaving)
04:10:42*rockcavera quit (Remote host closed the connection)
04:24:50*slowButPresent quit (Quit: leaving)
05:17:10FromDiscord<charlie3> In reply to @creikey "I misread the info": hi
05:18:46FromDiscord<lemon2> In reply to @creikey "I misread the info": hi
05:18:53FromDiscord<charlie3> In reply to @creikey "how does arc process": hello?
05:19:02FromDiscord<lemon2> In reply to @creikey "how does arc process": baen
05:19:08FromDiscord<charlie3> In reply to @creikey "this is how I": ho ho ho
05:19:30FromDiscord<lemon2> In reply to @creikey "this is how I": noauh
05:19:36FromDiscord<charlie3> In reply to @creikey "I want to know": he he ho
05:20:14FromDiscord<lemon2> In reply to @creikey "I want to know": ha ha hooo
05:20:26FromDiscord<charlie3> whats not that long đŸ€”
05:20:35FromDiscord<charlie3> In reply to @creikey "it's actually not that": whats not that long đŸ€”
05:20:50FromDiscord<lemon2> In reply to @charlie3 "whats not that long": i think hes talking about his file size
05:20:56FromDiscord<charlie3> In reply to @lemon2 "i think hes talking": whats a file
05:21:09FromDiscord<lemon2> its ok cameron they go after the men who split them up
05:21:27FromDiscord<charlie3> In reply to @creikey "I'm almost halfway through": cameron the type of mf to play github
05:21:48FromDiscord<lemon2> In reply to @charlie3 "cameron the type of": bro smokin that double pack
05:21:54FromDiscord<charlie3> In reply to @lemon2 "bro smokin that double": double pump shotgun
05:22:31FromDiscord<lemon2> In reply to @charlie3 "double pump shotgun": anyways i prefer to use nano instead of vim
05:22:52FromDiscord<charlie3> In reply to @lemon2 "anyways i prefer to": most smartest regex user
05:23:01FromDiscord<charlie3> (edit) "user" => "memoriser"
05:23:41FromDiscord<lemon2> weakest nim user vs strongest javascript user
05:24:15FromDiscord<charlie3> weakest gdscript user vs strongest nim user
05:25:07FromDiscord<lemon2> weakest php user vs strongest react user
05:25:08FromDiscord<charlie3> In reply to @creikey "it's harder to write": no oen asekd
05:26:05FromDiscord<charlie3> In reply to @lemon2 "weakest php user vs": weakest html user vs strongest assembly user
05:27:00FromDiscord<lemon2> weakest hexadecimal coder vs strongest lua user
05:28:13FromDiscord<charlie3> weakest air breather vs strongest water sucker
05:28:25FromDiscord<lemon2> SGHUT THE FUCK UP CHARLIE
05:28:45FromDiscord<charlie3> YOU SHUT THE FUCK UOP LEMONFACE GRAPH HEADASS
05:28:54FromDiscord<charlie3> baen
05:28:59FromDiscord<lemon2> ha ha hoo
05:29:05FromDiscord<charlie3> ho ho hop
05:30:03FromDiscord<lemon2> stop typing
05:30:05FromDiscord<charlie3> In reply to @creikey "most java programs I": mf called minecraft bad 💀 x10^7
05:30:13FromDiscord<charlie3> bvaen
05:30:17FromDiscord<lemon2> In reply to @creikey "most java programs I": CAMERON WHAT ARE YOU DOING
05:30:27FromDiscord<charlie3> In reply to @creikey "I mean of course": this is false
05:30:37FromDiscord<lemon2> weakest css user vs strongest c# user
05:30:54FromDiscord<charlie3> In reply to @creikey "except lua": average roblox alangaguge
05:38:17*Perryman joined #nim
05:40:54*vicfred joined #nim
05:45:19*vicfred quit (Ping timeout: 256 seconds)
06:10:03Perrymano/ I was wondering if nimble has a way to add required dependencies to <projectname>.nimble ? Or some other process to automatically/semiautomatically do that
06:12:50FromDiscord<pmunch> Yeah I agree, but apart from extreme hacks I'm not sure if it can be done
06:14:05FromDiscord<pmunch> Git autobisect is your friend
06:14:29FromDiscord<Elegantbeef> I mean you cant compile the compiler at some point between 1.4 and 1.6 without having the proper setup compiler
06:14:48FromDiscord<Elegantbeef> And i've been too lazy to do that
06:18:22*PMunch joined #nim
06:18:31*jjido joined #nim
06:19:15PMunchAh yeah that's annoying. I had a script once which built Nim from C sources, ran a small test, and returned the proper error codes for git bisect to work
06:19:36PMunchWe really should've had something like that in the repo
06:27:01FromDiscord<Rika> In reply to @Perryman "o/ I was wondering": What do you mean?
06:27:07PMunchHmm, I can't think of a way to do this without annotations @Elegantbeef. I mean Nim doesn't have any mechanism to get a list of procedures which returns a type or anything like that. You can't really get code outside your own blocks.. I mean it's easy to extend to a block syntax so you don't have to attach the pragma everywhere
06:27:20FromDiscord<Rika> Like importing something in your code then nimble resolving the package? No
06:27:44PMunchBut short of big hacks like reading the file statically and parsing it again in a macro I don't really know how I'd do it..
06:28:09FromDiscord<Elegantbeef> Yea you cannot do it that way, i can only think of doing it with an interface of a fixed name and then do a bunch of when statements
06:28:51PMunchYeah that would potentially work, but you might end up needing quite a lot of when statements
06:32:02FromDiscord<Perryman> In reply to @Rika "Like importing something in": yeah, this is what I was thinking
06:33:33FromDiscord<Rika> No I don’t think it exists
06:33:44FromDiscord<Rika> Package name and module name aren’t correlated so
06:33:51FromDiscord<Perryman> ohhh
06:34:55PMunchI guess it could look through installed packages and just file search for the module
06:35:07FromDiscord<Rika> Would be slow I’d assume
06:35:14FromDiscord<Perryman> nim just does it
06:35:41FromDiscord<Perryman> like if I use nim to compile it it doesn't care that it has a dependency
06:35:53PMunchI'm not sure what you're using this for, but if it's just like a "fix my imports"-kind of editor feature then it should be fast enough
06:36:02FromDiscord<Rika> I guess
06:36:09FromDiscord<Perryman> In reply to @PMunch "I'm not sure what": yeah, i don't know if this belongs in vscode or nimble
06:36:16PMunchWell Nim sets the nimble directory by default
06:36:38PMunchWhen you use nimble it unsets the nimble directory and passes paths to the imported packages explicitly
06:37:00PMunchI guess you could set the import path back, but that kind of breaks the concept behind making a package out of it
06:37:25PMunchNimble could certainly have some kind of "build project and list dependencies"
06:39:08FromDiscord<Rika> I use Nimph so I don’t get this problem 😎
06:39:53FromDiscord<Elegantbeef> Shit rika uses fancy software
06:41:02PMunchHow does Nimph handle this`
06:42:49FromDiscord<Perryman> So... maybe the better question is, if this works:↔`nim c -d:release -d:releaseMain -d:tinyc src/ctfocr.nim`↔would it make sense for nimble to figure out the dependencies too?
06:42:59FromDiscord<Perryman> (edit) "src/ctfocr.nim`↔would" => "src/main.nim`↔would"
06:43:05FromDiscord<Rika> Sets —path in project’s Nim config when you install packages
06:43:31FromDiscord<Rika> So I believe dependencies are effectively project local
06:44:57PMunchAre they installed into the working tree of the package?
06:45:12PMunchPerryman, well it would kind of defeat the purpose of Nimble
06:46:00FromDiscord<Rika> I believe it doesn’t, it still installs into the nimble directory, but I don’t recall what else it does because I don’t remember being able to access other packages within my module
06:46:20FromDiscord<Perryman> In reply to @PMunch "Perryman, well it would": what is the purpose of nimble vs. compiling with nim directly?
06:46:49PMunchNimble, amongst many of it's other uses, serves to fetch dependencies automatically. This works by looking in the .nimble file, seeing if all the packages are installed, and then installing them if they don't. If Nimble would grab locally installed packages automatically it would mean that it would be easier to forget to add a dependency while developing, breaking the downloading of packages for the users.
06:48:09PMunchSay if you make a small program that I want to run, I would clone your package repo and run `nimble build`. If it was configured to be a binary output nimble would now check that I have a new enough compiler, check that all the packages are present, and build the program.
06:48:37FromDiscord<Perryman> In reply to @PMunch "Nimble, amongst many of": ahhh thank you! that is a really good answer. found the config file eventually but I didn't really follow the documentation fully
06:48:45PMunchYou could also write more tasks into the Nimble file so if it required some extra sources or some system stuff to happen then that could be run as well.
06:59:18FromDiscord<Phil> There are nimble commands to compile and run my project?↔Huh... I'll look into that
06:59:34FromDiscord<Elegantbeef> Yea they're for "reproducible builds"
06:59:43FromDiscord<Elegantbeef> Though they're not always so reproducible until we get lock files
06:59:47FromDiscord<Phil> I was aware of nimble install and kind of ignored the rest
07:00:14FromDiscord<Elegantbeef> Yea `nimble build` builds the project only with dependencies in your .nimble
07:00:20FromDiscord<Perryman> I couldn't get vscode bindings automatically
07:00:26FromDiscord<Perryman> so i was just using the console
07:00:27FromDiscord<Elegantbeef> `nimble run` will run the binary if your project is a binary release
07:00:34FromDiscord<Perryman> (edit) "I couldn't get vscode bindings automatically ... " added "(working) yet"
07:00:47FromDiscord<Elegantbeef> People use other things than the console to build code?
07:00:53FromDiscord<Elegantbeef> Even in vscode i only used the terminal
07:00:55FromDiscord<Phil> In reply to @Perryman "I couldn't get vscode": Huh, the normal tasks json worked flawless for me
07:01:14FromDiscord<Perryman> In reply to @Isofruit "Huh, the normal tasks": yeah i think i screwed something up with it somehow
07:01:28FromDiscord<Perryman> c and python don't work either
07:01:46FromDiscord<Phil> I can't be arsed beef, I just execute a task on save that runs a compile and run command
07:02:14FromDiscord<Elegantbeef> Uhhh ok
07:02:15FromDiscord<Perryman> yeah, like I want to just smash F5 to compile build run
07:02:23PMunchKids today with their fancy tools..
07:02:30FromDiscord<Elegantbeef> Indeed pmunch
07:02:54FromDiscord<Elegantbeef> So i've accidently made a sokoban clone
07:03:15PMunchHaha, well Sokoban is fun
07:03:21PMunchNot the worst thing you could've cloned
07:03:21FromDiscord<Rika> What is that
07:03:27FromDiscord<Elegantbeef> simplescreenrecorder-2022-04-26\_00.38.56.mp4 https://media.discordapp.net/attachments/371759389889003532/968406937370755102/simplescreenrecorder-2022-04-26_00.38.56.mp4
07:03:30FromDiscord<Elegantbeef> It's the block pushing game rika
07:03:34FromDiscord<Phil> Get with the times old timer, nobody manually writes compile commands anymore 😄
07:03:37FromDiscord<Elegantbeef> Where you have to push blocks to get to the end
07:03:37FromDiscord<Rika> Oh it’s Japanese
07:04:06FromDiscord<Rika> Never knew this game originated from Japan lmao
07:04:34PMunch@Phil, I do :( Honestly `nim c -r myfile` isn't a great inconvenience
07:04:47FromDiscord<Elegantbeef> As do i
07:04:50PMunchAnd once I've typed it once I just hit up in the terminal to run it again
07:04:53FromDiscord<Elegantbeef> It's easier and i can be more explicit without modifying a file
07:05:04FromDiscord<Rika> But think about :make
07:05:15FromDiscord<Elegantbeef> Also i recently swapped to fish and oh boy is that a good shell
07:05:15FromDiscord<Elegantbeef> The autocomplete is lovely
07:05:45FromDiscord<Rika> Fish is nice, too bad no one uses it so I can’t get workarounds/solutions for things that I could do on bash
07:06:07FromDiscord<Solitude> no way no one uses it
07:06:33FromDiscord<Rika> I think it’s less of no one using it more of “fish shell” is fucked for search engines
07:06:41FromDiscord<Solitude> probably
07:06:59FromDiscord<Rika> Just get a lot of fishing equipment results
07:07:01FromDiscord<Phil> Be the search results you want to see in the world?
07:07:13FromDiscord<Phil> Ohhh that problem
07:07:32PMunchHaha, yeah fish shell is a tough thing to search for
07:07:47PMunchI use zsh, pretty good
07:08:36FromDiscord<Rika> I’m not a fan of posix shell syntax so I like how fish did away with it
07:15:06*gsalazar joined #nim
07:15:58FromDiscord<untoreh> a `ptr uint8` buffer which length is know at runtime is an `openarray` ? can I cast it into a string or do I have to perform a copy?
07:17:15*xet7 quit (Ping timeout: 272 seconds)
07:18:03FromDiscord<Elegantbeef> you could do `cast[ptr UncheckedArray[char]](myBuffer).toOpenArray(0, myBufflen)`
07:18:12FromDiscord<Elegantbeef> But no you cannot get a `string` or `cstring` safely
07:18:18FromDiscord<Elegantbeef> Only `openArray[cha]`
07:20:13FromDiscord<Rika> You have to copy
07:20:16FromDiscord<Rika> Essentially
07:20:49FromDiscord<Rika> There really has to be an abstraction over sequences that is “more unsafe than seq but less unsafe than unchecked”
07:21:15FromDiscord<Elegantbeef> `openArray` is that abstraction when view types are here
07:21:20FromDiscord<Rika> That’s more specific than open I’d say
07:21:30PMunch@Rika, wait it doesn't work like a normal shell?
07:21:34FromDiscord<Rika> Does open store lengths of any sorts
07:21:36FromDiscord<Rika> ?
07:21:40FromDiscord<Rika> In reply to @PMunch "<@259277943275126785>, wait it doesn't": Fish?
07:21:42FromDiscord<Elegantbeef> it stores the length of the slice
07:21:44FromDiscord<Rika> No the syntax is different
07:21:53FromDiscord<Rika> In reply to @Elegantbeef "it stores the length": Then I guess that’s good enough for me
07:22:01FromDiscord<Solitude> In reply to @PMunch "<@259277943275126785>, wait it doesn't": garbage shell
07:22:34FromDiscord<Rika> Honestly POSIX shells are literally impossible to remember the syntax of, personally
07:22:39FromDiscord<Rika> Too many inconsistencies
07:23:37PMunchHmm, that would probably take me ages to learn though..
07:23:42FromDiscord<Elegantbeef> `strutils` really needs a rewrite to use `openArray[char]` for many procedures 😄
07:23:59FromDiscord<Rika> Fish? Not really, blocks always end with “end” and that’s pretty much it
07:24:22FromDiscord<Rika> For file in (pretty much literally anything); something; end
07:24:25FromDiscord<Solitude> In reply to @Elegantbeef "`strutils` really needs a": this, its so annoying, i frequently copy paste strutils code jsut to change the signature
07:24:37PMunchHmm, I bought some doorbell switches yesterday which doesn't require a battery. The act of pushing the button generates enough power to send a radio signal
07:24:37FromDiscord<Rika> If condition; something; end
07:24:40FromDiscord<Rika> Not too hard to learn
07:24:54PMunchNow I just wonder if I could hook it up to an Attiny85 and do something else useful with it
07:24:55FromDiscord<Rika> In reply to @Elegantbeef "`strutils` really needs a": openarrayutils lol
07:25:09FromDiscord<Rika> I’m joking
07:25:45FromDiscord<Elegantbeef> anything that works with a static buffer should use `openarray[char]`, guess i should be the change i want to be
07:29:22FromDiscord<Elegantbeef> Yea i might get annoyed enough to change it↔(@Solitude)
07:29:35FromDiscord<Elegantbeef> Atleast write an RFC for it
07:32:10PMunchThat change would be very welcome indeed
07:40:38*duuude joined #nim
07:58:01FromDiscord<deadmeme77> Hey I tried compiling a nim file (thank you @demotomohiro) into a nimpy module, and got this error
07:58:13FromDiscord<deadmeme77> c++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/deadmeme/Documents/Programming/Python/texttospeech.so)
07:58:32*emery quit (Ping timeout: 250 seconds)
08:02:29FromDiscord<deadmeme77> libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/deadmeme/Documents/Programming/Python/texttospeech.so)
08:03:00FromDiscord<deadmeme77> even though I have already installed gxx_linux-64 in the anaconda environment. đŸ€”
08:03:23*ehmry joined #nim
08:05:08*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])
08:08:57*crem joined #nim
08:09:19FromDiscord<jmgomez> hey guys, how one can access to a value of an enum by index?
08:09:38FromDiscord<Elegantbeef> `MyEnum(myInt)`
08:11:34*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
08:12:32*jjido joined #nim
08:14:37FromDiscord<Elegantbeef> If that doesnt work be more explicit in what you want 😄
08:15:42FromDiscord<jmgomez> Oh that did work, I thumb up your comment but I think you cant see it
08:16:03FromDiscord<Elegantbeef> Reactions do not propagate across the bridge for some odd reason
08:16:14FromDiscord<Elegantbeef> custom emojis do though 😄
08:17:05FromDiscord<Rika> :flUshe:
08:17:16FromDiscord<jmgomez> xD
08:17:54FromDiscord<Elegantbeef> The bridge is weird
08:18:10FromDiscord<Elegantbeef> Our polls dont go through of course 😄
08:18:33madpropsi see yellow faces here
08:18:39madpropsand :flUshe:
08:18:50FromDiscord<Elegantbeef> Yea matrix is fancier
08:20:47madpropsin what ways apart from that?
08:21:20FromDiscord<Elegantbeef> It has built in multimedia support
08:22:02FromDiscord<Rika> In reply to @madprops "and :flUshe:": It’s just “😳” but with fish eye zoom
08:24:11FromDiscord<Zoom> s/zoom/lens↔(@Rika)
08:24:43FromDiscord<Elegantbeef> Appreciate the pedantry
08:25:26FromDiscord<Zoom> Had to write something to not feel I was summoned for nothing
08:25:33FromDiscord<Elegantbeef> Oh right Zoom 😄
08:25:53FromDiscord<Elegantbeef> No one writes elegantbeef except to insult me so i never get the accidental ping
08:27:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
08:27:35FromDiscord<Zoom> I rarely get those nowadays, not like previous couple of years. Probably it's because of enormous Jitsi success and growth. /s
08:28:31FromDiscord<Elegantbeef> I almost missed the joke
08:28:57FromDiscord<Elegantbeef> But hey element has their own jitsi-like now so who knows maybe it'll stop happening 😛
08:30:06FromDiscord<Zoom> I always aim for "almost". Mostly hit "completely".
08:30:43FromDiscord<Elegantbeef> To be fair i've never touched Zoom, i've read more about jitsi than it 😄
08:33:41*duuude quit (Ping timeout: 246 seconds)
08:34:48FromDiscord<Rika> In reply to @Zoom "s/zoom/lens (<@259277943275126785>)": Ok
08:34:55FromDiscord<Rika> I forgot xd even if I’m into photography
08:41:15FromDiscord<Zoom> I'm not surprised, I'm not very popular. And I can live with "it" - how would you now I'm not a bot or an alien, right?
08:55:03FromDiscord<2F42BBA1> Nim is comfy to work with
08:56:33FromDiscord<Rika> That’s nice to hear
09:02:23*jmdaemon quit (Ping timeout: 246 seconds)
09:05:53*duuude joined #nim
09:08:09*lumo_e joined #nim
09:15:40*jjido joined #nim
09:38:43FromDiscord<dom96> ooh yay, a new job post
09:53:22*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
09:56:50FromDiscord<Zoom> Where?↔(@dom96)
09:58:13FromDiscord<Rika> #jobs in the discord
09:58:17FromDiscord<Rika> I don’t think it is bridged
09:58:55FromDiscord<hmmm> broooooooskis long time no see! What is the cleanest way to check that a 0kb file is empty
10:00:39FromDiscord<dom96> read it to check the contents I guess
10:00:48FromDiscord<Rika> Get the stat and check the size via that
10:00:52FromDiscord<Zoom> Wow, discriminating access to jobs by IM network. That's new \:D↔(@Rika)
10:01:03FromDiscord<Rika> It’s not intentional
10:01:09FromDiscord<hmmm> how do I check the stat rika
10:01:27FromDiscord<Rika> POSIX only
10:01:32FromDiscord<Rika> It’s more complicated
10:01:36FromDiscord<Rika> Not sure if there are benefits
10:01:38FromDiscord<dom96> In reply to @Zoom "Wow, discriminating access to": With the amount of issues Matrix has I'd say you're discrimating against yourself by not simply using Discord 😛
10:01:40FromDiscord<hmmm> dom if I read it I should expect to find like zero characters in it?
10:01:40FromDiscord<Rika> If you want simple just read the file
10:01:43FromDiscord<dom96> (edit) "discrimating" => "discriminating"
10:01:50FromDiscord<hmmm> or len something == zero?
10:01:53FromDiscord<Rika> The length of the string will be zero
10:01:59FromDiscord<dom96> readFile("file.txt").len == 0
10:02:07FromDiscord<hmmm> I love u both ❀
10:02:30FromDiscord<Zoom> I don't have any issues đŸ€·â†”(@dom96)
10:02:45FromDiscord<Rika> Let’s not argue about IM networks
10:08:43FromDiscord<d4rckh> i have a small program, its using the net library, its just a socket library, but it complains about not having the libwinpthread dll
10:08:58FromDiscord<d4rckh> i can easily get it from the mingw website, but i want it to not be dependent on it
10:09:13FromDiscord<d4rckh> im not actually using threads in my code, but i assume `net` does use it in its library
10:09:27FromDiscord<Rika> You aren’t going to have fun static linking for windows, I personally don’t know how it’s done
10:10:32FromDiscord<dom96> In reply to @d4rckh "i have a small": do you pass `--thread:on`?
10:10:38FromDiscord<dom96> (edit) "`--thread:on`?" => "`--threads:on`?"
10:10:56FromDiscord<d4rckh> no i dont
10:11:25FromDiscord<dom96> hm, maybe it's on by default these days? try with `--threads:off`
10:12:30FromDiscord<Rika> It’s not
10:13:12FromDiscord<dom96> I cannot find anything in the Nim repo referring to libwinpthread.dll
10:13:31FromDiscord<dom96> maybe one of your dependencies links to it?
10:13:50FromDiscord<d4rckh> im also using `nativesockets`
10:13:53FromDiscord<d4rckh> and `winim`
10:14:15FromDiscord<d4rckh> `os`, `strformat`, `strutils`, `osproc`, `os`, `base64`
10:14:21FromDiscord<d4rckh> there are all of my dependencies
10:14:26FromDiscord<d4rckh> (edit) removed "of"
10:14:42FromDiscord<d4rckh> even if i compile it with --threads:on, it still compains
10:14:45FromDiscord<d4rckh> (edit) "compains" => "complains"
10:15:33FromDiscord<dom96> what's the exact error you're getting?
10:15:59FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/968455390004146226/unknown.png
10:16:18FromDiscord<d4rckh> if i get the dll and put it next to the binary it works fine
10:16:22FromDiscord<d4rckh> but i dont wanna have to do that
10:16:38FromDiscord<Tyrone Wiggums> In reply to @d4rckh "but i dont wanna": try using pointers
10:17:26FromDiscord<dom96> In reply to @Tyrone Wiggums "try using pointers": Strike 1
10:17:32FromDiscord<dom96> Don't troll here 🙂
10:17:35FromDiscord<Tyrone Wiggums> or if you're on windows put it in system32
10:17:56FromDiscord<Tyrone Wiggums> basically acts as path for windows
10:18:15FromDiscord<dom96> In reply to @d4rckh "": that looks like it's not Nim loading it, another one of the DLLs your program depends on must also need this DLL
10:18:33FromDiscord<dom96> do you have other DLLs beside your .exe?
10:18:57FromDiscord<d4rckh> Nope
10:19:27FromDiscord<dom96> hm, then I would say your best bet is to selectively remove code until that error is gone
10:19:34FromDiscord<dom96> that way you can identify which library is the cause
10:19:46FromDiscord<d4rckh> hmm okay
10:19:52FromDiscord<d4rckh> how can I static link it tho?
10:19:57FromDiscord<d4rckh> it shouldn't be too hard? Right 😅
10:21:24FromDiscord<dom96> it likely is, I would instead focus on getting rid of this dependency
10:22:29FromDiscord<dom96> first check if a simple hello world also needs this to rule out MINGW weirdness (maybe you've got some flag enabled that makes it add that as a dependency)
10:28:49FromDiscord<d4rckh> and... you are right
10:28:54FromDiscord<d4rckh> i had nim.cfg with --threads:on
10:29:03FromDiscord<Rika> How
10:29:42FromDiscord<d4rckh> i had that flag enabled every time i ran nim in my `nim.cfg` file
10:29:43FromDiscord<dom96> hah
10:29:56FromDiscord<d4rckh> because i have a client (which doesnt require threads) and a server (which does)
10:36:38FromDiscord<Solitude> you can have modulename.nim.cfg for more specific configs
10:38:42FromDiscord<Elias> Do I understand this correctly? I can safely cast `float32` to `float`, but not `float` to `float32`. Because float generally means `float64`? Think I have hard about potential problems casting downwards in size (which makes sense)
10:38:59FromDiscord<Elias> (edit) "hard" => "heard"
10:39:23FromDiscord<Rika> You can convert either safely but you lose information downwards
10:39:28FromDiscord<Rika> Casting either is unsafe
10:39:49FromDiscord<Rika> Unsafe in the sense that the values will not be correlated
10:41:26FromDiscord<Elias> Will there be a huge difference? Have done little floating point math when it comes to binary yet...
10:42:00*lumo_e quit (Ping timeout: 276 seconds)
10:42:14FromDiscord<Rika> Difference in terms of what
10:42:29FromDiscord<Rika> Precision yes
10:42:31FromDiscord<Rika> Speed depends
10:42:56FromDiscord<Rika> I’m not even sure about your concern
10:44:45FromDiscord<Elias> glm returns a `Mat4[float32]`, and I (at least for now) have written `Mat4[float]` as my return type.
10:45:02FromDiscord<Elias> in a proc
10:45:35FromDiscord<Rika> Okay, then what’s your concern
10:45:37FromDiscord<Rika> I’m still not sure
10:46:35FromDiscord<Elias> Aaah, ok. I wonder if it can be a problem or if I just get a float64 with "reduced" precision
10:47:14FromDiscord<Elias> (no real loss of precision)
10:47:50FromDiscord<Rika> Problem in what sense?
10:50:15FromDiscord<Elias> Becoming something else than the number I pass in. But, it seems according to your answer that it only is a problem downwards in size. Me (thinking integers in my head) wondered if there is a equivalent to a overflow in float types or if there is just loss of precision
10:50:22PMunchHuh, cool to see a new job listing. Especially that they want to have it written in Nim when they have one in Node and don't seem to have a dev already
10:50:35FromDiscord<Rika> Floats have an “overflow” which is when you hit infinity
10:50:40PMunchToo bad I just got hired for a new job :P
10:50:47FromDiscord<Rika> But it’s no problem since you can’t go under
10:51:17FromDiscord<Rika> Something else than the number only happens if you don’t convert the bits properly, which won’t happen if you use conversion
10:51:20FromDiscord<Rika> But will if you use cast
10:51:57FromDiscord<Rika> In reply to @Rika "Something else than the": Actually I guess if the 64 float value is larger than the max of the 32 float, it might become infinity
10:52:08FromDiscord<Rika> But once something is infinity it stays infinity I believe
10:53:06FromDiscord<dom96> In reply to @PMunch "Huh, cool to see": What I'm curious is what's the salary range, if it wasn't for the low amount of job postings we have already I would require that to be mentioned up-front
10:53:21FromDiscord<Elias> In reply to @Rika "Something else than the": What is the difference between conversion and casting?
10:53:28PMunchdom96, oh that's a good point
10:53:41FromDiscord<Rika> In reply to @Elias "What is the difference": float(value) vs cast[float](value)
10:53:52PMunch@Elias, casting just treats a series of bytes as a different type, converting actually converts one value to another
10:55:12PMunchconverting a float32 to a float shouldn't lose any precision, but you won't magically get better precision either, so there's not really a point in doing it unless you actually need them to be floats
10:56:09FromDiscord<Elias> In reply to @PMunch "<@390570241903689728>, casting just treats": Must say I have never heard about conversion before. Will conversion be the same as `variable.float` or is that a cast?
10:56:14FromDiscord<Rika> Yes
10:56:17FromDiscord<Rika> It’s conversion
10:56:20FromDiscord<Rika> MCS
10:56:35FromDiscord<Rika> If there’s cast it’s a cast
10:56:40FromDiscord<Rika> Otherwise it’s conversion
10:56:41FromDiscord<Elias> In reply to @Rika "Yes": Thought that was casting too 🙂
10:56:42FromDiscord<Rika> Pretty much
10:56:58FromDiscord<Rika> Casting is an overloaded word because of C
10:57:12FromDiscord<Rika> Cast here means reinterpret cast if you know C++ I believe
10:57:50FromDiscord<Elias> In reply to @Rika "Otherwise it’s conversion": Do you mean it will cast if possible, else convert?
10:57:56FromDiscord<Elias> is conversion slower?
10:58:18FromDiscord<Rika> What?
10:58:23FromDiscord<Rika> Okay wait
10:58:25PMunchIt's slow-er, but typically not very slow
10:59:01PMunchCasting doesn't require any work at runtime, it's just a matter of treating a type as something else
10:59:17*lumo_e joined #nim
10:59:32PMunchConversion have to actually do something to the data
11:00:29FromDiscord<Elias> In reply to @PMunch "converting a float32 to": The point is not a precision thing. Just using generic types as a starting point. Maybe it is stupid, but another example is that I use normal int instead of GL equivalent types for simplicity if I ever were to change backend api
11:00:50FromDiscord<Elias> (edit) "GL" => "OpenGL"
11:01:30FromDiscord<Elias> In reply to @PMunch "Casting doesn't require any": Ok
11:02:04PMunch(of course casting a float32 to a float64 doesn't work, as @Rika already pointed out)
11:02:23FromDiscord<Rika> it works but its not what you expect
11:03:45PMunchDoes it work?
11:03:48FromDiscord<Tyrone Wiggums> In reply to @PMunch "(of course casting a": doesnt make sense
11:03:51PMunchI mean they are different sizes..
11:03:57FromDiscord<Elias> In reply to @PMunch "(of course casting a": So if I understand it will compile, but my numbers dont make sense anymore?
11:04:03FromDiscord<Tyrone Wiggums> i should be able to convert anything to anything
11:04:17FromDiscord<Tyrone Wiggums> like string to array of characters
11:04:21FromDiscord<Elias> (edit) "In reply to @PMunch "(of course casting a": So if I understand it will compile, but my numbers dont make sense anymore? ... " added "(If I cast)"
11:04:27FromDiscord<Rika> In reply to @PMunch "Does it work?": it would probably just consume the next 32 bits after the float32
11:04:33FromDiscord<Rika> "consume"
11:04:35PMunchOkay, so it does actually work..
11:04:50FromDiscord<Rika> In reply to @Elias "So if I understand": yes
11:04:58FromDiscord<Rika> you're reinterpreting memory as it is
11:05:05FromDiscord<Rika> "fooling the compiler's type system"
11:05:07FromDiscord<Elias> In reply to @Rika "it would probably just": Haha, that will be some fun numbers
11:06:35FromDiscord<Rika> hmm, i wanna know if you cast a literal
11:06:47FromDiscord<Rika> !eval echo cast[float64](0'f32)
11:06:49NimBot8.358285837067407e+266
11:06:56FromDiscord<Rika> 🙂
11:07:17FromDiscord<Rika> just dont use cast
11:07:25FromDiscord<exelotl> In reply to @Tyrone Wiggums "doesnt make sense": read the convo again - cast is not the same as conversion
11:08:19FromDiscord<Elias> But, now when I am abstracting OpenGL and glm. Would you recommend to convert specific types from OpenGL and glm to generic types so that "internally" I dont need conversions or only to convert when something will not play together?
11:08:37FromDiscord<Rika> example?
11:11:14FromDiscord<Elias> such as getting float32 from glm. I do not know how I am going to use it yet because I am in the process of abstracting stuff should I then just pass on the float32 into the higher abstraction levels or just convert it to float before returning to keep things generic?
11:11:39FromDiscord<Elias> Am new to the level of control you have with nim
11:12:08FromDiscord<Rika> i have no idea what you mean
11:12:12FromDiscord<Elias> Hehe
11:12:29*Arrrrrrr joined #nim
11:12:41PMunch@Elias, hopefully this will help: https://play.nim-lang.org/#ix=3WhZ
11:12:48PMunchOr maybe it just confuses you further :P
11:14:06PMunch@Elias, what you could do is pass it along as a generic
11:14:44PMunchDefine that it returns a Vec4[float32] but that you require a Vec4[SomeFloat]
11:15:03PMunchThat way if you later change to float64 it will just propagate
11:15:41PMunchAnd assuming you don't do any bit-twiddling or manually specify the size of it anywhere it should all just work or throw an error telling you where floats aren't supported
11:18:42FromDiscord<Rika> woo my rpi pico arrived today xd
11:18:50FromDiscord<d4rckh> sent a code paste, see https://paste.rs/SdN
11:18:56PMunchOh nice, got any plans for it?
11:19:51FromDiscord<Elias> The problem here is that I am used to not having to specify bit width of my variables. Then I wonder what to do when the modules I use gives me stuff with specific bit widths back when I call their procs (such as float32). Should I just convert it to float straight away so that internally in my engine everything uses generic float (as a example) or just convert as needed and return whatever I get? All I want is the one that avoids too many
11:20:28FromDiscord<Elias> its perhaps a detail, just wonder how you work with this
11:20:38PMunch@Elias, generally I handle it with generics
11:20:53PMunchIf I don't care about the specific bit-ness then use a generic or typeclass
11:21:14PMunch@d4rckh, does indeed sound like you're doing something wrong
11:22:51FromDiscord<Rika> In reply to @d4rckh "I think I am": are you able to compile them
11:23:02FromDiscord<Rika> you're showing an editor error but is compiling working
11:23:15FromDiscord<d4rckh> nope
11:23:22FromDiscord<d4rckh> the editor uses `nim check`
11:23:22FromDiscord<Elias> sent a code paste, see https://paste.rs/7PP
11:23:54PMunch@Elias, I wouldn't
11:24:15PMunchAs I said, return the types you have, but accept multiple types
11:24:50*jjido joined #nim
11:25:25FromDiscord<Rika> `DDDTransform` is what specifically
11:25:29FromDiscord<Rika> maybe you can make that generic
11:26:39FromDiscord<Elias> That one is not the problem
11:27:08FromDiscord<Elias> sent a code paste, see https://play.nim-lang.org/#ix=3Wi1
11:27:27FromDiscord<Elias> forgot the .get
11:27:50FromDiscord<Rika> I mean to make it generic so you can use it to determine the return type
11:28:30FromDiscord<Elias> That sounds interesting. How would that work?
11:29:29FromDiscord<Elias> can the output return type be determined by the input?
11:30:39FromDiscord<Rika> Yes
11:32:23FromDiscord<Elias> could i then automatically convert "that one" to the correct type?
11:32:36FromDiscord<Rika> If needed sure
11:32:42FromDiscord<Phil> @Elias You can basically say "the input parameter will have type A, the output parameter will have the same type as the input parameter"
11:32:43FromDiscord<Rika> Usually it isn’t
11:33:38FromDiscord<Elias> Well my return type "something" does not nescessarily match the Mat4[float32] that I get from the .translate)(
11:33:41FromDiscord<Elias> (edit) ".translate)(" => ".translate()"
11:33:55FromDiscord<Rika> Why
11:34:09FromDiscord<Rika> Why can’t it?
11:34:21FromDiscord<Rika> Make translate generic too 🙂
11:34:24FromDiscord<Phil> Does the translate() not always return the same type?
11:34:35FromDiscord<Phil> You may want to play around with object variants in that case
11:34:47FromDiscord<Phil> Another approach would be as Rika stated, generics in generics
11:34:54FromDiscord<Elias> translate comes from glm
11:35:05FromDiscord<Phil> What does glm give you?
11:35:14FromDiscord<Elias> Mat4[float32]
11:35:14FromDiscord<Rika> And is it generic in some way, be it overloaded, implicit, or explicit?
11:35:25FromDiscord<Elias> In reply to @Rika "And is it generic": ?
11:35:33FromDiscord<Rika> Are there overloads
11:35:43FromDiscord<Phil> In reply to @Elias "Mat4[float32]": In what scenario could it then return you a value that doesn't match the output of Mat4[float32] of your own proc?
11:36:07FromDiscord<Elias> I specify Mat4[float] I get Mat4[float32]
11:36:22FromDiscord<Phil> Ohhhhhhh
11:36:28FromDiscord<Elias> (edit) "I specify Mat4[float] ... I(need" added "as return type" | "as return typeI get Mat4[float32] ... " added "(need conversion unless generics)"
11:36:34FromDiscord<Phil> Basically there's an explicit mapping from type A to type B
11:36:39FromDiscord<Rika> Why?
11:36:42FromDiscord<Phil> float to float32, int to int32 I assume
11:36:49FromDiscord<Elias> the other way
11:37:36FromDiscord<Phil> Hmm how performance critical is this? are you fighting for every millisecond? Do you very much care that it HAS to be float vs float32?
11:37:45FromDiscord<deadmeme77> How do you refer to an enum?
11:38:12FromDiscord<deadmeme77> I want to use std/jsfetch, but it complains that newFetchOptions(metod = "POST") is of wrong type, string instead of HttpMethod
11:38:40FromDiscord<Phil> In reply to @deadmeme77 "How do you refer": HttpMethod.POST or Post or hmPost or however they name their enums
11:38:53FromDiscord<frobnicate> No quotations
11:39:11FromDiscord<Phil> (edit) "enums" => "enum-values"
11:39:26FromDiscord<deadmeme77> In reply to @frobnicate "No quotations": metod = POST got undeclared identifier error
11:39:27FromDiscord<Rika> In reply to @deadmeme77 "I want to use": `HttpPost`
11:39:48FromDiscord<frobnicate> https://nim-by-example.github.io/types/enums/
11:39:56FromDiscord<frobnicate> Then it's the wrong identifier
11:39:57FromDiscord<Rika> you might need to import `httpcore` as well
11:39:59FromDiscord<deadmeme77> In reply to @Rika "`HttpPost`": undeclared variable as well
11:40:02FromDiscord<deadmeme77> Ah, that might be
11:40:04FromDiscord<deadmeme77> Yeah thats the issue
11:40:05FromDiscord<deadmeme77> thanks Rika
11:40:08FromDiscord<deadmeme77> thanks All 👍
11:40:10FromDiscord<Elias> In reply to @Isofruit "Hmm how performance critical": No I just use generic float. glm https://github.com/stavenko/nim-glm/ has a funciton translate that takes in a matrix and some coordinates to represent as a matrix which ill pass on to a uniform. It returns a Mat4[float32] and I just wondered if best practice is to convert to Mat4[float], but then we got started on generics...
11:40:49FromDiscord<Phil> In reply to @Elias "No I just use": Ahhh check. So you wanted to stick with float in order to not have to think about bit-size?
11:40:57FromDiscord<Elias> yepp
11:41:21FromDiscord<Elias> But then generics was something that could make everything even less specific as far I understand
11:42:06FromDiscord<Phil> generics are basically a template that is used to build explicit procs at the places that call the generics
11:42:27FromDiscord<Phil> (edit) "generics are basically a template that is used to build explicit procs at the places that call the generics ... " added "with the specified types"
11:42:30FromDiscord<frobnicate> I would imagine you would want it to be specific? I mean OpenGL uses f32↔So yeah I was gonna suggest templates
11:43:16FromDiscord<Phil> Either way, I think the two ways I see there are either: Accept to live with f32, or convert from f32 to float manually, which isn't hard, but might not be what you want if it's performance critical
11:43:24FromDiscord<Elias> In reply to @frobnicate "I would imagine you": at the lower levels of my engine yes, but else I dont care and would rather not think about bit size.
11:43:44FromDiscord<frobnicate> Is your engine just for you?
11:44:38FromDiscord<Phil> I'm really surprised they enforce the swap to f32 though, got to say
11:45:09FromDiscord<frobnicate> Well OpenGL uses f32 so
11:45:12FromDiscord<Elias> Currently its only for me. if it becomes any good Ill perhaps make it a nimble package. Easy enough to just convert just wondered if there are other (better) ways to do it I can learn from
11:45:15FromDiscord<Phil> Wait, they give generics
11:46:04FromDiscord<frobnicate> I've tried using the wrong float on accident, so I personally don't mind enforcing it
11:46:26FromDiscord<Phil> We're takling about the translate proc in `mat_transform.nim`, right?
11:47:11FromDiscord<Elias> In reply to @Elias "Currently its only for": I am not in a rush to finish it. Want to learn as much as possible from designing it in a good way. Hence the discussion
11:48:35FromDiscord<frobnicate> What's the consequences of converting an f64 to f32 exactly? Just dropping precision or can you end up with entirely different numbers?
11:49:01FromDiscord<Yardanico> dropping precision
11:49:10FromDiscord<Elias> I think the conclusion was conversion is completely fine but cast not
11:49:18FromDiscord<frobnicate> Then I guess it isn't that bad
11:49:26FromDiscord<Yardanico> In reply to @Elias "I think the conclusion": you shouldn't cast if you want to convert
11:49:26FromDiscord<Elias> since I am moving up in bit size there is theoretically no loss
11:49:28*Zectbumo quit (Remote host closed the connection)
11:49:40FromDiscord<Elias> yep, rika explained
11:49:41FromDiscord<Yardanico> yeah, but @frobnicate asked about f64 -> f32
11:49:46FromDiscord<Elias> aah
11:49:48FromDiscord<Yardanico> f32 -> f64 should have no accuracy loss
11:49:50FromDiscord<Yardanico> i think
11:49:57FromDiscord<frobnicate> In reply to @Elias "since I am moving": At some point it needs to go back to f32 is my point
11:50:10FromDiscord<Elias> yep
11:50:15FromDiscord<Rika> you might get inf if you exceed f32 limits
11:50:22FromDiscord<Elias> In reply to @frobnicate "At some point it": aaah, now I get it
11:50:40FromDiscord<Yardanico> but if you convert from/to f32->f64 all the time you might also lose performance
11:51:09FromDiscord<frobnicate> That's also my worry but I'd have to see a benchmark
11:51:12*xet7 joined #nim
11:51:17FromDiscord<Elias> In reply to @frobnicate "At some point it": so it could be a problem with float64 math for physics and then converting to float32 when passing on to OpenGL?
11:51:23FromDiscord<frobnicate> Yeah
11:51:27FromDiscord<Rika> !eval echo float32(4.4028234664e38)
11:51:29NimBotinf
11:51:36FromDiscord<Elias> fun
11:51:57FromDiscord<Rika> not an issue of course if you're not dealing with astronomy level sizes
11:52:05FromDiscord<Rika> just something to be wary of
11:52:08FromDiscord<Elias> who knows...
11:52:25FromDiscord<frobnicate> It might make sense to use high precision in some cases, but you need to make sure it's converted back nicely at some point
11:53:09FromDiscord<Elias> Ok, then as a starting point it may be simpler to just use float32 and take the problem with higher precision if it arises?
11:53:19FromDiscord<frobnicate> Yes
11:53:23FromDiscord<Rika> doubtful it ever will though
11:53:40FromDiscord<frobnicate> F32 is enough for the unreal guys, so
11:53:46FromDiscord<Elias> Think ill be fine 🙂
11:53:48FromDiscord<frobnicate> They seem to set the standard
11:54:11FromDiscord<frobnicate> I blame marketing 😾
11:55:10FromDiscord<Elias> It's settled then
12:00:23FromDiscord<Elias> But this however. Most are GLuints originally and some are ints, use int as standard or generics? https://media.discordapp.net/attachments/371759389889003532/968481663246032917/unknown.png
12:00:40*xet7 quit (Remote host closed the connection)
12:01:11FromDiscord<frobnicate> Personally I use gluints in my math
12:01:26FromDiscord<frobnicate> Or uint
12:01:50FromDiscord<frobnicate> Since signed to unsigned can be fucky wucky
12:02:10FromDiscord<Elias> Thats a thing too. (forgot)
12:02:17FromDiscord<frobnicate> The places that can have negative values i just use int
12:02:30FromDiscord<frobnicate> But most of those are actually floats
12:03:03FromDiscord<frobnicate> It's usually uints for object IDs in OpenGL
12:03:10FromDiscord<frobnicate> The rest is floats
12:04:14FromDiscord<Elias> Ok, then ill go with uint as a standard
12:04:34FromDiscord<Elias> Thanks everyone
12:21:52FromDiscord<deadmeme77> @Yardanico thank you! Let's move here
12:22:21FromDiscord<deadmeme77> is there a way to make echo able to show hiragana/kanji in terminal instead of unicode chars?
12:22:45FromDiscord<Yardanico> can you show the current output?
12:22:47FromDiscord<deadmeme77> I see, input.convert(), thanks
12:22:50FromDiscord<deadmeme77> its this
12:22:50FromDiscord<Yardanico> nonono
12:22:58FromDiscord<Yardanico> just show what it currently outputs
12:23:05FromDiscord<deadmeme77> https://media.discordapp.net/attachments/371759389889003532/968487378782154812/unknown.png
12:23:08FromDiscord<Yardanico> you basically just need to take the json field and get the string out of it
12:23:28FromDiscord<deadmeme77> I used echo response.body and get that
12:23:32FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wib
12:23:40FromDiscord<deadmeme77> I see, thanks. So char --> string conversion
12:23:51FromDiscord<Yardanico> well, not exactly, this isn't a conversion
12:24:14FromDiscord<Yardanico> it's just that in JSON you generally escape unicode strings so they are written with hex codes of unicode characters
12:24:21FromDiscord<Yardanico> it's the same string, just encoded differently
12:24:34FromDiscord<deadmeme77> I see, I understand now
12:24:43FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wic
12:24:46FromDiscord<deadmeme77> yep it works, thank you!
12:24:59FromDiscord<Yardanico> but you maybe also need to make it handle failures, because I guess if an error happens "translatedText" field won't exist
12:25:34FromDiscord<deadmeme77> should I use assert or try, catch?
12:25:43FromDiscord<deadmeme77> I think I see both used in examples
12:25:55FromDiscord<Yardanico> in this case you can just check if a field exists
12:26:10FromDiscord<Yardanico> or rather, use getStr's optional second argument
12:26:43FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wif
12:26:57FromDiscord<Yardanico> {} is different from [] in the sense that it'll return an nil JsonNode instead of erroring if that field doesn't exist
12:27:30*slowButPresent joined #nim
12:31:01FromDiscord<deadmeme77> Is that because {} is used for sets and [] for arrays? Or different concept?
12:31:13FromDiscord<Yardanico> no, that's not related
12:31:26FromDiscord<Yardanico> @deadmeme77 in Nim you can redefine operators easily, so JsonNode has both [] and {} defined for it that have different behaviour
12:31:37FromDiscord<deadmeme77> Ah, I see. Library overloading
12:31:40FromDiscord<Yardanico> well, rather not redefine but overload
12:31:50FromDiscord<deadmeme77> (edit) "Ah, I see. Library ... overloading" added "operator"
12:31:57FromDiscord<Yardanico> this is the specific overload that is used in my code example - https://nim-lang.org/docs/json.html#%7B%7D%2CJsonNode%2Cstring
12:32:28FromDiscord<Yardanico> and normal [] that raises an exception if the field doesn't exist - https://nim-lang.org/docs/json.html#%5B%5D%2CJsonNode%2Cstring
12:33:31*zeus-supreme joined #nim
12:34:36*zeus-supreme quit (Client Quit)
12:49:05FromDiscord<untoreh> sent a code paste, see https://paste.rs/9KO
12:49:15*rockcavera joined #nim
12:49:16*rockcavera quit (Changing host)
12:49:16*rockcavera joined #nim
12:50:51FromDiscord<untoreh> mmh nothing I think it works 🙂
12:59:04*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
13:00:36FromDiscord<ph4qd> sent a code paste, see https://play.nim-lang.org/#ix=3Win
13:03:03FromDiscord<Rika> same as `HOOKPROC(HookCallback)`
13:03:14FromDiscord<Rika> side effect of command call syntax
13:03:19PMunch@ph4qd, it's just an alternative way of converting types
13:05:16*arkurious joined #nim
13:05:27FromDiscord<ph4qd> oh ok that's really helpful thank you
13:07:09FromDiscord<ph4qd> is this alternative style for type conversion in the docs? i had been searching around without much luck
13:09:40PMunchWell it's not specific to type conversion
13:09:46PMunchAs @Rika said it's just command call syntax
13:10:13PMunch!eval (echo) "Hello world"
13:10:15NimBotHello world
13:10:41PMunchThe parenthesis are obviously not required
13:11:27FromDiscord<ph4qd> ah got it makes more sense now
13:11:57PMunchIt could just read `Hookproc HookCallback` or `HookCallback.HOOKPROC` or `HookProc(HookCallback)`
13:14:00PMunchReally those procedure names should be camelCase instead of PascalCase, and the indentation isn't NEP-1. If you're trying to learn Nim I'd recommend looking at some better sources
13:21:17FromDiscord<dom96> PMunch: I'm trying to get us some more DO credit to expand the playground server
13:21:53FromDiscord<Rika> is playground on DO?
13:22:25PMunchHopefully, otherwise those DO credits probably wouldn't help
13:23:06FromDiscord<ph4qd> any recommendations for repos implementing the `winim` library that have well-written idiomatic code?
13:24:01FromDiscord<dom96> In reply to @Rika "is playground on DO?": yep
13:24:37PMunch@ph4qd, hmm it seems like winim has copied the naming convention from the underlying library, so they will all have the weird names..
13:25:31PMunchBut the examples in the repo seems to be written in decently styled Nim
13:32:26*duuude quit (Remote host closed the connection)
13:53:46FromDiscord<deadmeme77> In reply to @PMunch "!eval (echo) "Hello world"": huh nim has !eval() as well?
13:54:07PMunch@deadmeme77, no the !eval is just a command to the NimBot
13:54:23PMunchIt will execute the snippet using the playground and output the result here in the chat
13:54:31PMunch!eval echo "Hello @deadmeme77"
13:54:33NimBotHello @deadmeme77
13:54:38PMunchLike that
13:54:52FromDiscord<deadmeme77> ahh wkwk I see, thanks
13:57:34*PMunch quit (Quit: Leaving)
14:07:12*LuxuryMode joined #nim
14:13:41FromDiscord<Zodey> hello↔Can somebody tell me what is the difference between "let" and "const"
14:13:53FromDiscord<Tyrone Wiggums> const is immutable and cant be changed
14:14:04FromDiscord<Tyrone Wiggums> variables initialized with let can be changed
14:14:18FromDiscord<Tyrone Wiggums> for example an unchanging api key would be declared with const
14:14:40FromDiscord<Tyrone Wiggums> a token variable that refreshes every 15 minutes would be declared with let
14:14:47FromDiscord<Zodey> https://media.discordapp.net/attachments/371759389889003532/968515492232953916/unknown.png
14:15:18FromDiscord<Tyrone Wiggums> what
14:16:12FromDiscord<Zodey> <https://learnxinyminutes.com/docs/nim/>
14:17:18FromDiscord<Tyrone Wiggums> guess i was wrong
14:19:00FromDiscord<aph> const is for those who can be set at compile time, let is for those who can't
14:19:09FromDiscord<aph> idk if im right though
14:19:12FromDiscord<Tyrone Wiggums> so
14:19:17FromDiscord<Tyrone Wiggums> all variables are immutable?
14:19:22FromDiscord<aph> no
14:19:26FromDiscord<Zodey> var is mutable
14:19:27FromDiscord<aph> you can use `var`
14:19:31FromDiscord<Zodey> ye
14:19:47FromDiscord<Tyrone Wiggums> this language is a menace to society
14:19:48FromDiscord<Zodey> and does --mm:arc is the default now?
14:19:50FromDiscord<aph> (edit) "const is for those who can be set at compile time, let is for those who can't ... " added "be set at compile time (immutable)"
14:20:04FromDiscord<aph> not sure about reference counting
14:20:28FromDiscord<Zodey> In reply to @Tyrone Wiggums "this language is a": lol no↔rust works almost the same
14:20:45FromDiscord<Tyrone Wiggums> In reply to @Zodey "lol no rust works": guess what language im an advocate against
14:21:54FromDiscord<Zodey> rust isnt that bad↔i would learn that, but i dont like the syntax for it
14:22:06FromDiscord<Zodey> (come from java btw)
14:22:17FromDiscord<Tyrone Wiggums> java is great
14:22:24FromDiscord<Tyrone Wiggums> really similar to my favorite language, c
14:22:59FromDiscord<Zodey> In reply to @Tyrone Wiggums "java is great": but really slow
14:23:06FromDiscord<Zodey> i mean
14:23:08FromDiscord<Tyrone Wiggums> i think its fast
14:23:17FromDiscord<Zodey> for most of the tasks its fast enough
14:23:30FromDiscord<Zodey> but i dont like the runtime
14:23:53FromDiscord<Tyrone Wiggums> i just had an idea
14:24:18FromDiscord<Tyrone Wiggums> nim on the jvm
14:24:33FromDiscord<Zodey> please dont
14:25:03FromDiscord<Zodey> well, you can translate it to js, then run on vm
14:25:10FromDiscord<Zodey> (edit) "vm" => "the jvm"
14:25:13FromDiscord<Tyrone Wiggums> oh no,
14:25:20FromDiscord<Tyrone Wiggums> i meant the java virtual machine
14:25:40FromDiscord<Tyrone Wiggums> and java bytecode
14:26:07FromDiscord<Generic> java is nothing like C besides the syntax
14:26:40FromDiscord<Tyrone Wiggums> In reply to @Generic "java is nothing like": it has semicolons
14:26:43FromDiscord<Tyrone Wiggums> close enough for me
14:26:51FromDiscord<Zodey> keksad
14:27:30*duuude joined #nim
14:27:46FromDiscord<Zodey> command line(1, 2) Error: invalid command line option: '--mm' https://media.discordapp.net/attachments/371759389889003532/968518756563316756/unknown.png
14:27:49FromDiscord<Zodey> bruh
14:28:05FromDiscord<Tyrone Wiggums> i think its from the fact that you're using gnu nano
14:29:20FromDiscord<aph> not sure why you used `mm`, but if you're choosing between arc or orc the correct argument should be `gc` instead probably
14:29:32FromDiscord<aph> like `--gc:orc`
14:29:35FromDiscord<aph> not sure though
14:29:39FromDiscord<aph> since idk what are you doing
14:30:09FromDiscord<Zodey> its good with gc
14:30:26FromDiscord<Zodey> https://media.discordapp.net/attachments/371759389889003532/968519429392568340/unknown.png
14:30:33FromDiscord<aph> ah
14:30:34FromDiscord<Yardanico> In reply to @aph "not sure why you": `mm` is the new way
14:30:38FromDiscord<aph> then idk that
14:30:39FromDiscord<aph> lol
14:30:48FromDiscord<Yardanico> In reply to @Zodey "command line(1, 2) Error:": your nim is too old
14:30:55FromDiscord<Yardanico> `mm` has only been added recently
14:30:59FromDiscord<Yardanico> on older nim versions you need to use `gc`, yes
14:31:09FromDiscord<Yardanico> nim docs are made for the latest Nim release
14:31:12FromDiscord<Yardanico> can you show `nim -v` ?
14:31:13FromDiscord<Rika> In reply to @aph "not sure why you": mm is the new argument
14:31:23FromDiscord<aph> roger
14:31:27FromDiscord<Rika> both work
14:31:36FromDiscord<Zodey> In reply to @Yardanico "can you show `nim": https://media.discordapp.net/attachments/371759389889003532/968519716777893938/unknown.png
14:31:40*vicfred joined #nim
14:31:41FromDiscord<Yardanico> yeah that's outdated :P
14:31:45FromDiscord<spoon> is mm just an alias for gc?
14:31:47FromDiscord<Yardanico> the latest is 1.6.4 (after 1.6.0 and 1.6.2)
14:31:57FromDiscord<Rika> technically gc is the alias to mm
14:32:00FromDiscord<Yardanico> yeah :)
14:32:10FromDiscord<Zodey> In reply to @Yardanico "the latest is 1.6.4": hmm, then arch repo isnt updated
14:32:13FromDiscord<Yardanico> yes it's not
14:32:14FromDiscord<Zodey> sad
14:32:27FromDiscord<Yardanico> install nim via choosenim or manually (it's pretty easy)
14:32:38FromDiscord<Zodey> is there auto updater for it btw?
14:32:44FromDiscord<Zodey> or i need to manually update every time?
14:32:52FromDiscord<Yardanico> choosenim makes updating a 1-command task
14:32:57FromDiscord<Yardanico> and nim releases aren't made that frequently
14:33:20FromDiscord<aph> In reply to @Zodey "is there auto updater": can probably make one, install a new nim every new git commit
14:33:23FromDiscord<aph> >:)
14:35:58FromDiscord<Zodey> In reply to @aph "can probably make one,": maybe someday
14:36:27FromDiscord<Zodey> but i will definitely use this language, cuz its seems fast and easy to read
14:38:39*kayabaNerve quit (Remote host closed the connection)
14:39:48FromDiscord<huantian> +1 for using choosenim (including on arch)
14:40:19FromDiscord<Zodey> In reply to @huantian "+1 for using choosenim": can you help me a bit? im a new user, i followed that path stupp, but didnt worked
14:40:22FromDiscord<Yardanico> i always use the manual way though, since it makes it easier to tinker with the stdlib and the compiler :)
14:40:51FromDiscord<Zodey> https://media.discordapp.net/attachments/371759389889003532/968522049242947584/unknown.png
14:41:06*lumo_e quit (Ping timeout: 250 seconds)
14:41:13FromDiscord<huantian> You installed choosenim via pacman right?
14:41:42FromDiscord<Zodey> i used this command
14:41:43FromDiscord<Zodey> sent a code paste, see https://play.nim-lang.org/#ix=3WiD
14:42:05FromDiscord<Yardanico> you don't need a newline here
14:42:11FromDiscord<Yardanico> `curl https://nim-lang.org/choosenim/init.sh -sSf | sh`
14:42:20FromDiscord<huantian> Or just use pacman
14:42:23FromDiscord<Zodey> it was just a paste mistake
14:42:23FromDiscord<Yardanico> execute this and it'll automatically install itself into ~/.nimble/bin
14:42:25FromDiscord<Yardanico> In reply to @huantian "Or just use pacman": 1.4.8
14:42:34FromDiscord<Zodey> In reply to @Yardanico "execute this and it'll": yeah, done
14:42:38FromDiscord<huantian> No install choosenim with pacman
14:42:39FromDiscord<Zodey> but i cant set the path for it
14:42:40FromDiscord<huantian> Not I’m
14:42:44FromDiscord<Yardanico> In reply to @Zodey "yeah, done": so do you have anything in ~/.nimble/bin ?
14:42:44FromDiscord<huantian> (edit) "I’m" => "Nim"
14:42:57FromDiscord<huantian> Also did you restart your terminal after making the changes
14:43:02FromDiscord<Zodey> In reply to @Yardanico "so do you have": https://media.discordapp.net/attachments/371759389889003532/968522598298292344/unknown.png
14:43:14FromDiscord<Yardanico> yeah, so what happens if you edit your profile and restart the terminal?
14:43:34FromDiscord<Zodey> https://media.discordapp.net/attachments/371759389889003532/968522735179399228/unknown.png
14:43:35FromDiscord<Yardanico> ah right @Zodey
14:43:43FromDiscord<Yardanico> did you remove the nim installation? oh you did
14:44:01FromDiscord<Yardanico> In reply to @Zodey "": ~/.profile requires a log-out and then a log-in again maybe?
14:44:08FromDiscord<huantian> Oh choosenim isn’t on the mainline arch repos I got it from the AUR <https://aur.archlinux.org/packages/choosenim>
14:44:22FromDiscord<huantian> If profile doesn’t work try your .zshrc
14:44:30FromDiscord<Zodey> In reply to @Yardanico "~/.profile requires a log-out": could be
14:44:36FromDiscord<Zodey> 1 sec, i reboot
14:45:21FromDiscord<Yardanico> uhh, you don't need to rebootr
14:45:22FromDiscord<Yardanico> (edit) "rebootr" => "reboot"
14:45:27FromDiscord<Yardanico> you can log out and log in without rebooting :P
14:45:58FromDiscord<Solitude> he isnt in a rush
14:47:42FromDiscord<Zodey> same 😩
14:47:59*kayabaNerve joined #nim
14:48:10FromDiscord<Alea> Is there any wrapper for windows Timeapi that has this function?↔https://docs.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod?redirectedfrom=MSDN
14:48:11FromDiscord<Zodey> one thing which is better in win is path setting
14:48:32FromDiscord<Yardanico> In reply to @Alea "Is there any wrapper": winim does
14:48:36FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/968523998440869958/unknown.png
14:49:07FromDiscord<Alea> hmm :EmotiHmmm: I literally just searched that repo and it didn't come up↔thanks github
14:49:36FromDiscord<Yardanico> In reply to @Zodey "same 😩": are you sure setting ~/.profile for path variables works on your system?
14:50:19FromDiscord<Zodey> i dont know, sorry
14:50:29FromDiscord<Zodey> just switched from windows to arch
14:50:30FromDiscord<Yardanico> @Zodey if you're using X, try ~/.xprofile instead
14:50:34FromDiscord<Zodey> (edit) "just switched from windows to arch ... " added "(manjaro)"
14:50:45FromDiscord<Yardanico> put your `export` there, log out, and then log in (no need to reboot)
15:23:15*PMunch joined #nim
15:35:32*vicfred quit (Quit: Leaving)
15:38:15FromDiscord<dom96> In reply to @huantian "Oh choosenim isn’t on": fun to see my software that was specifically made not to be packaged in Linux distro's get packaged in Linux distros 😛
15:39:38*duuude quit (Ping timeout: 246 seconds)
15:40:17FromDiscord<Yardanico> well that's AUR
15:40:23FromDiscord<Yardanico> it has everything one can dream of :P
15:43:09FromDiscord<huantian> That’s what you get for making something useful!
15:48:02FromDiscord<huantian> People will package anything they see in the aur
15:49:11FromDiscord<dom96> yeah, it is pretty cool actually, really happy to see it even if it makes helping troubleshoot choosenim problems harder (cannot trust most of these packagers unfortunately)
15:51:23*duuude joined #nim
16:02:29FromDiscord<Tyrone Wiggums> In reply to @dom96 "fun to see my": :)
16:12:03FromDiscord<Tyrone Wiggums> In reply to @Yardanico "it has everything one": not my software
16:12:25FromDiscord<Tyrone Wiggums> to be fair
16:12:29FromDiscord<Tyrone Wiggums> its all malware
16:12:48FromDiscord<Tyrone Wiggums> and the fact that its open source doesnt help my detection chances
16:16:50FromDiscord<Rika> okay
16:17:05FromDiscord<Rika> if you dont trust software why do you trust hardware? 🙂
16:18:29FromDiscord<Phil> Intel would neeeeeeeeever do anything to screw you over! /s
16:18:57PMunchdom96, imo having choosenim in AUR makes sense. Better than having a super outdated Nim version..
16:21:01FromDiscord<Phil> How else would you get up to date nim versions on Linux? Was the intended workflow to wait for distro repos to catch up?
16:21:56FromDiscord<Yardanico> In reply to @Isofruit "How else would you": huh?
16:22:00FromDiscord<Yardanico> just install it yourself
16:22:16FromDiscord<Phil> Ah no, I'm blind and dumb, forgot the were tear balls
16:22:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Wjt
16:22:27FromDiscord<Yardanico> well this is for the devel version
16:22:31FromDiscord<Phil> Tar
16:22:33FromDiscord<Yardanico> for stable you can either use tarballs or checkout a stable version
16:25:56*Chaul-Jhin-Kim joined #nim
16:25:58*duuude quit (Ping timeout: 250 seconds)
16:26:06Chaul-Jhin-KimHowdy
16:28:15FromDiscord<deadmeme77> I should take a look at packaging nim builds into guix, cause they are now stuck in a version from 2020 IIRC
16:28:20FromDiscord<deadmeme77> well, weekend is far
16:28:58Chaul-Jhin-KimDear GOD/GODS and/or anyone else who can HELP ME (e.g. TIME TRAVELERS or MEMBERS OF SUPER-INTELLIGENT ALIEN CIVILIZATIONS): The next time I wake up, please change my physical form to that of FINN MCMILLAN formerly of SOUTH NEW BRIGHTON at 8 YEARS OLD and keep it that way FOREVER. I am so sick of this chubby Asian man body! Thank you! - CHAUL JHIN
16:28:58Chaul-Jhin-KimKIM (a.k.a. A DESPERATE SOUL)
16:29:00*Chaul-Jhin-Kim left #nim (#nim)
16:29:52FromDiscord<Knedlik> Hey guys, is there a way to find the number of non-whitespace-only lines either using the compiler and/or VSC? Would be a nice statistic to look at
16:30:54FromDiscord<Knedlik> (edit) "Hey guys, is there a way to find the number of non-whitespace-only lines ... either" added "in either a file or the entire project,"
16:38:42*duuude joined #nim
17:15:42*Gustavo6046 joined #nim
17:16:48*Gustavo6046 quit (Max SendQ exceeded)
17:17:19*Gustavo6046 joined #nim
17:18:51*PMunch quit (Quit: leaving)
17:30:53*lumo_e joined #nim
17:37:34FromDiscord<Rika> Tool “CLOC”
17:38:02FromDiscord<Rika> https://github.com/AlDanial/cloc
17:47:22FromDiscord<Phil> erm... who the hell was that
17:58:09*lumo_e quit (Ping timeout: 276 seconds)
18:01:47*Zectbumo joined #nim
18:04:31*vicfred joined #nim
18:21:00FromDiscord<hmmm> never trust anyone that starts anything with howdy 🧐 đŸ€”
18:25:36*jjido joined #nim
18:26:28FromDiscord<Tyrone Wiggums> In reply to @hmmm "never trust anyone that": howdy partner
18:31:35*duuude quit (Ping timeout: 260 seconds)
18:35:18FromDiscord<adokitkat> Hi, how can I pass null/nil to a function which has a var argument? I just don't need it. It's `waitpid(a1: Pid, a2: var cint, a3: cint) : Pid` from std/posix.
18:35:43FromDiscord<Yardanico> In reply to @adokitkat "Hi, how can I": you can't, you have to pass it anyway
18:35:48FromDiscord<Yardanico> just don't use it afterwards if you don't care about it
18:36:00FromDiscord<Yardanico> ah actually, in this case you can pass `nil` probably
18:36:12FromDiscord<Yardanico> waitpid supports that, but I don't know if Nim will let you do that
18:36:21FromDiscord<Solitude> In reply to @adokitkat "Hi, how can I": std/posix has some questionable signatures
18:36:23FromDiscord<Yardanico> yeah
18:36:26FromDiscord<Yardanico> it should be "ptr cint"
18:36:55FromDiscord<Solitude> In reply to @adokitkat "Hi, how can I": you can just copy the definition in your code and change var to ptr
18:39:15FromDiscord<adokitkat> Good idea, thank you both
18:45:59*duuude joined #nim
18:50:44*lumo_e joined #nim
18:51:59*Gustavo6046 quit (Remote host closed the connection)
18:52:18*Gustavo6046 joined #nim
18:56:04*Arrrrrrr quit (Quit: Arrrrrrr)
19:00:53*lumo_e quit (Ping timeout: 272 seconds)
19:01:43*jmdaemon joined #nim
19:04:15*averell quit (Quit: .)
19:09:13*averell joined #nim
19:10:27NimEventerNew question by Philipp Doerner: How do I access an object field via its field name in string form?, see https://stackoverflow.com/questions/72019297/how-do-i-access-an-object-field-via-its-field-name-in-string-form
19:19:02FromDiscord<Phil> This is one of those "I wanted to document a thing I already know to google myself later" king of questions, don't worry
19:19:13FromDiscord<Phil> (edit) "king" => "kind" | "questions," => "questions from myself,"
19:19:26FromDiscord<Yardanico> In reply to @Isofruit "This is one of": yeah i know stackoverflow allows and even encourages self-answers, it's just a little weird :)
19:19:32FromDiscord<Yardanico> maybe i can check for self-answers somehow in nimeventer
19:19:45FromDiscord<Yardanico> although it's still beneficial to show them
19:19:54FromDiscord<Yardanico> so guess the current way works fine
19:19:56FromDiscord<Phil> Basically, if it's in SO and from me you're near guaranteed for it to be a self-answer
19:20:24FromDiscord<Yardanico> maybe I should spam SO a bit with basic nim stuff related to stdlib modules as well
19:20:33FromDiscord<Yardanico> to help people and my so rep maybe :D
19:21:23FromDiscord<Phil> I mean, if it's the kind of thing that you yourself have to google decently often or would be something a beginner absolutely wouldn't know, that works fine.
19:35:03FromDiscord<Yardanico> https://news.ycombinator.com/item?id=31160234
19:35:05FromDiscord<Yardanico> "Compile time evaluation in Nim, Zig, Rust and C++"
19:35:43*duuude quit (Ping timeout: 260 seconds)
19:36:50FromDiscord<Gengyuu> hoi people, im kind of a language hopper cuz i program for fun but i keep gettin drawn to nim, im torn between using vscode or neovim for nim but what kind of setup do you all use?
19:37:09FromDiscord<dom96> Super cool visualiation https://forum.nim-lang.org/t/9121#59537
19:37:16FromDiscord<huantian> In reply to @Yardanico "https://news.ycombinator.com/item?id=31160234": Wait I’ve always been confused do hackernews posts have like a post body?
19:37:19FromDiscord<huantian> Or just a title
19:37:33FromDiscord<huantian> Oh it’s a link
19:37:33FromDiscord<Yardanico> In reply to @huantian "Wait I’ve always been": they either have a link to something or a post body
19:37:50FromDiscord<Yardanico> yeah it links to https://castillodel.github.io/compile-time-evaluation/
19:37:53FromDiscord<Yardanico> just simple fizzbuzz
19:42:30FromDiscord<Yardanico> In reply to @dom96 "Super cool visualiation https://forum.nim-lang.org/": I wonder if they scraped the irclogs website or used my irc logs sqlite dump
19:42:38FromDiscord<Yardanico> I guess I should update it anyway since it's pretty outdated by now
19:45:20FromDiscord<d4rckh> when i pass an object to a proc, does nim pass it by reference or just copy it?
19:45:51FromDiscord<Yardanico> In reply to @d4rckh "when i pass an": by default nim will pass small objects by copy, large enough objects by reference
19:46:01FromDiscord<Yardanico> you can override that behaviour for your type by using `byref` and `bycopy` pragmas
19:46:13FromDiscord<Yardanico> which is needed for C interop usually
19:47:36FromDiscord<0000> farded
19:48:49FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Wkm
19:49:07FromDiscord<dom96> In reply to @Yardanico "https://news.ycombinator.com/item?id=31160234": This really shows just why Nim is so awesome
19:49:50FromDiscord<dom96> Zig/Rust/C++ are just a little too low-level when looking at that Fizz buzz example
19:52:14FromDiscord<Yardanico> In reply to @d4rckh "hm, right, so i": but is your server object a `ref` ?
19:52:42FromDiscord<Tyrone Wiggums> sent a code paste, see https://play.nim-lang.org/#ix=3Wko
19:52:51FromDiscord<Yardanico> In reply to @d4rckh "hm, right, so i": also what about timeouts - maybe acceptAddr hangs forever when there's no connection?
19:52:53FromDiscord<d4rckh> yes, it is a ref of object
19:52:56FromDiscord<Yardanico> maybe you should also use something like `withTimeout`
19:53:59FromDiscord<d4rckh> In reply to @Yardanico "also what about timeouts": oh yeah it hang
19:54:00FromDiscord<d4rckh> (edit) "hang" => "hangs"
19:54:08FromDiscord<d4rckh> wait, let me try something
19:54:13FromDiscord<d4rckh> stop it, and then try to connect
19:54:16FromDiscord<d4rckh> it should then truly stop
19:54:31FromDiscord<Yardanico> https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint if you want to add timeouts to async calls
19:54:59FromDiscord<d4rckh> yup, you are right
19:55:08FromDiscord<d4rckh> it actually works
19:55:19FromDiscord<d4rckh> but .acceptAdr() blocks everything
19:55:26FromDiscord<Yardanico> yeah, that's why withTimeout will be useful
19:55:57FromDiscord<d4rckh> wait, how do i actually use it?
19:55:59nrds<Prestige99> What's wrong with this concept? https://play.nim-lang.org/#ix=3Wkq
19:56:39FromDiscord<Yardanico> In reply to @d4rckh "wait, how do i": one moment
19:56:52FromDiscord<dom96> In reply to @Yardanico "yeah, that's why withTimeout": I don't think you want this on accept
19:57:02FromDiscord<dom96> What are you trying to do @d4rckh ?
19:57:13FromDiscord<d4rckh> In reply to @dom96 "What are you trying": stop my listeners when i set running to false
19:57:16FromDiscord<d4rckh> (edit) "listeners" => "listener"
19:57:27FromDiscord<d4rckh> but they wont stop, until a client connects to it
19:57:38FromDiscord<dom96> you want to stop accepting new connections with a command?
19:57:42FromDiscord<d4rckh> yes
19:57:46FromDiscord<d4rckh> just by setting running to false
19:57:49FromDiscord<d4rckh> or something else
19:57:53FromDiscord<d4rckh> it can be a function too đŸ€”
19:57:56FromDiscord<dom96> just close the server socket when `running` is false
19:58:08FromDiscord<dom96> should kill any in-progress `accept`
19:58:09FromDiscord<d4rckh> i think i can just use a function?
19:58:14FromDiscord<d4rckh> i didnt check the docs
19:58:15FromDiscord<d4rckh> one sec
19:58:20FromDiscord<dom96> (they might raise an exception, but you can catch it)
19:58:57FromDiscord<d4rckh> okay, should i set running to false and use .close?
19:59:43FromDiscord<d4rckh> `Error: unhandled exception: The I/O operation has been aborted because of either a thread exit or an application request.`
19:59:44FromDiscord<d4rckh> wow thats mean
19:59:47FromDiscord<d4rckh> when i use .close()
20:29:01FromDiscord<kunitoki> Hello there, anybody could help me understand a compiler error ?
20:29:04*ehmry quit (Ping timeout: 250 seconds)
20:29:35*ehmry joined #nim
20:30:13FromDiscord<kunitoki> sent a code paste, see https://play.nim-lang.org/#ix=3Wkw
20:30:34FromDiscord<kunitoki> everything works, except the `bindClosure` calling with argNoResult
20:31:00FromDiscord<kunitoki> sent a code paste, see https://play.nim-lang.org/#ix=3Wkx
20:31:54FromDiscord<kunitoki> it seems that `proc(arg: T)` with no explicit return type (or void for the matter) cannot be deduced with a generic type R
20:33:37FromDiscord<kunitoki> if i explicitly specialize the generic call it works, but it's annoying to have to do it while it works for the others `var y = bindClosure[void, int](argNoResult)`
20:34:19*ehmry quit (Ping timeout: 260 seconds)
20:34:37*ehmry joined #nim
20:41:18*ehmry quit (Ping timeout: 276 seconds)
20:41:41FromDiscord<iffy (Matt Haggard)> I've often wanted a way to conditionally do something if a key is defined in JSON and finally came up with this\: https://play.nim-lang.org/#ix=3Wkz Gosh, I love Nim. In summary, you can do\: `if somejson.extract("foo"): echo $foo.getInt()`
20:43:17FromDiscord<deech> In reply to @dom96 "This really shows just": I covered this exact example in my Nim Nuggets talk. I've been talking about static intro for years.
20:54:39FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "I've often wanted a": why not do it the much easier way with quote do? :)
20:54:57FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WkE
20:56:00FromDiscord<iffy (Matt Haggard)> Because it's late in the day \:)↔(@Yardanico)
20:56:02FromDiscord<Yardanico> also you probably want `key` to be a static string or evaluate it separately
20:56:07FromDiscord<iffy (Matt Haggard)> That's a much better solution
20:56:24FromDiscord<Elegantbeef> Why are we using quote do like it's 2003
20:56:26FromDiscord<Elegantbeef> Use genasts or go home
20:56:30FromDiscord<Yardanico> yeah yeah genasts blablabla
20:56:31FromDiscord<Elegantbeef> And if you're already home go homer
20:56:32FromDiscord<Yardanico> go sleep beef
20:56:47FromDiscord<Yardanico> you can't teach an old dog new tricks :PP
20:56:54FromDiscord<Elegantbeef> Hey i'm useless and just got up a couple hours ago
20:57:02FromDiscord<Elegantbeef> So dont tell me to go to sleep!
20:57:05FromDiscord<iffy (Matt Haggard)> Elegantbeef, show me the genast version
20:57:13FromDiscord<Yardanico> it'll be almost the same
20:57:14FromDiscord<Elegantbeef> It's the same thing just nicer
20:57:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WkG
20:58:38FromDiscord<iffy (Matt Haggard)> okay, no backticks, more nimmy
20:58:58FromDiscord<Elegantbeef> Yep also no need to manually declare variables
20:59:06FromDiscord<Elegantbeef> Just alias expressions or pass in values by name
21:00:23FromDiscord<Elegantbeef> You do also need `import std/genasts`
21:03:23FromDiscord<Yardanico> message count since this day from last year (might be inaccurate for people who like to change nicknames often)
21:03:25FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/968618321400463440/unknown.png
21:03:51FromDiscord<Elegantbeef> Fuck yea look at that useless bastard
21:04:40FromDiscord<Elegantbeef> Now do one without me
21:05:01FromDiscord<Yardanico> top 30 in text form https://media.discordapp.net/attachments/371759389889003532/968618727283249203/unknown.png
21:05:36FromDiscord<Yardanico> need to add a isofruit = phil alias in my irc log parsing code
21:05:43FromDiscord<Elegantbeef> Ah was going to say
21:06:10FromDiscord<Elegantbeef> Quite surprised you're so high given i almost never seen you 😛
21:06:15*lumo_e joined #nim
21:06:19FromDiscord<Yardanico> xd
21:06:33FromDiscord<Yardanico> in total 1351 users chatted in #main since last year
21:06:45FromDiscord<Yardanico> rough values, since the code probably missed some, and some people changed nicknames
21:07:04FromDiscord<Yardanico> half of all people left <= 10 messages
21:09:32*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
21:12:56FromDiscord<Elegantbeef> Yea many people just ding dong ditch with a single question or two
21:13:03FromDiscord<Elegantbeef> They dont like my hospitality methinks
21:13:32*flynn joined #nim
21:16:16FromDiscord<dom96> In reply to @d4rckh "okay, should i set": yes, do it. Is it working after you handle that error? 😄
21:17:35FromDiscord<dom96> In reply to @Elegantbeef "Why are we using": I think you got that the wrong way around, genast is actually the 2003 tech. That said, I still wish the do notation would be gotten rid of.
21:17:49FromDiscord<Elegantbeef> The hell are you talking about?
21:18:09FromDiscord<Yardanico> In reply to @dom96 "I think you got": beef is talking about std/genasts
21:18:10FromDiscord<Yardanico> https://github.com/nim-lang/Nim/pull/17426
21:18:16FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/968622060052054046/image.png
21:18:18*flynn quit (Read error: Connection reset by peer)
21:18:20FromDiscord<Yardanico> but yeah it's a bit more explicit than quote do
21:18:20FromDiscord<dom96> oh, I misread as getAst
21:18:24FromDiscord<dom96> lol
21:18:46FromDiscord<dom96> damn, genAst is much cooler than do
21:18:54FromDiscord<dom96> another reason to kill the do notation
21:19:20FromDiscord<Elegantbeef> Am i the only one that likes the do notation
21:19:30*flynn joined #nim
21:19:33*jjido joined #nim
21:19:56FromDiscord<dom96> yes
21:21:08FromDiscord<Generic> no I like it too
21:21:12FromDiscord<Generic> you're not alone
21:21:20FromDiscord<Elegantbeef> Well fuck you all i'll make my own Nim with blackjack and do notation
21:22:16FromDiscord<dom96> I'm willing to die on this hill even if it turns out I am the only one on it
21:22:21FromDiscord<dom96> do notation should have been removed long ago
21:22:30FromDiscord<Elegantbeef> It's so lovely
21:22:44FromDiscord<Elegantbeef> Doesnt rely on some uppity `=>` syntax
21:22:51FromDiscord<Elegantbeef> Could you imagine writing `=>` unironically
21:23:02FromDiscord<exelotl> nah do notation is pretty stupid
21:23:10FromDiscord<dom96> haha
21:23:15FromDiscord<dom96> exelotl with the cold hard truth
21:23:17FromDiscord<Elegantbeef> Pretty stupid cool
21:23:45*ehmry joined #nim
21:23:47FromDiscord<dom96> `=>` for single line lambdas and `proc` for multi-line works perfectly
21:23:53*flynn quit (Read error: Connection reset by peer)
21:24:03FromDiscord<dom96> "do notation" is just a vestigial organ
21:24:07FromDiscord<dom96> just like the appendix
21:24:18FromDiscord<Elegantbeef> No it doesnt cause `=>` fucking sucks
21:24:18FromDiscord<dom96> 😄
21:24:26FromDiscord<golova> What about multiple untyped blocks?
21:24:28FromDiscord<Elegantbeef> The appendix is actually apart of the immune system
21:24:35FromDiscord<Elegantbeef> Look at this guy saying "I dont want a part of my immune system"
21:25:05FromDiscord<Generic> I don't want to spread out the parameters so much
21:25:06*flynn joined #nim
21:25:11FromDiscord<Yardanico> yeah, @golova makes a valid point
21:25:20FromDiscord<dom96> I'd rather not live in fear of needing to get major surgery because my appendix gets inflamed, but this is getting too off-topic hah
21:25:24FromDiscord<Yardanico> what will you replace `do` with for templates and macros
21:25:38FromDiscord<Elegantbeef> I think the solution is named blocks
21:25:38FromDiscord<Elegantbeef> Which i also like
21:25:52FromDiscord<Yardanico> hmm
21:25:54FromDiscord<dom96> yep
21:26:02FromDiscord<dom96> do notation for templates/macros is a whole other discussion
21:26:09FromDiscord<Yardanico> @ElegantBeef can you show an example?
21:26:20FromDiscord<Elegantbeef> you use the parameter name with `:`
21:26:45FromDiscord<d4rckh> In reply to @dom96 "yes, do it. Is": I think so? I can't try it now, is there any bool the socket has which tells me wether the socket is closed or not, so i don't have to make my own
21:27:29FromDiscord<dom96> In reply to @deech "I covered this exact": We need you to talk more. We need more blog posts highlighting this fact 🙂
21:27:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WkN
21:27:56FromDiscord<dom96> sent a code paste, see https://play.nim-lang.org/#ix=3WkO
21:28:31FromDiscord<dom96> In reply to @d4rckh "I think so? I": don't think so
21:28:38FromDiscord<dom96> but check the docs 🙂
21:29:57FromDiscord<exelotl> if `do` for anonymous procedures was actually shorter it would be decent. but it saves like 2 characters over writing the exact same thing with `proc`, yet introduces an entirely different syntax that looks like functions from python (`def foo(a: sometype) -> rettype: ...`)
21:30:18FromDiscord<Elegantbeef> I mean the same argument can be made for `=>` no?
21:30:41*flynn quit (Read error: Connection reset by peer)
21:30:45FromDiscord<dom96> In reply to @exelotl "if `do` for anonymous": Yes! Exactly. The very custom non-Nim syntax is what bothers me the most
21:30:53FromDiscord<dom96> In reply to @Elegantbeef "I mean the same": `=>` is a macro
21:31:02FromDiscord<Elegantbeef> I'm not daft dom
21:31:22FromDiscord<dom96> Bro. I'm not saying you don't know this fact
21:31:30FromDiscord<dom96> I'm using this as the reason for why the same argument doesn't apply
21:31:33FromDiscord<exelotl> adds 1 to bro counter
21:31:55*flynn joined #nim
21:32:05FromDiscord<dom96> Can't say I wasn't influenced by that post
21:32:36FromDiscord<exelotl> `=>` does type inference all over which is enough to justify its existence right?
21:33:22FromDiscord<dom96> tbh I'll admit that `=>` is a bit of a hack. It just generates a `proc` with `auto` types 😄
21:34:24FromDiscord<Yardanico> yes, which breaks from time to time
21:34:34FromDiscord<Elegantbeef> If only the compiler could go "oh this is the do notation and we know it's a procedure, let's infer the parameters"↔(@exelotl)
21:34:43FromDiscord<Yardanico> like this - https://github.com/nim-lang/Nim/issues/19736 duplicate of https://github.com/nim-lang/Nim/issues/16906
21:35:09FromDiscord<dom96> the nice thing about `=>` is that you can give it types too
21:35:27FromDiscord<Elegantbeef> I think the do notation is a very useful utillity that if made smarter is better than what a macro is going to do
21:35:33FromDiscord<dom96> the fact that this works as a macro is as usual a true demonstration of Nim's power
21:35:52FromDiscord<dom96> and goes with Nim's original goal: small core with great extensibility
21:36:07FromDiscord<Elegantbeef> Sure except for the fact it often breaks 😄
21:36:10FromDiscord<dom96> another reason why the `do` notation is just guff IMO
21:36:29FromDiscord<dom96> that's more to do with Nim's type inference than with the macro's implementation though
21:36:33FromDiscord<Elegantbeef> Well the do notation is a concrete user written construct which means you could explictly use it for inferring procedure types
21:37:13FromDiscord<dom96> not sure what you mean by that tbh
21:37:29FromDiscord<Elegantbeef> So if it was made with a bit more umph you wouldnt need parameter types or return types where the type was explicit
21:37:49*flynn quit (Read error: Connection reset by peer)
21:38:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WkS
21:39:02*flynn joined #nim
21:39:41FromDiscord<Elegantbeef> In the case there is no ambiguity the above can work and doesnt require changing how `proc` is reasoned
21:40:58FromDiscord<dom96> sent a code paste, see https://play.nim-lang.org/#ix=3WkT
21:41:06FromDiscord<dom96> if you improve the handling of your example then you'll also improve the handling of this
21:41:34FromDiscord<Elegantbeef> You dont have to annotate types since it can be inferred?
21:41:46FromDiscord<Elegantbeef> to have it work with proc you need to make `proc(a,b)` valid
21:42:39FromDiscord<dom96> does `do` already allow that?
21:42:44*rawrrr joined #nim
21:42:51FromDiscord<Elegantbeef> > So if it was made with a bit more umph you wouldnt need parameter types or return types where the type was explicit
21:43:07FromDiscord<Elegantbeef> Since `nnkDo` is apart of the AST it can be done
21:43:43FromDiscord<dom96> oh, you mean it could be done without breaking the nnkDo AST? but doing the same for nnkProc would break its AST?
21:43:58FromDiscord<dom96> (I don't recall the details of the AST representation of these)
21:44:02FromDiscord<Elegantbeef> Well yea you need to allow `proc(a,b)` which is invalid
21:44:12FromDiscord<Elegantbeef> proc's parameters are `identdefs` not `ident`s
21:44:16*flynn quit (Read error: Connection reset by peer)
21:45:01FromDiscord<Elegantbeef> And you'd only allow `proc(a,b)` inside a proc call otherwise it's invalid
21:45:20FromDiscord<Elegantbeef> We already have a construct that's only allow inside a proc call that can be expanded to be more flexible
21:45:29*flynn joined #nim
21:46:25FromDiscord<dom96> https://play.nim-lang.org/#ix=3WkV
21:46:41FromDiscord<dom96> Looks to me like they have very similar ASTs
21:46:53FromDiscord<dom96> and that `proc` parses fine with no parameter types
21:48:33FromDiscord<Elegantbeef> Guess who didnt expect the proc to parse
21:49:05FromDiscord<dom96> I wasn't certain myself
21:49:32FromDiscord<dom96> But does that mean I've won you over on the do notation front? 🙂
21:49:39FromDiscord<Elegantbeef> Not really
21:50:18*flynn quit (Read error: Connection reset by peer)
21:50:57FromDiscord<dom96> Is there another objective reason you favour it or is it more of a subjective "I just like it a lot"
21:51:31*flynn joined #nim
21:55:29*flynn quit (Read error: Connection reset by peer)
21:55:56FromDiscord<Elegantbeef> Nope
21:56:04FromDiscord<Elegantbeef> I just think it's a better solution than chopping of the name of a proc and using it there
21:56:33FromDiscord<Elegantbeef> I'm very much in the minority
21:56:42*flynn joined #nim
21:57:05FromDiscord<dom96> not necessarily
21:57:12FromDiscord<Elegantbeef> Nah i am
21:58:42FromDiscord<dom96> I can see an alternate reality where Nim only allows named procs and then has a separate keyword for unnamed procs. But that's not how Nim evolved, unnamed procs have been around for far longer than `do` so from my perspective the `do` notation just felt like an addition without much purpose.
22:02:41FromDiscord<Elegantbeef> Way to be a luddite
22:04:13*flynn quit (Read error: Connection reset by peer)
22:04:40FromDiscord<dom96> what?
22:05:26*flynn joined #nim
22:06:50FromDiscord<dom96> I think it's a stretch to call the `do` notation a new technology lol
22:07:16FromDiscord<dom96> That's like calling me a luddite for being opposed to chocolate ice cream because I prefer vanilla
22:11:53*flynn quit (Read error: Connection reset by peer)
22:13:06*flynn joined #nim
22:17:56FromDiscord<Elegantbeef> You must be new here
22:18:44*flynn quit (Read error: Connection reset by peer)
22:19:57*flynn joined #nim
22:25:31*flynn quit (Read error: Connection reset by peer)
22:26:43*flynn joined #nim
22:27:40nrds<Prestige99> Elegantbeef do you know what I'm doing incorrectly here? https://play.nim-lang.org/#ix=3Wkq
22:28:07nrds<Prestige99> Do concepts only work with functions but not members of a type maybe?
22:28:26FromDiscord<Elegantbeef> Concepts are constraints
22:28:33FromDiscord<Elegantbeef> `Foo[T]` and `position: T`
22:28:43nrds<Prestige99> oh I need p.position not position(p)
22:31:52*flynn quit (Read error: Connection reset by peer)
22:33:05*flynn joined #nim
22:39:25*flynn quit (Read error: Connection reset by peer)
22:40:17nrds<Prestige99> I'm just going to pretend that makes sense and move on
22:40:37*flynn joined #nim
22:40:51FromDiscord<dom96> In reply to @Elegantbeef "You must be new": What do you mean? Can you elaborate/clarify?
22:45:18*flynn quit (Read error: Connection reset by peer)
22:46:32*flynn joined #nim
22:51:24*flynn quit (Read error: Connection reset by peer)
22:52:37*flynn joined #nim
22:52:48*lumo_e quit (Read error: Connection reset by peer)
22:57:27FromDiscord<Elegantbeef> I generally say hyperbolic things in jest↔(@dom96)
22:57:34*flynn quit (Read error: Connection reset by peer)
22:58:47*flynn joined #nim
22:59:50FromDiscord<Elegantbeef> Ah prestige i misread
22:59:51FromDiscord<Elegantbeef> Yea you want field access not method call as such `foo` doesnt match `position(p)`
23:00:09FromDiscord<Elegantbeef> Properties do pass for `p.position`
23:00:35nrds<Prestige99> Is that documented somewhere? I found the solution by randomly guessing for a while
23:01:18FromDiscord<Elegantbeef> I mean it's just `compiles(position(p))`
23:01:25FromDiscord<Elegantbeef> If all predicates return true it matches
23:01:59nrds<Prestige99> Was unaware of compiles as well
23:02:17FromDiscord<Elegantbeef> Lol
23:02:26FromDiscord<dom96> In reply to @Elegantbeef "I generally say hyperbolic": Good to know, but not everyone will. Keep that in mind as it wasn't clear to me whether you were just straight up insulting me 🙂
23:02:36FromDiscord<Elegantbeef> It basically checks if the statement compiles and if it's a bool that it's true
23:02:47FromDiscord<Elegantbeef> lol
23:03:26nrds<Prestige99> Concepts make a lot more sense now that you said that
23:03:47*flynn quit (Remote host closed the connection)
23:03:48FromDiscord<Elegantbeef> Congrats
23:03:49FromDiscord<Elegantbeef> Welcome to the feature
23:04:04FromDiscord<Elegantbeef> I mean future
23:04:16nrds<Prestige99> Har do
23:04:33FromDiscord<Elegantbeef> V2 concepts are different and do not support things such as fields
23:04:38FromDiscord<dom96> a future that may be short lived
23:04:46FromDiscord<dom96> yeah, v2 concepts are on the horizon
23:04:48FromDiscord<Elegantbeef> Eh concepts v2 suck
23:05:00*flynn joined #nim
23:05:11FromDiscord<Elegantbeef> Work ok for traits, but other than that they just dont work and need more
23:05:20FromDiscord<dom96> I haven't used them so I don't have an opinion here
23:05:39nrds<Prestige99> Shoot they won't work for fields? That's not good...
23:05:51FromDiscord<Elegantbeef> They presently only support a list of procedures required for a type
23:05:51FromDiscord<Elegantbeef> So if you do anything like `a.field is int` you're SOL
23:06:08FromDiscord<Elegantbeef> Well they may in the future, they presently dont
23:06:13FromDiscord<dom96> can't you just do: `proc field(): int`?
23:06:37nrds<Prestige99> Yeah but uh, why not just support fields?
23:06:37FromDiscord<dom96> that sounds like it would be consistent with how Nim already handles fields/procs
23:06:41FromDiscord<Elegantbeef> Not if i recall
23:06:52FromDiscord<dom96> because you'd need a separate keyword
23:06:54nrds<Prestige99> It sounds like it wouldn't be too easy to add
23:06:57FromDiscord<Elegantbeef> Cause it presently doesnt
23:07:13nrds<Prestige99> too hard to add*
23:07:31FromDiscord<dom96> current concepts eval Nim code
23:07:40*crem quit (Ping timeout: 250 seconds)
23:07:44FromDiscord<dom96> so you can just write Nim code which evaluates whether a field exists
23:07:47FromDiscord<Elegantbeef> Really it could support `field: int`
23:07:48FromDiscord<Elegantbeef> You dont
23:08:01FromDiscord<dom96> hm true
23:08:16FromDiscord<Elegantbeef> You just use ident defs
23:08:43FromDiscord<Elegantbeef> Ugh
23:08:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wlf
23:08:59FromDiscord<Elegantbeef> `myField: int` would work just fine and could check if there was a proc named `myField`
23:09:15FromDiscord<Elegantbeef> Takes a single parameter that is `Self` and returns `int`
23:09:29FromDiscord<Elegantbeef> Not using a bunch of `trySemExpr` is better but not having field support is awful
23:09:37FromDiscord<Elegantbeef> It means it's just a trait system presently
23:09:43FromDiscord<Elegantbeef> Which to be fair i've used it as such
23:10:04FromDiscord<Elegantbeef> https://github.com/beef331/traitor goes brrr
23:10:32nrds<Prestige99> I'm surprised lenientops isn't on by default
23:10:43FromDiscord<Elegantbeef> Nim is a statically typed language
23:10:54FromDiscord<Elegantbeef> lenientops has implicit converters
23:11:01FromDiscord<Elegantbeef> You dont do that in a statically typed language by default
23:11:06*flynn quit (Read error: Connection reset by peer)
23:11:10FromDiscord<dom96> to be fair, you could
23:11:17nrds<Prestige99> Yeah I'm aware but I'd still enable it my default
23:11:18FromDiscord<Elegantbeef> Of course you could
23:11:21FromDiscord<Elegantbeef> Doesnt change my stance
23:11:29FromDiscord<dom96> Nim's integer operations are much more anal than other language's, including many static language's
23:11:30nrds<Prestige99> by*
23:11:38FromDiscord<dom96> (edit) "language's," => "languages," | "language's" => "languages"
23:12:19*flynn joined #nim
23:12:39FromDiscord<dom96> There is no easy way to have a module that makes operations stricter though
23:12:45nrds<Prestige99> Like `let foo: float = 2.3 * 5` should compile imo
23:12:51nrds<Prestige99> True
23:12:53FromDiscord<dom96> at least with the constructs that Nim provides
23:12:54FromDiscord<Elegantbeef> It does
23:13:08FromDiscord<dom96> !eval let foo: float = 2.3 5; echo(foo)
23:13:10NimBotCompile failed: /usercode/in.nim(1, 22) Error: invalid token: (\29)
23:13:13FromDiscord<Elegantbeef> Cmon prestige use actual examples that dont compile
23:13:27FromDiscord<dom96> huh
23:13:34nrds<Prestige99> It compiles? Eh I'm on my phone atm
23:13:45FromDiscord<Elegantbeef> discord -\> irc adds a weird symbol for ``
23:13:50FromDiscord<Elegantbeef> Of course it compiles
23:13:53nrds<Prestige99> I swear I was doing stuff like that yesterday and it wouldn't compile
23:13:53FromDiscord<Elegantbeef> they're both literals
23:14:02FromDiscord<dom96> ugh Discord
23:14:03FromDiscord<Elegantbeef> Therefore the `5` is converted to a float
23:14:21FromDiscord<Elegantbeef> and you get 11.5 into fo
23:14:21FromDiscord<dom96> Could be a good time to move NimBot to Discord
23:14:23FromDiscord<Elegantbeef> foo
23:14:49nrds<Prestige99> Hmm I'll try the playground on my phone 1 min
23:15:09FromDiscord<dom96> it does work, I checked
23:15:24nrds<Prestige99> Ok the playground not doing well on my phone
23:15:30FromDiscord<ElegantBeef> Matrix bridge down 😩
23:15:41FromDiscord<Elegantbeef> Uh oh i killed the matrix bridge
23:15:43FromDiscord<ElegantBeef> Anyway like i said it raises the literal to the right type
23:15:47nrds<Prestige99> What else is new, matrix sucking
23:15:56FromDiscord<dom96> you killed it? how? lol
23:15:59FromDiscord<ElegantBeef> Not really matrix as much as the bridge being dumb
23:16:01FromDiscord<huantian> I think it’s the bridge’s fault
23:16:07*flynn quit (Read error: Connection reset by peer)
23:16:09nrds<Prestige99> What if they were saved to variables first
23:16:09FromDiscord<huantian> It’s cus it’s not in Nim!
23:16:24FromDiscord<ElegantBeef> It'd not compile cause nim doesnt do backwards inference
23:16:31FromDiscord<ElegantBeef> It'd infer the one as int and the other as float
23:16:36nrds<Prestige99> I'll have to test this out when I'm on my computer in like 10 minutes
23:16:45FromDiscord<ElegantBeef> And then not compile cause there is no `int float` or `float int` in system
23:16:51FromDiscord<ElegantBeef> You dont really need to test this
23:17:02FromDiscord<ElegantBeef> Any untyped literal will convert to a type if it needs to
23:17:13FromDiscord<dom96> right, I should head to bed. Night all
23:17:14FromDiscord<ElegantBeef> As soon as you add a variable you add typing
23:17:20nrds<Prestige99> Gn dom
23:17:20*flynn joined #nim
23:17:20FromDiscord<ElegantBeef> Buh bye
23:17:25nrds<Prestige99> That just sounds backwards to be honest
23:17:33FromDiscord<ElegantBeef> I mean it works fine
23:17:56FromDiscord<ElegantBeef> It gets bad when you have overloads
23:18:08FromDiscord<ElegantBeef> But generally it works fine if you ask me
23:18:31FromDiscord<huantian> Not me adding f to every float literal out of paranoia in C%
23:18:32*megaman1237 joined #nim
23:18:34FromDiscord<huantian> (edit) "C%" => "C#"
23:18:41*megaman1237 left #nim (Leaving)
23:18:42nrds<Prestige99> Lol
23:19:03FromDiscord<ElegantBeef> Exactly in most cases literals can be inferred due to their surroundings unless we're talking about backwards inference
23:19:15FromDiscord<ElegantBeef> The funny part is in rust where they have backwards inference it doesnt work on floats
23:19:46FromDiscord<ElegantBeef> So if you have a literal of `1` and attempt to use it as a float it doesnt type it properly but if you attempt to use it as a `u8` it does
23:19:57nrds<Prestige99> Weird
23:19:57FromDiscord<ElegantBeef> have a variable assigned to a literal of 1
23:20:59FromDiscord<ElegantBeef> Inferred literals that nim have are relatively nice given a lot of the time literals are used as default parameters
23:21:19FromDiscord<ElegantBeef> `proc doThing(a: float)` means you can do `doThing(32)`
23:21:53FromDiscord<ElegantBeef> In other languages you may have to do `32d` or similar
23:23:16*flynn quit (Read error: Connection reset by peer)
23:24:28*flynn joined #nim
23:27:09nrds<Prestige99> Yeah, I just wish I could add a float and and int together without casting
23:27:26nrds<Prestige99> when they are variables and not literals
23:27:51FromDiscord<Elegantbeef> It's ambiguous what's correct imo 😄
23:28:12nrds<Prestige99> What, the result of the addition?
23:28:24nrds<Prestige99> You can already do it with literals, it would just follow suit
23:28:49FromDiscord<Elegantbeef> Yes what is the correct type
23:29:00FromDiscord<Elegantbeef> Literals isnt equivlent
23:29:24nrds<Prestige99> I think it is? It's the same equation
23:29:37*flynn quit (Read error: Connection reset by peer)
23:29:41nrds<Prestige99> this for example https://play.nim-lang.org/#ix=3Wli
23:29:49nrds<Prestige99> 1 + 2.4 in both cases
23:30:20FromDiscord<Elegantbeef> I see it as different since in literal expressions there is only one solution
23:30:46nrds<Prestige99> What's the one solution?
23:30:48FromDiscord<Elegantbeef> All types in a literal expression need to match to be sensible
23:30:49*flynn joined #nim
23:31:14FromDiscord<Elegantbeef> But in a symbol expression types have been bound and the resultant type is ambiguous
23:31:50FromDiscord<Elegantbeef> You can argue for an `int` result as much as a `float` result
23:32:00nrds<Prestige99> leneintops handles it fine, I think that should just be the default for (int, float) operations
23:32:09nrds<Prestige99> I don't think you can
23:32:14FromDiscord<Elegantbeef> Fine in your books
23:32:26nrds<Prestige99> otherwise, why not cast 2.4 to an int in the literal expression?
23:32:59FromDiscord<Elegantbeef> Consider `255u8 range[0f..1f]`
23:33:28nrds<Prestige99> you can multiply ranges?
23:33:45FromDiscord<Elegantbeef> I could argue that in the above case a vast majority of the time you want the byte result
23:33:48FromDiscord<Elegantbeef> Well yea it's a subrange type
23:34:12FromDiscord<Elegantbeef> It doesnt dispatch specially it just dispatches all floats and ensures they're in `0f..1f`
23:34:21nrds<Prestige99> I don't understand how you do an operation on a range so this is kind of lost on me
23:34:35nrds<Prestige99> is the result supposed to be a new range?
23:34:55FromDiscord<Elegantbeef> Ranges are checked values not slices
23:35:07FromDiscord<Elegantbeef> The result i'd argue in the above should always be a u8
23:35:22*flynn quit (Read error: Connection reset by peer)
23:35:27nrds<Prestige99> oh so the range is a type? uh
23:35:34FromDiscord<Elegantbeef> Simply cause in most cases you multiply a uint8 by a float it's related to colour or other conversion
23:35:36nrds<Prestige99> I'd argue float if it's an int * a float
23:35:39FromDiscord<Elegantbeef> Yes range is a checked value
23:36:09FromDiscord<Elegantbeef> And i'd say that's wrong cause in most cases with `uint8 0f..1f` you want a uint8 back 😛
23:36:22nrds<Prestige99> That's kind of subjective
23:36:35*flynn joined #nim
23:36:36nrds<Prestige99> from a languge design standpoint I'd just always have int * float return a float
23:36:43FromDiscord<Elegantbeef> As is this entire exercise
23:37:55nrds<Prestige99> Any operation with a decimal should result in a decimal imo
23:38:08nrds<Prestige99> And if you want to do something against the grain you can just cast, floor, etc
23:40:16*flynn quit (Remote host closed the connection)
23:41:29*flynn joined #nim
23:44:05nrds<Prestige99> hm you can't have like, a method iterator can you?
23:44:18FromDiscord<Elegantbeef> Like i said have a closure iteratorr
23:44:51nrds<Prestige99> a method that returns an iterator?
23:44:57FromDiscord<Elegantbeef> Yes
23:46:04*flynn quit (Read error: Connection reset by peer)
23:47:18*flynn joined #nim
23:47:42*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
23:48:56FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Wll
23:49:34nrds<Prestige99> neat
23:52:01*crem joined #nim
23:53:29FromDiscord<Elegantbeef> And of course you can make it an `iterator` that calls it
23:53:51*flynn quit (Read error: Connection reset by peer)
23:54:15FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Wln
23:55:04*flynn joined #nim
23:57:57FromDiscord<Elegantbeef> Soon enough prestige you'll be the one answering these questions for others! 😛