00:12:01 | FromDiscord | <.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=pkAWFKHO |
00:12:42 | FromDiscord | <.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:26 | FromDiscord | <.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:12 | FromDiscord | <.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:02 | Jakepys | Hi |
03:55:58 | FromDiscord | <Elegantbeef> Hello |
04:33:13 | Jakepys | I 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:36 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html start here |
04:46:27 | strogon14 | The 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:50 | strogon14 | s/other/offers/ |
04:46:52 | FromDiscord | <Elegantbeef> search github with 'language\:nim' then |
05:09:44 | Jakepys | Thanks 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:52 | FromDiscord | <omniy> https://1click-on.eu/p/a1eF/7mhb/ZCxd |
11:53:23 | FromDiscord | <odexine> <@&371760044473319454> |
12:30:56 | FromDiscord | <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:07 | FromDiscord | <pmunch> Maybe not stupid, but perhaps a bit superfluous? |
12:34:27 | FromDiscord | <pmunch> Can make it harder in the future to know what's going on |
12:34:42 | FromDiscord | <Robyn [She/Her]> Fair point honestly |
12:34:53 | FromDiscord | <pmunch> I kinda like it though š |
12:35:08 | FromDiscord | <Robyn [She/Her]> lolol |
12:35:16 | FromDiscord | <Robyn [She/Her]> i made it to show the Power of Nimā¢ļø |
12:35:27 | FromDiscord | <Robyn [She/Her]> Kinda liking it for `init` functions tho |
12:38:14 | FromDiscord | <Robyn [She/Her]> `setF` needs a better name tho |
12:38:24 | PMunch | `apply` perhaps? |
12:39:17 | FromDiscord | <Robyn [She/Her]> hmmmm yeah that's definitely better |
12:40:05 | FromDiscord | <Robyn [She/Her]> `setOrDefault` could also be `applyOr`? |
12:42:14 | PMunch | Well it's not really an `or` if I'm reading the template right |
12:42:24 | PMunch | More like an `applyIf` |
12:43:10 | PMunch | Or `applyUnless` I guess |
12:43:44 | PMunch | But it's not really `apply` any longer since the field is now different.. |
12:44:00 | PMunch | That's the more confusing of the two for sure |
12:49:17 | FromDiscord | <Robyn [She/Her]> yeaaah |
12:49:21 | FromDiscord | <Robyn [She/Her]> `applyThisOrThat` is also a bit too verbose |
12:49:28 | FromDiscord | <odexine> you can reference other parameters in the signature of init you know |
12:49:39 | FromDiscord | <odexine> `proc init(T: typedesc[Entity], max_health, max_mana: int, health = max_health, mana = max_mana): T =` |
12:49:44 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "you can reference other": oh yeah i forgot |
12:49:59 | FromDiscord | <Robyn [She/Her]> I don't use that feature often, really |
12:50:01 | FromDiscord | <odexine> then everything is a field set |
12:53:21 | FromDiscord | <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:28 | FromDiscord | <zumi.dxy> Found out the hard way that templates affect stack traces and linedirs negatively :p |
13:21:37 | FromDiscord | <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:04 | FromDiscord | <zumi.dxy> I think I can understand why it is |
13:36:01 | FromDiscord | <pmunch> Is _that_ what's going on when this happens? |
13:36:11 | FromDiscord | <pmunch> Damn, I've been annoyed at this since forever |
13:37:44 | FromDiscord | <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:08 | FromDiscord | <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:56 | FromDiscord | <fabric.input_output> I think inline procs are just `inline` C functions |
13:48:05 | FromDiscord | <fabric.input_output> as far as I've seen from codegen |
13:49:56 | FromDiscord | <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:02 | FromDiscord | <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:30 | FromDiscord | <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:42 | FromDiscord | <nervecenter> (edit) "type," => "important type in my progrma," |
14:34:47 | FromDiscord | <nervecenter> (edit) "progrma," => "program," |
14:35:47 | FromDiscord | <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:20 | FromDiscord | <nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=HUaGNAHs |
14:44:37 | FromDiscord | <Robyn [She/Her]> In reply to @nervecenter "I realize you're probably": yeah I was aha |
14:45:09 | FromDiscord | <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:35 | FromDiscord | <nervecenter> That's what's nice about nim, you can always overload or name different `init` procs for different scenarios |
14:47:42 | FromDiscord | <nervecenter> No sweat |
14:48:05 | FromDiscord | <nervecenter> And it's not deeply coupled or any other nonsense |
14:48:55 | FromDiscord | <nervecenter> You can always write overloaded or uniquely named `init` procs for any given special scenario |
15:05:31 | FromDiscord | <mtriplet> What's happened |
15:05:51 | FromDiscord | <mtriplet> cool |
15:12:54 | * | PMunch quit (Quit: Leaving) |
15:29:34 | FromDiscord | <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:13 | Looking | Is 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:11 | FromDiscord | <demotomohiro> What's 'struct embedding' means? I don't know about go or D lang. |
16:07:53 | Looking | short read https://gobyexample.com/struct-embedding |
16:09:41 | FromDiscord | <odexine> no |
16:09:41 | Looking | What 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:44 | FromDiscord | <odexine> nim does not have this |
16:09:59 | Looking | Maybe some work arounds? |
16:11:04 | FromDiscord | <odexine> workarounds in what sense? |
16:11:13 | Looking | Can't use inheritance, because library objects are not of type `object of RootObj` |
16:11:56 | FromDiscord | <odexine> no alternatives here to get the same behaviour easily |
16:16:46 | FromDiscord | <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:17 | Looking | Which site? AI generated? |
16:17:39 | Looking | It doesn't work because you can't inherit from `object` type |
16:19:45 | FromDiscord | <planetis_m> Why you can't? Maybe it's missing the .final pragma |
16:24:20 | FromDiscord | <planetis_m> That no longer works, seems it needs to be object of RootObj |
16:25:12 | Looking | Wait are you the author of naylib? |
16:25:33 | FromDiscord | <planetis_m> Yes? |
16:25:51 | * | lucasta quit (Remote host closed the connection) |
16:26:06 | Looking | Ok what if I want to extend Camera2D with some fileds like maxZoom etc, how one would do that in nim? |
16:29:09 | FromDiscord | <planetis_m> Use composition, I don't see any other way |
16:35:01 | Looking | Thats a bummer. Thanks anyway |
16:42:07 | Looking | AI 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:04 | FromDiscord | <k0ts> Converters work well, until they don't |
16:54:43 | * | Looking quit (Ping timeout: 256 seconds) |
17:13:24 | FromDiscord | <planetis_m> Looks cursed imo |
17:55:20 | * | coldfeet joined #nim |
18:01:25 | FromDiscord | <fabric.input_output> where the canvas at the js bindings? |
18:02:14 | FromDiscord | <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:48 | FromDiscord | <planetis_m> In reply to @fabric.input_output "where the canvas at": In an external library |
18:04:25 | FromDiscord | <fabric.input_output> damn |
18:04:28 | FromDiscord | <fabric.input_output> sadge |
18:04:30 | FromDiscord | <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:53 | FromDiscord | <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:33 | FromDiscord | <fabric.input_output> tru |
18:42:17 | FromDiscord | <fabric.input_output> btw any workaround https://media.discordapp.net/attachments/371759389889003532/1305603523433730069/image.png?ex=6733a188&is=67325008&hm=0dab348553e383ce7f20ae37c2534e3dddc0f1d94ff842b00601262a8bdfec9a& |
18:42:30 | FromDiscord | <fabric.input_output> discord ate my messsage |
18:42:37 | FromDiscord | <fabric.input_output> any workarounds https://media.discordapp.net/attachments/371759389889003532/1305603608493953034/image.png?ex=6733a19d&is=6732501d&hm=9ca5ad9d54c515a9da6dc1d3f47fd2a6499852708ebd4a98ffdb5efb08db8bca& |
18:42:40 | FromDiscord | <fabric.input_output> what |
18:43:01 | FromDiscord | <fabric.input_output> I'm asking for workarounds for an issue and posting an image |
18:43:07 | FromDiscord | <fabric.input_output> and it gets deleted immediately |
18:43:15 | FromDiscord | <fabric.input_output> https://media.discordapp.net/attachments/371759389889003532/1305603762471047218/image.png?ex=6733a1c1&is=67325041&hm=c4004c11105dc71474bd7584ddefc883c9d0be46420dab0e8b123afc93415331& |
18:43:27 | FromDiscord | <fabric.input_output> wth discord |
18:51:17 | FromDiscord | <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:27 | FromDiscord | <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:56 | FromDiscord | <ieltan> In reply to @fabric.input_output "": I think I stumbled onto this one before lol |
18:53:38 | FromDiscord | <fabric.input_output> https://media.discordapp.net/attachments/371759389889003532/1305606377707798648/message.txt?ex=6733a431&is=673252b1&hm=cea5b66d7105dad0ef6325fb4d4beebd85d64d2826eaf74a9d08222a2995f60a& |
18:54:20 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=LqAlRdzJ |
18:54:49 | FromDiscord | <k0ts> yeesh |
18:55:14 | FromDiscord | <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:28 | FromDiscord | <swrge> i'll check how i solved it |
18:56:01 | FromDiscord | <swrge> this is ieltan btw |
18:56:09 | FromDiscord | <k0ts> Yeah, I thought default generic parameters was not a thing |
18:56:18 | FromDiscord | <fabric.input_output> it works on types iirc |
18:56:24 | FromDiscord | <swrge> they are a thing but they are quirky af |
18:56:26 | FromDiscord | <fabric.input_output> but I think it breaks when you try it on prcs |
18:56:30 | FromDiscord | <fabric.input_output> (edit) "prcs" => "procs" |
18:56:42 | FromDiscord | <swrge> you need to alias |
18:58:18 | FromDiscord | <fabric.input_output> how |
19:01:52 | FromDiscord | <swrge> alright |
19:02:04 | FromDiscord | <swrge> first generics are out of the question |
19:02:27 | FromDiscord | <swrge> i used concepts instead |
19:03:00 | FromDiscord | <swrge> sent a code paste, see https://play.nim-lang.org/#pasty=pYLdyneZ |
19:03:10 | FromDiscord | <swrge> (edit) "https://play.nim-lang.org/#pasty=FwMGLxsv" => "https://play.nim-lang.org/#pasty=rOQNAthh" |
19:03:23 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=JbxmObls |
19:03:55 | FromDiscord | <swrge> then you alias like this |
19:06:27 | FromDiscord | <swrge> sent a code paste, see https://play.nim-lang.org/#pasty=eZAvBVuO |
19:06:39 | FromDiscord | <swrge> (edit) "https://play.nim-lang.org/#pasty=QorQMfmT" => "https://play.nim-lang.org/#pasty=kVfJwQKr" |
19:07:21 | FromDiscord | <swrge> you can ditch the `distinct` too |
19:07:36 | FromDiscord | <swrge> but this is pretty much what worked for me |
19:08:00 | FromDiscord | <fabric.input_output> wait, what about the generic param of the `Allocator` and `GlobalAllocator`? |
19:08:58 | FromDiscord | <swrge> the allocator is completely oblivious to the T, it's just a pointer with clever type trickery on top |
19:09:17 | FromDiscord | <swrge> the `Arc` is what tells you what the `T` is |
19:10:06 | FromDiscord | <swrge> u should replicate what the stdlib allocated api is doing |
19:10:15 | FromDiscord | <fabric.input_output> nah the allocator got to know the `T` |
19:10:22 | FromDiscord | <fabric.input_output> In reply to @swrge "u should replicate what": where's that? |
19:11:02 | FromDiscord | <swrge> its basically just `create` `createU`/`dealloc` which is lowkey the low level Nim allocator api |
19:11:34 | FromDiscord | <fabric.input_output> nim only got 2 allocators, the thread local one and global one |
19:13:07 | FromDiscord | <swrge> sure ? defacto those are the only functions to interact with Nim's own allocator |
19:13:45 | FromDiscord | <fabric.input_output> I dun like that. I want something like C++'s allocator api |
19:14:22 | FromDiscord | <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:32 | FromDiscord | <swrge> In reply to @fabric.input_output "nah the allocator got": but why tho |
19:15:10 | FromDiscord | <fabric.input_output> In reply to @swrge "thats besides the point,": I don't like it >:( |
19:15:22 | FromDiscord | <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:06 | FromDiscord | <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:41 | FromDiscord | <swrge> it just builds upon the "lower" `alloc` |
19:18:20 | FromDiscord | <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:35 | FromDiscord | <fabric.input_output> doesn't really sit well with me |
19:18:56 | FromDiscord | <swrge> havent found a ezier solution personally lol |
19:19:06 | FromDiscord | <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:08 | FromDiscord | <swrge> anything else have been nothign short of the type system exploding on me |
19:20:09 | FromDiscord | <fabric.input_output> š |
19:20:17 | FromDiscord | <fabric.input_output> is it joever? |
19:21:30 | FromDiscord | <swrge> lemme compile a playground link |
19:32:44 | FromDiscord | <swrge> hmm |
19:32:58 | FromDiscord | <swrge> well this is embarassing, looks like it doesnt compile on devel anymore |
19:32:59 | FromDiscord | <swrge> xd |
19:33:52 | * | coldfeet quit (Remote host closed the connection) |
19:34:16 | FromDiscord | <fabric.input_output> T^T |
19:35:06 | * | xet7 quit (Quit: Leaving) |
19:37:37 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=bhvxPWal |
19:38:03 | FromDiscord | <TFed> but i get an error\: |
19:38:09 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=ZPUtsVpf |
19:38:41 | FromDiscord | <fabric.input_output> you're using the type `Unpack`, not the variable `unpack` |
19:38:57 | FromDiscord | <TFed> oh |
19:40:15 | FromDiscord | <TFed> yeah, that was it |
19:40:17 | FromDiscord | <TFed> thanks |
20:17:04 | FromDiscord | <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:43 | FromDiscord | <nervecenter> (edit) "use a" => "check an incrementing" |
20:37:44 | FromDiscord | <Elegantbeef> there is `std/enumerate` so you could do `for i, x in enumerate bleh.myIter` |
20:37:50 | FromDiscord | <Elegantbeef> @nervecenter |
20:38:07 | FromDiscord | <Elegantbeef> Otherwise not really iterators are not exactly composable |
20:49:05 | * | lucasta joined #nim |
20:55:21 | FromDiscord | <fabric.input_output> how can make a function that is just a getter for some property in js codegen? |
20:55:27 | FromDiscord | <fabric.input_output> (edit) "codegen?" => "backend?" |
20:55:37 | FromDiscord | <Elegantbeef> `importjs` |
20:55:40 | FromDiscord | <fabric.input_output> wanna do this but it doesn't work `func gpu(navigator: Navigator): GPU {.importjs: "navigator.gpu".}` |
20:55:56 | FromDiscord | <fabric.input_output> nvm fixed |
20:56:01 | FromDiscord | <fabric.input_output> needed to use `#` |
21:31:51 | FromDiscord | <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) |