<< 03-12-2025 >>

00:11:59FromDiscord<litlighilit> however python's slice doesn't contains `contains` method either↵(<@709044657232936960_mid-kid=5b=49=52=43=5d>)
00:13:00FromDiscord<litlighilit> however python's slice doesn't own↵contains method either
00:13:08FromDiscord<litlighilit> however python's slice doesn't owncontains method either
00:13:26FromDiscord<litlighilit> however python's slice doesn't own `contains` method either
00:20:36FromDiscord<litlighilit> however python's slice doesn't own `contains` method either,↵but range does.in case you want see it in nim, here is how i implemented\: [https://docs.nimpylib.org/pylib/builtins/pyrange.html#contains%2CPyRange%5BT%5D%2CT](https://docs.nimpylib.org/pylib/builtins/pyrange.html#contains%252CPyRange%255BT%255D%252CT)↵(click `Source` link to for details)
00:21:26FromDiscord<litlighilit> however python's slice doesn't own `contains` method either,↵but range does.in case you want see it in nim, here is how i implemented\: [NimPyLib docs of PyRange.contains](https://docs.nimpylib.org/pylib/builtins/pyrange.html#contains%2CPyRange%5BT%5D%2CT)↵(click `Source` link to for details)
00:22:25FromDiscord<litlighilit> but range does.in case you want see it in nim, here is how i implemented\: [NimPyLib docs of PyRange.contains](https://docs.nimpylib.org/pylib/builtins/pyrange.html#contains%2CPyRange%5BT%5D%2CT)↵(click `Source` link to for details)
00:23:00FromDiscord<litlighilit> but range does.in case you want see it in Nim, here is how it can be implemented in Nim\: [NimPyLib docs of PyRange.contains](https://docs.nimpylib.org/pylib/builtins/pyrange.html#contains%2CPyRange%5BT%5D%2CT)↵(click `Source` link to for details)
00:27:23*ehmry quit (Ping timeout: 260 seconds)
00:28:57FromDiscord<litlighilit> You can see that python is the one special.Almost all other languages result in the same for int division just like nim (e.g. C, Java, Lisp)↵(@nocturn9x)
00:29:59FromDiscord<janakali> In reply to @nocturn9x "any idea why `-18": in Nim `mod` is a remainder, you need `euclMod` from `std/math` for modulo
00:36:08FromDiscord<litlighilit> you can overload your own `//` for integer, as in Nim operator definition is non-invasive, like Rust, like [NimPyLib's definition of `//`](https://docs.nimpylib.org/pylib/ops.html#%2F%2F%2CA%2CB)
00:38:35*beholders_eye quit (Ping timeout: 240 seconds)
00:38:55FromDiscord<systemblue_2010> sent a code paste, see https://play.nim-lang.org/#pasty=vPUOIsZf
00:39:07FromDiscord<systemblue_2010> (edit) "https://play.nim-lang.org/#pasty=GCSeRddO" => "https://play.nim-lang.org/#pasty=VZILVffR"
00:39:20FromDiscord<systemblue_2010> (edit) "https://play.nim-lang.org/#pasty=rTCcQnWP" => "https://play.nim-lang.org/#pasty=reqKlISJ"
00:41:41FromDiscord<litlighilit> (however it's Nim's `floorMod` instead of `euclMod` that is equivalent to python's `%`)↵(@janakali)
00:41:48FromDiscord<litlighilit> how can seq be nil?↵(@systemblue_2010)
00:41:52FromDiscord<litlighilit> seq can never be nil, so such notation is meaningless thus invalid
00:41:58FromDiscord<systemblue_2010> wt?
00:42:01FromDiscord<systemblue_2010> really?
00:42:04FromDiscord<systemblue_2010> seq can't be nil?
00:42:22FromDiscord<litlighilit> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1445575686713774111): (however it's Nim's `floorMod` rather than `euclMod` that is equivalent to python's `%`)
00:42:38FromDiscord<systemblue_2010> sent a code paste, see https://play.nim-lang.org/#pasty=XmCwOKKW
00:42:41FromDiscord<litlighilit> seq may be empty, but never nil
00:42:46FromDiscord<systemblue_2010> if you do this you will get error
00:43:35FromDiscord<litlighilit> shouldn't it?↵(@systemblue_2010)
00:43:46FromDiscord<litlighilit> just like any other langs except for js
00:43:57FromDiscord<Buckwheat> yeah, that sounds like correct behaviour
00:50:19FromDiscord<systemblue_2010> In reply to @litlighilit "Nim has both borrow": does Nim have borrow checker?↵really?
00:51:12FromDiscord<litlighilit> https://nim-lang.org/docs/destructors.html#lent-type
00:52:16FromDiscord<systemblue_2010> hey lent is not borrow checker
00:52:31FromDiscord<systemblue_2010> it's just immutable reference
00:52:33FromDiscord<Buckwheat> that was not what lit was trying to imply
00:52:53FromDiscord<Buckwheat> there is an experimental feature for the Nim compile iirc that includes a borrow checker
00:52:59FromDiscord<Buckwheat> keyword, experimental
00:53:02FromDiscord<systemblue_2010> and even i can't use lent in proc↵only can use in template or func
00:53:20FromDiscord<litlighilit> there're owned[T] type.
00:53:26FromDiscord<litlighilit> and there're owned[T] type.
00:53:44FromDiscord<systemblue_2010> owned[T] and sink[T] move ownership to function↵it's similar with Rust's but
00:53:49FromDiscord<systemblue_2010> it's not borrow
00:54:12FromDiscord<systemblue_2010> borrow means, if function ends, ownership must be returned
00:54:29FromDiscord<systemblue_2010> but owned[T] does not return it ↵it just move it
00:54:39FromDiscord<systemblue_2010> so I think Nim need borrow[T]
00:55:36FromDiscord<systemblue_2010> most times, borrow checker is for concurrency programming and parallel work
00:55:43FromDiscord<systemblue_2010> memory safety is not main
00:55:44FromDiscord<Buckwheat> from what it looks like, it's not meant to be used as a parameter, it's meant to be a return type
00:55:44FromDiscord<Buckwheat> though please correct me if I'm wrong
00:55:45FromDiscord<litlighilit> and also\: sink
00:55:46FromDiscord<litlighilit> nope, it can be said a type of borrow check↵(@systemblue_2010)
00:55:47FromDiscord<litlighilit> see also\: sink
00:55:47FromDiscord<litlighilit> see also\: `sink`
00:55:47FromDiscord<Buckwheat> yeah, looking at that now
00:55:47FromDiscord<Buckwheat> you should probably read that doc lit sent (like I am) before saying so
00:56:37FromDiscord<Buckwheat> ah yeah, this definitely makes sense, I might have to play with this. thanks lit.
00:56:40FromDiscord<systemblue_2010> what is sent?
00:57:16FromDiscord<litlighilit> sent a code paste, see https://play.nim-lang.org/#pasty=hAJkGmIL
00:57:31FromDiscord<litlighilit> sent a code paste, see https://play.nim-lang.org/#pasty=sgcXPzct
00:59:12FromDiscord<litlighilit> lol but whoever uses rust just cannot get rid of borrow check even if not parallel↵(@systemblue_2010)
00:59:42FromDiscord<janakali> sent a code paste, see https://play.nim-lang.org/#pasty=CoBmATJf
01:02:40FromDiscord<litlighilit> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1445579232469057628): see also\: [`sink`](https://nim-lang.org/docs/destructors.html#sink-parameters)
01:15:05FromDiscord<litlighilit> nim has its own methods for race condition (note rust's borrow check itself only enforces there're no race condition)for example, one can\:↵● use pragma\: noSideEffect, guard, locks to make sure compiler check for you\: https://nim-lang.org/docs/manual.html#guards-and-locks↵● Or uses message ([Channel](https://nim-lang.org/docs/system.html#Channel))\: https://nim-lang.org/docs/system.html#example↵(@systemblue_2010)
01:17:01FromDiscord<Buckwheat> don't think I need to say this but as well... don't only trust the compiler, writing reasonable code also helps not have any of these issues
01:17:04FromDiscord<Buckwheat> compilers can only do so much
01:17:39FromDiscord<Buckwheat> help your compiler help you, maybe is the words I ought to use here?
01:18:10FromDiscord<systemblue_2010> but there's no temporary mutable reference that can be returned after function ended
01:19:08FromDiscord<litlighilit> lol but i'm the one who cannot bother writting rust
01:19:27FromDiscord<Buckwheat> me neither... the language is a type soup that gives me C++ war flashbacks
01:19:51FromDiscord<litlighilit> var↵(@systemblue_2010)
01:19:57FromDiscord<systemblue_2010> Vec<T> is similar with owned or sink↵&Vec<T> is similar with lent↵but there's no &mut Vec<T>
01:20:07FromDiscord<systemblue_2010> In reply to @litlighilit "var (<@1436476641726435469>)": var is not safe..
01:20:08FromDiscord<Buckwheat> lit just said var
01:20:31FromDiscord<litlighilit> sure↵(@systemblue_2010)
01:20:31FromDiscord<Buckwheat> nothing is safe if you write it to be unsafe...
01:20:46FromDiscord<litlighilit> but iirc nim checks safety somehow
01:20:56*rockcavera quit (Ping timeout: 240 seconds)
01:21:05FromDiscord<Buckwheat> probably a compile time flag
01:21:08FromDiscord<Buckwheat> I'd imagine
01:21:32FromDiscord<Buckwheat> idk I just use the GC personally, I don't try to act smarter than the compiler, it knows better than I do
01:21:32FromDiscord<litlighilit> https://nim-lang.org/docs/manual.html#procedures-var-return-type
01:22:03FromDiscord<litlighilit> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1445585291992629260): var return type
01:22:36FromDiscord<litlighilit> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1445585714912952443): https://nim-lang.org/docs/manual.html#procedures-var-return-type says↵> It is a static error if the implicitly introduced pointer could be used to access a location beyond its lifetime\:
01:24:54FromDiscord<litlighilit> oh here you just mean var param↵(@systemblue_2010)
01:26:57FromDiscord<litlighilit> for this nim has [var param](https://nim-lang.org/docs/manual.html#procedures-var-parameters),↵which does nothing with `var is not safe`↵(@systemblue_2010)
01:28:18FromDiscord<litlighilit> btw nim has `out`, too
01:28:28FromDiscord<systemblue_2010> but var is not safe in concurrency and parallel
01:28:43FromDiscord<Buckwheat> yeah I think that'd be similar? I understand that as being like passing a variable reference in C
01:29:49FromDiscord<litlighilit> er, so just no one shall use C# or python-FT(free-threaded) or C++↵(@systemblue_2010)
01:29:57FromDiscord<Buckwheat> or nearly every other language
01:30:14FromDiscord<Buckwheat> Go does similar things in Goroutines, and concurrency is a big part of Go
01:30:28FromDiscord<litlighilit> nim has other models for this, mentioned above↵(@systemblue_2010)
01:30:39FromDiscord<Buckwheat> again, like I said before... these things are unsafe if you write them to be unsafe
01:30:57FromDiscord<Buckwheat> help the compiler help you
01:32:34FromDiscord<litlighilit> and you need only to bother considering these iff you're writting the parallel part
01:34:39FromDiscord<litlighilit> most code is still single-threaded, at least for me
01:35:05FromDiscord<Buckwheat> I definitely do some multi-thread stuff, but I also make sure to use semaphores and mutexes and all that fun stuff
01:35:38FromDiscord<Buckwheat> but I mainly do that in Go where it's heavily baked into the language
01:35:55FromDiscord<systemblue_2010> for multi thread it's good to use spawn/channel and let
01:36:21FromDiscord<Buckwheat> I think you're mostly thinking of this in the context of Pure FP, am I right?
01:36:25FromDiscord<systemblue_2010> I think nim need to add more systems about parallel and concurrent
01:36:29FromDiscord<systemblue_2010> (edit) "concurrent" => "concurrency"
01:36:40FromDiscord<Buckwheat> the worry around var is very much signaling a Pure FP mindset
01:37:25FromDiscord<systemblue_2010> nono I don't like pure FP
01:37:39FromDiscord<litlighilit> for example?↵(@systemblue_2010)
01:38:02FromDiscord<systemblue_2010> I'm saying this because sometime, i need reference type or mutable type in parallel system
01:38:05FromDiscord<Buckwheat> mutability is one of the primary foundations of Pure FP and Pure FP is the most concerned about mutation more than any paradigm from how I learned about FP
01:39:14FromDiscord<litlighilit> just use explicit notation mentioned above↵(@systemblue_2010)
01:39:15FromDiscord<systemblue_2010> In reply to @litlighilit "for example? (<@1436476641726435469>)": borrow[T], system like goroutine and coroutine
01:39:35FromDiscord<Buckwheat> I'm gonna go with lit here, explicit notation
01:39:44FromDiscord<Buckwheat> unless you want to somehow implement something similar to Go's channels
01:40:24FromDiscord<systemblue_2010> In reply to @Buckwheat "mutability is one of": I heard pure FP programming language does not have mutable variables
01:40:45FromDiscord<Buckwheat> correct, because that's considered a side effect, and that's why it sounds like you're thinking in Pure FP to me↵(@systemblue_2010)
01:41:09FromDiscord<Buckwheat> and since you're making the Rust comparisons, that makes sense because that's also how Rust behaves, is in this Pure FP type manner
01:41:55FromDiscord<systemblue_2010> Rust has mutable variable is int?
01:41:58FromDiscord<Buckwheat> problem is, you're trying to apply that logic to a language that's not Pure FP, so... to get similar behaviours, gonna have to find workarounds or build your own solutions
01:42:00FromDiscord<systemblue_2010> (edit) "int?" => "it?"
01:42:16FromDiscord<Buckwheat> only with a certain keyword, beyond that it acts more in an FP sense↵(@systemblue_2010)
01:42:37FromDiscord<Buckwheat> I've written enough Haskell to feel the similarities between the 2
01:43:03FromDiscord<Buckwheat> but anyways... that's neither here nor there. I think lit has the best solution to your issue and if that's good enough well... tough luck
01:43:31FromDiscord<Buckwheat> but anyways... that's neither here nor there. I think lit has the best solution to your issue and if that's not good enough well... tough luck
03:52:20*SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev)
03:52:52*SchweinDeBurg joined #nim
04:24:59*zero`__ joined #nim
04:24:59*zero`_ quit (Read error: Connection reset by peer)
04:36:16*zero` joined #nim
04:37:19*zero`__ quit (Read error: Connection reset by peer)
04:37:36*zero`_ joined #nim
04:40:31*zero` quit (Ping timeout: 240 seconds)
05:45:03*zero`_ quit (Read error: Connection reset by peer)
06:05:12*zero` joined #nim
06:29:31FromDiscord<nnsee> In reply to @systemblue_2010 "but var is not": neither is `&mut Vec<T>` in rust though
06:29:45FromDiscord<nnsee> which is why it's usually wrapped in a mutex or other sort of lock
06:29:58FromDiscord<nnsee> which is what you would also do in nim
06:42:27FromDiscord<nnsee> and if you want to be explicit that your data needs to be locked, you can wrap it in a struct to indicate it in the procedure signature, something like https://play.nim-lang.org/#pasty=NZLExWfd
06:44:46FromDiscord<nnsee> (or just a Lock in the signature)
11:45:21*beholders_eye joined #nim
12:16:32FromDiscord<devilcrow9857> sent a code paste, see https://play.nim-lang.org/#pasty=lNhTFgMj
12:18:21FromDiscord<nasuray> Can you share the exact command and error message? And if you have any project config files (config.nims/nim.cfg)
12:19:48FromDiscord<devilcrow9857> sent a code paste, see https://play.nim-lang.org/#pasty=kKZGQkLS
12:25:35*beholders_eye quit (Ping timeout: 240 seconds)
12:29:16FromDiscord<punch5799> is there a way to get wrap around behavior on a type? For instance if I have a type defined as a range[0..512] is there a way to perform arithmetic on it such that it just wraps around rather than going out of bounds?
12:36:22FromDiscord<nnsee> sent a code paste, see https://play.nim-lang.org/#pasty=iIToLITw
12:36:29FromDiscord<lainlaylie> you only require websock as a dependency, which doesnt require json_rpc, so it's fair enough that nim can't find it?
12:37:02FromDiscord<devilcrow9857> right, well, in this case i swapped over to json_rpc to see if maybe that would work
12:37:15FromDiscord<nnsee> what was the original error, then?
12:37:21FromDiscord<devilcrow9857> the same, just with websocket
12:37:30FromDiscord<nnsee> can you paste the actual error?
12:37:30FromDiscord<lainlaylie> show nimble file, main file, and error
12:40:09FromDiscord<devilcrow9857> sent a code paste, see https://play.nim-lang.org/#pasty=dMWgWpjL
12:44:25FromDiscord<nnsee> sent a code paste, see https://play.nim-lang.org/#pasty=dynfbNCi
12:44:42FromDiscord<nnsee> to be clear, you should be importing json_rpc/rpcserver, not just json_rpc
12:44:48FromDiscord<nnsee> does the example not compile for you?↵https://github.com/status-im/nim-json-rpc?tab=readme-ov-file#example
12:46:00FromDiscord<devilcrow9857> It does not
12:46:14FromDiscord<devilcrow9857> `Error: cannot open file: json_rpc/rpcserver`
12:47:25FromDiscord<nnsee> that's pretty odd, can you clear the nimble cache dir (`.nimble/pkg`) and redownload the package list using `nimble refresh` and try again? seems to be working fine over here
12:47:46FromDiscord<lainlaylie> before we do that.. are you compiling the example via nimble or using nim directly?
12:47:53FromDiscord<devilcrow9857> nimble
12:47:59FromDiscord<devilcrow9857> `nimble build`
12:48:07FromDiscord<lainlaylie> and youve declared json_rpc as a dependency?
12:48:09FromDiscord<lainlaylie> it works for me
12:48:10FromDiscord<janakali> @devilcrow9857 is there a `nimble.paths` in your project directory?
12:48:22FromDiscord<devilcrow9857> Yes
12:48:35FromDiscord<lainlaylie> nimble setup
12:48:45FromDiscord<janakali> @devilcrow9857 do `nimble setup` and try again
12:49:07FromDiscord<devilcrow9857> still errors the same
12:50:26FromDiscord<nnsee> In reply to @janakali "<@835704949609332746> is there a": wait but why
12:50:38FromDiscord<lainlaylie> i think the vscode extension runs nimble setup automatically
12:50:42FromDiscord<nnsee> oh
12:51:09FromDiscord<lainlaylie> which would be fine if other nimble commands would keep nimble.paths up to date as well..
12:51:58FromDiscord<devilcrow9857> idk why it would, but lemme reboot pc to see if that fixes it for some reason
12:52:10FromDiscord<lainlaylie> i doubt itll fix it
12:52:28FromDiscord<lainlaylie> you need to debug where nim is getting its --path arguments and why they are wrong
12:53:48FromDiscord<nasuray> In reply to @lainlaylie "i think the vscode": Eww what
12:54:22FromDiscord<lainlaylie> i think the idea is so that nimlangserver/nimsuggest is able to pick up nimble deps without you having to manually run nimble setup beforehand
12:54:36FromDiscord<nasuray> Please post the full output of nimble build --debug
12:54:44FromDiscord<lainlaylie> but it has the side effect that if you change your dependencies without rerunning nimble setup, your --path will be unexpectedly wrong
12:56:03FromDiscord<lainlaylie> but since `nimble build` supplies each --path directly to the nim command, doesnt that override any outdated `nimble.paths`?
12:58:05FromDiscord<devilcrow9857> In reply to @nasuray "Please post the full": https://media.discordapp.net/attachments/371759389889003532/1445761003454201990/message.txt?ex=6931855c&is=693033dc&hm=9b302a135e4a73b567c3fc3feff7fdc3c3a7788f06da6027b45a3a1c6a8e4c1f&
12:58:58FromDiscord<lainlaylie> jsonrpc is missing from the --path
12:59:04FromDiscord<lainlaylie> (edit) "jsonrpc" => "json_rpc"
13:00:09FromDiscord<lainlaylie> it just looks like you havent `requires "json_rpc"`'d
13:00:15FromDiscord<devilcrow9857> but i have
13:00:24FromDiscord<devilcrow9857> https://media.discordapp.net/attachments/371759389889003532/1445761588173733918/image.png?ex=693185e7&is=69303467&hm=734d19b979c3d542ee33fa86ababf7db4da736aaaf2bf55bb97dcc62f11ae520&
13:00:43FromDiscord<lainlaylie> are you running `nimble build` from the same folder as that .nimble file?
13:00:48FromDiscord<devilcrow9857> Yes
13:04:17FromDiscord<devilcrow9857> okaayy↵i don't know exactly what happened here↵↵but i just created a new folder, and setup everything from the start, albeit the exact same, and now it can import it?
13:17:58FromDiscord<lainlaylie> would be nice to get to the bottom of what caused it though
13:18:40FromDiscord<lainlaylie> nimble build should generate the correct --path arguments regardless of any nimble.paths, so it's strange that it doesn't do so even though json_rpc is in your nimble file
13:19:07FromDiscord<nnsee> fwiw, i just did `nimble setup` in my test setup and it still worked fine
13:19:17FromDiscord<nnsee> so it's not like `nimble setup` is generating the wrong paths file
13:19:18FromDiscord<nnsee> hopefully
13:19:33FromDiscord<lainlaylie> it shouldnt be, and even if it did it shouldnt affect `nimble build`
13:22:54FromDiscord<devilcrow9857> i have no clue
13:31:41FromDiscord<janakali> sent a long message, see https://pasty.ee/BDipCncp
13:31:42FromDiscord<janakali> and `nimble.paths` is empty
13:32:11FromDiscord<nnsee> you don't `import json_rpc`, you `import json_rpc/rpcserver`
13:32:14FromDiscord<nnsee> i did say this above
13:32:44FromDiscord<nnsee> i did all of the steps you listed but the correct import and all of my builds worked and nimble.paths was not empty
13:34:45FromDiscord<lainlaylie> sent a long message, see https://pasty.ee/GFCAeVNm
13:36:13FromDiscord<lainlaylie> msgpack4nim is nimrpc's sole dependency, so somewhere there must be a nimble file with `requires "nimrpc"` that nimble is for some reason using instead of the one with `requires "json_rpc"`
14:05:34*hygo quit (Ping timeout: 244 seconds)
14:06:35*hygo joined #nim
15:04:45*amadaluzia joined #nim
15:21:17*beholders_eye joined #nim
15:46:04FromDiscord<litlighilit> overload `+-/` for this type↵(@punch5799)
15:47:40FromDiscord<litlighilit> if for typical int types like \`int8\`, \`int32\`,↵there're \`+%\`, \`\%\`, etc. already defined in system
15:47:52FromDiscord<litlighilit> If for typical int types like \`int8\`, \`int32\`,↵there're \`+%\`, \`\%\`, etc. already defined in system
15:48:13FromDiscord<litlighilit> If for typical int types like `int8`, `int32`,↵there're `+%`, `%`, etc. already defined in system
15:48:23FromDiscord<litlighilit> If for typical int types like `int8`, `int32`,↵there're `+%`, `%`, etc. already defined in system
16:06:16*cornfeedhobo quit (Quit: Goodbye)
16:21:25*cornfeedhobo joined #nim
16:52:53*lumidify quit (Quit: leaving)
16:54:15*lumidify joined #nim
17:20:33*xet7 joined #nim
18:15:34FromDiscord<_.ralf> sent a code paste, see https://play.nim-lang.org/#pasty=HJuXWYtx
18:16:19FromDiscord<_.ralf> (edit) "https://play.nim-lang.org/#pasty=uXHByTAL" => "https://play.nim-lang.org/#pasty=RIHaOvTK"
18:33:19FromDiscord<lainlaylie> did you try doing as the error message suggests
18:42:56FromDiscord<nasuray> > Error: unhandled exception: SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable. [HttpRequestError]
19:00:45FromDiscord<lainlaylie> would be funny if someone here tried to debug it by running the program
19:08:15FromDiscord<_.ralf> In reply to @lainlaylie "would be funny if": yea... well i testedt it it runned but wasnt sending anything
19:08:28FromDiscord<_.ralf> but i guess someone deleted the webhook xD
19:39:06FromDiscord<fridge777> hi, any way to hoist procedures in nim? i was surprised that i had to declare it above the code i used it in
19:48:49FromDiscord<Robyn [She/Her]> In reply to @fridge777 "hi, any way to": there is forward declarations, but ideally write your code in a way that avoids them
19:49:33FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=tWnrrUXA
19:49:50FromDiscord<Robyn [She/Her]> you write the signature above the usage site, and then the implementation somewhere below
19:49:52FromDiscord<fridge777> oh like headers...
19:50:03FromDiscord<Robyn [She/Her]> Keep in mind it has to match exactly at all times o7
19:50:04FromDiscord<fridge777> thank you, whats the reasoning for not hoisting?
19:50:30FromDiscord<Robyn [She/Her]> In reply to @fridge777 "thank you, whats the": For me it's just preference, it feels unhygienic when you do it often
19:52:10FromDiscord<fridge777> alright. well maybe it will make me clutter my code less lol
19:52:50FromDiscord<fridge777> for small script files i always tend to put the main stuff at the top and then all the functions below so i immediately tripped over this
20:17:32*joast quit (Quit: Leaving.)
21:05:43*beholders_eye quit (Ping timeout: 244 seconds)
21:19:01*xet7 quit (Remote host closed the connection)
21:19:56FromDiscord<Elegantbeef> Would require a second pass to reorganize code, but really why are you writing code that's hard to read 😄
21:19:56FromDiscord<Elegantbeef> @fridge777 Nim is a single pass compiler
21:19:56FromDiscord<Buckwheat> I'll second that
21:20:02FromDiscord<Buckwheat> gotta make your code maintainable and that means making it readable
21:21:49FromDiscord<fridge777> i dont think it makes it hard to read but fair enough
21:22:19FromDiscord<Elegantbeef> Well top to bottom is nice cause you see what's available as you scroll instead of requiring tooling, but it's subjective of course
21:22:20FromDiscord<Buckwheat> it's a lot of unnecessary writing you'd need to do in my opinion
21:22:36FromDiscord<Buckwheat> subjective but it's also the most reasonable stance
21:23:15FromDiscord<Buckwheat> personally I organize in alphabetical order with a `main` function that I use as an entry point that I then call in a `when isMainModule:` statement
21:23:28FromDiscord<fridge777> personally i dont read code top to bottom \:P
21:23:33FromDiscord<Elegantbeef> Alphabetical order is silly
21:23:44FromDiscord<Elegantbeef> Code should be written as it's needed and life is swell
21:24:07FromDiscord<Buckwheat> what if I need it alphabetical order otherwise I get annoyed trying to read it?
21:24:11FromDiscord<Buckwheat> ;D
21:24:11FromDiscord<fridge777> really, having to write code in 2 dimensions is a limitation, code is more like a graph anyway
21:24:28FromDiscord<Buckwheat> if I know the first letter of the function, I know "ah it's probably near this part of the source file"
21:24:41FromDiscord<Elegantbeef> It might be graph shaped, but it's lexical and as such it fits better to match what I'm used to reading
21:25:52FromDiscord<Elegantbeef> Code can be many things but as is its written word, and written word where I'm from is top to bottom!
21:26:18FromDiscord<Elegantbeef> I hate trying to contribute to a project and having to jump around a file to understand what the fuck is going on
21:26:23FromDiscord<Buckwheat> yeah me too
21:26:47FromDiscord<Buckwheat> I always decide on a convention first before I ever write code whenever I work with others
21:26:54FromDiscord<Elegantbeef> It's one of the big benefits to C to me
21:26:55FromDiscord<Buckwheat> I have very hardcore and strict limitations for myself
21:26:59FromDiscord<fridge777> that speaks more to bad overall structure than order of functions imo
21:27:13FromDiscord<Buckwheat> right??? I really like the way C can be written
21:27:17FromDiscord<fridge777> i dont read every single helper function, i start at the start and branch out from there
21:27:43FromDiscord<Buckwheat> are you also one of those types that separates not only the brace from the function but also the return type to make it easier to `grep`???
21:27:59FromDiscord<fridge777> who greps code?
21:28:05FromDiscord<Elegantbeef> I like to read what a module or file has available and where, it's easier to map a file when you can scroll down and just read it normally
21:28:05FromDiscord<Buckwheat> me
21:28:11FromDiscord<fridge777> just use a good editor
21:28:21FromDiscord<Elegantbeef> @Buckwheat I don't often write C
21:28:26FromDiscord<fridge777> i just ctrl click the function and jump to definition
21:28:38FromDiscord<Buckwheat> I use the best in the game (Emacs)↵(@fridge777)
21:28:40FromDiscord<Buckwheat> and even then
21:28:45FromDiscord<Buckwheat> I'm very comfy in a terminal
21:29:26FromDiscord<Buckwheat> if I'm running it from a terminal (which I am), and the error or compiler tells me the problem, cool, I can `grep` and get the line
21:30:01FromDiscord<threefour> In reply to @fridge777 "who greps code?": I project search via ripgrep frequently
21:30:20FromDiscord<Buckwheat> I forgot about ripgrep eheh
21:30:24FromDiscord<Buckwheat> it's a fantastic tool
21:30:35FromDiscord<Elegantbeef> Tools are for nerds!
21:30:38FromDiscord<fridge777> i guess we just work on different stuff. some languages might not have proper static code analysis
21:31:00FromDiscord<Elegantbeef> I mean I only work in compiled static languages
21:31:13FromDiscord<Buckwheat> yeah I predominantly use compiled things myself
21:31:18FromDiscord<Elegantbeef> It doesn't change my view, things should be declared before use and it makes it easier to on board yourself into understanding code
21:31:27FromDiscord<Buckwheat> yeah, I would agree with that
21:31:36FromDiscord<Elegantbeef> Tooling is great and all, but I want to map code out
21:31:48FromDiscord<threefour> I use both the LSP functionality for jumping around as well as ripgrep. Good for different situations.
21:32:09FromDiscord<fridge777> whats a situation where you would grep over the other thing?
21:32:10FromDiscord<Buckwheat> let me guess, you have Emacs plugins for all that? ;D↵(@threefour)
21:32:12*rockcavera joined #nim
21:32:53FromDiscord<threefour> Eglot which us built in, and projectile which uses ripgrep.
21:32:59FromDiscord<threefour> (edit) "us" => "is"
21:33:06FromDiscord<Buckwheat> right, I'm using eglot for LSP too
21:33:29FromDiscord<Buckwheat> the situation is if you're someone who's faster with a keyboard than with a mouse↵(@fridge777)
21:33:58FromDiscord<fridge777> well, theres still hotkeys for symbol search
21:34:13FromDiscord<Buckwheat> also depends on your editor
21:34:25FromDiscord<Buckwheat> if you're using something like VS Code/VSCodium (ew), then that's probably the route you want
21:34:26FromDiscord<fridge777> if emacs doesnt have that how can it be the best in the game
21:34:31FromDiscord<fridge777> 😌
21:34:45FromDiscord<Buckwheat> cause it's the most moddable editor, and if you really want that?
21:34:50FromDiscord<Buckwheat> make your own dotfile for it ;D
21:35:17FromDiscord<fridge777> i want sensible defaults
21:35:24FromDiscord<threefour> In reply to @fridge777 "if emacs doesnt have": My mouse never touches Emacs
21:35:31FromDiscord<Buckwheat> yeah same
21:35:34FromDiscord<Buckwheat> all keystrokes for me
21:36:19FromDiscord<Buckwheat> I already use a tiling WM that emphasizes keyboard usage, so I'm already pretty quick with that kinda thing in Emacs
21:36:48FromDiscord<saint._._.> In reply to @fridge777 "if emacs doesnt have": nvim
21:37:14FromDiscord<Buckwheat> Neovim is not mouse-heavy either though
21:37:22FromDiscord<threefour> I wish there was a good keyboard-only solution for the browser. The extensions like Vimium feel hacky, and Nyxt just isn't caught up. It needs to be able to run Dark Reader and uBlock Origin if I'm gonna use it.
21:37:47FromDiscord<fridge777> i didnt mean to start an editor holy war, my bad
21:37:58FromDiscord<saint._._.> emacs used to be better than vim even though i never used emacs and only used vim but nvim has overtaken emacs with the rapid rate of plugin dev etc imo
21:38:20FromDiscord<Buckwheat> mostly because the Emacs nerds like me are happy to implement their own solutions↵(@saint._._.)
21:38:21FromDiscord<threefour> This probably belongs in offtopic
21:38:25FromDiscord<Buckwheat> true
21:38:30FromDiscord<Buckwheat> to offtopic we gooooo
21:38:38FromDiscord<saint._._.> In reply to @threefour "I wish there was": vimium is decent but i don’t really navigate all that much with it. Mouse is just better for web for the most part
21:40:29FromDiscord<threefour> Unfortunately yeah mouse seems unavoidable
21:40:30*FromDiscord quit (Remote host closed the connection)
21:40:43*FromDiscord joined #nim
21:41:04FromDiscord<fridge777> nim question interjection: can a proc have a mutable integer argument
21:41:14FromDiscord<fridge777> or should i shadow it
21:41:20FromDiscord<Elegantbeef> `i: var int`
21:41:33FromDiscord<Buckwheat> I was about to say I think passing the param as var
21:41:34FromDiscord<Elegantbeef> Unless you mean locally mutable then you shadow it
21:41:40FromDiscord<fridge777> when i pass 2 it says expression '2' is immutable, not 'var'
21:41:56FromDiscord<fridge777> with the var int syntax
21:42:00FromDiscord<Elegantbeef> Right you mean locally mutable
21:42:03FromDiscord<Elegantbeef> Then you shadow it
21:42:11FromDiscord<fridge777> okay thank you
21:42:19FromDiscord<Elegantbeef> Technically you can cheat and use `sink int` but that's for ownership and is silly here
21:42:58*joast joined #nim
21:43:09FromDiscord<fridge777> ownership huh? cant wait to dive a bit deeper nim seems very cool so far
21:43:27FromDiscord<fridge777> i was annoyed with the lambda syntax but importing sugar fixed it for me
21:43:37FromDiscord<fridge777> very nifty
21:47:32FromDiscord<fridge777> if anyone did day 3 of aoc in nim id love to see it
21:47:43FromDiscord<fridge777> i just finished but theres probably more idiomatic ways or whatever
21:53:20*beholders_eye joined #nim
22:39:03FromDiscord<anuke> If my aim is to write integers and bytes to a memory buffer, is StringStream from the stdlib the best tool for the job? I vaguely remember hearing about performance issues related to that type, but I don't know if it's relevant these days
22:39:19FromDiscord<anuke> (I am not serializing anything)
22:40:35FromDiscord<ieltan> for loop
22:47:57FromDiscord<Elegantbeef> Stringstream should suffice, but you also can just copymem
22:52:49FromDiscord<anuke> Writing my own memory buffer with copyMem and capacity checks would just be reinventing the wheel, no?
22:55:39FromDiscord<Elegantbeef> `seq[byte]` and copymem is simpler than string stream and would remove some of the performance issues
22:59:20FromDiscord<anuke> I suppose my question is, are these performance issues bad enough for me to write my own implementation, and are there really no other libraries for this? status/faststreams doesn't compile on 2.x
23:02:57FromDiscord<punch5799> good rule of thumb is don't worry about the performance until you need to
23:03:06FromDiscord<punch5799> if you need the speed, then roll your own
23:06:00FromDiscord<punch5799> Question: Does anyone know if nim supports modular types like Ada? I'm doing this day 1 challenge late for aoc, and while I can do my own wrap around logic, this is a perfect instance for defining a modular type, but I'm having a hard time finding anything related to it. I tried using a ranged type with unsigned ints, but it looks like it still performs bounds checks. Any ideas?
23:25:39*beholders_eye quit (Quit: WeeChat 4.7.2)
23:28:43*beholders_eye joined #nim
23:42:49FromDiscord<fridge777> you should be able to turn overflow checks off with compiler options at least