<< 05-02-2023 >>

00:00:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n9O
00:38:59FromDiscord<Elegantbeef> I believe so
00:38:59FromDiscord<Elegantbeef> Well you need to pipe the event in @Phil
00:45:04FromDiscord<ElegantBeef> Bridge will ping you again in a second but alas
00:45:07FromDiscord<Elegantbeef> Cause you should be able to do `clicked = myProc`
00:45:08FromDiscord<Elegantbeef> This is mostly redundant though
00:45:08FromDiscord<Elegantbeef> Nevermind that's wrong
00:45:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4na0
00:45:39*azimut joined #nim
00:46:26FromDiscord<ElegantBeef> the `view` method is practically the builder for the gui so you can just make GUIs inside there and it'll generate them as you expect
00:46:42FromDiscord<ElegantBeef> So to make your own widget it's practically just make a new `viewable` give it the fields then generate the gui inside `view`
01:12:15*Guest22 joined #nim
01:33:36*Guest22 quit (Quit: Client closed)
04:24:13*ltriant joined #nim
04:28:46*arkurious quit (Quit: Leaving)
04:28:55*ltriant quit (Ping timeout: 252 seconds)
05:35:53FromDiscord<ricky> why does nim lsp break randomly bros 😔
05:36:17FromDiscord<Elegantbeef> Nimsuggest is not the most stable software
05:37:38FromDiscord<ricky> shame, otherwise nim is prob #1 lang imo
05:37:50FromDiscord<ricky> is neovim still the best ide for it
05:37:52FromDiscord<Elegantbeef> Yea tooling is one of it's weakest points
05:38:06FromDiscord<Elegantbeef> I use kate with nimlangserver or nimlsp
05:38:18FromDiscord<ricky> if nim had good tooling it'd be too OP
05:39:56FromDiscord<huantian> In reply to @Elegantbeef "Yea tooling is one": Yeah which is why we need to make a Nim formatter together beef!
05:40:19FromDiscord<Elegantbeef> I'm presently thinking about trying to write a header generator tool
05:40:24FromDiscord<sOkam!> @ElegantBeef one day I will learn how to interpret errors. maybe. one day 🤷‍♂️ _(effusively crosses his fingers)_↵turns out you can trigger the exact same "bug" I was getting by turning off the block where the `-` borrow is defined↵so it might actually be a dependency problem, where the op is not found where its needed so it errors from vmath like that https://media.discordapp.net/attachments/371759389889003532/10716665786193
05:43:34FromDiscord<Elegantbeef> Well it should mixin properly but it doesnt
05:44:47FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4naK what's weird is this works
05:45:48FromDiscord<Elegantbeef> Also your min repro didnt repro here
05:46:21FromDiscord<sOkam!> In reply to @Elegantbeef "Also your min repro": you need to switch the first to off to trigger what i get
05:46:31FromDiscord<Elegantbeef> I did
05:47:54FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4naL works fine
05:47:56FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4naM
05:47:59FromDiscord<sOkam!> which is the same i get in the engine
05:48:19FromDiscord<Elegantbeef> With both off that makes sense, since there is no `-` for FX
05:48:37FromDiscord<sOkam!> yeah, but that's what I get in the engine with all dependencies connected
05:48:52FromDiscord<Elegantbeef> [on, on] - works↵[on, off] - works↵[off, off] - fails
05:49:09FromDiscord<sOkam!> on,off fails for me with that error
05:49:15FromDiscord<Elegantbeef> With that file?
05:49:20FromDiscord<sOkam!> ye
05:49:30FromDiscord<Elegantbeef> Something is fucked with your nim
05:49:40FromDiscord<sOkam!> i might be on devel and you on stable?
05:49:49FromDiscord<Elegantbeef> I tried both
05:50:11FromDiscord<sOkam!> oh
05:50:15FromDiscord<sOkam!> on,off works on stable
05:50:42FromDiscord<Elegantbeef> #8e53fba083a7450b8c2e9771cba8d477468a520e - devel↵#f1519259f85cbdf2d5ff617c6a5534fcd2ff6942 - stable
05:50:52FromDiscord<sOkam!> how do i get those?
05:51:07FromDiscord<Elegantbeef> `choosenim stable` `choosenim update stable`
05:51:12FromDiscord<Elegantbeef> `choosenim update devel`
05:51:23FromDiscord<sOkam!> already up to date
05:51:27FromDiscord<sOkam!> i meant the hashes
05:51:41FromDiscord<Elegantbeef> `choosenim #commiit` should work
05:51:51FromDiscord<Elegantbeef> you shouldnt need to though, your Nim is just cursed
05:52:04FromDiscord<Elegantbeef> Are you using a config to compile the code?
05:52:14FromDiscord<sOkam!> ahhhh
05:52:20FromDiscord<sOkam!> i was not on the latest devel
05:52:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4naN
05:52:30FromDiscord<Elegantbeef> Did it fix it?
05:52:37FromDiscord<sOkam!> i updated devel and it fixed the on,off
05:52:45FromDiscord<Elegantbeef> Does it fix your project?
05:52:49FromDiscord<sOkam!> let me check that
05:53:22FromDiscord<Elegantbeef> I tried a bunch of shit to fix the minrepro i made, but I was not capable of fixing it until i realised the whole top level scope is only used
05:53:57FromDiscord<sOkam!> ah fuck me
05:54:05FromDiscord<sOkam!> it did fix it 🤦‍♂️
05:54:12FromDiscord<Elegantbeef> You hit a regression on the bleeding edge
05:54:18FromDiscord<Elegantbeef> The downsides of bleeding edge
05:54:22FromDiscord<sOkam!> ye
05:54:38FromDiscord<Elegantbeef> I'd suggest making a test for it 😄
05:55:17FromDiscord<Elegantbeef> No clue if you want to make a test for it or if it'd be accepted
05:58:02FromDiscord<sOkam!> i don't think im fit for writing tests at my current level of knowledge
05:58:34FromDiscord<sOkam!> i trip over myself on my own, let alone write a test that checks that what I think should be right is right. its probably wrong because my logic was 🙈
05:58:52FromDiscord<sOkam!> (edit) "was" => "was, not the code"
06:18:33FromDiscord<sOkam!> it did fix it in the minrepr, but not on my project
06:18:41FromDiscord<sOkam!> i built the wrong thing, so i thought it worked
06:18:59FromDiscord<sOkam!> so something is off in my project still, it seems
06:19:00FromDiscord<Elegantbeef> I do not know what to say then
06:19:12FromDiscord<Elegantbeef> Something is slightly different in your project vs your min repro
06:19:19FromDiscord<sOkam!> yeah, it must be some dependency issue. will try to hunt it, now that i know it must be my proj
06:19:48FromDiscord<Elegantbeef> When you show all mismatches does your proc show up?
06:21:22FromDiscord<sOkam!> how can i know if its my proc? does the distinct borrowed procs show up too?
06:21:29FromDiscord<Elegantbeef> Of course
06:21:30FromDiscord<sOkam!> as in show up as separate
06:21:43FromDiscord<Elegantbeef> It'll show up as a `proc(a, b: Fx): Fx`
06:21:53FromDiscord<sOkam!> defo not there
06:22:14FromDiscord<Elegantbeef> Does adding `mixin op` inside of vmath change anything?
06:24:37FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4naR
06:25:17FromDiscord<Elegantbeef> Oh does the module you're doing the `a - b` have that `-` in it's scope
06:25:55FromDiscord<Elegantbeef> `base` and or `bounds` needs that `-` in scope
06:26:23FromDiscord<Elegantbeef> Maybe araq's type bound operations isnt a bad idea, who knows
06:27:15FromDiscord<Rika> Type bound is a good idea, but there needs to be a way to bind to arbitrary types
06:27:41FromDiscord<Elegantbeef> Yea rika i was thinking a `{.bind.}` pragma to override rules
06:27:49FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4naT
06:27:52FromDiscord<sOkam!> https://tenor.com/view/hyper-gif-18023825
06:28:17FromDiscord<Elegantbeef> Ah so it was just a lacking procedure export
06:28:24FromDiscord<sOkam!> sent a code paste, see https://paste.rs/DvS
06:28:32FromDiscord<sOkam!> yeah, essentially. well, and the devel outdated issue first
06:36:35FromDiscord<sOkam!> sent a code paste, see https://paste.rs/07v
06:37:17FromDiscord<sOkam!> my type has a `/` proc, thats basically an alias for integer `div` in the background, so that it can behave like floats↵but it doesn't hit this case of vec/int
06:38:12FromDiscord<sOkam!> i guess i will need a specific proc for the case, or could there be some other way to approach it? 🤔
06:38:59FromDiscord<Elegantbeef> Make your own version of the ops 😄
06:39:39FromDiscord<sOkam!> yeah, was just thinking if there could be some other way to do it 🙂↵but i guess there is no case for float div int either
06:55:54FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4naY
06:56:39FromDiscord<Elegantbeef> Look at that error again
06:56:42FromDiscord<Elegantbeef> `[1]` not `[2]`
06:56:54FromDiscord<sOkam!> yeah just noticed, im blindu 😔
07:00:42FromDiscord<sOkam!> this new potential procs list is damn nice, btw. just saying
07:01:50FromDiscord<Elegantbeef> I find it extremely hard to read
07:04:21FromDiscord<sOkam!> are you scanning for things mainly horizontally?↵just noticed my eyes going up and down skimming over everything to find the correct information, so i believe i might be scanning vertically first 🤔
07:04:51FromDiscord<Elegantbeef> I'm scanning for a explicit error message
07:05:42FromDiscord<sOkam!> isn't the error at the very top, and then you scan to see what could or couldn't be there after seeing that main block of the error?
07:05:55FromDiscord<Elegantbeef> I much prefer the mismatch next to it
07:06:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nb0
07:06:44FromDiscord<sOkam!> but that gets repeated everywhere, you just need to remember a number and scan vertically for potential matches
07:07:09FromDiscord<Elegantbeef> That gets repeated everywhere, but the mismatch can be at different parameters
07:07:28FromDiscord<sOkam!> which is the [#] number at the leftmost part?
07:07:34FromDiscord<Elegantbeef> Yes i know how to read this
07:07:43FromDiscord<Elegantbeef> I find it very bad compared to old
07:08:11FromDiscord<sOkam!> yeah yeah, i was just trying to understand how that's harder to read, as in trying to understand why that could be creating such opposite reactions in us
07:08:45FromDiscord<sOkam!> for me now its actually readable, but before was just a mess
07:09:37FromDiscord<sOkam!> anyways, just me being curious about psychology stuffs. can ignore
07:09:45FromDiscord<Elegantbeef> I want to see the error, not play cross the lines 😄
07:12:59FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nb2
07:13:31FromDiscord<Elegantbeef> It doesnt return `: FX`
07:13:40FromDiscord<sOkam!> oh
07:13:44FromDiscord<Elegantbeef> also `var FX`
07:13:48FromDiscord<sOkam!> tru
07:14:25FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nb3
07:18:43FromDiscord<ajusa> Hey beef did you get a chance to look at https://github.com/beef331/constructor/issues/10? Wondering if you were able to reproduce or if there was a different issue in my code
07:19:15FromDiscord<Elegantbeef> I didnt see the issue, i'll look into it
07:21:04FromDiscord<ajusa> Cool thanks! the struct based constructor macro is my favorite of all the options 😸
07:21:11FromDiscord<ajusa> (edit) "😸" => "😄"
07:21:56*cm quit (Quit: Bye.)
07:22:23*cm joined #nim
07:24:09*rockcavera quit (Ping timeout: 260 seconds)
07:24:11*tiorock joined #nim
07:24:11*tiorock quit (Changing host)
07:24:11*tiorock joined #nim
07:24:11*tiorock is now known as rockcavera
07:25:40FromDiscord<Elegantbeef> Ah the new positional one?
07:27:03FromDiscord<ajusa> yeah
07:53:18*ltriant joined #nim
07:58:21*ltriant quit (Ping timeout: 268 seconds)
07:58:51FromDiscord<Elegantbeef> @ajusa\: oh nice it's a compiler error 😄
07:59:10FromDiscord<ajusa> that doesn't seem nice to me
07:59:57FromDiscord<ajusa> but at least it isn't a bug in constructor itself?
08:02:23FromDiscord<Elegantbeef> Well it might be a bug in constructor itself that causes the compiler to error
08:02:37FromDiscord<Elegantbeef> The fun part about AST macros is you can generate code that the compiler cannot compile 😄
08:16:24*ltriant joined #nim
08:34:30*azimut_ joined #nim
08:34:50*azimut quit (Ping timeout: 255 seconds)
08:39:34FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4nbf
08:39:50FromDiscord<4zv4l> oh wait, I think I know
08:40:12FromDiscord<4zv4l> I found that issue on github of winim
08:40:26FromDiscord<4zv4l> https://github.com/khchen/winim/issues/52
08:42:12FromDiscord<4zv4l> but it still doesn't find the `libgcc` in 32 bits
08:48:30*rockcavera quit (Remote host closed the connection)
08:56:31*ltriant quit (Ping timeout: 248 seconds)
09:00:19*fredrikhr joined #nim
09:00:23FromDiscord<sOkam!> is there an integer square root in std? 🤔
09:17:03FromDiscord<Phil> How can I generate a ref string?↵The idea is to e.g. pass a string into owlkettle-widget A and allow a click on a button modify that string for example
09:17:14FromDiscord<Elegantbeef> `new string`
09:19:14FromDiscord<Phil> The fact that `&` and `add` are not defined for ref strings is marginally annoying, then again ref strings are generally not a great idea so I can understand the reason
09:19:24FromDiscord<Phil> Dereferencing everywheeeere
09:19:52FromDiscord<Elegantbeef> Converters myguy
09:21:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbq
09:22:27FromDiscord<Elegantbeef> @ajusa\: ah so it's sorta a bug with me and the compiler, i used `{.compileTime.}` which only works in globals it seems
09:23:30FromDiscord<Elegantbeef> 1.1.2 is out now and should suffice
09:23:43FromDiscord<Elegantbeef> Phil i assume you read all that dribble i left you?
09:24:25FromDiscord<Phil> I did, I'm currently playing around with it, thus the ref string question
09:24:48FromDiscord<Elegantbeef> Refs and closures will be your friend
09:25:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nbs
09:27:20FromDiscord<Elegantbeef> `label = label`
09:28:03FromDiscord<Phil> You mena in the constructor for Submit?
09:28:08FromDiscord<Elegantbeef> Yes
09:29:12FromDiscord<Phil> Huh yeah that did it, now to see whether that manipulates the string and transmits those changes to other components
09:32:19FromDiscord<Phil> Ohhh so the viewproc gets executed again after every proc-call from an event
09:32:52FromDiscord<Elegantbeef> I think is "proper"
09:32:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbu
09:33:19FromDiscord<Elegantbeef> Can always ping can.l if you want to get more insight
09:34:51FromDiscord<Phil> Ohhhh I was an idiot, Label must be in viewable
09:34:57FromDiscord<Phil> Ah, I see you arrived at the same conclusion
09:35:12FromDiscord<Elegantbeef> Yea you do not need ref here really
09:35:21FromDiscord<Phil> By defining label in "view" I redefined that string all the time, replacing the reference and murdering the idea
09:35:50FromDiscord<Phil> I might anyway to keep up the habit because chances are I'd want to do similar things with objects
09:36:00FromDiscord<Phil> Where the ref will be mandatory
09:36:38FromDiscord<Elegantbeef> Why would it be manadatory
09:36:44FromDiscord<Elegantbeef> If you're using closures it's not mandatory 😄
09:37:14FromDiscord<Phil> Wouldn't I run into issues with stuff getting copied a lot when I want there to be only one explicit set of data
09:37:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbv
09:37:27FromDiscord<Elegantbeef> Oh possibly, but hey it's not mandatory
09:37:44FromDiscord<Phil> Eh, GUI is hard enough without me needing to account for value types
09:38:57*uics joined #nim
09:42:43FromDiscord<Elegantbeef> I still want to try to make the owlkettle DSL work on typed AST to make it a tinge smarter
09:42:44FromDiscord<Elegantbeef> But it's a challenge 😄
09:43:24FromDiscord<Phil> Personally I'm playing around with the idea of a central "data-store" that all viewables derive their data from
09:45:46FromDiscord<Phil> Basically it's flux-pattern / ngrx.↵A widget needs data means it sends an action through a global queue.↵You have entities listening on that queue and filtering whether that action is "for them" to act on or not.↵If it is, they trigger effects that load data or manipulate data as needed
09:46:23FromDiscord<Phil> (edit) "Basically it's flux-pattern / ngrx.↵A widget needs data means it sends an action through" => "sent" | "global queue.↵You have entities listening on that queue and filtering whether that action is "for them" to act on or not.↵If it is, they trigger effects that load data or manipulate data as needed" => "long message, see http://ix.io/4nby"
09:47:23FromDiscord<turbo> How can I get `$` to work in std/re? Every time I pass a multiline string to (e.g.) `findAll`, patterns using `^` or `$` return nothing. Example pattern: https://regex101.com/r/0I4UtU/1, and implemented in Nim: https://gist.github.com/turbo/9ec4e6b9355e437455a9c8725bebac35
09:50:41FromDiscord<turbo> Hm, it seems I have to manually enable multiline with `(?m)`. How odd
09:51:02FromDiscord<Elegantbeef> The hater of regex in me wants to say "just write the imperative loop" 😄
09:53:26FromDiscord<Phil> In reply to @Elegantbeef "The hater of regex": Can I instantiate ref strings with intiial values?
09:53:36FromDiscord<Phil> (edit) "intiial" => "inutial"
09:53:38FromDiscord<Elegantbeef> if you make your own `new` proc 😄
09:55:43FromDiscord<Phil> In reply to @Elegantbeef "if you make your": Ohhh good point, damn sometimes I still forget nim fundamentals because constructor almost always does it for me
09:59:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nbA
09:59:48FromDiscord<Phil> Do I have to include?
10:00:24FromDiscord<Elegantbeef> `export SubmitState`
10:01:03FromDiscord<Elegantbeef> Possibly `export Submit`
10:01:04FromDiscord<Elegantbeef> I forget
10:01:20FromDiscord<Phil> I have not once in my life used export for a Symbol I defined in that file
10:01:31FromDiscord<Phil> I didn't even know that was possible
10:01:52FromDiscord<Phil> Yeah that does it, doesn't need SubmitState, just Submit
10:02:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbD
10:02:56FromDiscord<Phil> I have, I have never regarded an imported module as a symbol I defined within that module
10:03:01FromDiscord<Phil> (edit) "I have, I have never regarded an imported module as a symbol I defined within that module ... " added "though"
10:03:07FromDiscord<Rika> welcome to macros?
10:03:16FromDiscord<Rika> oh wait no
10:03:17FromDiscord<Rika> not even
10:03:18FromDiscord<Elegantbeef> Ah well it technically is
10:03:34FromDiscord<Elegantbeef> technically to phil not a macro
10:04:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nbG
10:04:50FromDiscord<Elegantbeef> Buuuut?
10:04:53FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4nbG" => "https://play.nim-lang.org/#ix=4nbH"
10:05:00FromDiscord<Elegantbeef> Phil you're silly
10:05:07FromDiscord<Phil> No but, just works
10:05:34FromDiscord<Elegantbeef> then you can do `new "Hello"`
10:05:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbI
10:06:37FromDiscord<Elegantbeef> I do think this would be nice to be in the system module, ymmv
10:06:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nbJ
10:08:16FromDiscord<Phil> This works surprisingly well
10:08:32FromDiscord<Elegantbeef> Damn people make software that works
10:08:55FromDiscord<Phil> Incredible
10:09:03FromDiscord<Phil> Like constructor
10:09:14FromDiscord<Elegantbeef> Nah that shit doesnt owrk
10:09:15FromDiscord<Elegantbeef> work even
10:09:19FromDiscord<Elegantbeef> Ajusa found a bug with it todayt
10:14:08*uics quit (Remote host closed the connection)
10:39:01*uics joined #nim
10:45:37*dza quit (Quit: Ping timeout (120 seconds))
10:54:47*azimut_ quit (Ping timeout: 255 seconds)
10:56:18*dza joined #nim
10:56:50*azimut joined #nim
10:59:08FromDiscord<Phil> GUI:↵So much shared mutable state you would start going crazy
11:07:45Amun-Radoes cutting a slice of seq create a C-alike pointer to src seq or makes a new one?
11:08:53Amun-Rahmm, and by cutting I mean let s2 = s1[0 .. 999]
11:09:07FromDiscord<Rika> copy
11:09:25FromDiscord<Rika> use .toOpenArray(0..999) for a view
11:09:26FromDiscord<Rika> iirc
11:09:33Amun-Raoh, thanks
11:10:05FromDiscord<Rika> seems like it should be (0, 999)
11:10:10FromDiscord<Rika> not with the slice operator
11:10:45*ltriant joined #nim
11:24:13Amun-Rayes, it works, the only diffrerence is you have to pass that directly without creating transitional variables
11:26:06FromDiscord<Rika> yes you cant store slices in variables
11:26:10Amun-Rawell, template bitmap: untyped = buf.toopenarray(0, 7999) works just like a variable ;)
11:32:47FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4nc6
11:34:55FromDiscord<Rika> i assume this is for a shared library?
11:35:03FromDiscord<Rika> `{.exportc:"addTwoNumbers", dynlib.}`
11:35:17FromDiscord<4zv4l> The function is actually in a exe
11:35:27FromDiscord<4zv4l> And I try to get the address of that proc from a dll
11:35:43FromDiscord<Rika> i dont understand
11:35:47FromDiscord<Rika> `addTwoNumbers` is in?
11:35:55FromDiscord<4zv4l> The executable
11:36:06FromDiscord<Rika> and where is `GetProcAddress` defined
11:36:07FromDiscord<4zv4l> And from the dll I try to get the address of that function
11:36:29FromDiscord<Rika> if this is windows then i cant help 🙂
11:36:36FromDiscord<4zv4l> In reply to @Rika "and where is `GetProcAddress`": That is from winim ↵I run it from the dll to get the proc address of « addTwoNumbrrs »
11:36:44FromDiscord<4zv4l> Numbers
11:36:48FromDiscord<4zv4l> In reply to @Rika "if this is windows": Oh alright xD
11:36:57FromDiscord<Rika> i dont know anything about it lol
11:37:27FromDiscord<4zv4l> No problem 😂
12:37:12FromDiscord<Phil> I'm liking owlkettle so far, it's behaving very predictably, which I like
12:45:23FromDiscord<Phil> I wonder how I'd be testing that GUI though
12:56:21FromDiscord<4zv4l> how can I prevent a function from being inlined in Nim ?
12:59:56FromDiscord<4zv4l> okok I used `-fno-inline`
13:04:46FromDiscord<aMOPel> What happens when I `CTRL-C` a program while it's writing to a file eg. by using `writeFile`? Will it terminate mid-write or finish? How could I handle such a case to finish gracefully?
13:09:42FromDiscord<auxym> probably won't finish if your program doesn't call close/flush before exiting. You can probably catch the SIGINT and clean-up before exit
13:10:34FromDiscord<auxym> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29
13:11:03*PMunch joined #nim
13:12:58FromDiscord<aMOPel> Neat. Thank you, I couldn't find it
13:15:31*jmdaemon quit (Ping timeout: 252 seconds)
13:16:03FromDiscord<amadan> In reply to @4zv4l "how can I prevent": You can also attach the `noinline` pragma
13:18:01FromDiscord<4zv4l> In reply to @amadan "You can also attach": indeed, thanks !
13:20:06FromDiscord<aMOPel> In reply to @auxym "https://nim-lang.org/docs/system.html#setControlCHo": I don't get how I would use it to close a file, since it the hook can't have arguments or closures, so I can't pass anything to it.
13:23:28FromDiscord<auxym> not sure TBH. If the stack trace is consistent, maybe you can raise an exception from it? The other option I can see is using globals, but it's not exactly ideal.
13:25:17FromDiscord<aMOPel> Globals means using closures in this case, I thought? I'm gonna try the exception route
13:29:16FromDiscord<auxym> Nah I meant something like `var fileBeingWritten: File` at the global level. You use that in your writing proc, and in the handler you put `if not fileBeingWritten.isNil: close fileBeingWritten`
13:30:53FromDiscord<auxym> it might need to be more complex if nim's write implementation does its own buffering, not sure. catchable exception would be better, if it works
13:34:25*uics quit (Remote host closed the connection)
13:39:43FromDiscord<auxym> sent a long message, see http://ix.io/4ncN
13:47:26FromDiscord<Phil> What do I do if I want my owlkettle GUI to have multiple "pages"?↵Do I define all of them and make only one visible at a time?
13:47:39FromDiscord<Phil> (edit) ""pages"?↵Do" => ""pages", with different layouts, different buttons etc.?↵Do"
14:12:18FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4ncS
14:16:52FromDiscord<Phil> At that point I'd argue you'd want an overload
14:17:20FromDiscord<planetis> In reply to @4zv4l "how can I skip": I think it's possible on devel
14:22:09FromDiscord<4zv4l> In reply to @planetis "I think it's possible": on the latest I get `Error: attempt to redefine: '_'`
14:22:20FromDiscord<4zv4l> https://play.nim-lang.org/#ix=4ncW
14:26:38FromDiscord<planetis> that code is even correct?
14:27:03FromDiscord<planetis> And what on earth means on 'latest'? I said on nim devel
14:27:31FromDiscord<planetis> Ohh you're getting bullied, cause it works fine
14:32:15FromDiscord<4zv4l> wait what
14:32:15FromDiscord<4zv4l> xD
14:32:55FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4ncY
14:33:18*arkurious joined #nim
14:33:22FromDiscord<4zv4l> In reply to @planetis "And what on earth": because the playground doesn't show `devel`
14:34:19FromDiscord<planetis> I know, that was my attempt to be funny, badum ts
14:35:30FromDiscord<4zv4l> oh okok xD
14:35:58FromDiscord<4zv4l> https://tenor.com/view/gary-spongebob-drums-joke-ba-gif-22902854
14:36:06FromDiscord<4zv4l> oh, no gif alright
14:37:28FromDiscord<4zv4l> In reply to @Isofruit "At that point I'd": I maybe can't overload `DllMain` but I can do a wrapper↵would add useless code tho, can just skip those arguments↵just it takes lot of spaces on the screen 🥹
14:40:09FromDiscord<EyeCon> Do we have an http client that has cookie management? I think the built-in `httpclient` doesn't
14:40:17FromDiscord<Phil> In reply to @4zv4l "I maybe can't overload": I haven't dealt with DllMain or anything like it, so I can really say much about that 😛
14:41:35FromDiscord<Phil> how do I get a ref to a thing that is already in heap again?
14:41:57FromDiscord<Phil> got a `ref seq[MyType]` and I need to `filter` over it
14:46:54FromDiscord<Phil> Ah, I can just unref the point where I want to write to
14:48:02FromDiscord<Phil> Also, OHHHHH that is nice!↵Since every update automatically leads to an entire re-render, that means every change to the global App-State is immediately propagated also down to the other components (assuming the `view` method there gets called)
15:14:50FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ndd
15:27:44*koltrast quit (Ping timeout: 260 seconds)
15:50:29FromDiscord<huantian> In reply to @4zv4l "how can I skip": Weird I I would’ve sworn that would’ve worked
16:03:02*azimut quit (Ping timeout: 255 seconds)
16:05:20*azimut joined #nim
16:06:58*uics joined #nim
16:34:27FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4ndB
16:34:34FromDiscord<firasuke> (edit)
16:35:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndD
16:36:23FromDiscord<firasuke> In reply to @Isofruit "First question would be": and you are correct
16:36:31FromDiscord<firasuke> I am using `include` in two places
16:37:00FromDiscord<firasuke> what's a good plugin to use with nim that doesn't give warning about missing symbols, if a file is included/imported in another file in the same project overall
16:37:01FromDiscord<Phil> In reply to @firasuke "and you are correct": Include is not the same as import, it is essentially you copying the source of that other file and pasting it into your own file.↵That means effectively the code is duplicated
16:37:14FromDiscord<firasuke> In reply to @Isofruit "Include is not the": oh that's not what I want then
16:37:26FromDiscord<firasuke> I thought `import` is for standard stuff, while include is for local stuff
16:37:30FromDiscord<aMOPel> In reply to @auxym "here's another idea sort": Nice idea, but too involved for my use case I believe. I saw that I can actually use closures after all, I misinterpreted the error message apparently. I just have to give the `{.noconv.}` pragma.
16:37:32FromDiscord<Phil> Yeah, generally include is for those super extra special scenarios
16:37:39FromDiscord<firasuke> In reply to @Isofruit "Yeah, generally include is": I see
16:38:19FromDiscord<Phil> Like, there are scenarios where legitimately it should all be one file but it gets too long if you don't split it up and splitting into modules makes no sense.↵I honestly have no idea what such a scenario would look like, but that's the general idea behind include
16:38:51FromDiscord<jtv> It's usually when you can't split things up because of a lot of interdependencies where you have forward references
16:38:57FromDiscord<firasuke> In reply to @Isofruit "Like, there are scenarios": Well I'm not a fan of writing one large big file
16:39:06FromDiscord<jtv> Once those aren't needed, you might not ever need include IDK
16:39:34FromDiscord<Phil> In that case, just use import. I've yet to encounter a single scenario where I'd need it after my first year with nim
16:39:41FromDiscord<Phil> (edit) "it" => "include"
16:39:55FromDiscord<firasuke> ok cool, thanks for clearing that up
16:40:04FromDiscord<Phil> No worries, it's one of those starter things
16:40:30FromDiscord<sOkam!> sent a code paste, see https://paste.rs/kfu
16:41:10FromDiscord<jtv> The second does an actual conversion, where the former says, "treat the bits of this type as that type"
16:41:29FromDiscord<Phil> One of those is playing with fire, the other isnt
16:41:32FromDiscord<jtv> So float(someint) will give the same numeric value, but cast[float](someint) will not
16:41:53FromDiscord<jtv> Depends on what you are doing, ofc.
16:42:12FromDiscord<sOkam!> its for floating point math. it will be coming from the same type, really
16:42:39FromDiscord<sOkam!> (edit) "floating" => "fixed"
16:42:46FromDiscord<sOkam!> sry, fixed point math. big diff
16:42:52FromDiscord<Phil> Yeah, I mean sometimes it's unavoidable, e.g. when you have bytes encoded in base64 but `std/base64`'s decode method gives you a string back instead of a byte array, or when you load stuff from a lib and only have a pointer you need to cast to something
16:43:19FromDiscord<sOkam!> but is converting slower, or what is the conversion doing really?
16:43:32FromDiscord<sOkam!> its for a time sensitive usecase, so it matters even if small
16:43:44FromDiscord<sOkam!> it will happen like all of the time and extensively, so it matters a lot
16:43:48FromDiscord<jtv> Generally they'll both end up the same thing for most types
16:44:06FromDiscord<jtv> Unless an actual conversion happens
16:44:31FromDiscord<sOkam!> so it should be the same perf, when the bits are the same in the background, right?
16:44:37FromDiscord<jtv> Yes
16:44:57FromDiscord<sOkam!> kk, then its safer with the conversion, in case something weird happens by accident
16:47:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ndE
16:47:47FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndF
16:48:35FromDiscord<sOkam!> im stealing that code. so simple, yet exactly the benchmark style that i needed to see 🙏
16:49:04FromDiscord<Phil> Note that having a million or so int64's in RAM will... well eat up RAM
16:49:25FromDiscord<sOkam!> no worries 🙂
16:50:10FromDiscord<Phil> Also!↵I would keep in mind that the "later" option in benchy seems to sometimes have performance advantages, I assume because of some caching or some crap in terms of low-level optimization
16:50:44FromDiscord<Phil> If you do normconversion second you'll see normconversion being slightly faster than castconversion
16:50:47FromDiscord<sOkam!> 1ms? wth
16:50:55FromDiscord<sOkam!> im getting like 28 👀
16:51:54FromDiscord<Phil> I'm on a framework so the CPU is relatively new
16:52:24FromDiscord<Phil> Maybe that's why? 11th gen... well I guess that's not all that new anymore given that 13th gen is rolling out
16:52:56FromDiscord<sOkam!> my pc tends to choke from time to time also, so might be influencing
16:53:53FromDiscord<sOkam!> but yeah, the difference is like 0.200 in such a huge amount of operations
16:54:22FromDiscord<sOkam!> and the potential to shoot yourself in the foot with cast is way too big, so sticking with convers
16:54:39FromDiscord<Phil> Generally if the difference is that low I'd not trust there to be a difference at all due to performance impact that the order of measurement has
16:54:48FromDiscord<sOkam!> yeah probably
16:59:01FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ndH
16:59:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndI
17:00:04FromDiscord<Phil> You likely could just use mapIt or insert the proc directly
17:00:16FromDiscord<sOkam!> what does benchy need exactly?
17:00:23FromDiscord<sOkam!> why do you say keep(y)?
17:01:03FromDiscord<Phil> benchy just needs the operation you want to measure inside the timeit block
17:01:32FromDiscord<Phil> You say keep(x) to whatever result the measured code-block returns so the compiler doesn't just optimize that code-away since the result won't be used anywhere
17:01:45FromDiscord<sOkam!> i see
17:03:01FromDiscord<Phil> If your proc doesn't return anything you won't need keep(x)
17:03:11FromDiscord<Phil> Because then the compiler won't optimize anything away
17:03:58*rockcavera joined #nim
17:04:04FromDiscord<sOkam!> so i guess i just need to create a seq of my number type, and then create a for loop to process it?
17:04:10FromDiscord<Phil> I wonder if the way owlkettle triggers rerenders for every action you perform has performance implications
17:04:31FromDiscord<Phil> In reply to @sOkam! "so i guess i": pretty much
17:04:46FromDiscord<sOkam!> how do you create range a floats? is it poss?
17:04:49FromDiscord<Phil> I'd create resources you need within your test outside of the timeIt blocks because their performance doesn't interest you
17:05:01FromDiscord<sOkam!> yeah i guess
17:05:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndM
17:07:13FromDiscord<Phil> Okay that's a bunch of integers, but you can divide them by 256 if you want proper floats and not just and int with a `.0` attached at the end
17:09:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndP
17:09:54FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4ndP" => "https://play.nim-lang.org/#ix=4ndQ"
17:10:00FromDiscord<sOkam!> ty
17:11:58FromDiscord<sOkam!> damn arrow thing is making me choke on every single step i take, omg
17:12:15FromDiscord<sOkam!> is it fine to just make a damn simple loop, to achieve the same thing you did?
17:13:01FromDiscord<sOkam!> i just don't know if it will do the same, since I don't understand what the => is doing↵i know its a way to autogen a foreach, but even knowing that its like 🧩
17:15:31FromDiscord<Phil> Basically, => does the same as a proc declaration
17:15:32FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ndT
17:16:21*jkl quit (Quit: Gone.)
17:17:07FromDiscord<sOkam!> yeah, i know its a lambda thing. but even knowing that they just break my brain. i find them beyond confusing 😦
17:17:22FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ndU
17:17:51FromDiscord<Phil> Depending on the context you can even leave the type declaration for the parameter out
17:18:08*uics quit (Remote host closed the connection)
17:18:10FromDiscord<Phil> I like them, but I guess that's a JS/functional thing
17:18:14*jkl joined #nim
17:18:32*uics joined #nim
17:19:19FromDiscord<sOkam!> i've seen them before, and i've tried to reason how to apply them, and each time i just end up writing the explicit clear obvious thing that reads in english and not in l33t=>code
17:19:45FromDiscord<sOkam!> no offense, its admirable. but man they are so damn unintutive for me
17:21:11FromDiscord<firasuke> I know this is a question that has been asked a lot, but how do you import local files in nim?
17:23:55FromDiscord<Phil> Define local files.↵You mean other nim files?
17:24:35FromDiscord<Phil> Typically it's just `import ./otherfile` if they are in the same directory.↵`import ./foldername/otherfile` if `otherfile.nim` is in a folder `foldername`
17:24:44FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ne2
17:25:20FromDiscord<Phil> `import file` is ambiguous. If you have a package "file" that `import file` could be importing either the file.nim from that package or the file.nim from your project
17:25:28FromDiscord<firasuke> Oh ok thanks
17:25:50FromDiscord<Phil> I tend to prefer explicit `import ./file` to distinguish stuff that's from my own project vs. `import file` being a `file` package
17:26:36FromDiscord<sOkam!> same. i also do `std/file` when its from std (even if obvious) and pkg/file to make it clear that its an external package not from my project
17:26:56FromDiscord<sOkam!> (edit) "pkg/file" => "`pkg/file`"
17:28:10FromDiscord<firasuke> In reply to @sOkam! "same. i also do": oh this looks better imho
17:28:27FromDiscord<firasuke> thanks for the help, much appreciated
17:29:05FromDiscord<Phil> In reply to @sOkam! "same. i also do": I actually didn't know you can prefix package imports with `pkg` to make them explicit, good call!
17:29:24Amun-Rahmm, same here
17:34:09FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ne7
17:35:03Amun-Racan't beat good fpu
17:35:18FromDiscord<sOkam!> fpu cant beat determinism though
17:35:32Amun-Ramhm
17:35:52FromDiscord<sOkam!> what does the time mean in benchy? the time for each pass of the process, or the whole thing?
17:36:30FromDiscord<Phil> In reply to @sOkam! "what does the time": Benchy repeats the codeblock within timeit as many times as displayed under "runs"
17:36:58FromDiscord<Phil> So if your code-block in the time-it block was dividing 1.000.000 times, then it took 1.472 ms to do a million divisions
17:37:18FromDiscord<sOkam!> 100_000, but yeah that's what it was. i made a for loop
17:37:51FromDiscord<Phil> In that case it took 1.472 ms to iterate over the entire sequence and perform a division for each element
17:37:57FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ne8
17:38:15FromDiscord<hortinstein> I am newer to the JS backend with NIM, anyone see any issues or possible ways to resolve the following code/error?
17:38:17FromDiscord<hortinstein> https://media.discordapp.net/attachments/371759389889003532/1071847243549769870/image.png
17:38:22Amun-Ratime per run
17:39:00Amun-Rahortinstein: js backend likes cstrings
17:39:38FromDiscord<firasuke> is their a tool like `rustfmt` for beautifying code, removing trailing whitespace and such (I'm coming from Rust, so bare with me here :))
17:40:08Amun-Rathere' nimpretty, I don't know what stage it's at rn
17:40:09FromDiscord<hortinstein> In reply to @Amun-Ra "<@169298166506586113>: js backend likes": so i should convert all my strings in the JS module to C strings? Are they interoperable with other Nim strings?
17:40:12FromDiscord<sOkam!> In reply to @firasuke "is their a tool": nimpretty. but its not as good as clangd-format
17:40:22FromDiscord<sOkam!> i don't know about rustfmt so cant compare there
17:40:56FromDiscord<sOkam!> In reply to @hortinstein "so i should convert": for 99% of your use cases, yes they are
17:41:19Amun-Rahortinstein: it's hard for me to say, I just started porting my app to the js backend
17:41:36FromDiscord<hortinstein> awesome, will give it a shot thank you all!
17:42:11FromDiscord<sOkam!> its better if you stick to native types until you have to pass them as ctypes
17:42:18FromDiscord<sOkam!> at least afaik
17:42:29Amun-Ra^ this
17:43:35FromDiscord<firasuke> In reply to @sOkam! "nimpretty. but its not": cool thanks
17:47:08FromDiscord<Phil> In reply to @sOkam! "nimpretty. but its not": is clangd-format applicable to nim? I'd be surprised
17:48:38FromDiscord<sOkam!> In reply to @Isofruit "is clangd-format applicable to": i f'ing wish it was 😔
17:49:33FromDiscord<hortinstein> In reply to @sOkam! "its better if you": yeah i am trying to find a good tradeoff here, i think converting stuff to cstrings will take some substantial refactoring, going to do a few work arounds today
17:57:52FromDiscord<hortinstein> would something like this work (having issues right now with conversions back and forth)
17:57:53FromDiscord<hortinstein> https://media.discordapp.net/attachments/371759389889003532/1071852173308203078/image.png
17:58:35FromDiscord<hortinstein> like keeping the API with string, but doing internal conversion to maintain JS compatibility
18:02:19Amun-Rahortinstein: I'd use strings internally, cstring only when calling js world (including printing text)
18:22:33FromDiscord<hortinstein> thanks, yeah i am going to have to likely do a full refactor, but I did some work arounds and tests are passing now
18:28:43FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4neq
18:29:57Amun-Rahortinstein: btw, compiling to wasm is quite easy
18:34:32*uics quit (Remote host closed the connection)
18:34:52*rockcavera quit (Remote host closed the connection)
18:43:26*azimut_ joined #nim
18:43:38*azimut quit (Remote host closed the connection)
18:44:28FromDiscord<firasuke> ok so this importing local files thing is getting on my nerves,↵↵I have a `firstFile.nim` with a couple of constants in it, I'm trying to use the constants in another `secondFile.nim`, and I have `import firstFile` inside `secondFile.nim` and it is not working, what could be the problem? `nimble build` is giving undeclared identifier issues
18:45:17FromDiscord<sOkam!> are the constants ``?
18:45:44FromDiscord<sOkam!> i made that mistake all the time at the beginning, always forgot to mark them as extractable
18:46:08FromDiscord<sOkam!> (edit) "as extractable" => "for extracting"
18:46:50FromDiscord<firasuke> In reply to @sOkam! "are the constants `*`?": what's ``?
18:46:58FromDiscord<firasuke> no they are not
18:47:56FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4net
18:48:12FromDiscord<firasuke> I have newlines inside single const sections, is that allowed?
18:48:16FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4neu
18:48:28FromDiscord<sOkam!> In reply to @firasuke "I have newlines inside": yes
18:48:35FromDiscord<firasuke> ok good
18:48:53FromDiscord<firasuke> so they are not exported
18:48:54FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4nev
18:49:05FromDiscord<firasuke> I should have them all exported then
18:49:06FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4new
18:49:15FromDiscord<firasuke> thanks a lot, trying rn
18:51:03FromDiscord<firasuke> another issue is that, does define order matter, as in trying to use a later defined proc in a former defined proc body?
18:51:29FromDiscord<sOkam!> you can do forward declarations, but yes order matters
18:52:18FromDiscord<firasuke> In reply to @sOkam! "you can do forward": oh ok that makes sense I guess
18:52:43FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4ney
18:52:59FromDiscord<sOkam!> `const name` is the `NEP1` way of doing it
18:53:20FromDiscord<sOkam!> but its not illegal to do it some other way
18:54:06FromDiscord<firasuke> this nim plugin is formatting it the other way round which is weird
18:54:22FromDiscord<sOkam!> i do `const name :Type= 1` myself, but people around here prefer `const name: Type = 1` or even implicit type with `const name = 1`, since the lang knows what type it is because of the syntax for the value
18:54:56FromDiscord<sOkam!> In reply to @firasuke "this nim plugin is": i think nimpretty is nep1, i might be misremembering
18:55:43FromDiscord<firasuke> I see thanks
18:56:38FromDiscord<Phil> In reply to @firasuke "what's the preferred way?": I maintain my stance that screaming case for global consts is the way to go
18:57:00FromDiscord<firasuke> In reply to @Isofruit "I maintain my stance": yes exactly, this is just a quick placeholder
18:57:13FromDiscord<Phil> For local consts it doesn't matter as much since there they are barely more than variables that you compiled ahead of time because you can
18:57:39FromDiscord<sOkam!> constants don't hurt, variables do
18:58:54FromDiscord<firasuke> and for variables and procs, do I have to do the same to export them?
18:59:37FromDiscord<sOkam!> In reply to @firasuke "and for variables and": yep. everything is private by default in nim↵you are meant to be explicit about what you want the language to do, instead of having a bunch of implicit functionality all around and having to chase down what's going on
18:59:48FromDiscord<firasuke> ok good, makes sense
19:00:13FromDiscord<firasuke> In reply to @sOkam! "yep. everything is private": so just throw an `` at the end of the name, isn't their a quicker way to export entire files?
19:00:46FromDiscord<pyolyokh> there isn't
19:01:17FromDiscord<sOkam!> nope, there is none. but you will get so used to exporting, that you won't need to worry about it
19:01:36FromDiscord<sOkam!> its 1char after all
19:02:07FromDiscord<Elegantbeef> Says the person that uses u8 😛↵(@sOkam!)
19:02:15FromDiscord<Elegantbeef> Sorry too easy
19:02:20FromDiscord<sOkam!> exactly why i do it!
19:02:43FromDiscord<sOkam!> i would never write uint8 without tripping over my keyboard like 10times per day on that damn t 🙈
19:05:04FromDiscord<firasuke> xD
19:05:44Amun-Rauint8 is less distinguishable from uint16/… that byte, and much more typing… :P
19:07:43FromDiscord<sOkam!> how would you check for under or overflow of the contents of a variable, and what would be a reasonable way to approach such cases?↵context is arithmetic of int types, for when the value goes out of range
19:08:23FromDiscord<sOkam!> I've seen that the compiler throws a defect, but wondering what I should do for those cases
19:09:44Amun-Ras0kam: f.e. https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
19:18:18PMunchThis svgbob stuff is pretty neat :)
19:19:09*jmdaemon joined #nim
19:19:31FromDiscord<firasuke> regarding implicit returns, if I have a proc with a `string` return type, and I use `let someVar: string` (with or without specifying the type), will it get implicitly returned? or should I explicitly use `rerturn` along or `return someVar` to get it working?
19:23:29FromDiscord<Phil> I'm not sure if there's actually a consent on what to use where
19:23:58FromDiscord<Phil> I myself just use the either implicit `result` variable or when I want to have guard clauses then I use `return`
19:24:46FromDiscord<Phil> For one-liners I just write my procs like this: `proc getConfigFileValue(x: configName) : string = someGlobalVar[x])`
19:24:57FromDiscord<pyolyokh> sent a code paste, see https://paste.rs/2PT
19:25:21FromDiscord<Phil> Status (IIRC among the largest that use nim) however avoids `result` afaik
19:25:35FromDiscord<Phil> (edit) "Status (IIRC among the largest that use nim) however avoids `result` afaik ... " added "and insists on explicit returns"
19:28:07*dropkick joined #nim
19:33:23FromDiscord<firasuke> In reply to @pyolyokh "no, because `let` isn't": oh ok
19:35:04FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4neD
19:37:07FromDiscord<pyolyokh> there's no "given its type". You'll get an error if the type's wrong.
19:37:38FromDiscord<Elegantbeef> If it doesnt have a converter or the type is wrong\ 😄
19:38:32FromDiscord<pyolyokh> what Nim has instead is a requirement that return values be used or explicitly discarded. So a bare expression has to be what's returned, and that has to work
19:40:01FromDiscord<firasuke> ok that's good to know
19:41:15FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4neF
19:41:27*uics joined #nim
19:42:32FromDiscord<pyolyokh> explicit returns or using result or implicit returns all work pretty intuitively, the only trouble is mixing them, especially unintentionally and returning a default `result` because you missed a case
20:04:08*azimut_ quit (Quit: ZNC - https://znc.in)
20:04:41*azimut joined #nim
20:08:23FromDiscord<firasuke> I have to say I'm very impressed with Nim
20:08:40FromDiscord<firasuke> code is much clearer and easier to read compared to Rust, resulting binaries are much smaller, performance is about the same
20:08:47FromDiscord<firasuke> (edit) "clearer" => "cleaner"
20:12:01FromDiscord<Elegantbeef> But muh memory safety 😜
20:20:55FromDiscord<Phil> ~~Can't be memory unsafe if I just use orc~~
20:21:08FromDiscord<Phil> (edit) "orc~~" => "orc and don't use fancy pointer or addr stuff~~"
20:24:11FromDiscord<LuKol> hi, after evaluating some other new languages, I decided that I will stick with nim. does it make sense to start with 1.6 or is it better to go directly to version 2? I was not able to find when 2.0 should be official and 2 months of RC seems to be already enough for testing phase
20:25:56FromDiscord<xigoi> There aren't that many differences in version 2, especially for a beginner, so you can just start in 1.6 right now
20:27:35FromDiscord<sOkam!> In reply to @Amun-Ra "s0kam: f.e. https://wiki.sei.cmu.edu/confluence/dis": does this mean that by default nim types dont do so?
20:32:38*kenran joined #nim
20:34:18FromDiscord<firasuke> In reply to @firasuke "code is much cleaner": turns out complexity is cost xD
20:38:09FromDiscord<Elegantbeef> Sokam signed integers do have overflow checks in Nim
20:38:10FromDiscord<Elegantbeef> Unsigned do not
20:47:13FromDiscord<sOkam!> i might be getting confused by error messages again, then
20:47:35FromDiscord<Phil> In reply to @LuKol "hi, after evaluating some": Imo nim devel is stable enough to already run with. Everything I currently develop makes sure to run with both 1.6 and 1.9.1 (devel).↵You can of course do both, but generally 1.9.1 (to me) is basically 1.6. with better memory management and some library fixes that I personally find essential
20:48:53FromDiscord<Phil> Though if you want a more stable experience you can of course just start with 1.6.10 right now and compile everything with the `--mm:orc` flag, that should generally get you fairly close to what 1.9.1 is like
20:49:28FromDiscord<sOkam!> sent a code paste, see https://paste.rs/khz
20:50:40FromDiscord<Phil> Full code-sample for compiling myself plx
20:51:23FromDiscord<Elegantbeef> Ah sokam yea you need to check if it over/under flows before doing the arithmetic
20:51:42FromDiscord<firasuke> is there such a thing as overriding functions or procedures? for example, overriding the echo procedure to prefix output by date?
20:52:25FromDiscord<sOkam!> @Phil https://media.discordapp.net/attachments/371759389889003532/1071896096806281307/bench.nim https://media.discordapp.net/attachments/371759389889003532/1071896097305411705/fx.nim
20:52:26FromDiscord<Elegantbeef> Nim has procedure overloading
20:52:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nf0
20:53:33FromDiscord<Phil> In reply to @firasuke "is there such a": You can overload, not necessarily override.
20:53:55FromDiscord<Phil> "not necessarily" because there's some sort of semi-exceptions to that, for example if you have a generic you can "override" it with an explicit proc
20:53:58FromDiscord<sOkam!> In reply to @firasuke "is there such a": if they have the same name, they need to have different parameters or else they clash. but if you give different parameters, you could use the same name as an overload
20:54:12FromDiscord<Phil> Becasue generics aren't real and only get used to generate "real" procs when nothing else is availabel
20:54:15FromDiscord<Phil> (edit) "availabel" => "available"
20:54:19FromDiscord<firasuke> hmm, I think in my use case, it's easier to have a custom echo function with dates prefixed
20:54:32FromDiscord<Phil> I feel like you're looking for Logging
20:54:38FromDiscord<Phil> Which `std/logging` is used for
20:54:47FromDiscord<sOkam!> yeah, or logit from nimble
20:54:53FromDiscord<firasuke> In reply to @Isofruit "I feel like you're": thanks, but I'm not currently looking at that
20:54:58FromDiscord<sOkam!> from what i saw, logit looked the best and simplest
20:54:59FromDiscord<firasuke> just testing some stuff
20:55:11FromDiscord<firasuke> I do have logging planned, so thanks for pointing that out early
20:55:17FromDiscord<Phil> That allows you to output your messages with a specified format and allows you to control where that dataflow should be going
20:55:50FromDiscord<sOkam!> In reply to @firasuke "thanks, but I'm not": then just do something like `proc echod (message :string)= echo "customDateThing ", message`
20:56:10FromDiscord<Phil> Logging in nim isn't really hard to deal with.↵You have the usual procs and you can defined "Handlers" that you register per thread to let their output be thrown into the terminal or files or wherever
20:56:14FromDiscord<firasuke> In reply to @sOkam! "then just do something": exactly this looks like the most straightforward way to do it
20:56:28FromDiscord<firasuke> I mean with Nim's syntax everything just looks clean and straightforward xD
20:56:39FromDiscord<sOkam!> yeah 100% 🙂
20:56:53FromDiscord<Phil> The amount of effort of using custom echo proc-variations and using logging are fairly close
20:57:14FromDiscord<firasuke> In reply to @Isofruit "The amount of effort": I'll look into this hopefully in the near future
20:58:00FromDiscord<Phil> In reply to @sOkam! "yeah, or logit from": How's logit btw? Only used the std-lib because it fulfilled all my current needs, does logit do anything particularly special?
20:58:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4nf5
20:59:03FromDiscord<sOkam!> In reply to @Isofruit "How's logit btw? Only": looked really good, but don't have much more info beyond that, to be honest. haven't had the time to implement it yet
20:59:19FromDiscord<Elegantbeef> but yea a logging library is what you're likely after
20:59:27FromDiscord<sOkam!> all i did was analyze most of the options i found, and logit looked the best and simplest
20:59:49*fredrikhr quit (Quit: Disconnecting)
21:00:32FromDiscord<Phil> I'll be honest, having to fix the log4j issue at work and rip out all the custom-code we had there taught me way more about logging than I ever wanted to learn
21:02:54FromDiscord<Phil> Ohhhhh I finally realized how you could do routing in owlkettle, just define a "Page" enum and have the main AppState have one field for that, then you can use a case-statement in the gui-section to display the proper sub-component.... I think, maybe
21:03:07FromDiscord<Elegantbeef> Yep
21:03:36FromDiscord<firasuke> xD
21:03:55FromDiscord<Phil> The fact I got a feel for the framework after like... a day while watching videos half the time is honestly super impressive to me
21:04:07FromDiscord<Elegantbeef> Owlkettle is a nice dsl
21:04:15FromDiscord<Elegantbeef> Shame that it doesnt work on typed AST though
21:04:35FromDiscord<Phil> It's not just the DSL, the fact it starts out literally with a data store at the root level that you can pass around to lower-level components is a really good one
21:04:47FromDiscord<Elegantbeef> https://github.com/can-lehmann/owlkettle/issues/25 this annoys me to no end
21:04:56FromDiscord<Phil> (edit) "that" => "where" | "whereyou can pass ... around" added "parts of it "
21:05:11*rockcavera joined #nim
21:05:13FromDiscord<Elegantbeef> Was going to make toy system monitor but hitting this made me too annoyed to continue
21:06:00FromDiscord<Phil> Do you know of a way to test a owlkettle application?
21:06:11FromDiscord<Elegantbeef> Use it
21:06:14FromDiscord<Phil> Basically what webdriver is for webdev, something that automates clicking around and checking behaviour
21:06:25FromDiscord<Phil> That's not testing Beef, that's praying your code change doesn't break anything
21:06:33FromDiscord<Elegantbeef> Dude i do game dev
21:06:40FromDiscord<Elegantbeef> That's how a ton of gamedev is tested
21:06:50FromDiscord<Phil> That's.... terrifying
21:06:53FromDiscord<Phil> Horrendous
21:07:02FromDiscord<Phil> That's abominable !
21:07:08FromDiscord<Elegantbeef> Well i mean it's quite difficult to test many things since they're so complicated and detatched
21:07:11FromDiscord<Phil> Deplorable even !
21:07:12*PMunch quit (Quit: leaving)
21:07:16FromDiscord<Elegantbeef> Like my game presently doesnt have any testing in it
21:07:18FromDiscord<Elegantbeef> Though it should
21:07:23FromDiscord<Phil> And I've only started with the adjectives!
21:07:25FromDiscord<Elegantbeef> Since it's one of the few games that can have testing
21:07:47FromDiscord<Elegantbeef> I mean you think a game like gangbeasts is going to have a wide swath of tests for anything but backend code?
21:08:13FromDiscord<Phil> I didn't even know of the existance of anything called gangbeasts up until like 5 seconds ago
21:08:20FromDiscord<Phil> (edit) "existance" => "existence"
21:08:36FromDiscord<Elegantbeef> Well look it up and then tell me how to test that 😛
21:10:22FromDiscord<Elegantbeef> And i mean why do you even need to have something like a webdriver for owlkettle
21:10:24FromDiscord<Phil> Hmmm there's something called "dogtail"
21:10:31FromDiscord<Elegantbeef> You can just change state and do the entire logic
21:11:08FromDiscord<Elegantbeef> You have the source code, you can do `import myModule {.all.}` and have a field day running your own test suite
21:11:09FromDiscord<Phil> The reason you'd want to do testing in general:↵You'll do something complex at some point or logic will interact in ways that you overlook
21:11:34FromDiscord<Phil> For those scenarios you'll want to have a test-suite that does the typical kinds of interactions users would do with your application to see if it behaves as you'd anticipate
21:12:48FromDiscord<firasuke> what's a good argument parsing library? the ones I've checked are a bit lacking
21:12:51FromDiscord<Phil> I've got a plan for a nice owlkettle project, I'll play around with that and once I have at least some fundamental stuff going I'll look about testing
21:13:10FromDiscord<Phil> isn't that the kind of thing a CLI-lib would help with?
21:18:34FromDiscord<auxym> In reply to @firasuke "what's a good argument": cligen is likely the most popular, but there are a few other actively developed ones
21:18:34*kenran quit (Remote host closed the connection)
21:19:19FromDiscord<auxym> https://github.com/docopt/docopt.nimhttps://github.com/juancarlospaco/cliche↵come to mind
21:19:22FromDiscord<firasuke> hmmm I might write my own custom argument parser, do you advice against that?
21:19:51FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4nf9
21:20:04FromDiscord<auxym> I would unless you've already surveyed everything that already exists and decided that starting from scratch is really the best option...
21:20:08FromDiscord<auxym> @firasuke
21:20:11FromDiscord<Nilts> (edit) "https://play.nim-lang.org/#ix=4nf9" => "https://play.nim-lang.org/#ix=4nfa"
21:20:18FromDiscord<firasuke> ok thanks
21:21:04FromDiscord<Elegantbeef> It's a good way to learn `std/parseutils` 😄
21:21:06FromDiscord<sOkam!> @firasuke whats wrong about std/parseopts? i havent found a need that doesn't cover yet, for the stuff that i used so far
21:22:09FromDiscord<firasuke> I'm currently using commandLineParams xD
21:22:19FromDiscord<sOkam!> raw?
21:22:21FromDiscord<sOkam!> oh god
21:22:31FromDiscord<firasuke> umm yeah xD
21:22:46FromDiscord<firasuke> should probably throw my custom parser away and pick a ready solution
21:22:51FromDiscord<sOkam!> read the parseopts example, and stop hurting yourself man 🙈
21:23:06FromDiscord<firasuke> I have a lot of custom flags, some using `-flag` some with `flag` and some with `--flag`
21:23:09FromDiscord<Elegantbeef> I still need to work on my pragma rich parser 😄
21:23:22FromDiscord<Elegantbeef> Ew non gnu flags 😄
21:23:33FromDiscord<Elegantbeef> `-` is for short `--` is for long
21:23:50FromDiscord<sOkam!> In reply to @firasuke "I have a lot": parse opts allow for -f and --flag, and you can have flag too if you want. the single -flag would be interpreted as 4 separate short options, but the rest are covered
21:24:16FromDiscord<firasuke> some accept with `--flag=some_value` and some without `=`
21:24:18FromDiscord<sOkam!> (edit) "-f" => "`-f`" | "--flag," => "`--flag`," | "flag" => "`flag`" | "-flag" => "`-flag`"
21:24:28FromDiscord<firasuke> the most basic one is `parseopts` correct?
21:24:34FromDiscord<firasuke> and the most magical one is `docopt` xD
21:24:51FromDiscord<firasuke> I still don't get how `docopt` works
21:24:55FromDiscord<sOkam!> i mean you can call it "basic".... but you will be hardpressed to find much that it doesn't cover already
21:25:26FromDiscord<Nilts> In reply to @not logged in "Is countup broken?": Any ideas how this could happen? It is in-sync so nothing should modify it
21:25:35FromDiscord<sOkam!> this is not C where you do everything yourself. the stdlib is actually good in this lang
21:25:50FromDiscord<firasuke> so you'd recommend parseopts
21:25:57FromDiscord<firasuke> In reply to @sOkam! "this is not C": good point
21:27:00FromDiscord<Nilts> (edit) "Any ideas how this could happen? It is in-sync so nothing should modify it" => "Oops, i am deleting in the loop"
21:28:04FromDiscord<auxym> like I said check out cligen, I think it's the most used one
21:30:35FromDiscord<Nilts> cligen is easy to use
21:43:28FromDiscord<corey> Really impressed with Nim's FFI...
21:44:59FromDiscord<Elegantbeef> I'm suspicious of that elipsis
21:45:58FromDiscord<corey> Was looking for a good PDF lib in Nim and didn't seem to find any that fit the bill, so I decided to try and wrap libharu (https://github.com/libharu/libharu)
21:46:25FromDiscord<corey> I have never done any FFI and my C knowledge is only basic
21:46:57FromDiscord<corey> But within a few hours we are already rockin' and rollin' and making some nice PDFs! https://media.discordapp.net/attachments/371759389889003532/1071909819054829638/demo.png
21:48:32FromDiscord<Nilts> In nim JS, how should i convert cstring to nimstring without getting the `CStringConv` warning
21:48:42FromDiscord<Elegantbeef> `cstring myStr`
21:49:22FromDiscord<Hourglass [She/Her]> In reply to @not logged in "cligen is easy to": Cligen is cool
21:57:20*ltriant quit (Ping timeout: 248 seconds)
21:57:34*ltriant joined #nim
21:59:24FromDiscord<auxym> In reply to @corey "Was looking for a": nice. do publish these bindings if you don't mind, I'm sure I can find a use for generating PDFs from nim
22:00:08FromDiscord<corey> I'll keep you posted and once they are in a suitable state I would be happy to publish them
22:17:20*dropkick quit (Ping timeout: 246 seconds)
22:37:08FromDiscord<Nilts> In reply to @Elegantbeef "`cstring myStr`": tha is nimstring to cstring i thought
22:37:12FromDiscord<Nilts> (edit) "tha" => "that"
22:37:29FromDiscord<Elegantbeef> Ah sorry misread
22:37:33FromDiscord<Elegantbeef> `$ myCstring`
22:39:59*koltrast joined #nim
22:43:29*adium quit (Ping timeout: 260 seconds)
22:45:07*adium joined #nim
22:48:20FromDiscord<Nilts> In reply to @Elegantbeef "`$ myCstring`": i get a `CStringConv` warning for that
22:48:43FromDiscord<jtv> You shouldn't, that's the way to do the conversion
22:49:54FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4nfs
22:50:04FromDiscord<Elegantbeef> You're passing to a cstring then
22:50:16FromDiscord<Elegantbeef> what is `typeof(lineCount)`?
22:50:23FromDiscord<Nilts> oh!
22:50:52FromDiscord<Nilts> In reply to @Elegantbeef "what is `typeof(lineCount)`?": int
22:51:03FromDiscord<Elegantbeef> So then `cstring $lineCount`
22:52:00FromDiscord<Nilts> Ok, new problem, i can't get `nim doc` to work with js, as the Dom and Jsffi modules all throw errors
23:00:31*krux02 joined #nim
23:29:20FromDiscord<Papel> Maybe dumb question: is it possible to try something similar to SectorLISP or SectorFORTH, but with Nim? As in, a bootstrapping of the bare minimum of the compiler/language interpreter within the bootsector code?
23:58:49*krux02_ joined #nim