00:03:56 | * | lucasta joined #nim |
00:09:15 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "No real clue myself": Why not? Main issue would be making them all share a dispatched, I've done that but my usecase was just a horrible usecase anyway so it broke |
00:12:40 | FromDiscord | <Bloss> In reply to @Ayy Lmao "Hmmm, I think it's": Use `of` |
00:13:07 | * | xet7 joined #nim |
00:21:01 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x2o |
00:25:06 | FromDiscord | <demotomohiro> This compiles: |
00:25:16 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4x2q |
00:30:13 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x2s |
00:30:15 | FromDiscord | <etra> In reply to @Hourglass, When the Hour Strikes "Why not? Main issue": from what I read the odds are a bit better with arc/orc but still there's no implementation afaik. I gotta confess i am a bit disappointed but i understand the work on that ain't easy. I was looking to replace tokio but it seems this isn't the moment 😔 |
00:48:58 | FromDiscord | <Chronos [She/Her]> Why couldn't you use channels in a single threaded environment anyway |
00:49:09 | FromDiscord | <Elegantbeef> You can but it's pointless |
00:49:14 | FromDiscord | <Elegantbeef> You're locking for no reason |
00:49:28 | FromDiscord | <Chronos [She/Her]> Fair enough |
00:55:03 | * | lucasta quit (Remote host closed the connection) |
00:55:28 | * | lucasta joined #nim |
01:07:54 | FromDiscord | <Graveflo> in the readme of beef's `constructor` package it says "`constructor` works similarly to `construct`". I searched around for `construct` but I can't find anything. what is this reference to? |
01:08:05 | FromDiscord | <Elegantbeef> An old feature |
01:09:38 | FromDiscord | <Elegantbeef> Of my macros\ |
01:10:20 | FromDiscord | <Chronos [She/Her]> Hmm maybe i should look into that project |
01:10:28 | FromDiscord | <Elegantbeef> This abomination used to exist |
01:10:29 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1112910870431936582/image.png |
01:11:18 | FromDiscord | <Chronos [She/Her]> Inchresting, how does it look now? |
01:11:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4x2w |
01:11:49 | * | lucasta quit (Quit: Leaving) |
01:11:52 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4x2x |
01:12:32 | FromDiscord | <Elegantbeef> No clue really, you're not supposed to use anything but constant values on `=` |
01:12:48 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4x2y |
01:14:08 | FromDiscord | <Elegantbeef> There is a bunch of initialisation magic inside that package some of which has been formally adopted by Nim |
01:15:38 | FromDiscord | <Graveflo> also I can't find a good way to read the address that a ref is pointing to. This was my best guess but I have no idea what I'm doing with it. `cast[ptr[uint]](some_ref_variable.unsafeAddr)[]`. I think this assumes that the address is going to point to a "dumb pointer" with only a memory address at offset 0. I don't ever need to do this unless I am trying to teach myself how nim is working but I've needed it a couple times. |
01:15:51 | FromDiscord | <Elegantbeef> `cast[int](myRef)` |
01:16:11 | FromDiscord | <Elegantbeef> or just `echo myRef.repr` |
01:18:41 | FromDiscord | <Graveflo> yea.. looks right. I know I tried that cast too but for some reason it thought it didn't work and repr is even better. Thanks |
01:31:32 | * | boxuser joined #nim |
02:08:04 | * | boxuser left #nim (#nim) |
02:32:20 | FromDiscord | <emanresu3> hey nimsters in oop what is more common for nim `this` or `self`? I've seen both used in nim's source code |
02:42:49 | FromDiscord | <Elegantbeef> Neither |
02:42:53 | * | boxuser joined #nim |
02:42:56 | FromDiscord | <Elegantbeef> Stop it use descriptive field names |
02:43:01 | FromDiscord | <Elegantbeef> parameter\ |
02:46:28 | FromDiscord | <emanresu3> what if the class name is already descriptive? |
02:46:47 | * | om3ga quit (Ping timeout: 268 seconds) |
02:48:12 | FromDiscord | <Elegantbeef> I mean you do you there is no defined best naming |
02:48:32 | FromDiscord | <Elegantbeef> I personally find `self` very annoying since there is no clear separation between what a procedure is for |
02:49:36 | NimEventer | New Nimble package! simplelog - A deadly simply log package supporting very simple colorful logging., see https://github.com/sslime336/simplelog |
02:50:09 | FromDiscord | <Graveflo> doesn't the name of the proc tell you what it's for? |
02:50:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/qPjGG |
02:51:34 | FromDiscord | <Elegantbeef> I think it's incorrect to use `self` since Nim is procedural and you are not attaching a procedure to a type, you're operating on data passed in |
02:52:05 | FromDiscord | <Elegantbeef> But like i said the answer is use whichever you prefer |
02:52:29 | FromDiscord | <emanresu3> sure, I was just asking what is more common |
02:53:04 | FromDiscord | <Elegantbeef> Well i've only seen `self` and `this` sparingly |
02:53:09 | FromDiscord | <Elegantbeef> So... neither 😄 |
02:53:25 | FromDiscord | <Graveflo> I mean those procs are coupled as tightly as you can get to the type of their first parameter because the compiler will enforce the coupling through static typing. It really just comes down to how "attached" is defined |
02:53:32 | FromDiscord | <huantian> Well if it is a method, perhaps self/this is correct |
02:53:46 | FromDiscord | <huantian> Or at least admittable |
02:54:00 | FromDiscord | <Graveflo> yea thats what I was about to say. It might make sense for 'self' to mean that a function is doing OOP type things |
02:54:03 | FromDiscord | <Elegantbeef> Perhaps, I still do not see `self`/`this` often and just read it as a code smell |
02:56:09 | FromDiscord | <huantian> Easy TRM to ban it right? |
02:56:12 | FromDiscord | <huantian> 🙃 |
02:56:23 | FromDiscord | <Elegantbeef> Right |
03:08:15 | FromDiscord | <that_dude> Yo elegant, does the {.this.} pragma not exist anymore? I can find it in some gh comments, but not in any documentation |
03:08:27 | FromDiscord | <Elegantbeef> I've never seen it before |
03:09:26 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4x3x |
03:09:44 | FromDiscord | <Elegantbeef> What does that even do alias `self` to `this`? |
03:09:47 | FromDiscord | <that_dude> https://github.com/nim-lang/Nim/issues/5053 |
03:10:01 | FromDiscord | <that_dude> It seem like it also messes with the scope |
03:10:44 | FromDiscord | <that_dude> `{.this.} is deprecated. Can be closed?` ah nevermind I think |
03:22:46 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x3F |
03:24:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4x3I |
03:24:54 | FromDiscord | <Elegantbeef> But why are you not using an object variant |
03:26:03 | FromDiscord | <kcvinker> I am using nim dll in another scripting langage |
03:27:03 | FromDiscord | <kcvinker> It can send a pointer to nim |
03:27:34 | FromDiscord | <kcvinker> And in nim, I want to fill some data in that pointer. |
03:29:17 | FromDiscord | <kcvinker> @ElegantBeef , If i am not using var for pValue, I cannot assign to it |
03:29:49 | FromDiscord | <Elegantbeef> Right you do not want to assign it you want to write to where it points |
03:29:55 | FromDiscord | <Elegantbeef> You do not even want to do that |
03:30:01 | FromDiscord | <Elegantbeef> It's a pointer to some memory you want to copy from it to your nim data |
03:30:39 | FromDiscord | <Elegantbeef> Unless it's represented as a `void` what you're doing is wrong |
03:31:32 | FromDiscord | <kcvinker> currently, it's just an `int` at the calling site |
03:32:03 | FromDiscord | <Elegantbeef> Then yea what you're doing is wrong |
03:32:06 | FromDiscord | <kcvinker> So let me try with `int` |
03:33:07 | FromDiscord | <kcvinker> For typed data, everything works nice |
03:33:33 | FromDiscord | <kcvinker> If i use `var int`, its okay |
03:33:56 | FromDiscord | <Elegantbeef> I mean you need to do `copyMem` to move the data to the pointer |
03:34:19 | FromDiscord | <Elegantbeef> But what's the point of `pValue = cast[ptr float](pvalue)` |
03:36:07 | FromDiscord | <kcvinker> In reply to @Elegantbeef "But what's the point": cast the pointer to hold an int value |
03:36:10 | FromDiscord | <Elegantbeef> You've now made it point to itself |
03:36:27 | FromDiscord | <Elegantbeef> that's not needed |
03:36:33 | FromDiscord | <Elegantbeef> just do `copyMem` and call it a day |
03:36:39 | FromDiscord | <kcvinker> Oh i see |
03:36:59 | FromDiscord | <kcvinker> Thank you @ElegantBeef |
03:37:06 | FromDiscord | <JJ> curious to anyone who's used npegs extensively: how on earth do you deal with capturing optional values? |
03:37:10 | FromDiscord | <Elegantbeef> You have a type erased pointer, you can just write to it's destination assuming there is enough space there |
03:37:24 | FromDiscord | <Elegantbeef> Rumour has it if you ask about npeg enough a wild zevv appears |
03:37:41 | FromDiscord | <JJ> haha |
03:37:59 | FromDiscord | <JJ> sent a code paste, see https://play.nim-lang.org/#ix=4x45 |
03:38:29 | FromDiscord | <JJ> this doesn't work because code blocks are executed regardless of backtracking: yet i can't think of another way to deal with ex. `?(scheme ":")` |
03:38:37 | FromDiscord | <Elegantbeef> I only suggest npeg, never used it myself |
03:39:03 | FromDiscord | <JJ> it's nice to use when i know how to use it |
03:40:41 | FromDiscord | <JJ> pulling my hair out a bit rn b/c the codeblocks though |
03:50:19 | FromDiscord | <JJ> christ, i think this is the Big Issue unfortunately |
03:50:37 | FromDiscord | <JJ> time to make this ugly |
03:53:15 | FromDiscord | <leorize> you can also just ask Zevv on how to deal with that \:p |
03:53:41 | FromDiscord | <Elegantbeef> So leo I used your highlighting all day today |
03:53:57 | FromDiscord | <Elegantbeef> It works ok for normal code 😄 |
03:54:25 | FromDiscord | <leorize> it better be \:p a lot of interesting features depends on it |
03:55:08 | FromDiscord | <leorize> rn I'm playing with injections, ie. use markdown parser on doc comments |
03:55:44 | FromDiscord | <Elegantbeef> I do have to change my themes highlighting, cause it gives some red symbols which makes me think errors |
03:56:39 | FromDiscord | <leorize> probably for stuff like templates? |
03:56:58 | FromDiscord | <Elegantbeef> Think it was field access that was shown as red for me |
03:57:10 | FromDiscord | <Elegantbeef> Hurts the brain cause my instant reaction is "That's an error" |
03:57:19 | FromDiscord | <leorize> your theme is brutal lol |
03:57:34 | FromDiscord | <Elegantbeef> It's one of the stock vim distros |
03:57:50 | FromDiscord | <Elegantbeef> Had to check it's astronvim |
03:58:11 | FromDiscord | <leorize> most vscode themes have a nvim equivalent |
03:58:21 | FromDiscord | <leorize> in case you want something else |
04:00:05 | FromDiscord | <JJ> In reply to @leorize "you can also just": i think it's basically this: https://github.com/zevv/npeg/issues/32#issuecomment-817284051 |
04:00:41 | FromDiscord | <JJ> without named captures and with code blocks executing on backtracking i'm not actually sure if there's any way to deal with it, going to try some stuff first though |
04:05:57 | * | boxuser quit (Read error: Connection reset by peer) |
04:09:03 | NimEventer | New thread by melovv: Using TCC/NLVM to compile source code in a string, see https://forum.nim-lang.org/t/10235 |
04:11:32 | * | boxuser joined #nim |
04:26:20 | FromDiscord | <leorize> then I suppose you have to avoid backtracking altogether |
04:26:55 | FromDiscord | <leorize> an another trick that I could think of is to write a lexer and then use npeg to parse that |
04:29:00 | FromDiscord | <JJ> currently mangling my code so that every capture group has at most one optional statement, and then am checking the length of the capture list to determine whether or not it was matched and overwrite with the default value as necessary |
04:29:19 | FromDiscord | <JJ> i've never turned decent code into code this bad before |
04:29:23 | FromDiscord | <JJ> (edit) "bad" => "disgusting" |
04:31:40 | FromDiscord | <leorize> hmm I still can't imagine why backtracking would occur for this grammar |
04:32:05 | FromDiscord | <JJ> it's this part: `authority <- ?(>userinfo "@") hostport` |
04:33:25 | FromDiscord | <JJ> well actually a couple parts ig |
04:36:18 | FromDiscord | <leorize> try `-d:npegTrace` |
04:36:36 | FromDiscord | <leorize> that should give you something to figure the backtracking issue with |
04:40:41 | FromDiscord | <JJ> well i finished my mangling. it now "works" (by throwing all of the performance out the window) |
04:40:59 | FromDiscord | <leorize> at that point maybe just write a parser from scratch \:P |
04:41:00 | FromDiscord | <JJ> sent a code paste, see https://play.nim-lang.org/#ix=4x4b |
04:41:34 | FromDiscord | <leorize> have you tried the sample parser? https://github.com/zevv/npeg/blob/master/src/npeg/lib/uri.nim |
04:41:35 | FromDiscord | <JJ> i already have a parser from scratch, this is replacing that :-P |
04:41:52 | FromDiscord | <JJ> wait, what? haha |
04:42:25 | FromDiscord | <JJ> oh right yeah: it doesn't do captures unfortunately and captures are the problem |
04:48:19 | FromDiscord | <JJ> i think either code blocks not executing on backtraced steps or named captures / captures in optional blocks capturing default values instead of not existing would solve this. though from what i've read it seems like code blocks executing on backtraced steps might be necessary (don't know why) |
04:49:04 | FromDiscord | <leorize> a potential way out is to use a scanner in conjunction with the parser |
04:50:50 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4x4c |
04:53:43 | FromDiscord | <leorize> yea there are many unambiguous tokens, if you scan them out first the parser can potentially not backtrack as much |
04:53:52 | FromDiscord | <leorize> but I'm not entirely sure if npeg can decide tokens based on lookahead |
04:54:33 | FromDiscord | <Graveflo> In reply to @user2m "Anyone using the ImGui": platform? |
04:55:11 | FromDiscord | <user2m> In reply to @Graveflo "platform?": NVM! Just figured it out I had to compile to cpp `nim cpp -r timgui.nim` |
04:55:15 | FromDiscord | <JJ> yeah, i wanted to rewrite some simple parsers in npeg because it's cleaner / easier to be correct, but man this might have been the worst thing to rewrite |
04:56:12 | FromDiscord | <JJ> looking into the codebase now though - for something i consider absolute magic it's surprisingly little code |
05:19:37 | * | boxuser quit (Read error: Connection reset by peer) |
05:30:05 | FromDiscord | <JJ> i suppose i should ping @zevv: any tips for returning optional captures when backtracking is involved ex. in the examples above? and is deferring the execution of code blocks feasible? |
05:30:50 | FromDiscord | <JJ> oops. that was probably the wrong zevv. |
05:36:59 | * | rockcavera quit (Remote host closed the connection) |
06:03:44 | * | Jjp137 quit (Ping timeout: 248 seconds) |
06:04:06 | * | Jjp137 joined #nim |
06:05:05 | * | boxuser joined #nim |
06:15:21 | * | ntat joined #nim |
06:39:12 | * | PMunch joined #nim |
06:48:21 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4x4r |
06:50:07 | FromDiscord | <Elegantbeef> No |
06:50:12 | FromDiscord | <Elegantbeef> Easier to use an array or distinct types |
07:02:05 | PMunch | Or use a case statement |
07:03:13 | * | Notxor joined #nim |
07:03:14 | FromDiscord | <Dudugz> Sure |
07:03:43 | FromDiscord | <Dudugz> So procs can have different return values based on which enum key was used? |
07:04:09 | FromDiscord | <Elegantbeef> What? |
07:04:47 | FromDiscord | <Dudugz> I mean, I don't want to create multiple procs for the same thing, the only thing that changes is the return value, the logic is the same just for different data. |
07:05:05 | FromDiscord | <Elegantbeef> take in a static enum use `when` |
07:05:17 | FromDiscord | <Dudugz> Sure |
07:05:20 | * | om3ga joined #nim |
07:05:36 | * | Notxor left #nim (#nim) |
07:12:37 | FromDiscord | <Rika> Static enum means compile time values only though just a heads up |
07:28:28 | Amun-Ra | or have an arg of var T |
07:45:18 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal my Nim program requires thoses DLLs?↵The only dependencies I use are NimGL and ImGUI https://media.discordapp.net/attachments/371759389889003532/1113010229844639764/image.png https://media.discordapp.net/attachments/371759389889003532/1113010230058553384/image.png |
07:45:47 | FromDiscord | <leorize> if you compiled with gcc, then yes |
07:46:08 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @leorize "if you compiled with": And is it possible to statically link them? |
07:47:11 | FromDiscord | <mratsim> In reply to @System64 "And is it possible": `--dynlibOverride:mylib --passL:libmylib.a` |
07:47:19 | FromDiscord | <abisxir> Hey guys, anything ready for multiline spinner/progress in nim? |
07:47:42 | FromDiscord | <mratsim> In reply to @System64 "Is it normal my": seems like you compiled on windows via minGW? |
07:47:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @mratsim "seems like you compiled": I used Nim's compiler |
08:17:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @mratsim "seems like you compiled": Is it normal I have that? https://media.discordapp.net/attachments/371759389889003532/1113018228294295582/message.txt |
08:25:02 | FromDiscord | <System64 ~ Flandre Scarlet> Well, wouldn't it be simpler to compile with Clang instead? |
08:25:09 | FromDiscord | <System64 ~ Flandre Scarlet> btw I use the C++ backend |
08:41:19 | PMunch | Hmm, did something happen with shifts, oring, xoring etc. between 0.20.0 and 0.20.2? |
08:41:35 | PMunch | This library breaks between those two versions: https://github.com/MarcAzar/RollingHash |
08:57:21 | FromDiscord | <System64 ~ Flandre Scarlet> I tried with clang, but why it doesn't compile? https://media.discordapp.net/attachments/371759389889003532/1113028364207394836/message.txt |
08:59:17 | FromDiscord | <PMunch> Seems like you don't link it properly to something |
08:59:40 | FromDiscord | <PMunch> It complains that it is missing `imp_DragQueryFileW` and similar symbols |
09:03:08 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "It complains that it": I don't even use this function |
09:03:29 | PMunch | Well something uses it |
09:03:45 | PMunch | Unless it's somehow always generated |
09:04:06 | PMunch | I guess something being `exportc`'d would make it always generate for example |
09:04:58 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Unless it's somehow always": I use NIMGL and ImGUI (from NIMGL)↵I tried with MinGW but the problem is it doesn't work on some people's computer because Windows moment |
09:12:26 | PMunch | Sure it's not just a runtime dependency on some DLL? |
09:13:15 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Sure it's not just": The user has the DLLs |
09:23:07 | PMunch | And they set their path correctly? |
09:23:20 | PMunch | Their library loading path that is |
09:24:03 | * | Nam__ quit (Read error: Connection reset by peer) |
09:26:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Their library loading path": Even if the dlls are in the same dir as the exe |
09:33:03 | PMunch | Hmm, does it return an error? Have you checked it with a dynlib checker? |
09:34:27 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Hmm, does it return": it returns 0xC000007B↵And which dynlib checker should I use? |
09:36:22 | PMunch | I've used this tool before for this purpose: http://www.dependencywalker.com/ |
09:37:47 | PMunch | This might also be useful: https://github.com/nim-lang/Nim/issues/19713 |
09:43:10 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4x4N |
10:21:52 | FromDiscord | <chmod222> Any way to "unpack" a seq[T] into UncheckedArray[T] so I have a pointer to some data that will not get destroyed when the seq[] goes out of scope? |
10:22:25 | Amun-Ra | not without copy |
10:22:36 | FromDiscord | <chmod222> shame |
10:25:24 | PMunch | Well.. |
10:25:52 | PMunch | You could do some trickery with pointers GC_ref and destructors |
10:26:08 | FromDiscord | <chmod222> I know I could replicate the compiler internal structure and yank the pointer out by reinterpreting the seq[] |
10:26:19 | FromDiscord | <chmod222> But I try to maintain some of my sanity |
10:26:51 | FromDiscord | <chmod222> This section of code is not a hot loop and I can stomach a copy |
10:26:59 | FromDiscord | <chmod222> Still would have been nice not to have to |
10:39:15 | * | derpydoo quit (Read error: Connection reset by peer) |
11:27:07 | * | boxuser left #nim (#nim) |
12:54:32 | FromDiscord | <System64 ~ Flandre Scarlet> Does Nim have a static version of libgcc_s_seh-1.dll and libstdc++-6.dll? |
12:58:01 | PMunch | Ah, you found your missing dependencies? |
12:58:03 | FromDiscord | <jtv> @chmod It's not that hard; GC_ref it, then grab addr item[0], and there's your unchecked array, not going to out of scope until you decref it. |
12:58:32 | PMunch | This might be of interest to you: https://scripter.co/nim-deploying-static-binaries/ |
13:01:55 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Ah, you found your": Yeah, I needed the Nim's ones |
13:02:01 | FromDiscord | <filipemtx> have you guys used gintro with a ui file created on glade?↵I can't make it work I dunno what to do.↵I'm using this piece of the documentation |
13:02:02 | FromDiscord | <filipemtx> https://github.com/StefanSalewski/gintro#gtk-builderuser-interfaces-created-with-the-glade-tool |
13:02:30 | FromDiscord | <filipemtx> I'm able to compile the script on my windows if it is a certain type of xml |
13:02:39 | FromDiscord | <filipemtx> but when I do it from a glade ui I do, it doesn't work |
13:02:43 | FromDiscord | <filipemtx> can any1 help? |
13:03:03 | FromDiscord | <least antisemitic pole> explain to me how karax knows when to rerender on variable modification like im clinically stupid |
13:03:06 | PMunch | System64_~_Flandre_Scarlet, those aren't Nim-specific, it's just GCC and libc stuff |
13:03:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "System64_~_Flandre_Scarlet, those aren't Nim-specif": Yeah but no idea why, but it works with those ones |
13:03:48 | PMunch | filipemtx, wild guess is that you have to set your Glade export to use the correct Gtk version |
13:03:56 | FromDiscord | <System64 ~ Flandre Scarlet> Also Dependency Walker doesn't work for me |
13:04:00 | PMunch | I remember having issues like this with Gtk 2/3 in the past |
13:04:06 | FromDiscord | <filipemtx> hmmm |
13:04:12 | FromDiscord | <filipemtx> thanks I'm gonna take a look |
13:04:22 | PMunch | System64_~_Flandre_Scarlet, what do you mean doesn't work? |
13:04:38 | FromDiscord | <filipemtx> (edit) "do," => "make," |
13:04:43 | PMunch | filipemtx, not sure if it's the same issue, but it's a possibility |
13:04:52 | FromDiscord | <System64 ~ Flandre Scarlet> The windows error I talked about earlier |
13:05:00 | FromDiscord | <filipemtx> In reply to @PMunch "<@434491334838190082>, not sure if": ok thx! |
13:05:23 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "System64_~_Flandre_Scarlet, what do you": Oh, Dependency Walker, the program just freezes when I load my exe |
13:05:24 | PMunch | System64_~_Flandre_Scarlet, dependencywalker has the same error? |
13:05:36 | PMunch | Ah, that's probably not a great sign |
13:05:37 | FromDiscord | <System64 ~ Flandre Scarlet> No no, it freezes |
13:05:49 | FromDiscord | <System64 ~ Flandre Scarlet> It always did that with me |
13:05:51 | PMunch | Been a while since I used that tool though, might be something better out there |
13:06:06 | PMunch | On Linux I'd just use ldd or something |
13:08:21 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x5n |
13:09:09 | FromDiscord | <chmod222> I have to say, I really like how Nim doesn't get in my way when I really need to play around with memory and temporarily explode the limits of the type system, in a time where most languages get more and more restrictive for good, but frustrating reasons |
13:10:23 | FromDiscord | <System64 ~ Flandre Scarlet> Nim is quite strict about types |
13:11:06 | FromDiscord | <chmod222> Putting an `UncheckedArray[T]` as the last member of a struct and leaving it up to me to correctly deal with offsetting and allocating enough space is quite generous these days |
13:11:14 | FromDiscord | <chmod222> Well yes, unless you tell it not to |
13:14:26 | FromDiscord | <Nerve> I find `JsonNode` is a very nice way to get a dynamic heterogenous data structure. I have to check types when unpacking, of course, but that advantages are sometimes too strong to care. |
13:14:43 | FromDiscord | <Nerve> Nim can be less strict when you ask and it helps you along |
13:15:35 | PMunch | kcvinker, that's definitely not the best way of doing it |
13:16:21 | FromDiscord | <kcvinker> In reply to @PMunch "<@633714482572689449>, that's definitely not": Okay. Then could you please show me how to do it ? |
13:16:32 | PMunch | Well, depending on what "it" is of course, but for most sane "it"s this would not be a good way of achieving "it" |
13:16:47 | FromDiscord | <kcvinker> Yup |
13:18:14 | PMunch | First of `case` over an `int` is probably not a great idea. If you have discrete actions you should prefer an enum. That `else: discard` is a bad code smell and would likely lead to issues down the road |
13:18:48 | PMunch | Second, `var pointer` means you can edit the pointer, which you don't do. You edit what's behind the pointer, which is fine without the `var` keyword. |
13:19:03 | FromDiscord | <mratsim> In reply to @PMunch "First of `case` over": I create an "unreachable" proc for those. |
13:19:19 | FromDiscord | <kcvinker> @PMunch Okay |
13:20:04 | * | progranner joined #nim |
13:20:16 | PMunch | Third, you create a ref object only to assign it some data and use it as a pointer. This just leads to an extra copy with no benefit. I'd use `cast[ptr int32](pValue)[] = this.width` instead and drop the whole `iPtr` and `copyMem` dance. |
13:20:37 | PMunch | mratsim, an unreachable proc? |
13:21:16 | FromDiscord | <kcvinker> In reply to @PMunch "First of `case` over": Please don't mind the `case` statement. Because, I will create an enum for it and I will cover all the possible values in it. |
13:23:50 | PMunch | That part is fine then, but the other things should be changed. Oh and you're also missing a comma in your arguments list |
13:24:29 | FromDiscord | <kcvinker> In reply to @PMunch "That part is fine": Tyoe |
13:24:35 | FromDiscord | <kcvinker> (edit) "Tyoe" => "Typo" |
13:25:13 | FromDiscord | <kcvinker> @PMunch ↵> `cast[ptr int32](pValue)[] = this.width`↵This worked like a charm. Thanks a lot 🙂 |
13:25:44 | PMunch | No problem :) |
13:26:08 | PMunch | What are you trying to achieve here anyways? |
13:26:27 | FromDiscord | <Dudugz> sent a long message, see http://ix.io/4x5s |
13:26:39 | * | antranigv quit (Ping timeout: 256 seconds) |
13:26:41 | * | antranigv_ joined #nim |
13:27:10 | FromDiscord | <Dudugz> (edit) "http://ix.io/4x5s" => "https://paste.rs/6Quek" |
13:30:38 | * | antranigv_ is now known as antranigv |
13:31:04 | FromDiscord | <leorize> depends on your latency requirements |
13:31:25 | * | antranigv is now known as antranigv_ |
13:31:52 | FromDiscord | <Dudugz> Well, there are not many requirements, there are only two states, either the person is playing, or he is accessing information, it is not possible to do both at the same time. |
13:31:59 | FromDiscord | <Dudugz> (edit) removed "he" |
13:35:11 | * | antranigv_ is now known as antranigv |
13:36:46 | * | antranigv is now known as antranigv_ |
13:39:45 | FromDiscord | <rb3.nim> sent a code paste, see https://play.nim-lang.org/#ix=4x5w |
13:59:51 | * | PMunch quit (Quit: Leaving) |
14:11:07 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
14:12:47 | FromDiscord | <leorize> personally I'd do queue management on server side rather than client side |
14:13:33 | FromDiscord | <leorize> you can't really rely on a defense in the client where the user have control |
14:15:27 | * | progranner joined #nim |
14:21:25 | * | ntat quit (Quit: Leaving) |
14:21:43 | * | ntat joined #nim |
14:24:43 | FromDiscord | <least antisemitic pole> can I hide/rename the default `result` variable in a proc? |
14:25:07 | FromDiscord | <least antisemitic pole> use case is, im writing a macro and I have no access to the external result because of overshadowing |
14:25:24 | FromDiscord | <least antisemitic pole> by the "internal" implrementation-detail proc |
14:26:00 | * | sunset joined #nim |
14:30:38 | FromDiscord | <mratsim> In reply to @PMunch "<@570268431522201601>, an unreachable proc?": something to quit with a lot of noise to ease debugging compared to discard |
14:41:10 | FromDiscord | <least antisemitic pole> how to make a types empty set? `{}` but with a type |
14:47:03 | * | antranigv_ is now known as antranigv |
14:48:01 | FromDiscord | <Nerve> `initSet`, `initOrderedSet`, `initHashSet` |
14:48:29 | FromDiscord | <Nerve> Apparently there is a generic `init` |
14:50:58 | * | sunset left #nim (#nim) |
14:57:43 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
15:00:03 | * | progranner joined #nim |
15:04:55 | FromDiscord | <Gumbercules> pretty sure this gets invoked in each module prior to any other function |
15:05:03 | FromDiscord | <Gumbercules> the "generic `init`" |
15:05:20 | FromDiscord | <Gumbercules> (edit) "prior to any other function" => "when it is loaded" |
15:05:51 | FromDiscord | <Gumbercules> maybe I'm thinking of Odin.... |
15:19:24 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
15:19:55 | FromDiscord | <Dudugz> In reply to @leorize "personally I'd do queue": this is on server side :v clients should never get direct access to db |
15:22:28 | * | progranner joined #nim |
16:09:05 | FromDiscord | <cmc> Is there something like sequtils for tables? e.g. "iterate over all pairs where value-field `foo` is larger than 3". |
16:09:21 | FromDiscord | <arkanoid> why nlvm is a separate independent project, instead of being the "LLVM IR" backend of nim? |
16:09:51 | FromDiscord | <cmc> Or 'give me a sorted table of all pairs sorted by value-field foo' |
16:28:10 | FromDiscord | <juan_carlos> In reply to @arkanoid "why nlvm is a": No idea, but I seen the dude of Zig complaining about llvm breakages, memory fragmentation, performance, etc etc time to time. |
16:29:11 | FromDiscord | <juan_carlos> (edit) "time." => "time (as in not perfect silver bullet neither)." |
16:29:45 | arkanoid | juan_carlos: seems pretty improbable, considering whole Apple works rely on it, and lots of the rest too |
16:30:33 | FromDiscord | <juan_carlos> Yeah Apple on desktop is not bug free neither. |
16:30:43 | FromDiscord | <juan_carlos> Also https://arewestackefficientyet.com |
16:33:37 | * | arkurious joined #nim |
16:33:41 | * | arkurious quit (Remote host closed the connection) |
16:34:59 | FromDiscord | <etra> In reply to @juan_carlos "Also https://arewestackefficientyet.com": but that's comparing two llvm projects, clang and rustc |
16:35:06 | FromDiscord | <etra> (edit) "llvm" => "llvm-backed" |
16:35:15 | arkanoid | juan_carlos, this is rustc vs clang, both llvm |
16:36:12 | FromDiscord | <juan_carlos> Yep |
16:36:36 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4x6a |
16:36:50 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4x6a" => "https://play.nim-lang.org/#ix=4x6b" |
16:58:24 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:59:23 | * | progranner joined #nim |
17:04:52 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:07:29 | * | progranner joined #nim |
17:11:37 | * | progranner quit (Client Quit) |
17:14:46 | * | progranner joined #nim |
17:17:07 | FromDiscord | <Elegantbeef> @Arathanis\: this isnt even move semantics Nim sequences are value types |
17:17:45 | FromDiscord | <Arathanis> In reply to @Elegantbeef "<@136570191038513152>\: this isnt even": does that mean i just need to make `s` a `ref seq[int]`? |
17:18:07 | FromDiscord | <Elegantbeef> Or do the unsafe `var s = e[].s.addr` and `s[].add 42` |
17:18:23 | FromDiscord | <Elegantbeef> or you know pass `e.s` to a procedure |
17:18:24 | FromDiscord | <mratsim> _pitchfork_ |
17:19:06 | FromDiscord | <Arathanis> let's do it the unsafe way to scare away the rustacians |
17:19:32 | FromDiscord | <Elegantbeef> there is `std/decls` to make it little less scary |
17:19:42 | FromDiscord | <Elegantbeef> `var s {.byaddr.} = e[].s` |
17:19:50 | * | rockcavera joined #nim |
17:23:11 | FromDiscord | <Arathanis> im gonna take a look at this lib, haven't seen it yet |
17:24:13 | FromDiscord | <Arathanis> Beef, is there a list of builtins that are value vs ref? |
17:26:18 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:28:19 | * | progranner joined #nim |
17:29:44 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4x6m |
17:30:09 | FromDiscord | <Elegantbeef> All Nim primitives are values |
17:30:58 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4x6m" => "https://play.nim-lang.org/#ix=4x6n" |
17:31:25 | FromDiscord | <Elegantbeef> When you write the variable name it expands into `tmp[]` |
17:33:26 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4x6o |
17:33:40 | FromDiscord | <Arathanis> well i guess the "s2" specifically is the template |
17:33:41 | FromDiscord | <Elegantbeef> It doesnt turn it into a template |
17:33:44 | FromDiscord | <Elegantbeef> `s2` is a template |
17:33:51 | FromDiscord | <Elegantbeef> it just calls the template |
17:36:36 | FromDiscord | <Arathanis> so the return type of `{.byaddr.}` is a template and a closure that causes the identifier I assign to to be a template that expands to dereferencing the inner temp pointer |
17:36:38 | FromDiscord | <Arathanis> (edit) "pointer" => "pointer?" |
17:40:26 | FromDiscord | <Arathanis> no wait, def not a closure. tmp just is not injected so I can't reference it directly. |
17:46:58 | FromDiscord | <Arathanis> final question while I reckon how this template works. |
17:47:44 | FromDiscord | <Arathanis> so the template takes 3 params and is applied to a assignment expression. does the template mechanisms automatically unpack the 3 pieces of the assignment expression since its AST Node has 3 parts? |
17:48:07 | FromDiscord | <Arathanis> (edit) "so the template takes 3 params and is applied to a assignment expression. does the ... templatemechanism" added "compiler" | "mechanisms" => "mechanism" | "templatemechanismautomatically unpack the 3 pieces of the assignment expression since its AST Node has 3 parts? ... " added "are there any other examples of using this kind of unpacking?" |
17:57:16 | FromDiscord | <guttural666> do you guys split files like lexer.nim and lexer_types.nim to avoid circular dependencies? |
17:58:15 | FromDiscord | <mratsim> In reply to @guttural666 "do you guys split": yes |
17:58:17 | FromDiscord | <guttural666> had some problems in the past with this, where a file had to know about at least the types, but not the functionality |
17:58:25 | FromDiscord | <Arathanis> what was the alternative structure that was causing a circular dep? |
17:58:30 | FromDiscord | <Arathanis> also: yes |
17:58:32 | FromDiscord | <guttural666> In reply to @mratsim "yes": okay, so I am not insane probably 😄 |
18:00:01 | FromDiscord | <guttural666> In reply to @Arathanis "what was the alternative": main -> calling db -> calling api, but api still had to know about db to be able to parse answers into valid db types |
18:00:52 | FromDiscord | <guttural666> so I did a strictly linear dependency hierarchy for the procs and was able to share the types around promiscuously |
18:00:56 | FromDiscord | <Arathanis> so db was importing api but api was importing db? |
18:01:04 | FromDiscord | <guttural666> that's it |
18:01:31 | FromDiscord | <Arathanis> or specifically, db was importing api so it could call it, and api was importing db so it knew how to coerce to db types |
18:01:42 | FromDiscord | <guttural666> exactement |
18:02:37 | FromDiscord | <guttural666> will need the same for main->lexer->parser I am pretty sure |
18:03:00 | FromDiscord | <Arathanis> lexer should not need to know anything about parser |
18:03:14 | FromDiscord | <guttural666> yeah you're right actually |
18:03:15 | FromDiscord | <Arathanis> or at least, none of the lexer/parser pairs ive ever written should. |
18:03:19 | FromDiscord | <Arathanis> lexer is just a tokenizer |
18:03:24 | FromDiscord | <guttural666> indeed |
18:03:33 | FromDiscord | <Arathanis> parser needs to know about tokens and the perhaps the lexer itself, but lexer should care at all |
18:04:31 | FromDiscord | <Graveflo> sent a long message, see http://ix.io/4x6y |
18:05:45 | FromDiscord | <Arathanis> In reply to @Graveflo "I'm trying to write": my recommendation is to just build it instead of agonizing about the design. you can always iterate on that but going back to the drawing board is going to prevent you from discovering the other things you need to figure out |
18:05:58 | FromDiscord | <Arathanis> unless that is what is currently happening, in which case, welcome to the design process 😂 |
18:06:17 | FromDiscord | <Arathanis> @guttural666 id probably lift the IO out completely and put a facade between them. |
18:06:18 | FromDiscord | <guttural666> In reply to @Arathanis "my recommendation is to": probably the hardest lesson to learn in SE, just build a simple solution and iterate |
18:06:38 | FromDiscord | <Arathanis> I don't think the db and api should know about each other at all. You can have a 3rd layer that handles that for you |
18:06:49 | FromDiscord | <Arathanis> In reply to @guttural666 "probably the hardest lesson": exactly, the design will come out of trial and error |
18:07:06 | FromDiscord | <Graveflo> I certainly agree with that. I will do that too. I guess the issue is I'm not sure how I'm going to learn my lesson about this one if I am wrong. I'm not expecting it to fail |
18:07:11 | FromDiscord | <Arathanis> write that PoC, discover the unknowns, iterate forever |
18:07:26 | FromDiscord | <Arathanis> In reply to @Graveflo "I certainly agree with": decide in some kind of MVP PoC |
18:07:28 | FromDiscord | <Arathanis> and just implement it |
18:07:36 | FromDiscord | <Arathanis> some kind of base functionality |
18:07:39 | FromDiscord | <Arathanis> then iterate and expand upon it |
18:07:52 | FromDiscord | <Arathanis> you will discover if rewrites are necessary but in doing so the proper design will become clear. |
18:08:09 | FromDiscord | <guttural666> In reply to @Arathanis "write that PoC, discover": more fun as well, since you actually write stuff, most initial ideas are trash, but you can only possibly find out as you go |
18:08:39 | FromDiscord | <Arathanis> In reply to @guttural666 "more fun as well,": that is possibly the biggest benefit |
18:08:50 | FromDiscord | <Arathanis> you actually grow and learn and write code instead of feeling stuck in a rut of whiteboarding the design |
18:08:55 | FromDiscord | <Arathanis> there is a reason waterfall fell out of style |
18:09:04 | FromDiscord | <Arathanis> (edit) "there is a reason waterfall fell out of style ... " added "in favor of agile" |
18:10:12 | FromDiscord | <Arathanis> @guttural666 not facade, bridge. had to bust out the ol' Book of 4 |
18:10:53 | FromDiscord | <guttural666> In reply to @Arathanis "<@375727321958580228> not facade, bridge.": yeah probably similar to model, view, controller design |
18:11:22 | FromDiscord | <guttural666> (edit) "In reply to @Arathanis "<@375727321958580228> not facade, bridge.": yeah probably similar to model, view, controller design ... " added "for GUI" |
18:12:20 | FromDiscord | <Arathanis> yeah |
18:12:37 | FromDiscord | <Arathanis> db talks to and from database, with appropriate types |
18:12:41 | FromDiscord | <Arathanis> api talks to and from api with approprioate types |
18:12:51 | FromDiscord | <Arathanis> bridge is a translation layer between the two |
18:12:57 | FromDiscord | <Arathanis> and main orechestrates |
18:13:01 | FromDiscord | <Arathanis> (edit) "orechestrates" => "orchestrates" |
18:13:53 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4x6z |
18:14:23 | FromDiscord | <Arathanis> and now api and db can change independent of each other |
18:14:28 | FromDiscord | <Arathanis> decoupling 🙏 |
18:17:49 | FromDiscord | <guttural666> yeah, that sounds reasonable, but if you just want the API to build and return appropriate types to the db, just outsourcing the types is pretty good as well |
18:20:07 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4x6A |
18:22:43 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:25:04 | * | progranner joined #nim |
18:27:53 | FromDiscord | <guttural666> In reply to @ieltan "This template doesn't work": thinking about varargs when I see this, not sure if that is helpful |
18:31:29 | FromDiscord | <guttural666> prob not |
18:32:53 | FromDiscord | <Arathanis> im gonna assume you actually want a macro here |
18:33:14 | FromDiscord | <Arathanis> or just wait for beef to come solve the problem :] |
18:34:17 | FromDiscord | <ieltan> In reply to @guttural666 "thinking about varargs when": Nope already tried that and it doesn"t work ... |
18:34:53 | FromDiscord | <ieltan> In reply to @Arathanis "im gonna assume you": hmmm.. nevermind then ... Thanks |
18:36:09 | FromDiscord | <Arathanis> In reply to @ieltan "hmmm.. nevermind then ...": dont want to use a macro? |
18:37:05 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:37:38 | FromDiscord | <Elegantbeef> Why do people use templates for no reason |
18:37:46 | FromDiscord | <Elegantbeef> The simplest tool, cmon people |
18:38:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/qNNnN |
18:38:49 | FromDiscord | <Arathanis> i had a feeling this was going to be the result, and I was about to suggest it haha |
18:39:00 | FromDiscord | <Arathanis> told you beef would show up and lay down the law |
18:39:46 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4x6E |
18:40:01 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6F |
18:40:26 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4x6G |
18:40:28 | FromDiscord | <Elegantbeef> What's the error? |
18:40:39 | FromDiscord | <ieltan> Thanks anyways beef |
18:41:29 | * | progranner joined #nim |
18:43:01 | FromDiscord | <Elegantbeef> @kcvinker that question above was for you |
18:43:27 | FromDiscord | <guttural666> also, probably just use an array, if it's compile time known in terms of size I guess |
18:43:50 | FromDiscord | <kcvinker> @ElegantBeef I am sorry, that was my mistake. I didn't think the whole point |
18:44:11 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6H |
18:44:34 | FromDiscord | <Elegantbeef> Jees so much possible unsafe code in this api |
18:45:16 | FromDiscord | <Arathanis> isn't `pointer` just a void pointer? |
18:45:25 | FromDiscord | <Elegantbeef> Yes |
18:45:29 | FromDiscord | <Arathanis> O_o |
18:45:41 | FromDiscord | <Elegantbeef> Exactl |
18:45:53 | FromDiscord | <Arathanis> is there a reason this is ↵- not typed as an int ptr↵- not just an var int |
18:46:00 | FromDiscord | <Arathanis> (edit) "an" => "a" |
18:46:04 | FromDiscord | <Elegantbeef> Plus `copyMem` exists |
18:46:10 | FromDiscord | <Elegantbeef> This is from a library arath |
18:46:16 | FromDiscord | <Arathanis> oh wow |
18:46:22 | FromDiscord | <Elegantbeef> So they have a type erased pointer cause C |
18:46:30 | FromDiscord | <Arathanis> 😱 |
18:46:31 | FromDiscord | <kcvinker> Yes |
18:47:04 | FromDiscord | <Elegantbeef> If you're doing `cast[ptr T](pointer)[] = ....` just use copymem |
18:47:10 | FromDiscord | <Elegantbeef> It's literally the same thing but less silly |
18:47:31 | FromDiscord | <kcvinker> Oh I see. Let me check @ElegantBeef |
18:48:28 | FromDiscord | <Arathanis> what would that look like? |
18:48:45 | FromDiscord | <kcvinker> @ElegantBeef But when using `copyMem`, How do I get the address of my varibale ? `addr` & `unsafeAddr` won't work |
18:49:16 | FromDiscord | <Elegantbeef> Why don't they worrk |
18:49:32 | FromDiscord | <kcvinker> Ons second @ElegantBeef |
18:49:41 | FromDiscord | <Elegantbeef> You can quit pinging me |
18:49:54 | FromDiscord | <Elegantbeef> I have atleast one active neuron I can follow a conversation |
18:50:39 | FromDiscord | <kcvinker> In reply to @Elegantbeef "You can quit pinging": Sorry |
18:51:10 | FromDiscord | <kcvinker> Problem solved. and `unsafeAddr` worked in copyMem. My bad. |
18:59:20 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4x6N |
19:00:09 | FromDiscord | <Elegantbeef> `create` is a nicer allocator |
19:00:42 | * | junaid_ joined #nim |
19:09:13 | FromDiscord | <chmod222> And with the latter you can pretend programming in ruby by pretending your int has methods\: `int.create(1)` |
19:09:26 | FromDiscord | <chmod222> If you are into that |
19:09:51 | FromDiscord | <Arathanis> i like the syntax |
19:09:54 | FromDiscord | <Arathanis> but im def not into ruby |
19:11:15 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6Q |
19:11:41 | FromDiscord | <Elegantbeef> It's not cause it's primitive it's just cause `getWcharPtr` doesnt return an address |
19:12:10 | * | ntat quit (Quit: Leaving) |
19:12:39 | FromDiscord | <Arathanis> is createShared just create but so you can share the pointer with threads? |
19:12:52 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6S |
19:13:28 | FromDiscord | <Elegantbeef> Why are you casting `p` number 1 |
19:13:30 | FromDiscord | <Elegantbeef> number two that'll work just fine |
19:14:00 | FromDiscord | <Elegantbeef> It's `sizeof(LPWCHAR)` cause you want to copy the pointer not a single char |
19:14:08 | FromDiscord | <Elegantbeef> or just `sizeof(pointer)` |
19:14:16 | FromDiscord | <kcvinker> Oh i see |
19:14:23 | FromDiscord | <kcvinker> Let me try that |
19:17:43 | FromDiscord | <kcvinker> The caller expects a wchar pointer |
19:18:07 | FromDiscord | <kcvinker> So we must pass a pointer to what the caller expects. |
19:18:20 | FromDiscord | <kcvinker> So we need a pointer to wchar pointer |
19:19:04 | FromDiscord | <kcvinker> Thats why i am casting p |
19:20:57 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6W |
19:21:22 | FromDiscord | <kcvinker> See https://media.discordapp.net/attachments/371759389889003532/1113185402141024358/image.png |
19:24:02 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4x6Z |
19:24:09 | FromDiscord | <kcvinker> See https://media.discordapp.net/attachments/371759389889003532/1113186100270334012/image.png |
19:39:15 | FromDiscord | <arkanoid> this is interesting https://wasmer.io/posts/announcing-wasix |
19:41:44 | FromDiscord | <guttural666> does this seriously initialize tokenize on each loop pass? this should be a declaration only, not a declaration, am I wrong? https://media.discordapp.net/attachments/371759389889003532/1113190527404355604/image.png |
19:42:08 | FromDiscord | <guttural666> just yeeted it out of that while loop and now my shit works |
19:42:39 | FromDiscord | <Elegantbeef> Nim 0 inits |
19:42:40 | FromDiscord | <guttural666> (edit) "declaration," => "definition," |
19:43:02 | FromDiscord | <Elegantbeef> It's declared inside the scope so it's lifetime is the scope |
19:43:19 | FromDiscord | <guttural666> so it resets the life time? |
19:43:40 | FromDiscord | <guttural666> i thought var was a compile time declaration only |
19:43:59 | FromDiscord | <Elegantbeef> it doesnt reset the life time, ever while loop iteration it's redeclared cause that's how code works |
19:43:59 | FromDiscord | <Elegantbeef> Is there a language with local variables are persistent across while loops |
19:46:59 | FromDiscord | <Graveflo> wdym compile time declaration? It's unlikley that `file` has a value at the time of compilation. Aren't things like `cont` and `static` for compile time? |
19:47:21 | FromDiscord | <Elegantbeef> Yea no clue what they meant by that |
19:47:39 | FromDiscord | <Graveflo> btw I meant `const` there obvi |
19:47:53 | FromDiscord | <Elegantbeef> `const tokenize: bool` makes no sense anyway |
19:47:59 | FromDiscord | <Elegantbeef> They clearly do not understand scopes |
19:48:09 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4x73 |
19:48:24 | FromDiscord | <guttural666> (edit) "https://play.nim-lang.org/#ix=4x73" => "https://play.nim-lang.org/#ix=4x74" |
19:48:27 | FromDiscord | <Elegantbeef> Yea i'm not going to conside that a real languge |
19:48:31 | FromDiscord | <Elegantbeef> 😛 |
19:48:33 | FromDiscord | <guttural666> hahahaha |
19:48:56 | FromDiscord | <Elegantbeef> Like what is the point of `tokenize: bool` if you do not use the variable at runtime |
19:49:22 | FromDiscord | <guttural666> I do, just was confused about what var: type does I guess |
19:49:35 | FromDiscord | <Elegantbeef> It declares a variable that is 0initd |
19:49:44 | FromDiscord | <Elegantbeef> No different than `var tokenize = default(bool)` |
19:50:19 | FromDiscord | <guttural666> yeah, gotta yeet everything out of the loop then |
19:50:28 | FromDiscord | <guttural666> spending too much time at work |
19:50:33 | FromDiscord | <Elegantbeef> Also stop using a while loop |
19:50:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/6LO6q |
19:51:34 | FromDiscord | <guttural666> ah, didn't even know that was possible |
19:52:34 | FromDiscord | <guttural666> okay, it just reads the amount of lines beforehand |
19:55:36 | FromDiscord | <guttural666> In reply to @Elegantbeef "it doesnt reset the": this was the important clue, thanks |
20:03:22 | FromDiscord | <guttural666> kind of like the ABAP way more, because this will always pollute the surrounding scope: https://media.discordapp.net/attachments/371759389889003532/1113195970423967875/image.png |
20:04:17 | FromDiscord | <guttural666> maybe just my brain farts |
20:04:46 | FromDiscord | <Graveflo> I'm not saying this is what you do, but some say that if a proc is doing more than one thing you should really have two procs and thus two scopes anyway |
20:05:03 | * | junaid_ quit (Remote host closed the connection) |
20:05:20 | FromDiscord | <guttural666> In reply to @Graveflo "I'm not saying this": I think this is harmful ideology |
20:05:58 | FromDiscord | <Graveflo> whats the reasoning? |
20:10:52 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4x7c |
20:13:33 | FromDiscord | <guttural666> I just try to keep my function hierarchy as flat as possible, it's so much easier to read and reason about, not jumping around in endless call stacks like a monkey |
20:13:57 | FromDiscord | <Graveflo> yea, on this way of thinking that is my main issue with the mantra. "One thing" is ambiguous. In my mind, there is a place for accessor / mutator style code, not that your argument is specific to it, but there's no reason to overdo the concept. Perhaps its more palatable if you bar very small "things" |
20:14:47 | FromDiscord | <Graveflo> and prioritizing making your code easy to understand is certainly not a bad idea so I understand what you mean |
20:15:39 | FromDiscord | <guttural666> In reply to @Graveflo "yea, on this way": exactly, just choose a reasonable solution without confusing yourself and others just because some pattern ideologue says it is de way |
20:16:58 | FromDiscord | <guttural666> kind of what I think and what I had to learn reading my own shitty "abstracted" code |
20:17:04 | FromDiscord | <Graveflo> I like pattern ideologies though because I always read my old code and think I could have done better. Sometimes it's nice to keep certain things in mind that counter bad intuition. I expect this is more of a "me" problem then it is for most |
20:17:22 | FromDiscord | <Rika> In reply to @guttural666 "I think this is": only if you apply it to the extremes |
20:17:37 | FromDiscord | <Rika> with anything, extremes are almost always awful xd |
20:18:21 | FromDiscord | <guttural666> In reply to @Rika "only if you apply": yeah that was my point, I read a lot of code like that at work and I know people get it from books and uni and they end up writing absolute garbage code that is not readable and full of boiler plate |
20:19:16 | FromDiscord | <Rika> but is it the fault of the ideology or is it the fault of the education |
20:19:28 | FromDiscord | <guttural666> getters and setters that literally assign an int is just the tip of the iceberg |
20:19:56 | FromDiscord | <Rika> java moment |
20:20:36 | FromDiscord | <guttural666> one and the same, it's just wrong, SE should be about practical solutions to real problems, sometimes you yeet shit out of your control flow and put it in a function, because it makes sense, sometimes it's cool to be part of the control flow |
20:20:53 | FromDiscord | <guttural666> look at me talking like somebody who knows anything lol |
20:21:04 | FromDiscord | <Rika> eh no pragmatism is pretty important |
20:21:13 | FromDiscord | <guttural666> this |
20:21:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4x7e |
20:22:08 | FromDiscord | <Rika> i forgot the difference between a block and an if true |
20:22:10 | FromDiscord | <Rika> is it the break |
20:22:13 | FromDiscord | <Rika> (edit) "is it the break ... " added "behaviour" |
20:22:15 | FromDiscord | <Elegantbeef> yes |
20:22:27 | FromDiscord | <Elegantbeef> `if true` creates a scope but does not eat a break |
20:22:33 | FromDiscord | <Rika> yummy breaks |
20:22:36 | FromDiscord | <Elegantbeef> `block` creates a scope but eats a break |
20:22:40 | FromDiscord | <Graveflo> what about `block` |
20:22:45 | FromDiscord | <Rika> tho ive never tasted a break |
20:23:02 | FromDiscord | <Elegantbeef> I assume i answered your question grave |
20:23:06 | FromDiscord | <Graveflo> yaya mb |
20:23:16 | FromDiscord | <Rika> In reply to @Rika "tho ive never tasted": kinda weird no one has since breakfast is a thing |
20:23:32 | FromDiscord | <Elegantbeef> Well it's breaking a fast |
20:23:52 | FromDiscord | <Rika> i was making an admittedly awful joke |
20:24:00 | FromDiscord | <guttural666> I'm gonna consume a token rn |
20:24:00 | FromDiscord | <Rika> come on beef stop being such a bongo |
20:24:25 | FromDiscord | <Elegantbeef> I'll always be the most annoying drum |
20:24:38 | FromDiscord | <Rika> do people regularly beat you |
20:24:58 | FromDiscord | <Elegantbeef> What do you think? |
20:27:34 | FromDiscord | <Rika> No, I don’t think |
20:38:28 | FromDiscord | <guttural666> 🤣 |
20:43:40 | FromDiscord | <guttural666> @ElegantBeef will this then actually double malloc inside of a loop? or will that memset the next time the loop comes around? https://media.discordapp.net/attachments/371759389889003532/1113206111932268554/image.png |
20:45:22 | FromDiscord | <guttural666> (edit) "loop?" => "loop (meaning not reuse the memory)?" |
20:47:24 | FromDiscord | <Graveflo> I dont link the int returned from len is going to need malloc. If thats what you mean |
20:48:18 | FromDiscord | <Graveflo> but yea, unless you need to re-compute `print_from` at each iteration move it outside the loop |
20:49:42 | FromDiscord | <Graveflo> if you really want to discourage movement maybe you could declare it as `var` outside the loop and just set over top each time |
20:49:50 | FromDiscord | <Graveflo> but idk about that |
20:52:28 | FromDiscord | <guttural666> pretty sure this will let the memory go of print from at the end of the while scope and then see the "let print_from" again next time around and think "a completely new variable I have never seen, let's get some mem for this" |
20:52:38 | FromDiscord | <guttural666> at least if the compiler is naive |
20:52:54 | FromDiscord | <Elegantbeef> It's stack allocated |
20:52:55 | FromDiscord | <Elegantbeef> It doesnt matter |
20:53:21 | FromDiscord | <guttural666> malloc is 200 CPU cycles god damnit! 😄 |
20:53:28 | FromDiscord | <Graveflo> right i get what you mean. Yea just pretend you are writing c and pre-declare the name... Or listen to beef bc I'm sure he's right and it doesnt matter |
20:53:45 | FromDiscord | <guttural666> pretended I wrote ABAP for too long hahaha |
20:53:45 | FromDiscord | <Elegantbeef> Stack allocated variables are not using malloc |
20:53:50 | FromDiscord | <Elegantbeef> They're statically allocated |
20:54:00 | FromDiscord | <guttural666> In reply to @Elegantbeef "Stack allocated variables are": you're right yeah |
20:54:39 | FromDiscord | <guttural666> but let pls: string would actually null out that value every loop pass |
20:54:57 | FromDiscord | <Ayy Lmao> I just ran into an insanely insidious bug using emscripten. It's hard to explain but apparently passing a ref as an argument doesn't increase the ref count while it's in scope for the function? |
20:55:20 | FromDiscord | <Elegantbeef> Sure but that's what you've decreed |
20:55:23 | FromDiscord | <Elegantbeef> If you want to reuse memory reuse it |
20:55:25 | FromDiscord | <Elegantbeef> Like what? |
20:59:13 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x7l |
20:59:23 | FromDiscord | <Ayy Lmao> If you don't do `let widget = widget` then arc collects it |
21:00:55 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:01:27 | FromDiscord | <etra> how do I get for HashSet to use my custom hash function? even though `hash` is exported, and I can see it gets called if I throw an exception, neither intersection nor union actually uses what I'm returning |
21:02:01 | FromDiscord | <etra> oh wait, do I need to export `==`? |
21:03:24 | FromDiscord | <guttural666> In reply to @Elegantbeef "If you want to": nulling is a cost that is not necessary, same with letting formerly stack allocated memory go and and getting a new int is right? just gonna yeet all the declarations out of the loop |
21:03:55 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4x7n |
21:04:16 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4x7n" => "https://play.nim-lang.org/#ix=4x7o" |
21:16:41 | * | NimBot joined #nim |
21:16:52 | * | FromDiscord joined #nim |
21:17:11 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4x7x |
21:17:19 | FromDiscord | <Elegantbeef> Fixed in devel i believe |
21:20:56 | FromDiscord | <Ayy Lmao> Is using GcRef on top level refs the best way to keep them alive in emscripten? It is leading to strange and hard to debug behavior for me and I am wondering if there is a nicer way to get them to behave well. |
21:21:15 | NimEventer | New Nimble package! nimcatapi - nimcatapi is a library that lets you easily request images from thecatapi and/or thedogapi., see https://github.com/nirokay/nimcatapi |
21:23:26 | * | marcus joined #nim |
21:23:51 | FromDiscord | <Elegantbeef> You're using arc/orc? |
21:24:41 | FromDiscord | <Ayy Lmao> Yeah, the problem is I am spawning an event loop with `emscripten_request_animation_frame_loop` and that doesn't block the program from reaching the end, so everything gets collected unless I do GcRef |
21:25:02 | FromDiscord | <Ayy Lmao> And doing GcRef on a top level ref seems to have very peculiar behavior. |
21:26:43 | FromDiscord | <Elegantbeef> Are you not calling nimmains till? |
21:27:17 | FromDiscord | <Ayy Lmao> Am I supposed to be calling NimMain in emscripten? This is a completely different thing from the plugin thing I am doing btw. |
21:27:43 | FromDiscord | <Elegantbeef> I don't know what you're doing are you writing a pure Nim emscriptin program? |
21:28:03 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "I don't know what": Yeah essentially |
21:28:29 | FromDiscord | <Elegantbeef> I do not know why you'd need to call gcref on a global variable |
21:28:55 | FromDiscord | <Ayy Lmao> They get collected otherwise |
21:29:14 | FromDiscord | <Elegantbeef> Ok so why do they get collected? |
21:29:31 | FromDiscord | <Ayy Lmao> I guess nim thinks the program has ended, but it has not. |
21:29:46 | FromDiscord | <Ayy Lmao> Maybe I can try to get together a minimal example |
21:38:20 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x7C |
21:40:43 | * | rockcavera joined #nim |
21:41:18 | FromDiscord | <guttural666> how would I pass a slice of a seq of Tokens to a generator to generate fixed code? do I need openArray for that? |
21:42:33 | FromDiscord | <Ayy Lmao> In reply to @guttural666 "how would I pass": .toOpenArray() maybe? |
21:42:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4x7D |
21:43:00 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x7E |
21:45:28 | FromDiscord | <guttural666> In reply to @Ayy Lmao ".toOpenArray() maybe?": pseudocode: pass the recently added tokens to the generator as a reading pointer into the seq, gimme the generated code that you fixed https://media.discordapp.net/attachments/371759389889003532/1113221664528941066/image.png |
21:46:02 | FromDiscord | <guttural666> don't even know if the "unclosed" .. just defaults to .high |
21:46:17 | FromDiscord | <Elegantbeef> `..` is invalid |
21:46:31 | FromDiscord | <Elegantbeef> Nim doesnt have postfix |
21:48:08 | FromDiscord | <guttural666> does the [start..end] actually produce a slice (not copy)? if that is correct, how do I type it on the receiving end of fix()? |
21:48:20 | FromDiscord | <guttural666> pretty sure I need openArray here |
21:48:24 | FromDiscord | <Ayy Lmao> .toOpenArray(start, end) i think |
21:48:33 | FromDiscord | <Elegantbeef> you need openArray for a non allocating slice |
21:48:40 | FromDiscord | <guttural666> excellent |
21:49:35 | FromDiscord | <Elegantbeef> Wait i'm wrong ayy misread the proc def |
21:49:47 | FromDiscord | <Ayy Lmao> So beef, `emscripten_request_animation_frame_loop` returns void so what you said doesn't work, however there is `emscripten_request_animation_frame` which does return an EM_BOOL. The thing is, you can't put it in a while loop because it blocks the program from running. |
21:49:54 | FromDiscord | <Ayy Lmao> Also the ref gets collected regardless. |
21:50:11 | FromDiscord | <Elegantbeef> Well what's happening is you're calling emscripten code and then the program terminates |
21:50:21 | FromDiscord | <Ayy Lmao> Yeah |
21:50:26 | FromDiscord | <Elegantbeef> We need to stop that terminating so there has to be a way to block/poll |
21:50:26 | FromDiscord | <Ayy Lmao> So is GcRef the answer to that? |
21:50:40 | FromDiscord | <Ayy Lmao> I haven't found a way to block and poll the program |
21:50:42 | FromDiscord | <Elegantbeef> No cause the program terminates and deallocates globals regardless of ref count |
21:51:19 | FromDiscord | <Ayy Lmao> GcRef actually seems to work but it has very sinister bugs. |
21:51:47 | FromDiscord | <Ayy Lmao> Getting it to behave like a normal nim program on desktop would be ideal. |
21:53:41 | FromDiscord | <Ayy Lmao> `emscripten_set_main_loop` might be what I'm looking for. |
21:55:48 | FromDiscord | <Elegantbeef> Given that this is for web dev I do not imagine there is a way to block |
21:55:49 | FromDiscord | <Elegantbeef> Are you using devel? |
21:55:50 | FromDiscord | <Elegantbeef> If not do try that |
21:57:19 | FromDiscord | <Ayy Lmao> I am using 1.6.12 but I'll try that if I can't figure this out. |
21:59:35 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4x7G |
22:04:00 | FromDiscord | <guttural666> I see myself alternating between this: lex.read_token() and reset_lexer(lex) quite a lot and I would kinda prefer if the language forced me to do either, what do you guys think? |
22:04:39 | FromDiscord | <Elegantbeef> Nope |
22:05:22 | FromDiscord | <guttural666> elegeant likes his freedom 😛 |
22:05:30 | FromDiscord | <guttural666> (edit) "elegeant" => "elegant" |
22:05:38 | FromDiscord | <Ayy Lmao> I prefer lex.read_token() style. |
22:05:47 | FromDiscord | <Ayy Lmao> Honestly depends though |
22:06:08 | FromDiscord | <guttural666> echo pls is the best though |
22:06:27 | FromDiscord | <guttural666> would keep that and just force fix(lex) 😄 |
22:06:30 | FromDiscord | <Graveflo> In reply to @guttural666 "I see myself alternating": I think thats one of those things that either grows into habit or stops seeming disjointed. I've gotten used to it in a couple of weeks |
22:07:27 | * | progranner joined #nim |
22:08:20 | FromDiscord | <guttural666> just think the more ambivalence there is in the language the worse, but also like some uses of that uniform function call syntax |
22:08:50 | FromDiscord | <guttural666> sometimes it's just a lot of noise for the eye |
22:09:01 | FromDiscord | <Ayy Lmao> `emscripten_set_main_loop` seems to be the ticket Beef. There is an argument that simulates an infinite loop and that seems to stop Nim from collecting the globals. |
22:09:09 | FromDiscord | <Graveflo> I don't think I'll ever grow to like the style insensitivity though |
22:10:14 | FromDiscord | <Ayy Lmao> I have a strong preference for camel case so I hate when I have to use snake case. I like the style insensitivity for that but it can cause problems. |
22:10:18 | FromDiscord | <Elegantbeef> I find it literally doesnt matter |
22:10:51 | FromDiscord | <guttural666> In reply to @Elegantbeef "I find it literally": it matters to your reading speed even if you think it doesn't |
22:11:58 | FromDiscord | <Graveflo> I've never had it bother me yet and since other people like it I don't really have a problem with it. Just the idea of it makes me anxious bc I think I'm going to shadow something. Coming from primarily working in python, shadowing is way more of an issue over there |
22:12:04 | FromDiscord | <guttural666> In reply to @Ayy Lmao "I have a strong": I'll stick to snake with my own stuff and just respect stdlib's style |
22:13:13 | FromDiscord | <Ayy Lmao> The only time I've had it bite me is when you are binding C code that has something like FOO and Foo and they are different things. |
22:13:24 | FromDiscord | <guttural666> I see myself using either depending on the readability of the whole thing, kinda hate it and love it at the same time |
22:14:50 | FromDiscord | <guttural666> if the thing is an important thing that does important stuff I will use thing.do() if the thing is not that important for control flow, I will use strip(string) |
22:15:01 | NimEventer | New thread by dwhall256: Why does this operator overload fail?, see https://forum.nim-lang.org/t/10236 |
22:30:45 | * | om3ga quit (Quit: Bye) |
22:30:56 | * | om3ga joined #nim |
22:42:35 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
23:14:19 | * | jmdaemon joined #nim |
23:58:34 | FromDiscord | <Ayy Lmao> What parts of emscripten are portable outside the browser? Like I'm guessing if I execute javascript it doesn't work outside the browser right? |
23:59:33 | FromDiscord | <Elegantbeef> I mean it's fine if you mirror the API in your native runtime |