<< 11-11-2024 >>

00:12:01FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=pkAWFKHO
00:12:42FromDiscord<.tokyovigilante> In C this sort of thing would take a `void ` referencing an opaque object that needed to be updated based on the callback
00:14:26FromDiscord<.tokyovigilante> It seems chronos might do this:ā†µ`asyncengine: addReader2(fd: AsyncFD; cb: CallbackFunc; udata: pointer = nil): Result[void, OSErrorCode]` with a udata object
02:28:12FromDiscord<.tokyovigilante> Seems it does work with async dispatch if I put my callback in as an anonymous proc in the same function as I call `addRead()` which is ok but would be nice for legibility if I could define the callback proc separately
03:22:01*rockcavera quit (Remote host closed the connection)
03:22:04*GnuYawk quit (Quit: The Lounge - https://thelounge.chat)
03:22:23*GnuYawk joined #nim
03:45:36*Jakepys joined #nim
03:46:02JakepysHi
03:55:58FromDiscord<Elegantbeef> Hello
04:33:13JakepysI want to learn nim, but I'm a little lost, I know I shouldn't ask if I'm not at my disposition, but I want people who are experts to guide me
04:33:36FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html start here
04:46:27strogon14The Nim manual and standard lib documentation is really scarce on examples, so what helped me was looking at other peoples projects a lot and then trying to re-implement what I knew how to write in other languages in Nim and thereby exploring what the standard lib already others.
04:46:50strogon14s/other/offers/
04:46:52FromDiscord<Elegantbeef> search github with 'language\:nim' then
05:09:44JakepysThanks a lot guys, I will read the tutorials, and also read code from other nim devs.
05:09:53*Jakepys is now known as JakepysAsleep
05:14:26*JakepysAsleep quit (Ping timeout: 252 seconds)
05:28:56*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
05:29:27*SchweinDeBurg joined #nim
06:13:49*xet7 quit (Ping timeout: 252 seconds)
06:13:58*xet7 joined #nim
06:25:11*xet7 quit (Quit: Leaving)
06:30:40*xet7 joined #nim
09:06:49*deeo joined #nim
09:47:21*nonce joined #nim
10:29:02*nonce quit (Remote host closed the connection)
10:52:24*nonce joined #nim
11:30:36*nonce quit (Remote host closed the connection)
11:30:53*nonce joined #nim
11:49:52FromDiscord<omniy> https://1click-on.eu/p/a1eF/7mhb/ZCxd
11:53:23FromDiscord<odexine> <@&371760044473319454>
12:30:56FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=lMIUWdzj are templates like this stupid? :p
12:33:37*nonce quit (Remote host closed the connection)
12:33:54*nonce joined #nim
12:34:07FromDiscord<pmunch> Maybe not stupid, but perhaps a bit superfluous?
12:34:27FromDiscord<pmunch> Can make it harder in the future to know what's going on
12:34:42FromDiscord<Robyn [She/Her]> Fair point honestly
12:34:53FromDiscord<pmunch> I kinda like it though šŸ˜›
12:35:08FromDiscord<Robyn [She/Her]> lolol
12:35:16FromDiscord<Robyn [She/Her]> i made it to show the Power of Nimā„¢ļø
12:35:27FromDiscord<Robyn [She/Her]> Kinda liking it for `init` functions tho
12:38:14FromDiscord<Robyn [She/Her]> `setF` needs a better name tho
12:38:24PMunch`apply` perhaps?
12:39:17FromDiscord<Robyn [She/Her]> hmmmm yeah that's definitely better
12:40:05FromDiscord<Robyn [She/Her]> `setOrDefault` could also be `applyOr`?
12:42:14PMunchWell it's not really an `or` if I'm reading the template right
12:42:24PMunchMore like an `applyIf`
12:43:10PMunchOr `applyUnless` I guess
12:43:44PMunchBut it's not really `apply` any longer since the field is now different..
12:44:00PMunchThat's the more confusing of the two for sure
12:49:17FromDiscord<Robyn [She/Her]> yeaaah
12:49:21FromDiscord<Robyn [She/Her]> `applyThisOrThat` is also a bit too verbose
12:49:28FromDiscord<odexine> you can reference other parameters in the signature of init you know
12:49:39FromDiscord<odexine> `proc init(T: typedesc[Entity], max_health, max_mana: int, health = max_health, mana = max_mana): T =`
12:49:44FromDiscord<Robyn [She/Her]> In reply to @odexine "you can reference other": oh yeah i forgot
12:49:59FromDiscord<Robyn [She/Her]> I don't use that feature often, really
12:50:01FromDiscord<odexine> then everything is a field set
12:53:21FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=AbGhdiAN radical
13:09:04*JakepysAsleep joined #nim
13:17:56*JakepysAsleep quit (Ping timeout: 244 seconds)
13:20:28FromDiscord<zumi.dxy> Found out the hard way that templates affect stack traces and linedirs negatively :p
13:21:37FromDiscord<zumi.dxy> like, in the stack traces the function name is where it was invoked, but the filename is where it was defined
13:22:04FromDiscord<zumi.dxy> I think I can understand why it is
13:36:01FromDiscord<pmunch> Is _that_ what's going on when this happens?
13:36:11FromDiscord<pmunch> Damn, I've been annoyed at this since forever
13:37:44FromDiscord<zumi.dxy> Going forward I'll probably want to use procs more šŸ˜›ā†µ(i wonder if `{.inline.}` procs are subject to the same problem)
13:42:08FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "Going forward I'll probably": probably not, don't they get inlined on the C side?
13:44:40*beholders_eye joined #nim
13:47:56FromDiscord<fabric.input_output> I think inline procs are just `inline` C functions
13:48:05FromDiscord<fabric.input_output> as far as I've seen from codegen
13:49:56FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "I think inline procs": yeah that's what i assumed since I think in JS, the inline pragma does jackshit
13:50:02FromDiscord<Robyn [She/Her]> excuse my french :p
14:19:45*beholders_eye quit (Ping timeout: 272 seconds)
14:20:30*beholders_eye joined #nim
14:34:02*lucasta joined #nim
14:34:30FromDiscord<nervecenter> In reply to @chronos.vitaqua "https://play.nim-lang.org/#pasty=lMIUWdzj are templ": Based on my production experience, I'd just have a custom initializer for each type, because the conditions for initializing each type could radically diverge. It's also much easier to debug a proc than to debug generated code.
14:34:42FromDiscord<nervecenter> (edit) "type," => "important type in my progrma,"
14:34:47FromDiscord<nervecenter> (edit) "progrma," => "program,"
14:35:47FromDiscord<Robyn [She/Her]> In reply to @nervecenter "Based on my production": so just `result.a = a`?
14:36:43*deeo is now known as deep9
14:36:48*deep9 is now known as deeo9
14:39:58*deeo9 quit (Changing host)
14:39:58*deeo9 joined #nim
14:42:20FromDiscord<nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=HUaGNAHs
14:44:37FromDiscord<Robyn [She/Her]> In reply to @nervecenter "I realize you're probably": yeah I was aha
14:45:09FromDiscord<Robyn [She/Her]> In reply to @nervecenter "I realize you're probably": Oh that's what you mean, that's pretty repetitive though imo, hence why I prefer `init` and `new` functions
14:47:35FromDiscord<nervecenter> That's what's nice about nim, you can always overload or name different `init` procs for different scenarios
14:47:42FromDiscord<nervecenter> No sweat
14:48:05FromDiscord<nervecenter> And it's not deeply coupled or any other nonsense
14:48:55FromDiscord<nervecenter> You can always write overloaded or uniquely named `init` procs for any given special scenario
15:05:31FromDiscord<mtriplet> What's happened
15:05:51FromDiscord<mtriplet> cool
15:12:54*PMunch quit (Quit: Leaving)
15:29:34FromDiscord<Robyn [She/Her]> In reply to @nervecenter "You can always write": fair point
15:29:50*beholders_eye quit (Ping timeout: 260 seconds)
15:31:27*beholders_eye joined #nim
15:54:50*Looking joined #nim
15:57:13LookingIs there some kind of struct embedding in nim like in go, or alias this in D? Google is trying to hide such a knowledge from me or returns AI generated sites like https://learnxbyexample.com/nim/struct-embedding/
16:02:11FromDiscord<demotomohiro> What's 'struct embedding' means? I don't know about go or D lang.
16:07:53Lookingshort read https://gobyexample.com/struct-embedding
16:09:41FromDiscord<odexine> no
16:09:41LookingWhat I want to achieve is to be able to "extend" some library type and still use functions which expect such type + simplify access to the fields of embedded type
16:09:44FromDiscord<odexine> nim does not have this
16:09:59LookingMaybe some work arounds?
16:11:04FromDiscord<odexine> workarounds in what sense?
16:11:13LookingCan't use inheritance, because library objects are not of type `object of RootObj`
16:11:56FromDiscord<odexine> no alternatives here to get the same behaviour easily
16:16:46FromDiscord<planetis_m> In reply to @Looking "Is there some kind": I think the closest you have in nim is exactly like that site. Unless you prefer composition.
16:17:17LookingWhich site? AI generated?
16:17:39LookingIt doesn't work because you can't inherit from `object` type
16:19:45FromDiscord<planetis_m> Why you can't? Maybe it's missing the .final pragma
16:24:20FromDiscord<planetis_m> That no longer works, seems it needs to be object of RootObj
16:25:12LookingWait are you the author of naylib?
16:25:33FromDiscord<planetis_m> Yes?
16:25:51*lucasta quit (Remote host closed the connection)
16:26:06LookingOk what if I want to extend Camera2D with some fileds like maxZoom etc, how one would do that in nim?
16:29:09FromDiscord<planetis_m> Use composition, I don't see any other way
16:35:01LookingThats a bummer. Thanks anyway
16:42:07LookingAI suggested something that kinda works after modifications, but I'm not sure how idiomatic it would be to use something like this https://play.nim-lang.org/#pasty=wnskxlmR
16:44:04FromDiscord<k0ts> Converters work well, until they don't
16:54:43*Looking quit (Ping timeout: 256 seconds)
17:13:24FromDiscord<planetis_m> Looks cursed imo
17:55:20*coldfeet joined #nim
18:01:25FromDiscord<fabric.input_output> where the canvas at the js bindings?
18:02:14FromDiscord<ieltan> In reply to @k0ts "Converters work well, until": I feel like there should be some rules in order to prevent `converter` from being used liberally, while still making it useful
18:02:48FromDiscord<planetis_m> In reply to @fabric.input_output "where the canvas at": In an external library
18:04:25FromDiscord<fabric.input_output> damn
18:04:28FromDiscord<fabric.input_output> sadge
18:04:30FromDiscord<fabric.input_output> why
18:11:33*beholders_eye quit (Ping timeout: 248 seconds)
18:13:20*beholders_eye joined #nim
18:14:53*nonce quit (Remote host closed the connection)
18:22:54*beholders_eye quit (Ping timeout: 260 seconds)
18:26:53FromDiscord<k0ts> In reply to @ieltan "I feel like there": Idk, one of nim's charm points is that it's full of landmines that you only know to avoid with experience
18:41:33FromDiscord<fabric.input_output> tru
18:42:17FromDiscord<fabric.input_output> btw any workaround https://media.discordapp.net/attachments/371759389889003532/1305603523433730069/image.png?ex=6733a188&is=67325008&hm=0dab348553e383ce7f20ae37c2534e3dddc0f1d94ff842b00601262a8bdfec9a&
18:42:30FromDiscord<fabric.input_output> discord ate my messsage
18:42:37FromDiscord<fabric.input_output> any workarounds https://media.discordapp.net/attachments/371759389889003532/1305603608493953034/image.png?ex=6733a19d&is=6732501d&hm=9ca5ad9d54c515a9da6dc1d3f47fd2a6499852708ebd4a98ffdb5efb08db8bca&
18:42:40FromDiscord<fabric.input_output> what
18:43:01FromDiscord<fabric.input_output> I'm asking for workarounds for an issue and posting an image
18:43:07FromDiscord<fabric.input_output> and it gets deleted immediately
18:43:15FromDiscord<fabric.input_output> https://media.discordapp.net/attachments/371759389889003532/1305603762471047218/image.png?ex=6733a1c1&is=67325041&hm=c4004c11105dc71474bd7584ddefc883c9d0be46420dab0e8b123afc93415331&
18:43:27FromDiscord<fabric.input_output> wth discord
18:51:17FromDiscord<ieltan> In reply to @k0ts "Idk, one of nim's": Well you're not wrong, I'm a bit bummed out cause Imo Nim is a great and ez way to learn programming despite its many quirks, while still being a serious language. it does the convenient thing for you and if you need to optimize you can smoothly code your way into more advanced concepts. I think it just needs polished features and it'll be on another level completely
18:52:27FromDiscord<ieltan> In reply to @fabric.input_output "I'm asking for workarounds": Can u post the error text directly it'll be better
18:52:56FromDiscord<ieltan> In reply to @fabric.input_output "": I think I stumbled onto this one before lol
18:53:38FromDiscord<fabric.input_output> https://media.discordapp.net/attachments/371759389889003532/1305606377707798648/message.txt?ex=6733a431&is=673252b1&hm=cea5b66d7105dad0ef6325fb4d4beebd85d64d2826eaf74a9d08222a2995f60a&
18:54:20FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=LqAlRdzJ
18:54:49FromDiscord<k0ts> yeesh
18:55:14FromDiscord<swrge> the error message is a little bit deceptive, if this is the same issue that hit me `Allocator[T] = GlobalAllocator[T]` is the part that cause problems
18:55:28FromDiscord<swrge> i'll check how i solved it
18:56:01FromDiscord<swrge> this is ieltan btw
18:56:09FromDiscord<k0ts> Yeah, I thought default generic parameters was not a thing
18:56:18FromDiscord<fabric.input_output> it works on types iirc
18:56:24FromDiscord<swrge> they are a thing but they are quirky af
18:56:26FromDiscord<fabric.input_output> but I think it breaks when you try it on prcs
18:56:30FromDiscord<fabric.input_output> (edit) "prcs" => "procs"
18:56:42FromDiscord<swrge> you need to alias
18:58:18FromDiscord<fabric.input_output> how
19:01:52FromDiscord<swrge> alright
19:02:04FromDiscord<swrge> first generics are out of the question
19:02:27FromDiscord<swrge> i used concepts instead
19:03:00FromDiscord<swrge> sent a code paste, see https://play.nim-lang.org/#pasty=pYLdyneZ
19:03:10FromDiscord<swrge> (edit) "https://play.nim-lang.org/#pasty=FwMGLxsv" => "https://play.nim-lang.org/#pasty=rOQNAthh"
19:03:23FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=JbxmObls
19:03:55FromDiscord<swrge> then you alias like this
19:06:27FromDiscord<swrge> sent a code paste, see https://play.nim-lang.org/#pasty=eZAvBVuO
19:06:39FromDiscord<swrge> (edit) "https://play.nim-lang.org/#pasty=QorQMfmT" => "https://play.nim-lang.org/#pasty=kVfJwQKr"
19:07:21FromDiscord<swrge> you can ditch the `distinct` too
19:07:36FromDiscord<swrge> but this is pretty much what worked for me
19:08:00FromDiscord<fabric.input_output> wait, what about the generic param of the `Allocator` and `GlobalAllocator`?
19:08:58FromDiscord<swrge> the allocator is completely oblivious to the T, it's just a pointer with clever type trickery on top
19:09:17FromDiscord<swrge> the `Arc` is what tells you what the `T` is
19:10:06FromDiscord<swrge> u should replicate what the stdlib allocated api is doing
19:10:15FromDiscord<fabric.input_output> nah the allocator got to know the `T`
19:10:22FromDiscord<fabric.input_output> In reply to @swrge "u should replicate what": where's that?
19:11:02FromDiscord<swrge> its basically just `create` `createU`/`dealloc` which is lowkey the low level Nim allocator api
19:11:34FromDiscord<fabric.input_output> nim only got 2 allocators, the thread local one and global one
19:13:07FromDiscord<swrge> sure ? defacto those are the only functions to interact with Nim's own allocator
19:13:45FromDiscord<fabric.input_output> I dun like that. I want something like C++'s allocator api
19:14:22FromDiscord<swrge> thats besides the point, you can design it in anyway you want i just think it should replicate's nim cause thats just what nim's gives you as far as an "allocator" means to the language
19:14:32FromDiscord<swrge> In reply to @fabric.input_output "nah the allocator got": but why tho
19:15:10FromDiscord<fabric.input_output> In reply to @swrge "thats besides the point,": I don't like it >:(
19:15:22FromDiscord<fabric.input_output> In reply to @swrge "but why tho": cuz I want the allocator to do the casts and stuff. simple as
19:17:06FromDiscord<swrge> welp, for your casting woes i just provided u with an implementation of `create`/`createU` it should automatically be implemented for your`Allocator`
19:17:41FromDiscord<swrge> it just builds upon the "lower" `alloc`
19:18:20FromDiscord<swrge> yet the allocator still remains completely oblivious of the `T`, i'll be easier to work with the type system this way, trust me
19:18:35FromDiscord<fabric.input_output> doesn't really sit well with me
19:18:56FromDiscord<swrge> havent found a ezier solution personally lol
19:19:06FromDiscord<fabric.input_output> and also there's the problem of having more than 1 generic param for `=copy` and `=destroy` doesn't compile
19:19:08FromDiscord<swrge> anything else have been nothign short of the type system exploding on me
19:20:09FromDiscord<fabric.input_output> šŸ˜­
19:20:17FromDiscord<fabric.input_output> is it joever?
19:21:30FromDiscord<swrge> lemme compile a playground link
19:32:44FromDiscord<swrge> hmm
19:32:58FromDiscord<swrge> well this is embarassing, looks like it doesnt compile on devel anymore
19:32:59FromDiscord<swrge> xd
19:33:52*coldfeet quit (Remote host closed the connection)
19:34:16FromDiscord<fabric.input_output> T^T
19:35:06*xet7 quit (Quit: Leaving)
19:37:37FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=bhvxPWal
19:38:03FromDiscord<TFed> but i get an error\:
19:38:09FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=ZPUtsVpf
19:38:41FromDiscord<fabric.input_output> you're using the type `Unpack`, not the variable `unpack`
19:38:57FromDiscord<TFed> oh
19:40:15FromDiscord<TFed> yeah, that was it
19:40:17FromDiscord<TFed> thanks
20:17:04FromDiscord<nervecenter> Is it possible to limit an iterator? The first `n` entries, like a `take()` function? Or do we just have to use a sentinel value?
20:17:43FromDiscord<nervecenter> (edit) "use a" => "check an incrementing"
20:37:44FromDiscord<Elegantbeef> there is `std/enumerate` so you could do `for i, x in enumerate bleh.myIter`
20:37:50FromDiscord<Elegantbeef> @nervecenter
20:38:07FromDiscord<Elegantbeef> Otherwise not really iterators are not exactly composable
20:49:05*lucasta joined #nim
20:55:21FromDiscord<fabric.input_output> how can make a function that is just a getter for some property in js codegen?
20:55:27FromDiscord<fabric.input_output> (edit) "codegen?" => "backend?"
20:55:37FromDiscord<Elegantbeef> `importjs`
20:55:40FromDiscord<fabric.input_output> wanna do this but it doesn't work `func gpu(navigator: Navigator): GPU {.importjs: "navigator.gpu".}`
20:55:56FromDiscord<fabric.input_output> nvm fixed
20:56:01FromDiscord<fabric.input_output> needed to use `#`
21:31:51FromDiscord<nervecenter> In reply to @Elegantbeef "there is `std/enumerate` so": Okay thanks that does the job
21:53:32*rockcavera joined #nim
22:06:44*tiorock joined #nim
22:06:44*tiorock quit (Changing host)
22:06:44*tiorock joined #nim
22:06:44*rockcavera is now known as Guest5808
22:06:44*tiorock is now known as rockcavera
22:08:51*tiorock joined #nim
22:08:51*rockcavera is now known as Guest6758
22:08:51*Guest6758 quit (Killed (iridium.libera.chat (Nickname regained by services)))
22:08:51*tiorock is now known as rockcavera
22:10:59*Guest5808 quit (Ping timeout: 260 seconds)