00:04:26 | FromDiscord | <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:03 | FromDiscord | <ynfle> In reply to @ynfle "Is there any way": `-d:nimUnittestOutputLever=PRINT_NONE` |
00:24:28 | FromDiscord | <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:43 | FromDiscord | <Elegantbeef> It is possible at compile time |
00:25:00 | FromDiscord | <Elegantbeef> It's also possible at runtime but more difficult |
00:25:10 | FromDiscord | <ynfle> In reply to @Waldecir Santos "I've an object name": You can do if else if you know all the possibilities |
00:25:23 | FromDiscord | <Elegantbeef> Or a case statement if you're not an animal |
00:25:30 | FromDiscord | <Elegantbeef> Sorry not sorry ynfle |
00:25:42 | FromDiscord | <Waldecir Santos> I do know all possibilities, how can I do it @ynfle ? |
00:25:58 | FromDiscord | <Waldecir Santos> In reply to @Elegantbeef "It's also possible at": How ? |
00:26:46 | FromDiscord | <Waldecir Santos> I need to do that for the object type (instantiate) and set values properties |
00:26:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Q6x |
00:27:58 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3Q6y |
00:28:00 | FromDiscord | <Waldecir Santos> sent a code paste, see https://paste.rs/TgJ |
00:28:03 | FromDiscord | <Elegantbeef> Well yea that's ideal |
00:28:09 | FromDiscord | <Elegantbeef> Less manual work the better |
00:28:11 | FromDiscord | <ynfle> In reply to @Elegantbeef "Sorry not sorry ynfle": Love you too |
00:28:38 | FromDiscord | <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:24 | FromDiscord | <jos> i'm working on a language and about to start codegen |
01:51:44 | FromDiscord | <jos> i'm wondering about languages that compile to c in practice |
01:52:33 | FromDiscord | <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:18 | FromDiscord | <Elegantbeef> You depend on a compiler that is a bit harder to ship |
01:55:04 | FromDiscord | <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:10 | FromDiscord | <cs> sent a code paste, see https://play.nim-lang.org/#ix=3Q72 |
03:25:25 | FromDiscord | <cs> This doesn't happen if I type a word, a space and then another word |
03:25:49 | FromDiscord | <cs> (edit) "https://play.nim-lang.org/#ix=3Q74" => "https://play.nim-lang.org/#ix=3Q73" |
03:27:52 | FromDiscord | <cs> Is that expected behavior? |
03:38:13 | FromDiscord | <Elegantbeef> I'm going to say no an exception should never be user facing 😛 |
03:39:33 | FromDiscord | <aph> how do i use `clang` instead of gcc for nim? |
03:40:49 | FromDiscord | <Elegantbeef> `--cc:clang` |
03:41:00 | FromDiscord | <aph> thanks |
03:48:29 | FromDiscord | <cs> In reply to @Elegantbeef "I'm going to say": ok. I agree |
03:53:15 | FromDiscord | <Mysterysib> YO SON HOW DO I GET THE LENGTH OF OBJECTS IN A JSONNODE |
03:53:28 | FromDiscord | <Mysterysib> IS THERE A FUNCTION OR DO I HAVE TO DO SOME WEIRD WHILE LOOP |
03:55:25 | madprops | JASON.len |
03:58:17 | FromDiscord | <Mysterysib> Thanks 🙂 |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:31 | * | supakeen joined #nim |
04:12:23 | FromDiscord | <Rika> damn why ya shoutin |
04:13:53 | FromDiscord | <aph> In reply to @Rika "damn why ya shoutin": probably doing SQLs |
04:15:01 | FromDiscord | <Mysterysib> I'm trying to parse a .har and extract media from it |
04:15:37 | FromDiscord | <aph> nice |
04:17:18 | FromDiscord | <Mysterysib> Rather than manually defining the specific type structure for it, I'm writing a template definition to do it automatically |
04:19:06 | FromDiscord | <Mysterysib> I want make a program that will read and parse network packets, identify media, and then extract it |
04:19:20 | FromDiscord | <Mysterysib> I think I have to code the networking part in C but I'm doing the parsing in Nim |
04:21:20 | FromDiscord | <Mysterysib> I wonder what `"Error: internal error: invalid kind for lastOrd(tyGenericParam)"` means when I import a .nim file with template definitions |
04:23:18 | FromDiscord | <Mysterysib> (edit) "template" => "type" |
04:24:40 | FromDiscord | <Mysterysib> Oh, it's because I had a definition in an object `Arr : array`. Guess I'm not allowed to do that |
04:25:56 | FromDiscord | <Elegantbeef> Should be an error message but sadly is not |
04:25:58 | FromDiscord | <Rika> the array needs to have its generic types filled `array[Size, Type]` |
04:28:39 | FromDiscord | <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:05 | FromDiscord | <Rika> that is an issue with the jetbrains extension and not nim so submit an issue to them |
04:29:09 | FromDiscord | <Elegantbeef> Make an issue or a PR to address it on the github |
04:29:20 | FromDiscord | <Elegantbeef> Yea the jetbrains stuff goes to jetbrains |
04:29:24 | FromDiscord | <Elegantbeef> the compiler error goes to Nim |
04:29:34 | FromDiscord | <Mysterysib> Okay, cool |
04:31:01 | * | Gustavo6046 quit (Quit: Leaving) |
04:55:34 | FromDiscord | <K.io.S> sent a long message, see https://paste.rs/7Yj |
05:00:45 | FromDiscord | <Elegantbeef> nim's async isnt done with threads so it shouldnt change anything afaik |
05:06:42 | FromDiscord | <Rika> pretty much what he said |
05:07:02 | FromDiscord | <Rika> not sure what you mean by affect |
05:08:44 | FromDiscord | <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:57 | FromDiscord | <Rika> if you havent heard, the whole nim community is pretty fragmented |
05:12:20 | * | slowButPresent quit (Quit: leaving) |
05:12:32 | FromDiscord | <Elegantbeef> There's a nim community?!\\ |
05:32:44 | FromDiscord | <leorize> Araq has a talk on concurrency at fosdem if you wanna see what he thinks |
06:04:11 | FromDiscord | <mratsim> The talk on concurrency is about parallelism though 😅 |
06:05:11 | FromDiscord | <mratsim> sent a long message, see http://ix.io/3Q7A |
06:08:31 | FromDiscord | <leorize> there's also cps \:p |
06:32:11 | FromDiscord | <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:01 | FromDiscord | <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:12 | NimEventer | New Nimble package! toktok - Generic tokenizer written in Nim language 👑 Powered by Nim's Macros, see https://github.com/openpeep/toktok |
10:37:33 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3Q8s |
10:37:48 | FromDiscord | <Goel> (edit) "https://play.nim-lang.org/#ix=3Q8s" => "https://play.nim-lang.org/#ix=3Q8t" |
10:39:00 | FromDiscord | <Goel> (edit) "https://play.nim-lang.org/#ix=3Q8t" => "https://play.nim-lang.org/#ix=3Q8v" |
10:48:33 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Q8w |
10:51:12 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Q8x |
10:52:05 | FromDiscord | <enthus1ast> in the first example, you could define the function in the newFoo() newBaa() procs |
10:52:14 | * | averell joined #nim |
10:53:13 | FromDiscord | <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:04 | FromDiscord | <dom96> In reply to @Rika "if you havent heard,": Is it? |
11:03:43 | FromDiscord | <haolian9 (高浩亮)> sent a code paste, see https://paste.rs/GtA |
11:05:06 | FromDiscord | <Rika> Because it defaults to field when you call it with “field syntax” (or method call syntax) |
11:05:30 | FromDiscord | <Rika> So it’s like (l.name)() trying to call the field value like a proc |
11:09:25 | FromDiscord | <Waldecir Santos> Is it possible to get a list of all declared objects/types at compile type ? |
11:11:56 | FromDiscord | <haolian9 (高浩亮)> could you share some ref? i can not find any thing about UFC, except a wiki page↵(@Rika) |
11:12:13 | FromDiscord | <Rika> It’s in the manual somewhere lol I can’t check right now |
11:14:51 | FromDiscord | <xflywind> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
11:22:10 | FromDiscord | <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:47 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "Is it possible to": no unless you annotate them with some kind of pragma |
11:32:05 | FromDiscord | <haxscramper> in general, macros cannot access the source code outside of their scope |
11:36:06 | FromDiscord | <Waldecir Santos> got it, would be possible to show me how to use pragma for it ? |
11:37:04 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Q8I |
11:43:36 | FromDiscord | <Waldecir Santos> oh yeah but it will be outside the scope I need,!thank you |
11:44:15 | FromDiscord | <haxscramper> if the code is typed you can traverse the definitions using `.getTypeImpl()` |
11:44:48 | FromDiscord | <haxscramper> random combinations of `getTypeImpl()`, `getTypeInst()` or `getType()` for the fields, arguments and so on |
11:48:15 | FromDiscord | <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:10 | FromDiscord | <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:06 | FromDiscord | <enthus1ast> Nim cannot natively use socks |
13:02:21 | FromDiscord | <enthus1ast> Http proxy might work though |
13:04:00 | FromDiscord | <rakgew> so HTTP\_PROXY instead of HTTPS\_PROXY? enthus1ast thank you - will give it shot. |
13:05:02 | FromDiscord | <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:55 | FromDiscord | <rakgew> hm. unfortunately not. with python I could use\: `torsocks python3 -m pip install packagename` |
13:09:05 | FromDiscord | <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:05 | FromDiscord | <enthus1ast> Torsocks use LD\_PRELOAD this imho does not work with nim executables |
13:09:06 | FromDiscord | <rakgew> yes they do. thank you for the hint. |
13:10:38 | FromDiscord | <enthus1ast> https://github.com/nim-lang/nimble/commit/50d2637b04d9c7228e34c2ac5ec85f811804be7c |
13:11:32 | FromDiscord | <enthus1ast> I would set up a http(s) to socks/tor proxy and connect to these |
13:12:34 | FromDiscord | <enthus1ast> But I can imagine that there are other dragons |
13:13:30 | FromDiscord | <rakgew> I would not be surprised. thank you for the link. |
13:14:19 | FromDiscord | <enthus1ast> It would be nice when the proxy stuff in httpclient would be pluggable |
13:14:42 | FromDiscord | <enthus1ast> So that users can implement their own proxy routines |
13:15:19 | FromDiscord | <enthus1ast> I had to fork httpclient to let it connect to socks directly |
13:16:04 | FromDiscord | <rakgew> ouh, I agree. |
13:18:01 | FromDiscord | <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:55 | NimEventer | New 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:17 | nrds | <games/freenode99> <rasengan> Decision has been made <rasengan> We have to drain this swamp |
16:39:19 | nrds | <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:23 | nrds | <games/freenode99> <rasengan> Decision has been made <rasengan> We have to drain this swamp |
16:39:25 | nrds | <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:26 | PMunch | Uhm, what? |
16:46:44 | PMunch | Prestige, is your bot bridging stuff from other channels now? |
17:06:24 | nrds | <Prestige99> They added a freenode bridge and libera people keep going on the freenode channels and spamming |
17:07:01 | FromDiscord | <ShalokShalom> hi there↵↵I am new, and like to replace my bash script with some Nim |
17:07:32 | FromDiscord | <ShalokShalom> Is this possible/advisable, and if yes, how to do stuff such as mkdir and so on? |
17:07:46 | FromDiscord | <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:56 | FromDiscord | <Phil> sent a long message, see https://paste.rs/QYh |
17:10:06 | PMunch | @ShalokShalom, Nim isn't really meant as a bash replacement, but it can certainly be used as one |
17:10:44 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/HMT |
17:11:06 | PMunch | You 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:32 | FromDiscord | <ShalokShalom> Is this enough? https://nim-lang.github.io/Nim/os.html |
17:11:38 | FromDiscord | <ShalokShalom> Thanks |
17:11:58 | PMunch | Not 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:21 | PMunch | Yeah I mean that's how you would normally create folders and such |
17:12:40 | FromDiscord | <ShalokShalom> nimcr? https://media.discordapp.net/attachments/371759389889003532/945005044984606750/Screenshot_20220220_181216.png |
17:13:09 | FromDiscord | <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:26 | FromDiscord | <ShalokShalom> missing that too |
17:13:38 | PMunch | @Phil, essentially it tries to make the compile-time more static-y, which it can't, and then it gets confused |
17:13:52 | PMunch | Not a path, the PATH |
17:14:22 | FromDiscord | <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:23 | PMunch | Essentially 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:41 | PMunch | @ShalokShalom, nimcr: https://github.com/PMunch/nimcr |
17:14:45 | FromDiscord | <ShalokShalom> thanks a lot |
17:14:58 | PMunch | @Phil, pretty much |
17:14:59 | FromDiscord | <Phil> Somewhere there is an xzibit yo dawg meme to be made from my sentence |
17:15:08 | PMunch | Haha :P |
17:15:32 | FromDiscord | <demotomohiro> @ShalokShalom https://nim-lang.org/docs/nims.html↵Please read Standalone NimScript section |
17:15:32 | PMunch | Nim should probably just ignore static in a {.compileTime.} proc, maybe create an issue for this on GitHub |
17:15:35 | FromDiscord | <Phil> What's fascinating is that static asserts in a compileTime proc do work to a degree! |
17:16:12 | FromDiscord | <ShalokShalom> ok |
17:16:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QaP |
17:16:39 | FromDiscord | <Phil> It works absolutely flawlessly, though I guess I should throw out the static in there and see if that still works |
17:17:56 | FromDiscord | <Phil> Huh, yeah, works still when I remove the static from the asserts |
17:18:25 | FromDiscord | <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:34 | FromDiscord | <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:10 | FromDiscord | <ShalokShalom> PMunch: I see exec used in the NimScript example. Is it different from execCmd? |
17:21:44 | PMunch | Yes, NimScript is the parts of Nim which can run during compile-time |
17:22:02 | PMunch | It's kind of the same language, kinda not |
17:22:41 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/nimscript.html#exec%2Cstring |
17:23:41 | FromDiscord | <demotomohiro> NimScript can be executed like bash script with `nim myscript.nims`. |
17:25:47 | PMunch | NimScript 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:06 | FromDiscord | <ShalokShalom> No, I think both of you lovely people understood something else, as I mean |
17:26:49 | FromDiscord | <ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/945008604078047322/Screenshot_20220220_182624.png |
17:27:20 | FromDiscord | <ShalokShalom> Difference? https://media.discordapp.net/attachments/371759389889003532/945008738039910470/Screenshot_20220220_182701.png |
17:29:56 | FromDiscord | <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:29 | FromDiscord | <demotomohiro> `exec` is a proc in nimscript module and execCmd is a proc in osproc module that is unavailable in nimscript |
17:30:59 | FromDiscord | <ShalokShalom> Yeah, just figured that. |
17:31:13 | FromDiscord | <ShalokShalom> So exec is in both? |
17:31:56 | FromDiscord | <ShalokShalom> Like, is there a subset of NimScript, that cant be used in normal Nim either? |
17:32:55 | FromDiscord | <ShalokShalom> And I think nimcr could be part of the official distribution. Seems kinda basic. |
17:38:06 | FromDiscord | <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:35 | FromDiscord | <demotomohiro> Did you tried `strip` command? |
17:46:12 | FromDiscord | <Zajt> Yeah I have that one |
17:46:41 | FromDiscord | <Zajt> `nim c -d:strip --hints:off --warnings:off -d:verbose -d=mingw -d:exportExe out.nim` |
17:53:16 | FromDiscord | <huantian> @Zajt compile with -d:release |
17:55:08 | FromDiscord | <Zajt> In reply to @huantian "<@!290456415963709440> compile with -d:release": I tried with that earlier but couldn't run the binary then |
17:58:47 | FromDiscord | <Zajt> and I still don't know why that happened, it's really odd |
17:58:49 | FromDiscord | <huantian> Don’t know then, compiling with release always removed the debug strings which referenced the compilation file |
17:58:54 | FromDiscord | <huantian> (edit) "file" => "folder" |
17:59:11 | FromDiscord | <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:26 | FromDiscord | <demotomohiro> Did you tried `strip <your executable file>` command? |
18:12:20 | FromDiscord | <Zajt> that worked to remove it, thanks! |
18:19:41 | FromDiscord | <Zajt> or actually the path is still there |
18:24:37 | FromDiscord | <demotomohiro> Exception, stack trace or assert need to print file path. You might need to use `-d:danger` option. |
18:24:50 | FromDiscord | <b4mbus> Has anyone here tested `nlvm` and compared it to casual `nim` compilation with different options? |
18:28:13 | FromDiscord | <Mysterysib> I'm really stuck with pointers in Nim |
18:28:17 | FromDiscord | <Zajt> What does that one do? |
18:28:43 | FromDiscord | <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:53 | FromDiscord | <Mysterysib> When I do this check, the compiler doesn't understand |
18:29:41 | PMunch | @Mysterysib, that doesn't sound like something you should need pointers for.. |
18:30:13 | FromDiscord | <Mysterysib> Ah, I was thinking that maybe if I used pointers to change the datatype the compiler wouldn't complain |
18:30:54 | FromDiscord | <huantian> In reply to @Zajt "What does that one": Danger disables runtime checks |
18:31:09 | FromDiscord | <haolian9 (高浩亮)> can anyone elaborate thread's `no heap sharing restriction`? does it means i can not share a db connection between threads? |
18:31:16 | FromDiscord | <huantian> But if relrase doesn’t work ifk |
18:31:21 | FromDiscord | <huantian> (edit) "relrase" => "release" | "ifk" => "idk" |
18:32:53 | FromDiscord | <Mysterysib> sent a long message, see http://ix.io/3Qcj |
18:33:08 | PMunch | haolian9_(高浩亮), probably a bad idea |
18:33:26 | FromDiscord | <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:11 | FromDiscord | <haolian9 (高浩亮)> then if i use a connectionPool instead is also a bad idea? |
18:34:14 | FromDiscord | <federico3> @dom96\: why is https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m without a CVE? |
18:35:02 | PMunch | @Mysterysib, you can't assign to an argument if it isn't defined as `var` |
18:35:24 | PMunch | And 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:46 | PMunch | e.g. `let mystr = "Hello"; genJsonArray(mystr)` won't work |
18:35:51 | FromDiscord | <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:12 | PMunch | haolian9_(高浩亮), it all depends on how your application is built and what your database supports |
18:38:26 | FromDiscord | <Mysterysib> Ah Okay |
18:39:45 | FromDiscord | <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:16 | FromDiscord | <Mysterysib> `but expression 'JN' is of type: char`, but that part shouldn't run when `JN` is a char |
18:40:29 | FromDiscord | <Mysterysib> That's why I was thinking of using pointers |
18:40:39 | FromDiscord | <Mysterysib> I've been on this bug for like an hour 😢 |
18:40:54 | PMunch | The code is still invalid even if a runtime condition is not met |
18:41:27 | PMunch | You can try `firstIter: static[bool]` and then use a `when firstIter` statement |
18:41:42 | PMunch | I'm guessing that is only there to control some kind of recursion |
18:42:20 | FromDiscord | <Mysterysib> Yeah, and yep that worked |
18:42:27 | FromDiscord | <Mysterysib> Thank you |
18:42:47 | FromDiscord | <Mysterysib> What is the logic behind that so I can understand this moving forward? I'm still learning the language |
18:43:32 | FromDiscord | <Mysterysib> Is it because the compiler wants to make sure the bool doesn't change within the function? |
18:45:08 | PMunch | No |
18:45:36 | PMunch | Essentially 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:52 | PMunch | So the compiler needs to generate the code-path for what should happen when it is true |
18:46:04 | PMunch | But the code there is invalid, so it throws an error |
18:46:46 | PMunch | When 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:14 | PMunch | It basically turns it into two separate procedures, and which one is called depends on what you pass in as firstIter |
18:48:23 | PMunch | I 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:17 | PMunch | But 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:17 | PMunch | Since 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:45 | PMunch | And 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:36 | FromDiscord | <Mysterysib> Oh okay thank you I understand |
18:59:26 | * | slowButPresent joined #nim |
19:20:10 | * | neurocyte0917090 quit (Ping timeout: 272 seconds) |
19:24:45 | FromDiscord | <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:43 | FromDiscord | <Phil> I could use some inspiration for type naming |
19:41:40 | FromDiscord | <federico3> @dom96\: a CVE for Nim itself |
19:41:59 | FromDiscord | <Phil> sent a long message, see http://ix.io/3Qdv |
19:42:18 | FromDiscord | <Phil> Okay I need to find a way to write this shorter |
19:43:15 | FromDiscord | <Phil> (edit) "http://ix.io/3Qdv" => "http://ix.io/3Qdw" |
19:44:57 | * | neurocyte0917090 quit (Ping timeout: 256 seconds) |
19:49:23 | FromDiscord | <Phil> Well that rewrite didn't really make things shorter =/ |
19:50:20 | FromDiscord | <dom96> In reply to @federico3 "<@132595483838251008>\: a CVE for": huh? |
19:58:01 | FromDiscord | <Arathanis> In reply to @Isofruit "I have a relational": are you just looking for more descriptive named? |
19:58:16 | FromDiscord | <Phil> Yeh, solely looking for better understandable naming scheme |
19:58:26 | FromDiscord | <Phil> Which ideally hints at this 3-level-information hierarchy |
19:58:31 | FromDiscord | <Arathanis> Seems like you have 3 objects, each for the same underlying representation but with different amounts of damage |
19:59:01 | FromDiscord | <Arathanis> data |
19:59:05 | FromDiscord | <Arathanis> sorry was just playing MTG |
19:59:12 | FromDiscord | <Arathanis> burn deck, damage on the brain lol |
19:59:17 | FromDiscord | <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:17 | FromDiscord | <Arathanis> different amounts of data |
19:59:33 | FromDiscord | <Arathanis> why not something like |
19:59:49 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdE |
20:00:22 | FromDiscord | <Arathanis> or |
20:00:43 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdG |
20:01:43 | FromDiscord | <Phil> Hmm I'm a fan of your suffix idea |
20:02:54 | FromDiscord | <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:01 | FromDiscord | <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:08 | FromDiscord | <Arathanis> (edit) "OT" => "to" |
20:04:17 | FromDiscord | <Arathanis> I kind of see it has |
20:04:22 | FromDiscord | <Arathanis> ObjMin == Obj but stripped down |
20:04:37 | FromDiscord | <Arathanis> Obj is an Obj with all its data but not necessarily all its relationship data |
20:04:51 | FromDiscord | <Arathanis> ObjFull is an Obj that is fully fleshed out with all relationship connections loaded |
20:05:13 | FromDiscord | <Arathanis> but that might not be what you are doing |
20:05:23 | FromDiscord | <Arathanis> just what i mistakenly understood |
20:06:07 | FromDiscord | <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:27 | FromDiscord | <Phil> (edit) "obj" => "Obj" | "to↵ObjFull" => "pointing to them↵ObjFull" |
20:07:25 | FromDiscord | <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:44 | FromDiscord | <Phil> (edit) ""ObjFulL"" => ""ObjFull"" |
20:08:12 | FromDiscord | <Phil> I could skip the middle layer strictly speaking, but then the amount of database trips I do roughly doubles to triples. |
20:08:24 | FromDiscord | <Arathanis> Ok I got it |
20:08:28 | FromDiscord | <Phil> (edit) "speaking," => "speaking and do only "ObjMin" and "ObjFull"," |
20:09:24 | FromDiscord | <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:25 | FromDiscord | <Arathanis> (edit) "froom" => "from" |
20:10:00 | FromDiscord | <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:05 | FromDiscord | <Arathanis> don't fall into the trap of premature optimization |
20:10:25 | FromDiscord | <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:54 | FromDiscord | <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:28 | FromDiscord | <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:44 | FromDiscord | <Phil> (edit) "Django." => "Django (if you're not familiar, another web-framework but in python)." |
20:11:59 | FromDiscord | <Arathanis> oh python is my strongest language im very familiar haha |
20:12:14 | FromDiscord | <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:28 | FromDiscord | <Phil> Which is completely irrelevant |
20:12:36 | FromDiscord | <Phil> And solely for my own fun to see if I can ^^ |
20:12:39 | FromDiscord | <Arathanis> if its an experiment in optimization than forge onward! |
20:12:42 | FromDiscord | <Arathanis> ive been there |
20:13:17 | FromDiscord | <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:25 | FromDiscord | <Arathanis> and i often find myself trying to make it ever faster as part of the fun of it |
20:13:40 | FromDiscord | <Phil> Heh, I'm starting to develop the trend of just re-implementing my backend |
20:13:54 | * | cyraxjoe joined #nim |
20:13:59 | FromDiscord | <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:40 | FromDiscord | <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:25 | FromDiscord | <Phil> Never thought I'd find myself writing (stealing) code to build a django-signal like system |
20:18:11 | PMunch | Hmm, @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:20 | FromDiscord | <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:32 | FromDiscord | <Phil> (edit) "fast" => "fast. To the point I wish I could comprehend libsodium to use one of its wrappers" |
20:19:41 | FromDiscord | <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:02 | PMunch | Hmm |
20:20:26 | PMunch | I placed it in the same directory as my library files, but nimscript isn't able to find it |
20:20:48 | FromDiscord | <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:51 | PMunch | I guess the import resolution for NimScript doesn't take into account the nimble path.. |
20:21:14 | FromDiscord | <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:18 | FromDiscord | <Arathanis> and provide a spec |
20:21:26 | PMunch | Huh? |
20:21:52 | FromDiscord | <Arathanis> maybe im confused as to what you are trying to accomplish, I usually use `.nims` files for `config.nims` haha |
20:22:01 | FromDiscord | <Arathanis> you must be doing actual scripting stuff, just ignore me :] |
20:22:05 | PMunch | Yes, that's what I'm trying to do |
20:22:20 | PMunch | Not at all |
20:23:02 | PMunch | The 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:16 | PMunch | Currently the getting started guide looks like this: https://ratel.peterme.net/gettingstarted.html |
20:24:12 | FromDiscord | <dom96> In reply to @PMunch "I guess the import": Possible. Wouldn’t be surprised if that’s the case. |
20:24:22 | PMunch | What 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:45 | FromDiscord | <Arathanis> ahhh |
20:25:24 | FromDiscord | <federico3> @dom96\: the vuln seems to affect Nim's stdlib. If so there has to be a CVE assigned to Nim itself |
20:35:46 | FromDiscord | <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:01 | FromDiscord | <dom96> Not sure we can get that changed now |
20:37:30 | FromDiscord | <Arathanis> In reply to @PMunch "What I want to": what about an environment variable targetting the board config file |
20:38:06 | PMunch | Not sure how that would solve anything |
20:39:50 | FromDiscord | <Arathanis> you are trying to get all these special config variables loaded, right? |
20:41:34 | FromDiscord | <Arathanis> is it the compiler variables you are setting? |
20:42:37 | PMunch | Yes |
20:43:42 | FromDiscord | <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:49 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3QdS |
20:44:09 | * | jmdaemon joined #nim |
20:46:15 | FromDiscord | <Waldecir Santos> I can just use T, 🤦♂️ |
20:48:43 | PMunch | Oooh, so apparently it can't have the `.nims` filename, it has to be a regular `.nim` file |
20:49:41 | FromDiscord | <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:15 | FromDiscord | <Waldecir Santos> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": Awesome thank you |
21:25:06 | FromDiscord | <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:46 | FromDiscord | <Forest> How would i use the `{.used.}` pragma on imports? |
21:31:17 | NimEventer | New 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:32 | PMunch | @Forest, why do you want that? |
21:36:46 | FromDiscord | <Forest> To suppress certain unused imports |
21:37:12 | FromDiscord | <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:19 | FromDiscord | <demotomohiro> That means you have unused code that uses procedures in the module you want to add `{.used.}`? |
21:57:56 | FromDiscord | <Forest> The files I'm importing having nothing besides initialisation code |
21:58:55 | FromDiscord | <adokitkat> sent a code paste, see https://paste.rs/hkF |
21:59:36 | FromDiscord | <adokitkat> It's something about closures, I don't get it |
22:00:21 | FromDiscord | <huantian> I might be misreading on mobile but it seems that the function is asking for a proc which returns nothing |
22:00:45 | FromDiscord | <huantian> But you give it one which returns int |
22:01:13 | FromDiscord | <adokitkat> oh |
22:01:47 | PMunch | Aaah I see @Forest, and `import something {.used.}` doesn't work? |
22:02:02 | PMunch | If 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:19 | FromDiscord | <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:56 | FromDiscord | <Forest> In reply to @PMunch "Aaah I see <@909883978717204561>,": Let me double check |
22:24:45 | FromDiscord | <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:06 | NimEventer | New 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:14 | FromDiscord | <abdu> How to count a character occurrences in string in Nim, using its native statements |