00:00:48 | FromDiscord | <Elegantbeef> Cause... echo supports it |
00:01:10 | FromDiscord | <Elegantbeef> `echo "hello", " world", 100, 300, (10, 20)` is valid |
00:13:31 | * | lucasta joined #nim |
00:13:49 | * | derpydoo joined #nim |
01:03:07 | FromDiscord | <voidwalker> https://nim-lang.org/docs/sequtils.html#maxIndex%2CopenArray%5BT%5D |
01:03:31 | FromDiscord | <voidwalker> wouldn't it be normal to also have a maxIndexes func that returns a list of all indexes where the maximum is ? |
01:05:44 | * | krux02 quit (Remote host closed the connection) |
01:05:57 | FromDiscord | <morgan> In reply to @louis77 "Or anyone tried Tabnine": i disabled tabnine for nim. it always made bad suggestions on creating new procs, it did not understand the =, and i don’t remember the rest of it being that much better. i just use vscode’s completions |
01:06:18 | FromDiscord | <morgan> or rather, added nim to tabnine’s list of languages to ignore |
01:06:28 | FromDiscord | <morgan> it wasn’t even a suggestion in the list |
01:26:59 | FromDiscord | <Elegantbeef> "prs welcome"↵(@voidwalker) |
02:26:44 | * | azimut quit (Ping timeout: 255 seconds) |
02:30:20 | FromDiscord | <System64 ~ Flandre Scarlet> Can't arrays be considered as OpenArray? https://media.discordapp.net/attachments/371759389889003532/1099160230522277928/image.png |
02:30:26 | FromDiscord | <michaelb.eth> once I sorted out projectMapping for one of my repos, such that nimlangserver + Emacs lsp-mode are working properly, wow, such a big quality of life improvement |
02:30:56 | FromDiscord | <michaelb.eth> random, I know, just feeling very happy about nimlangserver |
02:31:09 | FromDiscord | <Rika> In reply to @System64 "Can't arrays be considered": They are, but T isn’t Pixel |
02:31:14 | FromDiscord | <Rika> It has to be |
02:31:34 | FromDiscord | <Rika> (edit) "In reply to @System64 "Can't arrays be considered": They are, but ... T" added "your" |
02:31:46 | FromDiscord | <System64 ~ Flandre Scarlet> Oh god wtf??↵So I can't send raw data of bytes?? |
02:31:57 | FromDiscord | <Rika> I don’t know |
02:32:07 | FromDiscord | <Rika> I don’t know how that library works |
02:41:24 | FromDiscord | <System64 ~ Flandre Scarlet> I try to cast it, but seems it doesn't work https://media.discordapp.net/attachments/371759389889003532/1099163013140979742/image.png |
02:41:42 | FromDiscord | <Elegantbeef> ptr |
02:43:01 | FromDiscord | <System64 ~ Flandre Scarlet> Still not happy with that https://media.discordapp.net/attachments/371759389889003532/1099163420667953163/image.png |
02:48:08 | FromDiscord | <that_dude> wouldn't you need to deref post cast? |
02:48:31 | FromDiscord | <Yardanico> In reply to @System64 "Still not happy with": show the compile error |
02:48:34 | FromDiscord | <Yardanico> it will tell what argument is not the same |
02:48:51 | FromDiscord | <Yardanico> ah nvm that proc just doesn't have an overload for that |
02:48:58 | FromDiscord | <Yardanico> you don't need to have a cast here at all |
02:48:59 | FromDiscord | <faldor20> sent a code paste, see https://play.nim-lang.org/#ix=4tYv |
02:49:10 | FromDiscord | <that_dude> you mean the mapit function? |
02:49:15 | FromDiscord | <Yardanico> In reply to @faldor20 "Hey does nim have": no, but you can use collect or write your own |
02:49:20 | FromDiscord | <Yardanico> In reply to @that_dude "you mean the mapit": they mean map with index |
02:49:29 | FromDiscord | <that_dude> ah like an enumerate |
02:49:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "you don't need to": Ah alright, so what should I do? |
02:50:06 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tYw |
02:50:15 | FromDiscord | <Yardanico> In reply to @System64 "Ah alright, so what": what type is tex? |
02:50:38 | FromDiscord | <faldor20> sent a code paste, see https://play.nim-lang.org/#ix=4tYx |
02:50:43 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "what type is tex?": array of bytes, raw pixel data |
02:51:26 | FromDiscord | <Yardanico> wait, that proc expects a container of pixels, does each pixel = 1 element in your array? |
02:51:44 | FromDiscord | <System64 ~ Flandre Scarlet> no idea at all :/ |
02:51:58 | FromDiscord | <Yardanico> found the proc you're using https://media.discordapp.net/attachments/371759389889003532/1099165671868354560/image.png |
02:51:59 | FromDiscord | <Yardanico> lets see |
02:52:48 | FromDiscord | <System64 ~ Flandre Scarlet> concept↵What is this?? https://media.discordapp.net/attachments/371759389889003532/1099165882548228096/image.png |
02:53:22 | FromDiscord | <that_dude> https://nim-lang.org/docs/manual_experimental.html#concepts for the manual |
02:53:25 | FromDiscord | <Yardanico> it just describes that any type that has a `kind` proc that returns a PixelFormat can be a Pixel |
02:53:40 | FromDiscord | <Yardanico> it's for better generic programming |
02:54:15 | FromDiscord | <Yardanico> I think you should either use the low-level raylib function directly, or write code that satisfies naylib |
02:54:30 | FromDiscord | <Yardanico> have you checked the examples in naylib? |
02:54:40 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1099166348942250004/image.png |
02:54:41 | FromDiscord | <that_dude> As long as the input type matches the concept conditions, ie have the outlined procs and conditions it can be used in there |
02:54:53 | FromDiscord | <System64 ~ Flandre Scarlet> Oh wait↵Isn't it like interfaces in Java or something? |
02:55:03 | FromDiscord | <that_dude> (edit) "in there" => "as a working "type"" |
02:55:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "": Yeah I want to do something like that |
02:55:06 | FromDiscord | <Yardanico> a bit, but concepts are compile-time only, you can't have a sequence of them for example |
02:55:16 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
02:55:26 | FromDiscord | <Yardanico> for runtime concepts = interfaces there's <https://github.com/yglukhov/iface> |
02:56:17 | FromDiscord | <Yardanico> In reply to @System64 "Oh alright": reading naylib examples, i think you're supposed to be using naylib for loading the image too |
02:56:40 | FromDiscord | <Yardanico> with `loadImage` |
02:56:58 | FromDiscord | <Yardanico> basically see <https://github.com/planetis-m/raylib-examples/blob/main/textures/image_processing.nim> |
02:57:04 | FromDiscord | <System64 ~ Flandre Scarlet> The thing is another lib generates a framebuffer |
02:58:17 | FromDiscord | <Yardanico> then you have to convert it to a raylib image |
02:58:34 | FromDiscord | <System64 ~ Flandre Scarlet> But this framebuffer is updated each frame |
02:58:36 | FromDiscord | <Yardanico> have you seen this? https://media.discordapp.net/attachments/371759389889003532/1099167339943055380/image.png |
02:59:46 | FromDiscord | <Yardanico> this uses raylib's LoadImageFromMemory |
02:59:56 | FromDiscord | <System64 ~ Flandre Scarlet> It works if the picture is PNG, JPG and stuff like that↵But not from raw pixel data |
03:29:10 | * | lucasta quit (Ping timeout: 250 seconds) |
03:33:12 | FromDiscord | <Elegantbeef> There are `FromPriv` procedures but not exported |
03:34:06 | FromDiscord | <Elegantbeef> Whoops i mean `loadImageRaw` |
03:38:48 | FromDiscord | <Yardanico> beef, that won't work either |
03:38:52 | FromDiscord | <Yardanico> since loadImageRaw loads from a file |
03:38:55 | FromDiscord | <Yardanico> not from a buffer |
03:39:44 | FromDiscord | <Elegantbeef> Odd |
03:40:56 | FromDiscord | <Yardanico> but yeah, the probable way here is to just cast your own image to raylib's image and then copy it so raylib owns the data |
03:41:12 | FromDiscord | <Yardanico> copy because otherwise you'd have to manage the memory of the buffer for the whole program life |
03:41:17 | FromDiscord | <Yardanico> raylib does have `ImageCopy` |
03:58:15 | * | TakinOver joined #nim |
05:45:46 | * | cm_ joined #nim |
05:45:59 | * | cm quit (Quit: Bye.) |
05:46:02 | * | cm_ is now known as cm |
05:53:04 | * | GreaseMonkey quit (Quit: No Ping reply in 180 seconds.) |
05:54:51 | * | greaser|q joined #nim |
05:56:22 | * | greaser|q quit (Changing host) |
05:56:22 | * | greaser|q joined #nim |
05:56:24 | * | greaser|q is now known as GreaseMonkey |
06:05:30 | NimEventer | New thread by Luethlee: Why nim discord library is slower than python's discord library?, see https://forum.nim-lang.org/t/10119 |
06:26:00 | * | Notxor joined #nim |
07:12:25 | * | Notxor quit (Remote host closed the connection) |
07:20:05 | * | cm quit (Ping timeout: 240 seconds) |
07:22:37 | * | cm joined #nim |
07:35:02 | FromDiscord | <Michal Maršálek> Hi, I created a forum post on CodinGame suggesting adding Nim to that site. I think it could be a good advertisement for Nim and some people might learn (about) Nim that way. It would be great if you could express your support: https://www.codingame.com/forum/t/nim-language-on-codingame/200375 |
08:01:05 | * | derpydoo quit (Ping timeout: 240 seconds) |
08:01:54 | * | azimut joined #nim |
08:17:55 | FromDiscord | <Yardanico> I mean, those platforms are commercial so they're not very likely to add support for niche languages |
08:18:06 | FromDiscord | <Yardanico> I think only a few platforms like this support Nim |
08:19:37 | FromDiscord | <Yardanico> I wonder if these platforms could benefit from wasm |
08:20:39 | FromDiscord | <Yardanico> I mean if all they do is check the output, then supporting wasm is a no brainer, just do it |
10:08:45 | NimEventer | New thread by noah: How to set hint/warningAsError switches in config.nims?, see https://forum.nim-lang.org/t/10121 |
10:08:58 | FromDiscord | <Yardanico> Another interesting thread (missed): https://forum.nim-lang.org/t/10120 |
10:09:03 | FromDiscord | <Yardanico> (edit) "(missed):" => "(missed by bot):" |
10:36:50 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4tZC |
10:36:53 | FromDiscord | <Z3NTL3> however when i read the docs, i dont see what ive done wrong |
10:41:03 | FromDiscord | <Z3NTL3> and also what i dont understand is how , startProcess returns a string from what i see in the ss but how can a string have a method https://media.discordapp.net/attachments/371759389889003532/1099283718633439282/image.png |
10:41:32 | FromDiscord | <Z3NTL3> btw everything works till that var outp section |
10:41:54 | FromDiscord | <Z3NTL3> (edit) "how ," => "that" |
10:42:09 | FromDiscord | <Z3NTL3> it makes me confused can someone help and explain |
10:47:16 | FromDiscord | <planetis> Guys, just ping me. |
10:47:23 | FromDiscord | <planetis> See the example https://github.com/planetis-m/raylib-examples/blob/main/textures/raw_data.nim |
10:47:53 | FromDiscord | <Yardanico> In reply to @planetis "Guys, just ping me.": the point is that this example doesn't help ;) |
10:48:03 | FromDiscord | <Yardanico> they wanted to load an image that they have raw pixels of in memory, not in a file |
10:48:06 | FromDiscord | <Yardanico> raylib offers no such function |
10:48:13 | FromDiscord | <Yardanico> loadImageRaw is only for files |
10:49:06 | FromDiscord | <planetis> Yes it does. loadTextureFromData the Pixel concept let's you define the format of the raw data |
10:49:58 | FromDiscord | <planetis> So for type Color it's https://github.com/planetis-m/naylib/blob/main/src/raylib.nim#L1946 UncompressedR8g8b8a8 |
10:50:30 | FromDiscord | <Z3NTL3> In reply to @Z3NTL3 "and also what i": can someone explain i am so confused |
10:51:33 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "and also what i": wdym by a method? |
10:52:13 | FromDiscord | <Yardanico> wait, why are you calling the `impl` and not just normal write |
10:52:24 | FromDiscord | <Z3NTL3> In reply to @Z3NTL3 "and also what i": look in the code above i used startProcess in ``taak`` var but the taak var ``.inputStream`` can be executed without any problem, but the docs said it returns a string, so how can that work? |
10:52:27 | FromDiscord | <Yardanico> also addr(yes) is wrong, you need addr yes[0] |
10:52:41 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "look in the code": because startProcess and execProcess are different procedures |
10:52:45 | FromDiscord | <Yardanico> evident by the name |
10:52:49 | FromDiscord | <planetis> In reply to @planetis "So for type Color": If you need a different interface just copy what that function does, loadTextureFromImage is public |
10:53:00 | FromDiscord | <Yardanico> @Z3NTL3 do you just want random exe files or just python? |
10:53:11 | FromDiscord | <Yardanico> in the latter case you can just use https://github.com/yglukhov/nimpy |
10:53:15 | FromDiscord | <Z3NTL3> i want to run a python script |
10:53:21 | FromDiscord | <Yardanico> yeah, so just use nimpy :) |
10:53:43 | FromDiscord | <Yardanico> and as for a python script - you can just edit it so that it takes input as an cli argument instead of stdin |
10:53:49 | FromDiscord | <Yardanico> so then you don't have to deal with writing to input stream |
10:53:51 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4tZG |
10:54:02 | FromDiscord | <Z3NTL3> im new into Nim and it looks very confusing the docs etc |
10:54:53 | FromDiscord | <Z3NTL3> In reply to @Z3NTL3 "and also what i": I see from the docs for example here, that this proc returns a string but its not a string bcs i can implement method calls on it. And the docs never say something about that |
10:54:58 | FromDiscord | <Z3NTL3> i get so lost in the dirty dust |
10:55:14 | FromDiscord | <Z3NTL3> I ve worked in Go, Typescript etc and it looks so confusing, just why 😄 |
10:55:56 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "I see from the": again |
10:56:01 | FromDiscord | <Yardanico> you're looking at two different procs |
10:56:07 | FromDiscord | <Yardanico> startProcess and execProcess are different ones |
10:56:11 | FromDiscord | <Yardanico> one returns a string, the other returns a process |
10:56:36 | FromDiscord | <Z3NTL3> startProcess returns a string, but how does the ``taak.inputStream()`` work? |
10:56:45 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "startProcess returns a string,": it doesn't return a string, please read what I said again |
10:56:48 | FromDiscord | <Z3NTL3> i get no error on that |
10:56:56 | FromDiscord | <Z3NTL3> In reply to @Yardanico "it doesn't return a": if it doesnt why the docs say it does |
10:57:04 | FromDiscord | <Z3NTL3> For me as reader i get so confused |
10:57:16 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "if it doesnt why": please read again, you're reading docs for a different procedure |
10:57:18 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1099287809816264704/image.png |
10:57:27 | FromDiscord | <Yardanico> it returns owned(Process), discard the `owned` part, you just see that it returns `Process` |
10:57:39 | FromDiscord | <Z3NTL3> pjj |
10:57:39 | FromDiscord | <Yardanico> execProcess returns a string, but that's a different proc https://media.discordapp.net/attachments/371759389889003532/1099287898437722194/image.png |
10:57:43 | FromDiscord | <Z3NTL3> ohh |
10:57:46 | FromDiscord | <Z3NTL3> i looked at execProcess |
10:57:51 | FromDiscord | <Z3NTL3> bruh |
10:57:53 | FromDiscord | <Yardanico> yes, but you're calling startProcess |
10:58:08 | FromDiscord | <Yardanico> but anyway, you can actually have "methods" attached to any type in Nim since Nim has UFCS |
10:58:14 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
10:58:21 | FromDiscord | <Yardanico> but that's not related to this question |
10:58:49 | FromDiscord | <Yardanico> @Z3NTL3 working example: |
10:58:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tZH |
10:59:20 | FromDiscord | <Yardanico> Process' input and output streams are actually the Stream type, and to do high-level stuff on them you need to import std/streams |
10:59:23 | FromDiscord | <Z3NTL3> and where can i see the docs for what the Process exactly is i only see ref ProcessObj https://media.discordapp.net/attachments/371759389889003532/1099288335324807228/image.png |
10:59:28 | FromDiscord | <Z3NTL3> im new into nim so i really dunno |
10:59:35 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "and where can i": you'll find ProcessObj directly below |
10:59:47 | FromDiscord | <Yardanico> ah i see, it's not exported here |
10:59:50 | FromDiscord | <Z3NTL3> i see only enum values |
11:00:01 | FromDiscord | <Yardanico> yes, in this case you don't need to know any of the fields |
11:00:11 | FromDiscord | <Yardanico> all the procs you can call on a Process are documented in the file |
11:00:19 | FromDiscord | <Yardanico> https://nim-lang.org/docs/osproc.html#inputStream%2CProcess |
11:00:24 | FromDiscord | <Yardanico> https://nim-lang.org/docs/osproc.html#outputStream%2CProcess |
11:00:57 | FromDiscord | <Z3NTL3> oke ty bro |
11:00:57 | FromDiscord | <Yardanico> ah right, in my working example I forgot to add `taak.close()` which is needed to close all handles when the process is done executing |
11:00:58 | FromDiscord | <Z3NTL3> i was so lost |
11:01:12 | FromDiscord | <Yardanico> if that python script isn't big you could just rewrite it in NIm |
11:01:14 | FromDiscord | <Yardanico> (edit) "NIm" => "Nim" |
11:01:48 | FromDiscord | <Z3NTL3> im not doing something for release just a exercise for me self to learn Nim so nothing important |
11:01:50 | FromDiscord | <Z3NTL3> https://media.discordapp.net/attachments/371759389889003532/1099288949287030865/image.png |
11:01:53 | FromDiscord | <Z3NTL3> and one more question |
11:01:56 | FromDiscord | <Z3NTL3> what does this star mean |
11:01:59 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "im not doing something": well that doesn't seem like a good starting place :) |
11:02:09 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "what does this star": it means that the symbol (proc/field/etc) is exported |
11:02:15 | FromDiscord | <Z3NTL3> ohh okey |
11:02:16 | FromDiscord | <Yardanico> again, you don't need to look at StreamObj |
11:02:27 | FromDiscord | <Yardanico> those procs are low-level, you call high-level ones that are documented in the module itself and are shown in examples |
11:02:38 | FromDiscord | <Yardanico> https://nim-lang.org/docs/streams.html#write%2CStream%2Cstring |
11:02:39 | FromDiscord | <Z3NTL3> and what i see here right is a way of "OOP" in Nim right? https://media.discordapp.net/attachments/371759389889003532/1099289157681025134/image.png |
11:03:00 | FromDiscord | <Z3NTL3> it represents this right? https://media.discordapp.net/attachments/371759389889003532/1099289246055022592/image.png |
11:03:11 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "and what i see": Nim has real methods with inheritance, this here is just a way of implementing interfaces with tuples |
11:03:16 | FromDiscord | <Yardanico> i mean procs in object |
11:03:25 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "it represents this right?": no, it's just a field in an object where you assign a procedure |
11:03:36 | FromDiscord | <Yardanico> so you can inherit from a Stream and override those procs with your own that are fit for your type |
11:03:42 | FromDiscord | <Yardanico> so then all the default stream procs also work on your stream type |
11:04:11 | FromDiscord | <Yardanico> learning like this might be a little too weird, it's better to read the docs on the basics of the language first :) |
11:04:28 | FromDiscord | <Z3NTL3> yea i read for most of part 1 but not complete |
11:04:34 | FromDiscord | <Yardanico> is <https://github.com/Z3NTL3/CloudflareIPTables/blob/main/cf.py> the script you're trying to run in nim? |
11:04:41 | FromDiscord | <Yardanico> it's quite easy to rewrite in nim |
11:04:41 | FromDiscord | <Z3NTL3> no |
11:04:44 | FromDiscord | <Yardanico> oh okay |
11:04:48 | FromDiscord | <Z3NTL3> https://media.discordapp.net/attachments/371759389889003532/1099289700142948393/image.png |
11:04:51 | FromDiscord | <Z3NTL3> i was just testing |
11:04:54 | FromDiscord | <Yardanico> okay |
11:04:55 | FromDiscord | <Z3NTL3> to write to stdin |
11:05:03 | FromDiscord | <Z3NTL3> (edit) "to write to ... stdinof" added "the" | "thestdin ... " added "of a spawned process" |
11:11:34 | FromDiscord | <Z3NTL3> @Yardanico yo the code u send did exit before writing to the stdin of the process |
11:11:43 | FromDiscord | <Z3NTL3> it had to print > y https://media.discordapp.net/attachments/371759389889003532/1099291437889232936/image.png |
11:11:52 | FromDiscord | <Z3NTL3> but the code looks fine so idk why |
11:13:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tZK |
11:13:30 | FromDiscord | <Z3NTL3> ye that worked |
11:13:57 | FromDiscord | <Z3NTL3> everytime you loop over readline the buffer get more and more reduced in N size of the read value right |
11:14:20 | FromDiscord | <Z3NTL3> (edit) "everytime you loop over readline the buffer get more and more reduced in N size of the read value right ... " added "compared to the X size of the buffer until 0" |
11:14:21 | FromDiscord | <Yardanico> no, this is reading by line |
11:14:32 | FromDiscord | <Z3NTL3> k |
11:19:51 | FromDiscord | <Z3NTL3> can u explain one more thing |
11:19:52 | FromDiscord | <Z3NTL3> https://media.discordapp.net/attachments/371759389889003532/1099293492007673856/image.png |
11:21:01 | FromDiscord | <Yardanico> this proc is overloaded |
11:21:04 | FromDiscord | <Yardanico> you're looking at the wrong overload |
11:21:09 | FromDiscord | <Z3NTL3> i see here the proc requires a stream as argument↵↵but we did directly do outp.readLine(), how is that even possible? It said we had to give the stream as argment so readLine(taak) |
11:21:14 | FromDiscord | <Z3NTL3> (edit) "readLine(taak)" => "readLine(outp)" |
11:21:16 | FromDiscord | <Yardanico> the one I'm calling is the one with two arguments - the stream and line |
11:21:38 | FromDiscord | <Yardanico> nim is quite different from go, nim has overloading and ufcs |
11:21:44 | FromDiscord | <Yardanico> https://nim-lang.org/docs/streams.html#readLine%2CStream%2Cstring i used this overload |
11:21:49 | FromDiscord | <Yardanico> and regarding ufcs see https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
11:22:00 | FromDiscord | <Yardanico> basically, in Nim `a.b()` is usually 100% the same as `b(a)` |
11:22:04 | FromDiscord | <Yardanico> even for all the default types |
11:22:16 | FromDiscord | <Yardanico> so you're not forced to use methods/classes just to get the nice dot call syntax |
11:22:34 | FromDiscord | <Michal Maršálek> In reply to @Yardanico "I mean, those platforms": Sure but if they did that, it would be nice. The thread was merged with a general poll about languages to add and Nim doesn't look that bad in that poll. |
11:22:50 | FromDiscord | <Yardanico> so `outp.readLine(line)` is the same as `readLine(outp, line)` |
11:23:05 | FromDiscord | <Z3NTL3> so ur using this but the stream arg is empty?. https://media.discordapp.net/attachments/371759389889003532/1099294294860365874/image.png |
11:23:07 | FromDiscord | <Yardanico> In reply to @Michal58 "Sure but if they": yeah replit added nim because of a similar poll too, although nowadays their version is outdated and there's a community template for the newest nim |
11:23:13 | FromDiscord | <Yardanico> In reply to @Z3NTL3 "so ur using this": please read what I said above |
11:23:27 | FromDiscord | <Z3NTL3> k |
11:23:53 | FromDiscord | <Z3NTL3> Ohhh |
11:23:54 | FromDiscord | <Z3NTL3> thnx |
11:23:56 | FromDiscord | <Z3NTL3> now i get to understand it |
11:24:07 | FromDiscord | <Z3NTL3> at first i was like "whatte f" |
11:29:56 | FromDiscord | <Z3NTL3> sent a code paste, see https://paste.rs/8eM |
11:30:23 | FromDiscord | <Z3NTL3> (edit) "https://paste.rs/98Q" => "https://play.nim-lang.org/#ix=4tZL" |
11:30:31 | FromDiscord | <Z3NTL3> (edit) "https://play.nim-lang.org/#ix=4tZL" => "https://play.nim-lang.org/#ix=4tZN" |
11:30:43 | FromDiscord | <Z3NTL3> and why is that |
11:40:18 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4tZP |
11:59:54 | FromDiscord | <xTrayambak> ha, what happened to nimble? https://media.discordapp.net/attachments/371759389889003532/1099303564859428955/image.png |
12:00:09 | FromDiscord | <xTrayambak> (edit) "nimble?" => "nimble's directory?" |
12:35:44 | * | beholders_eye joined #nim |
12:51:32 | FromDiscord | <Weldify> how do i depend on a specific branch of a nimble package? i need to depend on the `windows` branch of naylib |
12:51:56 | FromDiscord | <Weldify> tried doing `requires "naylib#windows >= 4.5.1"` but it doesnt seem to work |
12:52:30 | FromDiscord | <Yardanico> try naylib@windows |
12:52:33 | FromDiscord | <Yardanico> but not sure |
12:53:17 | FromDiscord | <Weldify> oh whoops, it appears like i got the version wrong, the versioning for the windows branch is inconsistent |
12:55:05 | FromDiscord | <Z3NTL3> In reply to @xTrayambak "ha, what happened to": noo nginx, yes to caddyserver ⚡ |
12:57:47 | NimEventer | New thread by tcheran: EU Cyber Resilience Act impact on Open Source community, see https://forum.nim-lang.org/t/10123 |
12:59:40 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u00 |
13:00:00 | FromDiscord | <Z3NTL3> (edit) "https://play.nim-lang.org/#ix=4u00" => "https://play.nim-lang.org/#ix=4u01" |
13:00:10 | FromDiscord | <Z3NTL3> (edit) "https://play.nim-lang.org/#ix=4u01" => "https://paste.rs/6YO" |
13:00:16 | FromDiscord | <Z3NTL3> sent a code paste, see https://paste.rs/hDd |
13:02:02 | * | jmdaemon quit (Ping timeout: 250 seconds) |
13:02:13 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u02 |
13:03:38 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u03 |
13:03:58 | FromDiscord | <Z3NTL3> big bruh |
13:04:26 | FromDiscord | <Z3NTL3> (edit) "big bruh ... " added "sometimes i dont read good enough or skip parts of reading" |
13:06:00 | FromDiscord | <Rika> You’ll get used to reading well |
13:06:13 | FromDiscord | <Rika> In reply to @Z3NTL3 "noo nginx, yes to": Still kinda sucks needing to recompile for a plug-in though |
13:41:16 | NimEventer | New Nimble package! niscv - Nim powered RISC-V virtual machine and emulator., see https://gitlab.com/OFThomas/niscv |
13:43:21 | * | fredrik92 joined #nim |
13:44:02 | * | fredrikhr quit (Killed (NickServ (GHOST command used by [email protected]))) |
13:44:08 | * | fredrik92 is now known as fredrikhr |
13:44:27 | * | fredrikhr92 joined #nim |
13:54:34 | * | PMunch joined #nim |
14:10:18 | FromDiscord | <Rika> nice |
14:57:10 | FromDiscord | <Dimi> Hi All!↵When we parse json to the object, how we flagging some of the attributes as non-mandatory?↵In Go-lang there's `json:omitempty` directive in struct. Do we have something similar in Nim? |
14:57:22 | FromDiscord | <Dimi> (edit) "Hi All!↵When we parse json to the object, how we ... flagging" added "are" |
14:58:05 | FromDiscord | <Yardanico> not in the stdlib, you can use jsony |
14:58:09 | FromDiscord | <Yardanico> <https://github.com/treeform/jsony> |
14:58:22 | FromDiscord | <Dimi> Awesome! Thanks! |
14:59:00 | FromDiscord | <Dimi> I was using std and faced with this behavior |
15:07:48 | * | arkurious joined #nim |
15:12:20 | FromDiscord | <deech> Is there any way to make `--expandArc` more fine grained, as it stands outside of toy examples it's difficult to actually use in larger projects. Here's couple of use cases I'd like if possible, just two of many:↵- pass a qualified name `--expandArc=foo.bar`↵- pass a specific overload `--expandArc=foo.bar[T](x:T):string` |
15:13:15 | FromDiscord | <Yardanico> not that I know of, expandArc is really quite basic |
15:13:39 | FromDiscord | <Yardanico> your only choice is to rename procs so that they're unique |
15:15:32 | FromDiscord | <deech> That is disappointing. |
15:16:47 | FromDiscord | <deech> (edit) "That is disappointing. ... " added "Design time decisions like overloading turn into debugging nightmares." |
15:50:51 | PMunch | Doesn't the stdlib json parser support Option? |
15:51:08 | FromDiscord | <Yardanico> ah right, it does |
15:51:12 | FromDiscord | <Yardanico> @Dimi you can use options too yeah |
16:20:41 | * | lucasta joined #nim |
16:37:07 | FromDiscord | <demetera> In reply to @Yardanico "<@743921751477584033> you can use": @Yardanico thanks! I'm not sure I'm able to grasp endless features of the options package at the moment. Thanks for the brain food |
16:41:54 | PMunch | Not sure I'd call them endless :P |
16:42:00 | PMunch | But sure, Options are neat |
17:04:23 | PMunch | Documentation like this can fuck right off: gtk_print_settings_set_output_bin, Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN. |
17:04:36 | PMunch | Thank you, that told me exactly nothing I didn't already know |
17:04:46 | PMunch | WHAT IS OUTPUT BIN?! |
17:08:43 | PMunch | Seriously, could they write anything that would be less useful? https://docs.gtk.org/gtk3/const.PRINT_SETTINGS_OUTPUT_BIN.html |
17:31:51 | FromDiscord | <firasuke> I am new to Nim, but so far I am enjoying it! I am writing a package manager for some custom Linux distribution, this file is responsible for downloading and verifying packages:↵https://github.com/glaucuslinux/radula/blob/main/src/envenomate.nim↵↵I feel like I can do much better than this, but I need some guidance and some criticism. |
17:34:47 | * | Notxor joined #nim |
17:36:41 | FromDiscord | <demetera> In reply to @firasuke "I am new to": Is your app working good? There are lot of blank lines in the source code too |
17:36:45 | FromDiscord | <Yardanico> In reply to @firasuke "I am new to": use `ceras{"url"}.getStr()` https://media.discordapp.net/attachments/371759389889003532/1099388334800912474/image.png |
17:37:00 | FromDiscord | <Yardanico> for all cases like this, with {} it will not error if there's no such key, and getStr returns an empty string if it's JNull |
17:49:21 | FromDiscord | <firasuke> In reply to @Dimi "Is your app working": yup |
17:49:39 | FromDiscord | <firasuke> it is working as intended |
17:49:46 | FromDiscord | <firasuke> In reply to @Yardanico "use `ceras{"url"}.getStr()`": oh cool, thanks |
17:50:31 | FromDiscord | <firasuke> In reply to @Dimi "Is your app working": are blank lines bad? I am using them to separate code based on context |
18:00:29 | FromDiscord | <Rika> personally i dont see the issue with your lines, it just looks emptier than usual because of the indent size |
18:01:01 | FromDiscord | <Sun「無用」> Is there any ways of doing seq(or any collection) unpacking? |
18:01:11 | FromDiscord | <firasuke> In reply to @Rika "personally i dont see": oh ok |
18:01:28 | FromDiscord | <Sun「無用」> (edit) "unpacking?" => "unpacking?↵Like python's `[stuff]`" |
18:01:39 | FromDiscord | <Rika> In reply to @Sun「無用」 "Is there any ways": manually or with a macro; theres a library for that already iirc |
18:01:41 | FromDiscord | <firasuke> I apologize if my code looks like a shell script, this package manager has been written in shell first then ported to Rust and now Nim |
18:02:03 | FromDiscord | <firasuke> and I have to say Nim is by far the most productive I have ever been |
18:02:13 | FromDiscord | <firasuke> hopefully my code is not that bad 😦 |
18:03:00 | FromDiscord | <Rika> with experience and over time you will make the code cleaner and more idiomatic, whether to nims idioms or to your own |
18:03:05 | FromDiscord | <Rika> dont worry too much now |
18:03:16 | PMunch | @firasuke, good to hear that you're finding Nim productive :) But you're not that new are you, I feel like I've seen you around here quite a bit |
18:03:19 | FromDiscord | <Rika> worry when you're not improving it ~~like how im not improving my shit lo~~ |
18:03:34 | FromDiscord | <Rika> In reply to @PMunch "<@248208053952970752>, good to hear": could be that theyre taking their time |
18:03:36 | FromDiscord | <Rika> learning, i mean |
18:04:08 | FromDiscord | <firasuke> In reply to @PMunch "<@248208053952970752>, good to hear": been using Nim for 2 months now, I consider that new xD |
18:04:31 | PMunch | Have you only been around for two months? Huh |
18:04:34 | FromDiscord | <firasuke> In reply to @Rika "could be that theyre": yeah I guess, I like to nitpick which I know may not be a good thing, but that's how I learn mostly |
18:04:40 | FromDiscord | <firasuke> In reply to @PMunch "Have you only been": yup |
18:04:46 | PMunch | By the way, Nim generally uses 2 spaces for indentation :) |
18:04:55 | PMunch | Not that it matters much, just in case you hadn't noticed |
18:05:13 | FromDiscord | <firasuke> oh ok, I did notice recently |
18:05:22 | FromDiscord | <Rika> In reply to @PMunch "Have you only been": same lol time sure feels like it flows different nowadays |
18:05:25 | FromDiscord | <firasuke> nimpretty was bugging me with the length of my constants |
18:05:33 | FromDiscord | <firasuke> so I disabled it |
18:05:44 | FromDiscord | <Rika> nimpretty is just absolute shite |
18:05:54 | PMunch | Wouldn't know, never used it :P |
18:06:13 | FromDiscord | <firasuke> I'm using helix and nimlangserver and the experience feels much better compared to vscode (based opinion) |
18:06:19 | FromDiscord | <firasuke> In reply to @PMunch "Wouldn't know, never used": makes sense xD |
18:06:22 | FromDiscord | <firasuke> so 2 spaces, got it |
18:06:39 | PMunch | You also seem to mix snake_case and camelCase, remember that Nim is style insensitive, so you can use whichever you prefer |
18:06:49 | FromDiscord | <firasuke> In reply to @Yardanico "use `ceras{"url"}.getStr()`": as for this, `nimsuggest` is throwing a `simpleGetOrDefault(ceras, "url") --> 'getOrDefault(ceras, "url")'` |
18:06:57 | FromDiscord | <Yardanico> it shows it in yellow |
18:07:02 | PMunch | e.g. styledEcho could be written styled_echo in your code even if it isn't written like that in the original library |
18:07:07 | FromDiscord | <Yardanico> this is just a hint that it used term-rewriting macros |
18:07:13 | FromDiscord | <firasuke> In reply to @PMunch "You also seem to": yeah I learned this the hard way, I am keeping my stuff in snake case, and Nim's stuff in camelCase |
18:07:28 | FromDiscord | <Yardanico> any reason for that? |
18:07:29 | FromDiscord | <Yardanico> just curious |
18:07:34 | FromDiscord | <firasuke> In reply to @Yardanico "this is just a": oh ok |
18:07:38 | FromDiscord | <Yardanico> all the IDE stuff will still work even with snake_case |
18:07:47 | FromDiscord | <firasuke> what if I wanted to change the default string? to something like "None" instead of an empty string? |
18:07:57 | FromDiscord | <firasuke> In reply to @Yardanico "all the IDE stuff": oh really |
18:08:00 | FromDiscord | <Yardanico> of course? |
18:08:05 | FromDiscord | <Yardanico> nimlangserver still uses nimsuggest |
18:08:15 | FromDiscord | <Yardanico> and nimsuggest uses the compiler as a library |
18:08:26 | FromDiscord | <firasuke> well nimsuggest keeps exiting with errors with nimlsp when using vim/nvim |
18:08:28 | FromDiscord | <Yardanico> so nimsuggest understands everything normal nim does, even stuff like macros |
18:08:34 | FromDiscord | <firasuke> oh ok |
18:08:56 | FromDiscord | <firasuke> In reply to @firasuke "what if I wanted": is this doable using `{}` or I have to use `try` and `except`? |
18:09:15 | FromDiscord | <Yardanico> In reply to @firasuke "is this doable using": again, please don't use try/except |
18:09:19 | FromDiscord | <Yardanico> you can always do things like that without it |
18:09:38 | FromDiscord | <firasuke> In reply to @Yardanico "again, please don't use": oh ok |
18:09:47 | FromDiscord | <Akrone> Hey, I just submitted an issue for nimsuggest snake_case support (https://github.com/nim-lang/Nim/issues/21228#event-8371301720) seems like there is no doc/onboarding, it's a bit hard for me to make my first contribution haha. If anybody is experienced with nimsuggest I'd love to have a call and some insights about it, there is something about `{.async.}` procs I don't really grasp (they do not show on nimsuggest) 😄 |
18:10:03 | FromDiscord | <Yardanico> In reply to @firasuke "oh ok": also, generally you can just use json.to |
18:10:10 | FromDiscord | <Yardanico> since you seem to know your json schemas anyway |
18:10:26 | FromDiscord | <Yardanico> then you get to use Option for free, and all the static type checking |
18:10:30 | FromDiscord | <firasuke> In reply to @Yardanico "also, generally you can": oh I am using toml from parsetoml, is there something better? |
18:10:37 | FromDiscord | <firasuke> In reply to @Yardanico "then you get to": oh cool |
18:10:55 | PMunch | @Yardanico, I feel partially responsible for those try/except default value things :P |
18:11:13 | FromDiscord | <Yardanico> oh you're using toml, i didn't notice, thought it was json |
18:11:46 | FromDiscord | <Yardanico> json.to would look much nicer here really, maybe status' toml serialization supports something similar? although it's pretty dependency-heavy |
18:11:59 | FromDiscord | <Yardanico> also @firasuke just move the parsing of that type to a separate proc where you do it all together |
18:12:25 | FromDiscord | <Yardanico> you seem to be parsing it each time in a lot of places |
18:12:28 | FromDiscord | <firasuke> In reply to @Yardanico "also <@248208053952970752> just move": oh please do tell me more, I write code like I write shell script |
18:12:57 | FromDiscord | <firasuke> In reply to @Yardanico "you seem to be": Well I am parsing in a lot of places, I have a function that parses and returns a tomlValueRef which I then use |
18:13:09 | FromDiscord | <Yardanico> In reply to @firasuke "Well I am parsing": yes, but you can create a proper Nim type for your config |
18:13:19 | FromDiscord | <Yardanico> and parse that toml into that Nim type so then you have a nice nim type to deal with in all the procs |
18:13:25 | FromDiscord | <firasuke> In reply to @Yardanico "yes, but you can": and pass that type then |
18:13:49 | FromDiscord | <firasuke> In reply to @Yardanico "and parse that toml": cool, thanks for suggesting that |
18:14:12 | FromDiscord | <firasuke> I had a struct for it in Rust, and I did use serde to serialize it |
18:14:36 | FromDiscord | <firasuke> but figured since I didn't find a proper toml serialization library in NIm, I won't use a custom type |
18:14:43 | FromDiscord | <firasuke> https://github.com/status-im/nim-toml-serialization |
18:15:04 | FromDiscord | <firasuke> I might take another look at that |
18:15:20 | FromDiscord | <Yardanico> it might not be too hard to actually take json.to and adapt it to parsetoml |
18:15:27 | FromDiscord | <Yardanico> since the interface is already very similar |
18:17:24 | FromDiscord | <firasuke> oh ok |
18:30:38 | * | azimut quit (Ping timeout: 255 seconds) |
18:39:36 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u1i |
18:39:39 | FromDiscord | <Z3NTL3> can someone help me, why does this give me an err |
18:39:48 | FromDiscord | <Z3NTL3> it says i am using the create thread wrong |
18:39:59 | FromDiscord | <Z3NTL3> https://media.discordapp.net/attachments/371759389889003532/1099404247457599538/image.png |
18:40:00 | FromDiscord | <Z3NTL3> but |
18:40:59 | FromDiscord | <Z3NTL3> (edit) "https://play.nim-lang.org/#ix=4u1i" => "https://play.nim-lang.org/#ix=4u1j" |
18:58:58 | FromDiscord | <firasuke> can you convert foregroundcolor to string? |
19:00:23 | FromDiscord | <Z3NTL3> you mean foregoundcolor escape sequence? |
19:00:29 | FromDiscord | <Z3NTL3> you may with ``$`` |
19:00:51 | FromDiscord | <Z3NTL3> so maybe ``$("\x1b[32m")`` |
19:12:00 | FromDiscord | <firasuke> sorry I meant this https://nim-lang.org/docs/terminal.html#ForegroundColor |
19:16:39 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4u1v |
19:18:12 | FromDiscord | <michaelb.eth> I poked around in github search but couldn't (yet) find a good explanation; my guess is that the algo for looking up symbols changed somehow, maybe for perf reasons it doesn't search down as far as it used to? |
19:18:47 | FromDiscord | <michaelb.eth> (edit) "symbols" => "identifiers" |
19:28:18 | * | lucasta quit (Remote host closed the connection) |
19:57:06 | FromDiscord | <Jackie> In reply to @firasuke "can you convert foregroundcolor": You mean like `$fgRed` to get the string "fgRed"? |
20:09:14 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4u1C |
20:09:40 | FromDiscord | <firasuke> In reply to @voidwalker "this is what he": Yup |
20:10:38 | FromDiscord | <firasuke> In reply to @Jackie "You mean like `$fgRed`": No, I meant `fgRed & "some string" & fgDefault` evaluates into ForegroundColor, I want to convert it to a string |
20:12:01 | FromDiscord | <Elegantbeef> All this work to avoid `stdout.styledWrite(fgRed, "hmmm")` |
20:12:13 | FromDiscord | <firasuke> Hahaha xD not really |
20:12:23 | FromDiscord | <firasuke> I am using styledEcho where appropriate |
20:12:40 | FromDiscord | <firasuke> But I have a ternary condition where this should evaluate to a string |
20:12:48 | FromDiscord | <firasuke> But I want it to be colored, |
20:12:59 | FromDiscord | <firasuke> Guess my only option is to use ANSI escape codes |
20:14:10 | FromDiscord | <firasuke> In reply to @voidwalker "this is what he": Thanks! |
20:45:32 | FromDiscord | <Dudugz> Because it makes sense, in github actions I can't test the socket, on my pc it works. The test just opens port ``1028`` on host ``127.0.0.1`` and creates a client that connects to that port and exchanges a simple ``ping-pong``. https://media.discordapp.net/attachments/371759389889003532/1099435844357599252/image.png https://media.discordapp.net/attachments/371759389889003532/1099435844567302254/image.png |
20:48:11 | FromDiscord | <anddam> hi, is there a library to write actual webapp, as "plain" frontend js ones? |
20:48:35 | * | lucasta joined #nim |
20:58:33 | FromDiscord | <michaelb.eth> In reply to @anddam "hi, is there a": can you explain more what you mean by "plain"? |
20:58:45 | FromDiscord | <anddam> I can try |
20:59:17 | FromDiscord | <anddam> I am not a "webster guy" myself, but I mean something like Vue or React, in Nim |
21:00:10 | FromDiscord | <anddam> I only have first hand experience with Angular, but that's a heavy beast, I'd like something leaner, I want to make a simple app plotting a certain model |
21:00:44 | FromDiscord | <anddam> so there's a few input fields, a couple slider for parameters, and a canvas to plot into, Angular is a bit heavy for that, also I'd like an excuse to try nim |
21:00:53 | FromDiscord | <anddam> and I despise js and the web |
21:01:44 | FromDiscord | <michaelb.eth> so it's not a Nim thing, but I'm a fan of Svelte, personally. I feel like it doesn't get in my way, the docs are pretty good, and it's fairly simple to do things that would be fairly verbose in vanilla JS/TS |
21:01:51 | FromDiscord | <Elegantbeef> Karax exists |
21:02:04 | FromDiscord | <michaelb.eth> (edit) "fairly" => "quite" |
21:13:33 | FromDiscord | <anddam> oh thank you, I was trying to remember the name of this framework and was frantically going through bookmarks to no avail |
21:13:35 | FromDiscord | <anddam> it was Svelte |
21:13:49 | FromDiscord | <anddam> @ElegantBeef let's check |
21:18:17 | FromDiscord | <PMunch> @elcritch @elcritch, not sure how but I managed to forget that the subject of my previous article was dynamic libraries: https://peterme.net/dynamic-libraries-in-nim.html |
21:18:40 | FromDiscord | <PMunch> Let me know if there's anything I've missed |
21:20:45 | FromDiscord | <louis77> anyone used the db_postgres std lib? I wonder why all the row values are returned as strings |
21:21:27 | FromDiscord | <louis77> all db_ libs do that |
21:27:04 | * | PMunch quit (Quit: leaving) |
21:31:20 | FromDiscord | <voidwalker> any nim projects out there that deal with large network connection pools ? and maybe some custom protocol. I'm kind of stuck designing my torrent library, need to see how this stuff is handled |
21:32:21 | FromDiscord | <Elegantbeef> @louis77\: excuse my ignorance, what else would it return? |
21:33:02 | FromDiscord | <anddam> @ElegantBeef seems too complex for now |
21:33:05 | FromDiscord | <louis77> In reply to @Elegantbeef "<@480081186505490445>\: excuse my ignorance,": well postgres has many different types |
21:33:30 | FromDiscord | <louis77> I don't see a reason to convert an int to string just to convert it back to an int |
21:34:08 | FromDiscord | <louis77> it seems to me like an overly simplified implementation but perhaps I was overlooking something, hence my question |
21:34:34 | FromDiscord | <Elegantbeef> Yea i do not use DBs so i cannot do anything aside from ask that question |
21:38:09 | FromDiscord | <Elegantbeef> @Phil\: probably is more helpful but likely is presently not here |
21:38:41 | FromDiscord | <Phil> ? I was writing angular storybook components etc, what is up? |
21:38:49 | FromDiscord | <Yepoleb> hello phil |
21:39:03 | FromDiscord | <Elegantbeef> > anyone used the db\_postgres std lib? I wonder why all the row values are returned as strings |
21:39:59 | FromDiscord | <Phil> In reply to @louis77 "I don't see a": You're looking for lowdb.↵I have no understanding as to why the folks that wrote the std lib thought it a good idea to represent things like that.↵lowdb will return an object variant instead and you can use something like norm to have that automatically parsed into a nim type |
21:40:06 | FromDiscord | <Phil> In reply to @Yepoleb "hello phil": Cheers! |
21:40:36 | FromDiscord | <Phil> lowdb also actually represents NULL correctly instead of representing it as an empty string |
21:40:44 | FromDiscord | <louis77> @Phil would you recommend Gatabase instead? |
21:40:51 | FromDiscord | <Yepoleb> i thought maybe the official apis only return strings, but they do return variants |
21:41:10 | FromDiscord | <Phil> In reply to @louis77 "<@180601887916163073> would you recommend": I have not used Gatabase, but it's got a lot of stars and was written mostly with postgres in mind, so worth trying out! |
21:41:58 | FromDiscord | <louis77> @Phil thanks you! I was really confused why std/db_ would return only strings, the pretty much makes it unusable |
21:42:06 | FromDiscord | <louis77> (edit) "the" => "that" |
21:42:18 | FromDiscord | <Yepoleb> this is phil's module https://github.com/PhilippMDoerner/lowdb |
21:43:12 | FromDiscord | <Phil> In reply to @louis77 "<@180601887916163073> thanks you! I": I agree. I went for an ORM solution immediately (my db was sqlite in that case) that's why I jumped on norm.↵Norm in turn used ndb, which started not getting updates and blocking us for updating for nim2.0 so I forked it into lowdb |
21:43:29 | FromDiscord | <Phil> (edit) "lowdb" => "lowdb, which is what norm uses nowadays" |
21:44:14 | FromDiscord | <Phil> However the postgres support is basically only "just there", so seeing if you can get gatabase to work for you might bring more rewards |
21:44:35 | FromDiscord | <louis77> @Phil got it, thanks! |
21:45:41 | FromDiscord | <ElegantBeef> To paste what the matrix version of me said:↵> Luckily these DB libraries are being moved to nimble packages so this issue can be resolved |
21:45:52 | FromDiscord | <Phil> I shall take this as my clue to go back into my cave and finish my frontend stuff for now |
21:46:07 | FromDiscord | <Phil> (edit) "clue" => "cue" |
21:46:28 | FromDiscord | <louis77> In reply to @ElegantBeef "To paste what the": Fully agree to that move |
21:47:53 | FromDiscord | <ElegantBeef> Based off that the repo's description is "unified db connector" perhaps that's why it's using a string |
21:48:28 | FromDiscord | <Elegantbeef> Luckily these DB libraries are being moved to nimble packages so this issue can be resolved |
21:48:36 | FromDiscord | <Phil> Even a unified DB_connector package can still use optionals at least to represent null not as "" |
21:49:16 | FromDiscord | <ElegantBeef> Of course I was just saying it likely was just laziness mixed with "Hey this DB returns strings" |
21:49:22 | FromDiscord | <Phil> Check |
21:53:27 | * | Notxor quit (Quit: Leaving) |
21:53:54 | FromDiscord | <louis77> sent a code paste, see https://play.nim-lang.org/#ix=4u1V |
21:54:52 | FromDiscord | <Phil> Errr I'm back out of context, is that a code snippet from gatabase? |
21:55:00 | FromDiscord | <louis77> no from lowdb |
21:55:13 | FromDiscord | <louis77> my first query returned `Failed to parse '2021-10-28 14:09:27.756545+02' with format 'yyyy-MM-dd HH:mm:sszz'. Failed on pattern 'zz'` |
21:55:28 | FromDiscord | <louis77> so I found that code in lowdb... |
21:56:16 | FromDiscord | <louis77> looks like I have to get my hands dirty with a PR 🙂 |
21:58:00 | FromDiscord | <Phil> Ma man, just for refernece, lowdb does not have async postgres support which may hurt quite a lot in terms of performance. If you're locked in for postgres I'd rather look at e.g. the stuff treeform has written and gatabase, I vaguely remember both of them having at least that available 😛 |
21:58:31 | FromDiscord | <louis77> "locked in for postgres" sounds interesting |
21:58:51 | FromDiscord | <louis77> I'm trying to get out of it for a long time but that's not so easy |
21:58:51 | FromDiscord | <ElegantBeef> It's a psychological thriller, that only weird programmers understand |
21:58:53 | FromDiscord | <Phil> I mean, I'll be happy about PRs to bring the featureset in lowdb up to par and add async in the future, but for getting something done quick I'd look at those. |
21:59:24 | FromDiscord | <louis77> there are not many alternatives to PG unfortunately |
21:59:46 | FromDiscord | <louis77> you all prefer sqlite? |
21:59:59 | FromDiscord | <ElegantBeef> I prefer no database |
22:00:21 | FromDiscord | <Phil> I prefer sqlite right up until I hit actually high user-numbers |
22:01:14 | FromDiscord | <Phil> Before then, afaik sqlite may actually be faster in low-traffic scenarios since it doesn't go through the network.↵And I kinda wrote my side-project as a vanity project for "how low can I make the pageloads go?" |
22:01:51 | FromDiscord | <louis77> unfortunately I'm in a high-traffic multi-client complex sql scenario |
22:03:26 | FromDiscord | <louis77> triggers, stored procs, multiple different apps connecting↵not that I like postgres but sqlite is not an option↵and mysql/mariadb are buggy as hell↵I was working on a POC to replace PG with MariaDB and ran into bugs _every hour_ I was working on it. Many of them filed and confirmed, non of them fixed even after two years |
22:03:46 | FromDiscord | <louis77> (edit) "non" => "none" |
22:04:09 | FromDiscord | <louis77> however, I won't disturb you guys about DB stuff here any longer 🙂 |
22:04:45 | FromDiscord | <ElegantBeef> You say disturb but given my lack of understanding i just read white noise |
22:05:10 | FromDiscord | <louis77> @ElegantBeef what do you use Nim for? |
22:05:26 | FromDiscord | <ElegantBeef> Inane projects that never see the light of day |
22:05:29 | FromDiscord | <ElegantBeef> Game dev |
22:05:54 | FromDiscord | <louis77> nice - an area I have zero clue about |
22:06:36 | * | fredrikhr quit (Quit: Disconnecting) |
22:06:56 | FromDiscord | <Phil> In reply to @louis77 "however, I won't disturb": Always happy to chat, don't worry.↵If I can help with anything in a web-related tech-stack I'm happy to, I've had my fingers in some of the codebases so I may be able to either help or know who can. |
22:07:03 | FromDiscord | <Phil> (edit) "In reply to @louis77 "however, I won't disturb": Always happy to chat, don't worry.↵If I can help with anything in a web-related tech-stack I'm happy to, I've had my fingers in some of the ... codebases" added "webdev-related" |
22:07:15 | FromDiscord | <ElegantBeef> A lot of my Nim code is actually just macro related stuff cause apparently I like writing compiler like stuff in userspace |
22:09:10 | FromDiscord | <louis77> In reply to @Isofruit "Always happy to chat,": sounds good - that's actually what I'm trying to use Nim for, web backend stuff (rest apis etc.) |
22:09:35 | FromDiscord | <ElegantBeef> Ah yet another person for me to bully |
22:10:14 | FromDiscord | <Phil> Note that in terms of explicitly webserver backends I'm familiar with like 2 of those, actually knowledgeable with 1 and there's been a bunch of web-packages popping up left and right that I haven't even looked at |
22:10:47 | FromDiscord | <Phil> Mummy is a new-er webserver for example that I haven't done anything with so far at all and chances are I won't be anywhere near-term |
22:29:47 | * | jmdaemon joined #nim |
22:36:59 | * | lucasta quit (Remote host closed the connection) |
22:44:18 | FromDiscord | <demetera> In reply to @Yardanico "<@743921751477584033> you can use": Unfortunately, still can't get, how to omit non-used json keys with the `options` module↵↵some background: openweathermaps API doesn't provide some fields sometimes and I can't parse those to my predefined object, hence app crashes |
22:44:34 | * | ltriant_ joined #nim |
22:44:50 | FromDiscord | <Yardanico> In reply to @Dimi "Unfortunately, still can't get,": You just have those fields in your object as Option[type] |
22:45:03 | FromDiscord | <Yardanico> if they're not present they're going to be none |
22:45:13 | FromDiscord | <Yardanico> this is with json module I mean, not jsony |
22:45:39 | FromDiscord | <demetera> Yes. Exactly. It's working, but I need to parse this object in the end even if those fields are not present |
22:46:08 | FromDiscord | <Yardanico> not sure what you mean |
22:46:34 | FromDiscord | <Yardanico> if the fields aren't present, you should store the default value or something else |
22:46:44 | FromDiscord | <demetera> So I have to pass json keys to the object, even if those keys are missing |
22:46:46 | FromDiscord | <Yardanico> You can check if an option has a value with isSome |
22:47:16 | * | ltriant quit (Ping timeout: 276 seconds) |
22:47:19 | FromDiscord | <Yardanico> In reply to @Dimi "So I have to": Sorry if I'm misunderstanding, but don't you have a nim type? You have fields, not strings for it |
22:48:31 | FromDiscord | <demetera> Yep. I have a Nim nested types indeed |
22:49:45 | FromDiscord | <demetera> Anyways, thanks for the help. Better I will check jsony module |
22:51:05 | FromDiscord | <demetera> I'm just looking something like in Golang where you can omit empty json keys |
22:52:31 | FromDiscord | <demetera> (edit) "you can" => "it's feasible to" | "it's feasible toomit ... empty" added "the" |
23:03:59 | * | lucasta joined #nim |
23:04:20 | * | derpydoo joined #nim |
23:15:29 | * | Jjp137 quit (Read error: Connection reset by peer) |