01:41:36 | * | Batzy quit (Ping timeout: 252 seconds) |
02:03:15 | FromDiscord | <goerge_lsd> https://nim-lang.org/docs/winlean.html#SocketHandle why is a socket handle something windows specific ? |
02:04:32 | FromDiscord | <Elegantbeef> It's not |
02:04:55 | FromDiscord | <Elegantbeef> https://github.com/search?q=repo%3Anim-lang%2FNim%20SocketHandle&type=code |
02:05:57 | FromDiscord | <goerge_lsd> i was looking at the index, there's only winlean is linked to it |
02:06:04 | FromDiscord | <goerge_lsd> https://nim-lang.org/docs/theindex.html#SocketHandle |
02:06:10 | FromDiscord | <Elegantbeef> Docs default to windows afaik |
02:07:04 | FromDiscord | <goerge_lsd> was trying to use that ioctl thing, but it wants a FileHandle, and getFd on socket returns a socketHandle |
02:07:21 | FromDiscord | <goerge_lsd> I guess it should accept a Socket Handle as well no ? |
02:07:24 | FromDiscord | <Elegantbeef> `cint` |
02:07:26 | FromDiscord | <goerge_lsd> I mean, design wise |
02:08:00 | FromDiscord | <goerge_lsd> it's just an int, no reason why it would work on FileHandle and not Socket Handle, without casting/converting |
02:09:39 | FromDiscord | <Elegantbeef> Cause they're distinct types |
02:09:42 | FromDiscord | <Elegantbeef> Nim devs like distinct typing |
02:10:11 | FromDiscord | <goerge_lsd> yeah I got that, makes perfect sense, but ioctl works on socket handles as well as file handles. I am saying the proc definition should accept both |
02:16:33 | FromDiscord | <goerge_lsd> or maybe this proc is to be used ? https://github.com/nim-lang/Nim/blob/4856beae70ba058612a07ab787c9f283f885b453/lib/pure/nativesockets.nim#L112 |
02:19:37 | FromDiscord | <goerge_lsd> oh that's windows only |
02:32:45 | FromDiscord | <goerge_lsd> sent a code paste, see https://play.nim-lang.org/#pasty=TLWUlOMf |
02:32:56 | FromDiscord | <goerge_lsd> why would this always get me -1 (fail) from ioctl ? |
02:33:09 | FromDiscord | <Elegantbeef> read OS errors |
02:41:41 | FromDiscord | <goerge_lsd> error 14, `Meaning: The EFAULT error indicates that an invalid pointer was passed to the system call. ` |
02:42:49 | FromDiscord | <goerge_lsd> sent a code paste, see https://play.nim-lang.org/#pasty=AvuOTYlt |
02:43:14 | FromDiscord | <Elegantbeef> It calls the C code so `man ioctl` |
02:43:34 | FromDiscord | <Elegantbeef> All this to avoid just not passing in `buffered = false` into `newSocket` |
02:44:21 | FromDiscord | <goerge_lsd> I already tried, same error with both variants |
02:46:38 | FromDiscord | <Elegantbeef> What? |
02:46:52 | FromDiscord | <goerge_lsd> `var s = newSocket(buffered = true)` |
02:47:00 | FromDiscord | <goerge_lsd> (edit) "`var s = newSocket(buffered = true)` ... " added "and `var s = newSocket(buffered = false`" |
02:47:15 | FromDiscord | <Elegantbeef> Unbuffered sockets return only what's there |
02:52:00 | FromDiscord | <goerge_lsd> wait, that proc has the varargs pragma, never saw this before |
02:52:13 | FromDiscord | <goerge_lsd> and the C header definition is `extern int ioctl_time64 (int fd, unsigned long int request, ...) THROW;` |
02:52:29 | FromDiscord | <goerge_lsd> (edit) "ioctl_time64" => "ioctl" |
02:52:54 | FromDiscord | <goerge_lsd> so I probably am missing those varargs, hence the error |
02:53:20 | FromDiscord | <Elegantbeef> The fact you're still trying to use ioctl when unbuffered sockets exist will never stop being funny |
02:53:29 | FromDiscord | <goerge_lsd> riight, the function itself only returns 0 or -1 success or fail, data is in that pointer i pass |
02:53:55 | FromDiscord | <goerge_lsd> Too bad I am missing out on the joke |
02:54:04 | FromDiscord | <Elegantbeef> Attempting to know how much data is waiting for a socket which can receive more data whilst you call how large it is is a fools errand |
02:54:18 | FromDiscord | <goerge_lsd> truth is, I still have no clue as to how they differ, conceptually it's a void there |
02:54:22 | FromDiscord | <Elegantbeef> Just use unbuffered sockets and read to your own buffer |
02:54:36 | FromDiscord | <Elegantbeef> Unbuffered read up to size, buffered read to size |
02:54:55 | FromDiscord | <goerge_lsd> maybe messing around with this will make me figure out more |
03:13:29 | FromDiscord | <goerge_lsd> sent a code paste, see https://play.nim-lang.org/#pasty=rWOSNhVL |
03:19:47 | FromDiscord | <goerge_lsd> but if I set buffered = false, it works as expected |
03:38:18 | * | lucasta joined #nim |
03:45:04 | * | rockcavera quit (Remote host closed the connection) |
03:45:47 | FromDiscord | <socialmediarefugee> I've a "drive-by" question: Is Nim single pass? |
03:47:16 | FromDiscord | <Elegantbeef> Yes |
03:51:09 | FromDiscord | <socialmediarefugee> Thank you very much. |
04:09:10 | FromDiscord | <goerge_lsd> so for a buffered socket, if i call `socket.recv(1)`, just 1 byte, the ioctl call to get bytes available in socket will always return 0 from then on |
04:11:36 | FromDiscord | <goerge_lsd> so the recv copies everything available from the os in socket's own buffer, and it's available there I guess |
04:17:06 | FromDiscord | <goerge_lsd> I think I get it now |
04:22:04 | * | lucasta quit (Remote host closed the connection) |
04:51:00 | * | ntat joined #nim |
05:03:03 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
05:04:48 | * | SchweinDeBurg joined #nim |
06:57:05 | * | ntat quit (Quit: Leaving) |
07:03:40 | * | mfg joined #nim |
07:19:22 | * | krux02_ joined #nim |
07:20:38 | * | om3ga_ joined #nim |
07:20:49 | * | Deadm0th_ joined #nim |
07:21:39 | * | om3ga quit (Quit: Bye) |
07:21:39 | * | Deadm0th quit (Remote host closed the connection) |
07:21:39 | * | FromDiscord quit (Read error: Connection reset by peer) |
07:21:39 | * | krux02 quit (Read error: Connection reset by peer) |
07:21:40 | * | SchweinDeBurg quit (Ping timeout: 246 seconds) |
07:21:40 | * | pmp-p quit (Ping timeout: 246 seconds) |
07:22:40 | * | pmp-p joined #nim |
07:22:44 | * | FromDiscord joined #nim |
07:23:27 | * | SchweinDeBurg joined #nim |
07:25:01 | * | Deadm0th_ quit (Changing host) |
07:25:01 | * | Deadm0th_ joined #nim |
07:25:07 | * | Deadm0th_ is now known as Deadm0th |
08:22:32 | * | xet7 joined #nim |
08:52:03 | FromDiscord | <tauruuuuuus> Never worked a lot with `ref`, does it make sense to use var parameters in `proc`s when the type is ref or is it implicitly var by default? |
08:52:53 | FromDiscord | <Elegantbeef> The data the ref points to is mutable |
08:53:27 | FromDiscord | <Elegantbeef> So if you need to change where it points to you need var otherwise you do not |
08:56:56 | FromDiscord | <tauruuuuuus> oh ok, so that's like `T const a;` in C if I don't use var? |
08:58:37 | FromDiscord | <Elegantbeef> No |
08:58:41 | FromDiscord | <Elegantbeef> it's like `T` |
08:58:47 | FromDiscord | <Elegantbeef> but `var ref T` is `T` |
09:02:33 | FromDiscord | <fabric.input_output> const ref when 😢 |
09:02:43 | FromDiscord | <tauruuuuuus> sent a code paste, see https://play.nim-lang.org/#pasty=cYuAjcQh |
09:02:49 | FromDiscord | <tauruuuuuus> I don't get the `T` example tbh |
09:03:21 | FromDiscord | <Elegantbeef> You want to change data you do not need `var` |
09:04:34 | krux02_ | @fabric.input_output for what do you need cont ref T when you can just pass in `T` to functions? |
09:08:50 | FromDiscord | <Elegantbeef> strictfuncs changed so that's no longer true |
09:42:11 | * | ehmry joined #nim |
10:02:07 | * | beholders_eye joined #nim |
11:14:27 | * | krux02_ quit (Quit: Leaving) |
11:15:28 | * | krux02 joined #nim |
11:32:24 | * | beholders_eye quit (Ping timeout: 246 seconds) |
11:41:48 | FromDiscord | <fabric.input_output> In reply to @krux02_ "@fabric.input_output for what do": cuz what if you have `type Foo = ref object` and only pass `Foo` and not `typeof(Foo.new[])` around |
12:21:02 | * | lucasta joined #nim |
12:43:00 | * | ryuukk quit (Remote host closed the connection) |
12:44:54 | * | ryuukk joined #nim |
12:49:21 | * | ryuukk quit (Ping timeout: 248 seconds) |
12:49:43 | * | ryuukk joined #nim |
12:56:51 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
12:58:29 | * | ryuukk quit (Ping timeout: 248 seconds) |
13:08:55 | * | ntat joined #nim |
13:30:21 | termer | wow, the bridge is back |
13:30:24 | termer | at long last |
14:04:33 | * | ryuukk joined #nim |
14:09:07 | Amun-Ra | termer: my words exactly |
14:12:25 | FromDiscord | <zumi.dxy> Return of the bots :) |
14:33:35 | FromDiscord | <haoyu233> Can we have such syntax? 'closure doStuff() = discard' and 'async doStuff() = discard'.↵Just like the func keyword does. |
14:39:17 | * | _________ quit (Quit: leaving) |
14:44:15 | FromDiscord | <griffith1deadly> In reply to @haoyu233 "Can we have such": maybe create issue/rfc for that |
14:45:33 | * | _________ joined #nim |
14:47:37 | FromDiscord | <haoyu233> nim seems to remove a lot of curly braces, but not completely, I always encounter it when using asynchronous functions. I hate pragmas, maybe because of my editing habits, I always type `= discard' and then back to type the required pragma, I feel that this experience is a bit bad. |
14:52:57 | * | beholders_eye joined #nim |
14:54:12 | FromDiscord | <haoyu233> In reply to @griffith1deadly "maybe create issue/rfc for": OK, I'll file an issue tomorrow morning. I think this syntax is pretty good, maybe others will like it too. |
15:10:11 | FromDiscord | <demotomohiro> How about to make a macro that transform `asyncDef doStuff() = discard` to `proc doStuff() {.async.}`? |
15:17:45 | FromDiscord | <solitudesf> In reply to @haoyu233 "Can we have such": async is not a language builtin unlike sideeffect tracking so `async doStuff()` doesnt make sense |
15:24:08 | FromDiscord | <haoyu233> sent a code paste, see https://play.nim-lang.org/#pasty=LeondURg |
15:29:05 | FromDiscord | <haoyu233> In reply to @solitudesf "async is not a": It just automatically inserts the `async` pragma like the `func` keyword. When using it, the user should ensure that the `async` macro exists in the current namespace. If not, the compiler should terminate the compilation and display an error message. |
15:30:23 | FromDiscord | <solitudesf> In reply to @haoyu233 "It just automatically inserts": crazy jank just for some syntax sugar. |
15:32:54 | * | mfg quit (Ping timeout: 272 seconds) |
15:33:49 | FromDiscord | <fabric.input_output> In reply to @haoyu233 "It can be modified": `->` ;] |
15:38:43 | FromDiscord | <ch_dr_7> In reply to @termer "wow, the bridge is": lets see if it's ficed? |
15:38:46 | FromDiscord | <ch_dr_7> fixed |
15:39:19 | FromDiscord | <ch_dr_7> there was a thing with IRC messing with my account when it was on or something (idk what any of that meant I don't work here) but it looks like it's fixed now |
15:48:52 | FromDiscord | <haoyu233> sent a code paste, see https://play.nim-lang.org/#pasty=MrLRPulZ |
15:53:33 | FromDiscord | <haoyu233> Maybe one day in the future, we can separate `closure` from `proc` and form its own keyword and type, just like `delegate` in other languages. |
16:08:36 | FromDiscord | <demotomohiro> You can declare closure procedual type variable with `var foo: proc (x: int): int`.↵Procedual types are closure in default.↵When you define the proc inside a proc and it refers local variables, it automatically become closure proc. |
16:43:15 | * | beholders_eye quit (Ping timeout: 260 seconds) |
16:43:54 | * | lucasta quit (Remote host closed the connection) |
16:44:57 | FromDiscord | <ch_dr_7> what does this error mean 😭 https://media.discordapp.net/attachments/371759389889003532/1280931619338846218/image.png?ex=66d9e008&is=66d88e88&hm=9b7598f49e61a90b36d2b969e47e2388f56523df78c0c19b45da654b0b5cd247& |
16:45:07 | FromDiscord | <ch_dr_7> crap it went away as I screenshotted it |
16:45:41 | FromDiscord | <ch_dr_7> https://media.discordapp.net/attachments/371759389889003532/1280931804055863416/image.png?ex=66d9e034&is=66d88eb4&hm=4435a6bb7d08c96cd692ec886e321d8ed74ec1e6c244b8eb024341adda503e07& |
17:01:03 | FromDiscord | <double_spiral> In reply to @ch_dr_7 "": Cant you `cstring($players)`? |
17:03:57 | FromDiscord | <ch_dr_7> is that what I need to do? idek what's going on I've never had to cast a string to a different type of string in any language before |
17:04:13 | FromDiscord | <pmunch> In reply to @termer "wow, the bridge is": Yup, it's a glorious day! |
17:04:20 | FromDiscord | <ch_dr_7> oh wait I think that might be an int |
17:06:02 | FromDiscord | <ch_dr_7> In reply to @double_spiral "Cant you `cstring($players)`?": no 💀 lmao it hates me, even if I cast it to a string it still says to cstring https://media.discordapp.net/attachments/371759389889003532/1280936927083626599/image.png?ex=66d9e4fa&is=66d8937a&hm=3725772621e44280f19daddd741442ed564dbe57c385d53caa511005d878d7cc& |
17:06:30 | FromDiscord | <ch_dr_7> I was extraconfused at first because the first error makes it look like "Players: " is the problem instead of $players when you glance at it |
17:07:33 | * | hovsater quit (Ping timeout: 248 seconds) |
17:09:00 | FromDiscord | <ch_dr_7> okay so apparently you can't just print strings you need to manually cast them to cstrings??? |
17:09:15 | FromDiscord | <ch_dr_7> that's odd but wtv |
17:10:26 | FromDiscord | <double_spiral> In reply to @ch_dr_7 "okay so apparently you": Are you using raylib? |
17:10:56 | FromDiscord | <double_spiral> They don't nimify the variable types for whatever reason |
17:11:10 | * | hovsater joined #nim |
17:11:29 | FromDiscord | <ch_dr_7> yeah |
17:11:45 | FromDiscord | <ch_dr_7> In reply to @double_spiral "They don't nimify the": strange, I just wish this stupid NN stuff would work |
17:14:41 | FromDiscord | <ch_dr_7> I'm trying to get a neural network running through nim, pytorch made it so easy but nim is so tiny that the arraymancer examples literally don't even work and there's not enough people to point it out to fix it I guess |
17:14:54 | FromDiscord | <ch_dr_7> either that or I missed something big |
17:20:28 | FromDiscord | <ch_dr_7> idk but I would love if anyone could tell me the problem with this is I literally have no idea, this is the example perceptron from scinim/flamebeau https://media.discordapp.net/attachments/371759389889003532/1280940558285799484/image.png?ex=66d9e85b&is=66d896db&hm=9e6ba0cb9314cfb2b3fa45d898dec2f4b7323c1866ed5b87eb547db35e0b91ed& |
17:27:53 | * | SchweinDeBurg joined #nim |
18:08:30 | * | ntat quit (Quit: Leaving) |
18:19:30 | FromDiscord | <Robyn [She/Her]> In reply to @ch_dr_7 "no 💀 lmao it": your issue is `"Players: "` is a Nim string and you're trying to concat two different types of strings |
18:20:05 | FromDiscord | <Robyn [She/Her]> Try `"Players: " & $players` and really you should have no issue I'd assume planetis nimified the procs |
18:20:46 | FromDiscord | <Robyn [She/Her]> In reply to @ch_dr_7 "idk but I would": what errors are you getting when compiling? that screenshot is useless |
18:21:12 | FromDiscord | <ch_dr_7> In reply to @chronos.vitaqua "Try `"Players: " &": that's what it was originally, it didn't actually have any problems but the IDE was screeching about it |
18:21:16 | FromDiscord | <Robyn [She/Her]> also the #science channel may help |
18:21:45 | FromDiscord | <Robyn [She/Her]> In reply to @ch_dr_7 "that's what it was": ah, then I'd suggest `pkill -9 -f nim` to kill the lang server and make it restart |
18:22:46 | FromDiscord | <Robyn [She/Her]> assuming you're on Linux |
18:22:55 | FromDiscord | <Robyn [She/Her]> idk windows or mac commands at all |
18:24:22 | FromDiscord | <ch_dr_7> oh nah I'm on windows |
18:24:51 | FromDiscord | <ch_dr_7> sent a long message, see https://pasty.ee/jTkPzlTE |
18:25:04 | FromDiscord | <ch_dr_7> I don't think it recognizes the network keyword either |
18:25:31 | FromDiscord | <Robyn [She/Her]> sounds like missing imports |
18:27:51 | FromDiscord | <ch_dr_7> is there some other way to import other than "import xyz" at the start? |
18:28:12 | FromDiscord | <ch_dr_7> because I literally just copy pasted the entire file, the only thing it imports is arraymancer and I already have that installed and imported |
18:28:14 | FromDiscord | <k0ts> i dont use arraymancer but `network` is `macro network(modelName: untyped; config: untyped): untyped`, and youre passing an extra 'ctx' argument |
18:29:41 | FromDiscord | <ch_dr_7> In reply to @k0ts "i dont use arraymancer": then why is that the example they gave 😭 https://media.discordapp.net/attachments/371759389889003532/1280957977255346227/image.png?ex=66d9f894&is=66d8a714&hm=fbb32d367613c925b8f7fd6503deeb4eb60038f3f0f972a2e0b0a65577220885& |
18:30:01 | FromDiscord | <k0ts> 🤷♂️ |
18:31:34 | FromDiscord | <k0ts> the example is outdated |
18:31:35 | FromDiscord | <k0ts> https://github.com/mratsim/Arraymancer/commit/642190a16dd3c75727506fee2f835214849cace7 |
18:35:59 | FromDiscord | <ch_dr_7> okay so nim is just so tiny there aren't any up to date examples |
18:38:18 | FromDiscord | <Robyn [She/Her]> i do still recommended asking in the science channel, that's where you'll find the most help from people familiar with the library |
19:33:07 | * | beholders_eye joined #nim |
19:36:16 | FromDiscord | <goerge_lsd> where do I find a list of all possible nim compilation defines, specifically interested for OS target |
19:37:22 | FromDiscord | <ch_dr_7> In reply to @chronos.vitaqua "i do still recommended": Well I haven't been able to find any other good examples, and I can't learn it from scratch from just asking people, and idk enough about nim to find it out from the source files or whatever, so it's looking like I may just give up. |
19:37:37 | FromDiscord | <nervecenter> In reply to @goerge_lsd "where do I find": Try `nim dump` |
19:38:07 | FromDiscord | <nervecenter> With `--dump.format:json` |
19:38:21 | FromDiscord | <nervecenter> https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches |
19:39:30 | FromDiscord | <k0ts> Additionally: https://github.com/nim-lang/Nim/blob/99f4cfa43850f4927aee329af6a461a22f483de2/compiler/options.nim#L633 |
20:24:24 | FromDiscord | <goerge_lsd> sent a code paste, see https://play.nim-lang.org/#pasty=nKgyxjlL |
20:24:57 | FromDiscord | <goerge_lsd> for unix it was just ` discard ioctl(cast[FileHandle](s.getFd()), FIONREAD, result.addr())` |
20:28:41 | FromDiscord | <Elegantbeef> Who cares about shortening code |
20:28:47 | FromDiscord | <goerge_lsd> oh come on |
20:28:52 | FromDiscord | <Elegantbeef> You could do `cast[ptr clong](result.addr)` but I will reiterate what you're doing is still illadvisable |
20:30:38 | FromDiscord | <goerge_lsd> oh yeah why didn't i think of that |
20:31:28 | FromDiscord | <goerge_lsd> https://play.nim-lang.org/#pasty=SdPBhiDE |
20:31:41 | FromDiscord | <Elegantbeef> Hey you're attempting to get the size of data on a socket, that is by definition a race condition |
20:32:00 | FromDiscord | <goerge_lsd> 3 calls to recv for the whole message, first with 1 byte, then the rest, the last one to get the timeout. works on both win and lin |
20:33:57 | FromDiscord | <goerge_lsd> how is it a race condition if i am doing all the reading |
20:51:43 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=PolVLbxv well it's a TOCTOU condition, but again selectors |
20:53:40 | FromDiscord | <ch_dr_7> In reply to @ch_dr_7 "Well I haven't been": wait what, there's stuff here now, one of them is literally a tutorial??? something must've glitched out before because before this folder only had "docs.json" in it when I looked https://media.discordapp.net/attachments/371759389889003532/1280994208479707136/image.png?ex=66da1a53&is=66d8c8d3&hm=b7951a8047d708e19b206ffa143292e2a378bf5b0ccb480de7163b5369c8613a& |
20:54:21 | FromDiscord | <ch_dr_7> In reply to @ch_dr_7 "wait what, there's stuff": why was none of this here last time???? https://media.discordapp.net/attachments/371759389889003532/1280994382459310092/image.png?ex=66da1a7c&is=66d8c8fc&hm=bb632e0581f8102e37ab566352d54e8994e50e2a10fc33806dd6bc0c6c847ff1& |
20:56:25 | FromDiscord | <Elegantbeef> You might've selected the wrong branch? |
20:56:31 | FromDiscord | <Elegantbeef> Which might have also been why your examples didn't work |
20:58:49 | * | krux02 quit (Remote host closed the connection) |
21:00:03 | * | krux02 joined #nim |
21:01:58 | * | krux02 quit (Client Quit) |
21:10:13 | FromDiscord | <ch_dr_7> well the example I was giving earlier that wasn't working happens to be from 4 years ago, that's why it doesn't work, but before I was on this one and there were NO files here, I know it's the same one because it's the same tab, but it's been refreshed, I can only figure something was slow and I was impatient or something broke altogether |
21:53:24 | FromDiscord | <double_spiral> There is a learning curve with nim, if you're coming from high level languages like i did you'll have to get used to reading docs if not scrolling through libs/bindings to understand them a bit more |
21:54:11 | FromDiscord | <double_spiral> You get used to it though and it helps you code better too |
21:55:55 | * | rockcavera joined #nim |
22:37:45 | * | beholders_eye quit (Read error: Connection reset by peer) |
22:43:30 | * | beholders_eye joined #nim |
23:19:43 | * | Batzy joined #nim |