<< 31-10-2022 >>

00:16:20*attah quit (Ping timeout: 248 seconds)
01:35:10*derpydoo joined #nim
02:25:27FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezl
02:25:38FromDiscord<Bung> is this valid? I see it here https://github.com/nim-lang/Nim/issues/12263
02:28:28FromDiscord<Elegantbeef> I imagine not
02:30:46FromDiscord<Bung> I also never seen that syntax before
02:31:06madpropsprogramming 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:51FromDiscord<Elegantbeef> An iterator + a callback?
02:32:33FromDiscord<danoneil> https://t.me/+PEc8FSRwFiFiYzc0
02:39:31FromDiscord<Prestige> <@&371760044473319454>
02:40:52*arkurious quit (Quit: Leaving)
04:12:51FromDiscord<Bung> `var EAGAIN {.importc: "EAGAIN", header: "<errno.h>".}: cint` is it possible be const ?
04:13:10*attah joined #nim
04:15:54FromDiscord<Elegantbeef> No
04:17:35FromDiscord<Bung> then I can't strictly check set construction
04:34:03FromDiscord<Elegantbeef> Well Nim is not a C compiler
04:34:04FromDiscord<Bung> `if {n[0][0].len, n[1].len} == {1}:` is this valid?
04:34:41FromDiscord<Elegantbeef> You'd have to convert to a range, but it's easier to just do `[a, b] == [1, 1]`
04:34:52FromDiscord<Elegantbeef> Though that's kinda ugly imo
04:35:57FromDiscord<Bung> hmm,I see the code from balls, it relys implicit range conversation
04:41:29FromDiscord<Elegantbeef> Whoopsies i just grew my stack by 8.1kb
04:42:17FromDiscord<Bung> shit , nim std also fails in my PR
04:42:27FromDiscord<Bung> https://github.com/nim-lang/Nim/pull/20712
04:44:17FromDiscord<Elegantbeef> I mean the CI errors are 'right'
04:49:40FromDiscord<Bung> so the generate structure compatible with c even element type is int?
04:50:26FromDiscord<Bung> just waste some memory
04:54:20FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezI
04:55:09*derpydoo quit (Ping timeout: 255 seconds)
04:55:46FromDiscord<Elegantbeef> Nimquery's quite cursed with their usage ` rune.int32 in intIdentifiers`
04:59:01FromDiscord<Bung> what's the problem your refers to? I see a memory waste
04:59:29FromDiscord<Elegantbeef> Memory waste and also it makes an set using `int` then checks if an `int32` is inside that int set
05:01:48FromDiscord<Bung> yeah, also a implicit conversation
05:04:32FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=4ezN
05:04:39FromDiscord<Bung> doesn't fails on my windows.
05:27:41FromDiscord<Elegantbeef> likely cause windows doesnt run the same code
05:33:45FromDiscord<Bung> how that could happen am on win10 64x
05:34:24FromDiscord<Elegantbeef> Oh no clue, misread
05:34:36FromDiscord<Bung> ok then
05:43:22FromDiscord<Bung> hmm, I forget I run it on wsl
06:32:32NimEventerNew thread by emre: Nim-gdb: Undefined command: "import", see https://forum.nim-lang.org/t/9565
06:37:23FromDiscord<Horizon [She/Her]> Winder how hard it'd be to make a basic abstraction layer for different WASM runtimes for Nim
06:37:30FromDiscord<Horizon [She/Her]> Wonder
06:37:50FromDiscord<Elegantbeef> There is some desire to make a FFI standard across all WASM runtimes
06:37:58FromDiscord<Elegantbeef> It's relatively difficult cause they all work differently
06:38:28FromDiscord<Elegantbeef> Wasmedge uses result types, Wasm3 uses cstring, Wasmer uses something else
06:38:36FromDiscord<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:56FromDiscord<Elegantbeef> Eh there is a desired to make a standard FFI for the runtimes
06:38:57FromDiscord<Horizon [She/Her]> In reply to @Elegantbeef "Wasmedge uses result types,": Hm, sounds more like pain then
06:39:38FromDiscord<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:40FromDiscord<Elegantbeef> https://github.com/WebAssembly/wasm-c-api
06:41:11FromDiscord<Horizon [She/Her]> Oh that's neat
06:41:23FromDiscord<Horizon [She/Her]> Wasmer is already implementing that API? And WasmTime too?
06:42:00FromDiscord<Elegantbeef> No clue wasmer's C-api lacked basic functionality iirc
06:42:35FromDiscord<Elegantbeef> One couldnt even query exported functions from a loaded wasm file when i was testing it
06:44:55FromDiscord<Horizon [She/Her]> That's... Irritating
06:45:10FromDiscord<Horizon [She/Her]> I remember wasmtime (the Java bindings) were broken though when i used them
06:45:29FromDiscord<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:43FromDiscord<Elegantbeef> It also has a very very simple forward facing API
06:45:59FromDiscord<Elegantbeef> Errors are just cstrings, if it's not nil it's an error, so i can raise an exception
06:46:06FromDiscord<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:39FromDiscord<Elegantbeef> I dont know if you looked at the wasm3c.nim file, but it's only 200 loc it's fucking amazing
06:47:38FromDiscord<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:10FromDiscord<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:13FromDiscord<Elegantbeef> Given i'm mostly concerned about dynamically scripting games and distributing those, i'm fairly indifferent about that
06:48:29FromDiscord<Elegantbeef> I might have missed some wasi stuff, but it should cover everything
06:49:27FromDiscord<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:42FromDiscord<Horizon [She/Her]> In reply to @Elegantbeef "I might have missed": I'm implementing WASI by myself anyway so that's fine
06:50:01FromDiscord<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:37FromDiscord<Horizon [She/Her]> Hm i still need to figure out how to structure the `Machine` object really
06:50:57FromDiscord<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:17FromDiscord<Elegantbeef> Some inspiration can be https://github.com/beef331/aiarena/blob/master/src/core/wasmenvs.nim↡(@Horizon [She/Her])
06:53:14FromDiscord<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:14FromDiscord<Elegantbeef> Look at tanks.nim's Tank and NativeTank for that
06:53:39FromDiscord<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:08FromDiscord<Elegantbeef> Physicsfs like?
06:55:16FromDiscord<Horizon [She/Her]> Physicsfs?
06:55:22FromDiscord<Elegantbeef> https://www.icculus.org/physfs/
06:55:33FromDiscord<Elegantbeef> I do kinda want to make a pure nim implementation of this
06:56:35FromDiscord<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:16FromDiscord<Horizon [She/Her]> Oh that's actually quite neat!
06:57:16FromDiscord<Elegantbeef> I'm not saying use it of course, just take inspiration from it
07:05:02FromDiscord<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:16FromDiscord<Horizon [She/Her]> Shouldn't be that hard in theory
07:05:26FromDiscord<Elegantbeef> Also have to ignore symlinks
07:06:07FromDiscord<Horizon [She/Her]> Does wasi even have a way to create symlinks?
07:06:21FromDiscord<Elegantbeef> No clue i've never looked into wasi really
07:13:05FromDiscord<Horizon [She/Her]> Fair, either way it shouldn't be that hard really
07:14:07FromDiscord<Horizon [She/Her]> If the parent dir does not equal `/home/{USER}/server/world/machines/{ID}`, then refuse to do anything
07:14:57FromDiscord<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:30FromDiscord<Elegantbeef> Bung\: `lastError.int in [errInvalidParameter, errFileNotFound]` πŸ˜„
07:21:33FromDiscord<Elegantbeef> Thank me later
07:25:26*PMunch joined #nim
07:34:15FromDiscord<Rika> Be careful of TOCTOU
07:34:33FromDiscord<Rika> https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use
07:47:40FromDiscord<Horizon [She/Her]> So to prevent it, raise an error instead of using a check?
07:48:37deadmarshalHey, 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:52FromDiscord<Elegantbeef> The python code?
07:56:33PMunchWild guess, you're not aware that `..` is inclusive and line 5 should actually just read 1..n instead of n+1?
07:57:37FromDiscord<Elegantbeef> That does make it not too recursive
07:58:46deadmarshalPMunch: Thanks, works now.
07:59:34FromDiscord<albassort> how can i set the port on the proxy in httpclient
07:59:52PMunch@Elegantbeef, well it worked for me :)
08:00:09FromDiscord<Elegantbeef> That's what i said
08:00:47FromDiscord<Elegantbeef> I wasnt going to say that it made it work cause i dont know what the sequence is supposed to be πŸ˜›
08:01:05FromDiscord<albassort> i cant seem to get these proxies working .-.
08:01:06PMunch@albassort, you create a Uri with a port element and call this: https://nim-lang.org/docs/httpclient.html#newProxy%2CUri%2Cstring
08:01:11FromDiscord<albassort> yahoo is ratelimiting me
08:01:19PMunchI guess you could also just do it with the string version
08:01:43PMunch@Elegantbeef, ah right, I misread what you wrote :)
08:03:28FromDiscord<albassort> parseUri will take a proxy like praseUr(94.131.21.2:6969)
08:03:30FromDiscord<albassort> ?
08:03:46FromDiscord<albassort> (edit) "praseUr(94.131.21.2:6969)" => "praseUri(94.131.21.2:6969)"
08:04:19PMunchYeah, it will parse the string according to the URI spec
08:06:20FromDiscord<albassort> well, I dont know if that worked or not
08:06:31FromDiscord<albassort> but yahoo still doesn't like me
08:07:05FromDiscord<Elegantbeef> Are you scraping too fast? Have you considered slowing down a bit
08:07:20FromDiscord<albassort> they blacklisted me
08:07:39FromDiscord<albassort> trying to proxy and useragent but they dont seem to fool them
08:07:40FromDiscord<albassort> hmmm
08:08:09FromDiscord<Elegantbeef> First step is to be kind
08:08:18FromDiscord<albassort> oh actually hmm
08:08:40FromDiscord<albassort> i coded something bad hmm
08:09:23FromDiscord<dizzyliam> Anyone know a way to get a byte corresponding to an int < 16? eg. 0 -> 0x00, 1 -> 0x01, etc.
08:09:41FromDiscord<dizzyliam> I foolishly assumed Nim would do some magic with myInt.byte
08:11:16FromDiscord<albassort> in string form?
08:11:26FromDiscord<albassort> like specifically to "0x01"
08:11:43FromDiscord<albassort> toHex in strutils is probably what you need
08:12:31FromDiscord<Elegantbeef> Wow someone read the strutils docs πŸ˜„
08:12:56FromDiscord<albassort> ok you know how much time I spent fucking with bytes
08:13:00PMunchTo be honest it would be cool if `byte` used toHex for its $ function
08:13:29FromDiscord<albassort> lets try get this for nim 2.0
08:14:09FromDiscord<albassort> oh i just realized i never applied the proxy and the useragent to the root client
08:14:11FromDiscord<albassort> :kek:
08:15:10FromDiscord<albassort> oh i did
08:15:16FromDiscord<albassort> what do i do next?
08:16:07FromDiscord<albassort> maybe I should get it running through tor or something
08:18:17FromDiscord<dizzyliam> In reply to @albassort "in string form?": in `byte` type
08:20:02FromDiscord<dizzyliam> so no. but glad I spawned this little discussion about hex representations
08:20:40FromDiscord<albassort> Byte type is a synonym for uint8
08:21:11FromDiscord<albassort> It is simply a value that takes up a single byte, ranging between 0 and 256
08:21:26FromDiscord<ChocolettePalette> 255?
08:21:36FromDiscord<albassort> 255. Sorry lol
08:21:45FromDiscord<albassort> Fake computer scientist
08:22:00FromDiscord<dizzyliam> hmm so `myInt.byte` should just work? right
08:22:46FromDiscord<albassort> Your integer will now be limited to a single byte in size
08:22:55FromDiscord<albassort> If that is what you want then yes
08:23:04PMunch@dizzyliam, I don't think anyone here really understands what you actually want..
08:23:56FromDiscord<albassort> There's nothing too special about the byte type. It's biggest use is memory optimization.. That's really it
08:24:16PMunchTo a computer 16 and 0x10 is the same number, they only differ in their string representation
08:24:28FromDiscord<albassort> Also if you specifically are working in the domain of serialization and memory
08:27:48FromDiscord<dizzyliam> In reply to @PMunch "To a computer 16": I was just wondering about type conversion specifically, to make the compiler happy
08:28:45FromDiscord<dizzyliam> Sounds like `myInt.byte` should be good :)
08:29:03PMunchYeah that will convert an int type to the byte type
08:31:07FromDiscord<dizzyliam> Cool thanks
08:32:15*derpydoo joined #nim
08:54:06*jjido joined #nim
09:01:05FromDiscord<ShalokShalom> In order to be more suitable for a dsl I like to develop, how can I redefine keywords?
09:01:33FromDiscord<ShalokShalom> Like, I like to have `logic` instead `func`
09:01:34FromDiscord<Rika> Do you have more context as to what you’re using
09:01:54FromDiscord<ShalokShalom> And `do` instead `proc`
09:02:13FromDiscord<Rika> Only within a macro can you redefine keywords
09:02:16FromDiscord<ShalokShalom> I just like to streamline the descriptive meaning of the keyword
09:02:19FromDiscord<Rika> Otherwise you would change the compiler code
09:02:28*kenran joined #nim
09:02:30FromDiscord<ShalokShalom> Oh yeah? And this still plays nice with tooling?
09:02:33FromDiscord<Rika> No
09:02:42FromDiscord<Rika> Well depends on which route you’re taking
09:02:46FromDiscord<ShalokShalom> I guess compiler code is more than simply running search and replace?
09:02:50FromDiscord<Rika> Probably not on either actually
09:02:50FromDiscord<Rika> Yes
09:02:52FromDiscord<Rika> Of course
09:03:00FromDiscord<ShalokShalom> The easiest route
09:03:05FromDiscord<Rika> In reply to @ShalokShalom "I guess compiler code": I would at least imagine it being more than that
09:03:10FromDiscord<ShalokShalom> I see
09:03:14FromDiscord<Rika> It might be that simple, I don’t really know
09:03:20FromDiscord<ShalokShalom> And how would I write that macro?
09:03:52*kenran quit (Remote host closed the connection)
09:04:20FromDiscord<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:29FromDiscord<Rika> Then it just replaces that keyword with what you want
09:04:37FromDiscord<Rika> what you want it to mean
09:04:39FromDiscord<ShalokShalom> Ah, I see.
09:04:43FromDiscord<ShalokShalom> Thanks dear
09:04:53FromDiscord<Rika> Which I guess would be a bit hard because of parsing rules being different
09:05:02FromDiscord<Rika> That might be an issue actually
09:11:14*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
09:37:43FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4eAz
09:46:35FromDiscord<Rika> Yeah me forgetful
09:46:40FromDiscord<Rika> Too bad there ain’t reader macros
10:22:28FromDiscord<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:35FromDiscord<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:15FromDiscord<arne> sent a code paste, see https://play.nim-lang.org/#ix=4eAV
10:52:50FromDiscord<arne> you can use annotations though.
10:54:33FromDiscord<arne> maybe you should use pragas to annotate your procs:
10:54:45FromDiscord<arne> sent a code paste, see https://play.nim-lang.org/#ix=4eAW
10:55:00FromDiscord<arne> (edit) "pragas" => "pragmas"
11:00:35FromDiscord<Rika> I know
11:00:39FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> hello everyone!
11:00:40FromDiscord<Rika> I realised
11:00:55FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> is there a well documented nim tutorial like rust's?
11:01:08FromDiscord<Horizon [She/Her]> Hello there πƒπšπ―πž
11:01:43FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> In reply to @Event Horizon "Hello there πƒπšπ―πž": hello
11:06:19FromDiscord<Horizon [She/Her]> In reply to @🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊 "is there a well": Have you looked at the tutorial page?
11:06:34FromDiscord<Horizon [She/Her]> https://nim-lang.org/docs/tut1.html
11:06:44FromDiscord<Horizon [She/Her]> Also the docs are your friends here ^^
11:33:02*derpydoo quit (Ping timeout: 268 seconds)
12:01:54FromDiscord<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:16FromDiscord<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:40FromDiscord<!&luke> How can I nimble install something with -d:ssl
13:41:59PMunchnimble install -d:ssl something?
13:42:06FromDiscord<!&luke> Of I just add that flag to the command it only installed the package dependencies
13:42:16FromDiscord<!&luke> (edit) "Of" => "If"
13:42:25FromDiscord<!&luke> (edit) "installed" => "installs"
13:49:12PMunchIs there a more comfortable way to do this? http://ix.io/4eBv/nim
14:27:34FromDiscord<@thatrandomperson5-6310e3b26da03> How would i type a type like\:
14:27:45FromDiscord<@thatrandomperson5-6310e3b26da03> How would i type a type like
14:29:27FromDiscord<@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4eBE
14:53:29FromDiscord<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:35FromDiscord<hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4eBY
15:19:08*arkurious joined #nim
15:20:21FromDiscord<guttural666> sent a long message, see http://ix.io/4eC1
15:30:22FromDiscord<@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:30FromDiscord<pietroppeter> hey all, there is still time to add your october thing to "This month with Nim"! https://github.com/beef331/website
16:41:06FromDiscord<pietroppeter> (I did add one thing ;))
16:41:18FromDiscord<pietroppeter> and thank @ElegantBeef for maintaining this!
16:45:50*derpydoo quit (Ping timeout: 246 seconds)
16:47:00FromDiscord<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:11FromDiscord<pietroppeter> @dizzyliam pigeon looks very interesting, maybe it is ready to be shared in this month with nim?
17:02:08FromDiscord<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:30FromDiscord<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:41FromDiscord<Tanguy> Haha, I could add some refreshers for people skipping the tutorials indeed πŸ™‚
17:12:49FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> In reply to @Event Horizon "Also the docs are": what about the guide books by others?
17:13:13FromDiscord<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:30FromDiscord<Horizon [She/Her]> Try "Nim By Example"? And "Nim handbook" in google?
17:14:13FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> In reply to @Event Horizon "Try "Nim By Example"?": no like i mean are they good?
17:14:44FromDiscord<Horizon [She/Her]> Oh, no idea, but probably are
17:15:16FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> i see
17:19:42FromDiscord<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:17FromDiscord<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:28FromDiscord<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:57FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> btw do you people think that nim is powerful enough for kernels?
17:36:08*arkurious joined #nim
18:10:41FromDiscord<@thatrandomperson5-6310e3b26da03> How would i properly type a proc? Like if im passing it into another proc.
18:12:01Amun-Rathatrandomperson5: foo(x: proc (x: int, y: float): bool)
18:12:17Amun-Ratype fun = proc (x: int): bool
18:12:19Amun-Raetc
18:23:45FromDiscord<Horizon [She/Her]> In reply to @🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊 "btw do you people": Yup, compiles down to C, and C is fine for kernels so
18:23:49FromDiscord<Horizon [She/Her]> There's an example kernel iirc
18:24:11FromDiscord<Horizon [She/Her]> https://github.com/dom96/nimkernel @🌊 .Β·.Β¨πƒπšπ―πžΒ¨.Β·. 🌊
18:25:37FromDiscord<🌊 .Β·.*Β¨πƒπšπ―πžΒ¨*.Β·. 🌊> thanks
18:35:42FromDiscord<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:55FromDiscord<guttural666> is a check like this in a case statement possible?
19:05:58FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1036717685620346971/unknown.png
19:08:20FromDiscord<auxym> yes, `of 1 .. 999` without the `in` should work
19:08:47FromDiscord<auxym> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement
19:11:32FromDiscord<auxym> but also you'll want to run the string you read from stdin through `parseInt` to get an integer
19:12:01FromDiscord<Bung> is there a proc I can get minimal type of int literal, for downgrade type
19:12:02FromDiscord<albassort> uh do proxies even work in httpclient?
19:15:09FromDiscord<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:20FromDiscord<guttural666> makes sense thanks
19:18:38FromDiscord<guttural666> this seems good eh https://media.discordapp.net/attachments/371759389889003532/1036720877938683964/unknown.png
19:19:35FromDiscord<guttural666> oh okay, what you said without the quotes does work fine
19:24:47FromDiscord<auxym> `"1" .. "9999" doesn't really make sense, you can't make a "range" of strings
19:24:55FromDiscord<auxym> (edit) ""9999"" => ""9999"`"
19:26:07FromDiscord<albassort> yea strings dont really work like that
19:26:21FromDiscord<albassort> there is no way to increment a string
19:26:26FromDiscord<albassort> string+1 doesn't exist
19:26:32FromDiscord<albassort> so you can make a range of it
19:27:58FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4eCU
19:28:33FromDiscord<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:41FromDiscord<albassort> auxym do you know any good httpclient libraries
19:29:57FromDiscord<albassort> the stdlib one is being a big ole baby about proxies
19:32:15FromDiscord<guttural666> In reply to @auxym "you want something like": okay, yeah got it, gonna take a look at this thanks!
19:39:56FromDiscord<Varriount> @Araq How should I handle PRs like this? https://github.com/nim-lang/Nim/pull/20697
19:47:59FromDiscord<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:52FromDiscord<planetis> So the new defaults fields allow to call any proc? I though the rfc was only for consts.
19:50:35FromDiscord<albassort> i was able to call = newHttpClient() in recent code
20:02:51FromDiscord<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:13FromDiscord<elizabethgary> https://t.me/+PEc8FSRwFiFiYzc0
20:33:20FromDiscord<Araq> @Varriount it's fine
20:39:31*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
20:39:56FromDiscord<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:26FromDiscord<guttural666> and what's the reason why defaulted proc parameters cannot be var?
20:52:29FromDiscord<huantian> because it doesn't make sense, would it be a global default that keeps getting changed?
20:52:51FromDiscord<huantian> if you want to catch errors you want `try:` `except ValueError:`
20:58:33FromDiscord<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:48FromDiscord<guttural666> okay, thanks, gonna check that out
20:59:04FromDiscord<huantian> I'd probably just use an overload as an alternative to var defaults for now
20:59:45FromDiscord<guttural666> I dunno, maybe my thinking is just way off
21:00:27FromDiscord<guttural666> this is what I'm doing rn, seems stupid https://media.discordapp.net/attachments/371759389889003532/1036746497993228458/unknown.png
21:00:55FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4eDl
21:01:39FromDiscord<guttural666> that would be the overload solution
21:01:44FromDiscord<guttural666> what you said?
21:01:52FromDiscord<huantian> yeah
21:02:06FromDiscord<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:14FromDiscord<huantian> which is probably what you want
21:02:20FromDiscord<guttural666> ohhhhhhhh
21:02:41FromDiscord<guttural666> will that reuse the memory as well?
21:02:59FromDiscord<huantian> I don't think it can
21:03:03FromDiscord<guttural666> mhm
21:03:14FromDiscord<huantian> since the arguments you pass in can't be mutated
21:03:42FromDiscord<guttural666> hmm, okay, thanks something to think about
21:04:11FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4eDm
21:04:54FromDiscord<guttural666> yeah, dunno what I was thinking
21:08:30NimEventerNew 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:54FromDiscord<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:54FromDiscord<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:07FromDiscord<Prestige> it's not
21:39:43FromDiscord<Elegantbeef> It is
21:40:03FromDiscord<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:47FromDiscord<Prestige> interesting
22:03:01FromDiscord<guttural666> cool, thanks!
22:09:36*jjido joined #nim
22:19:23FromDiscord<dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDC
22:19:31FromDiscord<dedraiaken> I get `invalid object assignment` at runtime
22:21:51FromDiscord<demotomohiro> It copys only Parent part of Child to do_thing. It is assumed invalid.
22:22:01FromDiscord<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:55FromDiscord<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:58FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4eDG
22:33:21FromDiscord<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:30FromDiscord<dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDH
22:33:37FromDiscord<dedraiaken> Do I have to explicitly cast it back?
22:35:09FromDiscord<huantian> yes, because do_thing returns a Parent : `proc do_thing(msg: Parent): Parent =`
22:36:55FromDiscord<Elegantbeef> Without the reference you cannot do inheritance as you've done
22:37:13FromDiscord<Elegantbeef> I think allowing the code you submitted to compile is wrong cause stack based inheritance is a mistake πŸ˜„
22:39:35FromDiscord<Bung> thought maybe can have better error message
22:40:37FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4eDJ
22:41:33FromDiscord<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:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDK
22:43:05FromDiscord<Elegantbeef> Either the check should ensure sizeof the child is the same as parent, or it should error at compile time
22:43:13FromDiscord<dedraiaken> In reply to @demotomohiro "You can convert the": Thanks!
22:45:01FromDiscord<Elegantbeef> Worth noting dedraiaken if you have a fixed selection of objects it's generally suggested to use object variants instead
22:45:19FromDiscord<Elegantbeef> It's faster and arguably less error prone
22:45:30FromDiscord<Elegantbeef> But it's also more inflexible and possibly more tedious
22:47:35FromDiscord<Bung> it should be a CT error imo.
22:47:50FromDiscord<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:13FromDiscord<Elegantbeef> If you are not adding fields to an object there isnt much reason to disable inheritance
22:49:14FromDiscord<Bung> but parent = child seems make no sense
22:50:14FromDiscord<Bung> follow this rules will be var a\: RootObj = A
22:50:27FromDiscord<Elegantbeef> Eh i think there are cases it makes sense
22:51:28FromDiscord<Bung> so the case is ?
22:51:34FromDiscord<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:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDL
22:54:14FromDiscord<Elegantbeef> the child is the same size as the parent so there is 0 reason to disallow the conversion imo
22:54:55FromDiscord<Elegantbeef> It's not like you cannot distinguish them later, so it's a bit odd
22:56:24FromDiscord<Bung> oh, I guess sometime it be useful for generic sigmatch
22:56:42FromDiscord<Elegantbeef> I mean it's runtime dispatch i'm talking about here
22:56:46FromDiscord<Bung> yeah, shouldn't disallowed
22:57:22FromDiscord<Elegantbeef> One might argue a pointer proc might make more sense here but alas
22:59:57FromDiscord<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:34FromDiscord<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:52FromDiscord<Elegantbeef> ChocolettePalette @albassort it does so https://nim-lang.org/docs/strutils.html#count%2Cstring%2Cstring%2Cbool
23:01:55FromDiscord<Elegantbeef> It's nim it's of course typesafe
23:02:08FromDiscord<Elegantbeef> It also of course cannot mutate fields that dont exist
23:02:29FromDiscord<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:46FromDiscord<Elegantbeef> It's a tinge annoying, and we can make macros to get around it luckily
23:05:14FromDiscord<dedraiaken> sent a code paste, see https://play.nim-lang.org/#ix=4eDQ
23:05:27FromDiscord<dedraiaken> Maybe something like that?
23:05:55FromDiscord<Elegantbeef> Message has no field clicked
23:05:59FromDiscord<Elegantbeef> It'll error at compile time
23:06:28FromDiscord<Elegantbeef> Wait i misread
23:06:41FromDiscord<Elegantbeef> I dont follow the issue
23:07:07FromDiscord<dedraiaken> This fails to compile because `update` wants a `Model` and `Message` not the more specific children
23:07:25FromDiscord<dedraiaken> even though `update` itself is valid because it constrains to `MsgClicked`
23:07:26FromDiscord<Elegantbeef> You make an intermediate proc that converts and checks
23:08:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eDR
23:09:19FromDiscord<Elegantbeef> Nim used to have multimethods but they're confusing
23:15:05FromDiscord<dedraiaken> In reply to @Elegantbeef "You make an intermediate": Yep, that compiles. I think that solves my confusion for now, thanks! πŸ˜„
23:15:16FromDiscord<dizzyliam> In reply to @pietroppeter "<@531959880609955841> pigeon looks very": Will do, thanks for the reminder!
23:18:58FromDiscord<Elegantbeef> No problem dedra
23:22:05FromDiscord<dizzyliam> @ElegantBeef I hope it's not too late to submit to This Month With Nim?
23:27:38FromDiscord<Elegantbeef> Nope
23:28:09FromDiscord<Elegantbeef> If there are atleast 3 submissions(we're at one right now) a post will be made
23:28:24FromDiscord<Elegantbeef> Otherwise we're waiting for November to be over
23:28:33FromDiscord<exelotl> oh I have a submission!
23:28:40FromDiscord<Elegantbeef> Well git at it
23:29:04*oprypin quit (Quit: Bye)
23:29:14*oprypin joined #nim
23:30:24FromDiscord<Bung> Elegantbeef\: I hope you can use github suggestion, so I can confirm by click. anyway thanks!
23:30:46FromDiscord<Elegantbeef> I'm too dumb to use github tools property
23:30:50FromDiscord<Elegantbeef> properly
23:31:30FromDiscord<huantian> you push the suggest button
23:31:39FromDiscord<huantian> Hope that helps!
23:31:39FromDiscord<Elegantbeef> Exactly
23:31:49FromDiscord<Elegantbeef> I'm too dumb for that
23:32:56*derpydoo quit (Ping timeout: 255 seconds)
23:33:14FromDiscord<albassort> In reply to @Elegantbeef "ChocolettePalette <@217459674700578816> it does": ?????????????????????????????????????????????????
23:33:51FromDiscord<Elegantbeef> I know right, searching for procedure names is rocket science
23:33:56FromDiscord<Elegantbeef> Just thing i cannot hit a green button
23:34:00FromDiscord<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:12FromDiscord<huantian> https://kate-editor.org/post/2022/2022-10-31-treats-for-kate/
23:49:15FromDiscord<huantian> treats for beef
23:49:29FromDiscord<Elegantbeef> Psh i'm not on an arch based distro so i already have those
23:49:33FromDiscord<Elegantbeef> i'm now on
23:49:53FromDiscord<elizabethgary> https://t.me/+PEc8FSRwFiFiYzc0