00:27:21 | * | proaxis joined #nim |
00:58:19 | * | rockcavera quit (Remote host closed the connection) |
01:52:05 | FromDiscord | <girvo> sent a long message, see https://pasty.ee/UAmlmLxTqdKs |
01:56:46 | FromDiscord | <girvo> I was trying to use `winim/clr` to work with it, but I can't create a `System.Management.EventArrivedEventHandler` it seems. I |
02:04:26 | * | Mister_Magister quit (Ping timeout: 252 seconds) |
02:05:54 | FromDiscord | <Elegantbeef> @girvo Generally the solution is the good ol' `proc(..., userData: pointer) {.cdecl.}` callback π |
02:07:08 | FromDiscord | <girvo> Yeah thats what I was thinking haha |
02:07:29 | FromDiscord | <girvo> Though I managed to get it to work by `compile()`-ing some C# via winim/clr to work around the difficulties I was having setting callbacks |
02:07:31 | FromDiscord | <girvo> sent a long message, see https://pasty.ee/nWfQQbshvHPD |
02:07:40 | FromDiscord | <girvo> That actually worked, interestingly! |
02:08:57 | FromDiscord | <girvo> https://pastebin.com/TFUK5jBT |
02:09:07 | * | Mister_Magister joined #nim |
02:12:47 | FromDiscord | <girvo> Now to work out how to debounce the handler |
02:26:26 | FromDiscord | <girvo> Oh lmao. WMI is just polling it based on the query anyway. So this is all useless, I might as well just call the `usbipd.exe state` directly in a 1 second loop |
02:29:28 | * | def- quit (Quit: -) |
02:33:23 | * | def- joined #nim |
02:36:27 | * | def- quit (Client Quit) |
02:44:45 | * | krux02 quit (Remote host closed the connection) |
02:44:56 | NimEventer | New Nimble package! simplestatsdclient - Pure nim interface library to send data to any StatsD compatible daemon, see https://github.com/Q-Master/statsdclient.nim |
02:52:17 | * | smlckz joined #nim |
02:53:06 | smlckz | Hi. How to cast seq[byte] to openArray[char] or equivalent? |
02:53:33 | FromDiscord | <Elegantbeef> You don't it already is convertible to it |
02:53:43 | FromDiscord | <Elegantbeef> Oh wait you said `openArray[char]` |
02:54:12 | FromDiscord | <Elegantbeef> I misread you can do `cast[seq[char]](myByteSeq)` |
02:54:28 | FromDiscord | <Elegantbeef> There sadly is not a safe operation for byte -\> char openArray |
02:55:10 | * | def- joined #nim |
02:58:29 | * | def- quit (Client Quit) |
02:59:59 | * | def- joined #nim |
03:02:48 | FromDiscord | <girvo> If I'm doing a desktop GUI app, with wNim, and it uses threadpool for spawning worker threads, but threadpool is deprecated: what should I be using instead? weave? taskpools? They all seem built for actual fan-out fan-in parallelism, rather than "worker thread that runs forever" spawns? |
03:03:35 | FromDiscord | <girvo> I don't really care about the returned value from the spawned task, as the task/thread/whatever won't ever return |
03:11:15 | * | rockcavera joined #nim |
03:11:38 | * | def- quit (Quit: -) |
03:13:19 | * | def- joined #nim |
03:24:14 | FromDiscord | <im__cynical> https://raw.githubusercontent.com/byt3bl33d3r/OffensiveNim/master/src/self_delete_bin.nim This code worked perfectly fine a few months ago, and now it gives me a buffer overflow when I try it |
03:24:37 | FromDiscord | <im__cynical> the code itself didnt change at all |
03:25:11 | FromDiscord | <β Array π΅πΈ π> does downgrading nim fixes it?β΅(@imcynical) |
03:36:41 | * | def- quit (Quit: -) |
03:37:27 | FromDiscord | <niggerblaster9005> @room |
03:37:35 | FromDiscord | <niggerblaster9005> Kill niggers |
03:37:41 | FromDiscord | <niggerblaster9005> Fuck all niggers |
03:37:44 | FromDiscord | <niggerblaster9005> Shoot kills |
03:37:55 | * | def- joined #nim |
03:37:57 | FromDiscord | <niggerblaster9005> Nigger nigger nigger |
03:38:03 | FromDiscord | <niggerblaster9005> Nigger |
03:38:04 | FromDiscord | <ElegantBeef> <@&371760044473319454> |
03:38:09 | FromDiscord | <niggerblaster9005> Nigger |
03:38:11 | FromDiscord | <niggerblaster9005> @ElegantBeef\: |
03:38:14 | FromDiscord | <niggerblaster9005> @ElegantBeef\: |
03:38:16 | FromDiscord | <niggerblaster9005> Nigger |
03:38:20 | FromDiscord | <Elegantbeef> @girvo probably want createThread |
03:38:20 | FromDiscord | <niggerblaster9005> Nigger |
03:38:25 | FromDiscord | <Elegantbeef> Damn you really are low effort troll |
03:38:35 | FromDiscord | <niggerblaster9005> 1000039228.jpg https://media.discordapp.net/attachments/371759389889003532/1211880029861187645/1000039228.jpg?ex=65efce3a&is=65dd593a&hm=05760e995f45059345f21211e30ac306cb3d1b19d2daa3f8bf6cd66f6ab34e78& |
03:38:42 | FromDiscord | <graveflo> why bother. like who cares |
03:38:59 | FromDiscord | <graveflo> just going to get banned anyway |
03:39:05 | FromDiscord | <niggerblaster9005> 1000039010.jpg https://media.discordapp.net/attachments/371759389889003532/1211880154968625162/1000039010.jpg?ex=65efce58&is=65dd5958&hm=b33478c881eba7af4ff30b5e8aa608b89a917f484b005b845f9721cd37ff0501& |
03:39:24 | FromDiscord | <niggerblaster9005> @room nigger |
03:39:30 | FromDiscord | <niggerblaster9005> @room nigger |
03:39:32 | FromDiscord | <niggerblaster9005> @room nigger |
03:39:34 | FromDiscord | <niggerblaster9005> @room nigger |
03:39:39 | FromDiscord | <niggerblaster9005> @room nigger |
03:40:34 | FromDiscord | <Elegantbeef> It's always a confounding thing |
03:40:41 | FromDiscord | <girvo> In reply to @Elegantbeef "<@823468778704076810> probably want createThread": Ah yep good call |
03:40:59 | FromDiscord | <girvo> Yeah I never understand. Must be something deeply wrong with them |
03:40:59 | FromDiscord | <Elegantbeef> sorry for the awful ping timing, just seen the message on discord |
03:41:20 | FromDiscord | <girvo> Lmao itβs all good |
03:41:46 | FromDiscord | <niggerblaster9005> @room nigger |
03:41:47 | FromDiscord | <niggerblaster9005> @room nigger |
03:42:56 | FromDiscord | <niggerblaster9005> 1000002174.gif https://media.discordapp.net/attachments/371759389889003532/1211881125870313513/1000002174.gif?ex=65efcf40&is=65dd5a40&hm=0a2880c1e43c3e76d4bb811522210b0d9af11c9a27e88d83b80f7d3dbfd4f412& |
03:42:56 | FromDiscord | <niggerblaster9005> 1000002177.jpg https://media.discordapp.net/attachments/371759389889003532/1211881127799816212/1000002177.jpg?ex=65efcf40&is=65dd5a40&hm=19a2982a7bdfd45e2662aaf52969321cd4dd5d495ee02a740d36e02a1aa89a88& |
03:42:58 | FromDiscord | <niggerblaster9005> 1000002178.jpg https://media.discordapp.net/attachments/371759389889003532/1211881134884130887/1000002178.jpg?ex=65efcf42&is=65dd5a42&hm=e93c6f69797c92825780d2236705d000124baeb51820c2c72214a4292231c316& |
03:44:49 | * | def- quit (Quit: -) |
03:45:32 | * | rockcavera quit (Remote host closed the connection) |
03:45:41 | * | def- joined #nim |
03:48:49 | FromDiscord | <odexine> wow what a pleasant discussion |
03:49:07 | * | def- quit (Client Quit) |
03:52:41 | * | def- joined #nim |
04:03:00 | FromDiscord | <im__cynical> In reply to @niggerblaster9005 "1000039228.jpg": least closeted anti furry |
04:06:08 | * | def- quit (Quit: -) |
04:08:02 | * | def- joined #nim |
04:11:03 | * | def- quit (Client Quit) |
04:11:30 | termer | cool posting |
04:16:36 | FromDiscord | <huantian> In reply to @im__cynical "least closeted anti furry": does that mean that they proclaim to be an anti furry, but are actually barely closeted? |
04:16:56 | FromDiscord | <girvo> least most closeted anti-anti-furry |
04:17:04 | FromDiscord | <huantian> that makes more sense |
04:17:10 | FromDiscord | <girvo> π |
04:17:46 | FromDiscord | <Elegantbeef> Whatever the case I'd have assumed the overlap of racists and furries would've been an empty set |
04:22:14 | FromDiscord | <odexine> unfortunately theres a small bit |
04:28:14 | * | azimut quit (Ping timeout: 255 seconds) |
04:31:46 | FromDiscord | <girvo> In reply to @odexine "unfortunately theres a small": For real, I've never understood it but theres genuinely a weird racist/fascist subset of furries. bonkers to me |
04:31:58 | FromDiscord | <girvo> tiny, ofc. but the fact it exists at all is wild |
04:33:26 | FromDiscord | <odexine> its the same with any kind of society id say, like a strange combination like those racist to their own race or w/e |
04:38:13 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=DkYRYTczsAAy |
04:38:28 | FromDiscord | <im__cynical> I allocate 8 to the buffer, and I write 8 bytesβ΅I dont see how this can result in an overflow |
04:38:45 | FromDiscord | <Elegantbeef> `sizeof(lpwStream)` is 8 |
04:39:28 | FromDiscord | <im__cynical> In reply to @Elegantbeef "`sizeof(lpwStream)` is 8": Yes, it is |
04:39:39 | FromDiscord | <Elegantbeef> You want `len` but really `":wtfbbq".len` |
04:40:18 | FromDiscord | <Elegantbeef> Windows really is atrocious to interact with though |
04:40:45 | FromDiscord | <im__cynical> π ik |
04:40:55 | FromDiscord | <im__cynical> there are so so so many different types |
04:41:06 | FromDiscord | <Elegantbeef> Well they use utf16 |
04:41:11 | FromDiscord | <Elegantbeef> So they're really out in the boonies of stupidity |
04:41:26 | FromDiscord | <im__cynical> ulonglong is a type |
04:41:59 | FromDiscord | <im__cynical> anyways, I can't use len() or .len on a wide cstring |
04:42:03 | FromDiscord | <Elegantbeef> But yea you want sizeof(uint16) \ myStr.len |
04:42:07 | FromDiscord | <Elegantbeef> You can use it |
04:42:18 | FromDiscord | <Elegantbeef> It's defined in the `std/widestrs` module |
04:43:45 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=NqwMVwwuGRac |
04:43:55 | FromDiscord | <im__cynical> sent a long message, see https://pasty.ee/OMOuTLlzEWTp |
04:44:00 | FromDiscord | <im__cynical> (edit) "https://pasty.ee/sElTBTqSDbOw" => "https://pasty.ee/lHIGZWPRoHjj" |
04:44:14 | FromDiscord | <Elegantbeef> Right use std/widestr's constructor |
04:47:58 | * | def- joined #nim |
04:48:02 | * | azimut joined #nim |
04:48:19 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=vuxyjaitDYVU |
04:49:14 | FromDiscord | <Elegantbeef> The size of lpFileInformation, in bytes. |
04:49:21 | FromDiscord | <Elegantbeef> The last parameter of that procedure |
04:50:51 | FromDiscord | <im__cynical> If you're referring to cast[DWORD](sizeof(fRename) + len(lpwStream)), the size of that is 31 |
04:51:03 | FromDiscord | <im__cynical> (edit) "size" => "value" |
04:53:47 | FromDiscord | <im__cynical> In reply to @Elegantbeef "The size of lpFileInformation,": the size of fRename is 24 |
04:54:04 | FromDiscord | <Elegantbeef> The length of the string does not change the side of the struct does it? |
04:54:26 | FromDiscord | <Elegantbeef> You're copying to `fRename.FileName` but that's not allocated memory |
04:54:51 | FromDiscord | <Elegantbeef> `fRename` is statically allocated to a size you do not do any allocating |
04:55:43 | FromDiscord | <Elegantbeef> To do what you're doing you need to allocate `FILE_RENAME_INFO` yourself |
04:56:09 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=SyfPapNuCrYN |
04:56:11 | FromDiscord | <Elegantbeef> ` WCHAR FileName[1];` is the definition of `FileName` which means you have no space to copy to when this is stack allocated |
04:56:15 | * | Guest21 joined #nim |
04:56:56 | * | Guest21 quit (Client Quit) |
04:57:02 | FromDiscord | <Elegantbeef> No `let resizeInfo = cast[ptr FileNameInfo](alloc(sizeof(FileNameInfo) + myWideStr.len))` |
04:57:43 | FromDiscord | <Elegantbeef> IIRC MSVC does not support `WChar FileName[]` so it uses `1` which means it allows you to stack allocate |
05:08:49 | FromDiscord | <im__cynical> Well, now it doesn't overflow |
05:08:55 | FromDiscord | <im__cynical> but it still doesn't function as expected |
05:09:18 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=aTqPlgllDkyc |
05:09:54 | FromDiscord | <Elegantbeef> you're still passing the wrong data |
05:10:15 | FromDiscord | <Elegantbeef> `DWord(sizeof(resizeInfo) + myWideStr.len sizeof(uint16))` |
05:10:38 | FromDiscord | <Elegantbeef> `sizeof(FileRenameInfo)` not resizeInfo |
05:13:28 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=IpEYsuzRsTzc |
05:13:50 | FromDiscord | <Elegantbeef> Whoops same thing on line 4 |
05:14:02 | FromDiscord | <Elegantbeef> `lpwStream.len` is in uint16s |
05:14:05 | FromDiscord | <Elegantbeef> So multiply there aswell |
05:15:20 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=dJjDvppeUIam |
05:16:19 | FromDiscord | <Elegantbeef> Lol I misread it |
05:16:27 | FromDiscord | <Elegantbeef> That's setfileinformation |
05:16:40 | FromDiscord | <girvo> In reply to @Elegantbeef "Windows really is atrocious": As someone whos spent the last few days trying to understand COM, WMI, Win32 in general and more: that is a complete and utter understatement! |
05:16:41 | FromDiscord | <Elegantbeef> Can utf16 die in a hole though... thanks |
05:16:54 | FromDiscord | <girvo> In reply to @Elegantbeef "Can utf16 die in": Dying in a hole isn't violent enough for UTF-16 |
05:18:02 | FromDiscord | <Elegantbeef> Ah luckily it's the same thing but that is supposed to be `cast[ptr FileRenameInfo]` at line 4 |
05:18:09 | FromDiscord | <Elegantbeef> Lol girvo it is just the worst |
05:19:08 | FromDiscord | <Elegantbeef> If that doesn't work I suggest purging windows and installing linux, mac, a BSD or anything \nix based |
05:19:11 | FromDiscord | <im__cynical> In reply to @Elegantbeef "Ah luckily it's the": Changing this did nothing, same output as before |
05:19:16 | FromDiscord | <im__cynical> In reply to @Elegantbeef "If that doesn't work": π |
05:19:48 | FromDiscord | <girvo> Btw, I wonder if nim-sys will eventually tackle `std/locks` at all, or is that too low level/needs too much magic? init/deinitLock makes me sad, but then I guess they're kind of global anyway so destructors kind of don't make that much semantic sense for them? |
05:19:57 | FromDiscord | <Elegantbeef> It won't change anything but you should deallocate the widestring after the copymem π |
05:20:11 | FromDiscord | <Elegantbeef> Well the init is silly |
05:20:18 | FromDiscord | <Elegantbeef> It should be `var myLock = Lock.init()` |
05:20:29 | FromDiscord | <girvo> that I absolutely agree with |
05:20:33 | FromDiscord | <Elegantbeef> The deinit should be handled by a destructor anywho |
05:20:39 | FromDiscord | <girvo> (and then `RwLock.init()` and so on) |
05:20:43 | FromDiscord | <Elegantbeef> Globals still have destructors |
05:20:49 | FromDiscord | <girvo> Cool π |
05:21:31 | FromDiscord | <Elegantbeef> Next you'll talk about streams needing to have `close` and I'll joyfully exclaim "Traitor's streams exist!" π |
05:21:38 | FromDiscord | <girvo> I might have a crack at it, as I've been implementing Lock-style interfaces for the FreeRTOS mutex primitives |
05:21:48 | FromDiscord | <girvo> In reply to @Elegantbeef "Next you'll talk about": oh god what have I done hahaha |
05:22:00 | FromDiscord | <Elegantbeef> Luckily you can always just do `type Lock = distinct locks.Lock` and implement your operations |
05:22:14 | FromDiscord | <girvo> In reply to @Elegantbeef "Luckily you can always": Yep pretty much exactly what I've done |
05:22:34 | FromDiscord | <Elegantbeef> Hey I need to shill Traitor until someone tries it and makes an issue |
05:23:27 | FromDiscord | <Elegantbeef> I'm at least dog fooding it with my shitty toy language to generate wasm byte code |
05:24:10 | FromDiscord | <girvo> I've not actually tried traitor yet. I keep thinking it'd be worth doing to have "easier" stubbing of dependencies for various modules, or something. But then I feel like I'm implementing dependency injection, and I feel gross and stop |
05:24:27 | FromDiscord | <girvo> Traitor isn't quite what I want though (as its runtime) |
05:24:35 | FromDiscord | <Elegantbeef> It's not though |
05:24:40 | FromDiscord | <Elegantbeef> It supports runtime and static dispatch |
05:24:43 | FromDiscord | <girvo> Its not? I thought it was for runtime dispatch |
05:24:44 | FromDiscord | <girvo> ooooh |
05:24:54 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor/blob/master/tests/tstreams.nim |
05:25:08 | FromDiscord | <sirolaf> In reply to @Elegantbeef "It's defined in the": The brave may also use winim/winstr https://khchen.github.io/winim/winstr.html |
05:25:11 | FromDiscord | <Elegantbeef> You use `StaticTraitor[Trait]` for static |
05:25:22 | FromDiscord | <girvo> Okay I'm definitely going to have a play with it then |
05:26:01 | FromDiscord | <Elegantbeef> You still need `implTrait MyTrait` cause I cheat and just do `StaticTrait[T] = concept type st; st.toTrait(T)` π |
05:26:10 | FromDiscord | <girvo> Being able to override, say, the Nesper parts and run them with stubs in our tests would be so nice |
05:26:20 | FromDiscord | <girvo> In reply to @Elegantbeef "You still need `implTrait": hah, thats not that big a deal though |
05:26:48 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor/blob/master/traitor/streams.nim#L103-L151 is pretty succinct |
05:27:11 | FromDiscord | <girvo> I was just reading through that |
05:27:12 | FromDiscord | <Elegantbeef> You of course should use `AnyTraitor[T]` if you want to work with runtime and static dispatch |
05:27:26 | FromDiscord | <girvo> tbh for our purposes _only_ static dispatch is best |
05:27:43 | FromDiscord | <girvo> paying runtime pointer chasing costs on embedded is ick |
05:27:51 | FromDiscord | <Elegantbeef> Right, I was just mentioning it before you make your own `AnyTraitor` π |
05:27:56 | FromDiscord | <girvo> No worries π |
05:28:01 | FromDiscord | <Elegantbeef> Yea I still need to figure out how to optimise it further |
05:28:26 | FromDiscord | <Elegantbeef> I ditched the idea of a single vtable per type as it's actually slower due to cache thrashing |
05:28:41 | FromDiscord | <Elegantbeef> Atleast when you are operating on many types |
05:29:22 | FromDiscord | <girvo> ah interesting, but I guess that makes sense |
05:29:46 | FromDiscord | <girvo> if it's static, whats the runtime overhead, if any? |
05:30:00 | FromDiscord | <Elegantbeef> So you save memory for each instance but lose some amount of dispatch speed |
05:30:01 | FromDiscord | <Elegantbeef> On a single type it's practically the same speed |
05:30:22 | FromDiscord | <girvo> Sweet |
05:30:24 | FromDiscord | <Elegantbeef> It's the same as a generic proc |
05:30:31 | FromDiscord | <girvo> Yeah perfect, that was my assumption |
05:30:54 | FromDiscord | <Elegantbeef> In the static case it's just constrained by that aforementioned concept |
05:31:32 | FromDiscord | <Elegantbeef> One thing I will note is you likely should have a `proc ensureCompiles() {.used, gensym.} = myRealProc(Traitor[Trait](), ...)` for any procs |
05:31:34 | FromDiscord | <girvo> Yeah perfect. its pretty much what I'd started doing with concepts and a static param to the procs lol |
05:31:37 | FromDiscord | <girvo> Just, yknow, nicer |
05:31:56 | FromDiscord | <Elegantbeef> This gives you a compile time error without having to instantiate the proc later on |
05:32:01 | FromDiscord | <girvo> Ahhhh nice! |
05:33:03 | FromDiscord | <Elegantbeef> It'll of course get DCE'd but it forces Nim to actually generate an instance of the proc and should ensure it compiles without any other implementions as Nim does unchecked generics even with concepts |
05:33:06 | FromDiscord | <girvo> I really do think "interface-like" stuff/stubbing is a missing piece in the testing workflow for Nim for real applications, at least with the embedded land constraints of "we can't just make 10000 tiny procs and hope they get optimised away" -- though I guess one can always `{.inline.}` them all lol |
05:33:45 | FromDiscord | <girvo> In reply to @Elegantbeef "It'll of course get": Okay thats nice. I think that idea is something I was missing when I was trying to build something similar myself |
05:34:24 | FromDiscord | <Elegantbeef> Yea that `Traitor[T]` being there and passing `StaticTraitor[T]` is a joyful accident |
05:35:12 | FromDiscord | <Elegantbeef> Similar to that is the `joinTraits` macro not needing `converter` cause the new type works in `AnyTraitor[Child]` https://github.com/beef331/traitor/blob/master/tests/tjointhem.nim |
05:35:40 | FromDiscord | <Elegantbeef> I thought it was going to require converters and shit to get that code to work and be able to call `print` but nope... you can just use the code directly without any issue π |
05:35:54 | FromDiscord | <girvo> haha happy accidents indeed |
05:36:24 | FromDiscord | <Elegantbeef> This does of course fall if you have overloads and the technique I do there with `_: typedesc[T or void]` is fantastic to allow you to call the specific implementation you want |
05:36:33 | FromDiscord | <Elegantbeef> Stopping the diamond problem in it's tracks |
05:37:56 | FromDiscord | <girvo> Yeah its a neat approach I think, and reads quite nicely |
05:38:30 | FromDiscord | <Elegantbeef> To ramble about the implementation a bit further, having an existential type really is the trick, other attempts I took resulted in having to convert from the "Trait"s to a number stored inside of a static parameter of an instance |
05:38:43 | FromDiscord | <girvo> beats the massively overloaded someFunc<Now, We, Pass, Lots, Of, Generics> when doing stuff like this back in Typescript/Flow land (back in the day anyway) -- and even then you'd get type erasure still if you weren't careful |
05:39:05 | FromDiscord | <girvo> In reply to @Elegantbeef "To ramble about the": Hah that has as name: "brands" I believe its called |
05:39:13 | FromDiscord | <Elegantbeef> But doing `type Atom = distinct void` and using that `Atom` in place of 'Self' really makes life so much better since everything is proper types |
05:39:58 | FromDiscord | <girvo> https://www.cl.cam.ac.uk/~jdy22/papers/lightweight-higher-kinded-polymorphism.pdf |
05:40:09 | FromDiscord | <Elegantbeef> It does kinda suck there is no way of doing `MyType[C]` where `C` is a `concept` |
05:40:25 | FromDiscord | <girvo> Basically having a tag or otherwise specific existential "thing" that you use as the identifier/pivot point |
05:40:33 | FromDiscord | <girvo> In reply to @Elegantbeef "It does kinda suck": Yeah π¦ |
05:40:34 | FromDiscord | <Elegantbeef> My uneducated brain will process that like my stomach does corn |
05:40:49 | FromDiscord | <girvo> In reply to @Elegantbeef "My uneducated brain will": I promise its less complex than it seems haha |
05:41:08 | * | nmz left #nim (Ploop) |
05:42:57 | FromDiscord | <Elegantbeef> Given I don't know haskell or ocaml are you sure about that? |
05:43:18 | FromDiscord | <girvo> https://github.com/gcanti/fp-ts (and previous to that, https://github.com/gcanti/flow-static-land) are built off that paper haha |
05:43:40 | FromDiscord | <girvo> In reply to @Elegantbeef "Given I don't know": Ocaml is easy π haskell less so |
05:44:40 | FromDiscord | <girvo> sent a long message, see https://pasty.ee/sjGHMlpmrAwC |
05:46:17 | FromDiscord | <girvo> I should honestly take a crack at implementing it in Nim some time, based on the paper. Lets you get proper higher kinded types even in type systems that aren't that powerful -- and Nims is decently powerful, so it should work quite welsl |
05:46:19 | FromDiscord | <girvo> well |
05:47:20 | FromDiscord | <Elegantbeef> Well if you need any meta-programming secrets tuples are the most magical Nim type |
05:47:33 | FromDiscord | <girvo> Structural typing? No wonder π |
05:47:43 | FromDiscord | <ipumpbuh4> Fuck niggers? |
05:47:54 | FromDiscord | <Elegantbeef> Phil (he/him) it's back |
05:48:11 | FromDiscord | <ipumpbuh4> 1000039246.jpg https://media.discordapp.net/attachments/371759389889003532/1211912644328685568/1000039246.jpg?ex=65efec9a&is=65dd779a&hm=cab83f9dd1683d595cdef553a1f78fa56552b4c653e19daf4c97917366553438& |
05:48:13 | FromDiscord | <ipumpbuh4> Problem? |
05:48:30 | FromDiscord | <ipumpbuh4> I made a nim library called fuckNiggers |
05:48:39 | FromDiscord | <Elegantbeef> @girvo Moreso that they're incapable of being variants, they're capable of being anonymous and you can iterate them |
05:49:06 | FromDiscord | <ipumpbuh4> Does anyone1here want to try my fuckNiggers library |
05:49:09 | FromDiscord | <ipumpbuh4> @room |
05:51:04 | FromDiscord | <ipumpbuh4> If you want to beta test fuckNiggers that would be helpful |
05:51:13 | FromDiscord | <ipumpbuh4> I never use it outside my machine |
05:51:25 | FromDiscord | <girvo> In reply to @Elegantbeef "<@823468778704076810> Moreso that they're": They really do seem like magic haha. Nothing else works like that hey |
05:51:42 | FromDiscord | <ipumpbuh4> @girvo\: want to beta test fuckNiggers? |
05:51:57 | FromDiscord | <Elegantbeef> They're a nice control varadic generic equivlency |
05:52:49 | FromDiscord | <djazz> <@&371760044473319454> |
05:52:51 | FromDiscord | <Elegantbeef> controlled\ |
05:53:09 | FromDiscord | <Elegantbeef> I was hoping phil was still here, but he probably left |
05:53:14 | FromDiscord | <girvo> https://drawson.medium.com/higher-kinds-in-kotlin-cdb6904c2fdb you might find this more straightforward than the paper, but it uses the same idea |
05:53:23 | * | FromDiscord quit (Remote host closed the connection) |
05:53:41 | * | FromDiscord joined #nim |
05:54:06 | FromDiscord | <girvo> _waves at @djazz_ |
05:54:29 | FromDiscord | <djazz> Aah its gone nice |
05:54:59 | FromDiscord | <Elegantbeef> I'll never understand that behaviour, must require driving a railroad spike through your skull |
05:55:30 | FromDiscord | <girvo> I have to assume they're truly broken people hey |
05:56:10 | FromDiscord | <girvo> But yeah that paper was huge in the "typed functional programming in languages not really made for it" space haha |
05:56:49 | FromDiscord | <huantian> In reply to @girvo "https://drawson.medium.com/higher-kinds-in-kotlin-c": this looks cool but i have not the patience to comsume it rn i will save this mayhaps |
05:57:09 | FromDiscord | <Elegantbeef> No huan that wasn't for you spit it otu |
05:57:09 | FromDiscord | <Elegantbeef> out\ |
05:57:14 | FromDiscord | <girvo> hahaha |
05:57:55 | FromDiscord | <Elegantbeef> Aint this mostly describing `concept`? |
05:58:00 | FromDiscord | <girvo> Sort of π |
05:59:01 | FromDiscord | <Elegantbeef> Though anything like `a.map is Mappable[T]` is not really representable in concepts directly |
06:00:24 | FromDiscord | <girvo> Yeah it allows for higher kinded type expressions which I'm pretty sure concepts still struggle with |
06:01:12 | FromDiscord | <Elegantbeef> Yea concepts cannot be deeply recursive think technically they can only recurse 100 times |
06:02:03 | FromDiscord | <girvo> Tbf neither can brands, as most impls sort of limit it to.. I think 10 times? Because the developer has to write them all out lol. β΅β΅Oh actually I think its 5! times? So 120 times, because of how ap1 through ap5 work togehter |
06:03:03 | FromDiscord | <Elegantbeef> Wait a bloody minute https://nim-lang.org/docs/manual_experimental.html#concepts-concept-refinement |
06:03:41 | FromDiscord | <girvo> ooooooooh |
06:03:44 | FromDiscord | <girvo> ooooh |
06:03:45 | FromDiscord | <girvo> okay |
06:03:47 | FromDiscord | <girvo> thats useful |
06:04:04 | FromDiscord | <Elegantbeef> I somehow have never seen this before... |
06:04:40 | FromDiscord | <djazz> Yo dawg we put concepts in your concepts |
06:04:54 | FromDiscord | <girvo> If it works the way it says, that would genuinely allow for HKTs to just "work" for the most part |
06:05:10 | FromDiscord | <Elegantbeef> Fastest segfault ever |
06:05:11 | FromDiscord | <Elegantbeef> Time! |
06:05:13 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=NJOOieSSPhLD |
06:05:14 | FromDiscord | <girvo> hahaha |
06:05:34 | FromDiscord | <djazz> Lool |
06:05:47 | FromDiscord | <Elegantbeef> I do want to take a look at these now cause this solves row typing |
06:05:59 | FromDiscord | <girvo> Yeah this would be super useful |
06:06:01 | FromDiscord | <Elegantbeef> If this works rowtyping just fucking works |
06:06:10 | FromDiscord | <girvo> I wonder what the limitation is thats causing that segfault |
06:06:18 | FromDiscord | <morgan> so im very confused |
06:06:23 | FromDiscord | <morgan> i'm using sokol |
06:06:32 | FromDiscord | <morgan> and trying to debug a crash when setting up textures |
06:06:43 | FromDiscord | <morgan> but i've commented out most of it, and force building every time |
06:07:16 | FromDiscord | <morgan> and it seems like the line that changes whether it gives errors (that there's no texture bound) or not with its crash, has nothing to do with it |
06:08:09 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#pasty=eMsKXHxbXEAI |
06:08:28 | FromDiscord | <morgan> commenting out the imagedesc line has no effect |
06:09:12 | FromDiscord | <morgan> defining an array causes it to crash |
06:09:19 | FromDiscord | <morgan> and i am so confused |
06:10:14 | FromDiscord | <morgan> even without the textures set up in the shader |
06:10:53 | FromDiscord | <morgan> commenting that in causes it to crash, when it otherwise would run (and draw stuff wrong, that's a whole other problem, i want the textures to see what it's doing better) |
06:11:00 | FromDiscord | <Elegantbeef> What's the error? |
06:11:03 | FromDiscord | <morgan> nim doesn't complain |
06:11:39 | FromDiscord | <demotomohiro> In reply to @morganalyssa "i'm using sokol": If that large array is defined in proc, it might causes stack overflow. |
06:11:50 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#pasty=pUJWnpIfjwGG |
06:12:08 | FromDiscord | <morgan> oh hm ok i'll try defining it outside it |
06:12:58 | FromDiscord | <morgan> oh huh yeah that did it |
06:13:01 | FromDiscord | <morgan> wack |
06:19:26 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=vsHiMMvoSGny |
06:19:39 | FromDiscord | <Elegantbeef> Yep |
06:19:46 | FromDiscord | <Elegantbeef> but doing `v is Vector2` works |
06:19:52 | FromDiscord | <Elegantbeef> So there is some refinement still |
06:20:27 | FromDiscord | <Elegantbeef> But it falls apart at Vector4 |
06:21:45 | FromDiscord | <Elegantbeef> `concept of` also fails as a syntax |
06:22:28 | FromDiscord | <sirolaf> Adding generics produces infinite recursion and without it you got ambiguity it says |
06:22:39 | FromDiscord | <Elegantbeef> I noticed that |
06:23:04 | FromDiscord | <Elegantbeef> Ah I see how I think |
06:27:29 | * | azimut quit (Ping timeout: 255 seconds) |
06:37:59 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=AsGQlZkgAxbD |
06:38:12 | FromDiscord | <Elegantbeef> Yea except that doesn't work for row types |
06:38:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/mathtypes.nim I did this before π |
06:40:29 | FromDiscord | <sirolaf> All roads lead to rome I guess |
06:40:31 | FromDiscord | <sirolaf> So what is a row type |
06:40:54 | FromDiscord | <Elegantbeef> Row polymorphism is runtime and static polymorphism based off a type having specific fields |
06:41:20 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/rowed.nim#L257-L293 |
06:41:30 | FromDiscord | <sirolaf> Good luck getting that to work in new style concepts, which are also abandoned from what I can tell πΌ |
06:41:42 | FromDiscord | <Elegantbeef> Fuck new styled concepts |
06:41:51 | FromDiscord | <Elegantbeef> I have no need for them π |
06:42:15 | FromDiscord | <sirolaf> Are prs for old concepts still accepted you think? |
06:42:24 | FromDiscord | <Elegantbeef> Probably |
06:42:30 | FromDiscord | <Elegantbeef> I'd hope so since I use them so much |
06:44:41 | FromDiscord | <sirolaf> First step to making this work would probably be giving weight to concept conditions then |
06:44:51 | FromDiscord | <sirolaf> It looks like its just a binary matches: yes/no |
06:45:02 | FromDiscord | <Elegantbeef> It's not binary yes/no since there is refinement |
06:45:12 | FromDiscord | <sirolaf> The refinement is bad |
06:45:16 | FromDiscord | <Elegantbeef> If two concepts match refinement should work otherwise you need to step in |
06:45:29 | FromDiscord | <Elegantbeef> Sure refinement is bad, but concept conditions should not change match strength |
06:45:33 | FromDiscord | <Elegantbeef> More concepts is not more better |
06:45:40 | FromDiscord | <Elegantbeef> I mean more concept statements |
06:46:10 | FromDiscord | <Elegantbeef> Fixing refinement seems to just be making the tree relation work properly |
06:46:26 | FromDiscord | <Elegantbeef> Then in the case of ambiguity between two concepts that match you need a mechanism to specify "Match this type" |
06:46:43 | FromDiscord | <Elegantbeef> `v is Y` seems to sorta work |
06:47:59 | FromDiscord | <sirolaf> In this case it will always be ambiguous because Vector3 is a pure extension to Vector2 |
06:48:04 | FromDiscord | <sirolaf> Thus it needs a weight |
06:48:24 | FromDiscord | <Elegantbeef> Right the weight is the inverse of the depth of the tree |
06:48:40 | FromDiscord | <Elegantbeef> The 0th node is the weakest the highest is the furthers from node |
06:48:54 | FromDiscord | <Elegantbeef> I thought you meant you needed weight per statement count |
06:49:16 | FromDiscord | <sirolaf> No, hadn't thought so deeply about it yet because there seem to be ambiguity traps everywhere |
06:49:43 | FromDiscord | <Elegantbeef> Right `nkConv(Concept,...)` should resolve that |
06:50:04 | FromDiscord | <Elegantbeef> You should be able to explicitly convert to a concept to prefer it but presently for obvious reasons a conversion to a concept is removed in dispatch |
06:54:15 | FromDiscord | <sirolaf> Now how would that tree depth interact with multiple "inheritance" |
06:55:55 | FromDiscord | <sirolaf> Naively I would probably collect all the leaf concepts and do a breadth first match on them until it's at the most specific it can satisfy |
07:02:12 | * | advesperacit joined #nim |
07:16:47 | * | systemdsucks quit (Ping timeout: 268 seconds) |
07:17:01 | * | systemdsucks joined #nim |
07:39:18 | FromDiscord | <sirolaf> Gonna play around with it, can probably solve it somewhere around `cmpCandidates` |
08:01:15 | NimEventer | New thread by IanZhang: Recusion use a lot of memory, any idea why?, see https://forum.nim-lang.org/t/11094 |
08:22:41 | * | redj quit (Quit: No Ping reply in 180 seconds.) |
08:24:04 | * | redj joined #nim |
08:42:20 | * | Epsilon quit (*.net *.split) |
09:01:06 | FromDiscord | <whisperecean> Is there a docu somewhere so I can fix issues like this? 'updateHandler (Async)' is not GC-safe as it calls 'genQuote' |
09:03:25 | FromDiscord | <nnsee> is genQuote your own code? |
09:03:42 | FromDiscord | <nnsee> mark it with the {.gcsafe.} pragma and fix any issues the compiler complains about |
09:17:23 | FromDiscord | <kiloneie> Why are there `{nnkVarTy, nnkConstTy}` node kinds but not a `nnkLetTy` ? Why can i only pass a `var` to a macro but not let and const ? |
09:18:16 | FromDiscord | <Elegantbeef> Cause the default parameter type is `let` and `static` is const |
09:19:52 | FromDiscord | <whisperecean> In reply to @nnsee "is genQuote your own": nope. repo project |
09:20:08 | FromDiscord | <whisperecean> wiht nim 1.4 in the nimble |
09:24:33 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=jpmYTnoTtKWv |
09:24:55 | FromDiscord | <Elegantbeef> Right cause it doesn't work presently π |
09:25:05 | FromDiscord | <Elegantbeef> `type V of X` does nothing afaict |
09:25:25 | FromDiscord | <Elegantbeef> Which makes me think it's unimplemented, as does `concept of T` |
09:25:38 | FromDiscord | <sirolaf> I added a type relation for it to identify subconcepts during overload resolution, but yeah stumbled upon this issue along the way while testing |
09:26:39 | FromDiscord | <sirolaf> Was hoping to rely on concept evaluation or whatever this is to work |
09:26:55 | FromDiscord | <Elegantbeef> The `x is T` does work |
09:27:14 | FromDiscord | <Elegantbeef> So you can test doing `x is OtherThing` for refinement to implement |
09:28:51 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=wfLfzhNYFeFi |
09:29:05 | FromDiscord | <Elegantbeef> Add `Vector4` |
09:29:12 | FromDiscord | <sirolaf> What should it be |
09:29:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JsbICLyiLNlu |
09:30:00 | FromDiscord | <Elegantbeef> So wait refinement sorta actually works presently? π |
09:30:10 | FromDiscord | <Elegantbeef> But only sorta |
09:30:48 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=OGKeyEagrhPo |
09:31:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=VnYUklFEKBBX |
09:33:17 | FromDiscord | <sirolaf> Someone has to solve that issue, then this type relation would work |
09:33:17 | FromDiscord | <Elegantbeef> Oh the vector example works cause the refinement forces it to expand to `.w` only being the constraint |
09:33:43 | FromDiscord | <sirolaf> I think it should take the inherited constraints into account too |
09:33:55 | FromDiscord | <Elegantbeef> I can take a look at the refinement logic tomorrow if you want to work together on this π |
09:34:14 | FromDiscord | <sirolaf> Sure, on my side the basic refinements work, not sure about more complex ones |
09:34:34 | FromDiscord | <Elegantbeef> Well it might fail when we take into account the children, but we'll see |
09:34:49 | FromDiscord | <Elegantbeef> It's depth first matching presently though right? |
09:35:00 | FromDiscord | <Elegantbeef> Deepest type is the concept chosen |
09:36:40 | FromDiscord | <sirolaf> It does something even more naive, `typeRel` checks if the formal is a subconcept of the given one and if it is it gets penalized during `checkGeneric`. Sub concept here means the given value can be downgraded into it based on the inheritance relation |
09:37:13 | FromDiscord | <Elegantbeef> Nifty |
09:37:49 | FromDiscord | <Robyn [She/Her]> Hazbin Hotel reference /j |
09:43:48 | FromDiscord | <Elegantbeef> So olaf there is a `inherited` variable inside the semtypeclass and it gets built up but isn't used anywhere |
09:44:42 | FromDiscord | <sirolaf> It does kinda get used |
09:45:19 | FromDiscord | <Elegantbeef> Ah right I misread π |
09:45:19 | FromDiscord | <Elegantbeef> Nearly 3am brain |
09:45:28 | FromDiscord | <sirolaf> But it does not get added to the concept body or get checked anywhere |
09:45:38 | FromDiscord | <sirolaf> Just turned into the nodes I use for my type relation |
09:45:42 | FromDiscord | <Elegantbeef> It gets added to the type |
09:47:40 | FromDiscord | <sirolaf> Simplest fix would be throwing it into the body with `name is T`, but not sure how reliable that would be |
09:47:57 | FromDiscord | <Elegantbeef> I think we can do better |
09:50:45 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=TMlniUReCKAI |
09:50:59 | FromDiscord | <Elegantbeef> Right |
09:51:05 | FromDiscord | <Elegantbeef> But the type information is there |
09:53:02 | FromDiscord | <Elegantbeef> I think it makes more sense to just check each concept when you hit a concept with inheritance rather than expand the ast |
09:53:47 | FromDiscord | <sirolaf> I could expand the type relation to do that I guess |
09:54:01 | FromDiscord | <sirolaf> When one of the subconcepts doesn't match return isNone |
09:54:19 | FromDiscord | <Elegantbeef> Yep what I was trying for a test |
09:54:23 | FromDiscord | <sirolaf> Assuming I have access to that info |
09:55:11 | FromDiscord | <Elegantbeef> Should be like `for i in i..<concpt.len: conceptMatchLogic(a, concept[i])` |
09:55:19 | FromDiscord | <Elegantbeef> `0..` whoops π |
10:00:37 | FromDiscord | <sirolaf> `matchUserTypeClass` basically just turns the body into an expression as well |
10:01:03 | FromDiscord | <sirolaf> (edit) "an" => "a static true/false" |
10:02:00 | FromDiscord | <sirolaf> Good chance it'll work if you call it recursivel |
10:02:02 | FromDiscord | <sirolaf> (edit) "recursivel" => "recursively" |
10:09:07 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#pasty=AewCONbpzfnI |
10:10:06 | FromDiscord | <sirolaf> Combine those two and all examples sent so far work as expected |
10:10:25 | FromDiscord | <Elegantbeef> good job |
10:10:40 | FromDiscord | <Elegantbeef> I tried to make `type Bleh = concept of X` work but my brain is fried |
10:11:19 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=lRByigIUegMD the diff whilst I throw in the towel for now |
10:11:45 | FromDiscord | <sirolaf> How would you use that anyways |
10:13:05 | FromDiscord | <sirolaf> Maybe transforming it into this, but besides saving some keystrokes I don't see a purpose `Vector4 = concept type V of Vector3, WConcept` |
10:14:09 | FromDiscord | <Elegantbeef> I agree it was just in the docs |
10:14:16 | FromDiscord | <Elegantbeef> Was seeing if it could be piped |
10:14:32 | FromDiscord | <sirolaf> You're right, didn't see that one |
10:14:59 | FromDiscord | <sirolaf> I think you could fix that in the parser |
10:16:41 | FromDiscord | <sirolaf> The merged scope part of it doesn't actually work though from what I can tell |
10:21:47 | FromDiscord | <sirolaf> Oh yeah generics are also still broken, gotta look into those |
10:23:16 | FromDiscord | <Elegantbeef> My looking at generics seemed to cause issues with using the generic parameter more than once |
10:24:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gkXeqLudqgUz |
10:28:46 | FromDiscord | <sirolaf> Causes segfaults actually |
10:29:35 | FromDiscord | <sirolaf> At least when you convert it into inheritance syntax |
10:29:43 | FromDiscord | <Elegantbeef> Ah |
10:29:53 | FromDiscord | <sirolaf> In this syntax it doesn't know how to resolve because I rely on that syntax |
10:29:56 | FromDiscord | <Elegantbeef> Probably the same thing for some reason it recursively attempts to replace T |
10:30:24 | FromDiscord | <sirolaf> No it passes nil during matchUserTypeClass with my code |
10:31:14 | FromDiscord | <sirolaf> Order is probably wrong and it doesn't know what's going on with T |
10:32:45 | FromDiscord | <whisperecean> @nnsee any more pointers? is it just about the annotations? |
10:36:05 | FromDiscord | <A2> Anyone have experience with the nim websockets packages? I'm looking at `treeform/ws` and `status-im/nim-websock`. I'm curious if someone has experience with these, and can tell which is preferable |
10:47:34 | FromDiscord | <vindaar> I've used treeform's `ws` several times and it's worked well for my simple use cases |
10:48:43 | FromDiscord | <theundername> Hi , How to use nim lang in c++? |
11:02:00 | * | jmdaemon quit (Ping timeout: 260 seconds) |
11:34:53 | FromDiscord | <A2> cool, thanks! I'll give `ws` a shot |
11:37:08 | FromDiscord | <A2> You can compile a `.so` file with the nim compiler, write a `.h` header file for the functions that you want to expose, and include that just like if it was a regular C libraryβ΅(@theundername) |
11:37:57 | FromDiscord | <A2> oh and you need to use the `exportc` pragma |
11:38:19 | FromDiscord | <A2> (on the functions that you want to call from your c++ project) |
11:38:30 | FromDiscord | <A2> (on the procs that you want to call from your c++ project) |
12:12:29 | * | xet7 quit (Remote host closed the connection) |
12:24:29 | * | rockcavera joined #nim |
13:29:28 | * | rockcavera quit (Remote host closed the connection) |
13:32:07 | * | xet7 joined #nim |
14:17:39 | FromDiscord | <fosster> hi all, do you know if nim can compile down to wasm? |
14:49:11 | * | azimut joined #nim |
14:49:52 | * | Epsilon joined #nim |
14:51:36 | * | krux02 joined #nim |
15:17:49 | FromDiscord | <nnsee> it can |
15:24:53 | * | tc424 quit (Ping timeout: 240 seconds) |
15:25:17 | * | ntat joined #nim |
15:35:36 | FromDiscord | <Robyn [She/Her]> In reply to @fosster "hi all, do you": It can yep, clang can emit WASM, so can `nlvm` (Nim but with a backend target LLVM instead of C), you can use `emcc` as a C compiler too |
15:55:17 | * | tc424 joined #nim |
15:57:46 | * | Epsilon quit (Ping timeout: 260 seconds) |
16:00:52 | * | Epsilon joined #nim |
16:18:20 | FromDiscord | <miragearchitect> how do you create and use bitfields? |
16:28:33 | FromDiscord | <im__cynical> sent a code paste, see https://play.nim-lang.org/#pasty=VpaRShWvRjJX |
16:36:40 | FromDiscord | <demotomohiro> In reply to @miragearchitect "how do you create": https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma |
16:40:53 | * | rockcavera joined #nim |
16:42:13 | * | jmdaemon joined #nim |
16:42:40 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=uewSyoOXEsoO |
17:27:56 | * | jmdaemon quit (Ping timeout: 260 seconds) |
17:34:52 | * | adigitoleo quit (Ping timeout: 258 seconds) |
17:37:23 | * | adigitoleo joined #nim |
17:47:27 | * | jmdaemon joined #nim |
17:54:25 | * | jmdaemon quit (Ping timeout: 264 seconds) |
18:20:40 | * | junaid_ joined #nim |
18:23:34 | * | adigitoleo quit (Ping timeout: 258 seconds) |
18:24:52 | * | adigitoleo joined #nim |
18:35:03 | * | junaid_ quit (Remote host closed the connection) |
19:17:42 | * | junaid_ joined #nim |
19:22:30 | FromDiscord | <ambient3332> Was cligen still the go-to library for creating command line tools? |
19:22:52 | FromDiscord | <ambient3332> I remember seeing some interesting alternatives |
19:22:55 | Amun-Ra | hmm |
19:52:40 | FromDiscord | <fosster> it's weird that there so few resouces online about wasm on nimβ΅(@Robyn [She/Her]) |
19:53:15 | FromDiscord | <Robyn [She/Her]> In reply to @fosster "it's weird that there": It's a niche usecase, to be fair |
19:54:04 | FromDiscord | <Robyn [She/Her]> Amun-Ra, did you use emcc to compile Nim 2.0.0 code to WASM? |
19:55:46 | FromDiscord | <awesome3434> sent a code paste, see https://play.nim-lang.org/#pasty=rfKzBFilPukz |
20:07:42 | Amun-Ra | Robyn: yes, emcc |
20:15:15 | Amun-Ra | this is the part of my wasm nim.cfg (there's a room for optimization): https://play.nim-lang.org/#pasty=bScIvlZxlxtX |
20:17:17 | Amun-Ra | that requires per-project settings in config.nims |
20:18:19 | Amun-Ra | like this: https://play.nim-lang.org/#pasty=dUlVeeClmuhe |
20:19:10 | Amun-Ra | I may write a kind of howto if anyone's interested |
20:29:11 | * | ntat quit (Quit: Leaving) |
20:39:29 | FromDiscord | <djazz> sent a code paste, see https://play.nim-lang.org/#pasty=EFzvfrchvhLE |
20:39:37 | * | junaid_ quit (Remote host closed the connection) |
20:40:38 | FromDiscord | <djazz> when echoing t i get `object` and t.flags `{tfFinal}` |
20:41:41 | FromDiscord | <djazz> echo debugging continues |
20:43:20 | termer | classic Nim debugging |
20:44:26 | FromDiscord | <djazz> the PR introducing the bug is here as revealed by git blame <https://github.com/nim-lang/Nim/pull/15544> |
20:44:39 | FromDiscord | <djazz> a fix of another bug |
20:44:48 | FromDiscord | <djazz> but why is t.sym nil? hmmm |
20:54:23 | FromDiscord | <demotomohiro> In reply to @awesome3434 "Is there any way": https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma |
21:03:13 | FromDiscord | <Elegantbeef> @djazz genTypeInfov1... are you on refc? |
21:03:24 | FromDiscord | <djazz> no, arc |
21:03:34 | FromDiscord | <Elegantbeef> Weird |
21:04:08 | FromDiscord | <djazz> Hint: mm: arc |
21:04:49 | FromDiscord | <Elegantbeef> iirc TypeInfoV1 is for refc... |
21:04:59 | FromDiscord | <Elegantbeef> I guess I'm wrong |
21:07:06 | FromDiscord | <Elegantbeef> Djazz can you throw a `debug t` before that if? |
21:07:07 | FromDiscord | <awesome3434> In reply to @demotomohiro "https://nim-lang.org/docs/manual.html#implementatio": It's what I'm using now for my internal objects, though it doesn't seem to affect RootObj or closure objects in any way |
21:12:24 | FromDiscord | <Elegantbeef> I've gotta ask why do you want to change how those are generated? |
21:13:55 | FromDiscord | <djazz> sent a code paste, see https://play.nim-lang.org/#pasty=XmiGcfSuupgc |
21:14:13 | FromDiscord | <Elegantbeef> Yep works on AST and Types |
21:14:20 | FromDiscord | <awesome3434> In reply to @Elegantbeef "I've gotta ask why": The external library I'm working with requires to pass a custom attribute to any object associated with the scope and sadly I can't really ignore it |
21:14:21 | FromDiscord | <djazz> ah, macro magic |
21:15:20 | FromDiscord | <Elegantbeef> Not ideal but you could try using emit or codegendecl to create a type that wraps your type for this heinous interop π |
21:15:34 | FromDiscord | <Elegantbeef> Huh?β΅(@djazz) |
21:15:47 | FromDiscord | <djazz> compiler magic |
21:16:40 | FromDiscord | <Elegantbeef> There is no ast associated with that type... odd |
21:16:51 | FromDiscord | <awesome3434> In reply to @Elegantbeef "Not ideal but you": Yeahh, I was more like trying to do it in a friendly Nim way with macros which seems to be handy for most of the time |
21:16:58 | FromDiscord | <Elegantbeef> Well actually it's an empty object |
21:17:00 | FromDiscord | <djazz> distinct object.. |
21:17:04 | FromDiscord | <djazz> not a lot! |
21:17:10 | FromDiscord | <Elegantbeef> Do you have an empty object somewhere in your AST? |
21:17:37 | FromDiscord | <djazz> futhark generates them |
21:17:41 | FromDiscord | <Elegantbeef> Make a macro that consumes a typesection I guessβ΅(@awesome3434) |
21:17:45 | FromDiscord | <Elegantbeef> Ah |
21:17:58 | FromDiscord | <djazz> `type Altcpfunctions = distinct object` |
21:18:06 | FromDiscord | <djazz> I believe its this one causing the issue |
21:18:19 | FromDiscord | <djazz> its a field type on AltcpPcb |
21:18:27 | FromDiscord | <Elegantbeef> So seems it's a `tyPtr` of `tyObject` that lacks a symbol |
21:18:28 | FromDiscord | <djazz> `fns: ptr Altcpfunctions` |
21:18:35 | FromDiscord | <djazz> yeah |
21:18:39 | FromDiscord | <Elegantbeef> Right that's wrong |
21:18:45 | FromDiscord | <Elegantbeef> `distinct object` is a generic constraint |
21:18:47 | FromDiscord | <djazz> i had issue with ptr to distinct object before crashing the compiler |
21:18:59 | FromDiscord | <Elegantbeef> That should just be `object` |
21:19:01 | FromDiscord | <djazz> unable to get the size etc |
21:19:36 | FromDiscord | <djazz> "If a type is not fully declared in your C headers but is still required for your project Futhark will generate a `type SomeType = distinct object` dummy type for it." |
21:19:40 | FromDiscord | <Elegantbeef> `distinct object` is for `proc doStuff(a, b: distinct object)` it allows you to use a typeclass in multiple places but bind to multiple times |
21:19:56 | FromDiscord | <Elegantbeef> That should just be `object` |
21:20:00 | FromDiscord | <Elegantbeef> Objects are already distinct |
21:20:04 | FromDiscord | <djazz> yeah |
21:20:50 | FromDiscord | <Elegantbeef> Fixing futhark should resolve that issue, but then there is the compiler issue that `distinct object` should be considered a generic type and error in usage anywhere that's not a parameter |
21:22:17 | FromDiscord | <djazz> changing distinct object to object for that type makes code compile and work! |
21:22:24 | FromDiscord | <djazz> @pmunch |
21:22:41 | FromDiscord | <Elegantbeef> Cmon djazz make an issue or PR π |
21:22:49 | FromDiscord | <djazz> so ptr to distinct object should be invalid? |
21:23:01 | FromDiscord | <Elegantbeef> `ptr distinct object` makes no sense |
21:23:05 | FromDiscord | <djazz> indeed |
21:23:25 | FromDiscord | <Elegantbeef> `type MyType = distinct object` is an alias not a new type |
21:23:25 | FromDiscord | <djazz> I can make PR to futhark but no idea how to fix it in nim compiler |
21:23:41 | FromDiscord | <djazz> make it error |
21:23:44 | FromDiscord | <djazz> and not crash |
21:24:04 | FromDiscord | <Elegantbeef> Right just make a min repro and an issue I might have a look later |
21:25:16 | FromDiscord | <Elegantbeef> Weird `distinct object` seems to not be an alias |
21:25:20 | FromDiscord | <Elegantbeef> Wild |
21:25:37 | FromDiscord | <djazz> thing is, distinct object is valid and does only crash under very specific circumstances |
21:25:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=aeazIEzCCzuV |
21:25:47 | FromDiscord | <djazz> as i only hit it while doing crazy stuff |
21:26:05 | FromDiscord | <Elegantbeef> Right but it should be disallowed as an instantiated type |
21:27:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=cbzSmOkdbWwj |
21:27:17 | FromDiscord | <djazz> I see |
21:27:27 | FromDiscord | <djazz> so in generics, not as a type |
21:27:38 | FromDiscord | <djazz> well, actual type |
21:27:44 | FromDiscord | <Elegantbeef> `distinct typeclass` is a generic parameter that allows you to provide multiple values for a single type since typeclasses are bound to their first usage |
21:28:04 | FromDiscord | <Elegantbeef> like `proc(v: SomeNumber): SomeNumber = assert v is typeof(result)` |
21:28:39 | FromDiscord | <Elegantbeef> All typeclasses are bound to their first usage in an instantiation as syntax sugar |
21:28:57 | FromDiscord | <Elegantbeef> So yea it should be disallowed anywhere that `object` is not allowed |
21:29:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=GrGaSInMRzDd |
21:30:15 | FromDiscord | <Elegantbeef> I assume what happens is that the `distinct` typesection does not know how to handle typeclasses so just emits a `distinct T` |
21:31:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ATmMDjcMMowk |
21:31:17 | * | jmdaemon joined #nim |
21:32:19 | FromDiscord | <djazz> distinct object is special, it lacks fields and symbols apparently |
21:35:11 | FromDiscord | <djazz> so in futhark should it be {.incompleteStruct.} = object instead? |
21:35:54 | FromDiscord | <Elegantbeef> It should be `object` no? |
21:36:18 | FromDiscord | <djazz> nim cant know the size but C can |
21:36:21 | FromDiscord | <djazz> idk |
21:36:34 | FromDiscord | <Elegantbeef> I don't see why it wouldn't just be `object` |
21:36:39 | FromDiscord | <Elegantbeef> 0 sized objects are a mistake π |
21:36:51 | FromDiscord | <djazz> "The incompleteStruct pragma tells the compiler to not use the underlying C struct in a sizeof expression" |
21:37:15 | FromDiscord | <Elegantbeef> In what place is that needed with futhark? |
21:38:13 | FromDiscord | <Elegantbeef> An empty struct is 1 byte in Nim but 0 in C so I guess that's an issue |
21:39:49 | FromDiscord | <awesome3434> sent a code paste, see https://play.nim-lang.org/#pasty=NiZMPDICsUpb |
21:40:10 | FromDiscord | <djazz> in C header its just `struct altcp_functions;` and then the actual fields are in the C file |
21:40:16 | FromDiscord | <Elegantbeef> You're not going to be able to change how Nim generates closures |
21:40:46 | FromDiscord | <awesome3434> In reply to @Elegantbeef "You're not going to": Uhh, doesn't sound good |
21:41:14 | FromDiscord | <Elegantbeef> Well then make your own closure generator π |
21:41:36 | FromDiscord | <Elegantbeef> Then yea if there are no fields for the struct I guess incomplete struct makes senseβ΅(@djazz) |
21:44:42 | FromDiscord | <leorize> you can also just `= ptr object` it \:p |
21:44:42 | FromDiscord | <leorize> though that probably doesn't do what I think it would |
21:48:43 | FromDiscord | <djazz> I love it when nimble uses an old version of package from pkgs instead of pkg2 because it wants to.. |
21:49:00 | FromDiscord | <djazz> I was like wtf why is it still generating with distinct... |
21:49:51 | FromDiscord | <djazz> nimble uninstall futhark doesnt remove it |
21:49:59 | FromDiscord | <djazz> because its not in pkgs2 |
21:50:01 | FromDiscord | <Elegantbeef> That does make a new object which is a ptr type |
21:50:02 | FromDiscord | <Elegantbeef> So it's closer than distinct π |
21:50:03 | FromDiscord | <Elegantbeef> Unless that's to awesome |
21:50:03 | FromDiscord | <leorize> you don't get instantiation prevention, basically |
21:50:03 | FromDiscord | <leorize> not that it matters that much, I suppose |
21:50:57 | FromDiscord | <djazz> sent a code paste, see https://play.nim-lang.org/#pasty=qBpxfXDwBrkT |
21:51:13 | FromDiscord | <djazz> anonymous object |
21:51:58 | FromDiscord | <Elegantbeef> Just delete `pkgs` π |
21:51:58 | FromDiscord | <Elegantbeef> Or use atlas |
21:52:00 | FromDiscord | <leorize> it's not nimble fault really |
21:52:02 | FromDiscord | <leorize> it's actually the compiler's |
21:52:03 | FromDiscord | <leorize> nimble is not aware of pkgs anymore |
21:52:10 | FromDiscord | <leorize> in fact the only job nimble does is to download the deps, the compiler actually picks what to use, and it's shit at that |
21:52:13 | FromDiscord | <djazz> im too stupid for atlas |
21:52:16 | FromDiscord | <leorize> that can work with some macro magic |
21:52:29 | FromDiscord | <djazz> well, nimble works well _enough_ |
21:53:09 | FromDiscord | <djazz> ah, you're right |
21:53:37 | FromDiscord | <djazz> piconim is calling nim intewrnally not nimble because checking deps 20 times when compiling took time |
21:53:55 | FromDiscord | <Elegantbeef> I've imagined that syntax djazz and I hate it |
21:54:15 | FromDiscord | <Elegantbeef> `proc doThing(val: typeof(MyType().a))` is awful |
21:54:50 | FromDiscord | <djazz> when you dont need the type. for whatever. |
21:55:16 | FromDiscord | <djazz> deleted old nimbledata.json, now it works |
21:56:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=LCriTyQxbyWW |
21:56:54 | FromDiscord | <Elegantbeef> There you go djazz terrible ness |
21:57:18 | FromDiscord | <djazz> omg |
21:58:31 | FromDiscord | <Elegantbeef> You of course cannot do `MyType(a: (300))` cause it's a distinct tuple |
22:00:06 | FromDiscord | <djazz> _"There's ~~an app~~ a macro for that!"_ What chatting with you feels like |
22:00:11 | FromDiscord | <djazz> π |
22:00:26 | FromDiscord | <Elegantbeef> We can go further |
22:00:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zvoPVWNxLKfF |
22:00:44 | FromDiscord | <djazz> plss no, help me find a smaller example why the compiler crash insatead |
22:00:49 | FromDiscord | <djazz> aaaa |
22:01:00 | FromDiscord | <djazz> stoooppp |
22:01:12 | FromDiscord | <djazz> what have I done |
22:01:16 | FromDiscord | <leorize> compile with nin\_dbg and you should get an useful stacktrace |
22:01:24 | FromDiscord | <leorize> nim\_dbg, even |
22:01:33 | FromDiscord | <Elegantbeef> Let me buy the domain `arewezigyet.com` |
22:01:42 | FromDiscord | <user2m> Does anyone know how to bundle a python script into the nim executable? I'm using a python script with one of my NIM projects, and interoperating between the two with nimpy but I have to bring the python module into the same folder as the executable. I was wondering if there's a way to compile down to just the executable and how to lug around the python modules? |
22:01:46 | FromDiscord | <awesome3434> In reply to @Elegantbeef "Well then make your": And uh, is there any way to get the closure variables handled by the Nim compiler without having to deal with Nim closures? Accessing rawProc, rawEnv seems to spew the closure structure into C++ code nonetheless, if I'm not wrong |
22:01:56 | FromDiscord | <Elegantbeef> What's a NIM project? |
22:02:02 | FromDiscord | <user2m> nim |
22:02:26 | FromDiscord | <Elegantbeef> Nim closures expose none of the data of the environment to users |
22:02:38 | FromDiscord | <user2m> (edit) "how" => "not have" |
22:02:39 | FromDiscord | <Elegantbeef> So you need to make your own generator like the C++ lambda |
22:02:42 | FromDiscord | <awesome3434> Duhh |
22:03:04 | FromDiscord | <djazz> when using just rawProc/rawEnv and you not storing the actual closure proc anywhere makes it go out of scope and fail |
22:03:09 | FromDiscord | <djazz> I trie dit earlier today |
22:03:29 | FromDiscord | <djazz> so i just put the callback closure proc as it inside a ref object |
22:04:03 | FromDiscord | <djazz> just in case you run in to that |
22:04:19 | FromDiscord | <djazz> working with C is a joy |
22:04:36 | FromDiscord | <djazz> when it's wrapped in Nim |
22:04:47 | FromDiscord | <awesome3434> In reply to @djazz "when using just rawProc/rawEnv": Alright, thanks for letting know about that |
22:05:02 | FromDiscord | <Elegantbeef> Yea I mean they expose the pointers to them but they're type erased sadly |
22:05:02 | FromDiscord | <awesome3434> I'll try to do something with it then |
22:06:31 | FromDiscord | <djazz> https://gist.github.com/daniel-j/3689d53d9c04dd5f5ac404be8c6d3d53 |
22:07:00 | FromDiscord | <djazz> I tried to do a small example similar to my crashing code but i could just not get the nim compiler to crash like that |
22:07:11 | FromDiscord | <djazz> this code is clean from distinct objects tho |
22:07:29 | FromDiscord | <Elegantbeef> Probably best to do something like `createClosure(bycopy a, byRef b): ##code here` and generate a `tuple[env: (typeof(a), when b is ref: typeof(b) else: ptr typeof(b)), prc: proc(a: typeof(a), b: ....)....]` |
22:08:19 | FromDiscord | <Elegantbeef> Guess that should be `var typeof(a)` inside of the proc |
22:08:40 | FromDiscord | <djazz> the interesting things happen between lines L56-L66 |
22:08:53 | FromDiscord | <djazz> @awesome3434 |
22:09:32 | FromDiscord | <djazz> should be GC safe and leak free but i havent verified |
22:10:21 | * | arkanoid quit (Ping timeout: 256 seconds) |
22:16:34 | FromDiscord | <djazz> I'm just waiting for ElegantBeef to eat up my inelegant code |
22:16:37 | FromDiscord | <djazz> π |
22:16:45 | FromDiscord | <djazz> PR to Futhark submitted. |
22:16:48 | FromDiscord | <Elegantbeef> Wait you want me to insult it?! |
22:17:01 | FromDiscord | <djazz> Constructively |
22:17:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wENzMQmTNDxP |
22:17:09 | FromDiscord | <Elegantbeef> Why `else` |
22:17:23 | FromDiscord | <djazz> I would use case but case isnt static |
22:17:32 | FromDiscord | <djazz> i know else isnt needed |
22:17:35 | FromDiscord | <Elegantbeef> when does not have to be exhaustive, and in the case you get a third type that should be `{.error: "Unimplemented: " & $T.}` |
22:17:50 | FromDiscord | <djazz> good idea |
22:18:35 | FromDiscord | <Elegantbeef> Should `CbState` just be a `ref object`? |
22:18:43 | FromDiscord | <Elegantbeef> You only use it as such afaict |
22:19:05 | FromDiscord | <djazz> ref object dont support GC_ref/unref |
22:19:12 | FromDiscord | <Elegantbeef> They do |
22:19:15 | FromDiscord | <djazz> hm |
22:19:25 | FromDiscord | <Elegantbeef> `new CbState` makes a `ref object` |
22:19:32 | FromDiscord | <Elegantbeef> all `ref` types support `GcRef` and `GcUnref` |
22:20:03 | FromDiscord | <Elegantbeef> Also at line 63 you could do `let state = (ref CbState)(cb: cb)` regardless |
22:20:40 | FromDiscord | <djazz> the error pragma didnt work, it is unexpected in that location |
22:20:57 | FromDiscord | <Elegantbeef> ref objects don't support destructors so you'd need to do `proc =destroy(cbState: typeof(CbState()[]))` |
22:21:06 | FromDiscord | <Elegantbeef> Did not expect that |
22:21:16 | FromDiscord | <djazz> oh yeah it was destructors i confused it with |
22:21:51 | FromDiscord | <djazz> pros of ref object vs object with ref in front? |
22:22:02 | FromDiscord | <Elegantbeef> They're literally the same |
22:22:06 | FromDiscord | <djazz> k |
22:23:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=hBDACXtVgrnt |
22:23:21 | FromDiscord | <Elegantbeef> Internally it emits a anonymous object type |
22:23:21 | FromDiscord | <djazz> ah good 2 know |
22:23:57 | FromDiscord | <Elegantbeef> Ok so instead of `error` you can do `void or void` it's not as helpful but it works |
22:24:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=rOtvGBVoSwXk |
22:24:24 | FromDiscord | <Elegantbeef> Though you could use a template for the type |
22:25:44 | FromDiscord | <djazz> invalid `let state = new(CbState)(cb: cb)` |
22:25:51 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=myrXlNjbEWQQ to not spam code here |
22:26:00 | FromDiscord | <Elegantbeef> To bring up a macro yet again https://github.com/beef331/nimtrest/blob/master/staticcases.nim#L59-L63 |
22:26:09 | FromDiscord | <Elegantbeef> Right |
22:26:17 | FromDiscord | <Elegantbeef> `CbState(cb: cb)` |
22:26:18 | FromDiscord | <djazz> with ref object |
22:26:39 | FromDiscord | <Elegantbeef> `new(CbState)` returns a `ref CbState` instance `state(cb: cb)` is invalid code |
22:26:54 | FromDiscord | <Elegantbeef> If it's a ref object the constructor heap allocates |
22:27:12 | FromDiscord | <Elegantbeef> If it's a value object you need to do `(ref CbState)(cb: cb)` to use the constructor syntax |
22:27:41 | FromDiscord | <djazz> I removed GC_ref now and it still works huh |
22:28:02 | FromDiscord | <Elegantbeef> Likely just lacking 0'ing of memory |
22:28:34 | FromDiscord | <Elegantbeef> if you remove the ref do `reset(cbState.cb)` inside the destructor |
22:32:54 | FromDiscord | <djazz> ah yea, reset, thanks |
22:34:15 | FromDiscord | <djazz> how do i know if it really got GC'd? |
22:34:54 | FromDiscord | <Elegantbeef> I'd say use valgrind but you're in embedded |
22:34:57 | FromDiscord | <Elegantbeef> So uhhh |
22:35:19 | FromDiscord | <djazz> this code is running on host |
22:35:27 | FromDiscord | <djazz> its just a closure toy |
22:35:28 | FromDiscord | <Elegantbeef> Ah then valgrind it |
22:36:39 | FromDiscord | <Elegantbeef> make sure you use `-d:useMalloc --debugger:native` |
22:41:01 | FromDiscord | <djazz> seems like just putting a closure on an object makes it leak? im not calling any callback stuff yet |
22:43:14 | FromDiscord | <Elegantbeef> Are you using orc or arc? |
22:43:19 | FromDiscord | <djazz> orc |
22:43:59 | FromDiscord | <Elegantbeef> What's your code now? |
22:45:26 | FromDiscord | <djazz> `total heap usage: 23 allocs, 20 frees` |
22:46:02 | FromDiscord | <djazz> gist updated |
22:47:24 | FromDiscord | <Elegantbeef> Your destroy is not properly destroying |
22:47:30 | FromDiscord | <Elegantbeef> You're leaking cause you're not managing memory |
22:47:57 | FromDiscord | <djazz> what can the destructor do? |
22:48:00 | FromDiscord | <Elegantbeef> `reset(cbstate.cb)` |
22:48:09 | FromDiscord | <Elegantbeef> It needs to destroy resources |
22:48:11 | FromDiscord | <djazz> reset needs a var type |
22:48:18 | FromDiscord | <Elegantbeef> Actually sorry was moved needs to do it now |
22:48:40 | FromDiscord | <djazz> does MyType need a destroy too? it has a callback |
22:49:03 | FromDiscord | <Elegantbeef> make a wasMoved hook reset the values then inside the destructor `if not cbState.cb.isNil: =destroy(cbState.cb)` |
22:49:20 | FromDiscord | <Elegantbeef> You only need destructors if you want to override behaviour |
22:49:31 | FromDiscord | <Elegantbeef> You wrote that destructor so you have to manage memory |
22:50:05 | FromDiscord | <djazz> removing it does not change valgrind |
22:51:33 | FromDiscord | <djazz> Callback does not have a =destroy |
22:52:17 | FromDiscord | <Elegantbeef> It does but `=destroy` is silly in 2.0 transition |
22:52:20 | FromDiscord | <djazz> non-var atleast |
22:52:41 | FromDiscord | <djazz> no change in valgrind |
22:52:47 | FromDiscord | <djazz> with var destroy |
22:53:17 | FromDiscord | <djazz> can you make a closure on a ref object that doesnt leak? |
22:53:50 | FromDiscord | <djazz> wasmoved is never called |
22:54:17 | FromDiscord | <girvo> In reply to @Elegantbeef "all `ref` types support": In arc/orc land, they inc/dec ref counts I'm assuming? I haven't actually checked |
22:54:24 | FromDiscord | <Elegantbeef> I'm going to assume it's the top level closures just being silly |
22:54:25 | FromDiscord | <Elegantbeef> Yes |
22:54:30 | FromDiscord | <djazz> yes, simple counter |
22:55:24 | FromDiscord | <Elegantbeef> Ah we're silly |
22:55:47 | FromDiscord | <Elegantbeef> `GcRunOrc()` |
22:55:57 | FromDiscord | <Elegantbeef> Nim does not call orc on end of program it seems |
22:56:06 | FromDiscord | <djazz> oh right |
22:56:09 | FromDiscord | <djazz> no leaks now |
22:56:12 | FromDiscord | <girvo> On second thought, lets not go to Nim #main, 'tis a silly place. |
22:56:18 | FromDiscord | <girvo> In reply to @Elegantbeef "Nim does not call": wat |
22:56:20 | FromDiscord | <girvo> why |
22:56:24 | FromDiscord | <Elegantbeef> Add that destructor back djazz and leak again |
22:56:37 | FromDiscord | <girvo> I guess coz "well its freed coz the process exited"? |
22:57:00 | FromDiscord | <Elegantbeef> No clue why it doesn't Nim's missing alot of "close program" features |
22:57:15 | FromDiscord | <Elegantbeef> There is no way to properly deallocate a .so either |
22:57:40 | FromDiscord | <girvo> In reply to @Elegantbeef "No clue why it": Yeah that's been true for a long time haha. Not usually that much of a problem, but doesn't play nice with some external tooling |
22:57:47 | FromDiscord | <djazz> wasMoved did nothing |
22:57:54 | FromDiscord | <djazz> destroy needs to be var |
22:58:07 | FromDiscord | <djazz> worst Nim 2.0 change imo |
22:58:13 | FromDiscord | <djazz> to make it non var |
22:58:25 | FromDiscord | <girvo> wait destroy takes a non var param now? |
22:58:34 | FromDiscord | <girvo> (we haven't moved to 2.0 yet) |
22:58:47 | FromDiscord | <djazz> yeah, var is deprecated notice |
22:59:10 | FromDiscord | <girvo> Interesting. Though does that mean I can have destructors run on non vars then now? |
22:59:15 | FromDiscord | <djazz> im sure there's logic to it but makes old code give warnings |
22:59:19 | FromDiscord | <Elegantbeef> Well `=wasMoved` is supposed to reset the data to clear the destructor |
22:59:28 | FromDiscord | <Elegantbeef> the destructor is supposed to destroy |
22:59:33 | FromDiscord | <Elegantbeef> wasmove is supposed to 0 |
22:59:57 | FromDiscord | <djazz> right |
23:00:13 | FromDiscord | <shruggingllama02> I made a library where can I share it |
23:00:36 | FromDiscord | <Elegantbeef> @Phil |
23:00:39 | FromDiscord | <djazz> gist updated and leak free |
23:00:51 | FromDiscord | <Elegantbeef> Shit phil is offline |
23:00:55 | FromDiscord | <shruggingllama02> It's called fuckNiggers |
23:01:00 | FromDiscord | <shruggingllama02> Where can I share it |
23:01:05 | FromDiscord | <ElegantBeef> <@&371760044473319454> we're going to need to block the nope.chat domain |
23:01:16 | FromDiscord | <girvo> In reply to @elegantbeef "<@&371760044473319454> we're going to": Yeah seems it |
23:01:17 | FromDiscord | <shruggingllama02> Does anyone want to use my fuckNiggers library |
23:01:24 | FromDiscord | <shruggingllama02> @room |
23:01:35 | FromDiscord | <shruggingllama02> Anyone want to beta test fuckNiggers |
23:01:47 | FromDiscord | <djazz> what are these bots |
23:01:52 | FromDiscord | <girvo> Its one person |
23:01:54 | FromDiscord | <Elegantbeef> These arent bots sadly |
23:01:56 | FromDiscord | <shruggingllama02> 1000000018.webm https://media.discordapp.net/attachments/371759389889003532/1212172797879787602/1000000018.webm?ex=65f0dee4&is=65de69e4&hm=d01b233f81bafb7c3d3940865da5689559cce1427183617f82c904fe91f785fb& |
23:02:05 | FromDiscord | <shruggingllama02> Flame on niggere |
23:02:09 | FromDiscord | <djazz> nope |
23:02:09 | FromDiscord | <shruggingllama02> Flame on |
23:02:20 | FromDiscord | <Elegantbeef> Someone purchased a matrix domain and is spamming inane bullshit cause they can |
23:02:22 | * | advesperacit quit () |
23:02:24 | FromDiscord | <shruggingllama02> That's me on Friday nights |
23:02:31 | FromDiscord | <shruggingllama02> Why |
23:02:35 | FromDiscord | <djazz> thanks mod |
23:03:29 | systemdsucks | any suggestions on a nim written program that separates cli and library functions |
23:03:40 | FromDiscord | <djazz> replacing GCRunOrc with GC_fullCollect |
23:03:42 | systemdsucks | it's mainly for reading and learning |
23:03:48 | FromDiscord | <Elegantbeef> Though it seems nope.chat is a legit matrix server maybe |
23:05:39 | FromDiscord | <voorhis> @room fuck niggers |
23:05:39 | FromDiscord | <voorhis> @room fuck niggers |
23:05:39 | FromDiscord | <voorhis> @room fuck niggers |
23:05:41 | FromDiscord | <voorhis> @room fuck niggers |
23:05:43 | FromDiscord | <voorhis> @room fuck niggers |
23:05:45 | FromDiscord | <voorhis> @room fuck niggers |
23:05:47 | FromDiscord | <voorhis> @room fuck niggers |
23:05:51 | FromDiscord | <Elegantbeef> Yardanico it's back |
23:05:56 | FromDiscord | <Elegantbeef> Can you block matrix domains? |
23:05:58 | FromDiscord | <voorhis> @room fuck niggers |
23:05:59 | FromDiscord | <voorhis> @room fuck niggers |
23:06:01 | FromDiscord | <voorhis> @room fuck niggers |
23:06:03 | FromDiscord | <voorhis> @room fuck niggers |
23:06:05 | FromDiscord | <voorhis> @room fuck niggers |
23:06:10 | FromDiscord | <voorhis> @room fuck niggers |
23:06:10 | FromDiscord | <voorhis> @room fuck niggers |
23:06:11 | FromDiscord | <voorhis> @room fuck niggers |
23:06:17 | FromDiscord | <voorhis> @room fuck niggers |
23:06:17 | FromDiscord | <voorhis> @room fuck niggers |
23:06:17 | FromDiscord | <voorhis> @room fuck niggers |
23:06:24 | FromDiscord | <voorhis> @room fuck niggers |
23:06:26 | FromDiscord | <voorhis> @room fuck niggers |
23:06:32 | FromDiscord | <voorhis> @room fuck niggers |
23:07:36 | FromDiscord | <Yardanico> i don't think so |
23:07:42 | FromDiscord | <Yardanico> i don't even think element has such functionality, and besides I only have mod rights |
23:07:47 | FromDiscord | <djazz> Interesting, ARC does leak |
23:07:58 | FromDiscord | <djazz> i guess its cyclic |
23:08:00 | FromDiscord | <Elegantbeef> Right mjolinir does have that functionality |
23:08:33 | FromDiscord | <Yardanico> yeah, you have to run that separate mjolnir service |
23:13:38 | FromDiscord | <Elegantbeef> People with too much time really ruin decentralisation π |
23:22:17 | FromDiscord | <nasuray> In reply to @systemdsucks "any suggestions on a": do you just mean an example of a hybrid project or something more complex? |
23:25:42 | * | KhazAkar quit (Read error: Connection reset by peer) |
23:30:33 | FromDiscord | <djazz> thank you @ElegantBeef β€οΈ so much cleaner now <https://github.com/daniel-j/picostdlib/commit/66715c2cbe94d219db6f0ac99035bbce1012e042> |
23:30:58 | FromDiscord | <djazz> except for the `typeof(Socket[SOCK_STREAM]()[])` in =destroy |
23:31:03 | FromDiscord | <djazz> that is ugly |
23:31:17 | FromDiscord | <djazz> since i changed to ref object |
23:31:54 | systemdsucks | maybe not too complex nasuray |
23:32:57 | FromDiscord | <Elegantbeef> Cmon djazz still using a macro for `ptr2ref` |
23:32:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=CgOzqNgGKFIF |
23:33:04 | FromDiscord | <Elegantbeef> why isnt that just `proc ptr2ref(val: pointer, T: typedesc[ref]): T = cast[T](val)`? |
23:35:10 | FromDiscord | <nasuray> In reply to @systemdsucks "maybe not too complex": I have a cli for an ANSI colored string library I wrote https://github.com/daylinmorgan/bbansi (it's not really documented but there isn't much code) for `.nimble` it basically means defining `srcDir` and `bin` |
23:35:22 | FromDiscord | <nasuray> (edit) "code) for" => "code)....for" |
23:36:06 | systemdsucks | thanks nasuray |
23:36:39 | FromDiscord | <Elegantbeef> @djazz is there a specific reason you have that `string | openArray[char]`? I don't see any specialisation for `string` |
23:36:40 | * | jmdaemon quit (Ping timeout: 268 seconds) |
23:36:46 | FromDiscord | <djazz> In reply to @Elegantbeef "why isnt that just": Before it was making a tmp var to hold ptr so i could emulate var with a template |
23:37:08 | FromDiscord | <djazz> In reply to @Elegantbeef "<@81390960805675008> is there a": Right⦠string is same i forgot |
23:37:20 | FromDiscord | <Elegantbeef> You're also using a macro where a template suffices |
23:38:10 | FromDiscord | <Elegantbeef> Finally `owned` means nothing now |
23:39:11 | FromDiscord | <djazz> Yea saw that owned didnt change anything |
23:39:19 | FromDiscord | <djazz> Now that its a ref |
23:41:19 | FromDiscord | <djazz> Can you make it just a template? <https://github.com/daniel-j/picostdlib/blob/master/src/picostdlib/net/picosocket.nim#L13> |
23:42:03 | FromDiscord | <djazz> It evolved from that |
23:42:20 | FromDiscord | <Elegantbeef> yep |
23:43:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=UqUikmzCAfbL |
23:43:16 | FromDiscord | <Elegantbeef> s/macro/template |
23:44:21 | FromDiscord | <djazz> Its very useful when dealing with C callbacks |
23:44:34 | FromDiscord | <djazz> Going to put it in more places |
23:45:01 | FromDiscord | <djazz> Before i had a separate cdecl proc calling nim proc to get var |
23:46:53 | FromDiscord | <djazz> Night |