<< 15-10-2022 >>

00:00:07FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbg
00:00:34FromDiscord<Elegantbeef> Are you sure your file is open, are you sure you're not reading outside of the string or file
00:00:45FromDiscord<Elegantbeef> Are you sure your string is intialised
00:00:49FromDiscord<sOkam!> how can i check for those?
00:01:11FromDiscord<sOkam!> In reply to @Elegantbeef "Are you sure your": does readFile initialize the string on asignment?
00:01:59FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbi
00:02:21FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4dbi" => "https://play.nim-lang.org/#ix=4dbj"
00:03:47FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4dbj" => "https://paste.rs/hAK"
00:05:52FromDiscord<Patitotective> In reply to @sOkam! "What can this type": send some code
00:06:05FromDiscord<sOkam!> its a bit complex, which is why i didn't. but will do
00:15:37FromDiscord<sOkam!> This is the code for the error. Tried to condense it a bit, but its a lot anyway. Sry about that↵https://dpaste.com/HNG6BE6U9
00:16:04FromDiscord<Elegantbeef> What is line 91?
00:16:06FromDiscord<sOkam!> If you see some lib import missing, the are actually in the files
00:16:23FromDiscord<sOkam!> The output of compiling?
00:16:35FromDiscord<Elegantbeef> `proc decodeTga(data: string): Tga =`
00:16:35FromDiscord<Elegantbeef> you dont do `new result`
00:16:38FromDiscord<Elegantbeef> QED
00:17:05FromDiscord<sOkam!> I thought result exists by default without creating it 🤔
00:17:13FromDiscord<Elegantbeef> It's a ref type
00:17:17FromDiscord<Elegantbeef> You need to heap allocate the memory
00:17:21FromDiscord<sOkam!> ah kk
00:18:05FromDiscord<sOkam!> `result = new result`?
00:18:11FromDiscord<Elegantbeef> `new ressult`
00:19:11FromDiscord<sOkam!> ah yeah, that fixes that issue. tysm!
00:30:26FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbp
00:30:31FromDiscord<Elegantbeef> > index out of bounds, the container is empty
00:30:47FromDiscord<sOkam!> I can read
00:31:01FromDiscord<sOkam!> I wouldn't ask if I understood what that means
00:31:14FromDiscord<Elegantbeef> It means you're attempting to index out of the range of the collection
00:31:28FromDiscord<Elegantbeef> It's a defect cause it's supposed to be handled in logic and not try except
00:32:48FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbq
00:33:35FromDiscord<sOkam!> if that's not the problem, I don'
00:33:45FromDiscord<sOkam!> (edit) "don'" => "don't understand where the issue is coming from"
00:34:53FromDiscord<auxym> the full stacktrace should tell you where the error is from
00:35:18FromDiscord<sOkam!> it doesn't, else I wouldn't be asking
00:36:02FromDiscord<sOkam!> Oh, nvm, it does. it points to that for loop line
00:36:18FromDiscord<sOkam!> and how is that out of range? 🧩
00:37:11FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbr
00:38:14FromDiscord<Elegantbeef> How is `width` and `height` calculated?
00:38:20FromDiscord<sOkam!> comes from the header
00:38:46FromDiscord<sOkam!> the size of the image is 64x64, and its being read correctly. checked with some echos and it prints 64 correctly
00:38:55FromDiscord<Elegantbeef> So that code clearly isnt the index error
00:39:04FromDiscord<Elegantbeef> Index errors require indexing
00:40:13FromDiscord<Elegantbeef> That's all error
00:40:17FromDiscord<Elegantbeef> you do not set the result
00:40:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dbs
00:40:35FromDiscord<sOkam!> oh the same as before
00:40:54FromDiscord<sOkam!> kk, never handled ref types before, so I guess the whole file is gonna be full of them
00:41:03FromDiscord<Elegantbeef> This isnt even a ref issue
00:41:04FromDiscord<Elegantbeef> it's a seq issue
00:41:16FromDiscord<sOkam!> what's the diff?
00:41:18FromDiscord<Elegantbeef> you're doing `[i]` without doing `result = newSeq[T](size)`
00:51:34FromDiscord<! Nilts> How would i turn an array of hex colors into a png in nim?
00:53:24FromDiscord<exelotl> Use nimPNG: https://github.com/jangko/nimPNG
00:58:04FromDiscord<! Nilts> In reply to @exelotl "Use nimPNG: https://github.com/jangko/nimPNG": how would i install it?
00:58:21FromDiscord<! Nilts> oops.
00:58:22FromDiscord<! Nilts> nvm
00:58:26FromDiscord<! Nilts> is there docs
01:08:46FromDiscord<exelotl> The docs are pretty minimal but what you probably want is encodePNG32 or encodePNG24 ?
01:10:20FromDiscord<! Nilts> ok
01:10:27FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbv
01:10:45FromDiscord<exelotl> Oh wait there's savePNG32 and savePNG24, they will take care of writing the file for you
01:11:13FromDiscord<exelotl> Without those you have to set up a stream and call writeChunks
01:17:23FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbx
01:18:51FromDiscord<Elegantbeef> Dont know
01:19:41FromDiscord<Patitotective> dont tell me that :[
01:20:28FromDiscord<! Nilts> Im banging my head now with a different problem. Converting binary 2 string is corrupting my bytes! how do i just get a hex rep of a binary file!.
01:20:42FromDiscord<Elegantbeef> You do have overloads that are intersections
01:20:50FromDiscord<Elegantbeef> `var List` and `var seq` are intersections
01:21:55FromDiscord<Elegantbeef> For my VM interop this is basically all i do https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim#L8-L40
01:21:57FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dby
01:22:24FromDiscord<! Nilts> In reply to @not logged in "Im banging my head": is there somewhere else i should ask this?
01:26:16FromDiscord<Patitotective> In reply to @Elegantbeef "For my VM interop": difference is that i have three types to decode from
01:26:31FromDiscord<Elegantbeef> It's the same thing
01:28:16FromDiscord<Patitotective> :|
01:28:27FromDiscord<Elegantbeef> I dont see why having 3 types changes anything
01:30:23FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbA
01:31:09FromDiscord<Elegantbeef> I dont know why you're providing APIs for anything but the primitives
01:31:33FromDiscord<Elegantbeef> Implement the primitives in this module, then implement the non primitive stdlib implementations
01:38:04NimEventerNew thread by Nlits: How do I turn binary file data into hex representation , see https://forum.nim-lang.org/t/9531
01:39:58FromDiscord<sOkam!> Is it possible to add a variable to the string contents of an exception message?↵Last attempt I tried said something about & potentially raising an exception too, and complained↵Is there a way to do it that doesn't create issues?
01:47:25FromDiscord<Patitotective> In reply to @sOkam! "Is it possible to": `except Exception as error: error.msg.add "huh"` (?)
01:47:48FromDiscord<Elegantbeef> what?
01:48:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dbC
01:50:45FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbD
01:51:01FromDiscord<Elegantbeef> `import std/strformat`
01:51:17FromDiscord<Elegantbeef> `fmt"Unsupported TGA data type {myVar}"`
01:51:28FromDiscord<sOkam!> oh fmt doesn't create exception?
01:51:38FromDiscord<sOkam!> I tried with &, and it complained
01:51:39FromDiscord<Patitotective> what exception?
01:51:55FromDiscord<sOkam!> I don't remember, but it complained when I tried the obvious formatted string
01:51:59FromDiscord<sOkam!> which is why i asked
01:52:08FromDiscord<Patitotective> well, it should work with `&`
01:52:12FromDiscord<Elegantbeef> fmt shouldnt raise an exception
01:52:18FromDiscord<Elegantbeef> They're string operations
01:52:30FromDiscord<sOkam!> should, but didn't. so made me think I was doing something incorrect
01:52:52FromDiscord<sOkam!> (edit) "should, but didn't. so made me think I was doing something incorrect ... " added "by using strformat"
01:54:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbE
01:54:29FromDiscord<Elegantbeef> So handle that excepption?
01:55:06FromDiscord<sOkam!> so its not obvious how?
01:55:30FromDiscord<sOkam!> ive never used exceptions in my life, don't assume I know as much as you do
01:55:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dbF
01:56:04FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#exception-handling
01:56:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#exceptions
01:57:09*arkurious quit (Quit: Leaving)
02:17:12FromDiscord<Patitotective> In reply to @Elegantbeef "Implement the primitives in": in the same module, right?
02:17:50FromDiscord<Elegantbeef> Doesnt have to be
02:33:29FromDiscord<Patitotective> this is getting too big https://media.discordapp.net/attachments/371759389889003532/1030669713933606983/unknown.png
02:36:38FromDiscord<ChocolettePalette> Just merge them into a single file "useful functions.nim"
02:38:26FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbH
02:38:50FromDiscord<Elegantbeef> Why include
02:39:06FromDiscord<Patitotective> annoys you more
02:39:13FromDiscord<Elegantbeef> ah
02:54:57FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbK
02:55:23FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=4dbK" => "https://play.nim-lang.org/#ix=4dbL"
03:10:59FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dbO
03:11:09FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4dbO" => "https://play.nim-lang.org/#ix=4dbP"
03:11:23FromDiscord<Elegantbeef> that's correct, and you dont nee `@`
03:11:36FromDiscord<Elegantbeef> you can just do `if myVal notin validTypes`
03:11:49FromDiscord<sOkam!> `notin`, kk
03:20:20FromDiscord<Rika> In reply to @Elegantbeef "that's correct, and you": It isn’t
03:20:42FromDiscord<Rika> Not int in container would bitwise invert the int and check that if it’s in the container no?
03:21:07FromDiscord<Elegantbeef> !eval echo not 10 in [10]
03:21:13NimBotfalse
03:22:06FromDiscord<Elegantbeef> !eval echo not -11 in [10]
03:22:10NimBottrue
03:22:20FromDiscord<Rika> Lol
03:29:09FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dbT
03:29:17FromDiscord<Elegantbeef> Congrats
03:29:39FromDiscord<Patitotective> my life is done
03:29:50FromDiscord<Elegantbeef> You now can move to a more sane format
03:31:10FromDiscord<Rika> Released from hell
03:31:31FromDiscord<Patitotective> after all this intellectual effort im not going to change kdl
03:34:09FromDiscord<Patitotective> In reply to @Elegantbeef "You now can move": or grow along kdl to a saner version of ourselves
03:34:11FromDiscord<Patitotective> 🌃
03:35:26FromDiscord<Rika> In reply to @Patitotective "or grow along kdl": Doubt
04:40:13NimEventerNew Nimble package! tabcompletion - stdin tab completion library, see https://github.com/z-kk/tabcompletion
06:43:45*rockcavera quit (Remote host closed the connection)
06:48:44*fallback quit (Ping timeout: 268 seconds)
06:49:00*rb quit (Ping timeout: 264 seconds)
07:33:24*rwb joined #nim
07:38:05*Guest7 joined #nim
07:38:30*Guest7 quit (Client Quit)
07:41:42*LuxuryMode joined #nim
07:59:13*jjido joined #nim
08:12:37*fallback joined #nim
08:12:43FromDiscord<Phil> Self-answered SO question incoming, basically me copy pasting the thread I opened on the nim forum about how to unroll a for-loop over a compile-time-seq over to SO because I can just find things easier on SO
08:13:00FromDiscord<Phil> (edit) "SO" => "SO."
08:13:07NimEventerNew question by Philipp Doerner: How to iterate over a compile-time seq in a manner that unrolls the loop?, see https://stackoverflow.com/questions/74077788/how-to-iterate-over-a-compile-time-seq-in-a-manner-that-unrolls-the-loop
08:19:10FromDiscord<Rika> Plagiarism smh
08:19:20FromDiscord<Rika> Oh you opened it :inatehe:
08:26:16FromDiscord<Phil> I typically don't understand other people's question well enough to transform them into an SO question 😛
08:29:11FromDiscord<4zv4l> are `case of` comptime ?
08:29:34FromDiscord<Elegantbeef> case statements require constants for the branches
08:29:48FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4dcx
08:29:59FromDiscord<Elegantbeef> Nim's case statements only support ordinals
08:30:03FromDiscord<Elegantbeef> on top of it
08:30:25FromDiscord<4zv4l> so I have to use if else ?
08:30:30FromDiscord<Elegantbeef> Yes
08:31:50FromDiscord<4zv4l> alright xD thanks !
08:32:57FromDiscord<mantielero (mantielero)> Quick question\: using the following is not feasible, is it?↵\`\`\`nim
08:33:40FromDiscord<Elegantbeef> No nested openarrays are not valid
08:33:59FromDiscord<mantielero (mantielero)> Thanks
08:39:09FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4dcB really made me make some funny code↵(@Phil)
08:39:28FromDiscord<Elegantbeef> Eh shit i'll do it properly
08:43:30FromDiscord<Phil> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4dcB really made me": ?↵Want to provide a third way to unroll loops on compile-time seqs?
08:43:40FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4dcC here we go, the real final way
08:45:22FromDiscord<Phil> What's name and body for?
08:45:39FromDiscord<Elegantbeef> To get the AST of the nodes
08:46:03FromDiscord<Phil> But do I throw in the seq into nameP? Is that the body of the variable that gets the seq value put into it?
08:46:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dcD
08:46:18FromDiscord<Phil> (edit) removed "body of the"
08:48:25FromDiscord<Elegantbeef> It unrolls iterators more than anything else
08:48:37FromDiscord<Elegantbeef> As such it's very reusable
08:50:23FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4dcF
08:55:03FromDiscord<Phil> Added it to the SO response
08:55:53FromDiscord<Elegantbeef> probably `x.items`
08:55:57FromDiscord<Elegantbeef> But yes
09:18:31*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:36:08FromDiscord<Phil> For reference, ORC was the GC for nim 2.0 right?
09:43:04FromDiscord<Rika> I believe so yes
10:07:11*kenran joined #nim
10:07:15*kenran quit (Remote host closed the connection)
10:17:46FromDiscord<Phil> Beef! Question
10:17:58FromDiscord<Rika> You should just ask it
10:21:17FromDiscord<ringabout> In reply to @Isofruit "For reference, ORC was": True, 2.0 is coming in one or two month.
10:21:22FromDiscord<ringabout> (edit) "month." => "months."
10:21:29FromDiscord<ringabout> (edit) "In reply to @Isofruit "For reference, ORC was": True, ... 2.0" added "and"
10:21:37FromDiscord<Phil> Say I have a string "bhfrhjjh {% instruction somefilepathstring %} ezubsdhh" known at compile time.↵How can I replace, at compile time, the symbol somefilepathstring with the actual value inside of it before another parser at compile time goes over the string and tries to turn the expression in between {%%} into Nim code?
10:22:02FromDiscord<Phil> (edit) ""bhfrhjjh" => "`"bhfrhjjh" | "ezubsdhh"" => "ezubsdhh"`"
10:26:00*TrueBlue[m] quit (Read error: Connection reset by peer)
10:26:03*reversem3[m] quit (Read error: Connection reset by peer)
10:28:11FromDiscord<ringabout> You can iterate over the existing string to generate a new string at compile time.
10:30:21*reversem3[m] joined #nim
10:40:09*jmdaemon quit (Ping timeout: 252 seconds)
10:41:41FromDiscord<Phil> O.O... Right! That might actually be a workable minimal hack for my problem.↵Well at least it means only hacky code in my package.↵↵Read in the nimja file before nimja, replace the variables with their actual strings and hand only that modified string over to nimja for parsing
10:41:42*TrueBlue[m] joined #nim
10:42:55FromDiscord<Phil> Wait.. shit, no. Unless I completely copy how nimja reads in templates and templates within those templates I'm still screwed
10:43:10FromDiscord<Phil> Which is a lot of work again, dangit!
11:57:22FromDiscord<ezquerra> If you define operator `+` for a type, do you automatically get the corresponding operator `+=`? I thought it would but it does not seem to be the case...
12:02:25FromDiscord<Rika> you do not
12:03:42FromDiscord<Rika> i guess you can make it so by `proc +=[T](a: var T; b: T) = a = a + b` ofc with the correct backticks
12:04:04FromDiscord<Rika> but i think in general its not desirable
12:04:22FromDiscord<ezquerra> Why not?
12:10:03FromDiscord<Rika> actually, hm
12:10:33FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=4ddQ
12:10:44FromDiscord<Rika> In reply to @Rika "i guess you can": `proc +=[T, U](a: var T; b: U) = a = a + b` allows for more "flexibility" since sometimes you have a + that takes two different types
12:10:51FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=4ddQ" => "https://paste.rs/2VP"
12:11:00FromDiscord<Rika> as long as + is +(T, U): T
12:11:47FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=4ddT" => "https://paste.rs/riw"
12:24:39*arkurious joined #nim
12:32:31*derpydoo joined #nim
12:40:19FromDiscord<jos> is there a way to trivially compile nim to wasm
12:40:27FromDiscord<jos> like without installing a third party toolchain or something
12:43:18FromDiscord<auxym> mostly using emscripten afaik. eg: https://github.com/beef331/wasm3
12:46:16FromDiscord<jos> thanks i'll try that
13:07:57FromDiscord<Rika> emscripten is "a third party toolchain"
13:09:07FromDiscord<Horizon [She/Her]> In reply to @jos "thanks i'll try that": There's also nlvm, which is just Nim but generates LLVM directly
13:09:32FromDiscord<Horizon [She/Her]> https://github.com/arnetheduck/nlvm
13:09:59FromDiscord<Horizon [She/Her]> In reply to @jos "like without installing a": Also, if you already have clang installed, it's possible to use that to generate WASM
13:11:20FromDiscord<Horizon [She/Her]> Nim likely never will have native WASM support though since really, it's not needed, since it uses a C (or C++) compiler (like emscripten and clang), and those can already output WASM↵↵As in, compilers exist for C and C++ to compile it to WASM
13:16:34FromDiscord<jos> with WASI coming around it would be nicer than using emscripten
13:17:42FromDiscord<jos> i think that would unlock more execution environments too
13:18:01FromDiscord<jos> since emscripten generates js shims, it basically only works in the browser or node, or something with a js runtime too
13:18:24FromDiscord<jos> but with wasi you can embed wasm modules in say, your own application for scripting support, without a js runtime
13:18:42FromDiscord<jos> not sure how accurate all that is but it's my understanding
13:19:04FromDiscord<jos> nvm emscripten supports wasi now too
13:26:12FromDiscord<auxym> In reply to @flywind "True, and 2.0 is": Is it really? Would be nice to get an official heads up with final list of breaking changes. Last I checked there was still a bunch of open RFCs with ongoing discussion about which breaking changes should make it into 2.0
13:36:25FromDiscord<ringabout> Breaking changes are always documented in the changelog.
13:36:52FromDiscord<ringabout> https://github.com/nim-lang/Nim/blob/devel/changelog.md#changes-affecting-backward-compatibility
13:44:57FromDiscord<Phil> Wait a sec, I thought the correct way to raise an exception is raise stuff with the error suffix. Isn't defect suffix only for when you want to program to crash if this is encountered? Why does error get deprecated?
13:47:15FromDiscord<Rika> what do you mean
13:47:59FromDiscord<Rika> raising stuff with the error suffix (that are aliased to defect) is equivalent to raising stuff with the defect suffix
13:48:08FromDiscord<Rika> they were aliased for compat. reasons
13:48:53FromDiscord<Rika> "but i wanted to avoid the dialect fracture" you cannot i believe
13:51:43*CyberTailor joined #nim
13:51:52*CyberTailor left #nim (#nim)
14:01:00FromDiscord<Phil> Ah, the defect aliases get deprecated, but a bunch of errors in general. I think I just didnt parse the sentence as such
14:01:15FromDiscord<Phil> (edit) "but" => "not"
14:02:18FromDiscord<Horizon [She/Her]> Question: What's the appropriate way to represent literals in Nim?
14:02:38FromDiscord<Phil> ?
14:03:17FromDiscord<Horizon [She/Her]> The code here is written in Java and uses the `Object` type to represent literals in Nim, idk how to handle them: https://craftinginterpreters.com/representing-code.html#:~:text=expression%22%2C%0A%20%20%20%20%20%20%22-,Literal%20%20%3A%20Object,-value%22%2C
14:04:29FromDiscord<Phil> Sorry I just dropped off from sports so a bit slow right now, so literally just representing strings known at compile time only need within a module?
14:04:46FromDiscord<Phil> Or is this about string interpolation
14:05:48FromDiscord<Horizon [She/Her]> Dw! I'm making an interpreter and currently on the part about representing the AST, I'm trying to figure out how to store them like CI is talking about
14:05:54FromDiscord<Horizon [She/Her]> I think that makes sense?
14:06:56FromDiscord<Horizon [She/Her]> I'll figure this out later actually
14:10:58*kenran joined #nim
14:12:37FromDiscord<Phil> I think right now I'm not at capacity to actually properly even understand the question 😅
14:13:32FromDiscord<Horizon [She/Her]> Fair enough, i'm probably rambling a bit too haha
14:24:46FromDiscord<Phil> Mostly because I see string literal, I immediately think "why not just put it in a const?"↵Thus I'm not understanding the "representation" aspect of it
14:25:11FromDiscord<Phil> I'm reasonably sure you're not after variable assignment, but can't imagine what else, thus perplexion
14:26:06*derpydoo quit (Quit: derpydoo)
14:49:37*PMunch joined #nim
15:30:47FromDiscord<auxym> @Horizon [She/Her] use a variant object, like the nim compiler itself does? nnkStringLiteral, nnkIntLiteral, etc. Each variant kind has a field with the value of appropriate type.
15:31:22FromDiscord<auxym> If you want more inspiration, you can search github for nim implementations of lox / crafting interpreters, there are a few out there
15:34:21FromDiscord<auxym> I'm pretty that writing compilers/parsers/ASTs is the main reason Araq included variant objects in the language 😛
15:36:07FromDiscord<Horizon [She/Her]> Ah fair lol
15:36:24FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=4dfc
15:36:38FromDiscord<Bung> (edit) "https://play.nim-lang.org/#ix=4dfc" => "https://play.nim-lang.org/#ix=4dfd"
15:36:44FromDiscord<Bung> (edit) "https://play.nim-lang.org/#ix=4dfd" => "https://play.nim-lang.org/#ix=4dfe"
15:44:27*strogon14 left #nim (Und tschüss!)
16:03:57FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4dfr
16:25:57FromDiscord<Patitotective> In reply to @Rika "Doubt": dont mind me, i was alienated
16:26:09FromDiscord<Patitotective> (edit) "In reply to @Rika "Doubt": dont mind me, i was alienated ... " added "because it was bedtime"
16:27:40FromDiscord<jos> sent a code paste, see https://play.nim-lang.org/#ix=4dfC
16:28:19*jmdaemon joined #nim
16:36:01*xet7 joined #nim
16:48:49FromDiscord<qb> mh I'm confused. https://play.nim-lang.org/#ix=4dfK
16:51:40*jjido joined #nim
16:58:26PMunch@qb, what confuses you?
17:00:05PMunchAh, never mind, I see where you got confused
17:00:35PMunchWhen you set your pixel you only use the x coordinate, try this instead: https://play.nim-lang.org/#ix=4dfO
17:01:41PMunchOr this, if you want an actual 2D array without doing the math yourself: https://play.nim-lang.org/#ix=4dfS
17:01:55PMunchThe data is stored exactly the same in memory either way
17:04:33FromDiscord<SREagle> nice to know, the 2nd looks more intuitive, I would probably have used the 1st approach, since I do so in other languages, Thx for the example!
17:06:41FromDiscord<qb> In reply to @PMunch "Or this, if you": Yea I got it. But thats even better
17:08:35FromDiscord<Scoobery Doobery> sent a code paste, see https://play.nim-lang.org/#ix=4dfV
17:09:19FromDiscord<Scoobery Doobery> (edit) "https://play.nim-lang.org/#ix=4dfV" => "https://play.nim-lang.org/#ix=4dfW"
17:09:56FromDiscord<Scoobery Doobery> I omitted the contents of `draw` for clarity. It seems like `FnPtr` aliases a `func` correctly, but the compile error convinces me that's not the case
17:10:50FromDiscord<Scoobery Doobery> Since `func` isn't allowed in type descriptions, I can't specify that for my `FnPtr` type
17:14:19PMunch@Scoobery_Doobery, not quite sure, this seems to work fine: https://play.nim-lang.org/#ix=4dg0
17:15:04FromDiscord<Scoobery Doobery> On the latest as well. Damn.
17:15:19FromDiscord<Scoobery Doobery> Must be some other package I imported or something. Urgh
17:15:21PMunchHuh?
17:15:35FromDiscord<Scoobery Doobery> I just mean we're both on the latest versions of Nim
17:15:36PMunchTry to create a minimal sample you can shar
17:15:39PMunchshare*
17:16:05PMunchOh right, the playground should automatically update to always be the latest version
17:16:13PMunchCurrently it's running 1.6.8 I believe
17:19:56FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dg3
17:20:47PMunchHmm, hard to tell without seeing how it's used
17:21:19PMunchTypically I'd expect node.len to return node.children.len, but without any context for how this is to be used it's hard to tell if that would be intuitive or not
17:21:46PMunch(If you've provided context elsewhere I'm sorry, just joined the channel :))
17:22:30FromDiscord<Scoobery Doobery> Not sure what was up with my code before, but rewriting it differently seems to have got rid of the error. Still, I have no clue what I did wrong initially lmao
17:23:56PMunchMight been a silly typo somewhere
17:24:00PMunchThose can be hard to miss :P
17:24:11PMunchEasy to miss* hard to spot*
17:24:20FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dg5
17:24:23FromDiscord<Patitotective> https://kdl.dev
17:24:32FromDiscord<qb> So another task which I wanna do now with this matrix is to get a rectangle 1010 from the center of it. Can't I just slice it that way? https://play.nim-lang.org/#ix=4dg4
17:31:35PMunchHmm, yeah in that case I think what you proposed would make sense
17:31:47PMunchWell, it depends on what's most commonly used I guess
17:33:06*wallabra quit (Ping timeout: 260 seconds)
17:35:03PMunchHmm, or maybe it's better to be explicit. Look at the nested child nodes for example
17:35:19PMunchWhat would you expect `section[0]` to be?
17:35:26PMunchOr `section.len` for that matter
17:41:10*jjido quit (Ping timeout: 268 seconds)
17:41:12*wallabra joined #nim
17:44:43PMunchHmm, I was going to write a BME280 library for Ratel, mostly to test if my USI implementation of I2C for the ATTiny85 was correct
17:44:53PMunchBut that sensor is complex..
17:47:54*derpydoo joined #nim
18:10:29PMunchHmm, and here I was thinking I could get some simple Hacktoberfest PRs in..
18:14:04FromDiscord<Patitotective> In reply to @PMunch "Hmm, yeah in that": i think ill just keep the most intuitive ones which i think are `node["key"]`, `node["key"]=` and `node.add` since it can have two overloads for `KdlNode` (add to children) and `KdlVal` (add to args)↵`node[0]` and `node.len` can be confused with arguments and children↵:]
19:07:17*derpydoo quit (Ping timeout: 250 seconds)
19:07:34*kenran quit (Remote host closed the connection)
19:07:57PMunchHmm, I'm creating enums for the settings for the BME280, anyone got some good names for the settings in Table 27? https://www.mouser.com/datasheet/2/783/BST-BME280-DS002-1509607.pdf
19:08:18PMunchSection 5.4.6, page 30
19:15:01FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dgH
19:16:38PMunchHmm, removing the T but otherwise those are fine I guess
19:16:46FromDiscord<Patitotective> wonder if you could make a `range[0.25, 62.5, 125, 250, 500, 1000, 10, 20]`
19:16:55FromDiscord<Patitotective> (edit) "wonder if you could make a `range[0.25, 62.5, 125, 250, 500, 1000, 10, 20]` ... " added "or w/e"
19:17:01PMunchI was considering ms or us though..
19:17:05FromDiscord<auxym> I sometimes prefix the unit for stuff like that
19:17:16PMunchYeah that's what I was thinking
19:17:23FromDiscord<auxym> so ms05, etc
19:17:30FromDiscord<auxym> or us500 i guess
19:17:57FromDiscord<auxym> and I tend to use {.pure.}
19:18:20PMunch`type StandBy = enum us500, us62500, ms125, ms250, ms500, ms1000, ms10, ms20`
19:18:26PMunchSomething like that?
19:18:49*derpydoo joined #nim
19:18:50PMunchDoes pure really do anything nowadays though?
19:19:10FromDiscord<Patitotective> you gotta always do `StandBy.us500` afaik
19:19:21PMunchThat was how they used to work
19:19:26PMunchBut that was removed quite a while ago
19:19:47PMunchAnd about the range thing, I would assign the values that I need to write the register as the value for the enum
19:20:23PMunchAh, but you wanted to be able to write 0.5 and it auto-converted to 001 I guess
19:21:35PMunchI guess I could use custom numeric literals: https://nim-lang.org/docs/manual.html#numeric-literals-custom-numeric-literals
19:21:59PMunchAnd have something like 0.26'ms
19:22:23PMunchOr 0.5'sbt (short for stand-by time)
19:24:01PMunchOr of course a `converter toStandByTime(x: static[SomeNumber]): StandBy = <Conversion logic>`
19:24:57FromDiscord<Patitotective> i think using custom numeric literals would be really neat
19:25:02FromDiscord<Patitotective> idiomatic
19:42:10PMunch@Patitotective, something like this? https://play.nim-lang.org/#ix=4dgJ
19:42:18PMunchDoesn't handle 62.50 though :P
19:47:53PMunchNot sure if I can import strutils on a microcontroller though..
19:52:41FromDiscord<Patitotective> @PMunch https://play.nim-lang.org/#ix=4dgN
19:52:55FromDiscord<Patitotective> could also use `parseEnum`
19:54:59PMunchHmm, yeah that works I guess
20:07:07FromDiscord<halc> little question, if I slice a view type with `someView[a..b]`, will that make a copy? Or should I use `toOpenArray` again?
20:07:16FromDiscord<halc> (edit) "again?" => "again to prevent that?"
20:10:07FromDiscord<Generic> the latter
20:10:21FromDiscord<halc> I see
20:10:32FromDiscord<Generic> slicing returns a seq, so it copies
20:15:45PMunch@Patitotective, this works
20:19:38*PMunch quit (Quit: leaving)
20:20:50FromDiscord<Patitotective> In reply to @PMunch "<@762008715162419261>, this works": forgot the link?
20:49:59*derpydoo quit (Ping timeout: 250 seconds)
21:05:56*derpydoo joined #nim
21:06:46FromDiscord<auxym> In reply to @PMunch "But that was removed": Wow, I was not even aware of that. Too bad, I kind of prefer qualifying enums most of the time
21:07:16FromDiscord<Patitotective> In reply to @auxym "Wow, I was not": related https://github.com/nim-lang/Nim/issues/8066
21:11:16*wallabra quit (Ping timeout: 260 seconds)
21:13:25*wallabra joined #nim
21:22:34FromDiscord<halc> how do I make an `openArray[char]` into a new `string`?
21:27:47FromDiscord<auxym> hm, not sure there's a way without copying with a loop, or copymem
21:29:55FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4dhb
21:32:00*clemens3 joined #nim
21:32:31FromDiscord<halc> fair enough
21:33:55*clemens3 left #nim (#nim)
21:34:12FromDiscord<Patitotective> damn, decoding object variants is really tricky↵the code looks so messy↵https://github.com/Patitotective/kdl-nim/blob/devel/src/kdl/decoder.nim#L101
21:34:23FromDiscord<dizzyliam> or `strutils.join`
21:35:56FromDiscord<dizzyliam> as in `stringy = arrayOfChars.join("")`
21:36:04FromDiscord<dizzyliam> probably slower but a nice one-liner
21:36:40FromDiscord<Patitotective> In reply to @karma_corrections "probably slower but a": the implementation does look slower
21:36:51FromDiscord<Patitotective> (edit) "In reply to @karma_corrections "probably slower but a": the implementation does ... look" added "not"
21:37:06FromDiscord<Patitotective> In reply to @karma_corrections "as in `stringy =": `arrayOfChars.join()` is enough :]
21:37:28FromDiscord<Patitotective> In reply to @Patitotective "the implementation does not": https://github.com/Patitotective/kdl-nim/blob/devel/src/kdl/decoder.nim#L101
21:37:31FromDiscord<dizzyliam> good point
21:37:35FromDiscord<Patitotective> (edit) "https://github.com/Patitotective/kdl-nim/blob/devel/src/kdl/decoder.nim#L101" => "https://github.com/nim-lang/Nim/tree/version-1-6/lib/pure/strutils.nim#L1772"
22:06:58FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dhj
22:19:05FromDiscord<Patitotective> am i doing something wrong?
22:19:06FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dhm
22:19:56FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=4dhm" => "https://play.nim-lang.org/#ix=4dhn"
22:20:38FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dho
22:26:51FromDiscord<jos> how does the acyclic pragma work if you have a tree, for example, which is acyclic except it can contain userdata-- and there's no guarantee that userdata may contain a node in the tree
22:27:06FromDiscord<jos> is there a strategy for something like that
22:27:53FromDiscord<Elegantbeef> The pragma tells the compiler the structure does not ever reference itself
22:28:07FromDiscord<Elegantbeef> You could use a `{.cursor.}` but that means you have to be sure about ownership
22:33:01FromDiscord<qb> `random.nim(325, 10) `x.a <= x.b` [AssertionDefect]`
22:33:25FromDiscord<qb> whats exactly the issue there?
22:33:35FromDiscord<Elegantbeef> Slices should be `low..high`
22:35:56*derpydoo quit (Ping timeout: 268 seconds)
22:51:02FromDiscord<40yd> sent a code paste, see https://play.nim-lang.org/#ix=4dhz
22:58:47FromDiscord<Phil> In reply to @40yd "Hi, I'm new to": Do all your intended procedures have the exact same signature?
23:01:25FromDiscord<Phil> Like, same parameter types in the same order?
23:28:34FromDiscord<40yd> Thx reply:) no, listener object could be different types like, Dog type, Cat type, Fox type(each type has different callback proc name)
23:28:54FromDiscord<40yd> In reply to @Isofruit "Do all your intended": Thx reply:) no, listener object could be different types like, Dog type, Cat type, Fox type(each type has different callback proc name)
23:34:51FromDiscord<Phil> That might turn into a problem, if you want to store them together in a seq or table or sth. They need to be of the same type. The only alternative you have that I'm aware of is object variants, which are only an option if the number of different procs is limited
23:42:29FromDiscord<40yd> In reply to @Isofruit "That might turn into": ic, so if i put pre-defined Types to enum, it might be possible. I'll try it:)
23:42:35FromDiscord<Require Support> anyone familiar on how to create async named pipes on windows using nim?