<< 17-02-2022 >>

00:10:15FromDiscord<treeform> I am not a sqlite db exert. But yes in theory because it does file io it can be async.
00:10:34FromDiscord<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:50FromDiscord<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:30arkanoidtreeform: 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:00FromDiscord<treeform> I think that tries to emulate an async api over what OS provides. But OS api is kind of meh.
00:18:07arkanoidtreeform, sincerely curious why you think this
00:18:21*wyrd joined #nim
00:21:24*jmdaemon quit (Ping timeout: 240 seconds)
00:22:03FromDiscord<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:06FromDiscord<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:44FromDiscord<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:18FromDiscord<treeform> In reply to @arkanoid "<@107140179025735680>, sincerely curious why": https://github.com/nim-lang/Nim/issues/11564
00:30:05FromDiscord<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:54FromDiscord<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:39FromDiscord<auxym> ?
01:02:42FromDiscord<Elegantbeef> Nim only does tuple unpacking so you'd need a library like https://github.com/haxscramper/hmatching#custom-unpackers
01:03:33FromDiscord<Elegantbeef> !
01:03:43FromDiscord<Elegantbeef> I think they want to unpack it
01:04:10FromDiscord<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:34FromDiscord<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:52FromDiscord<Elegantbeef> Why are you echoing?
01:09:23FromDiscord<Elegantbeef> Damn we cant cast to void!
01:09:29FromDiscord<Elegantbeef> 😛
01:10:09FromDiscord<Rika> `echo cstring nil`? I don’t know
01:10:18FromDiscord<civbag> In reply to @huantian "hm I wonder what": i need KEKW emoji for this
01:10:54FromDiscord<Rika> !eval echo cstring nil
01:10:56NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <cstring>
01:11:02FromDiscord<Rika> Hmm
01:11:10FromDiscord<ynfle> !eval echo $ cstring nil
01:11:12NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <proc (x: varargs[typed]){.gcsafe, locks: 0.}, cstring>
01:11:17FromDiscord<Rika> Shouldn't be needed
01:11:32FromDiscord<ynfle> !eval echo cstring("this")
01:11:34NimBotthis
01:11:44NimEventerNew 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:48FromDiscord<Rika> !eval echo nil.cstring
01:11:50NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <cstring>
01:12:02FromDiscord<Rika> Nil can’t be cstring? I guess
01:13:01FromDiscord<Elegantbeef> !eval (var b = (ref int)(nil); b[] = 0)
01:13:04NimBotTraceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)↵Segmentation fault (core dumped)
01:13:07FromDiscord<Rika> Pretty long
01:13:24FromDiscord<Elegantbeef> nil deference protection dumb safe language
01:13:32FromDiscord<Rika> discard would look shorter..
01:13:53FromDiscord<huantian> discard doesn't seem to actually do the deref tho
01:13:54FromDiscord<Elegantbeef> discard is optimized away
01:15:21FromDiscord<Elegantbeef> Due to nil safety i dont think we can do it any shorter than the cast method
01:16:43FromDiscord<Elegantbeef> @abdu\: is there any reason you ask a question here make a SO post then delete it always?
01:18:11FromDiscord<huantian> I wonder if emitting c would be less characters
01:18:22FromDiscord<Rika> Then it’s not Nim exactly
01:18:49FromDiscord<Elegantbeef> I realize `(var b: ref int; b[] = 0)` is shorter
01:18:57FromDiscord<Elegantbeef> But still not as short as possible
01:19:09FromDiscord<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:40FromDiscord<huantian> In reply to @Rika "Then it’s not Nim": Yeah true
01:20:56FromDiscord<Elegantbeef> You want to assign all the variables to the string version of the sequence?
01:25:23FromDiscord<huantian> Or maybe each element in the sequence is converted to a string?
01:26:42*jmdaemon quit (Ping timeout: 272 seconds)
01:30:19FromDiscord<Elegantbeef> No clue elaboration makes helping easier
01:35:10*ltriant joined #nim
01:36:39*jmdaemon joined #nim
01:53:29arkanoiddoes 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:07arkanoidthe 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:43arkanoidI 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:18FromDiscord<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:20madpropsthis 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:57FromDiscord<huantian> not related to lua but my brain hates it when people don't put spaces after their commas
03:11:24FromDiscord<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:20FromDiscord<huantian> we're rebranding to Luaim
04:36:51FromDiscord<Mysterysib> Hi
04:36:58FromDiscord<Elegantbeef> Hello
04:38:31FromDiscord<huantian> Hewoo
05:00:35NimEventerNew 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:36FromDiscord<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:04FromDiscord<haxscramper> In reply to @jmgomez "So I got this": you were compiling the code using `nim cpp file.nim`, right?
08:28:14FromDiscord<haxscramper> and it did not generate `extern "C"` for you automatically?
08:28:39FromDiscord<haxscramper> I tried doing the same just now, and proc annotated with `.exportc.` generated extern annotation properly
08:28:46FromDiscord<haxscramper> `extern "C" void exportedProc(void) {`
08:31:11*PMunch joined #nim
08:39:09om3gaHi! 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:39FromDiscord<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:15om3gamratsim thanks!
09:13:27FromDiscord<mratsim> In reply to @om3ga "mratsim thanks!": There is a full talk about it, let me see
09:13:42FromDiscord<mratsim> https://www.youtube.com/watch?v=ruT7sbs5O-Q
09:14:44om3gaawesome. 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:45FromDiscord<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:15FromDiscord<enthus1ast> do you see any other way to string interpolate?
10:12:39FromDiscord<enthus1ast> i mean i can and it should be safe since i use the parsed int
10:15:00FromDiscord<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:32FromDiscord<carpal> https://media.discordapp.net/attachments/371759389889003532/943819701170098306/unknown.png
10:42:41FromDiscord<carpal> is this a problem=
10:42:43FromDiscord<carpal> (edit) "problem=" => "problem?"
10:43:00*neurocyte0917090 quit (Ping timeout: 240 seconds)
10:57:35FromDiscord<enthus1ast> any idea why the mariadb returns "ISO-8859-1" rows? The databse should operate on utf8mb4
10:57:47FromDiscord<enthus1ast> is this a client setting?
10:59:00*krux02 joined #nim
10:59:09FromDiscord<enthus1ast> ok setEncoding is athing
11:01:05*rp1 quit (Ping timeout: 256 seconds)
11:01:28FromDiscord<enthus1ast> ok this works good (strange that utf-8 (plus the correct db suffix) is not default
11:01:48FromDiscord<enthus1ast> who in the world wants to store data in different encoding in 2022
11:02:25FromDiscord<enthus1ast> given that you're not russian or chinese and store massive amount of data
11:02:35FromDiscord<congusbongus> mariadb aka mysql has always been a bit of an oddball
11:02:44FromDiscord<congusbongus> also it's quite old
11:04:33FromDiscord<Rika> In reply to @carpal "is this a problem?": Why do you use none as a gc?
11:12:21FromDiscord<tandy> does anyone know how to not use a dependency when install nimble deps ?
11:12:28FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PPI
11:12:29FromDiscord<tandy> this isnt working \:o
11:13:26FromDiscord<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:16FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PPJ
11:16:48FromDiscord<haxscramper> `sym.flags {sfImportc, sfExportc} != {}` on the cpp backend will generate extern
11:16:52FromDiscord<haxscramper> sent a code paste, see https://paste.rs/oSN
11:18:14FromDiscord<haxscramper> ok, so if compiles to cpp extern "C" is implicit if `.exportc.` is used
11:18:36FromDiscord<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:43FromDiscord<jmgomez> dont they?
11:19:13FromDiscord<haxscramper> they do
11:19:44FromDiscord<haxscramper> if you annotate nim proc with `.exportc.` it will generate forward-declared prototype with `extern "C"` annotation
11:20:22FromDiscord<haxscramper> When calling `nim cpp` extern is used to avoid name mangling
11:20:36FromDiscord<haxscramper> and when compiling your C++ code, `extern "C"` is used to be able to interface with these procs
11:20:43FromDiscord<haxscramper> I think that's how it generally works
11:20:50FromDiscord<jmgomez> this is what I mean https://media.discordapp.net/attachments/371759389889003532/943829337365446686/unknown.png
11:21:18FromDiscord<jmgomez> If I remove extern on the cpp it cant bind the function from the dl
11:21:22FromDiscord<jmgomez> (edit) "dl" => "dll"
11:23:26FromDiscord<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:36FromDiscord<haxscramper> so `clang++ -ltests main.cpp`
11:24:06FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PPM
11:24:24FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=3PPM" => "https://play.nim-lang.org/#ix=3PPN"
11:26:59FromDiscord<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:57FromDiscord<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:29FromDiscord<jmgomez> Im downloading clang to see if it works there
11:36:56FromDiscord<jmgomez> Im seeing that when I export with the --header flag it does add the extern, that should be enough
11:37:40FromDiscord<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:17FromDiscord<haxscramper> sent a code paste, see https://paste.rs/2YV
11:39:26FromDiscord<haxscramper> (edit) "https://play.nim-lang.org/#ix=3PPR" => "https://play.nim-lang.org/#ix=3PPS"
11:44:44FromDiscord<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:09FromDiscord<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:23FromDiscord<haxscramper> `--app:staticlib`
11:45:28FromDiscord<jmgomez> lovely
11:45:48FromDiscord<jmgomez> thanks a lot for your help man, it's really appreciated it!
11:46:43FromDiscord<haxscramper> In reply to @jmgomez "Thanks! That's similar of": `--header` will generate header file in the `nimcache/file.h`
11:47:04FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PPU
11:47:11FromDiscord<haxscramper> (edit)
11:47:34FromDiscord<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:15FromDiscord<haxscramper> `g++ -P -I$E:HOME/.choosenim/toolchains/nim-1.6.2/lib/ -E nimcache/file.h > cleaned.h`
11:50:33FromDiscord<haxscramper> actually no
11:50:46FromDiscord<haxscramper> just write your own clean nimbase and expand `file.h` to something useful
11:52:16FromDiscord<haxscramper> `g++ -P -I(pwd) -E nimcache/file.h` will give you
11:52:29FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PPV
11:52:53FromDiscord<haxscramper> and you can just define the helper macros how you need
11:53:08FromDiscord<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:23FromDiscord<haxscramper> event system like qt signals?
11:53:24FromDiscord<haxscramper> no
11:53:42FromDiscord<haxscramper> at least I"m not aware of any library and there is certainly no built-in functionality like this
11:54:35FromDiscord<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:11FromDiscord<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:51PMunchI assume dom96 has run it locally
13:30:54FromDiscord<adokitkat> yeah I am waiting for his answer on github so I tried to ask here 😄
13:31:40FromDiscord<adokitkat> I am trying to debug this https://forum.nim-lang.org/t/8921
13:32:04FromDiscord<enthus1ast> thats a pretty nasty one indeed
13:35:17PMunchI'm debating deleting that topic, this really should've been disclosed properly as it might be possible to abuse..
13:41:51FromDiscord<auxym> someone should probably at least deploy an emergency fix that strips the parens or something.
13:43:18PMunchDefinitiely
13:45:18*jjido joined #nim
13:48:42FromDiscord<vegai> Nobody uses parentheses though
13:48:59FromDiscord<Rika> That’s not the issue though
13:52:34*crem1 quit (Quit: WeeChat 3.3)
14:06:35*arkurious joined #nim
14:13:58FromDiscord<adokitkat> In reply to @auxym "someone should probably at": i posted merge request yesterday
14:14:11FromDiscord<adokitkat> and we were debating the issue there
14:14:39FromDiscord<adokitkat> to fix it more thoroughly
14:19:32FromDiscord<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:00FromDiscord<adokitkat> I would test it but as I said I cannot get search to work on my local nimforum
14:25:08FromDiscord<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:24FromDiscord<auxym> No familiar enough with like/match though
14:25:30*crem joined #nim
14:27:03FromDiscord<auxym> https://www.sqlite.org/fts3.html#section_3
14:27:23FromDiscord<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:45FromDiscord<auxym> https://sqlite.org/lang_expr.html
14:28:54FromDiscord<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:57FromDiscord<adokitkat> Yeah I read it
14:30:28FromDiscord<adokitkat> If I can get the search to work locally then I can test it
14:35:46*Vladar quit (Quit: Leaving)
14:36:00FromDiscord<adokitkat> OK
14:36:15FromDiscord<adokitkat> so I the search works... just not how I imagined it
14:37:09FromDiscord<adokitkat> why cant we search for thread titles
14:37:48FromDiscord<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:32FromDiscord<Waldecir Santos> @haxscramper is it possible to use hmatching for changing a value instead of retrieving it ?
15:04:44FromDiscord<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:26FromDiscord<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:55FromDiscord<haxscramper> because defaulting to pointers implicitly wont' work for js/nimscript/things that don't have `addr` such as functiopn results etc.
15:08:25FromDiscord<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:42FromDiscord<haxscramper> but yeah, that would be nice to have
15:08:55FromDiscord<Waldecir Santos> oh, nice I've no idea what view types are, can you share anything about them
15:09:19FromDiscord<Waldecir Santos> Yeah it would be magical for what I'm doing, I hate code like `result[0][0][1][0]` lol
15:09:28FromDiscord<haxscramper> https://nim-lang.org/docs/manual_experimental.html#view-types they are experimental features for now
15:09:41FromDiscord<haxscramper> In reply to @Waldecir Santos "Yeah it would be": if the type is `ref` you sort of get mutation already
15:09:52FromDiscord<haxscramper> I assume `[0][][][][` is some kind of ref tree
15:10:07FromDiscord<Waldecir Santos> Yeah AST tree.
15:10:19FromDiscord<haxscramper> if it is ref you can just mutate captures
15:10:50FromDiscord<haxscramper> because captured elements don't `deepCopy` (obviously) and regular `=` that I used just gives you the same reference
15:11:53FromDiscord<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:22FromDiscord<haxscramper> ugh, nim node is a `.magic.` so I can't really be certain it would work
15:13:33FromDiscord<haxscramper> what exactlyt "doesn't reflect on the final" mean?
15:13:50FromDiscord<haxscramper> `[@capture]` `capture = newLit(12)` and the original ast is the same?
15:13:58FromDiscord<haxscramper> for named positions
15:14:00FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRc
15:14:41FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRd
15:14:43FromDiscord<haxscramper> `{ PosBody: @body }`
15:15:03FromDiscord<haxscramper> if you don't even want to remember the correct positioning and/or fill in the blanks in the pattern `_`
15:15:24FromDiscord<haxscramper> Should also work for slices
15:15:30FromDiscord<haxscramper> if you have different overload for `[]`
15:16:57FromDiscord<Waldecir Santos> Let me share my example one sec
15:17:37FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRg
15:18:41FromDiscord<Waldecir Santos> This is the code: https://play.nim-lang.org/#ix=3PRh
15:19:23FromDiscord<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:49FromDiscord<haxscramper> No reply from server:↵502:
15:19:51FromDiscord<haxscramper> nice
15:20:05FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/943889549543743508/unknown.png
15:20:11FromDiscord<Waldecir Santos> if that helps
15:20:28FromDiscord<Waldecir Santos> the result is the final AST and you can see that nothing changed there
15:22:04FromDiscord<Waldecir Santos> (edit) "result" => "`result` variable"
15:22:27FromDiscord<haxscramper> you are doing `for identDefs in ...`
15:22:32FromDiscord<haxscramper> try adding `mitems`
15:23:51FromDiscord<haxscramper> nope, this does not work
15:23:52FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRl
15:23:57FromDiscord<Waldecir Santos> Yeah no luck
15:25:31FromDiscord<haxscramper> this works
15:25:38FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3PRm
15:25:40FromDiscord<haxscramper> => NimNode is `.magic.`
15:26:21FromDiscord<Waldecir Santos> Not sure what `.magic.`. means but seems like I don't have anu other option because of it, right ?
15:31:22PMunch.magic. is something which is implemented internally in the compiler
15:34:37FromDiscord<haxscramper> yeah
15:34:54FromDiscord<haxscramper> basically nim node might or might now follow regular rules wrt. to asignments and so on
15:35:53FromDiscord<Waldecir Santos> got it
15:42:25FromDiscord<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:43FromDiscord<Waldecir Santos> @haxscramper if you can share more about views type I got curious
15:44:56FromDiscord<haxscramper> I have never actually used them
15:45:02FromDiscord<haxscramper> Because they are unusable
15:45:59FromDiscord<haxscramper> But tl;dr is that view type is a convenience wrapper around pointer
15:46:09FromDiscord<haxscramper> Single element or multiple elements
15:47:28FromDiscord<Waldecir Santos> got it
15:49:37PMunchJust uploaded my FOSDEM talk video to YouTube if anyone is interested: https://youtu.be/0dt3icPj8Kk
15:49:40FromDiscord<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:11FromDiscord<haxscramper> So you can simplify the codegen while still getting the results
15:50:18*PMunch quit (Quit: leaving)
15:50:27FromDiscord<haxscramper> Also I wanted to have a mutable view to immutable data
15:50:37FromDiscord<haxscramper> But seems like this possibility is slashed
15:51:04FromDiscord<Rika> After that we need go's concurrency system and we basically have all of go beaten /s
15:51:12FromDiscord<Rika> More of /j I guess
15:53:41FromDiscord<adokitkat> In reply to @PMunch "Just uploaded my FOSDEM": I have just watched it on Fosdem site haha
16:05:22FromDiscord<mratsim> In reply to @Rika "After that we need": `nim c --gc:go myawesomeproject.nim`
16:06:03FromDiscord<mratsim> TBH we have most of the tools to build Goroutines on top of taskpools
16:06:58FromDiscord<mratsim> sent a long message, see http://ix.io/3PRv
16:07:29FromDiscord<mratsim> to receive tasks from any thread, Go introduces an extra-level of indirection with a global queue protected by a lock.
16:08:20FromDiscord<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:05FromDiscord<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:16FromDiscord<Rika> That sounds not optimal but I assume that's the cost of extreme ease
16:09:37FromDiscord<mratsim> They use work-stealing for tasks already enqueued.
16:09:50FromDiscord<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:22FromDiscord<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:32FromDiscord<mratsim> I'm not even sure how that codepath is exercised.
16:10:36FromDiscord<Rika> Everyone is?
16:10:46FromDiscord<mratsim> every Go library
16:12:13FromDiscord<mratsim> one alternative is to have tasks submitted be randomly appended to any worker queue
16:12:26FromDiscord<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:46FromDiscord<mratsim> but that means the Single Producer Multi Consumer queues suddenly become MPMC.
16:13:28FromDiscord<mratsim> and you still need a way to select a thread without an index
16:13:58FromDiscord<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:26FromDiscord<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:40FromDiscord<jmgomez> I just did an eval of the file which is fine for now
16:16:55FromDiscord<auxym> can't help you more than that, sry, never actually used the js backend
16:17:04FromDiscord<jmgomez> np
16:24:37FromDiscord<Flo> sent a code paste, see https://play.nim-lang.org/#ix=3PRD
16:25:11FromDiscord<Flo> (edit) "https://play.nim-lang.org/#ix=3PRD" => "https://play.nim-lang.org/#ix=3PRE"
16:34:43FromDiscord<Waldecir Santos> There is a talk called Nim Nuggets, he did a diff function there map it helps you
16:34:53FromDiscord<Waldecir Santos> https://www.youtube.com/watch?v=d2VRuZo2pdA
16:55:49FromDiscord<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:14FromDiscord<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:41FromDiscord<auxym> !eval echo default(int)
16:58:43NimBot0
16:59:00FromDiscord<auxym> !eval echo default(string)
16:59:02NimBot<no output>
17:00:14FromDiscord<Flo> Ok true, I thought the fields in objects were nullables
17:04:09FromDiscord<Flo> sent a code paste, see https://play.nim-lang.org/#ix=3PRV
17:05:05FromDiscord<Flo> (edit)
17:12:23FromDiscord<adokitkat> In reply to @Flo "So for instance for": that's because you are using ref objects
17:12:39FromDiscord<adokitkat> and they need to be initialized
17:13:35FromDiscord<adokitkat> sent a code paste, see https://play.nim-lang.org/#ix=3PRY
17:14:05FromDiscord<adokitkat> ref objects are allocated on heap
17:14:57FromDiscord<adokitkat> ref means reference and is like auto-managed pointer by GC
17:15:15FromDiscord<Waldecir Santos> Do you want to merge th objects or have a "linked" property between objects ?
17:17:22FromDiscord<Flo> Okay that clears up some of my misunderstandings for the objects!
17:21:29FromDiscord<Flo> sent a code paste, see https://paste.rs/Djc
17:22:14FromDiscord<Flo> So for `options` it would always take the `some` and for anything else the second objects value
17:24:09FromDiscord<Flo> Also how do I create these fallback values for my custom types (like 0 for `int` etc) ?
17:39:57FromDiscord<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:12FromDiscord<adokitkat> sent a code paste, see https://paste.rs/07N
17:41:30FromDiscord<adokitkat> or use Option type and nil as default
17:43:45FromDiscord<Waldecir Santos> @Flo is this what you need https://github.com/beef331/constructor ?
17:50:24FromDiscord<Flo> @adokitkat Thanks for the write-up, this looks like something I could use↵@Waldecir Santos Thanks, that looks interesting as well!
17:57:26FromDiscord<adokitkat> In reply to @Flo "<@!216745055770116106> Thanks for the": with options:
17:57:37FromDiscord<adokitkat> sent a code paste, see https://play.nim-lang.org/#ix=3PSf
17:57:51FromDiscord<adokitkat> No problem 😄
18:04:58*jjido joined #nim
18:05:03FromDiscord<b4mbus> so nim allows user defined operators to be any combination of the basic operator set
18:05:09FromDiscord<b4mbus> so why doesnt it work?
18:05:11FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PSl
18:05:33FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PSm
18:06:00FromDiscord<adokitkat> you are missing one -
18:06:11FromDiscord<adokitkat> in echo
18:06:19FromDiscord<b4mbus> me dumbo
18:06:21FromDiscord<b4mbus> 🙏
18:06:22FromDiscord<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:57Amun-Rahmm, what's wrong with this assignment? https://play.nim-lang.org/#ix=3PSB
18:58:51FromDiscord<adokitkat> In reply to @Amun-Ra "hmm, what's wrong with": they have to be ref objects for inheritance to work
18:59:50Amun-Rahmm
18:59:54FromDiscord<adokitkat> I think so
19:00:00FromDiscord<adokitkat> it works that way
19:00:37FromDiscord<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:07FromDiscord<adokitkat> maybe it's a bug when using plain objects
19:02:33Amun-Raright, it works with refs, I wonder whether it should work for plain ones or not
19:04:24Amun-RaI found that quote, there's no example for composition unfortunately
19:10:01nrds<sorceror/freenode99> : _ _ __ __ _____ ____ _
19:10:01nrds<sorceror/freenode99> : _| || |_| \/ | ___/ ___| / \
19:10:01nrds<sorceror/freenode99> :|_ .. _| |\/| | |_ | | _ / _ \
19:10:03nrds<sorceror/freenode99> :|_ _| | | | _|| |_| |/ ___ \
19:10:05nrds<sorceror/freenode99> : |_||_| |_| |_|_| \____/_/ \_\
19:10:05nrds<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:29Amun-Rathere's one con of refs, I loose =destroy
19:33:59Amun-Rahmm, I don't
19:44:03FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PSK
19:44:34FromDiscord<jmgomez> OC if I remove line 34 it works fine
19:47:48*vicfred joined #nim
19:56:17FromDiscord<demotomohiro> Did you check you are using correct calling convention?
19:58:17FromDiscord<demotomohiro> Did you check sizeof(int) in Nim and C?
19:58:38FromDiscord<demotomohiro> It is possible that sizeof(int) in Nim and C can be different
19:59:57FromDiscord<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:09Amun-Rayes, int will cause problems
20:01:51FromDiscord<demotomohiro> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-what-is-the-difference-between-cintslashcfloat-and-intslashfloatqmark
20:02:54Amun-Raalso, you shouldn't use ref for interop with C or C++ → ptr
20:03:27FromDiscord<demotomohiro> Nim has types for interfacing with C lang that have 'c' prefix: https://nim-lang.org/docs/system.html#cdouble
20:09:27Amun-Rajmgomez: 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:11Amun-Rafun argument in callbackTest is missing cdecl pragma (or whatever windows uses)
20:12:43FromDiscord<planetis> Amun-Ra\: you can use inheritance with plain objects as well but can't assign to base type. See std/lexbase
20:13:31Amun-Raplanetis: I need this for a kind of UI interface, it has to be base type
20:29:21arkanoidI'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:28FromDiscord<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:29nrds<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:17nrds<Prestige99> fzf has an interactive cli e.g. https://github.com/junegunn/fzf#-
21:08:45arkanoidthanks
21:13:49arkanoidwhat'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:48arkanoidI 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:17FromDiscord<tandy> is there a way to convert string to enum?
21:34:27FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3PTa
21:41:05FromDiscord<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:18FromDiscord<tandy> tytyt↵(@ynfle)
22:05:10FromDiscord<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:09FromDiscord<ynfle> In reply to @tandy "tytyt (<@767093711112241162>)": 👍
23:04:06*sagax quit (Excess Flood)
23:09:56FromDiscord<Waldecir Santos> @haxscramper I was able to simplify the code and do "by ref" doing like this, so, much simpler:
23:09:57FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/944007794825232404/unknown.png
23:19:09FromDiscord<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:43FromDiscord<ynfle> Is nim participating in GSoC?
23:46:20droidrageI see mostly wip github repos when looking for nim and vala/glib/gtk...has anyone seen nim /compile/transpile to vala correctly/maintainably?