00:10:15 | FromDiscord | <treeform> I am not a sqlite db exert. But yes in theory because it does file io it can be async. |
00:10:34 | FromDiscord | <treeform> But no os does not provides an async file API. So you have to use threads for that. |
00:10:37 | * | lucerne0 joined #nim |
00:10:50 | FromDiscord | <treeform> Node JS emulates async file api with threads for example. |
00:11:34 | * | lucerne quit (Ping timeout: 250 seconds) |
00:11:35 | * | lucerne0 is now known as lucerne |
00:12:30 | arkanoid | treeform: https://nim-lang.org/docs/asyncfile.html ? |
00:13:10 | * | wyrd quit (Remote host closed the connection) |
00:15:19 | * | tiorock joined #nim |
00:15:19 | * | tiorock quit (Changing host) |
00:15:19 | * | tiorock joined #nim |
00:15:19 | * | rockcavera is now known as Guest5006 |
00:15:19 | * | Guest5006 quit (Killed (strontium.libera.chat (Nickname regained by services))) |
00:15:19 | * | tiorock is now known as rockcavera |
00:16:00 | FromDiscord | <treeform> I think that tries to emulate an async api over what OS provides. But OS api is kind of meh. |
00:18:07 | arkanoid | treeform, sincerely curious why you think this |
00:18:21 | * | wyrd joined #nim |
00:21:24 | * | jmdaemon quit (Ping timeout: 240 seconds) |
00:22:03 | FromDiscord | <treeform> I think most of my knowable comes with working with libuv and might be wrong when applied to other things: https://nikhilm.github.io/uvbook/filesystem.html |
00:22:06 | FromDiscord | <auxym> this might be of interest, io_uring is very recent and meant to adress issues with older linux APIs for async file IO https://www.phoronix.com/scan.php?page=news_item&px=Linux-io_uring-Fast-Efficient |
00:25:31 | * | wyrd quit (Remote host closed the connection) |
00:25:42 | * | wyrd joined #nim |
00:27:39 | * | vicfred_ joined #nim |
00:27:44 | FromDiscord | <treeform> In reply to @arkanoid "<@107140179025735680>, sincerely curious why": https://github.com/nim-lang/Nim/issues/7422#issuecomment-376482556 |
00:27:53 | * | vicfred quit (Read error: Connection reset by peer) |
00:27:54 | * | lucerne quit (Quit: Ping timeout (120 seconds)) |
00:29:04 | * | lucerne joined #nim |
00:29:18 | FromDiscord | <treeform> In reply to @arkanoid "<@107140179025735680>, sincerely curious why": https://github.com/nim-lang/Nim/issues/11564 |
00:30:05 | FromDiscord | <treeform> In reply to @arkanoid "<@107140179025735680>, sincerely curious why": https://github.com/nim-lang/Nim/issues/6054 |
00:32:57 | * | vicfred_ quit (Quit: Leaving) |
00:59:54 | FromDiscord | <abdu> how do in batch identifier a ,b, c, ...i is to be fiiled with array `arr :seq[int] = @[41, 3, 9, 33, 7, 99, 17, 8, 2]`↵? |
01:01:35 | * | jmdaemon joined #nim |
01:01:39 | FromDiscord | <auxym> ? |
01:02:42 | FromDiscord | <Elegantbeef> Nim only does tuple unpacking so you'd need a library like https://github.com/haxscramper/hmatching#custom-unpackers |
01:03:33 | FromDiscord | <Elegantbeef> ! |
01:03:43 | FromDiscord | <Elegantbeef> I think they want to unpack it |
01:04:10 | FromDiscord | <Elegantbeef> otherwise you just do `var a, b, c, d, e, f, g, j, i = @[41, 3, 9, 33, 7, 99, 17, 8, 2]` and get the worlds worst code |
01:07:34 | FromDiscord | <huantian> hm I wonder what what the least amount of code to segfault in nim is↵the best I came up with is `echo cast[ptr[int]](0)[]` |
01:08:52 | FromDiscord | <Elegantbeef> Why are you echoing? |
01:09:23 | FromDiscord | <Elegantbeef> Damn we cant cast to void! |
01:09:29 | FromDiscord | <Elegantbeef> 😛 |
01:10:09 | FromDiscord | <Rika> `echo cstring nil`? I don’t know |
01:10:18 | FromDiscord | <civbag> In reply to @huantian "hm I wonder what": i need KEKW emoji for this |
01:10:54 | FromDiscord | <Rika> !eval echo cstring nil |
01:10:56 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <cstring> |
01:11:02 | FromDiscord | <Rika> Hmm |
01:11:10 | FromDiscord | <ynfle> !eval echo $ cstring nil |
01:11:12 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <proc (x: varargs[typed]){.gcsafe, locks: 0.}, cstring> |
01:11:17 | FromDiscord | <Rika> Shouldn't be needed |
01:11:32 | FromDiscord | <ynfle> !eval echo cstring("this") |
01:11:34 | NimBot | this |
01:11:44 | NimEventer | New question by itil memek cantik: Do quick batch work initializing, fiiling so many identifiers with array, see https://stackoverflow.com/questions/71151265/do-quick-batch-work-initializing-fiiling-so-many-identifiers-with-array |
01:11:48 | FromDiscord | <Rika> !eval echo nil.cstring |
01:11:50 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <cstring> |
01:12:02 | FromDiscord | <Rika> Nil can’t be cstring? I guess |
01:13:01 | FromDiscord | <Elegantbeef> !eval (var b = (ref int)(nil); b[] = 0) |
01:13:04 | NimBot | Traceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)↵Segmentation fault (core dumped) |
01:13:07 | FromDiscord | <Rika> Pretty long |
01:13:24 | FromDiscord | <Elegantbeef> nil deference protection dumb safe language |
01:13:32 | FromDiscord | <Rika> discard would look shorter.. |
01:13:53 | FromDiscord | <huantian> discard doesn't seem to actually do the deref tho |
01:13:54 | FromDiscord | <Elegantbeef> discard is optimized away |
01:15:21 | FromDiscord | <Elegantbeef> Due to nil safety i dont think we can do it any shorter than the cast method |
01:16:43 | FromDiscord | <Elegantbeef> @abdu\: is there any reason you ask a question here make a SO post then delete it always? |
01:18:11 | FromDiscord | <huantian> I wonder if emitting c would be less characters |
01:18:22 | FromDiscord | <Rika> Then it’s not Nim exactly |
01:18:49 | FromDiscord | <Elegantbeef> I realize `(var b: ref int; b[] = 0)` is shorter |
01:18:57 | FromDiscord | <Elegantbeef> But still not as short as possible |
01:19:09 | FromDiscord | <abdu> In reply to @Elegantbeef "otherwise you just do": For sake of ease, sorry, its oversimplified↵Real case is at same time all is converted to string i.e $ prefixed↵So how to perfect your answer |
01:19:40 | FromDiscord | <huantian> In reply to @Rika "Then it’s not Nim": Yeah true |
01:20:56 | FromDiscord | <Elegantbeef> You want to assign all the variables to the string version of the sequence? |
01:25:23 | FromDiscord | <huantian> Or maybe each element in the sequence is converted to a string? |
01:26:42 | * | jmdaemon quit (Ping timeout: 272 seconds) |
01:30:19 | FromDiscord | <Elegantbeef> No clue elaboration makes helping easier |
01:35:10 | * | ltriant joined #nim |
01:36:39 | * | jmdaemon joined #nim |
01:53:29 | arkanoid | does awaiting this "https://nim-lang.org/docs/asyncnet.html#send%2CAsyncSocket%2Cstring" assures that all the ACKs have been received and that the destination has received all the bits? |
01:54:07 | arkanoid | the docs just says "The returned future will complete once all data has been sent", that does not necessarily means that the destination has the data |
01:57:43 | arkanoid | I know that "destination" means remote kernel, and not remote userland app, but question stands |
02:30:40 | * | jmdaemon quit (Ping timeout: 272 seconds) |
02:40:23 | * | jmdaemon joined #nim |
02:42:18 | FromDiscord | <demotomohiro> I think you will find out the answer by reading documents related to OS API that is used to implement that `send` procedure.↵It seems `send` procs in asyncnet module calls `send` proc in `asyncdispatch` module. |
02:57:29 | * | krux02 quit (Remote host closed the connection) |
03:02:20 | madprops | this is why I say lua is too barebones https://stackoverflow.com/questions/22831701/lua-read-beginning-of-a-string |
03:03:36 | * | neurocyte0917090 quit (Ping timeout: 272 seconds) |
03:03:57 | FromDiscord | <huantian> not related to lua but my brain hates it when people don't put spaces after their commas |
03:11:24 | FromDiscord | <Rika> I thought I somehow joined a Lua server |
03:23:15 | * | arkurious quit (Quit: Leaving) |
03:38:49 | * | keyehzh quit (Read error: Connection reset by peer) |
03:39:19 | * | keyehzh joined #nim |
03:42:03 | * | keyehzh quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:31 | * | supakeen joined #nim |
04:19:20 | FromDiscord | <huantian> we're rebranding to Luaim |
04:36:51 | FromDiscord | <Mysterysib> Hi |
04:36:58 | FromDiscord | <Elegantbeef> Hello |
04:38:31 | FromDiscord | <huantian> Hewoo |
05:00:35 | NimEventer | New post on r/nim by Yinisiki: Why am i Unable to run recursion over directories??, see https://reddit.com/r/nim/comments/sughj3/why_am_i_unable_to_run_recursion_over_directories/ |
05:11:47 | * | Gustavo6046 quit (Quit: Leaving) |
05:15:17 | * | slowButPresent quit (Quit: leaving) |
05:59:37 | * | tiorock joined #nim |
05:59:37 | * | tiorock quit (Changing host) |
05:59:37 | * | tiorock joined #nim |
05:59:37 | * | rockcavera is now known as Guest3037 |
05:59:37 | * | tiorock is now known as rockcavera |
06:02:43 | * | Guest3037 quit (Ping timeout: 256 seconds) |
06:41:36 | FromDiscord | <civbag> In reply to @huantian "we're rebranding to Luaim": That's cool |
06:58:11 | * | rockcavera quit (Remote host closed the connection) |
07:21:44 | * | jjido joined #nim |
07:25:33 | * | jjido quit (Client Quit) |
08:05:20 | * | jjido joined #nim |
08:28:04 | FromDiscord | <haxscramper> In reply to @jmgomez "So I got this": you were compiling the code using `nim cpp file.nim`, right? |
08:28:14 | FromDiscord | <haxscramper> and it did not generate `extern "C"` for you automatically? |
08:28:39 | FromDiscord | <haxscramper> I tried doing the same just now, and proc annotated with `.exportc.` generated extern annotation properly |
08:28:46 | FromDiscord | <haxscramper> `extern "C" void exportedProc(void) {` |
08:31:11 | * | PMunch joined #nim |
08:39:09 | om3ga | Hi! Is there any lib or framework for audio analyzis in nim? |
08:39:24 | * | Vladar joined #nim |
08:49:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:07:39 | FromDiscord | <mratsim> In reply to @om3ga "Hi! Is there any": for writing audio kernels: https://github.com/vitreo12/omni |
09:09:29 | * | jjido joined #nim |
09:12:15 | om3ga | mratsim thanks! |
09:13:27 | FromDiscord | <mratsim> In reply to @om3ga "mratsim thanks!": There is a full talk about it, let me see |
09:13:42 | FromDiscord | <mratsim> https://www.youtube.com/watch?v=ruT7sbs5O-Q |
09:14:44 | om3ga | awesome. I want to do some analyzis for my study. I hope I will able to integrate it with NiGui app |
09:44:54 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:02:38 | * | jjido joined #nim |
10:04:35 | * | neurocyte0917090 joined #nim |
10:11:45 | FromDiscord | <enthus1ast> in the db\_mysql (exec etc) all params are converted to string, but LIMIT only accepts int, so its a syntax error if a string is provided |
10:12:15 | FromDiscord | <enthus1ast> do you see any other way to string interpolate? |
10:12:39 | FromDiscord | <enthus1ast> i mean i can and it should be safe since i use the parsed int |
10:15:00 | FromDiscord | <enthus1ast> also mariadb does not accept shenanigans ala\: CAST('2' as int) in limit .... |
10:26:43 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:31:48 | * | jjido joined #nim |
10:35:21 | * | jjido quit (Client Quit) |
10:42:32 | FromDiscord | <carpal> https://media.discordapp.net/attachments/371759389889003532/943819701170098306/unknown.png |
10:42:41 | FromDiscord | <carpal> is this a problem= |
10:42:43 | FromDiscord | <carpal> (edit) "problem=" => "problem?" |
10:43:00 | * | neurocyte0917090 quit (Ping timeout: 240 seconds) |
10:57:35 | FromDiscord | <enthus1ast> any idea why the mariadb returns "ISO-8859-1" rows? The databse should operate on utf8mb4 |
10:57:47 | FromDiscord | <enthus1ast> is this a client setting? |
10:59:00 | * | krux02 joined #nim |
10:59:09 | FromDiscord | <enthus1ast> ok setEncoding is athing |
11:01:05 | * | rp1 quit (Ping timeout: 256 seconds) |
11:01:28 | FromDiscord | <enthus1ast> ok this works good (strange that utf-8 (plus the correct db suffix) is not default |
11:01:48 | FromDiscord | <enthus1ast> who in the world wants to store data in different encoding in 2022 |
11:02:25 | FromDiscord | <enthus1ast> given that you're not russian or chinese and store massive amount of data |
11:02:35 | FromDiscord | <congusbongus> mariadb aka mysql has always been a bit of an oddball |
11:02:44 | FromDiscord | <congusbongus> also it's quite old |
11:04:33 | FromDiscord | <Rika> In reply to @carpal "is this a problem?": Why do you use none as a gc? |
11:12:21 | FromDiscord | <tandy> does anyone know how to not use a dependency when install nimble deps ? |
11:12:28 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PPI |
11:12:29 | FromDiscord | <tandy> this isnt working \:o |
11:13:26 | FromDiscord | <jmgomez> In reply to @haxscramper "and it did not": you are right I just checked and Im seeing it twice I wanted to avoid the redefinition in the cpp side of things but I think it's mandatory to have it on the declaration, isnt it? |
11:15:16 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PPJ |
11:16:48 | FromDiscord | <haxscramper> `sym.flags {sfImportc, sfExportc} != {}` on the cpp backend will generate extern |
11:16:52 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/oSN |
11:18:14 | FromDiscord | <haxscramper> ok, so if compiles to cpp extern "C" is implicit if `.exportc.` is used |
11:18:36 | FromDiscord | <jmgomez> but what I mean is, in order to use these functions from cpp you need to forward declare them, and they must have extern in the cpp side of things |
11:18:43 | FromDiscord | <jmgomez> dont they? |
11:19:13 | FromDiscord | <haxscramper> they do |
11:19:44 | FromDiscord | <haxscramper> if you annotate nim proc with `.exportc.` it will generate forward-declared prototype with `extern "C"` annotation |
11:20:22 | FromDiscord | <haxscramper> When calling `nim cpp` extern is used to avoid name mangling |
11:20:36 | FromDiscord | <haxscramper> and when compiling your C++ code, `extern "C"` is used to be able to interface with these procs |
11:20:43 | FromDiscord | <haxscramper> I think that's how it generally works |
11:20:50 | FromDiscord | <jmgomez> this is what I mean https://media.discordapp.net/attachments/371759389889003532/943829337365446686/unknown.png |
11:21:18 | FromDiscord | <jmgomez> If I remove extern on the cpp it cant bind the function from the dl |
11:21:22 | FromDiscord | <jmgomez> (edit) "dl" => "dll" |
11:23:26 | FromDiscord | <haxscramper> can you show the build script? You still need to pass the `-ltest` when compiling the code if you are using dynamic linker (which you do, the other alternative is manually writing `dlopen` code) |
11:23:36 | FromDiscord | <haxscramper> so `clang++ -ltests main.cpp` |
11:24:06 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PPM |
11:24:24 | FromDiscord | <jmgomez> (edit) "https://play.nim-lang.org/#ix=3PPM" => "https://play.nim-lang.org/#ix=3PPN" |
11:26:59 | FromDiscord | <haxscramper> why split into two steps? And I'm not sure whether g++ needs `-ltest` only on linking `g++ -o`. Maybe compilation (`g++ -c`) also needs this |
11:28:57 | FromDiscord | <jmgomez> I dont thing that influence the result, it's just a test. My plan is to study the viability of using nim to build a sdk that works from UE, Unity, native Cpp and js. So that cpp test doesnt really bothers me |
11:31:29 | FromDiscord | <jmgomez> Im downloading clang to see if it works there |
11:36:56 | FromDiscord | <jmgomez> Im seeing that when I export with the --header flag it does add the extern, that should be enough |
11:37:40 | FromDiscord | <jmgomez> (edit) "extern," => "extern to the header," | "extern to the header,that should be enough ... " added "to avoid all the manuals forward declare" |
11:39:17 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/2YV |
11:39:26 | FromDiscord | <haxscramper> (edit) "https://play.nim-lang.org/#ix=3PPR" => "https://play.nim-lang.org/#ix=3PPS" |
11:44:44 | FromDiscord | <jmgomez> Thanks! That's similar of what Im doing though, you still have to forward declare it on cpp (but I guess that it could be automatized) |
11:45:09 | FromDiscord | <jmgomez> One other question, is what about static libraries? Is there a compiler option for those too? (iOS need libraries to be static) |
11:45:23 | FromDiscord | <haxscramper> `--app:staticlib` |
11:45:28 | FromDiscord | <jmgomez> lovely |
11:45:48 | FromDiscord | <jmgomez> thanks a lot for your help man, it's really appreciated it! |
11:46:43 | FromDiscord | <haxscramper> In reply to @jmgomez "Thanks! That's similar of": `--header` will generate header file in the `nimcache/file.h` |
11:47:04 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PPU |
11:47:11 | FromDiscord | <haxscramper> (edit) |
11:47:34 | FromDiscord | <jmgomez> unfortunately you cant just import it directly because of how it is build i.e https://media.discordapp.net/attachments/371759389889003532/943836063993065512/unknown.png |
11:49:15 | FromDiscord | <haxscramper> `g++ -P -I$E:HOME/.choosenim/toolchains/nim-1.6.2/lib/ -E nimcache/file.h > cleaned.h` |
11:50:33 | FromDiscord | <haxscramper> actually no |
11:50:46 | FromDiscord | <haxscramper> just write your own clean nimbase and expand `file.h` to something useful |
11:52:16 | FromDiscord | <haxscramper> `g++ -P -I(pwd) -E nimcache/file.h` will give you |
11:52:29 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PPV |
11:52:53 | FromDiscord | <haxscramper> and you can just define the helper macros how you need |
11:53:08 | FromDiscord | <jmgomez> okay, that sounds good. Will take a lot at that after I figured out others concerns.. btw do you know if nim has an event system that works across different compilation targets (js, cpp) and can be easily be consumed via them? Or it will be just better to use callbacks? |
11:53:23 | FromDiscord | <haxscramper> event system like qt signals? |
11:53:24 | FromDiscord | <haxscramper> no |
11:53:42 | FromDiscord | <haxscramper> at least I"m not aware of any library and there is certainly no built-in functionality like this |
11:54:35 | FromDiscord | <jmgomez> okay! |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:31 | * | supakeen joined #nim |
12:06:36 | * | jmdaemon quit (Ping timeout: 240 seconds) |
12:15:01 | * | jjido joined #nim |
12:28:11 | FromDiscord | <adokitkat> Hi, did anybody setup nimforum locally? I got it working, had a bit of problems with logging in (set cookie didn't work so I added the "sid" cookie manually), I can create posts but I search returns empty [] everytime. Even tho DB should be connected when the added posts show up. |
12:30:52 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:11:04 | * | slowButPresent joined #nim |
13:14:19 | * | rockcavera joined #nim |
13:14:19 | * | rockcavera quit (Changing host) |
13:14:19 | * | rockcavera joined #nim |
13:29:51 | PMunch | I assume dom96 has run it locally |
13:30:54 | FromDiscord | <adokitkat> yeah I am waiting for his answer on github so I tried to ask here 😄 |
13:31:40 | FromDiscord | <adokitkat> I am trying to debug this https://forum.nim-lang.org/t/8921 |
13:32:04 | FromDiscord | <enthus1ast> thats a pretty nasty one indeed |
13:35:17 | PMunch | I'm debating deleting that topic, this really should've been disclosed properly as it might be possible to abuse.. |
13:41:51 | FromDiscord | <auxym> someone should probably at least deploy an emergency fix that strips the parens or something. |
13:43:18 | PMunch | Definitiely |
13:45:18 | * | jjido joined #nim |
13:48:42 | FromDiscord | <vegai> Nobody uses parentheses though |
13:48:59 | FromDiscord | <Rika> That’s not the issue though |
13:52:34 | * | crem1 quit (Quit: WeeChat 3.3) |
14:06:35 | * | arkurious joined #nim |
14:13:58 | FromDiscord | <adokitkat> In reply to @auxym "someone should probably at": i posted merge request yesterday |
14:14:11 | FromDiscord | <adokitkat> and we were debating the issue there |
14:14:39 | FromDiscord | <adokitkat> to fix it more thoroughly |
14:19:32 | FromDiscord | <adokitkat> does anyone here knows SQL? Can MATCH operator in sqlite3 be changed to LIKE? MATCH seems to accept SQL subset and LIKE is more of just a pattern matching... |
14:20:00 | FromDiscord | <adokitkat> I would test it but as I said I cannot get search to work on my local nimforum |
14:25:08 | FromDiscord | <auxym> if this actually crashes the whole forum server, then I don't agree with dom, I think any sort of emergency fix that prevents crashes should be deployed and then we can spend time on figuring out the underlying issue. |
14:25:24 | FromDiscord | <auxym> No familiar enough with like/match though |
14:25:30 | * | crem joined #nim |
14:27:03 | FromDiscord | <auxym> https://www.sqlite.org/fts3.html#section_3 |
14:27:23 | FromDiscord | <auxym> "For example the LIKE query matches rows that contain terms such as "linuxophobe" or "EnterpriseLinux" (as it happens, the Enron E-Mail Dataset does not actually contain any such terms), whereas the MATCH query on the FTS3 table selects only those rows that contain "linux" as a discrete token. Both searches are case-insensitive." |
14:28:45 | FromDiscord | <auxym> https://sqlite.org/lang_expr.html |
14:28:54 | FromDiscord | <auxym> "The MATCH operator is a special syntax for the match() application-defined function. The default match() function implementation raises an exception and is not really useful for anything. But extensions can override the match() function with more helpful logic." |
14:29:57 | FromDiscord | <adokitkat> Yeah I read it |
14:30:28 | FromDiscord | <adokitkat> If I can get the search to work locally then I can test it |
14:35:46 | * | Vladar quit (Quit: Leaving) |
14:36:00 | FromDiscord | <adokitkat> OK |
14:36:15 | FromDiscord | <adokitkat> so I the search works... just not how I imagined it |
14:37:09 | FromDiscord | <adokitkat> why cant we search for thread titles |
14:37:48 | FromDiscord | <adokitkat> rip |
14:44:32 | * | keyehzh joined #nim |
14:53:51 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:57:09 | * | Gustavo6046 joined #nim |
14:58:25 | * | Gustavo6046 quit (Remote host closed the connection) |
14:58:47 | * | Gustavo6046 joined #nim |
15:01:32 | FromDiscord | <Waldecir Santos> @haxscramper is it possible to use hmatching for changing a value instead of retrieving it ? |
15:04:44 | FromDiscord | <thewhitedeath> on converting @[1,2,234] using encode(base64 module) is converts to AQLq is there any way I can do the reverse? |
15:07:26 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "<@!608382355454951435> is it possible": no, until view types are stabilized the only other option is to resort to pointers, which would have to be enabled via syntax |
15:07:55 | FromDiscord | <haxscramper> because defaulting to pointers implicitly wont' work for js/nimscript/things that don't have `addr` such as functiopn results etc. |
15:08:25 | FromDiscord | <haxscramper> I tried this, but last time I tried to use view types I got codegen error in ten minutes and crashed compiler after half an hour |
15:08:42 | FromDiscord | <haxscramper> but yeah, that would be nice to have |
15:08:55 | FromDiscord | <Waldecir Santos> oh, nice I've no idea what view types are, can you share anything about them |
15:09:19 | FromDiscord | <Waldecir Santos> Yeah it would be magical for what I'm doing, I hate code like `result[0][0][1][0]` lol |
15:09:28 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual_experimental.html#view-types they are experimental features for now |
15:09:41 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "Yeah it would be": if the type is `ref` you sort of get mutation already |
15:09:52 | FromDiscord | <haxscramper> I assume `[0][][][][` is some kind of ref tree |
15:10:07 | FromDiscord | <Waldecir Santos> Yeah AST tree. |
15:10:19 | FromDiscord | <haxscramper> if it is ref you can just mutate captures |
15:10:50 | FromDiscord | <haxscramper> because captured elements don't `deepCopy` (obviously) and regular `=` that I used just gives you the same reference |
15:11:53 | FromDiscord | <Waldecir Santos> What do you mean by ` just mutate captures` ? I've captured a seq of nimnodes iterated and changed they but that dosen't reflect on the final |
15:13:22 | FromDiscord | <haxscramper> ugh, nim node is a `.magic.` so I can't really be certain it would work |
15:13:33 | FromDiscord | <haxscramper> what exactlyt "doesn't reflect on the final" mean? |
15:13:50 | FromDiscord | <haxscramper> `[@capture]` `capture = newLit(12)` and the original ast is the same? |
15:13:58 | FromDiscord | <haxscramper> for named positions |
15:14:00 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRc |
15:14:41 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRd |
15:14:43 | FromDiscord | <haxscramper> `{ PosBody: @body }` |
15:15:03 | FromDiscord | <haxscramper> if you don't even want to remember the correct positioning and/or fill in the blanks in the pattern `_` |
15:15:24 | FromDiscord | <haxscramper> Should also work for slices |
15:15:30 | FromDiscord | <haxscramper> if you have different overload for `[]` |
15:16:57 | FromDiscord | <Waldecir Santos> Let me share my example one sec |
15:17:37 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRg |
15:18:41 | FromDiscord | <Waldecir Santos> This is the code: https://play.nim-lang.org/#ix=3PRh |
15:19:23 | FromDiscord | <Waldecir Santos> I'm basically Faking a "field" type like Django, and Copying them as pragmas so I can simulate python descritors and have same "Defination" as Django |
15:19:49 | FromDiscord | <haxscramper> No reply from server:↵502: |
15:19:51 | FromDiscord | <haxscramper> nice |
15:20:05 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/943889549543743508/unknown.png |
15:20:11 | FromDiscord | <Waldecir Santos> if that helps |
15:20:28 | FromDiscord | <Waldecir Santos> the result is the final AST and you can see that nothing changed there |
15:22:04 | FromDiscord | <Waldecir Santos> (edit) "result" => "`result` variable" |
15:22:27 | FromDiscord | <haxscramper> you are doing `for identDefs in ...` |
15:22:32 | FromDiscord | <haxscramper> try adding `mitems` |
15:23:51 | FromDiscord | <haxscramper> nope, this does not work |
15:23:52 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRl |
15:23:57 | FromDiscord | <Waldecir Santos> Yeah no luck |
15:25:31 | FromDiscord | <haxscramper> this works |
15:25:38 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRm |
15:25:40 | FromDiscord | <haxscramper> => NimNode is `.magic.` |
15:26:21 | FromDiscord | <Waldecir Santos> Not sure what `.magic.`. means but seems like I don't have anu other option because of it, right ? |
15:31:22 | PMunch | .magic. is something which is implemented internally in the compiler |
15:34:37 | FromDiscord | <haxscramper> yeah |
15:34:54 | FromDiscord | <haxscramper> basically nim node might or might now follow regular rules wrt. to asignments and so on |
15:35:53 | FromDiscord | <Waldecir Santos> got it |
15:42:25 | FromDiscord | <Waldecir Santos> Would be nice to have a option in the for loop for asking the ref, well, it's what it is, I proceed. |
15:42:43 | FromDiscord | <Waldecir Santos> @haxscramper if you can share more about views type I got curious |
15:44:56 | FromDiscord | <haxscramper> I have never actually used them |
15:45:02 | FromDiscord | <haxscramper> Because they are unusable |
15:45:59 | FromDiscord | <haxscramper> But tl;dr is that view type is a convenience wrapper around pointer |
15:46:09 | FromDiscord | <haxscramper> Single element or multiple elements |
15:47:28 | FromDiscord | <Waldecir Santos> got it |
15:49:37 | PMunch | Just uploaded my FOSDEM talk video to YouTube if anyone is interested: https://youtu.be/0dt3icPj8Kk |
15:49:40 | FromDiscord | <haxscramper> Main feature for macros, at least in my understanding is that view types would allow for `var thing = a[12]` to do a zero copy-view, and for `var thing = call()` they would expand lifetime of the result |
15:50:11 | FromDiscord | <haxscramper> So you can simplify the codegen while still getting the results |
15:50:18 | * | PMunch quit (Quit: leaving) |
15:50:27 | FromDiscord | <haxscramper> Also I wanted to have a mutable view to immutable data |
15:50:37 | FromDiscord | <haxscramper> But seems like this possibility is slashed |
15:51:04 | FromDiscord | <Rika> After that we need go's concurrency system and we basically have all of go beaten /s |
15:51:12 | FromDiscord | <Rika> More of /j I guess |
15:53:41 | FromDiscord | <adokitkat> In reply to @PMunch "Just uploaded my FOSDEM": I have just watched it on Fosdem site haha |
16:05:22 | FromDiscord | <mratsim> In reply to @Rika "After that we need": `nim c --gc:go myawesomeproject.nim` |
16:06:03 | FromDiscord | <mratsim> TBH we have most of the tools to build Goroutines on top of taskpools |
16:06:58 | FromDiscord | <mratsim> sent a long message, see http://ix.io/3PRv |
16:07:29 | FromDiscord | <mratsim> to receive tasks from any thread, Go introduces an extra-level of indirection with a global queue protected by a lock. |
16:08:20 | FromDiscord | <mratsim> and for blocked threads detection when all threads are busy, before grabbing a task, a thread will dynamically add a new thread to the threadpool. |
16:09:05 | FromDiscord | <mratsim> That part is a bit more tricky because that means you can't address threads by index anymore, especially for whatever you use to put threads to sleep. |
16:09:16 | FromDiscord | <Rika> That sounds not optimal but I assume that's the cost of extreme ease |
16:09:37 | FromDiscord | <mratsim> They use work-stealing for tasks already enqueued. |
16:09:50 | FromDiscord | <jmgomez> So I was compiling a few functions to js and I was wondering how I can use them from another js file. import doesnt seem to work |
16:10:22 | FromDiscord | <mratsim> also given that everyone is using the Go runtime, I think it's very rare that tasks come from a thread that is unknown to the runtime. |
16:10:32 | FromDiscord | <mratsim> I'm not even sure how that codepath is exercised. |
16:10:36 | FromDiscord | <Rika> Everyone is? |
16:10:46 | FromDiscord | <mratsim> every Go library |
16:12:13 | FromDiscord | <mratsim> one alternative is to have tasks submitted be randomly appended to any worker queue |
16:12:26 | FromDiscord | <auxym> In reply to @jmgomez "So I was compiling": exportc I think: https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma |
16:12:46 | FromDiscord | <mratsim> but that means the Single Producer Multi Consumer queues suddenly become MPMC. |
16:13:28 | FromDiscord | <mratsim> and you still need a way to select a thread without an index |
16:13:58 | FromDiscord | <mratsim> you can use a threadsafe stack (Treiber stack) but it now becomes a contention point when threads pushed/popped in the stack. |
16:16:26 | FromDiscord | <jmgomez> In reply to @auxym "exportc I think: https://nim-lang.org/docs/manual.h": I was already using it thing is that it doesnt seem to export the functions as modules |
16:16:40 | FromDiscord | <jmgomez> I just did an eval of the file which is fine for now |
16:16:55 | FromDiscord | <auxym> can't help you more than that, sry, never actually used the js backend |
16:17:04 | FromDiscord | <jmgomez> np |
16:24:37 | FromDiscord | <Flo> sent a code paste, see https://play.nim-lang.org/#ix=3PRD |
16:25:11 | FromDiscord | <Flo> (edit) "https://play.nim-lang.org/#ix=3PRD" => "https://play.nim-lang.org/#ix=3PRE" |
16:34:43 | FromDiscord | <Waldecir Santos> There is a talk called Nim Nuggets, he did a diff function there map it helps you |
16:34:53 | FromDiscord | <Waldecir Santos> https://www.youtube.com/watch?v=d2VRuZo2pdA |
16:55:49 | FromDiscord | <auxym> In reply to @Flo "Is there a way": Not sure how that would work though. `bar` does have `a` defined, it's just the default. For string that's an empty string. |
16:57:14 | FromDiscord | <auxym> If the behavior you want is to update all fields that don't have the default value, then yeah you could define a proc that does that for your object `Foo`. Or a macro that automatically generates a proc for any object def you give it. |
16:58:41 | FromDiscord | <auxym> !eval echo default(int) |
16:58:43 | NimBot | 0 |
16:59:00 | FromDiscord | <auxym> !eval echo default(string) |
16:59:02 | NimBot | <no output> |
17:00:14 | FromDiscord | <Flo> Ok true, I thought the fields in objects were nullables |
17:04:09 | FromDiscord | <Flo> sent a code paste, see https://play.nim-lang.org/#ix=3PRV |
17:05:05 | FromDiscord | <Flo> (edit) |
17:12:23 | FromDiscord | <adokitkat> In reply to @Flo "So for instance for": that's because you are using ref objects |
17:12:39 | FromDiscord | <adokitkat> and they need to be initialized |
17:13:35 | FromDiscord | <adokitkat> sent a code paste, see https://play.nim-lang.org/#ix=3PRY |
17:14:05 | FromDiscord | <adokitkat> ref objects are allocated on heap |
17:14:57 | FromDiscord | <adokitkat> ref means reference and is like auto-managed pointer by GC |
17:15:15 | FromDiscord | <Waldecir Santos> Do you want to merge th objects or have a "linked" property between objects ? |
17:17:22 | FromDiscord | <Flo> Okay that clears up some of my misunderstandings for the objects! |
17:21:29 | FromDiscord | <Flo> sent a code paste, see https://paste.rs/Djc |
17:22:14 | FromDiscord | <Flo> So for `options` it would always take the `some` and for anything else the second objects value |
17:24:09 | FromDiscord | <Flo> Also how do I create these fallback values for my custom types (like 0 for `int` etc) ? |
17:39:57 | FromDiscord | <adokitkat> In reply to @Flo "I guess I would": if you decide on some default value which would not be ever used otherwise you could do something like this? |
17:40:12 | FromDiscord | <adokitkat> sent a code paste, see https://paste.rs/07N |
17:41:30 | FromDiscord | <adokitkat> or use Option type and nil as default |
17:43:45 | FromDiscord | <Waldecir Santos> @Flo is this what you need https://github.com/beef331/constructor ? |
17:50:24 | FromDiscord | <Flo> @adokitkat Thanks for the write-up, this looks like something I could use↵@Waldecir Santos Thanks, that looks interesting as well! |
17:57:26 | FromDiscord | <adokitkat> In reply to @Flo "<@!216745055770116106> Thanks for the": with options: |
17:57:37 | FromDiscord | <adokitkat> sent a code paste, see https://play.nim-lang.org/#ix=3PSf |
17:57:51 | FromDiscord | <adokitkat> No problem 😄 |
18:04:58 | * | jjido joined #nim |
18:05:03 | FromDiscord | <b4mbus> so nim allows user defined operators to be any combination of the basic operator set |
18:05:09 | FromDiscord | <b4mbus> so why doesnt it work? |
18:05:11 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PSl |
18:05:33 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PSm |
18:06:00 | FromDiscord | <adokitkat> you are missing one - |
18:06:11 | FromDiscord | <adokitkat> in echo |
18:06:19 | FromDiscord | <b4mbus> me dumbo |
18:06:21 | FromDiscord | <b4mbus> 🙏 |
18:06:22 | FromDiscord | <b4mbus> thanks yeah |
18:25:59 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:44:05 | * | jjido joined #nim |
18:56:57 | Amun-Ra | hmm, what's wrong with this assignment? https://play.nim-lang.org/#ix=3PSB |
18:58:51 | FromDiscord | <adokitkat> In reply to @Amun-Ra "hmm, what's wrong with": they have to be ref objects for inheritance to work |
18:59:50 | Amun-Ra | hmm |
18:59:54 | FromDiscord | <adokitkat> I think so |
19:00:00 | FromDiscord | <adokitkat> it works that way |
19:00:37 | FromDiscord | <adokitkat> > Ref objects should be used whenever inheritance is used. It isn't strictly necessary, but with non-ref objects, assignments such as let person: Person = Student(id: 123) will truncate subclass fields.↵> ↵> Note: Composition (has-a relation) is often preferable to inheritance (is-a relation) for simple code reuse. Since objects are value types in Nim, composition is as efficient as inheritance. |
19:01:07 | FromDiscord | <adokitkat> maybe it's a bug when using plain objects |
19:02:33 | Amun-Ra | right, it works with refs, I wonder whether it should work for plain ones or not |
19:04:24 | Amun-Ra | I found that quote, there's no example for composition unfortunately |
19:10:01 | nrds | <sorceror/freenode99> : _ _ __ __ _____ ____ _ |
19:10:01 | nrds | <sorceror/freenode99> : _| || |_| \/ | ___/ ___| / \ |
19:10:01 | nrds | <sorceror/freenode99> :|_ .. _| |\/| | |_ | | _ / _ \ |
19:10:03 | nrds | <sorceror/freenode99> :|_ _| | | | _|| |_| |/ ___ \ |
19:10:05 | nrds | <sorceror/freenode99> : |_||_| |_| |_|_| \____/_/ \_\ |
19:10:05 | nrds | <sorceror/freenode99> <rasengan> Classic Freenode had a special part in my heart and everyone else's. It's the saddest and hardest thing I've done, in a long time - but I am giving the directive to shut it down. |
19:26:29 | Amun-Ra | there's one con of refs, I loose =destroy |
19:33:59 | Amun-Ra | hmm, I don't |
19:44:03 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PSK |
19:44:34 | FromDiscord | <jmgomez> OC if I remove line 34 it works fine |
19:47:48 | * | vicfred joined #nim |
19:56:17 | FromDiscord | <demotomohiro> Did you check you are using correct calling convention? |
19:58:17 | FromDiscord | <demotomohiro> Did you check sizeof(int) in Nim and C? |
19:58:38 | FromDiscord | <demotomohiro> It is possible that sizeof(int) in Nim and C can be different |
19:59:57 | FromDiscord | <demotomohiro> So, if you want to create a proc for C lang, you souhld use `cint` type that correspond to `int` in C. |
20:00:09 | Amun-Ra | yes, int will cause problems |
20:01:51 | FromDiscord | <demotomohiro> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-what-is-the-difference-between-cintslashcfloat-and-intslashfloatqmark |
20:02:54 | Amun-Ra | also, you shouldn't use ref for interop with C or C++ → ptr |
20:03:27 | FromDiscord | <demotomohiro> Nim has types for interfacing with C lang that have 'c' prefix: https://nim-lang.org/docs/system.html#cdouble |
20:09:27 | Amun-Ra | jmgomez: there are several problems with the code: age in Person should be of cint type, you are passing a pointer to Person to printPerson etc, so it's ptr Person, not ref Person |
20:12:11 | Amun-Ra | fun argument in callbackTest is missing cdecl pragma (or whatever windows uses) |
20:12:43 | FromDiscord | <planetis> Amun-Ra\: you can use inheritance with plain objects as well but can't assign to base type. See std/lexbase |
20:13:31 | Amun-Ra | planetis: I need this for a kind of UI interface, it has to be base type |
20:29:21 | arkanoid | I'm calling a C function call that prints to stdout and stderr, and I have no internal option to disable it. Is there a way to redirect/disable output in nim? |
20:36:28 | FromDiscord | <mratsim> In reply to @arkanoid "I'm calling a C": https://stackoverflow.com/questions/50357704/how-to-freopen-both-stdout-and-stderr-into-a-single-output-file-under-windows |
20:43:29 | nrds | <Prestige99> Is there a decent interface to execute interactive cli tools with Nim? I want to write a wrapper to connect a few cli tools like github cli, jira, and fzf. Instead of using bash I'm trying to use Nim for the job |
20:44:17 | nrds | <Prestige99> fzf has an interactive cli e.g. https://github.com/junegunn/fzf#- |
21:08:45 | arkanoid | thanks |
21:13:49 | arkanoid | what's the correct way to cross compile nim code from linux to windows? I've always used just -d:mingw for the job for trivial programs and that works, but I'm now trying with wNim and it complains missing windows.h, I'm reading that I should use wine for both compilation and testing, but now sure what's the difference from using mingw or going "wine gcc" |
21:14:48 | arkanoid | I mean, this is what the manual says https://nim-lang.org/docs/nimc.html#crossminuscompilation-for-windows |
21:16:05 | * | jmdaemon joined #nim |
21:34:17 | FromDiscord | <tandy> is there a way to convert string to enum? |
21:34:27 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PTa |
21:41:05 | FromDiscord | <ynfle> In reply to @tandy "is there a way": `strutils.parseEnum` |
21:51:48 | * | jjido quit (Quit: Textual IRC Client: www.textualapp.com) |
21:59:18 | FromDiscord | <tandy> tytyt↵(@ynfle) |
22:05:10 | FromDiscord | <jmgomez> In reply to @Amun-Ra "<@726017160115126333>: there are several": Didn’t know that. Thanks! What do you mean with fun is missing? Also it does work fine in Linux |
22:48:09 | FromDiscord | <ynfle> In reply to @tandy "tytyt (<@767093711112241162>)": 👍 |
23:04:06 | * | sagax quit (Excess Flood) |
23:09:56 | FromDiscord | <Waldecir Santos> @haxscramper I was able to simplify the code and do "by ref" doing like this, so, much simpler: |
23:09:57 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/944007794825232404/unknown.png |
23:19:09 | FromDiscord | <jmgomez> In reply to @jmgomez "Didn’t know that. Thanks!": did a quick test with a function bind from nim marked with extern C and it does not work neither (it does work in linux though) |
23:36:43 | FromDiscord | <ynfle> Is nim participating in GSoC? |
23:46:20 | droidrage | I see mostly wip github repos when looking for nim and vala/glib/gtk...has anyone seen nim /compile/transpile to vala correctly/maintainably? |