<< 23-02-2025 >>

00:02:10*tiorock joined #nim
00:02:10*tiorock quit (Changing host)
00:02:10*tiorock joined #nim
00:02:10*rockcavera is now known as Guest6776
00:02:10*tiorock is now known as rockcavera
00:03:43*jjido joined #nim
00:06:13*Guest6776 quit (Ping timeout: 248 seconds)
00:18:38*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
00:30:00*FromDiscord quit (Remote host closed the connection)
00:30:13*FromDiscord joined #nim
00:46:55FromDiscord<user2m> Is there a function like apply that will also expose the index of an item? Like [1,2,3].applyit(if it.idx> 2: it2 else: it)
01:18:28FromDiscord<Zoom> `enumerate` and iterate over tuples.
01:24:09FromDiscord<Elegantbeef> Don't need enumerate for arrays 😄
02:02:16*rockcavera is now known as Guest1809
02:02:16*tiorock joined #nim
02:02:16*Guest1809 quit (Killed (tungsten.libera.chat (Nickname regained by services)))
02:02:16*tiorock is now known as rockcavera
02:04:24*tiorock joined #nim
02:04:24*rockcavera is now known as Guest3923
02:04:24*Guest3923 quit (Killed (copper.libera.chat (Nickname regained by services)))
02:04:24*tiorock is now known as rockcavera
02:10:56FromDiscord<cineration> In reply to @cineration "I'm getting a `Wrong": So I’ve recompiled from source and still cannot get past this error. I’m kind of at a loss. Been using Nim for years and can’t even do local installs using nimble 😒
02:16:55FromDiscord<nasuray> In reply to @cineration "So I’ve recompiled from": Best bet is to probably to update nimble to v0.16.4
02:17:49FromDiscord<cineration> In reply to @nasuray "Best bet is to": Thanks, I ended up changing my .nimble directory name so it regenerates everything and it’s working. Something must have gotten messed up somehow 😭
02:18:29FromDiscord<cineration> Even when I updated to nimble 0.16.4 it didn’t work but it was my .nimble directory
02:42:03FromDiscord<explosiveend> In reply to @aintea "These are the topics": this would be nice, as some of the nim docs (including nim by example) aren't fully updated
03:44:24*Guest95 joined #nim
03:45:05*Guest95 quit (Read error: Connection reset by peer)
03:46:37*Guest95 joined #nim
03:55:12FromDiscord<beastarss> does anyone know why discord webhooks wont work with the httpclient? im trying to make a simple application to play with webhooks that lets me just type out the message in the terminal
03:56:42FromDiscord<beastarss> all im doing is posting to the webhook link, with the body looking smth like `"{"content": "helloooo"}"`
03:59:23FromDiscord<beastarss> its rlly weird to me bc the request should work
04:00:00FromDiscord<lainlaylie> what does "wont work" mean? it errors at runtime? api returns error? request goes through successfully but no message is actually sent? does it work if you use e.g. curl instead?
04:00:04*Guest95 quit (Quit: My Mac has gone to sleep. ZZZzzz…)
04:00:25FromDiscord<beastarss> hold up , let me show
04:22:33FromDiscord<beastarss> well thats awkward↵i installed the newest nim version and it worked for some reason LOL
04:22:54FromDiscord<beastarss> the api returned an error last time
04:23:00FromDiscord<beastarss> something something CORS i think
04:24:33FromDiscord<beastarss> also please, how do i get this abysmal dogshit off https://media.discordapp.net/attachments/371759389889003532/1343076004100309064/image.png?ex=67bbf480&is=67baa300&hm=68094fbacccf679ed2194771c904e9b9d7cb4688ce86b546741253e3c2f126c2&
04:40:53*beholders_eye quit (Ping timeout: 265 seconds)
04:43:43*Guest95_ joined #nim
05:03:41*GnuYawk673 quit (Quit: The Lounge - https://thelounge.chat)
05:04:00*GnuYawk673 joined #nim
05:17:45*GnuYawk6736 joined #nim
05:18:11*GnuYawk673 quit (Read error: Connection reset by peer)
05:18:11*GnuYawk6736 is now known as GnuYawk673
05:26:26*GnuYawk6736 joined #nim
05:26:53*GnuYawk673 quit (Read error: Connection reset by peer)
05:26:53*GnuYawk6736 is now known as GnuYawk673
05:51:10*Guest95_ quit (Quit: My Mac has gone to sleep. ZZZzzz…)
06:13:05*GnuYawk6730 joined #nim
06:13:35*GnuYawk673 quit (Read error: Connection reset by peer)
06:13:35*GnuYawk6730 is now known as GnuYawk673
06:16:45*GnuYawk6733 joined #nim
06:18:28*GnuYawk673 quit (Ping timeout: 252 seconds)
06:18:28*GnuYawk6733 is now known as GnuYawk673
07:08:51*Guest95 joined #nim
07:12:33*ntat joined #nim
07:30:11*Guest95 is now known as protium
08:02:51*rockcavera quit (Remote host closed the connection)
08:26:19*protium quit (Quit: My Mac has gone to sleep. ZZZzzz…)
08:27:57*coldfeet joined #nim
08:42:41*coldfeet quit (Quit: leaving)
10:07:42FromDiscord<jraskar> How do I configure the config.nims with nimble in such a way that I could add local files to paths?↵I tried using switch("path","vendor") but when I run nimble setup it does not add the path to the nimble.paths file https://media.discordapp.net/attachments/371759389889003532/1343162364391850024/image.png?ex=67bc44ee&is=67baf36e&hm=679861529ef55c2589fa5ad738600ec2eb7a5c295b2f1acadc425134c93f9feb&
10:08:20FromDiscord<jraskar> https://media.discordapp.net/attachments/371759389889003532/1343162520004857896/image.png?ex=67bc4513&is=67baf393&hm=6a583ec5c180801eed30c17fd5424aed0b9001a5c9cd941a44cc15ee474bd64e&
10:09:57FromDiscord<jraskar> if I add it manually, the line is overwritten when calling nimble setup
10:12:03FromDiscord<aintea> Guys what should I ask to print for the first Nim program in the Nimlings ? I was thinking "hello world" is a tad too classic
10:13:06*GabrielJeff joined #nim
10:15:36GabrielJeffHow do I configure the XXX.nimble with nimble in such a way that I could add local files to paths?
10:15:36GabrielJeffI tried using switch("path","vendor") but when I run nimble setup it does not add the path to nimble.paths file. Also, adding the path manually to nimble.paths or using the switch(...) on config.nims, the line is overwritten when calling nimble setup
10:27:56FromDiscord<lainlaylie> don't know about nimble but you can make a config.nims and put your `switch("path", ...` in there
10:34:41FromDiscord<lainlaylie> nimble setup should only overwrite its part of the config.nims
10:37:10FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=BrWfBnsa
10:37:47FromDiscord<blashyrk> (edit) "https://play.nim-lang.org/#pasty=VuUoiMvt" => "https://play.nim-lang.org/#pasty=ukAcVyxu"
10:40:57FromDiscord<jraskar> In reply to @lainlaylie "nimble setup should only": Did not know that... I was writing my switch inside the`# begin nimble config...` block. That's why my switch was being overwritten. Thak you
10:41:39FromDiscord<lainlaylie> In reply to @blashyrk "Hey all, is it": `withDir("bench"): exec("nimble run")`?
10:42:05FromDiscord<blashyrk> This works, thanks!
10:47:06FromDiscord<jraskar> In reply to @lainlaylie "nimble setup should only": The program now compiles normally, but my intellisense fails to find the "vendor" directory. Do you know why?
10:56:21FromDiscord<lainlaylie> even after restarting your editor?
11:01:48FromDiscord<jraskar> In reply to @lainlaylie "even after restarting your": hmmmm, didn't tried that.↵restarting it worked.↵Maybe this was a bug then
11:03:53FromDiscord<lainlaylie> i find that the langserver usually takes a restart to pick up new `path`s
11:21:55*GabrielJeff quit (Quit: Leaving)
12:04:12FromDiscord<intellij_gamer> sent a code paste, see https://play.nim-lang.org/#pasty=bqtbPWyM
12:58:38*alexdaguy joined #nim
13:03:15*alexdaguy quit (Client Quit)
13:24:07FromDiscord<nocturn9x> is there a way to override what `nimble build` does?
13:24:31FromDiscord<nocturn9x> I migrated away from nim.cfg and am now using a Makefile because some tooling I use in the development of my chess engine requires one, and maintaining two separate things got annoying
13:24:42FromDiscord<nocturn9x> However I now lost the ability of doing `nimble install`, which was handy :(
13:24:54FromDiscord<nocturn9x> defining a `task build` in the nimble file doesn't seem to do anything
13:26:30FromDiscord<nocturn9x> there is a bunch of define directives that I need to pass so I would like to be able to make it such that `nimble build` just defers to `make native`
13:29:38FromDiscord<aintea> is it possible for the Nim base test framework (unittest I think ?) to check the output of a program ?
13:31:26FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=wZokOuKW
13:49:31FromDiscord<lainlaylie> apart from along the lines of `execCmdEx("nim r --verbosity:0 " & (currentSourcePath().parentDir / "src" / "hello_world.nim")).output`?
13:50:59strogon14nocturn9x, I don't think you can overwrite the built-in nimble tasks. And the "build" tasks requires that you define a "bin" array.
13:50:59strogon14But you can define "before <task>" and "after <task>" hooks in your nimble file, an those you can call other custom task, whioch you define with "mytasknameTask()".
13:51:55strogon14So you could define a "before build" task, whioch gets run first, when you run "nimble build". But you'll still get an error afterwards when no "bin" array is defined.
13:52:49strogon14https://nim-lang.github.io/nimble/create-packages.html#nimble-tasks
14:01:38FromDiscord<nocturn9x> hmm
14:01:41FromDiscord<nocturn9x> I do have the bin array
14:08:42FromDiscord<aintea> In reply to @lainlaylie "apart from along the": Yes apart from that, I was looking at the ziglings testing code and saw this https://codeberg.org/ziglings/exercises/src/branch/main/build.zig
14:16:08*beholders_eye joined #nim
14:17:51*rockcavera joined #nim
14:18:06*ensyde joined #nim
14:20:10FromDiscord<lainlaylie> In reply to @aintea "Yes apart from that,": hard to tell because i dont use zig but it looks theyre also just invoking the compiler (althrough through some kind of dedicated compiler api?) and running the outputted executable, which is what execCmd("nim r ...") would do
14:20:40FromDiscord<aintea> do you think it would be the best idea to check a program's output
14:20:52FromDiscord<lainlaylie> not particularly
14:21:01FromDiscord<aintea> or should I make the user make functions so that I can test more easily
14:21:22FromDiscord<lainlaylie> nim itself uses testament to test program output
14:22:01FromDiscord<lainlaylie> there might some other way involving nimscript
14:22:22FromDiscord<lainlaylie> someone else might have a better idea
14:22:31FromDiscord<lainlaylie> (edit) "there might ... some" added "be"
14:23:18FromDiscord<aintea> I think I will just ask the user to make functions until I have a proper solution on how to test stdout
15:39:26FromDiscord<System64 ~ Flandre Scarlet> Hi! Is it possible to create shared and static libraries that I can use with C for example?↵And do I have to take some stuff into account?
15:52:12FromDiscord<TӨMΛ ☠> How do I convert `seq` into `array`?
16:28:07*tiorock joined #nim
16:28:08*rockcavera quit (Killed (mercury.libera.chat (Nickname regained by services)))
16:28:08*tiorock is now known as rockcavera
16:30:10*tiorock joined #nim
16:30:10*rockcavera is now known as Guest5451
16:30:10*Guest5451 quit (Killed (iridium.libera.chat (Nickname regained by services)))
16:30:10*tiorock is now known as rockcavera
16:47:55FromDiscord<demotomohiro> In reply to @sys64 "Hi! Is it possible": You can:↵https://internet-of-tomohiro.pages.dev/nim/clibrary.en
16:49:12FromDiscord<demotomohiro> In reply to @toma400 "How do I convert": Write code that checks if src `seq` has enough length and copy each items with loop.
16:49:13FromDiscord<jseb> In reply to @toma400 "How do I convert": I don't know, but i'm interested to know. The difficulty is array's size must be defined at compile time
16:49:51FromDiscord<jseb> so you must have an array with enough room for the seq, and may be wasting space
16:54:32FromDiscord<nasuray> In reply to @nocturn9x "defining a `task build`": You can put the task in a `config.nims` and invoke it with `nim build`
16:55:01FromDiscord<nocturn9x> but I want to be able to use `nimble install`
16:55:11FromDiscord<nocturn9x> or at least come up with an equally functional alternative
16:55:27FromDiscord<nocturn9x> I just wanted to avoid just rewriting the cross platform logic for the command
17:03:35FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "You can: https://internet-of-tomohiro.pages.dev/nim": And if I initialize a ref object in a function↵And I return this ref object↵Will it be deleted by the GC?
17:09:03FromDiscord<demotomohiro> In reply to @sys64 "And if I initialize": Yes.↵If you want to return ref types to C, you need to use these:↵https://nim-lang.org/docs/system.html#GC_ref%2Cref.T↵https://nim-lang.org/docs/system.html#GC_unref%2Cref.T
17:11:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Yes. If you want": I have to unref I return to C?
17:12:19FromDiscord<System64 ~ Flandre Scarlet> (edit) "In reply to @demotomohiro "Yes. If you want": I have to unref ... I" added "if"
17:16:17FromDiscord<demotomohiro> In reply to @sys64 "I have to unref": Call `GC_ref` when return to C and call `GC_unref` when you free it.
17:37:20FromDiscord<TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#pasty=WnDsJrGJ
17:38:00FromDiscord<TӨMΛ ☠> (would need check if `s[ix]` exists I guess, but otherwise should be correct I guess)
17:38:14FromDiscord<TӨMΛ ☠> (edit) "correct I guess)" => "correct)"
17:38:23FromDiscord<TӨMΛ ☠> (edit) "correct)" => "correct if I understand this)"
17:40:07FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=sYnKHrvz
17:41:43FromDiscord<TӨMΛ ☠> Yup, or if I want to make it skip the error just make `if ix < s.len`, though I guess this can be risky compared to outright assertion
17:42:25FromDiscord<TӨMΛ ☠> Thank you for help ❤️
17:42:41FromDiscord<lainlaylie> assertion is appropriate given that other kinds of out of bounds error raise defects
17:42:43FromDiscord<TӨMΛ ☠> (I guess pinging @jseb too ^^)
17:42:56FromDiscord<TӨMΛ ☠> (edit) "(I guess pinging @jseb too ... ^^)" added "as they wanted to know it"
18:12:35FromDiscord<jseb> In reply to @toma400 "(I guess pinging <@291299421864329216>": why not looping on seq.len , instead ?
18:13:36FromDiscord<jseb> (edit) "In reply to @toma400 "(I guess pinging <@291299421864329216>": why not looping on seq.len , instead ? ... " added "Plus checking that array size is enough, of couse"
18:13:41FromDiscord<jseb> (edit) "couse" => "course"
18:52:03*ensyde quit (Ping timeout: 276 seconds)
19:47:35FromDiscord<TӨMΛ ☠> Well, if you check sizes to be equal it's whatever, but if you'd like to avoid checks (e.g. because you know the amount of items will always be correct) this saves you one line of code 😄
19:48:44FromDiscord<Elegantbeef> `result[0..result.high] = s` does everything
19:51:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Call `GC_ref` when return": Oh alright, but it's still manual memory management, right?
19:59:37FromDiscord<aintea> In reply to @Elegantbeef "`result[0..result.high] = s` does": THAT'S A THING ???
19:59:44FromDiscord<aintea> I learn about Nim every day
20:00:11FromDiscord<aintea> We should make a place where all Nim tips and tricks are
20:00:33FromDiscord<Elegantbeef> it's just `proc []=(oa: openArray[T], slice: Slice[int], toSet: openArray)` 😄
20:00:49FromDiscord<Elegantbeef> Just read system.nim and all the module files in the stdlib
20:01:37FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#%5B%5D%3D%2Carray%5BIdx%2CT%5D%2CHSlice%5BU%3A%20Ordinal%2CV%3A%20Ordinal%5D%2CopenArray%5BT%5D hell of a url
20:04:41FromDiscord<nieznanymagnat> sent a code paste, see https://play.nim-lang.org/#pasty=iYBduhSP
20:05:12FromDiscord<Elegantbeef> Depends on what you're doing
20:05:57FromDiscord<Elegantbeef> It should match fine and not cause issues, but they might be doing some macro shenanigans that don't know how to traverse aliases and explode
20:07:15FromDiscord<nieznanymagnat> compilers says it's a `type mismatch` at `template/generic instantiation`↵and I'm pretty sure they're doing some heavy-lifting with macros and templates, so yeah↵https://github.com/godot-nim/gdext-nim
20:07:33FromDiscord<Elegantbeef> Got the full error?
20:12:09FromDiscord<nieznanymagnat> sent a code paste, see https://play.nim-lang.org/#pasty=StmBriNT
20:12:33FromDiscord<Elegantbeef> `scenObject = AlSQResource` is wrong
20:12:55FromDiscord<Elegantbeef> `sceneObject: AlSQResource`
20:13:19FromDiscord<Elegantbeef> The first makes `sceneObject` a `typedesc` not a value
20:14:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=bTIMaHSO
20:14:32FromDiscord<nieznanymagnat> oops, so I just made a typo↵thanks!
20:15:12FromDiscord<nieznanymagnat> that makes me wonder why linter didn't catch it, but oh well
20:15:31FromDiscord<Elegantbeef> Why would a linter question valid code?
20:17:20FromDiscord<nieznanymagnat> Sry, I type somewhat slowly and didn't pay attention to what you sent in the meantime↵I see it now
20:20:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=pDArKodi
20:58:43FromDiscord<sub_sophia> so i downloaded all the files for nim and installed it but what software shalll i use to code and that when i run script it will be turned into an exe when i hit build
20:59:18FromDiscord<Elegantbeef> Whatever text editor your heart desires
21:00:06FromDiscord<sub_sophia> but how do ithen make it into an exe?
21:00:30FromDiscord<Elegantbeef> By compiling the code with the compiler
21:00:44FromDiscord<sub_sophia> what command and wheres the compiler?
21:01:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html
21:03:38FromDiscord<sub_sophia> In reply to @Elegantbeef "https://nim-lang.org/docs/tut1.html": so like this ? nim compile --opt:speed --debug:off --out:your_program.exe example.nim
21:05:01FromDiscord<sub_sophia> ?
21:23:26FromDiscord<aintea> just `nim c -r example.nim` would suffice If you want a shorthand
21:23:34FromDiscord<aintea> this will produce `example.exe`
21:26:59*ntat quit (Quit: Leaving)
21:41:44FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=SudWgovi
21:42:20FromDiscord<aintea> wdym by that
21:42:42FromDiscord<aintea> you want common fields ?
21:43:30FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=nBaGrTQv" => "https://play.nim-lang.org/#pasty=BSJGyOyp"
21:43:41FromDiscord<albassort> you know, notably, i tend to give code so it would understandable
21:44:25FromDiscord<aintea> I don't understand your request
21:44:40FromDiscord<aintea> I'm tired so please make it as simple as possible
21:44:51FromDiscord<aintea> My brain is not functionning much
21:48:33FromDiscord<albassort> i literally cannot think of a simpler example and i think this is as straight forward as i can make it, maybe you should rest
21:51:19FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=mgPYkbYY
21:51:28FromDiscord<solitudesf> no, there isn't
21:51:29FromDiscord<albassort> its defined twice here, once on One, once on TWo
21:51:40FromDiscord<solitudesf> (edit) "no, there isn't ... " added "a way"
21:51:45FromDiscord<albassort> sad
21:51:48FromDiscord<albassort> thank you
21:58:07FromDiscord<aintea> oh I understand now
21:58:27FromDiscord<aintea> No you can't unless the field is common to all variants in which case you can define it before the case statement
21:58:33FromDiscord<aintea> otherwise you can't
22:12:06FromDiscord<Elegantbeef> Though myself i'd just give a bitset of `flags` before all and call it a day
22:12:07FromDiscord<Elegantbeef> You can do `of One, Two: myThing: bool, url: string` then define a template or proc for `on`
22:12:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OzoURbzT
22:14:02FromDiscord<aintea> That looks horrible to make
22:14:28FromDiscord<aintea> I can't wait for the RFC about enum variants and proper structural pattern matching to be accepted
22:14:46FromDiscord<aintea> Time to rewrite the whole standard library variants
22:16:03FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=MvvDWRCI
22:16:15FromDiscord<aintea> (edit) "https://play.nim-lang.org/#pasty=BHGhiwKm" => "https://play.nim-lang.org/#pasty=xMrycTDi"
22:16:32FromDiscord<aintea> (edit) "https://play.nim-lang.org/#pasty=WSEuvOcY" => "https://play.nim-lang.org/#pasty=mwmyqxUH"
22:16:44FromDiscord<aintea> Any suggestion is welcome
23:37:51*tiorock joined #nim
23:37:51*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
23:37:51*tiorock is now known as rockcavera
23:40:00*tiorock joined #nim
23:40:01*tiorock quit (Changing host)
23:40:01*tiorock joined #nim
23:40:01*rockcavera is now known as Guest8901
23:40:01*Guest8901 quit (Killed (calcium.libera.chat (Nickname regained by services)))
23:40:01*tiorock is now known as rockcavera