<< 03-10-2022 >>

00:08:41FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=4c8C
00:09:21FromDiscord<Elegantbeef> `copyMem(data, unsafeAddr str[0], str.len + 1)`
00:09:28FromDiscord<Elegantbeef> removes line 4
00:09:45FromDiscord<Elegantbeef> Personally i'd do `create(char, str.len + 1)` instead of `alloc`
00:09:50FromDiscord<Elegantbeef> that gives you a `ptr char` directly
00:10:11FromDiscord<sealmove> ohh thanks :3 i've been stuck with this bug for quite some time, let's see. i saw `create` somewhere but didn't realize it's an stdlib proc
00:12:21*attah quit (Ping timeout: 260 seconds)
00:12:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c8E
00:14:59FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=4c8F
00:15:15FromDiscord<Elegantbeef> cstring(createU(char, str.len + 1))\`
00:15:53FromDiscord<Elegantbeef> That error is quite odd though iven `ptr char` is what a cstring is on C/C++
00:17:51FromDiscord<Patitotective> there should be a natural32 🧐
00:18:16FromDiscord<Elegantbeef> Make it?
00:18:40FromDiscord<Patitotective> done
00:25:38FromDiscord<!&luke> Can I compile nim to risc-v
00:27:01*attah joined #nim
00:33:06FromDiscord<auxym> probably. nim already has `--cpu:riscv32` and `riscv64` options. you might need to specify your compiler path (riscv-gcc?) and pass additional flags to gcc for your specific chip.
00:33:23FromDiscord<auxym> see the cross-compiling section in the manual
00:35:17FromDiscord<Patitotective> In reply to @auxym "probably. nim already has": dont think it does
00:44:17FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4c8L
00:47:42FromDiscord<Patitotective> you were right lol
01:29:20FromDiscord<martinium> for async code is it better to use pattern matching with case vs if statements. I am assuming conditions on if statements are still evaluated serially?
01:29:26FromDiscord<martinium> (edit) "serially?" => "in order?"
01:29:46FromDiscord<Elegantbeef> Regardless it's always best to use `case`
01:30:04FromDiscord<Elegantbeef> Of course minus `bool`
01:30:45FromDiscord<martinium> Gotcha
01:31:42FromDiscord<Rika> In reply to @Elegantbeef "*Of course minus `bool`*": Why not xd
01:32:02FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4c8R
01:32:11FromDiscord<Elegantbeef> I mean yes you can
01:32:22FromDiscord<Elegantbeef> Rika you know why not
01:32:35FromDiscord<Elegantbeef> If you're using case on a bool you're just making the code harder to read
01:33:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c8S
01:34:38FromDiscord<Patitotective> Ugh
01:34:39FromDiscord<SaAnd> please do not do this for the full `int` range, you're gonna run out of memory↵(@Patitotective)
01:35:01FromDiscord<Elegantbeef> Minor details
01:43:46*wallabra quit (Ping timeout: 268 seconds)
01:46:28*wallabra joined #nim
01:46:30FromDiscord<martinium> how would I check for multiple conditions in a branch
01:46:41FromDiscord<martinium> example looking for two substrings
01:46:55FromDiscord<martinium> of ""auth and "200"
01:47:00FromDiscord<martinium> can't use the and
01:47:07FromDiscord<martinium> (edit) """auth" => ""auth""
01:47:26FromDiscord<martinium> (edit) "can't use the and ... " added "operator"
01:51:31FromDiscord<Rika> In reply to @Elegantbeef "Rika you know why": xd
01:51:59FromDiscord<Rika> In reply to @martinium "how would I check": Not in a case
01:52:26FromDiscord<martinium> only 1 item per of branch
01:52:41FromDiscord<Rika> Well maybe you can hack something together with tuples but I’m not sure
01:52:43FromDiscord<martinium> what about the case itself can it take a conditional expression?
01:53:01FromDiscord<martinium> case "200" in line:↵of "yadda"
01:53:05FromDiscord<Rika> In reply to @martinium "what about the case": Then you’ll be matching against Booleans and you saw what happened when I jokingly asked
01:53:09FromDiscord<martinium> gotcha
01:56:35FromDiscord<martinium> I would need to nest it inside an if statement before the cases
01:56:45FromDiscord<martinium> probably would accomplish the "filtering"
02:42:18*droidrage joined #nim
02:59:11*wallabra quit (Remote host closed the connection)
02:59:26*wallabra joined #nim
03:06:46*derpydoo quit (Ping timeout: 260 seconds)
03:30:50FromDiscord<martinium> sent a code paste, see https://play.nim-lang.org/#ix=4c96
03:31:08FromDiscord<martinium> getting Error: await expects Future[T], got void
03:31:38FromDiscord<martinium> when I remove the await from f.close() line I get compiler code 139
03:43:11FromDiscord<Rika> I’m not aware of open async
03:43:18FromDiscord<Rika> Is this part of a third party library?
03:43:25FromDiscord<Rika> Maybe I forgot about it
03:43:37FromDiscord<Rika> I believe you don’t need to await close
03:43:55FromDiscord<Rika> Do you mind giving more info about the error without the await on close
03:51:35FromDiscord<Elegantbeef> Hmph bridge dieded
03:52:14FromDiscord<Elegantbeef> https://nim-lang.org/docs/asyncfile.html
03:52:14FromDiscord<Elegantbeef> `close` is not async
03:52:27*LuxuryMode joined #nim
03:52:45FromDiscord<martinium> I see a close() that takes an AsyncFile
03:52:55FromDiscord<martinium> error without the await is ... Execution failed with exit code 139
03:52:56FromDiscord<Elegantbeef> It isnt an async procedure
03:53:02FromDiscord<Elegantbeef> It doesnt return `Future[void]`
03:53:04LuxuryModeAnyone happen to know if there's an AWS library for Nim besides this one? https://github.com/aidansteele/aws_sdk.nim This project seems to be abandonware at this point.
03:53:09*vicecea quit (Remote host closed the connection)
03:53:11FromDiscord<martinium> understood
03:53:26FromDiscord<martinium> sent a code paste, see https://play.nim-lang.org/#ix=4c98
03:53:38*vicecea joined #nim
03:53:41FromDiscord<Elegantbeef> No stack trace?
03:54:21FromDiscord<Elegantbeef> How are you running the program?
03:54:57LuxuryModeOh, there is this: https://github.com/disruptek/atoz
03:55:09FromDiscord<martinium> on terminal
03:55:18FromDiscord<martinium> this is full code: https://gist.github.com/martinium/cf44daa3a5b647ca6be0dd509b56a2d8
03:57:15FromDiscord<Elegantbeef> Ugh code
03:58:07FromDiscord<Elegantbeef> Nice a compiler bug
03:58:22FromDiscord<martinium> yeah, its bad. Was simple program I made and did the job but want to see if I can make it async to keep learning Nim.
03:58:41FromDiscord<Elegantbeef> Enum indexed arrays are your friends
04:01:27FromDiscord<martinium> compiler bug exists with 1.6.8 and devel
04:01:38FromDiscord<Elegantbeef> `await f.readLine()` is the culprit
04:02:25FromDiscord<huantian> Huh that shouldn’t make the compiler crash tho lmao
04:02:52FromDiscord<Elegantbeef> Of course it shouldnt
04:02:55FromDiscord<Elegantbeef> I'm trying to minimise the code huan!
04:03:09FromDiscord<huantian> :p
04:03:33FromDiscord<martinium> I assume that happens during the readAll() proc is called
04:03:42FromDiscord<martinium> (edit) "I assume that happens during ... the" added "when"
04:05:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c9b
04:05:54FromDiscord<huantian> I mean that looks right?
04:06:18FromDiscord<Elegantbeef> The oddity is that it's not much different to that which doesnt
04:07:21FromDiscord<Elegantbeef> It's `walkDirRec` that's causing it i think
04:07:58FromDiscord<Elegantbeef> Does not
04:08:05FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/yWK
04:08:43FromDiscord<wiga> i tried to use execCmdEx but when i try to get the output of a command it just drops this weird stuff https://media.discordapp.net/attachments/371759389889003532/1026345023941398538/unknown.png
04:08:54FromDiscord<huantian> that looks right
04:09:03FromDiscord<huantian> the weird stuff is probably ascii color codes or something
04:09:12FromDiscord<wiga> yes but how do i get rid of that
04:09:21FromDiscord<wiga> and like
04:09:37FromDiscord<wiga> the output is suppose to be only one command
04:09:44FromDiscord<wiga> not all my pc properties
04:09:45FromDiscord<Elegantbeef> Tell the program you dont want colouring
04:10:05FromDiscord<wiga> it looks like my neofetch on my terminal tho
04:10:27FromDiscord<wiga> it is
04:10:28FromDiscord<wiga> bruh
04:10:36FromDiscord<wiga> is there any alternative?
04:11:04FromDiscord<huantian> `neofetch --stdout`
04:11:26FromDiscord<wiga> to this i mean https://media.discordapp.net/attachments/371759389889003532/1026345706816020530/unknown.png
04:11:29FromDiscord<Elegantbeef> Martinium you can use `walkpattern` i believe instead, though make an issue please
04:11:44FromDiscord<martinium> I am using walkDir as I just want to point to a folder with a bunch of logs and have it iterate through the files and read/filter and write to new files from each one.
04:11:59FromDiscord<martinium> is there another way to open files in a directory one by one?
04:12:22FromDiscord<martinium> (edit) "one?" => "one without having to specify exact filenames?"
04:18:15FromDiscord<Elegantbeef> Seems something with walkDirRec causes the compiler to endlessly recurse attempting to transform something
04:19:43FromDiscord<martinium> yeah too much headache for minimal gain
04:19:54FromDiscord<martinium> I'll just keep using sync version I made for this 🤷‍♂️
04:20:16FromDiscord<Elegantbeef> So dont worry about an issue i'll make it
04:22:07FromDiscord<wiga> In reply to @wiga "to this i mean": i cant find a way to just make this working and not spitting out randomness
04:22:57FromDiscord<Elegantbeef> It's not randomness you're calling a program that emits ANSI terminal code but your terminal doesnt support it
04:23:46FromDiscord<wiga> its literally my neofetch
04:23:55FromDiscord<huantian> In reply to @huantian "`neofetch --stdout`":
04:23:59FromDiscord<Elegantbeef> And that's ansi codes
04:24:09FromDiscord<wiga> yes but i just want to command output
04:24:14FromDiscord<wiga> not the whole terminal
04:24:23FromDiscord<huantian> that is the command output of neofetch
04:24:31FromDiscord<wiga> i dont want neofetch BRUH
04:24:43FromDiscord<huantian> what do you want
04:24:56FromDiscord<wiga> In reply to @wiga "to this i mean": .
04:25:09FromDiscord<wiga> i just want to run basic pwsh commands
04:25:18FromDiscord<Elegantbeef> Then do it?
04:25:23FromDiscord<wiga> 💀
04:25:51FromDiscord<huantian> I think this is a powershell question and not a nim question so I don't know if people here can answer
04:25:58FromDiscord<wiga> bro
04:26:01FromDiscord<wiga> i want to run
04:26:04FromDiscord<wiga> pwsh commands
04:26:07FromDiscord<wiga> through nim
04:26:13FromDiscord<wiga> isnt it a simple question?
04:26:27FromDiscord<huantian> yes and like half of this server uses linux and has no idea how powershell works
04:26:34FromDiscord<wiga> ok then
04:26:44FromDiscord<wiga> how to a run bash commands and get the output
04:26:47FromDiscord<wiga> through nim
04:26:51FromDiscord<huantian> I mean I won't speak for the server but at least I don't have any idea how powershell works
04:27:01FromDiscord<wiga> its a command line....
04:27:16FromDiscord<Elegantbeef> `man bash` indicates `bash "command"` is all you need to do
04:27:37FromDiscord<wiga> through nim
04:27:49FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4c9d
04:27:51FromDiscord<Elegantbeef> That's not through bash though
04:28:00FromDiscord<Elegantbeef> That's through your default shell
04:28:01FromDiscord<wiga> sent a code paste, see https://play.nim-lang.org/#ix=4c9e
04:28:09FromDiscord<wiga> but i get more than what its suppose to output
04:28:12FromDiscord<huantian> oh sorry then ig it's `"bash ls"`
04:28:15FromDiscord<wiga> i get my whole command line
04:29:06FromDiscord<huantian> did you try `powershell -command "some stuff here"`
04:29:27FromDiscord<huantian> In reply to @wiga "i get my whole": yeah that's because that's what `powershell` is outputting
04:29:32FromDiscord<huantian> it's outputting your shell
04:29:41FromDiscord<huantian> (edit) "shell" => "shell/your whole command line"
04:30:11FromDiscord<wiga> ok look at this https://media.discordapp.net/attachments/371759389889003532/1026350424548188190/unknown.png
04:30:24FromDiscord<wiga> what do you think it will output?
04:31:04FromDiscord<Elegantbeef> Oh huan it's `bash -c ls`
04:31:08FromDiscord<wiga> In reply to @huantian "it's outputting your shell/your": cool but how tf do i get rid of that
04:31:16FromDiscord<huantian> In reply to @Elegantbeef "Oh huan it's `bash": ah yeah sorry
04:31:21FromDiscord<huantian> In reply to @huantian "did you try `powershell":
04:31:31FromDiscord<Elegantbeef> Living on pedantry over here
04:31:54FromDiscord<huantian> In reply to @wiga "what do you think": the output of powershell
04:31:55FromDiscord<huantian> which is a shell
04:32:13FromDiscord<wiga> In reply to @huantian "** **": totally working https://media.discordapp.net/attachments/371759389889003532/1026350939340292176/unknown.png
04:32:19FromDiscord<wiga> i dont want my neofetch
04:32:54FromDiscord<huantian> ok do this
04:32:57FromDiscord<huantian> go to `cmd`
04:33:06FromDiscord<huantian> run `powershell.exe echo hello`
04:33:08FromDiscord<huantian> what does it show
04:33:10FromDiscord<Rika> Aren’t you the one running neofetch though
04:33:29FromDiscord<wiga> In reply to @huantian "what does it show": neofetch & output
04:33:33FromDiscord<huantian> exactly
04:33:43FromDiscord<huantian> so you have to tell powershell somehow not to show the neofetch
04:33:53FromDiscord<huantian> I personally don't know how to do that since I don't know powershell
04:33:55FromDiscord<wiga> but i still want to use neofetch 💀
04:34:17FromDiscord<Rika> We can’t help you with your power shell config…
04:34:22FromDiscord<wiga> my main question was: what proc do i use for this to not happen
04:34:29FromDiscord<wiga> In reply to @Rika "We can’t help you": idc
04:34:33FromDiscord<wiga> thats not my question
04:34:53FromDiscord<Rika> That is your question, your power shell config seems to run neofetch on startup right?
04:35:00FromDiscord<wiga> yes
04:35:05FromDiscord<Rika> Then that is the issue
04:35:37FromDiscord<Rika> You run power shell and it shows neofetch on startup, how do you make it not do that when you run it in Nim is not something we can help with
04:36:22FromDiscord<Rika> There should prolly be some flag you can pass to suppress config but I don’t know
04:36:37FromDiscord<wiga> its so retarded
04:37:16FromDiscord<huantian> Nim will only output what powershell outputs↵If poweshell outputs your neofetch then Nim will too
04:37:28FromDiscord<wiga> mh
04:40:37FromDiscord<Rainbow Asteroids> In reply to @wiga "totally working": https://tenor.com/view/fire-kill-fuego-matar-incendiar-gif-5307315
04:40:45FromDiscord<Rainbow Asteroids> oh, ok
04:40:53FromDiscord<Rainbow Asteroids> https://tenor.com/view/fire-kill-fuego-matar-incendiar-gif-5307315
04:40:59FromDiscord<Rainbow Asteroids> https://tenor.com/view/stranger-things-fire-flame-gif-14920648
04:41:04FromDiscord<Rainbow Asteroids> uh oh
04:41:12FromDiscord<Rainbow Asteroids> embed machine no work
04:57:28FromDiscord<wiga> 💀
05:13:43FromDiscord<Rika> In reply to @Rainbow Asteroids "embed machine no work": Embeds here are disabled
05:13:48FromDiscord<Rika> Don’t ask me why I have no damn clue
06:52:10*LuxuryMode quit (Quit: Connection closed for inactivity)
06:57:29*rockcavera quit (Remote host closed the connection)
06:57:50*rockcavera joined #nim
06:57:51*rockcavera quit (Changing host)
06:57:51*rockcavera joined #nim
07:00:09*genpaku quit (Read error: Connection reset by peer)
07:00:50*genpaku joined #nim
07:12:19*rockcavera quit (Remote host closed the connection)
08:38:35FromDiscord<albassort> i need a fast way to put something in every other character in an array
08:38:37FromDiscord<albassort> hm
08:38:41FromDiscord<albassort> i guess we shall use collect
08:45:58NimEventerNew thread by drkameleon: Copies, seqs, assignments & templates, see https://forum.nim-lang.org/t/9505
09:18:02FromDiscord<Horizon [She/Her]> Wonder if Nim can be compiled with clang to WASM
09:18:08FromDiscord<Horizon [She/Her]> Clang can be compiled to wasm
09:18:17FromDiscord<Horizon [She/Her]> If Nim can be compiled, and clang can be compiled
09:18:39FromDiscord<Elegantbeef> You likely can, but nlvm or emcc is easier in my experience
09:18:40FromDiscord<Horizon [She/Her]> Imagine a code editor online relying on your browser for Nim dev
09:18:55FromDiscord<Elegantbeef> Oh the compiler, probably not to browser wasm
09:19:00FromDiscord<Horizon [She/Her]> In reply to @Elegantbeef "You likely can, but": I'm in the mood for something stupid since I'm in college and can't install stuff
09:19:03FromDiscord<Elegantbeef> you'd need WASI support
09:19:06FromDiscord<Horizon [She/Her]> Ah
09:19:19FromDiscord<Horizon [She/Her]> Clang has been compiled to work in the web which is funny ngl
09:19:53FromDiscord<Horizon [She/Her]> Imagine the cursedness
09:20:11FromDiscord<Elegantbeef> I only like to put effort in things that are not cursed
09:21:22FromDiscord<Horizon [She/Her]> I like having a mixed bag of options
09:34:57FromDiscord<Esther> Sometimes the cursed option is the fun option
09:49:19*dnh joined #nim
09:58:39*jmdaemon quit (Ping timeout: 250 seconds)
10:00:25FromDiscord<Horizon [She/Her]> exactly lmao
11:24:23FromDiscord<ieltan> wasm is interesting just because you can avoid writing javascript
11:41:29FromDiscord<Horizon [She/Her]> It's nice but also there's limitations, like needing JS glue for example with some things like the dom
11:41:41FromDiscord<Horizon [She/Her]> Plus, Nim on it's own can do JS interop which is nice
11:42:53*gsalazar joined #nim
12:23:07*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:36:59*xet7 joined #nim
12:39:31FromDiscord<Phil> Is there an echo-like statement one could use even in a func?
12:39:52FromDiscord<Yardanico> In reply to @Isofruit "Is there an echo-like": `debugEcho`
12:39:59FromDiscord<Yardanico> specifically made for this purpose :)
12:40:06FromDiscord<Phil> Perfect!
12:40:09FromDiscord<Yardanico> https://nim-lang.org/docs/system.html#debugEcho%2Cvarargs%5Btyped%2C%5D
12:40:20*dnh joined #nim
12:41:32FromDiscord<Yardanico> sent a code paste, see https://paste.rs/DUC
12:49:00FromDiscord<ShalokShalom> In reply to @Elegantbeef "You likely can, but": Emcc?
12:50:51FromDiscord<ShalokShalom> Ah, Emscripten you mean
12:53:54*derpydoo joined #nim
12:58:14FromDiscord<ShalokShalom> Is there now a plan to make strictFunc default?
12:59:00FromDiscord<Yardanico> In reply to @ShalokShalom "Is there now a": I think so, yes
12:59:02FromDiscord<Yardanico> https://github.com/nim-lang/Nim/pull/19380
12:59:08FromDiscord<Yardanico> <https://github.com/nim-lang/RFCs/issues/437>
13:07:13FromDiscord<Phil> sent a long message, see http://ix.io/4caZ
13:08:12FromDiscord<Phil> However when I do that it suddenly breaks parsing of httpx of `NativeHTTPRequests` to `Request` objects since it can't figure out where what part of the request starts
13:08:50FromDiscord<Phil> Or rather it wrongly figures it out and causes an index-defect when it tries to iterate past more bytes than there are in the request
13:08:57FromDiscord<Phil> (edit) "Or rather it wrongly figures it out and causes an index-defect when it tries to iterate past more bytes than there are in the request ... " added "upon failing to find a start point"
13:09:11FromDiscord<Phil> (edit) "Or rather it wrongly figures it out and causes an index-defect when it tries to iterate past more bytes than there are in the request upon failing to find a start point ... " added "for something to parse"
13:20:48*arkurious joined #nim
13:20:55*xet7 quit (Remote host closed the connection)
13:24:43FromDiscord<jos> is there something like zig's comptime in nim?
13:26:16FromDiscord<Yardanico> In reply to @jos "is there something like": you just write procedures like normal and then you can do `const myvar = myproc()`
13:26:36FromDiscord<Yardanico> but if you want something actually close, then it'll probably be `static` in the context of forcing something to execute in a static context
13:26:47FromDiscord<Yardanico> but usually people prefer to just use `const`
13:27:49FromDiscord<jos> that makes sense
13:28:02FromDiscord<jos> is there a way to rebind a "comptime" variable?
13:28:07FromDiscord<Yardanico> wdym by "rebind"?
13:28:11FromDiscord<jos> reassign
13:28:17FromDiscord<Yardanico> ?
13:28:27FromDiscord<Yardanico> you can make a runtime variable out of a compile-time variable, it just works, if you mean that
13:28:41FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4cb8
13:28:53FromDiscord<Yardanico> ah, you mean change value on compile time
13:28:53FromDiscord<Phil> You can also force a proc to always be done at compiletime by annotating it with the compileTime pragma
13:28:58FromDiscord<Yardanico> yeah, you can, but that's a bit more complexc
13:28:58FromDiscord<Yardanico> (edit) "complexc" => "complex"
13:28:59FromDiscord<jos> yeah i mean change the value at compile time
13:29:11FromDiscord<Phil> That one I don't think is a think
13:29:15FromDiscord<jos> i'm trying to have a global compile time variable to enable or disable tests
13:29:23FromDiscord<Yardanico> In reply to @jos "i'm trying to have": for that you usually use defines :)
13:29:44FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4cb9
13:29:45FromDiscord<jos> that's a good idea, but i'm also designing my own lang and am curious what's possible in nim
13:30:05FromDiscord<jos> because nim requires forward decls i figured it just evaluates the program in some fixed order, so i figured redefining const vars might be possible
13:30:18FromDiscord<Yardanico> you can't redefine consts, no
13:30:21FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4cba
13:30:21*xet7 joined #nim
13:30:22FromDiscord<Yardanico> you can't redefine variables at all
13:30:34FromDiscord<jos> i mean reassign
13:30:46FromDiscord<Yardanico> still no, for that you have to use `var` like I showed above
13:31:05FromDiscord<jos> can you have a macro that depends on a var that's marked with the compileTime pragma?
13:31:05FromDiscord<Yardanico> this approach is usually used when you want to store something, although specifically for macros there's https://nim-lang.org/docs/macrocache.html
13:31:09FromDiscord<Yardanico> In reply to @jos "can you have a": yes of course
13:32:12FromDiscord<Yardanico> In reply to @jos "because nim requires forward": i'm not good at compiler development, but nim manual says this:
13:32:31FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#order-of-evaluation↵https://nim-lang.org/docs/manual.html#macros
13:32:41FromDiscord<Yardanico> the first one is order of evaluation for code generally, the second one is when you add macros into the mix
13:32:46FromDiscord<Yardanico> "Macro invocation is a case where semantic analysis does not entirely proceed top to bottom and left to right. Instead, semantic analysis happens at least twice:"
13:33:56FromDiscord<Yardanico> and yeah, generally macros aren't that special, you can use any normal procs/funcs/etc in them as long as they work at compile-time
13:34:12FromDiscord<Yardanico> that includes everything in the stdlib that works at compile-time (and almost all pure-nim stdlib modules do)
13:34:40FromDiscord<jos> hmm
13:36:58FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1026488026299367504/unknown.png
13:37:07FromDiscord<jos> ok so i expect this to output "ya" once
13:37:09FromDiscord<jos> but it actually outputs nothing
13:37:22FromDiscord<jos> am i misunderstanding something?
13:38:29FromDiscord<Yardanico> xyz runs at runtime
13:38:41FromDiscord<Yardanico> you switch test to true and then false, so it's `false` during the compilation
13:38:50FromDiscord<Yardanico> and xyz runs at runtime where xyz is already false
13:38:50FromDiscord<jos> i thought templates were invoked at compile time
13:38:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cbb
13:38:58FromDiscord<Yardanico> In reply to @jos "i thought templates were": they are, but they are just code substitution
13:39:02FromDiscord<Phil> The copy paste of the template is done at compile time
13:39:04FromDiscord<Yardanico> they just paste the code inside of them to where they were called
13:39:08FromDiscord<Phil> the actual code of the template is not executed
13:39:12FromDiscord<Yardanico> (they do have a few extra features though, but that's basically it)
13:39:37FromDiscord<jos> if i mark the if statement as static, will that do my expected behavior?
13:39:42FromDiscord<jos> basically compile two variants of the fn
13:39:53FromDiscord<Phil> it should from my understanding
13:40:17FromDiscord<Yardanico> In reply to @jos "basically compile two variants": not sure what's your goal here - if you want to have a variable that can be switched at runtime, you just have a normal global `var` variable without `compileTime`
13:40:18FromDiscord<jos> hmm i can't quite get it to work
13:40:31FromDiscord<jos> i want the variable to be switched at compile time
13:40:39FromDiscord<Yardanico> yes, but your code runs at runtime
13:40:47FromDiscord<jos> well, i want two variants of the fn to be generated
13:40:48FromDiscord<Yardanico> so why do you want two variants of the same procedure to be compiled
13:40:57FromDiscord<jos> it's a contrived example
13:41:07FromDiscord<jos> i'm trying to understand what's possible at compile time
13:41:14FromDiscord<jos> stuff like this is useful in certain contexts though
13:41:14FromDiscord<Yardanico> In reply to @jos "well, i want two": I just don't understand what for :P
13:41:33FromDiscord<Yardanico> Nim has dead code elimination always enabled, so it only keeps multiple variants when they are actually executes
13:41:37FromDiscord<Yardanico> e.g. if you have a generic procedure
13:41:43FromDiscord<Yardanico> (edit) "executes" => "executed"
13:42:29FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1026489417826832394/unknown.png
13:42:30FromDiscord<jos> ok this actually worked
13:42:55FromDiscord<jos> https://media.discordapp.net/attachments/371759389889003532/1026489528187359252/unknown.png
13:42:57FromDiscord<jos> but for some reason this didn't work
13:43:08FromDiscord<jos> i don't quite understand how the static keyword works, but this is good enough for now i guess
13:43:44FromDiscord<jos> i think one easy example where something like this would be useful is if you have a debug logging function and don't want to generate the code if some const expression in the program config evaluates to false
13:44:14FromDiscord<Yardanico> In reply to @jos "i think one easy": yes, but you don't need all that for this
13:44:22FromDiscord<Yardanico> as I said, you just use a define, or read the config at compile-time into a `const`
13:44:39FromDiscord<Yardanico> and then do `when variable` or `when defined(define)`
13:44:42FromDiscord<jos> ofc, i'm just trying to understand what's possible in nim so i can take some stuff away into my own language
13:44:44FromDiscord<Yardanico> `when` is basically compile-time if
13:44:56FromDiscord<jos> i want to have as little overlap of features as possible
13:45:11FromDiscord<jos> and i'm not really sure what's possible in compiler design with a AoT language
13:45:14FromDiscord<jos> nim is definitely pushing the boundaries
13:45:23FromDiscord<jos> so i like looking at nim
13:50:09FromDiscord<Rika> In reply to @jos "": I’m surprised this didn’t
13:52:40*rockcavera joined #nim
13:52:40*rockcavera quit (Changing host)
13:52:40*rockcavera joined #nim
14:04:56FromDiscord<Phil> sent a code paste, see https://paste.rs/pm8
14:10:25FromDiscord<Yardanico> escape sequences
14:10:26FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals
14:14:30FromDiscord<Bung> am making a PR for one issue that remove one localError report , found https://github.com/nim-lang/Nim/blob/devel/tests/errmsgs/t10735.nim my version will stop on `Error: undeclared identifier: 'pos'` but am not sure which version better
14:23:35*LuxuryMode joined #nim
14:30:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cbu
14:33:53FromDiscord<Phil> At first glance I think the error is likely somewhere around `parser.nim` and the iterator `parseRequests`.↵That iterator typically hands out as "start" index a 0.↵In the case of these requests it doesn't, it wrongly "stays" in the iterator instead of opening a new one (?) and throws out a second "start" index, which leads to parsing errors down the line when `parsePath` tries to figure something out but doesn't find a `' '` character.
14:36:10FromDiscord<Phil> Note that this is only a problem when the form is of type `enctype="multipart/form-data"`, not when it is urlencoded!
14:38:47FromDiscord<Bung> doesn't redirect only do http get request ?
14:40:34FromDiscord<Phil> You can redirect incoming post requests just fine (otherwise, how would you forward a user after creating an entry in a database?), its just this specific scenario that breaks it.↵Notably when the form contains a value that is an HTTP method (so PUT, POST, GET etc.)
14:41:21FromDiscord<Phil> It also only crashes when the methods are capitalized, so "put" will not crash
14:44:40FromDiscord<Bung> it's implementation says it do a http 301 headers and body default empty
14:45:37FromDiscord<Phil> Aye, you would think that, however it still retains the first request in memory. I think it might be that because of the HTTP verb in the form it expects a second request to come in or something
14:45:45FromDiscord<Phil> (edit) "Aye, you would think that, however it still retains the first request in memory. I think it might be that because of the HTTP verb in the form it expects a second request to come in or something ... " added "before it starts processing the redirect"
14:46:30FromDiscord<Bung> oh found document, it use original request method and body
14:48:39FromDiscord<Phil> opened an issue, at least I can do a workaround by just going lowercase
14:54:01FromDiscord<Phil> Heck yeah! I can now generate an entire form to create an entry just based on a norm-model, including for file fields!
15:01:00FromDiscord<dom96> can you open it on httpbeast as well?↵Also as a side note, can prologue switch to httpbeast so we stop needing to maintain two slightly different versions of httpbeast?
15:01:15FromDiscord<dom96> (edit) "it" => "an issue"
15:02:04FromDiscord<Phil> Erm.... err.... not sure how tbh ^^' ↵I never used httpbeast directly so I don't know how to register a route, neither how to trigger a redirect
15:02:19FromDiscord<Phil> Like, I'm sure the example is not that hard to set up, just requires knowledge of httpbeast that I do not have
15:02:34FromDiscord<dom96> It's fine, just link to the httpx issue
15:02:58FromDiscord<dom96> so that if it's fixed in httpx I can remember to pull that fix 🙂
15:03:40FromDiscord<Phil> https://github.com/ringabout/httpx/issues/13↵Or did you mean opening an issue in the httpbeast repo and linking to the httpx issue?
15:03:50FromDiscord<dom96> yes
15:06:29FromDiscord<Phil> Done, issue in httpbeast repo open with link to httpx issue
15:06:34FromDiscord<dom96> Thanks!
15:07:10FromDiscord<Phil> I think this was the first time I found a bug that didn't just throw an exception but actually took down the entire server with it
15:07:29FromDiscord<Phil> Who'da thunk it'd be an http server that does me in!
15:07:56FromDiscord<dom96> very interesting bug
15:08:36FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://play.nim-lang.org/#ix=4cbS
15:08:40FromDiscord<dom96> I guess httpbeast incorrectly thinks a new request started. Seems you've already deduced basically this from reading your message above.
15:09:10FromDiscord<Phil> From the barebones I got from the code.↵Like, I have no idea how it discerns things, but the proc names are giving me hints
15:09:15FromDiscord<Phil> God I love it when proc names are actually useful
15:09:19FromDiscord<dom96> If you're adventurous, reproing in httpbeast should be fairly easy. Just send your POST to https://github.com/dom96/httpbeast/blob/master/tests/helloworld.nim
15:09:54FromDiscord<Rika> In reply to @Anna Aurora 🇪🇺🏳🌈 "I'm getting this error": I’m gonna guess here and say that you’re using “=“ by accident instead of “:”
15:10:36FromDiscord<Phil> I already spend like 3-4h figuring out this bug, for now I just want to get back to my actual project, which is developing an admin area.↵Next thing on the list is how to handle login and whether I provide default authentication ways
15:10:41*derpydoo quit (Ping timeout: 260 seconds)
15:11:00FromDiscord<dom96> In reply to @Isofruit "God I love it": Same. It might take longer to type but when you get back to the codebase after many years it saves you far more time. Honestly no idea how Araq deals with the naming in the compiler codebase.
15:12:37FromDiscord<Phil> In reply to @dom96 "Same. It might take": Sidenote, I don't think it would hurt either way if pathParams was changed regardless of it being the cause of the issue or not.↵A while-loop that can go out of bounds is just asking for easy ways to crash your server
15:12:57FromDiscord<Phil> Or would doing a range check affect performance too much?
15:13:06FromDiscord<Phil> (edit) "pathParams" => "path"
15:13:12FromDiscord<Phil> One sec, let me find the offensive code passage
15:13:52FromDiscord<dom96> yep, performance is always the concern, though we can add `assert`s safely to aid in debugging.
15:15:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cbU
15:15:11FromDiscord<Phil> Ah, too late
15:15:37FromDiscord<Phil> So basically, speed is when you don't check anything?
15:18:51FromDiscord<dom96> httpbeast primary goal was speed, so my focus was primarily on that, hence not a lot of safety checks
15:20:35FromDiscord<dom96> (edit) "httpbeast" => "httpbeast's"
15:20:50FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://play.nim-lang.org/#ix=4cbV
15:21:11FromDiscord<Phil> Is Color a tuple?
15:24:02FromDiscord<Anna Aurora 🇪🇺🏳🌈> no, an array…
15:24:02FromDiscord<Anna Aurora 🇪🇺🏳🌈> oh, square brackets?
15:33:49FromDiscord<Phil> Generally (a, b) is the syntax to generate a tuple.↵[a,b] will generate an array of size 2.↵@[a,b] generate a seq
15:34:41*wallabra quit (Ping timeout: 252 seconds)
15:34:57FromDiscord<Anna Aurora 🇪🇺🏳🌈> made it too complicated
15:34:57FromDiscord<Anna Aurora 🇪🇺🏳🌈> made it too complicated in the first one
15:35:02FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://play.nim-lang.org/#ix=4cbY
15:35:04FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://paste.rs/TSR
15:35:15FromDiscord<Phil> Ahhh so it was a tuple, yeah nice
15:36:05FromDiscord<Anna Aurora 🇪🇺🏳🌈> I thought Color is like, a custom type
15:40:05FromDiscord<Anna Aurora 🇪🇺🏳🌈> but then you can't define array length I guess?
15:40:06FromDiscord<Anna Aurora 🇪🇺🏳🌈> but it doesn't take floats either so it should be an array
15:40:17FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://paste.rs/IFo
15:40:22FromDiscord<Anna Aurora 🇪🇺🏳🌈> sent a code paste, see https://paste.rs/wKw
15:43:37*wallabra joined #nim
15:44:09*derpydoo joined #nim
15:59:11FromDiscord<Phil> Hmm how would you figure out if an enum is represented by an int or a string?
15:59:24FromDiscord<Phil> Like, how do you get an enums internal type
16:00:30FromDiscord<Bung> there's module names like enumutils
16:02:06FromDiscord<Phil> Yeah but they contain:↵symbolName - That is basically the symbol of the enum in the form of a string, not its value↵symbolRank - The order in which the enum is, so at first place, second place etc.
16:02:39FromDiscord<Phil> no symbolValue
16:03:28*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
16:04:28FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cc6
16:05:41*wallabra joined #nim
16:19:33FromDiscord<Phil> the answer is `ord`↵`x.ord` gives the value
16:22:37FromDiscord<Phil> Wait, only if its an int enum, but how do I figure out which of the two it is
16:23:30FromDiscord<Yardanico> In reply to @Isofruit "Wait, only if its": an enum is always a numerical thing, if it has strings they're there just for the stringification
16:23:39FromDiscord<Yardanico> since enums must be ordinal (except those that are with holes)
16:23:51FromDiscord<Phil> In reply to @Yardanico "an enum is always": Aye but I want to know if strings or numbers were assigned
16:24:33FromDiscord<Phil> Since whatever was assigned is what the user wants in the database and thus what I must render as "values" for options of an HTML-select field
16:27:53FromDiscord<Phil> Or at least I want something that always works for conversion of enum --> string| int --> enum , regardless of if the enum has been assigned strings or ints
16:29:05FromDiscord<Bung> no string enum
16:36:56FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ccl
16:39:28FromDiscord<Bung> hmm seems work
16:39:49FromDiscord<Bung> parseInt then A
16:41:08FromDiscord<Bung> but string here not useful?
16:42:30FromDiscord<Bung> oh can be used as option text
16:47:01FromDiscord<Phil> I actually can do the entire thing without any assignment, but my users might not know this as did I until 20 minutes ago
16:47:24FromDiscord<Phil> I guess its nice in the db when you want strings stored there
16:47:44FromDiscord<Phil> And makes parsing from db --> nim easier
16:49:01FromDiscord<Phil> sent a long message, see http://ix.io/4ccr
16:57:12FromDiscord<Horizon [She/Her]> Wonder how good i could interop with Python with a WASM runtime compared to using Nimpy
16:57:20FromDiscord<Horizon [She/Her]> Probably better with Nimpy
17:24:33*gsalazar quit (Ping timeout: 250 seconds)
17:27:23FromDiscord<jan Apisu> cannot install nimlangserver on archlinux
17:27:28FromDiscord<jan Apisu> installed nimble from choosenim
17:27:39FromDiscord<jan Apisu> it asks for lot of packages to overwrite
17:27:43FromDiscord<jan Apisu> then it fails
17:29:43FromDiscord<flywind> In reply to @Isofruit "<@658563905425244160> I think": Hi, did you try it with `asynchttpserver` so that we can make sure it is an issue of httpbeast/httpx not an issue of prologue?
17:33:21*LuxuryMode quit (Quit: Connection closed for inactivity)
17:39:57FromDiscord<jan Apisu> wat? https://media.discordapp.net/attachments/371759389889003532/1026549179775975484/unknown.png
17:48:08FromDiscord<jan Apisu> what is `{.base.}` ?
18:00:34*PMunch joined #nim
18:03:37*gsalazar joined #nim
18:08:12*gsalazar quit (Ping timeout: 264 seconds)
19:15:26*gsalazar joined #nim
19:21:43FromDiscord<demotomohiro> @jan Apisu https://nim-lang.org/docs/manual.html#methods
19:30:12FromDiscord<Phil> In reply to @flywind "Hi, did you try": Just tried it, the server does not explode when I compile with `--define:usestd`.↵Therefore I assume that it is an httpx/httpbeast issue
19:58:15*LuxuryMode joined #nim
20:01:07FromDiscord<Phil> How do I figure out the path to the current nim-package that a file is in?↵Usecase:↵I have a package with its own resource folder, which contains nimja templates.↵The package must locate the resource folder at compile time, as it reads in the files from that directory at compiletime.
20:01:18FromDiscord<Phil> (edit) "in?↵Usecase:↵I" => "part of?↵Usecase:↵I"
20:02:53*gsalazar quit (Ping timeout: 268 seconds)
20:03:43FromDiscord<Phil> So I basically have the files I want under ~/.nimble/pkgs/snorlogue-0.1.0/resources↵And I want to figure that out in a file located under ~/.nimble/pkgs/snorlogue-0.1.0/snorlogue/frontendController.nim↵The relative path from `frontendController.nim` to the directory `resources` is always the same, just not the absolute paths
20:04:52FromDiscord<FM> sent a code paste, see https://play.nim-lang.org/#ix=4cda
20:05:13FromDiscord<FM> (edit) "https://play.nim-lang.org/#ix=4cda" => "https://play.nim-lang.org/#ix=4cdb"
20:05:48FromDiscord<FM> (edit) "https://play.nim-lang.org/#ix=4cdb" => "https://play.nim-lang.org/#ix=4cdc"
20:07:04FromDiscord<Phil> is north..west not an enum?
20:07:08FromDiscord<Phil> I'd assume it is an enum
20:07:27FromDiscord<Phil> if it is, that north..west would evaluate to something like 0..3
20:11:40NimEventerNew question by Stefan Zobel: Nim sequence assignment value semantics, see https://stackoverflow.com/questions/73940369/nim-sequence-assignment-value-semantics
20:12:27FromDiscord<FM> Oh right, thank you Phil, I'm stupid. I was confused between index type and the type of elements of the array
20:12:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cdg
20:12:41FromDiscord<FM> (edit) "of" => "in"
20:13:30FromDiscord<FM> I was thinking that `array[north..west, BlinkLights]` had to be ordinal. I misunderstood
20:13:31FromDiscord<Phil> Ah, wait, incorrect, north..west encompasses 4 values
20:13:44FromDiscord<Phil> There you go
20:13:47FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cdh
20:14:07FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4cdh" => "https://play.nim-lang.org/#ix=4cdi"
20:14:07FromDiscord<Phil> One of these days I'll learn to type
20:14:24FromDiscord<Phil> In that case you can self-reply to your SO question 😛
20:15:13FromDiscord<Phil> Anyway, that's a lot of BlinkLights
20:15:49FromDiscord<FM> Haha indeed
20:16:00FromDiscord<FM> https://media.discordapp.net/attachments/371759389889003532/1026588451929346149/unknown.png
20:26:21*PMunch quit (Quit: Leaving)
21:02:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4cdp
21:04:29FromDiscord<4zv4l> this doesn't seem to work
21:04:30FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4cdq
21:04:40FromDiscord<4zv4l> the thread is supposed to write `i` but it's always `1`
21:04:47FromDiscord<4zv4l> it doesn't increment
21:08:40FromDiscord<4zv4l> I am so silly omg↵I wrote `echo $1`
21:08:44FromDiscord<4zv4l> my bad
21:15:56*rhu joined #nim
21:15:59*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
21:16:20*wallabra joined #nim
21:31:24FromDiscord<demotomohiro> Maybe you are using a font that '1' and 'l' (lower case L) looks almost same.↵https://github.com/demotomohiro/DUBF
21:33:21FromDiscord<Patitotective> In reply to @demotomohiro "Maybe you are using": :o
21:40:43*wallabra quit (Ping timeout: 246 seconds)
21:45:06FromDiscord<4zv4l> In reply to @demotomohiro "Maybe you are using": lmaooooo, nice program dude ! xD
21:46:32*wallabra joined #nim
21:47:55FromDiscord<demotomohiro> In reply to @4zv4l "lmaooooo, nice program dude": Thx!
21:48:46FromDiscord<Elegantbeef> As soon as you add unicode demo homoglyphs ruin your day
21:49:50FromDiscord<Phil> sent a long message, see http://ix.io/4cdv
21:50:41FromDiscord<Elegantbeef> template or macro instead of a proc so it's evaluated inside module b
22:10:54*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
22:11:10*wallabra joined #nim
23:17:41*LuxuryMode quit (Quit: Connection closed for inactivity)
23:33:00*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:39:26FromDiscord<Tuatarian> this is a compiler bug right?
23:39:48FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4ce1
23:39:48FromDiscord<Tuatarian> or lexer bug I guess
23:51:37*rhu quit (Ping timeout: 246 seconds)
23:57:36FromDiscord<Elegantbeef> It's a codegen issue
23:57:53FromDiscord<Elegantbeef> `lexer` is your program 😄