00:01:07 | FromDiscord | <Tuatarian> That's so strange |
00:04:19 | FromDiscord | <Elegantbeef> There is no difference |
00:31:16 | * | Jjp137 quit (Ping timeout: 252 seconds) |
00:32:22 | * | Jjp137 joined #nim |
00:48:35 | FromDiscord | <emanresu3> how can I get the realpath of a file in nim? |
00:49:21 | FromDiscord | <Elegantbeef> `absolutePath` |
00:50:54 | FromDiscord | <emanresu3> Thanks, but how can I get it to follow symlinks? |
00:51:22 | FromDiscord | <emanresu3> i mean get the canonical path |
00:51:30 | FromDiscord | <Elegantbeef> `expandSymLink` |
00:51:44 | FromDiscord | <Elegantbeef> Doesnt work on windows though |
00:56:50 | FromDiscord | <emanresu3> Thanks again! So I guess, to get a realpath of a file twice symlinked, I'd do `"path".expandSymlink.expandSymlink.absolutePath` |
00:57:35 | FromDiscord | <emanresu3> I'd be nice if there was a function in std/os that did this recursively already, is there not? |
00:57:35 | FromDiscord | <Elegantbeef> Expand symlink likely will return absolute |
00:58:15 | FromDiscord | <emanresu3> Oh weird, it returned me a relative one, I'll recheck |
00:59:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggm |
01:00:49 | FromDiscord | <emanresu3> wait I think `expandFileName` is what I was looking for |
01:01:29 | FromDiscord | <Elegantbeef> Yea it follows symlinks |
01:06:25 | FromDiscord | <voidwalker> any working guide on how to get step by step debugging working in vscode ? |
01:07:23 | FromDiscord | <Yardanico> it just works ™️ if you compile with `--debugger:native` and use CodeLLDB (and point it to your binary file) |
01:07:30 | FromDiscord | <Yardanico> of course the variables would be far from perfect |
01:07:34 | FromDiscord | <Yardanico> i mean their contents |
01:57:24 | FromDiscord | <Yardanico> well lol |
01:57:30 | FromDiscord | <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:52 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4ggS |
05:14:55 | FromDiscord | <Tuatarian> wait nevermind |
05:17:05 | FromDiscord | <Tuatarian> it causes an error on my machine but on on the playground |
05:17:41 | FromDiscord | <Elegantbeef> Are you compiling it? |
05:17:56 | FromDiscord | <Tuatarian> on my machine? |
05:17:57 | FromDiscord | <Tuatarian> yes |
05:18:05 | FromDiscord | <Elegantbeef> What's the error? |
05:18:11 | FromDiscord | <Tuatarian> it works if I remove the return from the return |
05:18:36 | FromDiscord | <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:57 | FromDiscord | <Tuatarian> if I remove the word return and just put the value, it works |
05:18:59 | FromDiscord | <Tuatarian> otherwise it gives this error |
05:19:05 | FromDiscord | <Elegantbeef> sounds like you have only a return on a single branch |
05:19:10 | FromDiscord | <Tuatarian> no it's on both |
05:19:13 | FromDiscord | <Elegantbeef> Or are doing `return return` |
05:19:14 | FromDiscord | <Tuatarian> on the playground it works fine |
05:19:25 | FromDiscord | <Elegantbeef> Well what version of the compiler? |
05:19:27 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4gfM |
05:19:31 | FromDiscord | <Tuatarian> 1.6.6 |
05:19:35 | FromDiscord | <Tuatarian> tried devel but same issue |
05:19:43 | FromDiscord | <Elegantbeef> You have a borked PC |
05:20:03 | FromDiscord | <Tuatarian> lmao |
05:20:22 | FromDiscord | <Tuatarian> what do I do |
05:20:35 | FromDiscord | <Elegantbeef> remove your `.cache/nim` |
05:20:42 | FromDiscord | <Tuatarian> is it a folder? |
05:20:55 | FromDiscord | <Elegantbeef> yes |
05:21:07 | FromDiscord | <Tuatarian> same issue |
05:21:08 | FromDiscord | <Elegantbeef> Actually that shouldnt change anything |
05:21:10 | FromDiscord | <Tuatarian> I deleted the entire folder |
05:21:11 | FromDiscord | <Tuatarian> yeah |
05:21:18 | NimEventer | New 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:22 | FromDiscord | <Elegantbeef> Reinstall nim |
05:21:23 | FromDiscord | <Tuatarian> compilation still instant, though it is a small amount of code |
05:21:28 | FromDiscord | <Tuatarian> I'm using choosenim |
05:21:37 | FromDiscord | <Tuatarian> is there an easy way to reinstall/uninstall via choosenim |
05:21:54 | FromDiscord | <Tuatarian> weirdly if I remove the `return` statement and just put the value, it works |
05:21:58 | FromDiscord | <Elegantbeef> `choosenim --help` |
05:23:52 | FromDiscord | <Tuatarian> so it won't remove the current nim version |
05:24:01 | FromDiscord | <Tuatarian> in theory this should be solved via switching verisons in choosenim right?> |
05:24:03 | FromDiscord | <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:30 | FromDiscord | <Tuatarian> how do i uninstall choosenim? |
05:52:45 | FromDiscord | <Tuatarian> wait beef |
05:52:46 | FromDiscord | <Tuatarian> beef |
05:53:41 | FromDiscord | <Elegantbeef> tuatara |
05:53:56 | FromDiscord | <Tuatarian> if i copy my code into playground |
05:53:57 | FromDiscord | <Tuatarian> it fails to compile |
05:54:01 | FromDiscord | <Tuatarian> no idea what the difference is though |
05:54:03 | FromDiscord | <Elegantbeef> Well send it here |
05:54:14 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4ggX |
05:54:24 | FromDiscord | <Elegantbeef> you have a return in a template |
05:54:30 | FromDiscord | <Tuatarian> that's not allowed? |
05:54:41 | FromDiscord | <Elegantbeef> It's allowed but it pastes a `return` where it's pasted |
05:54:45 | FromDiscord | <Tuatarian> OH |
05:54:51 | FromDiscord | <Tuatarian> got it |
05:54:51 | FromDiscord | <Elegantbeef> so if you dont call it in a procedure it doesnt do what you want |
05:55:01 | FromDiscord | <Tuatarian> since i guess you're returning untyped, it returns the return statement |
05:55:06 | FromDiscord | <Tuatarian> wow that needs a better error message |
05:55:14 | FromDiscord | <Elegantbeef> I mean it told you |
05:55:28 | FromDiscord | <scarf> any library to read mp4 to each of its frame's raw buffer? (e.g array of RGB) |
05:55:32 | FromDiscord | <Tuatarian> `/usercode/in.nim(17, 31) Error: expression 'return HvNum(isInt: true, iVal: -a.iVal)' has no type (or is ambiguous)` |
05:55:49 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> Yes `return X` has no type 😄 |
05:55:55 | FromDiscord | <Tuatarian> as opposed to a template issue |
05:55:58 | FromDiscord | <Tuatarian> or a return being where it shouldn't be |
05:56:04 | FromDiscord | <Tuatarian> it's not wrong, but it is unhelpful |
05:56:16 | FromDiscord | <Elegantbeef> PR's welcome 😄 |
05:56:37 | FromDiscord | <Tuatarian> I have no idea how to change/fix this kind of thing lmao |
05:56:51 | FromDiscord | <Tuatarian> should I post on forum/github/somewhere else? |
05:56:53 | FromDiscord | <Elegantbeef> It seems like the template indirection actually changes the error |
05:56:57 | FromDiscord | <Elegantbeef> `/usercode/in.nim(3, 5) Error: 'return' not allowed here` |
05:57:05 | FromDiscord | <Tuatarian> that would have been far more helpful |
05:57:16 | FromDiscord | <Tuatarian> I would have probably realized on my own with that as the error message |
05:57:18 | FromDiscord | <Elegantbeef> Errors the same |
05:57:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ggY |
05:57:47 | FromDiscord | <Elegantbeef> Oh right you're doing `return return` |
05:58:42 | FromDiscord | <Tuatarian> no I only had one return in the template |
05:58:54 | FromDiscord | <Elegantbeef> except you're calling it inside the proc |
05:59:00 | FromDiscord | <Elegantbeef> so you now have `return return` |
05:59:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gh0 |
06:02:02 | FromDiscord | <Tuatarian> yes |
06:02:45 | FromDiscord | <Tuatarian> I feel like `expected type X but return return whatever is of type untyped..,` would have been more helpful |
06:02:47 | FromDiscord | <huantian> this is the same issue that happens with await outside of async procs |
06:02:48 | FromDiscord | <Elegantbeef> Basically the compiler needs a check that the child of a `nkReturnStmt` is a `nkReturnStmt` if so error |
06:04:40 | FromDiscord | <Elegantbeef> Actually that might not even work |
06:05:07 | FromDiscord | <Elegantbeef> Cause the right hand of return needs to be an expression or nothing |
06:06:05 | FromDiscord | <Tuatarian> yeah |
06:06:30 | FromDiscord | <Tuatarian> I'm trying to think if somehow you can return a return statement in the context of higher order functions |
06:06:34 | FromDiscord | <Tuatarian> but I'm pretty sure it doesn't make sense |
06:06:41 | FromDiscord | <Elegantbeef> You cannot return a return |
06:06:44 | FromDiscord | <Tuatarian> yeah |
06:07:01 | FromDiscord | <Tuatarian> honestly, that doesn't even sound too bad to implement |
06:07:09 | FromDiscord | <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:13 | FromDiscord | <Tuatarian> might be able to make it my first contribution to nim language |
06:07:59 | FromDiscord | <Elegantbeef> Well clone the repo and then compile the min repo i gave you with `./koch temp c ./my.nim` |
06:09:24 | FromDiscord | <Elegantbeef> This gives you a stack trace of the error |
06:09:43 | FromDiscord | <Tuatarian> what is a min repo? |
06:09:52 | FromDiscord | <Elegantbeef> minimal reproduction |
06:10:44 | FromDiscord | <Rika> You missed an r |
06:10:58 | FromDiscord | <Elegantbeef> Yep |
06:12:05 | FromDiscord | <Elegantbeef> This isnt as easy to resolve as one would imagine, but it's a nice 'first issue' |
06:13:18 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> expands\ |
06:13:37 | FromDiscord | <Elegantbeef> So you basically need to pass a flag that you're in a return statement just for this specific case |
06:33:57 | NimEventer | New Nimble package! toposort - Efficient topological sort using Kahn's algorithm, see https://github.com/ryukoposting/toposort |
06:33:57 | NimEventer | New Nimble package! resolver - Semver parser and dependency management tools, see https://github.com/ryukoposting/resolver |
06:37:28 | FromDiscord | <haxscramper> Someone is writing a new package manager it seems |
06:42:48 | FromDiscord | <huantian> That’s what the cool kids are doing these days ig |
06:43:12 | FromDiscord | <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:22 | FromDiscord | <huantian> No |
06:43:34 | FromDiscord | <emanresu3> Why not? |
06:43:49 | FromDiscord | <huantian> It’s more explicit to return exactly what you’re returning |
06:43:59 | FromDiscord | <huantian> Wow that’s horrible wording |
06:44:20 | FromDiscord | <huantian> Use var when you need to modify state, return when you want to give the user a result |
06:44:28 | FromDiscord | <emanresu3> So it's mainly just or legibility sake? |
06:44:41 | FromDiscord | <Tuatarian> most things are for legibility sake imo |
06:44:51 | FromDiscord | <Tuatarian> at least these kind of large-scope patterns |
06:44:57 | FromDiscord | <huantian> Yeah, returning vs var tells the programmer what the value means |
06:45:13 | FromDiscord | <huantian> In addition, by using dup you just add extra complexity that isn’t needed |
06:45:51 | FromDiscord | <emanresu3> Ok thanks, good to know |
06:46:50 | FromDiscord | <Elegantbeef> `dup` is good if you want to reduce code |
06:47:01 | FromDiscord | <Elegantbeef> If you have proc that operates in place but you want it to return |
06:47:20 | FromDiscord | <Elegantbeef> Whether you should make all your procs in place depends on the api |
06:48:27 | FromDiscord | <emanresu3> so in what kind of api would it make more sense to use in-place procs? |
06:48:50 | FromDiscord | <Elegantbeef> When you need to mutate an object |
06:49:11 | FromDiscord | <Elegantbeef> the main benefit of `dup` is to prevent the whole `sort` and `sorted` inside sequtils |
06:49:23 | FromDiscord | <Elegantbeef> You write the inplace then get the other for 'free' |
06:50:40 | FromDiscord | <emanresu3> Ok thanks for the advice |
06:51:28 | FromDiscord | <Elegantbeef> Sorry it's algorthims that `sort` and `sorted` are in isnt it 😄 |
06:52:08 | FromDiscord | <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:05 | FromDiscord | <huantian> Yeah I think Nim went with the `sort` vs `sorted` naming convention |
06:53:31 | FromDiscord | <huantian> But I think it’d be hard to designate a specific symbol like ! for that in Nim tbo unfortunately |
06:54:10 | FromDiscord | <Elegantbeef> `sortInplace` is too wordy?! 😄 |
06:54:32 | NimEventer | New thread by ThomasTJdev: How to manually free/clear memory used by ref, see https://forum.nim-lang.org/t/9633 |
06:55:04 | FromDiscord | <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:07 | FromDiscord | <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:29 | FromDiscord | <Elegantbeef> I hate you |
06:55:56 | FromDiscord | <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:05 | FromDiscord | <haxscramper> Site doesn't work though |
06:56:31 | FromDiscord | <Elegantbeef> Perhaps, too many people work in silence 😛 |
07:12:32 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> Cause UFCS exists |
07:13:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gha |
07:14:10 | FromDiscord | <Elegantbeef> Module names arent really used for Nim unless you need to disambiguate |
07:16:18 | FromDiscord | <emanresu3> Oh I see, to importing all symbols makes chaining procs easier |
07:17:30 | FromDiscord | <emanresu3> And module's symbols are also called with dot syntax, so it would be illegible |
07:18:30 | FromDiscord | <emanresu3> Still, maybe another syntax for calling module's symbols would have been also another solution |
07:19:27 | FromDiscord | <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:40 | FromDiscord | <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:18 | FromDiscord | <MilesTheFox> What backends does Nim support? |
07:29:39 | FromDiscord | <Elegantbeef> C, C++, JS, Obj-C |
07:29:50 | FromDiscord | <MilesTheFox> Ohh, okayy |
07:30:42 | FromDiscord | <MilesTheFox> JS backend is... something like NodeJS app? |
07:31:17 | FromDiscord | <Elegantbeef> It generates JS |
07:31:24 | FromDiscord | <Elegantbeef> Where you run that JS is up to you |
07:31:47 | FromDiscord | <MilesTheFox> Browser can't execute system things |
07:32:00 | FromDiscord | <Elegantbeef> Nim doesnt have system things in the stdlib |
07:32:30 | FromDiscord | <MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghf |
07:33:40 | FromDiscord | <Elegantbeef> nativesockets arent wrapped for js |
07:33:50 | FromDiscord | <Elegantbeef> Not all of the stdlib works on JS |
07:34:03 | FromDiscord | <MilesTheFox> Okayy |
07:34:15 | FromDiscord | <ChocolettePalette> 😔 |
07:34:30 | FromDiscord | <Elegantbeef> https://github.com/juancarlospaco/nodejs might help you |
07:34:31 | FromDiscord | <MilesTheFox> I just hate the fact that my app is detected as Win32/Wacatac. without any reason |
07:35:34 | FromDiscord | <MilesTheFox> In reply to @MilesTheFox "I just hate the": 3/26 AV detected it as malware |
07:35:39 | FromDiscord | <MilesTheFox> Including Windows Defender. |
07:38:54 | FromDiscord | <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:35 | FromDiscord | <MilesTheFox> Malware on Linux... good joke |
07:39:48 | FromDiscord | <MilesTheFox> I update glibc and openssl almost every day |
07:40:16 | FromDiscord | <MilesTheFox> There's only 3 known Linux malware and 2 of them are DE-specific |
07:40:32 | FromDiscord | <MilesTheFox> 1 of them just inject itself via libc |
07:41:36 | FromDiscord | <Elegantbeef> Blame antivirus false positives are common for obscure compilers |
07:42:05 | FromDiscord | <dizzyliam [they/them]> In reply to @MilesTheFox "There's only 3 known": It's few but I doubt it's 3 |
07:42:15 | FromDiscord | <MilesTheFox> In reply to @Elegantbeef "Blame antivirus false positives": What's wrong with GCC? |
07:42:17 | FromDiscord | <huantian> Yeah unfortunately there’s only so much we can do other than report tbe false positives |
07:42:31 | FromDiscord | <huantian> In reply to @MilesTheFox "What's wrong with GCC?": Who said anything was wrong with gov |
07:42:35 | FromDiscord | <huantian> (edit) "gov" => "gcc" |
07:42:39 | FromDiscord | <huantian> Dang autocorrect |
07:42:46 | FromDiscord | <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:13 | FromDiscord | <MilesTheFox> Second malware just wiped hard drive data |
07:43:17 | FromDiscord | <MilesTheFox> (edit) "wiped" => "wipes" |
07:43:22 | FromDiscord | <dizzyliam [they/them]> A server of mine once got malwared when I was still learning and not very good with security |
07:44:08 | FromDiscord | <dizzyliam [they/them]> I setup a user (without sudo luckily) with a low security password, accessible by SSH |
07:44:12 | FromDiscord | <Elegantbeef> Nim is an obscure compiler, it generates code that triggers a false positive |
07:44:27 | FromDiscord | <MilesTheFox> In reply to @Elegantbeef "Nim is an obscure": Oh... |
07:44:32 | FromDiscord | <huantian> In reply to @karma_corrections "I setup a user": Dang that’s unfortunate |
07:44:46 | FromDiscord | <huantian> How did you find that you got hacked lol |
07:44:50 | FromDiscord | <dizzyliam [they/them]> Next thing I got an email from my VPS provider saying it was using a lot of CPU |
07:45:25 | FromDiscord | <MilesTheFox> In reply to @karma_corrections "Next thing I got": Someone tried to compile Chromium on it 💀 |
07:45:44 | FromDiscord | <dizzyliam [they/them]> Turns out there was a Monero miner pretending to be cron |
07:46:21 | FromDiscord | <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:46 | FromDiscord | <dizzyliam [they/them]> Well not a cron job - literally cron itself lol |
07:46:57 | FromDiscord | <MilesTheFox> LMAO |
07:47:01 | FromDiscord | <MilesTheFox> HAOW |
07:47:23 | FromDiscord | <MilesTheFox> Haow is that possible? XD |
07:47:48 | FromDiscord | <dizzyliam [they/them]> The process just called itself "cron" |
07:47:56 | FromDiscord | <MilesTheFox> XD |
07:48:57 | FromDiscord | <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:28 | FromDiscord | <MilesTheFox> HUH |
07:49:32 | FromDiscord | <MilesTheFox> IRC BOTNET |
07:49:38 | FromDiscord | <MilesTheFox> RARE |
07:49:48 | FromDiscord | <dizzyliam [they/them]> pretty common lol |
07:49:51 | FromDiscord | <ChocolettePalette> This is why I'm into Matrix |
07:49:57 | FromDiscord | <MilesTheFox> Send me this executable XD |
07:50:10 | FromDiscord | <MilesTheFox> In reply to @ChocolettePalette "This is why I'm": Matrix is bloated |
07:50:19 | FromDiscord | <Elegantbeef> You're using discord |
07:50:23 | FromDiscord | <MilesTheFox> My laptop can't run Moment |
07:50:34 | FromDiscord | <Elegantbeef> That argument holds water like a thimble |
07:50:53 | FromDiscord | <MilesTheFox> Matrix clients need good optimization |
07:50:55 | FromDiscord | <huantian> But a thimble has holes beef |
07:51:08 | FromDiscord | <Elegantbeef> Wow↵(@huantian) |
07:51:12 | FromDiscord | <huantian> In reply to @MilesTheFox "Matrix clients need good": At least element doesn’t lag like crazy on Linux |
07:51:25 | FromDiscord | <huantian> And matrix actually encourages you to make custom clients |
07:51:31 | FromDiscord | <huantian> Unlike discord which is all closed down |
07:51:34 | FromDiscord | <MilesTheFox> Moment is beautiful client, but... I'm running out of RAM when running it |
07:51:51 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> What is moment? |
07:52:21 | FromDiscord | <MilesTheFox> In reply to @huantian "Unlike discord which is": Direct HTTP requests is good lightweight client XD |
07:52:57 | FromDiscord | <huantian> Ah yes I will use curl as my discord client |
07:53:07 | FromDiscord | <MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghj |
07:53:13 | FromDiscord | <MilesTheFox> In reply to @huantian "Ah yes I will": XD |
07:54:21 | FromDiscord | <MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4ghk |
07:54:25 | FromDiscord | <MilesTheFox> On X11 it requires compositor |
07:55:28 | FromDiscord | <Rika> i also had one of my vpses get a virus, i dont remember what it did |
07:55:54 | FromDiscord | <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:18 | FromDiscord | <MilesTheFox> I never had any virus on my VPS, PC, laptop and phon |
07:56:22 | FromDiscord | <MilesTheFox> (edit) "phon" => "phone" |
07:56:25 | FromDiscord | <MilesTheFox> And tablet |
07:56:30 | FromDiscord | <Rika> wow congrats |
07:56:37 | FromDiscord | <MilesTheFox> I literally use Linux on all these devices |
07:56:50 | FromDiscord | <MilesTheFox> With mainline Zen kernel |
07:57:27 | FromDiscord | <Rika> okay |
07:57:59 | FromDiscord | <dizzyliam [they/them]> Oops just realised we've been having this chat on #main . Probably more #offtopic |
07:58:21 | FromDiscord | <MilesTheFox> Is #offtopic bridged to Internet Relay Chat? |
07:58:46 | FromDiscord | <dizzyliam [they/them]> Ye `#nim-offtopic` |
07:58:56 | FromDiscord | <MilesTheFox> Okayy |
08:10:42 | FromDiscord | <ShalokShalom> In reply to @MilesTheFox "What backends does Nim": There is also a direct llvm implementation |
08:11:09 | FromDiscord | <ShalokShalom> Not official https://github.com/arnetheduck/nlvm |
08:11:45 | FromDiscord | <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:09 | FromDiscord | <dizzyliam [they/them]> Can you use generics with templates? |
09:03:21 | FromDiscord | <ChocolettePalette> Yes |
09:46:12 | FromDiscord | <dizzyliam [they/them]> In reply to @ChocolettePalette "Yes": Thanks. I just had an issue with the syntax I was using |
09:58:18 | FromDiscord | <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:11 | FromDiscord | <planetis> this year |
10:48:44 | FromDiscord | <ChocolettePalette> I wonder if Nim 2 will have lesser CO2 emission? |
10:49:20 | FromDiscord | <Rika> The amount of CO2 your computer emits is dependent on your energy provider and manufacturers |
10:50:46 | FromDiscord | <ChocolettePalette> Nim has GC which requires use of processor resources and therefore consumes more power in comparison to C programs↵(@Rika) |
10:51:04 | FromDiscord | <ChocolettePalette> Because there's no GC in C |
10:51:13 | FromDiscord | <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:41 | FromDiscord | <ChocolettePalette> These CO2 emission talks are all about making someone else responsible 😔 |
10:56:38 | FromDiscord | <ShalokShalom> Yeah, I heard a talk from a Greenpeace representative |
10:56:51 | FromDiscord | <ShalokShalom> She explained, how they do more harm than good |
10:57:41 | FromDiscord | <Rika> I mean, yes there is something us normal people should do |
10:57:46 | FromDiscord | <ShalokShalom> Ultimately, it leads to flourishing places being bought and then kept as an asset. |
10:58:04 | FromDiscord | <ShalokShalom> That is, what CO2 emission offsets essentially do. |
10:58:27 | FromDiscord | <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:48 | FromDiscord | <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:08 | FromDiscord | <Rika> It’s mostly indoor climate control I believe for the average home |
10:59:13 | FromDiscord | <ShalokShalom> Server farms do emmit quite something.↵↵But it's still in a reasonable ratio.. |
10:59:14 | FromDiscord | <Rika> And for in general it’s just companies |
10:59:42 | FromDiscord | <DarkSky> How do i square root a number? |
10:59:42 | FromDiscord | <Rika> What in companies, depends, there’s too much to discuss ngl and I’m kinda wanting to not really |
10:59:54 | FromDiscord | <Rika> In reply to @DarkSky "How do i square": Math module, sqrt |
11:00:09 | FromDiscord | <ShalokShalom> Unlike meat, transportation of goods over huge distances and heating /cooling for housing. |
11:00:13 | FromDiscord | <Rika> Meat |
11:00:14 | FromDiscord | <Rika> Yeah |
11:00:18 | FromDiscord | <DarkSky> In reply to @Rika "Math module, sqrt": thx |
11:00:19 | FromDiscord | <Rika> Hella crazy that one is |
11:00:28 | FromDiscord | <Rika> Last mile transport is too |
11:00:30 | FromDiscord | <ShalokShalom> Animal agriculture produces the most harm |
11:00:51 | FromDiscord | <ShalokShalom> On basically every metric it effects something |
11:01:12 | FromDiscord | <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:32 | FromDiscord | <ShalokShalom> I am vegan for 7 and vegetarian for 15 years. |
11:01:59 | FromDiscord | <Rika> The only meat I consume is chicken, and not because of voluntary choice |
11:02:29 | FromDiscord | <Rika> Anyway yeah |
11:02:59 | FromDiscord | <Rika> I don’t think it’s a good spending of effort trying to lessen Nim carbon emissions compared to what else |
11:06:17 | FromDiscord | <ChocolettePalette> To the C programming language↵(@Rika) |
11:07:47 | * | jjido joined #nim |
11:10:22 | FromDiscord | <Rika> By compared to what else, I mean compared to doing other things to reduce footprint |
11:13:04 | FromDiscord | <DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4ghT |
11:13:07 | FromDiscord | <DarkSky> tried looking in the docs but couldn't find it |
11:14:30 | FromDiscord | <Rika> ? |
11:14:38 | FromDiscord | <DarkSky> functions |
11:14:49 | FromDiscord | <Rika> proc function () =↵ # code↵function() |
11:15:00 | FromDiscord | <Rika> (edit) "function ()" => "function()" |
11:15:00 | FromDiscord | <DarkSky> oooh thats interesting syntax lol |
11:15:01 | FromDiscord | <DarkSky> thx |
11:15:10 | FromDiscord | <Rika> It’s in the manual |
11:15:41 | FromDiscord | <DarkSky> i didnt realize that it was the same as a function |
11:15:44 | FromDiscord | <DarkSky> soryr |
11:15:57 | FromDiscord | <Rika> Well technically functions in Nim have a different definition |
11:16:02 | FromDiscord | <Rika> To Python functions |
11:17:03 | FromDiscord | <DarkSky> wdym? |
11:17:49 | FromDiscord | <Rika> Functions in Nim is not the same idea as functions in Python |
11:18:18 | FromDiscord | <Rika> Nim functions mean “procedures that should not touch global state” |
11:18:26 | FromDiscord | <Rika> Python functions are just Nim procedures iirc |
11:19:10 | FromDiscord | <Rika> In reply to @Rika "Python functions are just": If you don’t understand, just remember this one |
11:21:23 | FromDiscord | <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:08 | FromDiscord | <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:17 | FromDiscord | <DarkSky> all the difference that I see for now is just the syntax |
11:25:23 | FromDiscord | <ShalokShalom> Python def is Nim proc |
11:29:09 | FromDiscord | <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:11 | FromDiscord | <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:07 | FromDiscord | <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:05 | FromDiscord | <Rika> In reply to @ChocolettePalette "No, I will post": This man writes C code, he gets it |
11:38:29 | FromDiscord | <Phil> insert squint gif here |
11:39:42 | FromDiscord | <ShalokShalom> In reply to @Isofruit "The differentiation between "function"": The differentiation is actually older than programming |
11:39:54 | FromDiscord | <ShalokShalom> Imperative peeps were just ignoring that |
11:40:29 | FromDiscord | <ShalokShalom> Impure functions are not a thing, unless you just ignore of both terms were used from the start |
11:48:31 | FromDiscord | <.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:12 | FromDiscord | <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:47 | FromDiscord | <.tochka> In reply to @Rika "Python functions are just": not directly comparable i would say, as python treats them as objects also |
11:52:01 | FromDiscord | <ShalokShalom> In reply to @.tochka "nim, probably, but i": How far will you optimize js runtimes further? |
11:52:20 | FromDiscord | <ShalokShalom> Is there anything in the software world more optimized than that? |
11:52:44 | FromDiscord | <ShalokShalom> In reply to @DarkSky "I also write C": Yeah, Nims documentation system.... |
11:53:35 | FromDiscord | <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:46 | FromDiscord | <DarkSky> hopefully Nim gains more attention in the future though |
11:53:56 | FromDiscord | <.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:03 | FromDiscord | <.tochka> nim docs be like just read the source :D |
11:58:47 | FromDiscord | <Rika> In reply to @.tochka "not directly comparable i": Nim has functions as values too though? |
11:59:52 | FromDiscord | <.tochka> on runtime they're just pointers |
11:59:53 | FromDiscord | <ShalokShalom> In reply to @.tochka "nim docs be like": What I hate the most is the search module |
12:00:06 | FromDiscord | <ShalokShalom> That's just like someone intentionally tries to make it bad |
12:00:16 | FromDiscord | <ShalokShalom> Just something like that doesnt happen on accident |
12:00:18 | FromDiscord | <Rika> In reply to @.tochka "on runtime they're just": Yeah and? |
12:00:53 | FromDiscord | <.tochka> In reply to @Rika "Yeah and?": you cant mutate and interspect that |
12:01:08 | FromDiscord | <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:50 | FromDiscord | <Rika> In reply to @.tochka "you cant mutate and": I guess sure, the way Python does it yeah |
12:02:02 | FromDiscord | <Rika> That’s because Nim has a different philosophy on how to do that |
12:02:44 | FromDiscord | <Rika> In reply to @Jessa "what would be the": Write a macro for it pretty much |
12:03:15 | FromDiscord | <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:19 | FromDiscord | <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:26 | FromDiscord | <Jessa> they do not have the same signature↵↵and how would i use a macro for this, if i may ask? |
12:04:54 | FromDiscord | <Rika> You’d write a macro to make the if else calls |
12:05:01 | FromDiscord | <Rika> Calls? Statements |
12:05:51 | FromDiscord | <.tochka> In reply to @ShalokShalom "I hear so often": in nim? or in shadow of c/c++ mess |
12:07:04 | FromDiscord | <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:32 | FromDiscord | <ShalokShalom> In reply to @.tochka "in nim? or in": Nim |
12:08:38 | FromDiscord | <Rika> Compile time |
12:09:44 | FromDiscord | <Jessa> hm |
12:09:59 | FromDiscord | <Jessa> might not be what i need then↵as i want to dynamiically load things based on user inputs |
12:11:01 | FromDiscord | <Rika> Raw pointers |
12:11:31 | FromDiscord | <Rika> Or some other encapsulation to hide the typing by signature |
12:30:39 | FromDiscord | <b1rdf00d> do you mean like `eval` ? |
12:32:36 | FromDiscord | <Rika> No |
12:32:42 | FromDiscord | <Rika> Wait not for me |
12:32:42 | FromDiscord | <Rika> Lol |
12:33:18 | FromDiscord | <b1rdf00d> for Jessa "the user inputs 'multiply' and the function `multiply` is called " |
12:35:32 | FromDiscord | <Rika> I know, my bad |
12:40:07 | FromDiscord | <scarf> okay so it's about fourth time I'm making questions here but: any video (preferrably webm) library for nim? |
12:43:46 | FromDiscord | <Rika> Not any that I’m aware of, no |
12:44:17 | FromDiscord | <scarf> hecc, should I just use c/c++ interop |
12:44:33 | FromDiscord | <scarf> afaik nim-nestegg is broken, nim opencv is broken |
12:44:35 | FromDiscord | <Rika> You could, yes |
12:45:30 | FromDiscord | <scarf> ok, I'll try one last time with nimffmpeg before switching |
13:03:14 | FromDiscord | <scarf> how could i split string into four like `let (r,g,b,a) = "abcd"` |
13:04:40 | FromDiscord | <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:26 | FromDiscord | <Rika> How long are these strings? Arbitrary? |
13:06:53 | FromDiscord | <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:40 | FromDiscord | <Rika> `theseq.mapIt(cast[int](it))` perhaps |
13:09:02 | FromDiscord | <Rika> prolly `cast[uint8]()` more of |
13:09:18 | FromDiscord | <dlesnoff> In reply to @scarf "they are char of": Did you add heading zeros ? It could give a fixed bit width |
13:10:24 | FromDiscord | <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:32 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=4gie |
13:17:36 | * | krux02 joined #nim |
13:17:47 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gij |
13:18:36 | FromDiscord | <Rika> oh yeah you can convert normally from char to uint8 no |
13:18:43 | FromDiscord | <Rika> !eval echo 'a'.uint8 |
13:18:49 | NimBot | 97 |
13:19:08 | FromDiscord | <Rika> yeah then its fine to do `theseq.mapIt(it.uint8)` |
13:20:42 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gil |
13:22:35 | FromDiscord | <ringabout> In reply to @halc "does the `locals()` proc": 1.6.8 or devel has fixed this problem |
13:32:19 | FromDiscord | <halc> In reply to @ringabout "1.6.8 or devel has": just updated and yup, you're right, thank you |
13:33:31 | FromDiscord | <ringabout> No problem |
13:35:24 | FromDiscord | <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:39 | NimEventer | New 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:20 | FromDiscord | <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:49 | FromDiscord | <アサダ> sent a code paste, see https://play.nim-lang.org/#ix=4gip |
13:53:59 | * | arkurious joined #nim |
13:58:11 | FromDiscord | <hotdog> In reply to @アサダ "Hello! I have a": “echo Parent[1]().child.data.len” prints 3, which is correct? |
14:04:23 | FromDiscord | <アサダ> 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:18 | FromDiscord | <scarf> are there something like universal `len` for `Slice[T]` for do I always use `foo.b - foo.a` |
14:06:27 | FromDiscord | <scarf> (edit) "for" => "or" |
14:06:28 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
14:09:22 | FromDiscord | <hotdog> In reply to @アサダ "True. However, if you": I see. Does seem like a bug. File an issue on GitHub |
14:09:41 | FromDiscord | <DarkSky> how can i check if an item is not in list? |
14:09:59 | FromDiscord | <DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4giv |
14:10:04 | FromDiscord | <hotdog> In reply to @DarkSky "how can i check": “item notin list” |
14:10:19 | FromDiscord | <DarkSky> notin? |
14:10:34 | FromDiscord | <hotdog> In reply to @DarkSky "notin?": Ye |
14:10:43 | FromDiscord | <アサダ> In reply to @hotdog "I see. Does seem": Okay, thank you. |
14:11:24 | FromDiscord | <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:45 | FromDiscord | <DarkSky> (edit) "owkr" => "work" |
14:12:28 | FromDiscord | <hotdog> In reply to @DarkSky "and how do i": var primes = newSeq[int]() |
14:12:37 | FromDiscord | <hotdog> Or |
14:12:47 | FromDiscord | <DarkSky> In reply to @hotdog "var primes = newSeq[int]()": what does newSeq stand for? |
14:12:52 | FromDiscord | <hotdog> var primes: seq[int] |
14:12:56 | FromDiscord | <hotdog> Or |
14:13:18 | FromDiscord | <hotdog> var primes: seq[int] = @[] |
14:13:32 | FromDiscord | <hotdog> In reply to @DarkSky "what does newSeq stand": It’s a procedure to create a seq |
14:13:50 | FromDiscord | <DarkSky> ooh alr |
14:14:10 | FromDiscord | <hotdog> In reply to @DarkSky "what does newSeq stand": https://nim-lang.org/docs/system.html#newSeq |
14:14:19 | FromDiscord | <DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4giy |
14:14:35 | FromDiscord | <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:29 | FromDiscord | <hotdog> In reply to @DarkSky "and how would I": https://nim-lang.org/docs/system.html#countup.i%2CT%2CT%2CPositive |
14:16:31 | FromDiscord | <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:41 | FromDiscord | <hotdog> There is also newSeqOfCap |
14:16:51 | FromDiscord | <hotdog> Which sets capacity but not length |
14:16:51 | FromDiscord | <DarkSky> In reply to @hotdog "https://nim-lang.org/docs/system.html#countup.i%2CT": okee that worked thxx |
14:16:59 | FromDiscord | <DarkSky> i see |
14:17:14 | FromDiscord | <hotdog> In reply to @DarkSky "okee that worked thxx": No prob |
14:20:05 | * | jjido joined #nim |
14:22:35 | FromDiscord | <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:36 | FromDiscord | <DarkSky> kek |
14:22:50 | FromDiscord | <DarkSky> tried comparing Python and Nim speeds |
14:29:31 | FromDiscord | <auxym> you can probably get it even faster with some tricks, eg. `-d:release` |
14:30:18 | FromDiscord | <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:07 | FromDiscord | <Jessa> sent a code paste, see https://paste.rs/SLH |
14:37:01 | FromDiscord | <Generic> no, overloading in Nim only works based on the parameters |
14:38:48 | FromDiscord | <Jessa> how would i go about such a problem in that case |
14:39:54 | FromDiscord | <Generic> call them differently |
14:40:22 | FromDiscord | <Generic> toNumber isn't really a descriptive name in a programming language which properly distinguishes floating point numbers and integers anyway |
14:40:29 | FromDiscord | <Jessa> In reply to @Generic "toNumber isn't really a": It's an example |
14:40:46 | FromDiscord | <Generic> do you have a more practical example? |
14:41:31 | FromDiscord | <Jessa> moment |
14:42:22 | FromDiscord | <DarkSky> In reply to @auxym "you can probably get": yeah i did that |
14:43:49 | FromDiscord | <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:38 | FromDiscord | <Generic> well what you can also do is make the return type generic |
14:46:58 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4giH |
14:47:24 | FromDiscord | <Generic> you'd call this proc then with `toNumber[int]("meow")` |
14:47:45 | FromDiscord | <Generic> or `"meow".toNumber[:int]()` |
14:48:21 | FromDiscord | <Generic> if you can avoid duplicating some logic, this might be a good idea |
14:48:32 | FromDiscord | <Generic> (edit) "logic," => "logic by doing this," |
14:54:08 | FromDiscord | <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:44 | FromDiscord | <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:47 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4giV |
15:02:23 | FromDiscord | <Rika> Well sorry but this isn’t Python |
15:02:41 | FromDiscord | <Rika> You have to know the types before runtime |
15:02:44 | FromDiscord | <Rika> It’s a must |
15:03:35 | FromDiscord | <Jessa> Yes, i know |
15:03:39 | FromDiscord | <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:54 | FromDiscord | <Jessa> and i'm wondering how i could reproduce the same functionalitiy in Nim |
15:03:58 | FromDiscord | <Jessa> (edit) "and i'm wondering how i could reproduce the same functionalitiy in Nim ... " added "as a learning experience" |
15:04:03 | FromDiscord | <Rika> I don’t think I can elaborate now because it’s late but hm |
15:04:25 | FromDiscord | <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:36 | FromDiscord | <scarf> maybe define `let user_input: int | float = ...`? |
15:04:39 | FromDiscord | <Rika> You can, I can explain but it’s late |
15:04:57 | FromDiscord | <Generic> in Nim you just need to have two code paths for different types |
15:05:13 | FromDiscord | <Generic> with generics and variant types etc. you can make this more pretty |
15:05:21 | FromDiscord | <Rika> Generic or whoever else, try explaining to them how they could use object variants to have runtime generics or so |
15:05:24 | FromDiscord | <Rika> Yeah |
15:05:39 | FromDiscord | <Rika> Thanks I’m gonna go experience temporary death for 8 hours good night lol |
15:05:47 | FromDiscord | <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:47 | FromDiscord | <Generic> sleep well |
15:06:25 | FromDiscord | <Jessa> (edit) "" => "&" |
15:06:28 | FromDiscord | <Generic> that's basically what you do in statically typed languages |
15:06:42 | FromDiscord | <Jessa> that.. sounds horrible |
15:06:54 | FromDiscord | <Generic> in practice situations like this almost never occur |
15:07:08 | FromDiscord | <Jessa> maybe i'm doing something wrong then |
15:07:42 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4giW |
15:07:45 | FromDiscord | <Generic> what you can use is such a variant type |
15:08:03 | FromDiscord | <Generic> it's basically how Python implements every value internally |
15:08:22 | FromDiscord | <Generic> to pass around a value which could be of multiple different types |
15:12:24 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4giY |
15:13:50 | FromDiscord | <Generic> what is this supposed to be when it's finished? |
15:14:02 | FromDiscord | <Generic> also how do you supply the parameters for the proc calls? |
15:14:32 | FromDiscord | <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:52 | FromDiscord | <auxym> you can't do that at runtime. consider using an OOP approach with inheritance, eg Strategy Pattern |
15:15:10 | FromDiscord | <Generic> yeah using inheritance is one way |
15:15:23 | FromDiscord | <Generic> you could also wrap the procs in closures |
15:15:33 | FromDiscord | <Generic> so they all have a common interface |
15:15:57 | FromDiscord | <Generic> but it's hard to give an answer without knowing for what you're doing this |
15:16:24 | FromDiscord | <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:49 | FromDiscord | <scarf> In reply to @hmmm "boiz what's the way": mapIt($it) |
15:16:52 | FromDiscord | <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:59 | FromDiscord | <hmmm> ❤️ u scarf |
15:17:04 | FromDiscord | <Generic> sent a code paste, see https://paste.rs/jLp |
15:17:07 | FromDiscord | <hmmm> oh really? |
15:17:10 | FromDiscord | <auxym> In reply to @scarf "mapIt($it)": yes |
15:17:30 | FromDiscord | <hmmm> map(`$`) why would this even work |
15:17:33 | FromDiscord | <Generic> In reply to @Jessa "trying to make a": oh ok I see |
15:17:50 | FromDiscord | <hmmm> but I'll go with the it for now, ty lovlies |
15:18:40 | FromDiscord | <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:42 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4gj2 |
15:19:26 | FromDiscord | <Generic> In reply to @scarf "they fail tho https://play.nim-lang.org/#ix=4gj1": weird, I would have thought it worked ¯\_(ツ)_/¯ |
15:20:45 | FromDiscord | <Generic> In reply to @Jessa "i'm used to beinig": this is a pretty tricky project |
15:21:22 | FromDiscord | <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:23 | FromDiscord | <Generic> you know the signatures of the functions you're wrapping in Nim code though? |
15:21:24 | FromDiscord | <Jessa> maybe that works |
15:21:34 | FromDiscord | <Jessa> In reply to @Generic "you know the signatures": Yes |
15:21:55 | FromDiscord | <Generic> ok well |
15:22:01 | FromDiscord | <DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4gj4 |
15:22:31 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4gj5 |
15:22:34 | FromDiscord | <Generic> because false is the default value of type bool |
15:23:15 | FromDiscord | <DarkSky> In reply to @Generic "in this particular example": thankss |
15:24:07 | FromDiscord | <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:41 | FromDiscord | <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:46 | FromDiscord | <Generic> and then unpacks it |
15:25:58 | FromDiscord | <Jessa> i see |
15:34:17 | FromDiscord | <scarf> wonder if there could be compile time version of sequtils |
15:34:34 | FromDiscord | <scarf> something like arrayutils |
15:43:54 | FromDiscord | <.tochka> vm should be able to reason about sequences in static contexts i imagine |
15:50:08 | FromDiscord | <.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:46 | FromDiscord | <Yardanico> yes, and then you can convert it back to an array too |
16:23:10 | NimEventer | New 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:06 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4gjF |
17:24:02 | FromDiscord | <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:41 | Zevv | I 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:13 | Zevv | interestingly, I found my own forum post from 2018 asking the same question, unanwered: https://forum.nim-lang.org/t/4503 |
17:54:57 | Zevv | oh wait. dang, totally ignore all of that please |
17:55:11 | Zevv | not 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:58 | FromDiscord | <tsoj> sent a code paste, see https://play.nim-lang.org/#ix=4gkb |
18:54:26 | Zevv | https://play.nim-lang.org/#ix=4gkb |
18:54:36 | Zevv | echo fmt"""Hello {names["Bob"]}""" |
18:55:03 | Zevv | https://nim-lang.org/docs/manual.html#lexical-analysis-triple-quoted-string-literals |
18:55:48 | Zevv | or 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:15 | FromDiscord | <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:39 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4gkR |
21:27:18 | * | jmdaemon joined #nim |
21:32:30 | FromDiscord | <auxym> because toHex isn't defined for uint8 |
21:33:28 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/strutils.html#toHex%2CT↵(@auxym) |
21:33:49 | FromDiscord | <auxym> oops |
21:34:21 | FromDiscord | <Elegantbeef> really though why are we using fmt here |
21:34:31 | FromDiscord | <Elegantbeef> `echo "Opcode with value ", toHex(byte)` |
21:45:53 | FromDiscord | <dizzyliam [they/them]> https://media.discordapp.net/attachments/371759389889003532/1043643302450299011/Screenshot_20221120-104506_Firefox-01.jpeg |
21:46:14 | FromDiscord | <dizzyliam [they/them]> lol GitHub thinks my Nim library is written in JS? |
21:46:43 | FromDiscord | <dizzyliam [they/them]> There isn't a single line of JS in the whole thing |
21:46:58 | FromDiscord | <dizzyliam [they/them]> All .nim files |
21:47:17 | FromDiscord | <Elegantbeef> You have a test.js you didnt git ignore |
21:47:22 | FromDiscord | <Elegantbeef> It's 12k loc |
21:48:22 | FromDiscord | <dizzyliam [they/them]> Oh haha I see thanks |
21:48:46 | FromDiscord | <Yardanico> doing tg bots with telebot, it's mostly _fine_ but some things are _weird_ |
21:48:49 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1043644039456620605/image.png |
21:48:53 | FromDiscord | <Yardanico> telebot source code I mean |
21:50:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gl5 |
22:37:49 | FromDiscord | <Zuwa> I’m looking for resources teaching Nim on AWS or Google Cloud. Any leads/advice? Thanks |
22:45:19 | FromDiscord | <Horizon [She/Her]> In reply to @auxym "because toHex isn't defined": But it uses `SomeInteger` |
22:46:17 | FromDiscord | <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:43 | FromDiscord | <Generic> hey you're creating an emulator? |
22:47:07 | FromDiscord | <Horizon [She/Her]> Me? Nah, I'm trying to work on a JVM bytecode manipulation and reader library in Nim |
22:47:18 | FromDiscord | <Generic> ah I remember |
22:47:38 | FromDiscord | <Horizon [She/Her]> Yeah xD |
22:47:59 | FromDiscord | <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:36 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> The `toHex` call should work so if you can make a minimal reproduction that'd be grand 😛 |
22:50:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glf |
22:53:11 | FromDiscord | <Horizon [She/Her]> That's... Really odd then |
23:00:37 | FromDiscord | <Horizon [She/Her]> What's a more idiomatic name for `Dup_x1` that's still somewhat close to the original? |
23:00:53 | FromDiscord | <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:57 | FromDiscord | <Horizon [She/Her]> that's the desc for it |
23:03:43 | FromDiscord | <Horizon [She/Her]> I'll just do `DupX1` |
23:04:45 | FromDiscord | <.tochka> what behavior would threadvar with destructor have? |
23:05:00 | FromDiscord | <Elegantbeef> Likely destructed when the thread is destroyed |
23:10:31 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4gli |
23:10:46 | FromDiscord | <Elegantbeef> Use a single type definition |
23:11:03 | FromDiscord | <Elegantbeef> sorry type section |
23:11:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/0LZ |
23:11:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glj |
23:12:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4glk |
23:12:32 | FromDiscord | <etra> ooh, interesting, that worked, thanks Elegantbeef! |
23:13:04 | FromDiscord | <.tochka> sent a code paste, see https://paste.rs/uru |