00:16:20 | * | attah quit (Ping timeout: 248 seconds) |
01:35:10 | * | derpydoo joined #nim |
02:25:27 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezl |
02:25:38 | FromDiscord | <Bung> is this valid? I see it here https://github.com/nim-lang/Nim/issues/12263 |
02:28:28 | FromDiscord | <Elegantbeef> I imagine not |
02:30:46 | FromDiscord | <Bung> I also never seen that syntax before |
02:31:06 | madprops | programming question. what's the best pattern to perform an action when iterating a list where each iteration makes splices an item from the list? |
02:31:51 | FromDiscord | <Elegantbeef> An iterator + a callback? |
02:32:33 | FromDiscord | <danoneil> https://t.me/+PEc8FSRwFiFiYzc0 |
02:39:31 | FromDiscord | <Prestige> <@&371760044473319454> |
02:40:52 | * | arkurious quit (Quit: Leaving) |
04:12:51 | FromDiscord | <Bung> `var EAGAIN {.importc: "EAGAIN", header: "<errno.h>".}: cint` is it possible be const ? |
04:13:10 | * | attah joined #nim |
04:15:54 | FromDiscord | <Elegantbeef> No |
04:17:35 | FromDiscord | <Bung> then I can't strictly check set construction |
04:34:03 | FromDiscord | <Elegantbeef> Well Nim is not a C compiler |
04:34:04 | FromDiscord | <Bung> `if {n[0][0].len, n[1].len} == {1}:` is this valid? |
04:34:41 | FromDiscord | <Elegantbeef> You'd have to convert to a range, but it's easier to just do `[a, b] == [1, 1]` |
04:34:52 | FromDiscord | <Elegantbeef> Though that's kinda ugly imo |
04:35:57 | FromDiscord | <Bung> hmm,I see the code from balls, it relys implicit range conversation |
04:41:29 | FromDiscord | <Elegantbeef> Whoopsies i just grew my stack by 8.1kb |
04:42:17 | FromDiscord | <Bung> shit , nim std also fails in my PR |
04:42:27 | FromDiscord | <Bung> https://github.com/nim-lang/Nim/pull/20712 |
04:44:17 | FromDiscord | <Elegantbeef> I mean the CI errors are 'right' |
04:49:40 | FromDiscord | <Bung> so the generate structure compatible with c even element type is int? |
04:50:26 | FromDiscord | <Bung> just waste some memory |
04:54:20 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezI |
04:55:09 | * | derpydoo quit (Ping timeout: 255 seconds) |
04:55:46 | FromDiscord | <Elegantbeef> Nimquery's quite cursed with their usage ` rune.int32 in intIdentifiers` |
04:59:01 | FromDiscord | <Bung> what's the problem your refers to? I see a memory waste |
04:59:29 | FromDiscord | <Elegantbeef> Memory waste and also it makes an set using `int` then checks if an `int32` is inside that int set |
05:01:48 | FromDiscord | <Bung> yeah, also a implicit conversation |
05:04:32 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezN |
05:04:39 | FromDiscord | <Bung> doesn't fails on my windows. |
05:27:41 | FromDiscord | <Elegantbeef> likely cause windows doesnt run the same code |
05:33:45 | FromDiscord | <Bung> how that could happen am on win10 64x |
05:34:24 | FromDiscord | <Elegantbeef> Oh no clue, misread |
05:34:36 | FromDiscord | <Bung> ok then |
05:43:22 | FromDiscord | <Bung> hmm, I forget I run it on wsl |
06:32:32 | NimEventer | New thread by emre: Nim-gdb: Undefined command: "import", see https://forum.nim-lang.org/t/9565 |
06:37:23 | FromDiscord | <Horizon [She/Her]> Winder how hard it'd be to make a basic abstraction layer for different WASM runtimes for Nim |
06:37:30 | FromDiscord | <Horizon [She/Her]> Wonder |
06:37:50 | FromDiscord | <Elegantbeef> There is some desire to make a FFI standard across all WASM runtimes |
06:37:58 | FromDiscord | <Elegantbeef> It's relatively difficult cause they all work differently |
06:38:28 | FromDiscord | <Elegantbeef> Wasmedge uses result types, Wasm3 uses cstring, Wasmer uses something else |
06:38:36 | FromDiscord | <Horizon [She/Her]> Shouldn't be too hard in theory, having an abstraction layer between them could allow for better portability between different platformsβ΅β΅You'd just need an API wrapping the most basic functions |
06:38:56 | FromDiscord | <Elegantbeef> Eh there is a desired to make a standard FFI for the runtimes |
06:38:57 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Wasmedge uses result types,": Hm, sounds more like pain then |
06:39:38 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Eh there is a": Yeah but you just said there are different ways WASM values are handled internally so it's not as easy as it looks |
06:39:40 | FromDiscord | <Elegantbeef> https://github.com/WebAssembly/wasm-c-api |
06:41:11 | FromDiscord | <Horizon [She/Her]> Oh that's neat |
06:41:23 | FromDiscord | <Horizon [She/Her]> Wasmer is already implementing that API? And WasmTime too? |
06:42:00 | FromDiscord | <Elegantbeef> No clue wasmer's C-api lacked basic functionality iirc |
06:42:35 | FromDiscord | <Elegantbeef> One couldnt even query exported functions from a loaded wasm file when i was testing it |
06:44:55 | FromDiscord | <Horizon [She/Her]> That's... Irritating |
06:45:10 | FromDiscord | <Horizon [She/Her]> I remember wasmtime (the Java bindings) were broken though when i used them |
06:45:29 | FromDiscord | <Elegantbeef> Wasm3 is seriously the nicest runtime i tested, i can build it from source, it's easy to move around and it integrates well with Nim's compiler |
06:45:43 | FromDiscord | <Elegantbeef> It also has a very very simple forward facing API |
06:45:59 | FromDiscord | <Elegantbeef> Errors are just cstrings, if it's not nil it's an error, so i can raise an exception |
06:46:06 | FromDiscord | <Horizon [She/Her]> It somehow confused the imports with the exports, so even though i defined two methods of the wasi module, and exported them to the runtime |
06:46:39 | FromDiscord | <Elegantbeef> I dont know if you looked at the wasm3c.nim file, but it's only 200 loc it's fucking amazing |
06:47:38 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "It also has a": Yeah it looks quite simple even if I haven't tore into the guts of it, just bigger programs would be slower than if i used something like WasmEdge (of course, because Wasm3 is an interpreter compared to a JIT compiler which is to be expected) |
06:48:10 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "I dont know if": Yeah i did yesterday, i was wondering if it covered everything within the API too |
06:48:13 | FromDiscord | <Elegantbeef> Given i'm mostly concerned about dynamically scripting games and distributing those, i'm fairly indifferent about that |
06:48:29 | FromDiscord | <Elegantbeef> I might have missed some wasi stuff, but it should cover everything |
06:49:27 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Given i'm mostly concerned": Yeah that's fair, i am using it for the same purpose even if from a Minecraft mod so it's not much of a worry |
06:49:42 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "I might have missed": I'm implementing WASI by myself anyway so that's fine |
06:50:01 | FromDiscord | <Elegantbeef> Yea distributing wasm files that abuse the JIT to break out of the sandbox is not something I'd want to do π |
06:50:37 | FromDiscord | <Horizon [She/Her]> Hm i still need to figure out how to structure the `Machine` object really |
06:50:57 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Yea distributing wasm files": Yeahh considering it'll be running WASM on a server, probably not the best idea |
06:51:15 | * | disso_peach quit (Quit: Leaving) |
06:51:17 | FromDiscord | <Elegantbeef> Some inspiration can be https://github.com/beef331/aiarena/blob/master/src/core/wasmenvs.nimβ΅(@Horizon [She/Her]) |
06:53:14 | FromDiscord | <Elegantbeef> One thing i will suggest is to use Nim's stack based OOP for objects that you want to transfer to the VM but also have an extend host version, to reduce redundant code |
06:53:14 | FromDiscord | <Elegantbeef> Look at tanks.nim's Tank and NativeTank for that |
06:53:39 | FromDiscord | <Horizon [She/Her]> That helps a lot actually, thanks! Just need to figure out now how to implement wasi methods that are specific to a machine, so it can write to a path as a sort of 'virtual filesystem' |
06:54:08 | FromDiscord | <Elegantbeef> Physicsfs like? |
06:55:16 | FromDiscord | <Horizon [She/Her]> Physicsfs? |
06:55:22 | FromDiscord | <Elegantbeef> https://www.icculus.org/physfs/ |
06:55:33 | FromDiscord | <Elegantbeef> I do kinda want to make a pure nim implementation of this |
06:56:35 | FromDiscord | <Elegantbeef> It's basically a sandboxable file system that works with zip archives and existing files to allow easy modding and safely writing files |
06:57:16 | FromDiscord | <Horizon [She/Her]> Oh that's actually quite neat! |
06:57:16 | FromDiscord | <Elegantbeef> I'm not saying use it of course, just take inspiration from it |
07:05:02 | FromDiscord | <Horizon [She/Her]> Yeah, i already had the idea of just expanding the path and checking if it goes outside of a certain directory |
07:05:16 | FromDiscord | <Horizon [She/Her]> Shouldn't be that hard in theory |
07:05:26 | FromDiscord | <Elegantbeef> Also have to ignore symlinks |
07:06:07 | FromDiscord | <Horizon [She/Her]> Does wasi even have a way to create symlinks? |
07:06:21 | FromDiscord | <Elegantbeef> No clue i've never looked into wasi really |
07:13:05 | FromDiscord | <Horizon [She/Her]> Fair, either way it shouldn't be that hard really |
07:14:07 | FromDiscord | <Horizon [She/Her]> If the parent dir does not equal `/home/{USER}/server/world/machines/{ID}`, then refuse to do anything |
07:14:57 | FromDiscord | <Horizon [She/Her]> Since WASM is a Linux-like architecture when using a compiler, it should be possible to implement most of the methods too so |
07:21:30 | FromDiscord | <Elegantbeef> Bung\: `lastError.int in [errInvalidParameter, errFileNotFound]` π |
07:21:33 | FromDiscord | <Elegantbeef> Thank me later |
07:25:26 | * | PMunch joined #nim |
07:34:15 | FromDiscord | <Rika> Be careful of TOCTOU |
07:34:33 | FromDiscord | <Rika> https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use |
07:47:40 | FromDiscord | <Horizon [She/Her]> So to prevent it, raise an error instead of using a check? |
07:48:37 | deadmarshal | Hey, I can't figure out why the recursion doesn't stop, I wrote the exact same thing in python and works: https://bpa.st/RQUA |
07:54:52 | FromDiscord | <Elegantbeef> The python code? |
07:56:33 | PMunch | Wild guess, you're not aware that `..` is inclusive and line 5 should actually just read 1..n instead of n+1? |
07:57:37 | FromDiscord | <Elegantbeef> That does make it not too recursive |
07:58:46 | deadmarshal | PMunch: Thanks, works now. |
07:59:34 | FromDiscord | <albassort> how can i set the port on the proxy in httpclient |
07:59:52 | PMunch | @Elegantbeef, well it worked for me :) |
08:00:09 | FromDiscord | <Elegantbeef> That's what i said |
08:00:47 | FromDiscord | <Elegantbeef> I wasnt going to say that it made it work cause i dont know what the sequence is supposed to be π |
08:01:05 | FromDiscord | <albassort> i cant seem to get these proxies working .-. |
08:01:06 | PMunch | @albassort, you create a Uri with a port element and call this: https://nim-lang.org/docs/httpclient.html#newProxy%2CUri%2Cstring |
08:01:11 | FromDiscord | <albassort> yahoo is ratelimiting me |
08:01:19 | PMunch | I guess you could also just do it with the string version |
08:01:43 | PMunch | @Elegantbeef, ah right, I misread what you wrote :) |
08:03:28 | FromDiscord | <albassort> parseUri will take a proxy like praseUr(94.131.21.2:6969) |
08:03:30 | FromDiscord | <albassort> ? |
08:03:46 | FromDiscord | <albassort> (edit) "praseUr(94.131.21.2:6969)" => "praseUri(94.131.21.2:6969)" |
08:04:19 | PMunch | Yeah, it will parse the string according to the URI spec |
08:06:20 | FromDiscord | <albassort> well, I dont know if that worked or not |
08:06:31 | FromDiscord | <albassort> but yahoo still doesn't like me |
08:07:05 | FromDiscord | <Elegantbeef> Are you scraping too fast? Have you considered slowing down a bit |
08:07:20 | FromDiscord | <albassort> they blacklisted me |
08:07:39 | FromDiscord | <albassort> trying to proxy and useragent but they dont seem to fool them |
08:07:40 | FromDiscord | <albassort> hmmm |
08:08:09 | FromDiscord | <Elegantbeef> First step is to be kind |
08:08:18 | FromDiscord | <albassort> oh actually hmm |
08:08:40 | FromDiscord | <albassort> i coded something bad hmm |
08:09:23 | FromDiscord | <dizzyliam> Anyone know a way to get a byte corresponding to an int < 16? eg. 0 -> 0x00, 1 -> 0x01, etc. |
08:09:41 | FromDiscord | <dizzyliam> I foolishly assumed Nim would do some magic with myInt.byte |
08:11:16 | FromDiscord | <albassort> in string form? |
08:11:26 | FromDiscord | <albassort> like specifically to "0x01" |
08:11:43 | FromDiscord | <albassort> toHex in strutils is probably what you need |
08:12:31 | FromDiscord | <Elegantbeef> Wow someone read the strutils docs π |
08:12:56 | FromDiscord | <albassort> ok you know how much time I spent fucking with bytes |
08:13:00 | PMunch | To be honest it would be cool if `byte` used toHex for its $ function |
08:13:29 | FromDiscord | <albassort> lets try get this for nim 2.0 |
08:14:09 | FromDiscord | <albassort> oh i just realized i never applied the proxy and the useragent to the root client |
08:14:11 | FromDiscord | <albassort> :kek: |
08:15:10 | FromDiscord | <albassort> oh i did |
08:15:16 | FromDiscord | <albassort> what do i do next? |
08:16:07 | FromDiscord | <albassort> maybe I should get it running through tor or something |
08:18:17 | FromDiscord | <dizzyliam> In reply to @albassort "in string form?": in `byte` type |
08:20:02 | FromDiscord | <dizzyliam> so no. but glad I spawned this little discussion about hex representations |
08:20:40 | FromDiscord | <albassort> Byte type is a synonym for uint8 |
08:21:11 | FromDiscord | <albassort> It is simply a value that takes up a single byte, ranging between 0 and 256 |
08:21:26 | FromDiscord | <ChocolettePalette> 255? |
08:21:36 | FromDiscord | <albassort> 255. Sorry lol |
08:21:45 | FromDiscord | <albassort> Fake computer scientist |
08:22:00 | FromDiscord | <dizzyliam> hmm so `myInt.byte` should just work? right |
08:22:46 | FromDiscord | <albassort> Your integer will now be limited to a single byte in size |
08:22:55 | FromDiscord | <albassort> If that is what you want then yes |
08:23:04 | PMunch | @dizzyliam, I don't think anyone here really understands what you actually want.. |
08:23:56 | FromDiscord | <albassort> There's nothing too special about the byte type. It's biggest use is memory optimization.. That's really it |
08:24:16 | PMunch | To a computer 16 and 0x10 is the same number, they only differ in their string representation |
08:24:28 | FromDiscord | <albassort> Also if you specifically are working in the domain of serialization and memory |
08:27:48 | FromDiscord | <dizzyliam> In reply to @PMunch "To a computer 16": I was just wondering about type conversion specifically, to make the compiler happy |
08:28:45 | FromDiscord | <dizzyliam> Sounds like `myInt.byte` should be good :) |
08:29:03 | PMunch | Yeah that will convert an int type to the byte type |
08:31:07 | FromDiscord | <dizzyliam> Cool thanks |
08:32:15 | * | derpydoo joined #nim |
08:54:06 | * | jjido joined #nim |
09:01:05 | FromDiscord | <ShalokShalom> In order to be more suitable for a dsl I like to develop, how can I redefine keywords? |
09:01:33 | FromDiscord | <ShalokShalom> Like, I like to have `logic` instead `func` |
09:01:34 | FromDiscord | <Rika> Do you have more context as to what youβre using |
09:01:54 | FromDiscord | <ShalokShalom> And `do` instead `proc` |
09:02:13 | FromDiscord | <Rika> Only within a macro can you redefine keywords |
09:02:16 | FromDiscord | <ShalokShalom> I just like to streamline the descriptive meaning of the keyword |
09:02:19 | FromDiscord | <Rika> Otherwise you would change the compiler code |
09:02:28 | * | kenran joined #nim |
09:02:30 | FromDiscord | <ShalokShalom> Oh yeah? And this still plays nice with tooling? |
09:02:33 | FromDiscord | <Rika> No |
09:02:42 | FromDiscord | <Rika> Well depends on which route youβre taking |
09:02:46 | FromDiscord | <ShalokShalom> I guess compiler code is more than simply running search and replace? |
09:02:50 | FromDiscord | <Rika> Probably not on either actually |
09:02:50 | FromDiscord | <Rika> Yes |
09:02:52 | FromDiscord | <Rika> Of course |
09:03:00 | FromDiscord | <ShalokShalom> The easiest route |
09:03:05 | FromDiscord | <Rika> In reply to @ShalokShalom "I guess compiler code": I would at least imagine it being more than that |
09:03:10 | FromDiscord | <ShalokShalom> I see |
09:03:14 | FromDiscord | <Rika> It might be that simple, I donβt really know |
09:03:20 | FromDiscord | <ShalokShalom> And how would I write that macro? |
09:03:52 | * | kenran quit (Remote host closed the connection) |
09:04:20 | FromDiscord | <Rika> The macro would pretty much take in all the code you want the keyword to be redefined in so youβd basically have one extra indent level |
09:04:29 | FromDiscord | <Rika> Then it just replaces that keyword with what you want |
09:04:37 | FromDiscord | <Rika> what you want it to mean |
09:04:39 | FromDiscord | <ShalokShalom> Ah, I see. |
09:04:43 | FromDiscord | <ShalokShalom> Thanks dear |
09:04:53 | FromDiscord | <Rika> Which I guess would be a bit hard because of parsing rules being different |
09:05:02 | FromDiscord | <Rika> That might be an issue actually |
09:11:14 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzβ¦) |
09:37:43 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4eAz |
09:46:35 | FromDiscord | <Rika> Yeah me forgetful |
09:46:40 | FromDiscord | <Rika> Too bad there ainβt reader macros |
10:22:28 | FromDiscord | <Horizon [She/Her]> I wonder if i could implement enough WASI APIs that a shell like bash could run on it |
10:25:57 | * | lucerne joined #nim |
10:41:48 | * | krux02 joined #nim |
10:48:35 | FromDiscord | <arne> @Rika keyword repacement isn't possible. The keywords define the structure for the parser in the language. Changing them to something else will set the parser to do something completely different. |
10:52:15 | FromDiscord | <arne> sent a code paste, see https://play.nim-lang.org/#ix=4eAV |
10:52:50 | FromDiscord | <arne> you can use annotations though. |
10:54:33 | FromDiscord | <arne> maybe you should use pragas to annotate your procs: |
10:54:45 | FromDiscord | <arne> sent a code paste, see https://play.nim-lang.org/#ix=4eAW |
10:55:00 | FromDiscord | <arne> (edit) "pragas" => "pragmas" |
11:00:35 | FromDiscord | <Rika> I know |
11:00:39 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> hello everyone! |
11:00:40 | FromDiscord | <Rika> I realised |
11:00:55 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> is there a well documented nim tutorial like rust's? |
11:01:08 | FromDiscord | <Horizon [She/Her]> Hello there πππ―π |
11:01:43 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> In reply to @Event Horizon "Hello there πππ―π": hello |
11:06:19 | FromDiscord | <Horizon [She/Her]> In reply to @π .Β·.*Β¨πππ―πΒ¨*.Β·. π "is there a well": Have you looked at the tutorial page? |
11:06:34 | FromDiscord | <Horizon [She/Her]> https://nim-lang.org/docs/tut1.html |
11:06:44 | FromDiscord | <Horizon [She/Her]> Also the docs are your friends here ^^ |
11:33:02 | * | derpydoo quit (Ping timeout: 268 seconds) |
12:01:54 | FromDiscord | <AmjadHD> Is there a (`koch`) command to build docs locally in the `doc/html/` folder only and not in `web/upload/` and without building index or running runnableExamples ? |
12:19:52 | * | xaltsc quit (Ping timeout: 246 seconds) |
12:22:16 | FromDiscord | <ChocolettePalette> Is it like rust's though? \:/If not, I won't read it! throws a tantrum |
12:44:57 | * | jmdaemon quit (Ping timeout: 255 seconds) |
12:52:07 | * | jjido joined #nim |
13:02:33 | * | arkurious joined #nim |
13:31:13 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzβ¦) |
13:41:40 | FromDiscord | <!&luke> How can I nimble install something with -d:ssl |
13:41:59 | PMunch | nimble install -d:ssl something? |
13:42:06 | FromDiscord | <!&luke> Of I just add that flag to the command it only installed the package dependencies |
13:42:16 | FromDiscord | <!&luke> (edit) "Of" => "If" |
13:42:25 | FromDiscord | <!&luke> (edit) "installed" => "installs" |
13:49:12 | PMunch | Is there a more comfortable way to do this? http://ix.io/4eBv/nim |
14:27:34 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i type a type like\: |
14:27:45 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i type a type like |
14:29:27 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4eBE |
14:53:29 | FromDiscord | <ShalokShalom> In reply to @vindaar "yeah, you can't write": Do you know, where I would need to change the source code, to achieve that? |
15:06:28 | * | arkurious quit (Ping timeout: 252 seconds) |
15:11:18 | * | PMunch quit (Quit: Leaving) |
15:12:35 | FromDiscord | <hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4eBY |
15:19:08 | * | arkurious joined #nim |
15:20:21 | FromDiscord | <guttural666> sent a long message, see http://ix.io/4eC1 |
15:30:22 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Thanks!β΅(@hotdog) |
15:50:38 | * | derpydoo joined #nim |
15:53:02 | * | kenran joined #nim |
15:53:05 | * | PMunch joined #nim |
15:53:09 | * | kenran quit (Remote host closed the connection) |
16:25:57 | * | kenran joined #nim |
16:26:12 | * | kenran quit (Remote host closed the connection) |
16:40:30 | FromDiscord | <pietroppeter> hey all, there is still time to add your october thing to "This month with Nim"! https://github.com/beef331/website |
16:41:06 | FromDiscord | <pietroppeter> (I did add one thing ;)) |
16:41:18 | FromDiscord | <pietroppeter> and thank @ElegantBeef for maintaining this! |
16:45:50 | * | derpydoo quit (Ping timeout: 246 seconds) |
16:47:00 | FromDiscord | <pietroppeter> for example @Tanguy, I see you released 1.0.0 of libp2p, could be nice to add that to this month with nim (or maybe you have a special announcement post planned), especially given the nice tron tutorial that you added! (I already tried to run it but there was no one else to matchmake and did not have time to set it up on another computer - on same computer it seems it is smart enough not to match...) |
16:59:11 | FromDiscord | <pietroppeter> @dizzyliam pigeon looks very interesting, maybe it is ready to be shared in this month with nim? |
17:02:08 | FromDiscord | <Tanguy> In reply to @pietroppeter "for example <@427483936587907082>, I": I added instructions since last week, you need to specify a bootstrap node to discover other peers (you can use the other instance as a bootstrap node, which is arguably less impressive, but works)β΅β΅I'll add it to next month with nim, because I won't have time today or tomorrow |
17:06:30 | FromDiscord | <pietroppeter> I saw the note about bootstrap node, but honestly did not understand what they mean π I guess I have to read other parts (in particular I see there is a code comment that mentions previous tutorial). since it was released it was easy to nimble install and try it out without actually learning much about it! π |
17:12:41 | FromDiscord | <Tanguy> Haha, I could add some refreshers for people skipping the tutorials indeed π |
17:12:49 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> In reply to @Event Horizon "Also the docs are": what about the guide books by others? |
17:13:13 | FromDiscord | <Horizon [She/Her]> In reply to @π .Β·.*Β¨πππ―πΒ¨*.Β·. π "what about the guide": There is a few more but can't remember off the top of my head |
17:13:30 | FromDiscord | <Horizon [She/Her]> Try "Nim By Example"? And "Nim handbook" in google? |
17:14:13 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> In reply to @Event Horizon "Try "Nim By Example"?": no like i mean are they good? |
17:14:44 | FromDiscord | <Horizon [She/Her]> Oh, no idea, but probably are |
17:15:16 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> i see |
17:19:42 | FromDiscord | <ezquerra> Is it possible to ensure that -d:nimPreviewHashRef is used when compiling a particular module (for example) by specifying a pragma at the top of the module? |
17:20:17 | FromDiscord | <ezquerra> I got some code that requires nimPreviewHashRef but I do not want to rely on the user knowing that and adding -d:nimPreviewHashRef to their build command |
17:20:28 | FromDiscord | <ezquerra> Also, any chance that nimPreviewHashRef might be enabled with nim 2.0 by default? |
17:23:25 | * | arkurious quit (Ping timeout: 252 seconds) |
17:26:57 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> btw do you people think that nim is powerful enough for kernels? |
17:36:08 | * | arkurious joined #nim |
18:10:41 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i properly type a proc? Like if im passing it into another proc. |
18:12:01 | Amun-Ra | thatrandomperson5: foo(x: proc (x: int, y: float): bool) |
18:12:17 | Amun-Ra | type fun = proc (x: int): bool |
18:12:19 | Amun-Ra | etc |
18:23:45 | FromDiscord | <Horizon [She/Her]> In reply to @π .Β·.*Β¨πππ―πΒ¨*.Β·. π "btw do you people": Yup, compiles down to C, and C is fine for kernels so |
18:23:49 | FromDiscord | <Horizon [She/Her]> There's an example kernel iirc |
18:24:11 | FromDiscord | <Horizon [She/Her]> https://github.com/dom96/nimkernel @π .Β·.Β¨πππ―πΒ¨.Β·. π |
18:25:37 | FromDiscord | <π .Β·.*Β¨πππ―πΒ¨*.Β·. π> thanks |
18:35:42 | FromDiscord | <Horizon [She/Her]> Np! |
19:00:07 | * | LuxuryMode joined #nim |
19:01:08 | * | _________ is now known as ___boo___ |
19:01:10 | * | ___boo___ is now known as _________ |
19:05:05 | * | jjido joined #nim |
19:05:55 | FromDiscord | <guttural666> is a check like this in a case statement possible? |
19:05:58 | FromDiscord | <guttural666> https://media.discordapp.net/attachments/371759389889003532/1036717685620346971/unknown.png |
19:08:20 | FromDiscord | <auxym> yes, `of 1 .. 999` without the `in` should work |
19:08:47 | FromDiscord | <auxym> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement |
19:11:32 | FromDiscord | <auxym> but also you'll want to run the string you read from stdin through `parseInt` to get an integer |
19:12:01 | FromDiscord | <Bung> is there a proc I can get minimal type of int literal, for downgrade type |
19:12:02 | FromDiscord | <albassort> uh do proxies even work in httpclient? |
19:15:09 | FromDiscord | <guttural666> In reply to @auxym "https://nim-lang.org/docs/manual.html#statements-an": ahh, obviously this has to be compared to a string or char |
19:15:20 | FromDiscord | <guttural666> makes sense thanks |
19:18:38 | FromDiscord | <guttural666> this seems good eh https://media.discordapp.net/attachments/371759389889003532/1036720877938683964/unknown.png |
19:19:35 | FromDiscord | <guttural666> oh okay, what you said without the quotes does work fine |
19:24:47 | FromDiscord | <auxym> `"1" .. "9999" doesn't really make sense, you can't make a "range" of strings |
19:24:55 | FromDiscord | <auxym> (edit) ""9999"" => ""9999"`" |
19:26:07 | FromDiscord | <albassort> yea strings dont really work like that |
19:26:21 | FromDiscord | <albassort> there is no way to increment a string |
19:26:26 | FromDiscord | <albassort> string+1 doesn't exist |
19:26:32 | FromDiscord | <albassort> so you can make a range of it |
19:27:58 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4eCU |
19:28:33 | FromDiscord | <auxym> and you'll probably want to handle the `ValueError` that is thrown if the string to be parsed is not actually a number |
19:29:41 | FromDiscord | <albassort> auxym do you know any good httpclient libraries |
19:29:57 | FromDiscord | <albassort> the stdlib one is being a big ole baby about proxies |
19:32:15 | FromDiscord | <guttural666> In reply to @auxym "you want something like": okay, yeah got it, gonna take a look at this thanks! |
19:39:56 | FromDiscord | <Varriount> @Araq How should I handle PRs like this? https://github.com/nim-lang/Nim/pull/20697 |
19:47:59 | FromDiscord | <SREagle> In reply to @albassort "there is no way": Perl (the language) likes to have a word with you about that ;-p : https://perldoc.pl/perlop#Auto-increment-and-Auto-decrement (last two paragraphs of the section) - this is actually pretty handy, and I'm considering to implement this in Nim for myself, just for fun |
19:48:52 | FromDiscord | <planetis> So the new defaults fields allow to call any proc? I though the rfc was only for consts. |
19:50:35 | FromDiscord | <albassort> i was able to call = newHttpClient() in recent code |
20:02:51 | FromDiscord | <auxym> In reply to @albassort "auxym do you know": nope never done any http stuff in nim so far. |
20:32:30 | * | derpydoo joined #nim |
20:33:13 | FromDiscord | <elizabethgary> https://t.me/+PEc8FSRwFiFiYzc0 |
20:33:20 | FromDiscord | <Araq> @Varriount it's fine |
20:39:31 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzβ¦) |
20:39:56 | FromDiscord | <guttural666> how can I handle this gracefully in Nim and not shit my pants at runtime? keyword should suffice, I'll read up on it thanks! https://media.discordapp.net/attachments/371759389889003532/1036741335031500931/unknown.png |
20:43:54 | * | jjido joined #nim |
20:45:35 | * | derpydoo quit (Ping timeout: 246 seconds) |
20:46:26 | FromDiscord | <guttural666> and what's the reason why defaulted proc parameters cannot be var? |
20:52:29 | FromDiscord | <huantian> because it doesn't make sense, would it be a global default that keeps getting changed? |
20:52:51 | FromDiscord | <huantian> if you want to catch errors you want `try:` `except ValueError:` |
20:58:33 | FromDiscord | <guttural666> In reply to @huantian "because it doesn't make": because explicitly stating that you do not have to provide something, that the proc will take care of it is different to implicitly setting a default in the proc, if some initial value was provided by the caller |
20:58:48 | FromDiscord | <guttural666> okay, thanks, gonna check that out |
20:59:04 | FromDiscord | <huantian> I'd probably just use an overload as an alternative to var defaults for now |
20:59:45 | FromDiscord | <guttural666> I dunno, maybe my thinking is just way off |
21:00:27 | FromDiscord | <guttural666> this is what I'm doing rn, seems stupid https://media.discordapp.net/attachments/371759389889003532/1036746497993228458/unknown.png |
21:00:55 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4eDl |
21:01:39 | FromDiscord | <guttural666> that would be the overload solution |
21:01:44 | FromDiscord | <guttural666> what you said? |
21:01:52 | FromDiscord | <huantian> yeah |
21:02:06 | FromDiscord | <huantian> In reply to @guttural666 "this is what I'm": for this case you can just declare a new `var` variable with teh same name as the arg |
21:02:14 | FromDiscord | <huantian> which is probably what you want |
21:02:20 | FromDiscord | <guttural666> ohhhhhhhh |
21:02:41 | FromDiscord | <guttural666> will that reuse the memory as well? |
21:02:59 | FromDiscord | <huantian> I don't think it can |
21:03:03 | FromDiscord | <guttural666> mhm |
21:03:14 | FromDiscord | <huantian> since the arguments you pass in can't be mutated |
21:03:42 | FromDiscord | <guttural666> hmm, okay, thanks something to think about |
21:04:11 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4eDm |
21:04:54 | FromDiscord | <guttural666> yeah, dunno what I was thinking |
21:08:30 | NimEventer | New post on r/nim by Fried_out_Kombi: Guide/tutorials for wrapping Nim around C++ classes and classes?, see https://reddit.com/r/nim/comments/yiozt9/guidetutorials_for_wrapping_nim_around_c_classes/ |
21:10:54 | FromDiscord | <guttural666> option wouldn't help me either |
21:12:35 | * | arkanoid quit (Ping timeout: 268 seconds) |
21:14:12 | * | arkanoid joined #nim |
21:21:03 | * | jmdaemon joined #nim |
21:27:00 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzβ¦) |
21:30:54 | FromDiscord | <guttural666> something like this is not supported in Nim, right, definition in a condition https://media.discordapp.net/attachments/371759389889003532/1036754162207182858/unknown.png |
21:37:07 | FromDiscord | <Prestige> it's not |
21:39:43 | FromDiscord | <Elegantbeef> It is |
21:40:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/vxT |
21:41:18 | * | tinytoast quit (Remote host closed the connection) |
21:41:28 | * | tinystoat joined #nim |
21:42:45 | * | madprops quit (Quit: biourvgrt445) |
21:43:02 | * | madprops joined #nim |
21:43:03 | * | madprops quit (Changing host) |
21:43:03 | * | madprops joined #nim |
21:48:47 | FromDiscord | <Prestige> interesting |
22:03:01 | FromDiscord | <guttural666> cool, thanks! |
22:09:36 | * | jjido joined #nim |
22:19:23 | FromDiscord | <dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDC |
22:19:31 | FromDiscord | <dedraiaken> I get `invalid object assignment` at runtime |
22:21:51 | FromDiscord | <demotomohiro> It copys only Parent part of Child to do_thing. It is assumed invalid. |
22:22:01 | FromDiscord | <huantian> if you're going to be using inheritance, use `ref object of RootObj` instead to have the behavior you're expecting here |
22:26:55 | FromDiscord | <guttural666> the compiler complains that this cannot be known at compile time, but I don't get why it should be required, this should be a run time value of a sequence https://media.discordapp.net/attachments/371759389889003532/1036768258222739516/unknown.png |
22:29:52 | * | derpydoo joined #nim |
22:31:58 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4eDG |
22:33:21 | FromDiscord | <demotomohiro> In reply to @guttural666 "the compiler complains that": According toβ΅https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statementβ΅> Because case statements are checked for exhaustiveness during semantic analysis, the value in every of branch must be a constant expression. This restriction also allows the compiler to generate more performant code. |
22:33:30 | FromDiscord | <dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDH |
22:33:37 | FromDiscord | <dedraiaken> Do I have to explicitly cast it back? |
22:35:09 | FromDiscord | <huantian> yes, because do_thing returns a Parent : `proc do_thing(msg: Parent): Parent =` |
22:36:55 | FromDiscord | <Elegantbeef> Without the reference you cannot do inheritance as you've done |
22:37:13 | FromDiscord | <Elegantbeef> I think allowing the code you submitted to compile is wrong cause stack based inheritance is a mistake π |
22:39:35 | FromDiscord | <Bung> thought maybe can have better error message |
22:40:37 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4eDJ |
22:41:33 | FromDiscord | <Elegantbeef> This is basic inheritance you can convert up implicitly but you have to convert down explicitly |
22:42:10 | * | krux02 quit (Remote host closed the connection) |
22:42:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDK |
22:43:05 | FromDiscord | <Elegantbeef> Either the check should ensure sizeof the child is the same as parent, or it should error at compile time |
22:43:13 | FromDiscord | <dedraiaken> In reply to @demotomohiro "You can convert the": Thanks! |
22:45:01 | FromDiscord | <Elegantbeef> Worth noting dedraiaken if you have a fixed selection of objects it's generally suggested to use object variants instead |
22:45:19 | FromDiscord | <Elegantbeef> It's faster and arguably less error prone |
22:45:30 | FromDiscord | <Elegantbeef> But it's also more inflexible and possibly more tedious |
22:47:35 | FromDiscord | <Bung> it should be a CT error imo. |
22:47:50 | FromDiscord | <Elegantbeef> Well i think it should be in the case that the type is a different size |
22:48:01 | * | PMunch quit (Quit: leaving) |
22:48:13 | FromDiscord | <Elegantbeef> If you are not adding fields to an object there isnt much reason to disable inheritance |
22:49:14 | FromDiscord | <Bung> but parent = child seems make no sense |
22:50:14 | FromDiscord | <Bung> follow this rules will be var a\: RootObj = A |
22:50:27 | FromDiscord | <Elegantbeef> Eh i think there are cases it makes sense |
22:51:28 | FromDiscord | <Bung> so the case is ? |
22:51:34 | FromDiscord | <dedraiaken> In reply to @Elegantbeef "Worth noting dedraiaken if": Well I'm digging into a deeper rabbit hole and was trying to use both, but I'm not sure what I need yet or if it's possible. |
22:53:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDL |
22:54:14 | FromDiscord | <Elegantbeef> the child is the same size as the parent so there is 0 reason to disallow the conversion imo |
22:54:55 | FromDiscord | <Elegantbeef> It's not like you cannot distinguish them later, so it's a bit odd |
22:56:24 | FromDiscord | <Bung> oh, I guess sometime it be useful for generic sigmatch |
22:56:42 | FromDiscord | <Elegantbeef> I mean it's runtime dispatch i'm talking about here |
22:56:46 | FromDiscord | <Bung> yeah, shouldn't disallowed |
22:57:22 | FromDiscord | <Elegantbeef> One might argue a pointer proc might make more sense here but alas |
22:59:57 | FromDiscord | <dedraiaken> What about a case where you want to specify the type of a callback? Say you have something like:β΅`view: proc (x: Model): Message` |
23:00:34 | FromDiscord | <dedraiaken> I want a callback that take some kind of Message, but whoever is wiring up the function needs to ensure that its type safe in that it's not mutating variables that don't exist on the object. |
23:00:52 | FromDiscord | <Elegantbeef> ChocolettePalette @albassort it does so https://nim-lang.org/docs/strutils.html#count%2Cstring%2Cstring%2Cbool |
23:01:55 | FromDiscord | <Elegantbeef> It's nim it's of course typesafe |
23:02:08 | FromDiscord | <Elegantbeef> It also of course cannot mutate fields that dont exist |
23:02:29 | FromDiscord | <guttural666> In reply to @demotomohiro "According to https://nim-lang.org/docs/manual.html#": this is an interesting design descision, replaced it with ifs and works now |
23:03:46 | FromDiscord | <Elegantbeef> It's a tinge annoying, and we can make macros to get around it luckily |
23:05:14 | FromDiscord | <dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDQ |
23:05:27 | FromDiscord | <dedraiaken> Maybe something like that? |
23:05:55 | FromDiscord | <Elegantbeef> Message has no field clicked |
23:05:59 | FromDiscord | <Elegantbeef> It'll error at compile time |
23:06:28 | FromDiscord | <Elegantbeef> Wait i misread |
23:06:41 | FromDiscord | <Elegantbeef> I dont follow the issue |
23:07:07 | FromDiscord | <dedraiaken> This fails to compile because `update` wants a `Model` and `Message` not the more specific children |
23:07:25 | FromDiscord | <dedraiaken> even though `update` itself is valid because it constrains to `MsgClicked` |
23:07:26 | FromDiscord | <Elegantbeef> You make an intermediate proc that converts and checks |
23:08:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDR |
23:09:19 | FromDiscord | <Elegantbeef> Nim used to have multimethods but they're confusing |
23:15:05 | FromDiscord | <dedraiaken> In reply to @Elegantbeef "You make an intermediate": Yep, that compiles. I think that solves my confusion for now, thanks! π |
23:15:16 | FromDiscord | <dizzyliam> In reply to @pietroppeter "<@531959880609955841> pigeon looks very": Will do, thanks for the reminder! |
23:18:58 | FromDiscord | <Elegantbeef> No problem dedra |
23:22:05 | FromDiscord | <dizzyliam> @ElegantBeef I hope it's not too late to submit to This Month With Nim? |
23:27:38 | FromDiscord | <Elegantbeef> Nope |
23:28:09 | FromDiscord | <Elegantbeef> If there are atleast 3 submissions(we're at one right now) a post will be made |
23:28:24 | FromDiscord | <Elegantbeef> Otherwise we're waiting for November to be over |
23:28:33 | FromDiscord | <exelotl> oh I have a submission! |
23:28:40 | FromDiscord | <Elegantbeef> Well git at it |
23:29:04 | * | oprypin quit (Quit: Bye) |
23:29:14 | * | oprypin joined #nim |
23:30:24 | FromDiscord | <Bung> Elegantbeef\: I hope you can use github suggestion, so I can confirm by click. anyway thanks! |
23:30:46 | FromDiscord | <Elegantbeef> I'm too dumb to use github tools property |
23:30:50 | FromDiscord | <Elegantbeef> properly |
23:31:30 | FromDiscord | <huantian> you push the suggest button |
23:31:39 | FromDiscord | <huantian> Hope that helps! |
23:31:39 | FromDiscord | <Elegantbeef> Exactly |
23:31:49 | FromDiscord | <Elegantbeef> I'm too dumb for that |
23:32:56 | * | derpydoo quit (Ping timeout: 255 seconds) |
23:33:14 | FromDiscord | <albassort> In reply to @Elegantbeef "ChocolettePalette <@217459674700578816> it does": ????????????????????????????????????????????????? |
23:33:51 | FromDiscord | <Elegantbeef> I know right, searching for procedure names is rocket science |
23:33:56 | FromDiscord | <Elegantbeef> Just thing i cannot hit a green button |
23:34:00 | FromDiscord | <Elegantbeef> think\ |
23:36:57 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzβ¦) |
23:43:01 | * | tinytoast joined #nim |
23:45:40 | * | tinystoat quit (Ping timeout: 252 seconds) |
23:49:12 | FromDiscord | <huantian> https://kate-editor.org/post/2022/2022-10-31-treats-for-kate/ |
23:49:15 | FromDiscord | <huantian> treats for beef |
23:49:29 | FromDiscord | <Elegantbeef> Psh i'm not on an arch based distro so i already have those |
23:49:33 | FromDiscord | <Elegantbeef> i'm now on |
23:49:53 | FromDiscord | <elizabethgary> https://t.me/+PEc8FSRwFiFiYzc0 |