<< 20-02-2022 >>

00:04:26FromDiscord<ynfle> Is there any way to disable output for `unittest`?
00:09:49*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
00:16:03FromDiscord<ynfle> In reply to @ynfle "Is there any way": `-d:nimUnittestOutputLever=PRINT_NONE`
00:24:28FromDiscord<Waldecir Santos> I've an object name in a string how can I use for instantiate it using that value from the string ? is this possible with nim ?
00:24:43FromDiscord<Elegantbeef> It is possible at compile time
00:25:00FromDiscord<Elegantbeef> It's also possible at runtime but more difficult
00:25:10FromDiscord<ynfle> In reply to @Waldecir Santos "I've an object name": You can do if else if you know all the possibilities
00:25:23FromDiscord<Elegantbeef> Or a case statement if you're not an animal
00:25:30FromDiscord<Elegantbeef> Sorry not sorry ynfle
00:25:42FromDiscord<Waldecir Santos> I do know all possibilities, how can I do it @ynfle ?
00:25:58FromDiscord<Waldecir Santos> In reply to @Elegantbeef "It's also possible at": How ?
00:26:46FromDiscord<Waldecir Santos> I need to do that for the object type (instantiate) and set values properties
00:26:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Q6x
00:27:58FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3Q6y
00:28:00FromDiscord<Waldecir Santos> sent a code paste, see https://paste.rs/TgJ
00:28:03FromDiscord<Elegantbeef> Well yea that's ideal
00:28:09FromDiscord<Elegantbeef> Less manual work the better
00:28:11FromDiscord<ynfle> In reply to @Elegantbeef "Sorry not sorry ynfle": Love you too
00:28:38FromDiscord<Waldecir Santos> lol
01:05:26*noeontheend joined #nim
01:22:05*PMunch quit (Quit: leaving)
01:35:48*noeontheend quit (Ping timeout: 240 seconds)
01:44:41*noeontheend joined #nim
01:51:24FromDiscord<jos> i'm working on a language and about to start codegen
01:51:44FromDiscord<jos> i'm wondering about languages that compile to c in practice
01:52:33FromDiscord<jos> it seems like a good idea, but i've never really used a language that does it, is there any reason not to do it
01:54:18FromDiscord<Elegantbeef> You depend on a compiler that is a bit harder to ship
01:55:04FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/1246
02:57:59*noeontheend quit (Ping timeout: 256 seconds)
03:23:51*arkurious quit (Quit: Leaving)
03:25:10FromDiscord<cs> sent a code paste, see https://play.nim-lang.org/#ix=3Q72
03:25:25FromDiscord<cs> This doesn't happen if I type a word, a space and then another word
03:25:49FromDiscord<cs> (edit) "https://play.nim-lang.org/#ix=3Q74" => "https://play.nim-lang.org/#ix=3Q73"
03:27:52FromDiscord<cs> Is that expected behavior?
03:38:13FromDiscord<Elegantbeef> I'm going to say no an exception should never be user facing 😛
03:39:33FromDiscord<aph> how do i use `clang` instead of gcc for nim?
03:40:49FromDiscord<Elegantbeef> `--cc:clang`
03:41:00FromDiscord<aph> thanks
03:48:29FromDiscord<cs> In reply to @Elegantbeef "I'm going to say": ok. I agree
03:53:15FromDiscord<Mysterysib> YO SON HOW DO I GET THE LENGTH OF OBJECTS IN A JSONNODE
03:53:28FromDiscord<Mysterysib> IS THERE A FUNCTION OR DO I HAVE TO DO SOME WEIRD WHILE LOOP
03:55:25madpropsJASON.len
03:58:17FromDiscord<Mysterysib> Thanks 🙂
04:06:01*supakeen quit (Quit: WeeChat 3.4)
04:06:31*supakeen joined #nim
04:12:23FromDiscord<Rika> damn why ya shoutin
04:13:53FromDiscord<aph> In reply to @Rika "damn why ya shoutin": probably doing SQLs
04:15:01FromDiscord<Mysterysib> I'm trying to parse a .har and extract media from it
04:15:37FromDiscord<aph> nice
04:17:18FromDiscord<Mysterysib> Rather than manually defining the specific type structure for it, I'm writing a template definition to do it automatically
04:19:06FromDiscord<Mysterysib> I want make a program that will read and parse network packets, identify media, and then extract it
04:19:20FromDiscord<Mysterysib> I think I have to code the networking part in C but I'm doing the parsing in Nim
04:21:20FromDiscord<Mysterysib> I wonder what `"Error: internal error: invalid kind for lastOrd(tyGenericParam)"` means when I import a .nim file with template definitions
04:23:18FromDiscord<Mysterysib> (edit) "template" => "type"
04:24:40FromDiscord<Mysterysib> Oh, it's because I had a definition in an object `Arr : array`. Guess I'm not allowed to do that
04:25:56FromDiscord<Elegantbeef> Should be an error message but sadly is not
04:25:58FromDiscord<Rika> the array needs to have its generic types filled `array[Size, Type]`
04:28:39FromDiscord<Mysterysib> In reply to @Elegantbeef "Should be an error": What's the best place to submit requests like this so we can improve the lang? For instance, I had an issue with the Jetbrains Nim extension and had to create a custom .sh script to run Jetbrains for it to work with "EXPORT = /path/to/nimcompiler"
04:29:05FromDiscord<Rika> that is an issue with the jetbrains extension and not nim so submit an issue to them
04:29:09FromDiscord<Elegantbeef> Make an issue or a PR to address it on the github
04:29:20FromDiscord<Elegantbeef> Yea the jetbrains stuff goes to jetbrains
04:29:24FromDiscord<Elegantbeef> the compiler error goes to Nim
04:29:34FromDiscord<Mysterysib> Okay, cool
04:31:01*Gustavo6046 quit (Quit: Leaving)
04:55:34FromDiscord<K.io.S> sent a long message, see https://paste.rs/7Yj
05:00:45FromDiscord<Elegantbeef> nim's async isnt done with threads so it shouldnt change anything afaik
05:06:42FromDiscord<Rika> pretty much what he said
05:07:02FromDiscord<Rika> not sure what you mean by affect
05:08:44FromDiscord<K.io.S> the point is that the concurrency story is fragmented atm. and there are many different efforts.↵The fact that threads are one thing and any not necessarily threaded implementation isn't, is not what I was asking about.
05:11:57FromDiscord<Rika> if you havent heard, the whole nim community is pretty fragmented
05:12:20*slowButPresent quit (Quit: leaving)
05:12:32FromDiscord<Elegantbeef> There's a nim community?!\\
05:32:44FromDiscord<leorize> Araq has a talk on concurrency at fosdem if you wanna see what he thinks
06:04:11FromDiscord<mratsim> The talk on concurrency is about parallelism though 😅
06:05:11FromDiscord<mratsim> sent a long message, see http://ix.io/3Q7A
06:08:31FromDiscord<leorize> there's also cps \:p
06:32:11FromDiscord<Bung> In reply to @haolian9 (高浩亮) "as the header part": yeah, I remember supported http version is hard code in std
07:54:34*jmd_ quit (Quit: ZNC 1.8.2 - https://znc.in)
07:56:09*jmdaemon joined #nim
08:11:01FromDiscord<Phil> In reply to @Elegantbeef "There's a nim community?!\\": impossibru
09:19:05*jjido joined #nim
09:28:11*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:32:36*wyrd quit (Remote host closed the connection)
09:33:01*wyrd joined #nim
09:39:08*jjido joined #nim
09:46:12NimEventerNew Nimble package! toktok - Generic tokenizer written in Nim language 👑 Powered by Nim's Macros, see https://github.com/openpeep/toktok
10:37:33FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=3Q8s
10:37:48FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=3Q8s" => "https://play.nim-lang.org/#ix=3Q8t"
10:39:00FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=3Q8t" => "https://play.nim-lang.org/#ix=3Q8v"
10:48:33FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Q8w
10:51:12FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Q8x
10:52:05FromDiscord<enthus1ast> in the first example, you could define the function in the newFoo() newBaa() procs
10:52:14*averell joined #nim
10:53:13FromDiscord<untoreh> sent a code paste, see https://play.nim-lang.org/#ix=3Q8y
10:59:55*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:02:04FromDiscord<dom96> In reply to @Rika "if you havent heard,": Is it?
11:03:43FromDiscord<haolian9 (高浩亮)> sent a code paste, see https://paste.rs/GtA
11:05:06FromDiscord<Rika> Because it defaults to field when you call it with “field syntax” (or method call syntax)
11:05:30FromDiscord<Rika> So it’s like (l.name)() trying to call the field value like a proc
11:09:25FromDiscord<Waldecir Santos> Is it possible to get a list of all declared objects/types at compile type ?
11:11:56FromDiscord<haolian9 (高浩亮)> could you share some ref? i can not find any thing about UFC, except a wiki page↵(@Rika)
11:12:13FromDiscord<Rika> It’s in the manual somewhere lol I can’t check right now
11:14:51FromDiscord<xflywind> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
11:22:10FromDiscord<haolian9 (高浩亮)> thanks for the link, i saw it before and re-read again, but it does not say property takes precedent over method
11:31:47FromDiscord<haxscramper> In reply to @Waldecir Santos "Is it possible to": no unless you annotate them with some kind of pragma
11:32:05FromDiscord<haxscramper> in general, macros cannot access the source code outside of their scope
11:36:06FromDiscord<Waldecir Santos> got it, would be possible to show me how to use pragma for it ?
11:37:04FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Q8I
11:43:36FromDiscord<Waldecir Santos> oh yeah but it will be outside the scope I need,!thank you
11:44:15FromDiscord<haxscramper> if the code is typed you can traverse the definitions using `.getTypeImpl()`
11:44:48FromDiscord<haxscramper> random combinations of `getTypeImpl()`, `getTypeInst()` or `getType()` for the fields, arguments and so on
11:48:15FromDiscord<Waldecir Santos> ty I’ll check it.
12:06:02*supakeen quit (Quit: WeeChat 3.4)
12:06:32*supakeen joined #nim
12:26:12*jmdaemon quit (Ping timeout: 240 seconds)
12:55:10FromDiscord<rakgew> hi, I was wondering if there is way to use nimble to refresh or install packages also behind tor socks5 proxy? tried to wrap nimble into torsocks/torify but it was not able to connect. using `HTTPS_PROXY=socks5://127.0.0.1:9050 nimble refresh --verbose` showed that it picked up proto/url/port correctly, but would not connect. is there another way to get it working?
12:57:22*jjido joined #nim
13:02:06FromDiscord<enthus1ast> Nim cannot natively use socks
13:02:21FromDiscord<enthus1ast> Http proxy might work though
13:04:00FromDiscord<rakgew> so HTTP\_PROXY instead of HTTPS\_PROXY? enthus1ast thank you - will give it shot.
13:05:02FromDiscord<enthus1ast> I do not know IF this is supposed to work, the only thing I know is that the stdlib has no socks client code
13:05:55FromDiscord<rakgew> hm. unfortunately not. with python I could use\: `torsocks python3 -m pip install packagename`
13:09:05FromDiscord<rakgew> with rust/cargo I needed to set some config or env var, then it worked there as well. would be really great if I could get nimble to work as well.
13:09:05FromDiscord<enthus1ast> Torsocks use LD\_PRELOAD this imho does not work with nim executables
13:09:06FromDiscord<rakgew> yes they do. thank you for the hint.
13:10:38FromDiscord<enthus1ast> https://github.com/nim-lang/nimble/commit/50d2637b04d9c7228e34c2ac5ec85f811804be7c
13:11:32FromDiscord<enthus1ast> I would set up a http(s) to socks/tor proxy and connect to these
13:12:34FromDiscord<enthus1ast> But I can imagine that there are other dragons
13:13:30FromDiscord<rakgew> I would not be surprised. thank you for the link.
13:14:19FromDiscord<enthus1ast> It would be nice when the proxy stuff in httpclient would be pluggable
13:14:42FromDiscord<enthus1ast> So that users can implement their own proxy routines
13:15:19FromDiscord<enthus1ast> I had to fork httpclient to let it connect to socks directly
13:16:04FromDiscord<rakgew> ouh, I agree.
13:18:01FromDiscord<enthus1ast> And I also started to add http proxy support to my socks server implementation, but imho never finished it
13:19:44*slowButPresent joined #nim
14:16:10*{cms} quit (Remote host closed the connection)
14:16:32*PMunch joined #nim
14:20:05*arkurious joined #nim
14:28:58*Gustavo6046 joined #nim
14:30:16*Gustavo6046 quit (Max SendQ exceeded)
14:30:44*Gustavo6046 joined #nim
14:44:55NimEventerNew thread by Ggibson: Porting c++ [string]view demo to nim: a puzzle, see https://forum.nim-lang.org/t/8935
15:01:09*neurocyte0917090 joined #nim
15:50:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
16:39:17nrds<games/freenode99> <rasengan> Decision has been made <rasengan> We have to drain this swamp
16:39:19nrds<games/freenode99> <rasengan> Classic tried to go on for the sake of the community, but the community has made it loud and clear-they want freenode classic to end, today! #MFGA
16:39:23nrds<games/freenode99> <rasengan> Decision has been made <rasengan> We have to drain this swamp
16:39:25nrds<games/freenode99> <rasengan> Classic tried to go on for the sake of the community, but the community has made it loud and clear-they want freenode classic to end, today! #MFGA
16:46:26PMunchUhm, what?
16:46:44PMunchPrestige, is your bot bridging stuff from other channels now?
17:06:24nrds<Prestige99> They added a freenode bridge and libera people keep going on the freenode channels and spamming
17:07:01FromDiscord<ShalokShalom> hi there↵↵I am new, and like to replace my bash script with some Nim
17:07:32FromDiscord<ShalokShalom> Is this possible/advisable, and if yes, how to do stuff such as mkdir and so on?
17:07:46FromDiscord<ShalokShalom> Is there some doc, that collects all the system io stuff (on Linux)
17:08:55*wyrd quit (Ping timeout: 240 seconds)
17:08:56FromDiscord<Phil> sent a long message, see https://paste.rs/QYh
17:10:06PMunch@ShalokShalom, Nim isn't really meant as a bash replacement, but it can certainly be used as one
17:10:44FromDiscord<Phil> sent a code paste, see https://paste.rs/HMT
17:11:06PMunchYou probably want to look into `nimcr` so your scripts get shebang support. To use tools such as mkdir you need to use something like execCmd, but of course this could be wrapped
17:11:32FromDiscord<ShalokShalom> Is this enough? https://nim-lang.github.io/Nim/os.html
17:11:38FromDiscord<ShalokShalom> Thanks
17:11:58PMunchNot sure if anyone has yet set up something like this, but it wouldn't be impossible for a Nim program to read your path during compile-time and then create templates to run any program in your path that way.
17:12:21PMunchYeah I mean that's how you would normally create folders and such
17:12:40FromDiscord<ShalokShalom> nimcr? https://media.discordapp.net/attachments/371759389889003532/945005044984606750/Screenshot_20220220_181216.png
17:13:09FromDiscord<Phil> I feel like I'm missing something, where did you make the jump to read a path at compile time for shalok's usecase pmunch?
17:13:26FromDiscord<ShalokShalom> missing that too
17:13:38PMunch@Phil, essentially it tries to make the compile-time more static-y, which it can't, and then it gets confused
17:13:52PMunchNot a path, the PATH
17:14:22FromDiscord<Phil> In reply to @PMunch "<@180601887916163073>, essentially it tries": Ah, so it boils down to "there is only one compileTime-time, don't use static in a compileTime proc to get more compileTime during compileTime" ?
17:14:23PMunchEssentially just finding every single binary you can normally run in your bash script without arguments and creating templates to run those in a similar way in Nim.
17:14:41PMunch@ShalokShalom, nimcr: https://github.com/PMunch/nimcr
17:14:45FromDiscord<ShalokShalom> thanks a lot
17:14:58PMunch@Phil, pretty much
17:14:59FromDiscord<Phil> Somewhere there is an xzibit yo dawg meme to be made from my sentence
17:15:08PMunchHaha :P
17:15:32FromDiscord<demotomohiro> @ShalokShalom https://nim-lang.org/docs/nims.html↵Please read Standalone NimScript section
17:15:32PMunchNim should probably just ignore static in a {.compileTime.} proc, maybe create an issue for this on GitHub
17:15:35FromDiscord<Phil> What's fascinating is that static asserts in a compileTime proc do work to a degree!
17:16:12FromDiscord<ShalokShalom> ok
17:16:15FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QaP
17:16:39FromDiscord<Phil> It works absolutely flawlessly, though I guess I should throw out the static in there and see if that still works
17:17:56FromDiscord<Phil> Huh, yeah, works still when I remove the static from the asserts
17:18:25FromDiscord<Phil> My takeaway from this is: When you want to prevent yourself from being dumb at compile time, do compiletimeprocs with asserts and done
17:18:34FromDiscord<Phil> (edit) "My takeaway from this is: When you want to prevent yourself from being dumb at compile time, do compiletimeprocs with asserts ... and" added "(instead of static asserts)"
17:21:10FromDiscord<ShalokShalom> PMunch: I see exec used in the NimScript example. Is it different from execCmd?
17:21:44PMunchYes, NimScript is the parts of Nim which can run during compile-time
17:22:02PMunchIt's kind of the same language, kinda not
17:22:41FromDiscord<demotomohiro> https://nim-lang.org/docs/nimscript.html#exec%2Cstring
17:23:41FromDiscord<demotomohiro> NimScript can be executed like bash script with `nim myscript.nims`.
17:25:47PMunchNimScript won't give you all the benefits of Nim though, so depending on what you're actually looking to achieve by switching to Nim it might not be worth it
17:25:58*wyrd joined #nim
17:26:06FromDiscord<ShalokShalom> No, I think both of you lovely people understood something else, as I mean
17:26:49FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/945008604078047322/Screenshot_20220220_182624.png
17:27:20FromDiscord<ShalokShalom> Difference? https://media.discordapp.net/attachments/371759389889003532/945008738039910470/Screenshot_20220220_182701.png
17:29:56FromDiscord<ShalokShalom> https://nim-lang.org/docs/osproc.html#execCmd%2Cstring↵And there is one more: https://nim-lang.org/docs/os.html#execShellCmd%2Cstring
17:30:29FromDiscord<demotomohiro> `exec` is a proc in nimscript module and execCmd is a proc in osproc module that is unavailable in nimscript
17:30:59FromDiscord<ShalokShalom> Yeah, just figured that.
17:31:13FromDiscord<ShalokShalom> So exec is in both?
17:31:56FromDiscord<ShalokShalom> Like, is there a subset of NimScript, that cant be used in normal Nim either?
17:32:55FromDiscord<ShalokShalom> And I think nimcr could be part of the official distribution. Seems kinda basic.
17:38:06FromDiscord<Zajt> I saw the path to the file I compiled `/home/zajt/file.nim` is in strings of the binary compiled with Nim, is it possible to get rid of this one?
17:41:35FromDiscord<demotomohiro> Did you tried `strip` command?
17:46:12FromDiscord<Zajt> Yeah I have that one
17:46:41FromDiscord<Zajt> `nim c -d:strip --hints:off --warnings:off -d:verbose -d=mingw -d:exportExe out.nim`
17:53:16FromDiscord<huantian> @Zajt compile with -d:release
17:55:08FromDiscord<Zajt> In reply to @huantian "<@!290456415963709440> compile with -d:release": I tried with that earlier but couldn't run the binary then
17:58:47FromDiscord<Zajt> and I still don't know why that happened, it's really odd
17:58:49FromDiscord<huantian> Don’t know then, compiling with release always removed the debug strings which referenced the compilation file
17:58:54FromDiscord<huantian> (edit) "file" => "folder"
17:59:11FromDiscord<Zajt> tried with different combinations of the arguments to see if it is caused by two special flags/arguments at the same time
18:08:26*jjido joined #nim
18:09:26FromDiscord<demotomohiro> Did you tried `strip <your executable file>` command?
18:12:20FromDiscord<Zajt> that worked to remove it, thanks!
18:19:41FromDiscord<Zajt> or actually the path is still there
18:24:37FromDiscord<demotomohiro> Exception, stack trace or assert need to print file path. You might need to use `-d:danger` option.
18:24:50FromDiscord<b4mbus> Has anyone here tested `nlvm` and compared it to casual `nim` compilation with different options?
18:28:13FromDiscord<Mysterysib> I'm really stuck with pointers in Nim
18:28:17FromDiscord<Zajt> What does that one do?
18:28:43FromDiscord<Mysterysib> I have a function with a parameter with two possible datatypes, and depending on the datatype I want to set the parameter to a different definition with a different datatype
18:28:53FromDiscord<Mysterysib> When I do this check, the compiler doesn't understand
18:29:41PMunch@Mysterysib, that doesn't sound like something you should need pointers for..
18:30:13FromDiscord<Mysterysib> Ah, I was thinking that maybe if I used pointers to change the datatype the compiler wouldn't complain
18:30:54FromDiscord<huantian> In reply to @Zajt "What does that one": Danger disables runtime checks
18:31:09FromDiscord<haolian9 (高浩亮)> can anyone elaborate thread's `no heap sharing restriction`? does it means i can not share a db connection between threads?
18:31:16FromDiscord<huantian> But if relrase doesn’t work ifk
18:31:21FromDiscord<huantian> (edit) "relrase" => "release" | "ifk" => "idk"
18:32:53FromDiscord<Mysterysib> sent a long message, see http://ix.io/3Qcj
18:33:08PMunchhaolian9_(高浩亮), probably a bad idea
18:33:26FromDiscord<Mysterysib> if I define JN as a var, then I cannot call the function with a string parameter because it says the string is immutable
18:34:11FromDiscord<haolian9 (高浩亮)> then if i use a connectionPool instead is also a bad idea?
18:34:14FromDiscord<federico3> @dom96\: why is https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m without a CVE?
18:35:02PMunch@Mysterysib, you can't assign to an argument if it isn't defined as `var`
18:35:24PMunchAnd if you can't call it with a string it means that the string you defined in your other scope isn't a var
18:35:46PMunche.g. `let mystr = "Hello"; genJsonArray(mystr)` won't work
18:35:51FromDiscord<demotomohiro> In reply to @Mysterysib "if I define JN": If you want to set value to argument, it must be `var parameter` and you have to pass `var` variable to the parameter.
18:36:12PMunchhaolian9_(高浩亮), it all depends on how your application is built and what your database supports
18:38:26FromDiscord<Mysterysib> Ah Okay
18:39:45FromDiscord<Mysterysib> when I call ` genJsonArray(JN[idx], false)` inside `proc genJsonArray(JN:string|JsonNode|char;firstIter: bool) =`, it throws an error for `if firstIter: jsonTxt = parseJson(readFile(JN))` even though `firstIter` is set to false
18:40:16FromDiscord<Mysterysib> `but expression 'JN' is of type: char`, but that part shouldn't run when `JN` is a char
18:40:29FromDiscord<Mysterysib> That's why I was thinking of using pointers
18:40:39FromDiscord<Mysterysib> I've been on this bug for like an hour 😢
18:40:54PMunchThe code is still invalid even if a runtime condition is not met
18:41:27PMunchYou can try `firstIter: static[bool]` and then use a `when firstIter` statement
18:41:42PMunchI'm guessing that is only there to control some kind of recursion
18:42:20FromDiscord<Mysterysib> Yeah, and yep that worked
18:42:27FromDiscord<Mysterysib> Thank you
18:42:47FromDiscord<Mysterysib> What is the logic behind that so I can understand this moving forward? I'm still learning the language
18:43:32FromDiscord<Mysterysib> Is it because the compiler wants to make sure the bool doesn't change within the function?
18:45:08PMunchNo
18:45:36PMunchEssentially in your version you could've had firstIter passed in by something which would only be known at runtime, say e.g. some user input
18:45:50*slowButPresent quit (Quit: leaving)
18:45:52PMunchSo the compiler needs to generate the code-path for what should happen when it is true
18:46:04PMunchBut the code there is invalid, so it throws an error
18:46:46PMunchWhen you change it to static you tell the compiler that this value is never going to change on runtime, it will always be known during compilation. So that `when` check is actually checking the value of firstIter as you compile your program
18:47:14PMunchIt basically turns it into two separate procedures, and which one is called depends on what you pass in as firstIter
18:48:23PMunchI assume you're coming from a language like Python or something, where everything is done at runtime. In that case the code isn't checked before it is run, so you would get an error about the impossible code when you try to run it (and if it never reaches an impossible scenario it won't create an issue).
18:49:17PMunchBut Nim is compiled, so it needs to create instructions for each of those branches for each of those arguments, even if one combination is never used.
18:50:17PMunchSince you have an argument with three optional types and a static boolean Nim will basically create six separate procedures for you, and when it is compiling it will know which one to call based on the types you pass and the value of that static parameter
18:51:45PMunchAnd since the argument is now static it can be sure that the version it creates for char doesn't contain any invalid code (these separate procedures are created on the fly as you call them, so if you ever tried to call it with a char and the argument set to true then it will be asked to create invalid code and stop it)
18:54:36FromDiscord<Mysterysib> Oh okay thank you I understand
18:59:26*slowButPresent joined #nim
19:20:10*neurocyte0917090 quit (Ping timeout: 272 seconds)
19:24:45FromDiscord<dom96> In reply to @federico3 "<@132595483838251008>\: why is https://github.com/n": because the NimForum advisory has a CVE, can you not see the GitHub message?
19:28:54*neurocyte0917090 joined #nim
19:29:43FromDiscord<Phil> I could use some inspiration for type naming
19:41:40FromDiscord<federico3> @dom96\: a CVE for Nim itself
19:41:59FromDiscord<Phil> sent a long message, see http://ix.io/3Qdv
19:42:18FromDiscord<Phil> Okay I need to find a way to write this shorter
19:43:15FromDiscord<Phil> (edit) "http://ix.io/3Qdv" => "http://ix.io/3Qdw"
19:44:57*neurocyte0917090 quit (Ping timeout: 256 seconds)
19:49:23FromDiscord<Phil> Well that rewrite didn't really make things shorter =/
19:50:20FromDiscord<dom96> In reply to @federico3 "<@132595483838251008>\: a CVE for": huh?
19:58:01FromDiscord<Arathanis> In reply to @Isofruit "I have a relational": are you just looking for more descriptive named?
19:58:16FromDiscord<Phil> Yeh, solely looking for better understandable naming scheme
19:58:26FromDiscord<Phil> Which ideally hints at this 3-level-information hierarchy
19:58:31FromDiscord<Arathanis> Seems like you have 3 objects, each for the same underlying representation but with different amounts of damage
19:59:01FromDiscord<Arathanis> data
19:59:05FromDiscord<Arathanis> sorry was just playing MTG
19:59:12FromDiscord<Arathanis> burn deck, damage on the brain lol
19:59:17FromDiscord<Phil> Pretty much, I'd love to have only one but that's a technical ORM limitation which I can't abstract away without doing a lot of unnecessary work
19:59:17FromDiscord<Arathanis> different amounts of data
19:59:33FromDiscord<Arathanis> why not something like
19:59:49FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdE
20:00:22FromDiscord<Arathanis> or
20:00:43FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdG
20:01:43FromDiscord<Phil> Hmm I'm a fan of your suffix idea
20:02:54FromDiscord<Phil> The fact that the "base" thingy starts in the middle is a bit strange but going with naming with "Min/max" or "Full/Empty" somewhere in that area "feels" correct
20:04:01FromDiscord<Arathanis> OT my eyes the base thingy starting in the middle makes the most sense, but that might be because I have a rudimentary understanding of your data model
20:04:08FromDiscord<Arathanis> (edit) "OT" => "to"
20:04:17FromDiscord<Arathanis> I kind of see it has
20:04:22FromDiscord<Arathanis> ObjMin == Obj but stripped down
20:04:37FromDiscord<Arathanis> Obj is an Obj with all its data but not necessarily all its relationship data
20:04:51FromDiscord<Arathanis> ObjFull is an Obj that is fully fleshed out with all relationship connections loaded
20:05:13FromDiscord<Arathanis> but that might not be what you are doing
20:05:23FromDiscord<Arathanis> just what i mistakenly understood
20:06:07FromDiscord<Phil> ObjMin is all data from its own table↵Obj is all data from its own table + all data from tables that obj has an FK field entry to↵ObjFull is all data from its own table + all relationship data from all other tables with FK's pointing from Obj to them or from them to Obj
20:06:27FromDiscord<Phil> (edit) "obj" => "Obj" | "to↵ObjFull" => "pointing to them↵ObjFull"
20:07:25FromDiscord<Phil> Since ObjMin is only data from a single table, that's what you use for create/update/delete operations, thus I see it more as the "core" of everything, while "Obj" is "ObjMin" with a few frills and "ObjFulL" is "Obj" but with even more frills.
20:07:44FromDiscord<Phil> (edit) ""ObjFulL"" => ""ObjFull""
20:08:12FromDiscord<Phil> I could skip the middle layer strictly speaking, but then the amount of database trips I do roughly doubles to triples.
20:08:24FromDiscord<Arathanis> Ok I got it
20:08:28FromDiscord<Phil> (edit) "speaking," => "speaking and do only "ObjMin" and "ObjFull","
20:09:24FromDiscord<Arathanis> ObjMin is all data on that row, fkeys are just the actual id↵Obj is the same as ObjMin but fkeys are actual objects with data now↵ObjFull is Obj but we also include objects with fkeys to the instance instead of just froom
20:09:25FromDiscord<Arathanis> (edit) "froom" => "from"
20:10:00FromDiscord<Phil> Precisely. Obj only exists because with norm I can fetch that data in a single trip to the database, but not other entries with fkey pointing to the instance.
20:10:05FromDiscord<Arathanis> don't fall into the trap of premature optimization
20:10:25FromDiscord<Arathanis> you are trying to reduce how much data you use, but do you know for sure that amount of data throughput will be problematic?
20:10:54FromDiscord<Arathanis> if you don't I would write it in the easiest to follow, most concise and quick way, and then if it turns out its an issue you can refactor for performance
20:11:28FromDiscord<Phil> I mean, I'm writing this for performance for funsies because it's basically a rewrite of an application I already have written in Django.
20:11:44FromDiscord<Phil> (edit) "Django." => "Django (if you're not familiar, another web-framework but in python)."
20:11:59FromDiscord<Arathanis> oh python is my strongest language im very familiar haha
20:12:14FromDiscord<Phil> The goal is pretty much to crunch down from... I think currently I'm at ~200ms on a pageload to sub 50ms
20:12:28FromDiscord<Phil> Which is completely irrelevant
20:12:36FromDiscord<Phil> And solely for my own fun to see if I can ^^
20:12:39FromDiscord<Arathanis> if its an experiment in optimization than forge onward!
20:12:42FromDiscord<Arathanis> ive been there
20:13:17FromDiscord<Arathanis> one of the first things I do when learning a new language is write a prime sieve since I think its not overly complex but does require non-trivial logic and data structures. great learning project, doesn't take too long
20:13:24*cyraxjoe quit (Ping timeout: 252 seconds)
20:13:25FromDiscord<Arathanis> and i often find myself trying to make it ever faster as part of the fun of it
20:13:40FromDiscord<Phil> Heh, I'm starting to develop the trend of just re-implementing my backend
20:13:54*cyraxjoe joined #nim
20:13:59FromDiscord<Phil> Because it automatically forces me into so many obscure areas of the language that are none the less really good to know
20:16:40FromDiscord<Phil> I very quickly learn how it feels best to structure medium-large projects in the language, how to deal with database interaction, authentication, encryption, connection pooling, async, multi-threading, file-uploading and more
20:17:25FromDiscord<Phil> Never thought I'd find myself writing (stealing) code to build a django-signal like system
20:18:11PMunchHmm, @dom96 is there a way to package a `.nims` file in a nimble package in such a way that users can create their own `.nims` files and import it?
20:18:20FromDiscord<Phil> As an aside, I'm not sure if you followed the debate on webdev, python's encryption lib is crazy fast
20:18:26*nixfreaknim[m] is now known as reversem3[m]
20:19:32FromDiscord<Phil> (edit) "fast" => "fast. To the point I wish I could comprehend libsodium to use one of its wrappers"
20:19:41FromDiscord<dom96> In reply to @PMunch "Hmm, <@132595483838251008> is there": dunno, but I would assume that this would work the same as with .nim files
20:20:02PMunchHmm
20:20:26PMunchI placed it in the same directory as my library files, but nimscript isn't able to find it
20:20:48FromDiscord<Arathanis> I always figured that if you wanted themn to have control over config you would write your `.nims` file in a way to load from an optional config file
20:20:51PMunchI guess the import resolution for NimScript doesn't take into account the nimble path..
20:21:14FromDiscord<Arathanis> so rather than try and figure out a way to let them make their own `.nims` file you would tell them they can configure things with a `yaml` file called "config.yml" or smth
20:21:18FromDiscord<Arathanis> and provide a spec
20:21:26PMunchHuh?
20:21:52FromDiscord<Arathanis> maybe im confused as to what you are trying to accomplish, I usually use `.nims` files for `config.nims` haha
20:22:01FromDiscord<Arathanis> you must be doing actual scripting stuff, just ignore me :]
20:22:05PMunchYes, that's what I'm trying to do
20:22:20PMunchNot at all
20:23:02PMunchThe problem I'm trying to solve is that Ratel, my microprocessor library in Nim is best used with a bunch of variables set up.
20:23:16PMunchCurrently the getting started guide looks like this: https://ratel.peterme.net/gettingstarted.html
20:24:12FromDiscord<dom96> In reply to @PMunch "I guess the import": Possible. Wouldn’t be surprised if that’s the case.
20:24:22PMunchWhat I want to do is move that entire configuration file into a `config.nims` file that I ship with the library. Then when using the library the user doesn't have to copy that config, but rather just run `import boardConf` or something similar
20:24:45FromDiscord<Arathanis> ahhh
20:25:24FromDiscord<federico3> @dom96\: the vuln seems to affect Nim's stdlib. If so there has to be a CVE assigned to Nim itself
20:35:46FromDiscord<dom96> In reply to @federico3 "<@132595483838251008>\: the vuln seems": I guess it’s my bad for requesting the CVE on the Nim forum repo first
20:36:01FromDiscord<dom96> Not sure we can get that changed now
20:37:30FromDiscord<Arathanis> In reply to @PMunch "What I want to": what about an environment variable targetting the board config file
20:38:06PMunchNot sure how that would solve anything
20:39:50FromDiscord<Arathanis> you are trying to get all these special config variables loaded, right?
20:41:34FromDiscord<Arathanis> is it the compiler variables you are setting?
20:42:37PMunchYes
20:43:42FromDiscord<Waldecir Santos> How to get the T type from a generics, I've `MyType[T]` when I do typeof I get `Mytype[int]` How can I get `"int"` type ? inside a proc no macro or template
20:43:49FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdS
20:44:09*jmdaemon joined #nim
20:46:15FromDiscord<Waldecir Santos> I can just use T, 🤦‍♂️
20:48:43PMunchOooh, so apparently it can't have the `.nims` filename, it has to be a regular `.nim` file
20:49:41FromDiscord<demotomohiro> In reply to @Waldecir Santos "How to get the": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-how-to-get-generic-parameter-from-generic-typeqmark
20:55:15FromDiscord<Waldecir Santos> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": Awesome thank you
21:25:06FromDiscord<haolian9 (高浩亮)> thanks for the reply, seems it can not be answered briefly, i'll leave it alone for now and read some projects.↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
21:30:46FromDiscord<Forest> How would i use the `{.used.}` pragma on imports?
21:31:17NimEventerNew post on r/nim by Godzila543: Cant get any code autocomplete working, see https://reddit.com/r/nim/comments/sxbwy1/cant_get_any_code_autocomplete_working/
21:34:32PMunch@Forest, why do you want that?
21:36:46FromDiscord<Forest> To suppress certain unused imports
21:37:12FromDiscord<Forest> Since I'm mainly importing files just to add the code, but i don't have any direct references to the functions in those imports
21:44:19FromDiscord<demotomohiro> That means you have unused code that uses procedures in the module you want to add `{.used.}`?
21:57:56FromDiscord<Forest> The files I'm importing having nothing besides initialisation code
21:58:55FromDiscord<adokitkat> sent a code paste, see https://paste.rs/hkF
21:59:36FromDiscord<adokitkat> It's something about closures, I don't get it
22:00:21FromDiscord<huantian> I might be misreading on mobile but it seems that the function is asking for a proc which returns nothing
22:00:45FromDiscord<huantian> But you give it one which returns int
22:01:13FromDiscord<adokitkat> oh
22:01:47PMunchAaah I see @Forest, and `import something {.used.}` doesn't work?
22:02:02PMunchIf not I think the only way to do it would be to add a dummy proc to the module and mark that as used
22:03:19FromDiscord<adokitkat> In reply to @huantian "But you give it": thanks, that was it!
22:07:47*PMunch quit (Quit: leaving)
22:17:13*nexeq joined #nim
22:23:56FromDiscord<Forest> In reply to @PMunch "Aaah I see <@909883978717204561>,": Let me double check
22:24:45FromDiscord<Forest> Nope, it said it expected `{all}`
22:43:13*lumidify joined #nim
22:48:27*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:32:35*slowButPresent quit (Quit: leaving)
23:34:06NimEventerNew question by itil memek cantik: Have to count a character occurrence in Nim string type, see https://stackoverflow.com/questions/71199715/have-to-count-a-character-occurrence-in-nim-string-type
23:40:33*slowButPresent joined #nim
23:56:14FromDiscord<abdu> How to count a character occurrences in string in Nim, using its native statements