<< 26-05-2023 >>

01:17:09*derpydoo joined #nim
01:41:44FromDiscord<Nlits (Ping on reply)> sent a long message, see http://ix.io/4wIG
01:41:57FromDiscord<Rika> Lol
01:42:04FromDiscord<Elegantbeef> I've seen that sentiment a lot
01:48:55*xet7 quit (Ping timeout: 256 seconds)
01:50:39FromDiscord<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:59NimEventerNew thread by terrygils: PyPI was subpoenaed. Should Nim prepare a process in place?, see https://forum.nim-lang.org/t/10224
03:34:03NimEventerNew thread by sls1005: DLL Terms, see https://forum.nim-lang.org/t/10225
04:01:08*derpydoo quit (Ping timeout: 240 seconds)
04:18:24NimEventerNew 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:55FromDiscord<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:30FromDiscord<leorize> nope
07:02:14*advesperacit joined #nim
07:31:07FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4wJD
07:48:55*Notxor joined #nim
08:33:12FromDiscord<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:15FromDiscord<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:53FromDiscord<voidwalker> it's a very simple parse this time
08:39:38FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wJP
08:39:43FromDiscord<voidwalker> I wanna get that `value`
08:40:27FromDiscord<voidwalker> I could get the same result with string find I guess, but I wanted to make it proper with htmlparse
08:40:39FromDiscord<chmod222> Should be simple enough for a handwritten parser if XmlNode fails you
08:41:01FromDiscord<voidwalker> It's not failing me, I just have no idea how to use it, I don't know XML
08:41:10FromDiscord<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:25FromDiscord<Ras> replace `a` with `input` and `href` with `value` and stop at the first match, i guess
08:41:33FromDiscord<voidwalker> I'd like to print a representation of the xml tree so I can see what I need to get
08:41:58FromDiscord<chmod222> What does `$` give you?
08:42:12FromDiscord<chmod222> I believe it should print you the full parsed tree
08:42:21FromDiscord<voidwalker> it just prints the html again
08:42:32FromDiscord<Ras> as a side note, i've found treeform's `print` to be super useful when printing "unknown" structs etc
08:42:34FromDiscord<Ras> https://github.com/treeform/print
08:42:44FromDiscord<Ras> but i dunno if it would work here
08:46:07NimEventerNew thread by cmc: German Tax Upload in Nim with Futhark, see https://forum.nim-lang.org/t/10231
08:49:14FromDiscord<voidwalker> https://pastebin.com/raw/nU2gDys9 this is what treeform print gets me
08:49:44FromDiscord<voidwalker> headspinning
08:50:07FromDiscord<voidwalker> I'll just do strings, sigh
09:24:21PMunchvoidwalker, what's wrong with following Ras's example code?
09:26:07FromDiscord<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:05FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wKe
10:34:49FromDiscord<leorize> `sequtils.filterIt`?
10:34:52FromDiscord<Andreas> `filterIt`
10:35:08FromDiscord<Andreas> (edit) "`filterIt` ... " added ",, 2nd best"
10:35:45FromDiscord<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:52FromDiscord<sOkam!> tyty
10:40:52FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wKf
10:52:52FromDiscord<hotdog> In reply to @Ras "as a side note,": He’s working on a replacement too https://github.com/treeform/pretty
10:53:21FromDiscord<Ras> ah, good to know, thanks!
11:14:17FromDiscord<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:08FromDiscord<Ras> chmod222: "If you are going to be parsing HTML, I would rather be looking into dedicated HTML parser libraries"
11:23:25FromDiscord<Ras> std/parsexml is apparently designed to be more lenient, exactly with HTML in mind
11:23:54FromDiscord<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:16FromDiscord<kcvinker> When creating a dll file in nim, do we need a main function or DllMain ?
11:29:46FromDiscord<kcvinker> Because, my dll only shows a `NimMain` when I inspect with `dumpbin`
11:30:03FromDiscord<kcvinker> It doesn't show my exportc function name
11:31:24ntatHi. 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:00FromDiscord<kcvinker> In reply to @kcvinker "Because, my dll only": Never mind. I got it. `dynlib` did the trick.
11:35:36FromDiscord<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:14FromDiscord<mratsim> @ntat https://play.nim-lang.org/#ix=4wKn
11:38:57FromDiscord<voidwalker> which results in: https://play.nim-lang.org/#ix=4wKr
11:39:19*rockcavera joined #nim
11:39:20NimEventerNew thread by PMunch: Bloom filter comparisson, see https://forum.nim-lang.org/t/10232
11:40:45PMunchkcvinker, this might be of interest to you: https://peterme.net/dynamic-libraries-in-nim.html
11:41:03ntat<voidwalker>, <mratsim> thanks :)
11:41:39FromDiscord<voidwalker> Should this POST request data: "validator=90003f04ff2a0749db87c22db1ef7fc93e3c66de4a77e86d0e0c62912803927b&username=voidwalker&password=myPass" be in the body or multipart data type ?
11:41:46FromDiscord<kcvinker> In reply to @PMunch "<@633714482572689449>, this might be": Wow ! That's great. That's what I am searching. Thank you @PMunch
11:42:04PMunchNo problem :)
11:43:43ntatand is it the simple way to find one array in other?
11:45:37FromDiscord<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:30ntat<voidwalker> no, I'm just looking for ways to find a smaller array in a larger.
11:52:52FromDiscord<voidwalker> how do you define this in your example ?
11:53:07FromDiscord<voidwalker> how do you find a 2x2 array in a 4x3 array
11:58:03ntat<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:14ntatAnd 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:59ntatSimply trying to write a program to find a picture inside another picture.
12:03:47ntatLittle correct → Eg. for picture 640x480 I want to have 640 tuples in every COLUMN and 480 tuples in any ROW
12:04:10ntat*every ROW ;)
12:07:13FromDiscord<voidwalker> well chat GPT tells me the Rabin-Karp algorithm is a good pick for this : )
12:07:28FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wKB
12:07:33FromDiscord<voidwalker> (edit)
12:09:37ntatOMG :>
12:11:44ntatI 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:15:42PMunchvoidwalker, hmm interesting algorithm
12:16:26PMunchI've been looking at various string searching algorithms lately
12:16:43FromDiscord<voidwalker> Doesn't feel to be optimal for this scenario though
12:17:26PMunchActually 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:07ntatIn Python→PyAutoGui this function is called LocateOnScreen and it takes a screenshot and searches for another image in it.
12:22:22ntatI try to do this in Nim
12:26:01FromDiscord<Ras> In reply to @voidwalker "Should this POST request": body
12:26:28FromDiscord<voidwalker> yeah it's body, I noticed there must be content-type multipart in headers if it needs multipart
12:26:57FromDiscord<voidwalker> I think I got everything right, but now I am getting ` Connection was closed before full request has been made [ProtocolError]`
12:27:42FromDiscord<Ras> generally, the `Content-Type` header for that should be 😂
12:27:46FromDiscord<Ras> sorry, wrong clipboard
12:27:55FromDiscord<Ras> `application/x-www-form-urlencoded`
12:28:10FromDiscord<voidwalker> `flLoginHeaders["Content-Type"] = "application/x-www-form-urlencoded"↵`
12:28:14FromDiscord<voidwalker> this is what I have indeed
12:28:37FromDiscord<voidwalker> I copy pasted all the headers from firefox ;\
12:28:46FromDiscord<Ras> what's your code?
12:29:09FromDiscord<Ras> and do you have a `Content-Length` that's `len(body)`?
12:29:16FromDiscord<Ras> (edit) "and do you have a `Content-Length` ... that'sset" added "header" | "headerthat's ... `len(body)`?" added "set to"
12:29:32FromDiscord<Ras> you probably don't need all the headers, lol
12:29:57FromDiscord<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:12FromDiscord<voidwalker> yes, `flLoginHeaders["Content-Length"] = $flLoginPostData.len`
12:32:25FromDiscord<voidwalker> code is basically, do a GET request to get that validator string, and PHPSESSID (those work okay)
12:33:14FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wKD
12:33:22FromDiscord<Ras> private trackers, eh
12:33:23FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4wKD" => "https://play.nim-lang.org/#ix=4wKE"
12:34:21FromDiscord<Ras> set the `Connection` header to `close`
12:35:03FromDiscord<Ras> you also don't need `Accept-Language`, (probably) `Accept`, `Origin`, `Referer`, any of the `Sec-` headers, `TE` and `Upgrade-Insecure-Requests`
12:35:06FromDiscord<voidwalker> Same result
12:35:28FromDiscord<voidwalker> Yeah I will remove all the unnecessary ones once I figure out how to login : )
12:36:06FromDiscord<Ras> also i'm assuming phpSessId has the `PHPSESSID=` prefix, and not just the value
12:36:14FromDiscord<Ras> not related to the error you're getting, but just in case
12:36:51FromDiscord<voidwalker> yes, it is the full string
12:38:35FromDiscord<Ras> hmmmm
12:39:14FromDiscord<voidwalker> I can pm you the code/pass if you have mood to try and fix this : )
12:39:21FromDiscord<Ras> sure
12:40:38FromDiscord<voidwalker> but I can't, you are very restrictive with messages and friend requests lol
12:40:57FromDiscord<voidwalker> I should do that too, too much spam lately
12:42:36FromDiscord<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:14FromDiscord<kcvinker> How do convert a Utf16Char pointer into Utf16Char string or any string ?
14:18:38*PMunch quit (Quit: Leaving)
14:33:07FromDiscord<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:59FromDiscord<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:18FromDiscord<chmod222> It's nothing earth shattering, but I do wonder if someone else had that happen
15:11:32FromDiscord<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:53FromDiscord<michaelb.eth> In reply to @chmod222 "Does anyone else have": are you using nimlsp or nimlangserver?
15:17:31FromDiscord<chmod222> Honestly I don't know
15:18:11FromDiscord<chmod222> The VSCode config only speaks of nimsuggest
15:21:54FromDiscord<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:59FromDiscord<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:18FromDiscord<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:29FromDiscord<michaelb.eth> (edit) "utf16char," => "Utf16Char,"
15:32:31FromDiscord<Spatchler> is this where i ask for help?
15:32:39FromDiscord<michaelb.eth> In reply to @Spatchler "is this where i": it is indeed
15:34:01*xet7 quit (Quit: Leaving)
15:35:44FromDiscord<Spatchler> sent a code paste, see https://play.nim-lang.org/#ix=4wLp
15:36:54FromDiscord<kcvinker> In reply to @michaelb.eth "so if you have": Thank @michaelb.eth Let me check that.
15:38:29FromDiscord<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:35FromDiscord<michaelb.eth> (edit) "`array[1W," => "`array[W,"
15:39:14FromDiscord<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:40FromDiscord<Spatchler> In reply to @michaelb.eth "where you have `array[1..W,": that didn't work but thanks
15:40:03FromDiscord<Spatchler> In reply to @demotomohiro "I think you still": but does the converter not convert them
15:42:44FromDiscord<demotomohiro> In reply to @Spatchler "but does the converter": Your code might needs converter from array[N, int] to array[N, uint8]
15:44:28FromDiscord<Spatchler> In reply to @demotomohiro "Your code might needs": oh yeah, thanks for the help
15:45:59FromDiscord<Spatchler> its annoying that it cannot be implicitly converted
15:51:44*azimut quit (Ping timeout: 240 seconds)
16:05:08FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4wLw
16:13:33om3gaFinally 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:47FromDiscord<mratsim> In reply to @om3ga "Finally found the way": at that point you might as well use manual memory management
16:16:50om3gamratsim: I did that many times, the reason I choose nim is not to do so :)
16:18:45FromDiscord<voidwalker> Is there code in nim devel for default object values or is it just rfc for now ?
16:19:36om3gaI 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:37FromDiscord<kcvinker> How do you write a null character literal in nim ? `'\x0000` is not working.
16:20:16FromDiscord<kcvinker> Oh I see. Let me try. Thanks
16:20:34FromDiscord<kcvinker> Well I am working with wide characters
16:21:03FromDiscord<kcvinker> So on the left hand side, there is Utf16Char
16:21:29FromDiscord<kcvinker> I think if I use `'\0'`, It will be an error
16:21:45om3gamaybe '\z'?
16:21:57FromDiscord<kcvinker> Oh, let me try
16:22:14om3gaI rarely work with utf16, even with 8
16:22:44FromDiscord<kcvinker> It's resulted in an invalid character constant
16:23:45om3gaother variations: \000, \x00
16:24:46FromDiscord<kcvinker> Thanks. Let me try
16:25:53FromDiscord<kcvinker> In reply to @om3ga "other variations: \000, \x00": Both are char in nim
16:26:21FromDiscord<kcvinker> Seems like ord() is my last resort
16:27:50*xaltsc joined #nim
16:30:01om3gahttps://play.nim-lang.org/#ix=4wLA kcvinker
16:30:11FromDiscord<michaelb.eth> @kcvinker you need the null char for Utf16Char?
16:30:19FromDiscord<michaelb.eth> (edit) "@kcvinker you need the null char for ... Utf16Char?" added "type"
16:30:24FromDiscord<kcvinker> Yes
16:31:13FromDiscord<michaelb.eth> how about `const nullC = Utf16Char('\x00')`
16:35:11FromDiscord<kcvinker> In reply to @michaelb.eth "how about `const nullC": Thanks. Let me try
16:37:02FromDiscord<kcvinker> @michaelb.eth I think it will work if we add an operator overload for "=="
16:37:10FromDiscord<kcvinker> This is the result↵`Error: type mismatch: got <Utf16Char, Utf16Char>`
16:37:47FromDiscord<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:46FromDiscord<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:47NimEventerNew 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:13FromDiscord<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:25FromDiscord<michaelb.eth> (edit) "works↵↵if" => "works↵if"
17:05:46*disso-peach joined #nim
17:06:32FromDiscord<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:40FromDiscord<kcvinker> In reply to @michaelb.eth "sure, that works if": Thanks. I will check it.
17:07:28FromDiscord<sOkam!> In reply to @sOkam! "Is it possible to": @ElegantBeef to the rescue, maybe?
17:10:10FromDiscord<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:03FromDiscord<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:23FromDiscord<sOkam!> yeah, pretty much
17:24:58FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wLN
17:25:52FromDiscord<Graveflo> only way i know how to do something like that is by making the parameter untyped
17:27:06FromDiscord<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:09FromDiscord<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:08FromDiscord<demotomohiro> In reply to @sOkam! "that would mean I": How about to write a macro?
18:28:05FromDiscord<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:39FromDiscord<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:26FromDiscord<guttural666> can somebody help me escape the necessary chars in this regex: ^.["][.]$
19:07:53FromDiscord<guttural666> got this rn and it complains re"^.["][.]$"
19:08:23FromDiscord<guttural666> escaping the one dquote in there does not do it
19:08:58FromDiscord<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:23FromDiscord<kcvinker> I have a `seq[char]`. How to convert this a string /
19:09:27FromDiscord<kcvinker> (edit) "/" => "?"
19:09:37FromDiscord<Chronos [She/Her]> Can't you just cast it?
19:09:38FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1111732893673336852/image.png
19:10:00FromDiscord<kcvinker> In reply to @Hourglass, When the Hour Strikes "Can't you just cast": Thanks. Let me try
19:10:02FromDiscord<guttural666> In reply to @kcvinker "I have a `seq[char]`.": $sequence maybe?
19:10:23FromDiscord<kcvinker> What is `$sequence` ?
19:10:46FromDiscord<guttural666> $ stringyfies stuff, maybe there is an implementation for a seq[char]
19:10:51FromDiscord<Chronos [She/Her]> In reply to @guttural666 "$sequence maybe?": That just does `"@['a', 'b', 'c']"`
19:11:08FromDiscord<kcvinker> Oh I see
19:11:11FromDiscord<Chronos [She/Her]> In reply to @guttural666 "$ stringyfies stuff, maybe": And no, I'd assume that'd break the convention
19:11:47FromDiscord<Chronos [She/Her]> Strutils probably has something for it but an unsafe way of doing this is `cast[string](yourVar)`
19:12:23FromDiscord<kcvinker> In reply to @Hourglass, When the Hour Strikes "And no, I'd assume": Cast is working nicely
19:12:55FromDiscord<guttural666> In reply to @Hourglass, When the Hour Strikes "That just does `"@['a',": yeah
19:13:24FromDiscord<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:46FromDiscord<Chronos [She/Her]> `yourVar.join()`
19:14:03FromDiscord<Chronos [She/Her]> Can also change the seperator but not needed here
19:14:12FromDiscord<Chronos [She/Her]> separator
19:25:36FromDiscord<demotomohiro> Casting from `seq[char]` to string can be unsafe as string always has zero terminal but seq[char] doesn't.
19:33:56FromDiscord<guttural666> In reply to @guttural666 "": anybody familiar with std/re?
19:35:36FromDiscord<Elegantbeef> I'm familiar with telling people not to use regex, aside from that joke I've got nothing
19:37:40FromDiscord<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:51FromDiscord<kcvinker> In reply to @Hourglass, When the Hour Strikes "In strutils there is": Thank you. Let me check
19:42:29FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wMd
19:42:30FromDiscord<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:02FromDiscord<Elegantbeef> You really shouldnt be using `cast`
19:43:19FromDiscord<Elegantbeef> Why do you need `string`?
19:43:55FromDiscord<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:00om3gakcvinker, but strings are null terminated by default
19:44:08FromDiscord<kcvinker> I am using my nim dll in another programming language
19:44:14om3gawhy you need to do that manually?
19:44:33FromDiscord<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:38FromDiscord<Elegantbeef> Ok you're using your NimDLL in another language, that means you should likely expose a `cstring`
19:44:38FromDiscord<kcvinker> There is only one way to get a string from there. And it is a wchar pointer
19:44:45om3gaand when you call the function it crashes?
19:44:54FromDiscord<kcvinker> Nope
19:45:04FromDiscord<voidwalker> oh that wasn't for me
19:45:06FromDiscord<Elegantbeef> Nim string isnt a wchar pointer
19:45:14FromDiscord<kcvinker> Because I am parsing string from that ptr
19:45:16om3ga0x0000 is hexademical null for utf16
19:45:24FromDiscord<Elegantbeef> Void that's horrendous
19:45:46FromDiscord<voidwalker> dehorrendify it then pls : P
19:45:49FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4wMf
19:46:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wMg
19:46:35FromDiscord<Elegantbeef> Isnt there a query module for this though
19:49:04FromDiscord<kcvinker> Is it possible to create objects at runtime from string ?
19:49:17FromDiscord<Elegantbeef> Sure how do you think parsing works
19:49:23FromDiscord<Elegantbeef> Is it possible to create types at runtime... no
19:49:38FromDiscord<kcvinker> Oh I see
19:50:28FromDiscord<voidwalker> ` fmt"https://website.io/details.php?id={id}" & (if withFiles: "&filelist=1" else: ""))`
19:50:30FromDiscord<voidwalker> this works
19:50:53FromDiscord<voidwalker> But I don't know why I can't use an expression to return a string, inside fmt ?
19:51:00FromDiscord<kcvinker> sent a long message, see http://ix.io/4wMh
19:52:02FromDiscord<Elegantbeef> Of course
19:52:26FromDiscord<kcvinker> Where should I start @ElegantBeef ?
19:53:09FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/8BDcV
19:53:14FromDiscord<Elegantbeef> Depends on what you mean from "Getting an object from string"
19:54:09FromDiscord<kcvinker> I mean, I get a string through a function and it's in nim syntax.
19:54:35FromDiscord<kcvinker> So I parse that string and execute it
19:54:52FromDiscord<Elegantbeef> Nim is compiled to do that you'd need to use the NimVm
19:54:54FromDiscord<kcvinker> So that I can create an object from that string
19:55:08FromDiscord<kcvinker> How ?
19:55:18FromDiscord<Elegantbeef> Nimscripter is a good place to start
19:55:30FromDiscord<Elegantbeef> Though i'd still suggest using json, toml, or any other format over using nimscript
19:55:36FromDiscord<kcvinker> Great. Thanks @ElegantBeef
19:57:45FromDiscord<kcvinker> @ElegantBeef So which is the popular json parser for nim ?
19:58:06FromDiscord<Elegantbeef> There are like 6 to choose from and they all work
20:01:38FromDiscord<RatoGBM> How do I make an array of zeros all int32? `var tape: array[256, int32] = ???` but filled with zeors
20:01:49FromDiscord<RatoGBM> (edit) "tape:" => "arr:"
20:02:02FromDiscord<Elegantbeef> `var arr: array[256, int32]`
20:02:35FromDiscord<RatoGBM> I want it to be filled with zeros
20:02:54FromDiscord<Elegantbeef> Yep
20:03:27FromDiscord<RatoGBM> I would like an array of int32 numbers filled with zeros
20:03:38FromDiscord<Elegantbeef> Yes I just showed you how
20:03:47FromDiscord<Elegantbeef> Sometimes it's like pulling teeth
20:04:04FromDiscord<demotomohiro> Nim fills arrays with zero in default.
20:04:37FromDiscord<RatoGBM> In reply to @demotomohiro "Nim fills arrays with": I guess that's not why my indexing bug is happening then.
20:05:00FromDiscord<RatoGBM> `Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]`
20:05:27FromDiscord<Elegantbeef> Index out of bounds means you're indexxing out of 0..255
20:05:34FromDiscord<demotomohiro> In Nim, almost every types are initialized with zero bits in default excepts `{.noinit.}`.
20:08:19FromDiscord<RatoGBM> 🤦‍♂️ Nvm and thks, I was being redicolously stupid
20:08:34FromDiscord<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:40FromDiscord<sOkam!> is this type of thing illegal in recent versions of nim? https://media.discordapp.net/attachments/371759389889003532/1111751280050851860/image.png
20:23:22FromDiscord<Elegantbeef> Was that ever legal?
20:23:38FromDiscord<Elegantbeef> `int` is a integer so needs to be stropped there as it's a parameter name
20:24:56FromDiscord<sOkam!> how would you achieve something like this with current versions of nim? https://media.discordapp.net/attachments/371759389889003532/1111751843559772180/image.png
20:25:13FromDiscord<Elegantbeef> `arg: int`
20:26:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wMv
20:26:26FromDiscord<Elegantbeef> ...
20:26:30FromDiscord<Elegantbeef> remove the `=`
20:26:43FromDiscord<sOkam!> oh shoot
20:28:19FromDiscord<sOkam!> thx beef. that was the issue
20:29:39FromDiscord<sOkam!> is there docs anywhere where each of the node kinds are described?
20:29:56FromDiscord<Elegantbeef> Nope
20:31:25FromDiscord<sOkam!> how can I learn about the topic, without just blind-guessing?
20:32:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#the-ast-in-nim
20:32:02FromDiscord<Elegantbeef> closest there is
20:32:32FromDiscord<Elegantbeef> `dumpTree` and `repr`
20:32:43FromDiscord<Elegantbeef> Almost like you never read my writeup on macros
20:33:28FromDiscord<sOkam!> dude, i read it 3 times
20:33:55FromDiscord<sOkam!> doesn't mean reading something makes me understand something. specially when the person is equipped with my brain 🐠
20:34:51FromDiscord<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:16FromDiscord<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:39FromDiscord<Elegantbeef> I do not follow
20:47:18FromDiscord<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:23FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim second closest to that explanatation
20:48:32FromDiscord<sOkam!> like `FormalParams`. why are they `formal`. and things like that
20:48:36FromDiscord<Elegantbeef> Scroll down to tnodekind
20:48:48FromDiscord<Elegantbeef> None of that is explained anywhere
20:48:54FromDiscord<Elegantbeef> They're formal cause they're not generic
20:49:14FromDiscord<sOkam!> oh they are slightly documented there. thats definitely better than nothing, tyty
21:21:49FromDiscord<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:40FromDiscord<Chronos [She/Her]> In reply to @kcvinker "Thank you. Let me": Of course!
21:55:59*advesperacit quit ()
22:36:14NimEventerNew 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