01:17:09 | * | derpydoo joined #nim |
01:41:44 | FromDiscord | <Nlits (Ping on reply)> sent a long message, see http://ix.io/4wIG |
01:41:57 | FromDiscord | <Rika> Lol |
01:42:04 | FromDiscord | <Elegantbeef> I've seen that sentiment a lot |
01:48:55 | * | xet7 quit (Ping timeout: 256 seconds) |
01:50:39 | FromDiscord | <Recruit_main707> if everyone had good opinions the world would be too boring |
02:01:36 | * | xet7 joined #nim |
02:13:06 | * | Guest89 joined #nim |
02:13:44 | * | Guest89 quit (Client Quit) |
03:23:59 | NimEventer | New thread by terrygils: PyPI was subpoenaed. Should Nim prepare a process in place?, see https://forum.nim-lang.org/t/10224 |
03:34:03 | NimEventer | New thread by sls1005: DLL Terms, see https://forum.nim-lang.org/t/10225 |
04:01:08 | * | derpydoo quit (Ping timeout: 240 seconds) |
04:18:24 | NimEventer | New thread by slangmgh: May bug with ``ptr ref`` combine closure?, see https://forum.nim-lang.org/t/10226 |
05:02:09 | * | Batzy_ is now known as Batzy |
05:04:18 | * | lucasta quit (Quit: Leaving) |
05:09:55 | FromDiscord | <anthead> lack of cyclic imports is really annoying, does v2 gonna change the situation? |
05:13:16 | * | rockcavera quit (Remote host closed the connection) |
06:20:49 | * | azimut quit (Remote host closed the connection) |
06:22:50 | * | azimut joined #nim |
06:32:54 | * | PMunch joined #nim |
06:45:30 | FromDiscord | <leorize> nope |
07:02:14 | * | advesperacit joined #nim |
07:31:07 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4wJD |
07:48:55 | * | Notxor joined #nim |
08:33:12 | FromDiscord | <voidwalker> Is there a way to print an xmlNode structure recursively, like a tree ? I want to do html parsing but have no idea what I am looking for |
08:38:15 | FromDiscord | <chmod222> If you are going to be parsing HTML, I would rather be looking into dedicated HTML parser libraries. While HTML looks like XML on the surface, there are so many nastinesses that are valid HTML but invalid XML that covering the edge cases is not possible with a pure XML library |
08:38:53 | FromDiscord | <voidwalker> it's a very simple parse this time |
08:39:38 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wJP |
08:39:43 | FromDiscord | <voidwalker> I wanna get that `value` |
08:40:27 | FromDiscord | <voidwalker> I could get the same result with string find I guess, but I wanted to make it proper with htmlparse |
08:40:39 | FromDiscord | <chmod222> Should be simple enough for a handwritten parser if XmlNode fails you |
08:41:01 | FromDiscord | <voidwalker> It's not failing me, I just have no idea how to use it, I don't know XML |
08:41:10 | FromDiscord | <Ras> i think https://nim-lang.org/docs/parsexml.html#example-2colon-retrieve-all-html-links is more or less what you're looking for |
08:41:25 | FromDiscord | <Ras> replace `a` with `input` and `href` with `value` and stop at the first match, i guess |
08:41:33 | FromDiscord | <voidwalker> I'd like to print a representation of the xml tree so I can see what I need to get |
08:41:58 | FromDiscord | <chmod222> What does `$` give you? |
08:42:12 | FromDiscord | <chmod222> I believe it should print you the full parsed tree |
08:42:21 | FromDiscord | <voidwalker> it just prints the html again |
08:42:32 | FromDiscord | <Ras> as a side note, i've found treeform's `print` to be super useful when printing "unknown" structs etc |
08:42:34 | FromDiscord | <Ras> https://github.com/treeform/print |
08:42:44 | FromDiscord | <Ras> but i dunno if it would work here |
08:46:07 | NimEventer | New thread by cmc: German Tax Upload in Nim with Futhark, see https://forum.nim-lang.org/t/10231 |
08:49:14 | FromDiscord | <voidwalker> https://pastebin.com/raw/nU2gDys9 this is what treeform print gets me |
08:49:44 | FromDiscord | <voidwalker> headspinning |
08:50:07 | FromDiscord | <voidwalker> I'll just do strings, sigh |
09:24:21 | PMunch | voidwalker, what's wrong with following Ras's example code? |
09:26:07 | FromDiscord | <voidwalker> @PMunch, nothing I didn't try it, too much of a cognitive load at the moment, fixed it with a simple string find : ) |
10:33:05 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wKe |
10:34:49 | FromDiscord | <leorize> `sequtils.filterIt`? |
10:34:52 | FromDiscord | <Andreas> `filterIt` |
10:35:08 | FromDiscord | <Andreas> (edit) "`filterIt` ... " added ",, 2nd best" |
10:35:45 | FromDiscord | <sOkam!> oh, that's what i was searching for. i was searching in that module, but didn't see that's the one that doesn modify |
10:35:52 | FromDiscord | <sOkam!> tyty |
10:40:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wKf |
10:52:52 | FromDiscord | <hotdog> In reply to @Ras "as a side note,": He’s working on a replacement too https://github.com/treeform/pretty |
10:53:21 | FromDiscord | <Ras> ah, good to know, thanks! |
11:14:17 | FromDiscord | <voidwalker> How can I see the exact string representation of httpclient post request headers ? I am trying to compare vs firefox's network inspector to see what I am missing |
11:23:08 | FromDiscord | <Ras> chmod222: "If you are going to be parsing HTML, I would rather be looking into dedicated HTML parser libraries" |
11:23:25 | FromDiscord | <Ras> std/parsexml is apparently designed to be more lenient, exactly with HTML in mind |
11:23:54 | FromDiscord | <Ras> > The parser has been designed to be somewhat error correcting, so that even most "wild HTML" found on the web can be parsed with it. |
11:23:59 | * | ntat joined #nim |
11:29:16 | FromDiscord | <kcvinker> When creating a dll file in nim, do we need a main function or DllMain ? |
11:29:46 | FromDiscord | <kcvinker> Because, my dll only shows a `NimMain` when I inspect with `dumpbin` |
11:30:03 | FromDiscord | <kcvinker> It doesn't show my exportc function name |
11:31:24 | ntat | Hi. I have two question :) How can I correctly declare these arrays? → https://play.nim-lang.org/#ix=4wKl And how can I find y array in x array (how to display position)? |
11:34:00 | FromDiscord | <kcvinker> In reply to @kcvinker "Because, my dll only": Never mind. I got it. `dynlib` did the trick. |
11:35:36 | FromDiscord | <voidwalker> ntat from IRC : declare like this (remove type definition as it's infered from the static array construction) https://play.nim-lang.org/#ix=4wKm |
11:36:14 | FromDiscord | <mratsim> @ntat https://play.nim-lang.org/#ix=4wKn |
11:38:57 | FromDiscord | <voidwalker> which results in: https://play.nim-lang.org/#ix=4wKr |
11:39:19 | * | rockcavera joined #nim |
11:39:20 | NimEventer | New thread by PMunch: Bloom filter comparisson, see https://forum.nim-lang.org/t/10232 |
11:40:45 | PMunch | kcvinker, this might be of interest to you: https://peterme.net/dynamic-libraries-in-nim.html |
11:41:03 | ntat | <voidwalker>, <mratsim> thanks :) |
11:41:39 | FromDiscord | <voidwalker> Should this POST request data: "validator=90003f04ff2a0749db87c22db1ef7fc93e3c66de4a77e86d0e0c62912803927b&username=voidwalker&password=myPass" be in the body or multipart data type ? |
11:41:46 | FromDiscord | <kcvinker> In reply to @PMunch "<@633714482572689449>, this might be": Wow ! That's great. That's what I am searching. Thank you @PMunch |
11:42:04 | PMunch | No problem :) |
11:43:43 | ntat | and is it the simple way to find one array in other? |
11:45:37 | FromDiscord | <voidwalker> well if the arrays are of the same type, which in your example are not (size 2 vs size 3 array of tuples), you would simply check with == |
11:52:30 | ntat | <voidwalker> no, I'm just looking for ways to find a smaller array in a larger. |
11:52:52 | FromDiscord | <voidwalker> how do you define this in your example ? |
11:53:07 | FromDiscord | <voidwalker> how do you find a 2x2 array in a 4x3 array |
11:58:03 | ntat | <voidwalker> I I would like convert Image to array with tuples with (r,g,b) for any pixel. Eg. for picture 640x480 I want to have 640 tuples in every row and 480 tuples in any column :) |
11:59:13 | * | cm_ joined #nim |
11:59:14 | ntat | And then I want to convert to array second (smaller) image to find in large image |
11:59:31 | * | cm quit (Ping timeout: 240 seconds) |
11:59:35 | * | cm_ is now known as cm |
11:59:59 | ntat | Simply trying to write a program to find a picture inside another picture. |
12:03:47 | ntat | Little correct → Eg. for picture 640x480 I want to have 640 tuples in every COLUMN and 480 tuples in any ROW |
12:04:10 | ntat | *every ROW ;) |
12:07:13 | FromDiscord | <voidwalker> well chat GPT tells me the Rabin-Karp algorithm is a good pick for this : ) |
12:07:28 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wKB |
12:07:33 | FromDiscord | <voidwalker> (edit) |
12:09:37 | ntat | OMG :> |
12:11:44 | ntat | I have other way to do dis, but I think that thi is very weak way → convert Image object to multiline string and use regex to find the same string :D |
12:11:50 | ntat | *this |
12:15:42 | PMunch | voidwalker, hmm interesting algorithm |
12:16:26 | PMunch | I've been looking at various string searching algorithms lately |
12:16:43 | FromDiscord | <voidwalker> Doesn't feel to be optimal for this scenario though |
12:17:26 | PMunch | Actually just aborted a fairly misguided attempt at creating a bloom filter cache, by my calculations it would've taken just shy of 2000 years to complete :P |
12:22:07 | ntat | In Python→PyAutoGui this function is called LocateOnScreen and it takes a screenshot and searches for another image in it. |
12:22:22 | ntat | I try to do this in Nim |
12:26:01 | FromDiscord | <Ras> In reply to @voidwalker "Should this POST request": body |
12:26:28 | FromDiscord | <voidwalker> yeah it's body, I noticed there must be content-type multipart in headers if it needs multipart |
12:26:57 | FromDiscord | <voidwalker> I think I got everything right, but now I am getting ` Connection was closed before full request has been made [ProtocolError]` |
12:27:42 | FromDiscord | <Ras> generally, the `Content-Type` header for that should be 😂 |
12:27:46 | FromDiscord | <Ras> sorry, wrong clipboard |
12:27:55 | FromDiscord | <Ras> `application/x-www-form-urlencoded` |
12:28:10 | FromDiscord | <voidwalker> `flLoginHeaders["Content-Type"] = "application/x-www-form-urlencoded"↵` |
12:28:14 | FromDiscord | <voidwalker> this is what I have indeed |
12:28:37 | FromDiscord | <voidwalker> I copy pasted all the headers from firefox ;\ |
12:28:46 | FromDiscord | <Ras> what's your code? |
12:29:09 | FromDiscord | <Ras> and do you have a `Content-Length` that's `len(body)`? |
12:29:16 | FromDiscord | <Ras> (edit) "and do you have a `Content-Length` ... that'sset" added "header" | "headerthat's ... `len(body)`?" added "set to" |
12:29:32 | FromDiscord | <Ras> you probably don't need all the headers, lol |
12:29:57 | FromDiscord | <voidwalker> yeah I somehow got the idea that I need multipart data, and that didn't work, so I tried to replicate all the headers.. but it wasn't that |
12:31:12 | FromDiscord | <voidwalker> yes, `flLoginHeaders["Content-Length"] = $flLoginPostData.len` |
12:32:25 | FromDiscord | <voidwalker> code is basically, do a GET request to get that validator string, and PHPSESSID (those work okay) |
12:33:14 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wKD |
12:33:22 | FromDiscord | <Ras> private trackers, eh |
12:33:23 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4wKD" => "https://play.nim-lang.org/#ix=4wKE" |
12:34:21 | FromDiscord | <Ras> set the `Connection` header to `close` |
12:35:03 | FromDiscord | <Ras> you also don't need `Accept-Language`, (probably) `Accept`, `Origin`, `Referer`, any of the `Sec-` headers, `TE` and `Upgrade-Insecure-Requests` |
12:35:06 | FromDiscord | <voidwalker> Same result |
12:35:28 | FromDiscord | <voidwalker> Yeah I will remove all the unnecessary ones once I figure out how to login : ) |
12:36:06 | FromDiscord | <Ras> also i'm assuming phpSessId has the `PHPSESSID=` prefix, and not just the value |
12:36:14 | FromDiscord | <Ras> not related to the error you're getting, but just in case |
12:36:51 | FromDiscord | <voidwalker> yes, it is the full string |
12:38:35 | FromDiscord | <Ras> hmmmm |
12:39:14 | FromDiscord | <voidwalker> I can pm you the code/pass if you have mood to try and fix this : ) |
12:39:21 | FromDiscord | <Ras> sure |
12:40:38 | FromDiscord | <voidwalker> but I can't, you are very restrictive with messages and friend requests lol |
12:40:57 | FromDiscord | <voidwalker> I should do that too, too much spam lately |
12:42:36 | FromDiscord | <Ras> really? huh |
12:44:20 | * | ntat quit (Quit: Leaving) |
12:47:23 | * | Notxor quit (Ping timeout: 246 seconds) |
13:29:35 | * | progranner joined #nim |
14:17:14 | FromDiscord | <kcvinker> How do convert a Utf16Char pointer into Utf16Char string or any string ? |
14:18:38 | * | PMunch quit (Quit: Leaving) |
14:33:07 | FromDiscord | <michaelb.eth> In reply to @kcvinker "How do convert a": Have you tried the facilities in https://nim-lang.org/docs/widestrs.html? |
14:51:58 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
14:52:24 | * | progranner joined #nim |
15:03:25 | * | ntat joined #nim |
15:10:59 | FromDiscord | <chmod222> Does anyone else have occasional trouble with vscode and the Nim extension? I've had it happen twice now that I've had dozens of nimsuggest processes running and basically forkbombing/OOMing my desktop |
15:11:18 | FromDiscord | <chmod222> It's nothing earth shattering, but I do wonder if someone else had that happen |
15:11:32 | FromDiscord | <voidwalker> is it not possible to set nim's httpclient to automatically store received cookies for subsequent connections ? Any clien that can do this ?↵Also, is it possible to modify headers between redirects with nim httpclient ? |
15:14:53 | FromDiscord | <michaelb.eth> In reply to @chmod222 "Does anyone else have": are you using nimlsp or nimlangserver? |
15:17:31 | FromDiscord | <chmod222> Honestly I don't know |
15:18:11 | FromDiscord | <chmod222> The VSCode config only speaks of nimsuggest |
15:21:54 | FromDiscord | <kcvinker> In reply to @michaelb.eth "Have you tried the": Yes, but at the first glance, I didn't notice anything which takes a Utf16Char pointer as parameter. |
15:29:59 | FromDiscord | <michaelb.eth> hmm, so looking at sources, I see that in devel (so nim v2), widestrs is moved from system to std, and it uses `WideCString = ptr UncheckedArray[Utf16Char]` instead of `WideCString = ref UncheckedArray[Utf16Char]` |
15:32:18 | FromDiscord | <michaelb.eth> so if you have a `pointer` to the first utf16char, I think you'd be able to cast to WideCString, but when WideCString is defined with `ref` instead of `ptr`, I'm not sure |
15:32:29 | FromDiscord | <michaelb.eth> (edit) "utf16char," => "Utf16Char," |
15:32:31 | FromDiscord | <Spatchler> is this where i ask for help? |
15:32:39 | FromDiscord | <michaelb.eth> In reply to @Spatchler "is this where i": it is indeed |
15:34:01 | * | xet7 quit (Quit: Leaving) |
15:35:44 | FromDiscord | <Spatchler> sent a code paste, see https://play.nim-lang.org/#ix=4wLp |
15:36:54 | FromDiscord | <kcvinker> In reply to @michaelb.eth "so if you have": Thank @michaelb.eth Let me check that. |
15:38:29 | FromDiscord | <michaelb.eth> In reply to @Spatchler "this is my first": where you have `array[1..W, array[1..H, uint8]`, can you try `array[1W, array[H, uint8]`? |
15:38:35 | FromDiscord | <michaelb.eth> (edit) "`array[1W," => "`array[W," |
15:39:14 | FromDiscord | <demotomohiro> In reply to @Spatchler "this is my first": I think you still need to use uint8 literals like `1'u8` to define `maze`. |
15:39:40 | FromDiscord | <Spatchler> In reply to @michaelb.eth "where you have `array[1..W,": that didn't work but thanks |
15:40:03 | FromDiscord | <Spatchler> In reply to @demotomohiro "I think you still": but does the converter not convert them |
15:42:44 | FromDiscord | <demotomohiro> In reply to @Spatchler "but does the converter": Your code might needs converter from array[N, int] to array[N, uint8] |
15:44:28 | FromDiscord | <Spatchler> In reply to @demotomohiro "Your code might needs": oh yeah, thanks for the help |
15:45:59 | FromDiscord | <Spatchler> its annoying that it cannot be implicitly converted |
15:51:44 | * | azimut quit (Ping timeout: 240 seconds) |
16:05:08 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4wLw |
16:13:33 | om3ga | Finally found the way how to force GC free up the ram. Not an elegant solution, but I created the thread, and processed all the data to the shared ram, and when thread exits all it's local allocations freed. |
16:15:47 | FromDiscord | <mratsim> In reply to @om3ga "Finally found the way": at that point you might as well use manual memory management |
16:16:50 | om3ga | mratsim: I did that many times, the reason I choose nim is not to do so :) |
16:18:45 | FromDiscord | <voidwalker> Is there code in nim devel for default object values or is it just rfc for now ? |
16:19:36 | om3ga | I think some sort of GC_free_heap() is a must have function. By my opinion, speed is not always main target, especially when executable can hold all that allocs for long time |
16:19:37 | FromDiscord | <kcvinker> How do you write a null character literal in nim ? `'\x0000` is not working. |
16:19:57 | om3ga | '\0'? |
16:20:16 | FromDiscord | <kcvinker> Oh I see. Let me try. Thanks |
16:20:34 | FromDiscord | <kcvinker> Well I am working with wide characters |
16:21:03 | FromDiscord | <kcvinker> So on the left hand side, there is Utf16Char |
16:21:29 | FromDiscord | <kcvinker> I think if I use `'\0'`, It will be an error |
16:21:45 | om3ga | maybe '\z'? |
16:21:57 | FromDiscord | <kcvinker> Oh, let me try |
16:22:14 | om3ga | I rarely work with utf16, even with 8 |
16:22:44 | FromDiscord | <kcvinker> It's resulted in an invalid character constant |
16:23:45 | om3ga | other variations: \000, \x00 |
16:24:46 | FromDiscord | <kcvinker> Thanks. Let me try |
16:25:53 | FromDiscord | <kcvinker> In reply to @om3ga "other variations: \000, \x00": Both are char in nim |
16:26:05 | om3ga | hmm |
16:26:21 | FromDiscord | <kcvinker> Seems like ord() is my last resort |
16:27:50 | * | xaltsc joined #nim |
16:30:01 | om3ga | https://play.nim-lang.org/#ix=4wLA kcvinker |
16:30:11 | FromDiscord | <michaelb.eth> @kcvinker you need the null char for Utf16Char? |
16:30:19 | FromDiscord | <michaelb.eth> (edit) "@kcvinker you need the null char for ... Utf16Char?" added "type" |
16:30:24 | FromDiscord | <kcvinker> Yes |
16:31:13 | FromDiscord | <michaelb.eth> how about `const nullC = Utf16Char('\x00')` |
16:35:11 | FromDiscord | <kcvinker> In reply to @michaelb.eth "how about `const nullC": Thanks. Let me try |
16:37:02 | FromDiscord | <kcvinker> @michaelb.eth I think it will work if we add an operator overload for "==" |
16:37:10 | FromDiscord | <kcvinker> This is the result↵`Error: type mismatch: got <Utf16Char, Utf16Char>` |
16:37:47 | FromDiscord | <kcvinker> So it seems that `system/widestrs` did not implement these ops |
16:42:49 | * | oprypin quit (Quit: Bye) |
16:46:58 | * | oprypin joined #nim |
16:47:46 | FromDiscord | <kcvinker> Anyway, it's trivial to use `if ord(wchar) == 0: # do something` |
16:48:28 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:54:39 | * | progranner joined #nim |
16:55:47 | NimEventer | New post on r/nim by No_Necessary_3356: Ferus -- a toy web engine/browser written in Nim, see https://reddit.com/r/nim/comments/13sihuj/ferus_a_toy_web_enginebrowser_written_in_nim/ |
17:05:13 | FromDiscord | <michaelb.eth> In reply to @kcvinker "Anyway, it's trivial to": sure, that works↵↵if you ever do need/want to define `==`, etc., the `{.borrow.}` pragma can be helpful for that: https://nim-lang.org/docs/manual.html#types-distinct-type |
17:05:25 | FromDiscord | <michaelb.eth> (edit) "works↵↵if" => "works↵if" |
17:05:46 | * | disso-peach joined #nim |
17:06:32 | FromDiscord | <sOkam!> Is it possible to get the root name of a variable, when the variable is called from inside a proc (or nested proc), where said variable is passed as one of the inputs? |
17:06:40 | FromDiscord | <kcvinker> In reply to @michaelb.eth "sure, that works if": Thanks. I will check it. |
17:07:28 | FromDiscord | <sOkam!> In reply to @sOkam! "Is it possible to": @ElegantBeef to the rescue, maybe? |
17:10:10 | FromDiscord | <sOkam!> I managed to partially "fix" it, but making the proc a template. But now I hit the actual problem when I realized that the template needs to be called from inside a type constructor proc🤦♂️. So there is no avoiding it now |
17:18:03 | FromDiscord | <Graveflo> what do you mean the variable is "called" is the variable a function pointer? Do you mean that it is a parameter? Are you trying to get the name of the parameter or the code that was used to supply the parameter at the time of calling? |
17:23:23 | FromDiscord | <sOkam!> yeah, pretty much |
17:24:58 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wLN |
17:25:52 | FromDiscord | <Graveflo> only way i know how to do something like that is by making the parameter untyped |
17:27:06 | FromDiscord | <sOkam!> that would mean I make the outside api of the library be able to give any other type of input, which is very undesirable |
17:28:09 | FromDiscord | <sOkam!> i can just add an extra input string where the user gives the name they want to use, but was wondering if that could be avoidable |
17:43:05 | * | Notxor joined #nim |
18:24:08 | FromDiscord | <demotomohiro> In reply to @sOkam! "that would mean I": How about to write a macro? |
18:28:05 | FromDiscord | <sOkam!> In reply to @demotomohiro "How about to write": im fine if that's the way. i have a macro for the name. but question is if its possible to access the source name and (even if only vaguely and roughly) how to do so |
18:36:54 | * | derpydoo joined #nim |
18:51:39 | FromDiscord | <Graveflo> if you want to restrict what can actually be input to the untyped parameter you need to raise a compile time error and do the check yourself |
19:07:26 | FromDiscord | <guttural666> can somebody help me escape the necessary chars in this regex: ^.["][.]$ |
19:07:53 | FromDiscord | <guttural666> got this rn and it complains re"^.["][.]$" |
19:08:23 | FromDiscord | <guttural666> escaping the one dquote in there does not do it |
19:08:58 | FromDiscord | <Chronos [She/Her]> I need to store a hash and I want to use `norm` but I don't get how I should make it so `norm` can represent it in the db exactly? |
19:09:23 | FromDiscord | <kcvinker> I have a `seq[char]`. How to convert this a string / |
19:09:27 | FromDiscord | <kcvinker> (edit) "/" => "?" |
19:09:37 | FromDiscord | <Chronos [She/Her]> Can't you just cast it? |
19:09:38 | FromDiscord | <guttural666> https://media.discordapp.net/attachments/371759389889003532/1111732893673336852/image.png |
19:10:00 | FromDiscord | <kcvinker> In reply to @Hourglass, When the Hour Strikes "Can't you just cast": Thanks. Let me try |
19:10:02 | FromDiscord | <guttural666> In reply to @kcvinker "I have a `seq[char]`.": $sequence maybe? |
19:10:23 | FromDiscord | <kcvinker> What is `$sequence` ? |
19:10:46 | FromDiscord | <guttural666> $ stringyfies stuff, maybe there is an implementation for a seq[char] |
19:10:51 | FromDiscord | <Chronos [She/Her]> In reply to @guttural666 "$sequence maybe?": That just does `"@['a', 'b', 'c']"` |
19:11:08 | FromDiscord | <kcvinker> Oh I see |
19:11:11 | FromDiscord | <Chronos [She/Her]> In reply to @guttural666 "$ stringyfies stuff, maybe": And no, I'd assume that'd break the convention |
19:11:47 | FromDiscord | <Chronos [She/Her]> Strutils probably has something for it but an unsafe way of doing this is `cast[string](yourVar)` |
19:12:23 | FromDiscord | <kcvinker> In reply to @Hourglass, When the Hour Strikes "And no, I'd assume": Cast is working nicely |
19:12:55 | FromDiscord | <guttural666> In reply to @Hourglass, When the Hour Strikes "That just does `"@['a',": yeah |
19:13:24 | FromDiscord | <Chronos [She/Her]> In reply to @kcvinker "Cast is working nicely": In strutils there is also https://nim-lang.org/docs/strutils.html#join%2CopenArray%5BT%5D%2Cstring which is much safer |
19:13:46 | FromDiscord | <Chronos [She/Her]> `yourVar.join()` |
19:14:03 | FromDiscord | <Chronos [She/Her]> Can also change the seperator but not needed here |
19:14:12 | FromDiscord | <Chronos [She/Her]> separator |
19:25:36 | FromDiscord | <demotomohiro> Casting from `seq[char]` to string can be unsafe as string always has zero terminal but seq[char] doesn't. |
19:33:56 | FromDiscord | <guttural666> In reply to @guttural666 "": anybody familiar with std/re? |
19:35:36 | FromDiscord | <Elegantbeef> I'm familiar with telling people not to use regex, aside from that joke I've got nothing |
19:37:40 | FromDiscord | <Elegantbeef> @sOkam!\: to answer your question of course not. A procedure is self contained and cannot know what symbol or data you pass to it, you want a template |
19:41:51 | FromDiscord | <kcvinker> In reply to @Hourglass, When the Hour Strikes "In strutils there is": Thank you. Let me check |
19:42:29 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wMd |
19:42:30 | FromDiscord | <kcvinker> In reply to @demotomohiro "Casting from `seq[char]` to": I am creating this seq. So I can make sure that there is a null at the end |
19:43:02 | FromDiscord | <Elegantbeef> You really shouldnt be using `cast` |
19:43:19 | FromDiscord | <Elegantbeef> Why do you need `string`? |
19:43:55 | FromDiscord | <guttural666> In reply to @Elegantbeef "I'm familiar with telling": will hack together a strutils alternative then, when it works it's quite nice ^^ |
19:44:00 | om3ga | kcvinker, but strings are null terminated by default |
19:44:08 | FromDiscord | <kcvinker> I am using my nim dll in another programming language |
19:44:14 | om3ga | why you need to do that manually? |
19:44:33 | FromDiscord | <voidwalker> @ElegantBeef cause.. I need it ? I want to do something like `fmt"https://website.io/browse.php?id={id}" & fmt"{(if withFiles: "&filelist=1" else: "")}"` |
19:44:38 | FromDiscord | <Elegantbeef> Ok you're using your NimDLL in another language, that means you should likely expose a `cstring` |
19:44:38 | FromDiscord | <kcvinker> There is only one way to get a string from there. And it is a wchar pointer |
19:44:45 | om3ga | and when you call the function it crashes? |
19:44:54 | FromDiscord | <kcvinker> Nope |
19:45:04 | FromDiscord | <voidwalker> oh that wasn't for me |
19:45:06 | FromDiscord | <Elegantbeef> Nim string isnt a wchar pointer |
19:45:14 | FromDiscord | <kcvinker> Because I am parsing string from that ptr |
19:45:16 | om3ga | 0x0000 is hexademical null for utf16 |
19:45:24 | FromDiscord | <Elegantbeef> Void that's horrendous |
19:45:46 | FromDiscord | <voidwalker> dehorrendify it then pls : P |
19:45:49 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4wMf |
19:46:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wMg |
19:46:35 | FromDiscord | <Elegantbeef> Isnt there a query module for this though |
19:49:04 | FromDiscord | <kcvinker> Is it possible to create objects at runtime from string ? |
19:49:17 | FromDiscord | <Elegantbeef> Sure how do you think parsing works |
19:49:23 | FromDiscord | <Elegantbeef> Is it possible to create types at runtime... no |
19:49:38 | FromDiscord | <kcvinker> Oh I see |
19:50:28 | FromDiscord | <voidwalker> ` fmt"https://website.io/details.php?id={id}" & (if withFiles: "&filelist=1" else: ""))` |
19:50:30 | FromDiscord | <voidwalker> this works |
19:50:53 | FromDiscord | <voidwalker> But I don't know why I can't use an expression to return a string, inside fmt ? |
19:51:00 | FromDiscord | <kcvinker> sent a long message, see http://ix.io/4wMh |
19:52:02 | FromDiscord | <Elegantbeef> Of course |
19:52:26 | FromDiscord | <kcvinker> Where should I start @ElegantBeef ? |
19:53:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/8BDcV |
19:53:14 | FromDiscord | <Elegantbeef> Depends on what you mean from "Getting an object from string" |
19:54:09 | FromDiscord | <kcvinker> I mean, I get a string through a function and it's in nim syntax. |
19:54:35 | FromDiscord | <kcvinker> So I parse that string and execute it |
19:54:52 | FromDiscord | <Elegantbeef> Nim is compiled to do that you'd need to use the NimVm |
19:54:54 | FromDiscord | <kcvinker> So that I can create an object from that string |
19:55:08 | FromDiscord | <kcvinker> How ? |
19:55:18 | FromDiscord | <Elegantbeef> Nimscripter is a good place to start |
19:55:30 | FromDiscord | <Elegantbeef> Though i'd still suggest using json, toml, or any other format over using nimscript |
19:55:36 | FromDiscord | <kcvinker> Great. Thanks @ElegantBeef |
19:57:45 | FromDiscord | <kcvinker> @ElegantBeef So which is the popular json parser for nim ? |
19:58:06 | FromDiscord | <Elegantbeef> There are like 6 to choose from and they all work |
20:01:38 | FromDiscord | <RatoGBM> How do I make an array of zeros all int32? `var tape: array[256, int32] = ???` but filled with zeors |
20:01:49 | FromDiscord | <RatoGBM> (edit) "tape:" => "arr:" |
20:02:02 | FromDiscord | <Elegantbeef> `var arr: array[256, int32]` |
20:02:35 | FromDiscord | <RatoGBM> I want it to be filled with zeros |
20:02:54 | FromDiscord | <Elegantbeef> Yep |
20:03:27 | FromDiscord | <RatoGBM> I would like an array of int32 numbers filled with zeros |
20:03:38 | FromDiscord | <Elegantbeef> Yes I just showed you how |
20:03:47 | FromDiscord | <Elegantbeef> Sometimes it's like pulling teeth |
20:04:04 | FromDiscord | <demotomohiro> Nim fills arrays with zero in default. |
20:04:37 | FromDiscord | <RatoGBM> In reply to @demotomohiro "Nim fills arrays with": I guess that's not why my indexing bug is happening then. |
20:05:00 | FromDiscord | <RatoGBM> `Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]` |
20:05:27 | FromDiscord | <Elegantbeef> Index out of bounds means you're indexxing out of 0..255 |
20:05:34 | FromDiscord | <demotomohiro> In Nim, almost every types are initialized with zero bits in default excepts `{.noinit.}`. |
20:08:19 | FromDiscord | <RatoGBM> 🤦♂️ Nvm and thks, I was being redicolously stupid |
20:08:34 | FromDiscord | <RatoGBM> (edit) "🤦♂️ Nvm and thks, I was being redicolously stupid ... " added "in my code" |
20:18:04 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:22:40 | FromDiscord | <sOkam!> is this type of thing illegal in recent versions of nim? https://media.discordapp.net/attachments/371759389889003532/1111751280050851860/image.png |
20:23:22 | FromDiscord | <Elegantbeef> Was that ever legal? |
20:23:38 | FromDiscord | <Elegantbeef> `int` is a integer so needs to be stropped there as it's a parameter name |
20:24:56 | FromDiscord | <sOkam!> how would you achieve something like this with current versions of nim? https://media.discordapp.net/attachments/371759389889003532/1111751843559772180/image.png |
20:25:13 | FromDiscord | <Elegantbeef> `arg: int` |
20:26:13 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wMv |
20:26:26 | FromDiscord | <Elegantbeef> ... |
20:26:30 | FromDiscord | <Elegantbeef> remove the `=` |
20:26:43 | FromDiscord | <sOkam!> oh shoot |
20:28:19 | FromDiscord | <sOkam!> thx beef. that was the issue |
20:29:39 | FromDiscord | <sOkam!> is there docs anywhere where each of the node kinds are described? |
20:29:56 | FromDiscord | <Elegantbeef> Nope |
20:31:25 | FromDiscord | <sOkam!> how can I learn about the topic, without just blind-guessing? |
20:32:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/macros.html#the-ast-in-nim |
20:32:02 | FromDiscord | <Elegantbeef> closest there is |
20:32:32 | FromDiscord | <Elegantbeef> `dumpTree` and `repr` |
20:32:43 | FromDiscord | <Elegantbeef> Almost like you never read my writeup on macros |
20:33:28 | FromDiscord | <sOkam!> dude, i read it 3 times |
20:33:55 | FromDiscord | <sOkam!> doesn't mean reading something makes me understand something. specially when the person is equipped with my brain 🐠 |
20:34:51 | FromDiscord | <Elegantbeef> Guess it doesnt mention `treeRepr` and the other representation procedures |
20:37:05 | * | disso-peach quit (Quit: Leaving) |
20:41:18 | * | ntat quit (Quit: Leaving) |
20:45:16 | FromDiscord | <sOkam!> yeah, but having a list of things doesn't give an explanation of each of the things. that's why i was asking if thats documented somewhere, or if its all blind-guessing from names |
20:45:39 | FromDiscord | <Elegantbeef> I do not follow |
20:47:18 | FromDiscord | <sOkam!> I can deduce that `nnkConv` is the actual node of `Conv` when the treeRepr function sends it out to the console↵but... i don't know what Conv is, I have to blindguess if its `conversation`, `convention` or `convolution` (just to give a silly dumb example) and that doesn't explain what that Convention thing is meant to be for. So I have to guess what its for, and that guess could be wrong |
20:48:23 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim second closest to that explanatation |
20:48:32 | FromDiscord | <sOkam!> like `FormalParams`. why are they `formal`. and things like that |
20:48:36 | FromDiscord | <Elegantbeef> Scroll down to tnodekind |
20:48:48 | FromDiscord | <Elegantbeef> None of that is explained anywhere |
20:48:54 | FromDiscord | <Elegantbeef> They're formal cause they're not generic |
20:49:14 | FromDiscord | <sOkam!> oh they are slightly documented there. thats definitely better than nothing, tyty |
21:21:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wME |
21:50:48 | * | Notxor quit (Remote host closed the connection) |
21:54:40 | FromDiscord | <Chronos [She/Her]> In reply to @kcvinker "Thank you. Let me": Of course! |
21:55:59 | * | advesperacit quit () |
22:36:14 | NimEventer | New Nimble package! statictea - A template processor and language., see https://github.com/flenniken/statictea |
23:05:11 | * | antranigv quit (Ping timeout: 240 seconds) |
23:26:19 | * | antranigv joined #nim |
23:53:51 | * | azimut joined #nim |
23:59:17 | * | lucasta joined #nim |