<< 19-11-2022 >>

00:01:07FromDiscord<Tuatarian> That's so strange
00:04:19FromDiscord<Elegantbeef> There is no difference
00:31:16*Jjp137 quit (Ping timeout: 252 seconds)
00:32:22*Jjp137 joined #nim
00:48:35FromDiscord<emanresu3> how can I get the realpath of a file in nim?
00:49:21FromDiscord<Elegantbeef> `absolutePath`
00:50:54FromDiscord<emanresu3> Thanks, but how can I get it to follow symlinks?
00:51:22FromDiscord<emanresu3> i mean get the canonical path
00:51:30FromDiscord<Elegantbeef> `expandSymLink`
00:51:44FromDiscord<Elegantbeef> Doesnt work on windows though
00:56:50FromDiscord<emanresu3> Thanks again! So I guess, to get a realpath of a file twice symlinked, I'd do `"path".expandSymlink.expandSymlink.absolutePath`
00:57:35FromDiscord<emanresu3> I'd be nice if there was a function in std/os that did this recursively already, is there not?
00:57:35FromDiscord<Elegantbeef> Expand symlink likely will return absolute
00:58:15FromDiscord<emanresu3> Oh weird, it returned me a relative one, I'll recheck
00:59:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggm
01:00:49FromDiscord<emanresu3> wait I think `expandFileName` is what I was looking for
01:01:29FromDiscord<Elegantbeef> Yea it follows symlinks
01:06:25FromDiscord<voidwalker> any working guide on how to get step by step debugging working in vscode ?
01:07:23FromDiscord<Yardanico> it just works ™️ if you compile with `--debugger:native` and use CodeLLDB (and point it to your binary file)
01:07:30FromDiscord<Yardanico> of course the variables would be far from perfect
01:07:34FromDiscord<Yardanico> i mean their contents
01:57:24FromDiscord<Yardanico> well lol
01:57:30FromDiscord<Yardanico> copilot can even help write lldb python scripts
03:26:46*arkurious quit (Quit: Leaving)
03:50:20*pbsds quit (Quit: The Lounge - https://thelounge.chat)
03:50:56*pbsds joined #nim
03:56:24*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
05:03:52*jmcantrell joined #nim
05:14:52FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4ggS
05:14:55FromDiscord<Tuatarian> wait nevermind
05:17:05FromDiscord<Tuatarian> it causes an error on my machine but on on the playground
05:17:41FromDiscord<Elegantbeef> Are you compiling it?
05:17:56FromDiscord<Tuatarian> on my machine?
05:17:57FromDiscord<Tuatarian> yes
05:18:05FromDiscord<Elegantbeef> What's the error?
05:18:11FromDiscord<Tuatarian> it works if I remove the return from the return
05:18:36FromDiscord<Tuatarian> `/home/tuatarian/code/Heaviside/heaviside.nim(19, 31) Error: expression 'return HvNum(isInt: true, iVal: -a.iVal)' has no type (or is ambiguous)`
05:18:57FromDiscord<Tuatarian> if I remove the word return and just put the value, it works
05:18:59FromDiscord<Tuatarian> otherwise it gives this error
05:19:05FromDiscord<Elegantbeef> sounds like you have only a return on a single branch
05:19:10FromDiscord<Tuatarian> no it's on both
05:19:13FromDiscord<Elegantbeef> Or are doing `return return`
05:19:14FromDiscord<Tuatarian> on the playground it works fine
05:19:25FromDiscord<Elegantbeef> Well what version of the compiler?
05:19:27FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfM
05:19:31FromDiscord<Tuatarian> 1.6.6
05:19:35FromDiscord<Tuatarian> tried devel but same issue
05:19:43FromDiscord<Elegantbeef> You have a borked PC
05:20:03FromDiscord<Tuatarian> lmao
05:20:22FromDiscord<Tuatarian> what do I do
05:20:35FromDiscord<Elegantbeef> remove your `.cache/nim`
05:20:42FromDiscord<Tuatarian> is it a folder?
05:20:55FromDiscord<Elegantbeef> yes
05:21:07FromDiscord<Tuatarian> same issue
05:21:08FromDiscord<Elegantbeef> Actually that shouldnt change anything
05:21:10FromDiscord<Tuatarian> I deleted the entire folder
05:21:11FromDiscord<Tuatarian> yeah
05:21:18NimEventerNew post on r/nim by Souckmycock: Does this community have something like Crates.io?, see https://reddit.com/r/nim/comments/yz4c7j/does_this_community_have_something_like_cratesio/
05:21:22FromDiscord<Elegantbeef> Reinstall nim
05:21:23FromDiscord<Tuatarian> compilation still instant, though it is a small amount of code
05:21:28FromDiscord<Tuatarian> I'm using choosenim
05:21:37FromDiscord<Tuatarian> is there an easy way to reinstall/uninstall via choosenim
05:21:54FromDiscord<Tuatarian> weirdly if I remove the `return` statement and just put the value, it works
05:21:58FromDiscord<Elegantbeef> `choosenim --help`
05:23:52FromDiscord<Tuatarian> so it won't remove the current nim version
05:24:01FromDiscord<Tuatarian> in theory this should be solved via switching verisons in choosenim right?>
05:24:03FromDiscord<Tuatarian> but that doesn't do it
05:28:24*jmcantrell quit (Quit: Reconnecting)
05:28:59*jmcantrell joined #nim
05:39:56*__jmcantrell__ joined #nim
05:40:15*__jmcantrell__ quit (Client Quit)
05:44:42*__jmcantrell__ joined #nim
05:44:57*__jmcantrell__ quit (Client Quit)
05:51:30FromDiscord<Tuatarian> how do i uninstall choosenim?
05:52:45FromDiscord<Tuatarian> wait beef
05:52:46FromDiscord<Tuatarian> beef
05:53:41FromDiscord<Elegantbeef> tuatara
05:53:56FromDiscord<Tuatarian> if i copy my code into playground
05:53:57FromDiscord<Tuatarian> it fails to compile
05:54:01FromDiscord<Tuatarian> no idea what the difference is though
05:54:03FromDiscord<Elegantbeef> Well send it here
05:54:14FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4ggX
05:54:24FromDiscord<Elegantbeef> you have a return in a template
05:54:30FromDiscord<Tuatarian> that's not allowed?
05:54:41FromDiscord<Elegantbeef> It's allowed but it pastes a `return` where it's pasted
05:54:45FromDiscord<Tuatarian> OH
05:54:51FromDiscord<Tuatarian> got it
05:54:51FromDiscord<Elegantbeef> so if you dont call it in a procedure it doesnt do what you want
05:55:01FromDiscord<Tuatarian> since i guess you're returning untyped, it returns the return statement
05:55:06FromDiscord<Tuatarian> wow that needs a better error message
05:55:14FromDiscord<Elegantbeef> I mean it told you
05:55:28FromDiscord<scarf> any library to read mp4 to each of its frame's raw buffer? (e.g array of RGB)
05:55:32FromDiscord<Tuatarian> `/usercode/in.nim(17, 31) Error: expression 'return HvNum(isInt: true, iVal: -a.iVal)' has no type (or is ambiguous)`
05:55:49FromDiscord<Tuatarian> frankly sounds more like you've failed to specify the type of something/some error with the way I've used my types
05:55:54FromDiscord<Elegantbeef> Yes `return X` has no type 😄
05:55:55FromDiscord<Tuatarian> as opposed to a template issue
05:55:58FromDiscord<Tuatarian> or a return being where it shouldn't be
05:56:04FromDiscord<Tuatarian> it's not wrong, but it is unhelpful
05:56:16FromDiscord<Elegantbeef> PR's welcome 😄
05:56:37FromDiscord<Tuatarian> I have no idea how to change/fix this kind of thing lmao
05:56:51FromDiscord<Tuatarian> should I post on forum/github/somewhere else?
05:56:53FromDiscord<Elegantbeef> It seems like the template indirection actually changes the error
05:56:57FromDiscord<Elegantbeef> `/usercode/in.nim(3, 5) Error: 'return' not allowed here`
05:57:05FromDiscord<Tuatarian> that would have been far more helpful
05:57:16FromDiscord<Tuatarian> I would have probably realized on my own with that as the error message
05:57:18FromDiscord<Elegantbeef> Errors the same
05:57:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggY
05:57:47FromDiscord<Elegantbeef> Oh right you're doing `return return`
05:58:42FromDiscord<Tuatarian> no I only had one return in the template
05:58:54FromDiscord<Elegantbeef> except you're calling it inside the proc
05:59:00FromDiscord<Elegantbeef> so you now have `return return`
05:59:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gh0
06:02:02FromDiscord<Tuatarian> yes
06:02:45FromDiscord<Tuatarian> I feel like `expected type X but return return whatever is of type untyped..,` would have been more helpful
06:02:47FromDiscord<huantian> this is the same issue that happens with await outside of async procs
06:02:48FromDiscord<Elegantbeef> Basically the compiler needs a check that the child of a `nkReturnStmt` is a `nkReturnStmt` if so error
06:04:40FromDiscord<Elegantbeef> Actually that might not even work
06:05:07FromDiscord<Elegantbeef> Cause the right hand of return needs to be an expression or nothing
06:06:05FromDiscord<Tuatarian> yeah
06:06:30FromDiscord<Tuatarian> I'm trying to think if somehow you can return a return statement in the context of higher order functions
06:06:34FromDiscord<Tuatarian> but I'm pretty sure it doesn't make sense
06:06:41FromDiscord<Elegantbeef> You cannot return a return
06:06:44FromDiscord<Tuatarian> yeah
06:07:01FromDiscord<Tuatarian> honestly, that doesn't even sound too bad to implement
06:07:09FromDiscord<huantian> I think there should be a series of checks, in general it should give "`expression` has no type, but return takes `type`"↵then if `expression` is of a common kind, eg return, it should add an extra hint
06:07:13FromDiscord<Tuatarian> might be able to make it my first contribution to nim language
06:07:59FromDiscord<Elegantbeef> Well clone the repo and then compile the min repo i gave you with `./koch temp c ./my.nim`
06:09:24FromDiscord<Elegantbeef> This gives you a stack trace of the error
06:09:43FromDiscord<Tuatarian> what is a min repo?
06:09:52FromDiscord<Elegantbeef> minimal reproduction
06:10:44FromDiscord<Rika> You missed an r
06:10:58FromDiscord<Elegantbeef> Yep
06:12:05FromDiscord<Elegantbeef> This isnt as easy to resolve as one would imagine, but it's a nice 'first issue'
06:13:18FromDiscord<Elegantbeef> The main crux is that the right side of a return is done through `semExprWithType`, and you do not know it's a return return until that expans
06:13:21FromDiscord<Elegantbeef> expands\
06:13:37FromDiscord<Elegantbeef> So you basically need to pass a flag that you're in a return statement just for this specific case
06:33:57NimEventerNew Nimble package! toposort - Efficient topological sort using Kahn's algorithm, see https://github.com/ryukoposting/toposort
06:33:57NimEventerNew Nimble package! resolver - Semver parser and dependency management tools, see https://github.com/ryukoposting/resolver
06:37:28FromDiscord<haxscramper> Someone is writing a new package manager it seems
06:42:48FromDiscord<huantian> That’s what the cool kids are doing these days ig
06:43:12FromDiscord<emanresu3> Is it a good coding practice to always write proc with var parameters and don't return; and when I do want to return from the proc, to use the `dup` macro?
06:43:22FromDiscord<huantian> No
06:43:34FromDiscord<emanresu3> Why not?
06:43:49FromDiscord<huantian> It’s more explicit to return exactly what you’re returning
06:43:59FromDiscord<huantian> Wow that’s horrible wording
06:44:20FromDiscord<huantian> Use var when you need to modify state, return when you want to give the user a result
06:44:28FromDiscord<emanresu3> So it's mainly just or legibility sake?
06:44:41FromDiscord<Tuatarian> most things are for legibility sake imo
06:44:51FromDiscord<Tuatarian> at least these kind of large-scope patterns
06:44:57FromDiscord<huantian> Yeah, returning vs var tells the programmer what the value means
06:45:13FromDiscord<huantian> In addition, by using dup you just add extra complexity that isn’t needed
06:45:51FromDiscord<emanresu3> Ok thanks, good to know
06:46:50FromDiscord<Elegantbeef> `dup` is good if you want to reduce code
06:47:01FromDiscord<Elegantbeef> If you have proc that operates in place but you want it to return
06:47:20FromDiscord<Elegantbeef> Whether you should make all your procs in place depends on the api
06:48:27FromDiscord<emanresu3> so in what kind of api would it make more sense to use in-place procs?
06:48:50FromDiscord<Elegantbeef> When you need to mutate an object
06:49:11FromDiscord<Elegantbeef> the main benefit of `dup` is to prevent the whole `sort` and `sorted` inside sequtils
06:49:23FromDiscord<Elegantbeef> You write the inplace then get the other for 'free'
06:50:40FromDiscord<emanresu3> Ok thanks for the advice
06:51:28FromDiscord<Elegantbeef> Sorry it's algorthims that `sort` and `sorted` are in isnt it 😄
06:52:08FromDiscord<emanresu3> I'd be nice if there was some sort of subtle distinction between the in-place proc and the non-in-place proc. Like for example Julia encourages to write in-place functions with a `!` at the end of the name, an non-inplace function without it
06:53:05FromDiscord<huantian> Yeah I think Nim went with the `sort` vs `sorted` naming convention
06:53:31FromDiscord<huantian> But I think it’d be hard to designate a specific symbol like ! for that in Nim tbo unfortunately
06:54:10FromDiscord<Elegantbeef> `sortInplace` is too wordy?! 😄
06:54:32NimEventerNew thread by ThomasTJdev: How to manually free/clear memory used by ref, see https://forum.nim-lang.org/t/9633
06:55:04FromDiscord<Elegantbeef> I had to snoop and seems they forked Nimble recently, so might be a case of they're adding proper dependency logic to Nimble, but who knows↵(@haxscramper)
06:55:07FromDiscord<huantian> In reply to @Elegantbeef "`sortInplace` is too wordy?!": We just need type interface for proc return and we can use overloading ez
06:55:29FromDiscord<Elegantbeef> I hate you
06:55:56FromDiscord<haxscramper> In reply to @Elegantbeef "I had to snoop": His website on GitHub is grub.pug, pubgrub is the name of dependency resolution algorithm
06:56:05FromDiscord<haxscramper> Site doesn't work though
06:56:31FromDiscord<Elegantbeef> Perhaps, too many people work in silence 😛
07:12:32FromDiscord<emanresu3> Btw why does Nim recommend to import all symbols in global scope `import module` instead of importing under the module's namespace `from module import nil`?
07:13:32FromDiscord<Elegantbeef> Cause UFCS exists
07:13:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gha
07:14:10FromDiscord<Elegantbeef> Module names arent really used for Nim unless you need to disambiguate
07:16:18FromDiscord<emanresu3> Oh I see, to importing all symbols makes chaining procs easier
07:17:30FromDiscord<emanresu3> And module's symbols are also called with dot syntax, so it would be illegible
07:18:30FromDiscord<emanresu3> Still, maybe another syntax for calling module's symbols would have been also another solution
07:19:27FromDiscord<emanresu3> I'm just importing too many modules in one big script and my names are collinding, I think at that point I should separate the script in other modules as well
07:19:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ghc
07:24:00*tiorock joined #nim
07:24:00*tiorock quit (Changing host)
07:24:00*tiorock joined #nim
07:24:00*rockcavera is now known as Guest8052
07:24:00*Guest8052 quit (Killed (silver.libera.chat (Nickname regained by services)))
07:24:00*tiorock is now known as rockcavera
07:29:18FromDiscord<MilesTheFox> What backends does Nim support?
07:29:39FromDiscord<Elegantbeef> C, C++, JS, Obj-C
07:29:50FromDiscord<MilesTheFox> Ohh, okayy
07:30:42FromDiscord<MilesTheFox> JS backend is... something like NodeJS app?
07:31:17FromDiscord<Elegantbeef> It generates JS
07:31:24FromDiscord<Elegantbeef> Where you run that JS is up to you
07:31:47FromDiscord<MilesTheFox> Browser can't execute system things
07:32:00FromDiscord<Elegantbeef> Nim doesnt have system things in the stdlib
07:32:30FromDiscord<MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghf
07:33:40FromDiscord<Elegantbeef> nativesockets arent wrapped for js
07:33:50FromDiscord<Elegantbeef> Not all of the stdlib works on JS
07:34:03FromDiscord<MilesTheFox> Okayy
07:34:15FromDiscord<ChocolettePalette> 😔
07:34:30FromDiscord<Elegantbeef> https://github.com/juancarlospaco/nodejs might help you
07:34:31FromDiscord<MilesTheFox> I just hate the fact that my app is detected as Win32/Wacatac. without any reason
07:35:34FromDiscord<MilesTheFox> In reply to @MilesTheFox "I just hate the": 3/26 AV detected it as malware
07:35:39FromDiscord<MilesTheFox> Including Windows Defender.
07:38:54FromDiscord<ChocolettePalette> There might be a malware inserting thing in the complier for real, I mean you never know until you audit all the code on your own
07:39:35FromDiscord<MilesTheFox> Malware on Linux... good joke
07:39:48FromDiscord<MilesTheFox> I update glibc and openssl almost every day
07:40:16FromDiscord<MilesTheFox> There's only 3 known Linux malware and 2 of them are DE-specific
07:40:32FromDiscord<MilesTheFox> 1 of them just inject itself via libc
07:41:36FromDiscord<Elegantbeef> Blame antivirus false positives are common for obscure compilers
07:42:05FromDiscord<dizzyliam [they/them]> In reply to @MilesTheFox "There's only 3 known": It's few but I doubt it's 3
07:42:15FromDiscord<MilesTheFox> In reply to @Elegantbeef "Blame antivirus false positives": What's wrong with GCC?
07:42:17FromDiscord<huantian> Yeah unfortunately there’s only so much we can do other than report tbe false positives
07:42:31FromDiscord<huantian> In reply to @MilesTheFox "What's wrong with GCC?": Who said anything was wrong with gov
07:42:35FromDiscord<huantian> (edit) "gov" => "gcc"
07:42:39FromDiscord<huantian> Dang autocorrect
07:42:46FromDiscord<MilesTheFox> In reply to @karma_corrections "It's few but I": 1. EvilGNOME or something like that↵2. I forgot↵3. I forgot
07:43:13FromDiscord<MilesTheFox> Second malware just wiped hard drive data
07:43:17FromDiscord<MilesTheFox> (edit) "wiped" => "wipes"
07:43:22FromDiscord<dizzyliam [they/them]> A server of mine once got malwared when I was still learning and not very good with security
07:44:08FromDiscord<dizzyliam [they/them]> I setup a user (without sudo luckily) with a low security password, accessible by SSH
07:44:12FromDiscord<Elegantbeef> Nim is an obscure compiler, it generates code that triggers a false positive
07:44:27FromDiscord<MilesTheFox> In reply to @Elegantbeef "Nim is an obscure": Oh...
07:44:32FromDiscord<huantian> In reply to @karma_corrections "I setup a user": Dang that’s unfortunate
07:44:46FromDiscord<huantian> How did you find that you got hacked lol
07:44:50FromDiscord<dizzyliam [they/them]> Next thing I got an email from my VPS provider saying it was using a lot of CPU
07:45:25FromDiscord<MilesTheFox> In reply to @karma_corrections "Next thing I got": Someone tried to compile Chromium on it 💀
07:45:44FromDiscord<dizzyliam [they/them]> Turns out there was a Monero miner pretending to be cron
07:46:21FromDiscord<MilesTheFox> In reply to @karma_corrections "Turns out there was": Or... Cron task that tried to compile Chromium? XD
07:46:26*TakinOver quit (Ping timeout: 256 seconds)
07:46:46FromDiscord<dizzyliam [they/them]> Well not a cron job - literally cron itself lol
07:46:57FromDiscord<MilesTheFox> LMAO
07:47:01FromDiscord<MilesTheFox> HAOW
07:47:23FromDiscord<MilesTheFox> Haow is that possible? XD
07:47:48FromDiscord<dizzyliam [they/them]> The process just called itself "cron"
07:47:56FromDiscord<MilesTheFox> XD
07:48:57FromDiscord<dizzyliam [they/them]> Controlled by IRC, looked like it was brute forcing other servers on the net to get into them the same way
07:49:28FromDiscord<MilesTheFox> HUH
07:49:32FromDiscord<MilesTheFox> IRC BOTNET
07:49:38FromDiscord<MilesTheFox> RARE
07:49:48FromDiscord<dizzyliam [they/them]> pretty common lol
07:49:51FromDiscord<ChocolettePalette> This is why I'm into Matrix
07:49:57FromDiscord<MilesTheFox> Send me this executable XD
07:50:10FromDiscord<MilesTheFox> In reply to @ChocolettePalette "This is why I'm": Matrix is bloated
07:50:19FromDiscord<Elegantbeef> You're using discord
07:50:23FromDiscord<MilesTheFox> My laptop can't run Moment
07:50:34FromDiscord<Elegantbeef> That argument holds water like a thimble
07:50:53FromDiscord<MilesTheFox> Matrix clients need good optimization
07:50:55FromDiscord<huantian> But a thimble has holes beef
07:51:08FromDiscord<Elegantbeef> Wow↵(@huantian)
07:51:12FromDiscord<huantian> In reply to @MilesTheFox "Matrix clients need good": At least element doesn’t lag like crazy on Linux
07:51:25FromDiscord<huantian> And matrix actually encourages you to make custom clients
07:51:31FromDiscord<huantian> Unlike discord which is all closed down
07:51:34FromDiscord<MilesTheFox> Moment is beautiful client, but... I'm running out of RAM when running it
07:51:51FromDiscord<dizzyliam [they/them]> I zipped up and saved what I could find of the malware before I wiped the VPS, not sure if I have it anymore though
07:52:15FromDiscord<Elegantbeef> What is moment?
07:52:21FromDiscord<MilesTheFox> In reply to @huantian "Unlike discord which is": Direct HTTP requests is good lightweight client XD
07:52:57FromDiscord<huantian> Ah yes I will use curl as my discord client
07:53:07FromDiscord<MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghj
07:53:13FromDiscord<MilesTheFox> In reply to @huantian "Ah yes I will": XD
07:54:21FromDiscord<MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghk
07:54:25FromDiscord<MilesTheFox> On X11 it requires compositor
07:55:28FromDiscord<Rika> i also had one of my vpses get a virus, i dont remember what it did
07:55:54FromDiscord<Rika> i never actually wiped the thing, just deactivated whatever it was using to keep running, so basically it prolly still has a backdoor somewhere in it
07:56:18FromDiscord<MilesTheFox> I never had any virus on my VPS, PC, laptop and phon
07:56:22FromDiscord<MilesTheFox> (edit) "phon" => "phone"
07:56:25FromDiscord<MilesTheFox> And tablet
07:56:30FromDiscord<Rika> wow congrats
07:56:37FromDiscord<MilesTheFox> I literally use Linux on all these devices
07:56:50FromDiscord<MilesTheFox> With mainline Zen kernel
07:57:27FromDiscord<Rika> okay
07:57:59FromDiscord<dizzyliam [they/them]> Oops just realised we've been having this chat on #main . Probably more #offtopic
07:58:21FromDiscord<MilesTheFox> Is #offtopic bridged to Internet Relay Chat?
07:58:46FromDiscord<dizzyliam [they/them]> Ye `#nim-offtopic`
07:58:56FromDiscord<MilesTheFox> Okayy
08:10:42FromDiscord<ShalokShalom> In reply to @MilesTheFox "What backends does Nim": There is also a direct llvm implementation
08:11:09FromDiscord<ShalokShalom> Not official https://github.com/arnetheduck/nlvm
08:11:45FromDiscord<ShalokShalom> In reply to @MilesTheFox "I never had any": You mean you didn't notice one.
08:59:08*pro joined #nim
08:59:18*pro left #nim (#nim)
09:02:09FromDiscord<dizzyliam [they/them]> Can you use generics with templates?
09:03:21FromDiscord<ChocolettePalette> Yes
09:46:12FromDiscord<dizzyliam [they/them]> In reply to @ChocolettePalette "Yes": Thanks. I just had an issue with the syntax I was using
09:58:18FromDiscord<emanresu3> when is Nim 2 expected to come out?
10:01:47*mahlon quit (Ping timeout: 248 seconds)
10:05:19*mahlon joined #nim
10:12:11FromDiscord<planetis> this year
10:48:44FromDiscord<ChocolettePalette> I wonder if Nim 2 will have lesser CO2 emission?
10:49:20FromDiscord<Rika> The amount of CO2 your computer emits is dependent on your energy provider and manufacturers
10:50:46FromDiscord<ChocolettePalette> Nim has GC which requires use of processor resources and therefore consumes more power in comparison to C programs↵(@Rika)
10:51:04FromDiscord<ChocolettePalette> Because there's no GC in C
10:51:13FromDiscord<Rika> In reply to @ChocolettePalette "Nim has GC which": And if your provider is carbon neutral then they would have equal emissions in theory
10:52:41FromDiscord<ChocolettePalette> These CO2 emission talks are all about making someone else responsible 😔
10:56:38FromDiscord<ShalokShalom> Yeah, I heard a talk from a Greenpeace representative
10:56:51FromDiscord<ShalokShalom> She explained, how they do more harm than good
10:57:41FromDiscord<Rika> I mean, yes there is something us normal people should do
10:57:46FromDiscord<ShalokShalom> Ultimately, it leads to flourishing places being bought and then kept as an asset.
10:58:04FromDiscord<ShalokShalom> That is, what CO2 emission offsets essentially do.
10:58:27FromDiscord<Rika> But I do not think that the effort to make Nim that much more carbon negative is the best effort for going against GW
10:58:48FromDiscord<ShalokShalom> In reply to @Rika "I mean, yes there": Looking at what causes the most emissions reveals that its not the peoples computers.
10:59:08FromDiscord<Rika> It’s mostly indoor climate control I believe for the average home
10:59:13FromDiscord<ShalokShalom> Server farms do emmit quite something.↵↵But it's still in a reasonable ratio..
10:59:14FromDiscord<Rika> And for in general it’s just companies
10:59:42FromDiscord<DarkSky> How do i square root a number?
10:59:42FromDiscord<Rika> What in companies, depends, there’s too much to discuss ngl and I’m kinda wanting to not really
10:59:54FromDiscord<Rika> In reply to @DarkSky "How do i square": Math module, sqrt
11:00:09FromDiscord<ShalokShalom> Unlike meat, transportation of goods over huge distances and heating /cooling for housing.
11:00:13FromDiscord<Rika> Meat
11:00:14FromDiscord<Rika> Yeah
11:00:18FromDiscord<DarkSky> In reply to @Rika "Math module, sqrt": thx
11:00:19FromDiscord<Rika> Hella crazy that one is
11:00:28FromDiscord<Rika> Last mile transport is too
11:00:30FromDiscord<ShalokShalom> Animal agriculture produces the most harm
11:00:51FromDiscord<ShalokShalom> On basically every metric it effects something
11:01:12FromDiscord<Rika> I’m not vegan or vegetarian ~~because I’d probably become hospital ridden if I tried so better that I don’t~~
11:01:32FromDiscord<ShalokShalom> I am vegan for 7 and vegetarian for 15 years.
11:01:59FromDiscord<Rika> The only meat I consume is chicken, and not because of voluntary choice
11:02:29FromDiscord<Rika> Anyway yeah
11:02:59FromDiscord<Rika> I don’t think it’s a good spending of effort trying to lessen Nim carbon emissions compared to what else
11:06:17FromDiscord<ChocolettePalette> To the C programming language↵(@Rika)
11:07:47*jjido joined #nim
11:10:22FromDiscord<Rika> By compared to what else, I mean compared to doing other things to reduce footprint
11:13:04FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4ghT
11:13:07FromDiscord<DarkSky> tried looking in the docs but couldn't find it
11:14:30FromDiscord<Rika> ?
11:14:38FromDiscord<DarkSky> functions
11:14:49FromDiscord<Rika> proc function () =↵ # code↵function()
11:15:00FromDiscord<Rika> (edit) "function ()" => "function()"
11:15:00FromDiscord<DarkSky> oooh thats interesting syntax lol
11:15:01FromDiscord<DarkSky> thx
11:15:10FromDiscord<Rika> It’s in the manual
11:15:41FromDiscord<DarkSky> i didnt realize that it was the same as a function
11:15:44FromDiscord<DarkSky> soryr
11:15:57FromDiscord<Rika> Well technically functions in Nim have a different definition
11:16:02FromDiscord<Rika> To Python functions
11:17:03FromDiscord<DarkSky> wdym?
11:17:49FromDiscord<Rika> Functions in Nim is not the same idea as functions in Python
11:18:18FromDiscord<Rika> Nim functions mean “procedures that should not touch global state”
11:18:26FromDiscord<Rika> Python functions are just Nim procedures iirc
11:19:10FromDiscord<Rika> In reply to @Rika "Python functions are just": If you don’t understand, just remember this one
11:21:23FromDiscord<Phil> In reply to @ChocolettePalette "To the C programming": You need to have the addendum:↵To efficient C code.↵I bet you more than just a little C code will be inefficient as hell because of difficulty that there is in writing C
11:24:08FromDiscord<DarkSky> In reply to @Rika "Python functions are just": I guess I'll have to go deeper into Nim to understand that lol
11:24:17FromDiscord<DarkSky> all the difference that I see for now is just the syntax
11:25:23FromDiscord<ShalokShalom> Python def is Nim proc
11:29:09FromDiscord<Phil> In reply to @DarkSky "I guess I'll have": The differentiation between "function" and "procedure" is a functional programming thing.↵Since you stem from python and didn't have to worry about that until now, you can proceed to just use `proc` instead of `def`↵If you want to dive deeper of what the differences between a function and a procedure are, you might want to look into first what a "side effect" is
11:29:11FromDiscord<ChocolettePalette> No, I will post my C code online and the C programmers will mock it and make fun of me, quoting the inefficient codeAnd I would take advantage of it ofc rewriting it, this is how it works↵(@Phil)
11:30:07FromDiscord<Phil> (edit) "In reply to @DarkSky "I guess I'll have": The differentiation between "function" and "procedure" is" => "sent" | "functional programming thing.↵Since you stem from python and didn't have to worry about that until now, you can proceed to just use `proc` instead of `def`↵If you want to dive deeper of what the differences between a function and a procedure are, you might want to look into first what a "side effect" is" => "long m
11:37:05FromDiscord<Rika> In reply to @ChocolettePalette "No, I will post": This man writes C code, he gets it
11:38:29FromDiscord<Phil> insert squint gif here
11:39:42FromDiscord<ShalokShalom> In reply to @Isofruit "The differentiation between "function"": The differentiation is actually older than programming
11:39:54FromDiscord<ShalokShalom> Imperative peeps were just ignoring that
11:40:29FromDiscord<ShalokShalom> Impure functions are not a thing, unless you just ignore of both terms were used from the start
11:48:31FromDiscord<.tochka> In reply to @Rika "I don’t think it’s": nim, probably, but i would argue optimizing energy efficiency of common js and python runtimes would be impactful, given how much they're ran
11:50:12FromDiscord<DarkSky> In reply to @Rika "This man writes C": I also write C code but I dislike the way Nim docs are structured, just an opinion tho
11:50:47FromDiscord<.tochka> In reply to @Rika "Python functions are just": not directly comparable i would say, as python treats them as objects also
11:52:01FromDiscord<ShalokShalom> In reply to @.tochka "nim, probably, but i": How far will you optimize js runtimes further?
11:52:20FromDiscord<ShalokShalom> Is there anything in the software world more optimized than that?
11:52:44FromDiscord<ShalokShalom> In reply to @DarkSky "I also write C": Yeah, Nims documentation system....
11:53:35FromDiscord<DarkSky> In reply to @ShalokShalom "Yeah, Nims documentation system....": I'd say the docs itself are a bit weird and besides that it's difficult to find answers on any other websites, since Nim isn't very popular compared to C or Python
11:53:46FromDiscord<DarkSky> hopefully Nim gains more attention in the future though
11:53:56FromDiscord<.tochka> In reply to @ShalokShalom "How far will you": cant really know where's the ceiling at, but yes, v8 is efficient. but mozilla's js is not as much
11:55:03FromDiscord<.tochka> nim docs be like just read the source :D
11:58:47FromDiscord<Rika> In reply to @.tochka "not directly comparable i": Nim has functions as values too though?
11:59:52FromDiscord<.tochka> on runtime they're just pointers
11:59:53FromDiscord<ShalokShalom> In reply to @.tochka "nim docs be like": What I hate the most is the search module
12:00:06FromDiscord<ShalokShalom> That's just like someone intentionally tries to make it bad
12:00:16FromDiscord<ShalokShalom> Just something like that doesnt happen on accident
12:00:18FromDiscord<Rika> In reply to @.tochka "on runtime they're just": Yeah and?
12:00:53FromDiscord<.tochka> In reply to @Rika "Yeah and?": you cant mutate and interspect that
12:01:08FromDiscord<Jessa> what would be the best way to call a multitude of functions by user input?↵↵like, the user inputs `multiply` and the function `multiply` is called without an if or case statement per function
12:01:50FromDiscord<Rika> In reply to @.tochka "you cant mutate and": I guess sure, the way Python does it yeah
12:02:02FromDiscord<Rika> That’s because Nim has a different philosophy on how to do that
12:02:44FromDiscord<Rika> In reply to @Jessa "what would be the": Write a macro for it pretty much
12:03:15FromDiscord<Rika> If your functions have the same call signature then you could put them all into a table and set them with a for loop or something but eh
12:04:19FromDiscord<ShalokShalom> I hear so often 'macros are a last resort kind of thing, dont overuse it' and at the same time, they are used for everything 😋
12:04:26FromDiscord<Jessa> they do not have the same signature↵↵and how would i use a macro for this, if i may ask?
12:04:54FromDiscord<Rika> You’d write a macro to make the if else calls
12:05:01FromDiscord<Rika> Calls? Statements
12:05:51FromDiscord<.tochka> In reply to @ShalokShalom "I hear so often": in nim? or in shadow of c/c++ mess
12:07:04FromDiscord<Jessa> In reply to @Rika "You’d write a macro": hah, i'd have to look up how to make macros then↵↵are they compile time, or can they be dynamic
12:08:32FromDiscord<ShalokShalom> In reply to @.tochka "in nim? or in": Nim
12:08:38FromDiscord<Rika> Compile time
12:09:44FromDiscord<Jessa> hm
12:09:59FromDiscord<Jessa> might not be what i need then↵as i want to dynamiically load things based on user inputs
12:11:01FromDiscord<Rika> Raw pointers
12:11:31FromDiscord<Rika> Or some other encapsulation to hide the typing by signature
12:30:39FromDiscord<b1rdf00d> do you mean like `eval` ?
12:32:36FromDiscord<Rika> No
12:32:42FromDiscord<Rika> Wait not for me
12:32:42FromDiscord<Rika> Lol
12:33:18FromDiscord<b1rdf00d> for Jessa "the user inputs 'multiply' and the function `multiply` is called "
12:35:32FromDiscord<Rika> I know, my bad
12:40:07FromDiscord<scarf> okay so it's about fourth time I'm making questions here but: any video (preferrably webm) library for nim?
12:43:46FromDiscord<Rika> Not any that I’m aware of, no
12:44:17FromDiscord<scarf> hecc, should I just use c/c++ interop
12:44:33FromDiscord<scarf> afaik nim-nestegg is broken, nim opencv is broken
12:44:35FromDiscord<Rika> You could, yes
12:45:30FromDiscord<scarf> ok, I'll try one last time with nimffmpeg before switching
13:03:14FromDiscord<scarf> how could i split string into four like `let (r,g,b,a) = "abcd"`
13:04:40FromDiscord<scarf> (edit) "could" => "do" | "doi split string into four ... likewith" added "then map into int" | "i split string into fourthen map into intlike `let (r,g,b,a) = "abcd"` ... " added "with sequtils?"
13:06:26FromDiscord<Rika> How long are these strings? Arbitrary?
13:06:53FromDiscord<scarf> In reply to @Rika "How long are these": they are char of length 4 disguised as string. I need to split them to each char, then I could map them into int
13:08:40FromDiscord<Rika> `theseq.mapIt(cast[int](it))` perhaps
13:09:02FromDiscord<Rika> prolly `cast[uint8]()` more of
13:09:18FromDiscord<dlesnoff> In reply to @scarf "they are char of": Did you add heading zeros ? It could give a fixed bit width
13:10:24FromDiscord<scarf> In reply to @Jiezron "Did you add heading": oh, I'm parsing png, and nimpng gives me 'rgba' N length of string to use
13:10:32FromDiscord<halc> sent a code paste, see https://play.nim-lang.org/#ix=4gie
13:17:36*krux02 joined #nim
13:17:47FromDiscord<scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gij
13:18:36FromDiscord<Rika> oh yeah you can convert normally from char to uint8 no
13:18:43FromDiscord<Rika> !eval echo 'a'.uint8
13:18:49NimBot97
13:19:08FromDiscord<Rika> yeah then its fine to do `theseq.mapIt(it.uint8)`
13:20:42FromDiscord<scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gil
13:22:35FromDiscord<ringabout> In reply to @halc "does the `locals()` proc": 1.6.8 or devel has fixed this problem
13:32:19FromDiscord<halc> In reply to @ringabout "1.6.8 or devel has": just updated and yup, you're right, thank you
13:33:31FromDiscord<ringabout> No problem
13:35:24FromDiscord<halc> I really wish I knew this proc existed before though, I had been needing something similar for a while and I only found it today by accident 😅
13:41:39NimEventerNew post on r/nim by Rupour: Is there a way to disable warnings for identifier names when compiling?, see https://reddit.com/r/nim/comments/yzc4k2/is_there_a_way_to_disable_warnings_for_identifier/
13:47:20FromDiscord<scarf> if only there was a way to stream webm as frames... https://media.discordapp.net/attachments/371759389889003532/1043522869285625926/image.png
13:48:13*derpydoo joined #nim
13:48:49FromDiscord<アサダ> sent a code paste, see https://play.nim-lang.org/#ix=4gip
13:53:59*arkurious joined #nim
13:58:11FromDiscord<hotdog> In reply to @アサダ "Hello! I have a": “echo Parent[1]().child.data.len” prints 3, which is correct?
14:04:23FromDiscord<アサダ> In reply to @hotdog "“echo Parent[1]().child.data.len” prints 3,": True. However, if you run the following program, the size of `data` will be 27. The only difference is that `Parent[3]` is present.↵The fact that `Parent[1]().child` is of type `Child[3 n]` appears to be a type inference failure.↵↵https://play.nim-lang.org/#ix=4git
14:06:18FromDiscord<scarf> are there something like universal `len` for `Slice[T]` for do I always use `foo.b - foo.a`
14:06:27FromDiscord<scarf> (edit) "for" => "or"
14:06:28*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
14:09:22FromDiscord<hotdog> In reply to @アサダ "True. However, if you": I see. Does seem like a bug. File an issue on GitHub
14:09:41FromDiscord<DarkSky> how can i check if an item is not in list?
14:09:59FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4giv
14:10:04FromDiscord<hotdog> In reply to @DarkSky "how can i check": “item notin list”
14:10:19FromDiscord<DarkSky> notin?
14:10:34FromDiscord<hotdog> In reply to @DarkSky "notin?": Ye
14:10:43FromDiscord<アサダ> In reply to @hotdog "I see. Does seem": Okay, thank you.
14:11:24FromDiscord<DarkSky> and how do i define an empty list? tried doing that but didnt owkr https://media.discordapp.net/attachments/371759389889003532/1043528928322658304/image.png https://media.discordapp.net/attachments/371759389889003532/1043528928662409286/image.png
14:11:45FromDiscord<DarkSky> (edit) "owkr" => "work"
14:12:28FromDiscord<hotdog> In reply to @DarkSky "and how do i": var primes = newSeq[int]()
14:12:37FromDiscord<hotdog> Or
14:12:47FromDiscord<DarkSky> In reply to @hotdog "var primes = newSeq[int]()": what does newSeq stand for?
14:12:52FromDiscord<hotdog> var primes: seq[int]
14:12:56FromDiscord<hotdog> Or
14:13:18FromDiscord<hotdog> var primes: seq[int] = @[]
14:13:32FromDiscord<hotdog> In reply to @DarkSky "what does newSeq stand": It’s a procedure to create a seq
14:13:50FromDiscord<DarkSky> ooh alr
14:14:10FromDiscord<hotdog> In reply to @DarkSky "what does newSeq stand": https://nim-lang.org/docs/system.html#newSeq
14:14:19FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4giy
14:14:35FromDiscord<DarkSky> In reply to @hotdog "https://nim-lang.org/docs/system.html#newSeq": yeah i saw it in the docs but didnt really get the reasoning behind it, thought it was like a naming thing lol
14:15:29FromDiscord<hotdog> In reply to @DarkSky "and how would I": https://nim-lang.org/docs/system.html#countup.i%2CT%2CT%2CPositive
14:16:31FromDiscord<hotdog> In reply to @DarkSky "yeah i saw it": You can set the length of the seq using it, which is helpful if you are going to set those entries later
14:16:41FromDiscord<hotdog> There is also newSeqOfCap
14:16:51FromDiscord<hotdog> Which sets capacity but not length
14:16:51FromDiscord<DarkSky> In reply to @hotdog "https://nim-lang.org/docs/system.html#countup.i%2CT": okee that worked thxx
14:16:59FromDiscord<DarkSky> i see
14:17:14FromDiscord<hotdog> In reply to @DarkSky "okee that worked thxx": No prob
14:20:05*jjido joined #nim
14:22:35FromDiscord<DarkSky> Nim `./prime 9.36s user 0.09s system 99% cpu 9.507 total`↵Python `python3 prime.py 133.44s user 0.34s system 98% cpu 2:15.68 total`
14:22:36FromDiscord<DarkSky> kek
14:22:50FromDiscord<DarkSky> tried comparing Python and Nim speeds
14:29:31FromDiscord<auxym> you can probably get it even faster with some tricks, eg. `-d:release`
14:30:18FromDiscord<auxym> or the extreme method: https://nim-lang.org/blog/2021/07/28/Nim-Efficient-Expressive-Elegant-Benchmarking.html
14:32:29*rockcavera quit (Remote host closed the connection)
14:36:07FromDiscord<Jessa> sent a code paste, see https://paste.rs/SLH
14:37:01FromDiscord<Generic> no, overloading in Nim only works based on the parameters
14:38:48FromDiscord<Jessa> how would i go about such a problem in that case
14:39:54FromDiscord<Generic> call them differently
14:40:22FromDiscord<Generic> toNumber isn't really a descriptive name in a programming language which properly distinguishes floating point numbers and integers anyway
14:40:29FromDiscord<Jessa> In reply to @Generic "toNumber isn't really a": It's an example
14:40:46FromDiscord<Generic> do you have a more practical example?
14:41:31FromDiscord<Jessa> moment
14:42:22FromDiscord<DarkSky> In reply to @auxym "you can probably get": yeah i did that
14:43:49FromDiscord<Jessa> In reply to @Generic "do you have a": Even though, that is basically exactly what i need to do, i do not know why the variable name is such a problem
14:45:38FromDiscord<Generic> well what you can also do is make the return type generic
14:46:58FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=4giH
14:47:24FromDiscord<Generic> you'd call this proc then with `toNumber[int]("meow")`
14:47:45FromDiscord<Generic> or `"meow".toNumber[:int]()`
14:48:21FromDiscord<Generic> if you can avoid duplicating some logic, this might be a good idea
14:48:32FromDiscord<Generic> (edit) "logic," => "logic by doing this,"
14:54:08FromDiscord<Jessa> but, if the string, in this case "int", or "float" is a user input-↵thiis wouldn't work, as you don't know it shoult be an int or float beforehand-
14:54:44FromDiscord<Jessa> this kind of a problem iis the main headscratcher for me, coming from python↵↵this is such a pain to deal with / learn how to not deal with
15:01:47FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4giV
15:02:23FromDiscord<Rika> Well sorry but this isn’t Python
15:02:41FromDiscord<Rika> You have to know the types before runtime
15:02:44FromDiscord<Rika> It’s a must
15:03:35FromDiscord<Jessa> Yes, i know
15:03:39FromDiscord<Rika> If you think it’s a good idea, you can have a number abstraction and have that handle the integer float difference and just return that
15:03:54FromDiscord<Jessa> and i'm wondering how i could reproduce the same functionalitiy in Nim
15:03:58FromDiscord<Jessa> (edit) "and i'm wondering how i could reproduce the same functionalitiy in Nim ... " added "as a learning experience"
15:04:03FromDiscord<Rika> I don’t think I can elaborate now because it’s late but hm
15:04:25FromDiscord<Jessa> however, so far, the solutions i've came up with, and from what i've found, is that i cannot reproduce it
15:04:36FromDiscord<scarf> maybe define `let user_input: int | float = ...`?
15:04:39FromDiscord<Rika> You can, I can explain but it’s late
15:04:57FromDiscord<Generic> in Nim you just need to have two code paths for different types
15:05:13FromDiscord<Generic> with generics and variant types etc. you can make this more pretty
15:05:21FromDiscord<Rika> Generic or whoever else, try explaining to them how they could use object variants to have runtime generics or so
15:05:24FromDiscord<Rika> Yeah
15:05:39FromDiscord<Rika> Thanks I’m gonna go experience temporary death for 8 hours good night lol
15:05:47FromDiscord<Jessa> the only way ii see this being reproducable, is to wrtite an if-statement everytime i want to call `toNumber` or it's float stuff variants
15:05:47FromDiscord<Generic> sleep well
15:06:25FromDiscord<Jessa> (edit) "" => "&"
15:06:28FromDiscord<Generic> that's basically what you do in statically typed languages
15:06:42FromDiscord<Jessa> that.. sounds horrible
15:06:54FromDiscord<Generic> in practice situations like this almost never occur
15:07:08FromDiscord<Jessa> maybe i'm doing something wrong then
15:07:42FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=4giW
15:07:45FromDiscord<Generic> what you can use is such a variant type
15:08:03FromDiscord<Generic> it's basically how Python implements every value internally
15:08:22FromDiscord<Generic> to pass around a value which could be of multiple different types
15:12:24FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4giY
15:13:50FromDiscord<Generic> what is this supposed to be when it's finished?
15:14:02FromDiscord<Generic> also how do you supply the parameters for the proc calls?
15:14:32FromDiscord<Jessa> In reply to @Generic "also how do you": that's a good question, hadn't even thought that far yet due to the fact i can't get thiis part done
15:14:52FromDiscord<auxym> you can't do that at runtime. consider using an OOP approach with inheritance, eg Strategy Pattern
15:15:10FromDiscord<Generic> yeah using inheritance is one way
15:15:23FromDiscord<Generic> you could also wrap the procs in closures
15:15:33FromDiscord<Generic> so they all have a common interface
15:15:57FromDiscord<Generic> but it's hard to give an answer without knowing for what you're doing this
15:16:24FromDiscord<hmmm> boiz what's the way of stringify a seq[int] into a seq[string]? $ gives back an entire string and map($) doesn't work 😦
15:16:49FromDiscord<scarf> In reply to @hmmm "boiz what's the way": mapIt($it)
15:16:52FromDiscord<Jessa> trying to make a program that loads in multiple dll's functions (also made with nim), and storing them in someway so the user can call either one of them, kind of like a custom shell way
15:16:59FromDiscord<hmmm> ❤️ u scarf
15:17:04FromDiscord<Generic> sent a code paste, see https://paste.rs/jLp
15:17:07FromDiscord<hmmm> oh really?
15:17:10FromDiscord<auxym> In reply to @scarf "mapIt($it)": yes
15:17:30FromDiscord<hmmm> map(`$`) why would this even work
15:17:33FromDiscord<Generic> In reply to @Jessa "trying to make a": oh ok I see
15:17:50FromDiscord<hmmm> but I'll go with the it for now, ty lovlies
15:18:40FromDiscord<Jessa> i'm used to beinig able to store function refferences in some kind of a dictionary to get them by key↵but, yeah, you can't store different types in nim
15:18:42FromDiscord<scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gj2
15:19:26FromDiscord<Generic> In reply to @scarf "they fail tho https://play.nim-lang.org/#ix=4gj1": weird, I would have thought it worked ¯\_(ツ)_/¯
15:20:45FromDiscord<Generic> In reply to @Jessa "i'm used to beinig": this is a pretty tricky project
15:21:22FromDiscord<Jessa> In reply to @Jessa "i'm used to beinig": though, i could indeedm ake it a generic type by storing the pointer & indentifier in a object, and then store it within an dictionary/table↵↵then just cast & call it with if-statements later down the line
15:21:23FromDiscord<Generic> you know the signatures of the functions you're wrapping in Nim code though?
15:21:24FromDiscord<Jessa> maybe that works
15:21:34FromDiscord<Jessa> In reply to @Generic "you know the signatures": Yes
15:21:55FromDiscord<Generic> ok well
15:22:01FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4gj4
15:22:31FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=4gj5
15:22:34FromDiscord<Generic> because false is the default value of type bool
15:23:15FromDiscord<DarkSky> In reply to @Generic "in this particular example": thankss
15:24:07FromDiscord<Generic> Jessa, what I'd do is to use variant type and a macro
15:24:19*derpydoo quit (Ping timeout: 260 seconds)
15:24:41FromDiscord<Generic> which wraps each of the DLL functions into a proc which takes a seq of the variant type, checks if the parameter count and types match
15:24:46FromDiscord<Generic> and then unpacks it
15:25:58FromDiscord<Jessa> i see
15:34:17FromDiscord<scarf> wonder if there could be compile time version of sequtils
15:34:34FromDiscord<scarf> something like arrayutils
15:43:54FromDiscord<.tochka> vm should be able to reason about sequences in static contexts i imagine
15:50:08FromDiscord<.tochka> https://media.discordapp.net/attachments/371759389889003532/1043553770291859516/image.png
16:15:48*kenran joined #nim
16:18:00*Jjp137 quit (Ping timeout: 260 seconds)
16:22:46FromDiscord<Yardanico> yes, and then you can convert it back to an array too
16:23:10NimEventerNew thread by dizzyliam: Pigeon 0.2, see https://forum.nim-lang.org/t/9635
16:25:27*kenran quit (Remote host closed the connection)
16:41:20*jmdaemon quit (Ping timeout: 260 seconds)
17:01:21*derpydoo joined #nim
17:12:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4gjF
17:24:02FromDiscord<auxym> In reply to @scarf "wonder if there could": have you tried zero? https://github.com/zero-functional/zero-functional
17:39:56*krux02 quit (Remote host closed the connection)
17:52:38*Jjp137 joined #nim
17:52:41ZevvI have two types, `ref object X of RootObj` and `ref object Y of X`. I can pass in instance of Y to a proc taking X as argument, and later convert it back to Y. But how can I tell if an X was originally an Y? Type info is there because the conversion to Y checks for this, but I want to know this beforehand. `mything is Y` returns false.
17:53:03*krux02 joined #nim
17:53:13Zevvinterestingly, I found my own forum post from 2018 asking the same question, unanwered: https://forum.nim-lang.org/t/4503
17:54:57Zevvoh wait. dang, totally ignore all of that please
17:55:11Zevvnot nimming for a year has made me forget parts of the language it seems. I'm good now.
18:25:27*oprypin quit (Ping timeout: 256 seconds)
18:50:58FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#ix=4gkb
18:54:26Zevvhttps://play.nim-lang.org/#ix=4gkb
18:54:36Zevvecho fmt"""Hello {names["Bob"]}"""
18:55:03Zevvhttps://nim-lang.org/docs/manual.html#lexical-analysis-triple-quoted-string-literals
18:55:48Zevvor escape your " with \", of course
19:15:22*krux02 quit (Quit: Leaving)
19:29:24*kenran joined #nim
19:29:26*kenran quit (Remote host closed the connection)
19:56:53*oprypin joined #nim
20:30:31*junaid_ joined #nim
20:46:37*junaid_ quit (Quit: leaving)
20:47:06*junaid_ joined #nim
20:50:01*junaid_ quit (Client Quit)
20:50:21*junaid_ joined #nim
20:52:09*junaid_ quit (Client Quit)
20:52:28*junaid_ joined #nim
20:58:43*junaid_ quit (Quit: leaving)
21:08:39*derpydoo quit (Ping timeout: 256 seconds)
21:10:15FromDiscord<Horizon [She/Her]> Why does this code not allow me to use `toHex` in a format string? I'm on the latest stable build of nim too https://hastebin.com/rikuyejunu.coffeescript
21:10:39FromDiscord<Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4gkR
21:27:18*jmdaemon joined #nim
21:32:30FromDiscord<auxym> because toHex isn't defined for uint8
21:33:28FromDiscord<Elegantbeef> https://nim-lang.org/docs/strutils.html#toHex%2CT↵(@auxym)
21:33:49FromDiscord<auxym> oops
21:34:21FromDiscord<Elegantbeef> really though why are we using fmt here
21:34:31FromDiscord<Elegantbeef> `echo "Opcode with value ", toHex(byte)`
21:45:53FromDiscord<dizzyliam [they/them]> https://media.discordapp.net/attachments/371759389889003532/1043643302450299011/Screenshot_20221120-104506_Firefox-01.jpeg
21:46:14FromDiscord<dizzyliam [they/them]> lol GitHub thinks my Nim library is written in JS?
21:46:43FromDiscord<dizzyliam [they/them]> There isn't a single line of JS in the whole thing
21:46:58FromDiscord<dizzyliam [they/them]> All .nim files
21:47:17FromDiscord<Elegantbeef> You have a test.js you didnt git ignore
21:47:22FromDiscord<Elegantbeef> It's 12k loc
21:48:22FromDiscord<dizzyliam [they/them]> Oh haha I see thanks
21:48:46FromDiscord<Yardanico> doing tg bots with telebot, it's mostly _fine_ but some things are _weird_
21:48:49FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1043644039456620605/image.png
21:48:53FromDiscord<Yardanico> telebot source code I mean
21:50:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gl5
22:37:49FromDiscord<Zuwa> I’m looking for resources teaching Nim on AWS or Google Cloud. Any leads/advice? Thanks
22:45:19FromDiscord<Horizon [She/Her]> In reply to @auxym "because toHex isn't defined": But it uses `SomeInteger`
22:46:17FromDiscord<Horizon [She/Her]> In reply to @Elegantbeef "really though why are": I was gonna have it be `echo "The opcode {toHex(byt)} isn't implemented! Please report it as an issue"` but yeah that's easier
22:46:43FromDiscord<Generic> hey you're creating an emulator?
22:47:07FromDiscord<Horizon [She/Her]> Me? Nah, I'm trying to work on a JVM bytecode manipulation and reader library in Nim
22:47:18FromDiscord<Generic> ah I remember
22:47:38FromDiscord<Horizon [She/Her]> Yeah xD
22:47:59FromDiscord<Horizon [She/Her]> It'll not only help me, but if i make bindings to other languages, i think it'll fill in quite a big gap
22:48:36FromDiscord<Horizon [She/Her]> Since the only proper java ASM libraries that exist is the ones written for the JVM, which obviously makes sense but doesn't work for my usecase aha
22:49:42FromDiscord<Elegantbeef> The `toHex` call should work so if you can make a minimal reproduction that'd be grand 😛
22:50:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glf
22:53:11FromDiscord<Horizon [She/Her]> That's... Really odd then
23:00:37FromDiscord<Horizon [She/Her]> What's a more idiomatic name for `Dup_x1` that's still somewhat close to the original?
23:00:53FromDiscord<Horizon [She/Her]> `Insert a copy of the top value into the stack two values from the top. value1 and value2 must not be of the type double or long.`
23:00:57FromDiscord<Horizon [She/Her]> that's the desc for it
23:03:43FromDiscord<Horizon [She/Her]> I'll just do `DupX1`
23:04:45FromDiscord<.tochka> what behavior would threadvar with destructor have?
23:05:00FromDiscord<Elegantbeef> Likely destructed when the thread is destroyed
23:10:31FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4gli
23:10:46FromDiscord<Elegantbeef> Use a single type definition
23:11:03FromDiscord<Elegantbeef> sorry type section
23:11:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/0LZ
23:11:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glj
23:12:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glk
23:12:32FromDiscord<etra> ooh, interesting, that worked, thanks Elegantbeef!
23:13:04FromDiscord<.tochka> sent a code paste, see https://paste.rs/uru