00:04:57 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
00:07:54 | * | Lord_Nightmare joined #nim |
00:10:48 | * | jmdaemon joined #nim |
01:13:59 | * | sommerjan quit (Quit: Konversation terminated!) |
01:24:59 | * | def- quit (Quit: -) |
01:25:19 | * | def- joined #nim |
01:34:05 | * | lumo_e joined #nim |
01:43:57 | FromDiscord | <sOkam!> I have an issue, where I want to keep two separate values in sync. When I change one, the other should also change↵But they are different types, so I cannot just reference one to the other↵How would you solve such type of situation? 🤔 |
01:48:02 | FromDiscord | <Elegantbeef> More context is required |
02:01:28 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKu |
02:02:14 | FromDiscord | <Elegantbeef> Make a proc that takes physics and applies it to the render data, or just use the physics body interpolated |
02:02:32 | FromDiscord | <sOkam!> I could have both fixed point, but it would make me rewrite big chuncks of vmath for the unique type, so was thinking if there could be some other solution |
02:03:03 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Make a proc that": interpolated from where to where? 🤔 |
02:03:57 | FromDiscord | <Elegantbeef> Using the dt and physics logic to interpolate where the object should be after last tick |
02:04:52 | FromDiscord | <sOkam!> yeah but doesn't interpolation take two points? |
02:05:06 | FromDiscord | <Elegantbeef> Exterpolate! |
02:05:12 | FromDiscord | <Elegantbeef> Polate all the directions |
02:23:11 | * | jmdaemon quit (Ping timeout: 252 seconds) |
02:24:51 | termer | How do I check the value of a value I defined in CLI args? I'm doing -d:asyncBackend=chronos but I'm not sure how to check that in the code |
02:25:09 | termer | `when asyncBackend == "chronos"` doesn't work |
02:25:35 | FromDiscord | <Elegantbeef> `const asyncBackend {.strdefine.} = ...` |
02:27:06 | termer | and that will be set by the CLI option? |
02:27:36 | * | jmdaemon joined #nim |
02:35:42 | FromDiscord | <Elegantbeef> should |
02:45:55 | * | jmdaemon quit (Ping timeout: 252 seconds) |
02:46:30 | termer | seems to work, thanks ElegantBeef |
02:52:39 | * | azimut quit (Remote host closed the connection) |
02:53:07 | * | azimut joined #nim |
02:57:06 | FromDiscord | <sOkam!> how do you compare if two typedesc are the same? 🤔 ↵im trying `is` and `==` but its complaining for both |
02:57:48 | * | rockcavera joined #nim |
02:58:17 | FromDiscord | <Arathanis> `is` should work |
02:59:43 | FromDiscord | <Arathanis> !eval echo int is int |
02:59:46 | NimBot | true |
02:59:56 | FromDiscord | <Arathanis> !eval echo int is string |
02:59:59 | NimBot | false |
03:00:44 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKD |
03:00:57 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4mKD" => "https://play.nim-lang.org/#ix=4mKE" |
03:01:22 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4mKE" => "https://play.nim-lang.org/#ix=4mKF" |
03:01:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKG |
03:02:02 | FromDiscord | <Arathanis> what is PType |
03:02:09 | FromDiscord | <sOkam!> an aliased type |
03:02:23 | FromDiscord | <sOkam!> its Fx in this case, aliased |
03:02:36 | FromDiscord | <Arathanis> can you show me how it is defined? |
03:02:44 | FromDiscord | <huantian> you can't return a typedesc from a func |
03:02:54 | FromDiscord | <Arathanis> casuse `distinctBase` is for distinct types |
03:02:56 | FromDiscord | <deadmeme77> e |
03:02:58 | FromDiscord | <sOkam!> and Fx is a distinct type coming from an int32, because its a fixed point representation |
03:03:00 | FromDiscord | <Elegantbeef> Use a template |
03:03:00 | FromDiscord | <Arathanis> i think its nonsensical for aliases |
03:03:03 | FromDiscord | <huantian> `typedesc` doesn't exist at runtime |
03:03:51 | FromDiscord | <sOkam!> In reply to @Arathanis "i think its nonsensical": how do you get the type where the given type is coming from, to compare it with the current, without distinctbase? |
03:04:13 | FromDiscord | <Arathanis> fwiw I don't KNOW its nonsensical for an alias |
03:04:16 | FromDiscord | <Arathanis> but you could check it |
03:04:24 | FromDiscord | <Arathanis> if it is truly an alias you should be able to use raw `is` |
03:04:44 | FromDiscord | <Arathanis> but your issue might be what @huantian mentioned |
03:05:58 | FromDiscord | <Arathanis> what is the goal this function is trying to accomplish? |
03:06:15 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKJ |
03:06:43 | FromDiscord | <Arathanis> oh if its an alias of a distinct type you should be fine |
03:06:55 | FromDiscord | <Arathanis> and i just checked, distinctBase doesn't care if its a non distinct type |
03:07:00 | FromDiscord | <sOkam!> In reply to @Arathanis "what is the goal": appropiately converting to the type representation, which will need extra processing when its fixed point, but no processing at all when its some number |
03:08:12 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1070178728056991824/image.png |
03:08:38 | FromDiscord | <sOkam!> that is not what it should say |
03:08:45 | FromDiscord | <sOkam!> it should be Next |
03:08:53 | FromDiscord | <Elegantbeef> No aliases are not distinct |
03:08:58 | FromDiscord | <Elegantbeef> I gave you a macro that shows alias |
03:09:00 | FromDiscord | <Arathanis> oh that isn't what distinctBase does |
03:09:12 | FromDiscord | <sOkam!> yeah, i use that as `baseType` to get to the raw type |
03:09:25 | FromDiscord | <sOkam!> but I only want the previous type, not the most bottom one |
03:09:33 | FromDiscord | <Arathanis> In reply to @Elegantbeef "I gave you a": im guessing this is up there somewhere? ^ |
03:09:36 | FromDiscord | <Elegantbeef> Then change it to do that |
03:09:44 | FromDiscord | <sOkam!> but i don't know macros, beef |
03:09:50 | FromDiscord | <Elegantbeef> Learn them |
03:09:52 | FromDiscord | <sOkam!> like at all... they are cryptic |
03:10:04 | FromDiscord | <sOkam!> i have tried at least 4-5times |
03:10:13 | FromDiscord | <sOkam!> i understand 0% every time |
03:10:50 | FromDiscord | <Arathanis> I honestly sat down and hacked at macros until it stuck |
03:10:58 | FromDiscord | <Arathanis> There is a wealth of information online about macros in the abstract |
03:11:04 | FromDiscord | <Arathanis> cause its just AST manipulation |
03:11:08 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKK |
03:11:29 | FromDiscord | <sOkam!> the top macro is the one that beef wrote, and works |
03:11:53 | FromDiscord | <Elegantbeef> Remove `newCall` and there you go |
03:12:00 | FromDiscord | <sOkam!> the part below is my failure at trying to get the rest of the behavior. it works well for normal values, but have no clue how to do it for typedesc |
03:13:39 | FromDiscord | <Arathanis> im very sad that Windows Defender identifies Nim 1.6.10 as a virus u_u |
03:13:49 | FromDiscord | <Arathanis> this is new |
03:14:03 | FromDiscord | <Rika> It isn’t lol |
03:14:12 | FromDiscord | <Rika> The AV battle has been going on for a while |
03:14:18 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKL |
03:14:32 | FromDiscord | <Elegantbeef> Correct that will get the alias's type |
03:14:38 | FromDiscord | <sOkam!> kty ✍️ |
03:14:39 | FromDiscord | <Elegantbeef> But again no one in their right mind cares about aliases |
03:14:43 | FromDiscord | <Elegantbeef> Cause they're not types |
03:14:56 | FromDiscord | <Arathanis> In reply to @Rika "It isn’t lol": I only mention the "newness" because I updated to 1.6.10 pretty quickly after it's release on one of my Windows machines but now my other Window's machines are very sad about trying to update |
03:15:15 | FromDiscord | <sOkam!> how do you check for that correctly then? do you just `is` without getting out of the alias ? |
03:15:37 | FromDiscord | <Elegantbeef> What? |
03:15:42 | FromDiscord | <Elegantbeef> No one cares about aliases |
03:15:50 | FromDiscord | <Elegantbeef> you do `Type is Alias` |
03:16:09 | FromDiscord | <Elegantbeef> Or whatever you're doing |
03:16:27 | FromDiscord | <Elegantbeef> Aliases are not anything but renaming of types, why you're caring where they point is beyond me |
03:16:35 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1070180837691244674/image.png |
03:16:51 | FromDiscord | <Arathanis> the alias name has no meaning |
03:16:52 | FromDiscord | <Arathanis> its just a name |
03:18:40 | FromDiscord | <Arathanis> In reply to @Rika "The AV battle has": is there a good work around? |
03:18:45 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Aliases are not anything": because i thought it woould be important, and i fucking suck at understanding ast. so how could I possibly know if its important or not, if they are failing compilation with cryptic errors? |
03:18:55 | FromDiscord | <Rika> In reply to @Arathanis "is there a good": Disable your AV xd |
03:19:10 | FromDiscord | <Arathanis> so there is a ~~good~~ work around |
03:19:22 | FromDiscord | <ringabout> Use devel or 2.0rc |
03:19:38 | FromDiscord | <Rika> In reply to @Arathanis "so there is a": You can also compile Nim from source |
03:19:39 | FromDiscord | <sOkam!> In reply to @Arathanis "": kty. i guess i was lost in the simple syntax once again 😔 |
03:19:46 | FromDiscord | <Arathanis> it's ok, learning |
03:19:49 | FromDiscord | <Rika> I hear compilation from source isn’t detected |
03:20:01 | FromDiscord | <ringabout> In reply to @ringabout "Use devel or 2.0rc": 1.6.10 missed a related PR |
03:20:10 | FromDiscord | <Arathanis> In reply to @sOkam! "kty. i guess i": in the context of programming, alias means "another name for something" |
03:20:12 | FromDiscord | <sOkam!> In reply to @Arathanis "it's ok, learning": it happens more than with learning. it happens even with stuff i already know. but yeah, i get what you mean, ty |
03:20:14 | FromDiscord | <Arathanis> but its not different than that thing |
03:21:03 | FromDiscord | <ringabout> In reply to @ringabout "1.6.10 missed a related": https://github.com/nim-lang/Nim/pull/19767 |
03:26:04 | FromDiscord | <Arathanis> devel worked, thanks everyone |
03:26:15 | FromDiscord | <Arathanis> does choosenim always say devel has updates available? lol |
03:30:09 | * | arkurious quit (Quit: Leaving) |
03:30:45 | * | lain quit (Ping timeout: 260 seconds) |
03:31:31 | * | lain joined #nim |
03:35:20 | FromDiscord | <sOkam!> `is` fixed the issue, btw. ty for the help ✍️ |
03:49:53 | * | azimut_ joined #nim |
03:49:59 | * | azimut quit (Ping timeout: 255 seconds) |
04:26:59 | * | jmdaemon joined #nim |
04:29:01 | * | m5zs7k quit (Ping timeout: 268 seconds) |
04:29:55 | * | m5zs7k joined #nim |
04:37:58 | * | m5zs7k quit (Ping timeout: 252 seconds) |
04:43:44 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4mKT |
04:43:51 | * | m5zs7k joined #nim |
04:46:30 | FromDiscord | <ShalokShalom> You can use single case enums, to define aliases, that create a new type ☺️ |
05:02:26 | FromDiscord | <sOkam!> sent a long message, see http://ix.io/4mKU |
05:02:43 | FromDiscord | <sOkam!> (edit) "http://ix.io/4mKU" => "http://ix.io/4mKV" |
05:05:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mKW |
05:07:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mKX |
05:08:35 | FromDiscord | <sOkam!> so that math needs to be chosen differently depending on whether the type is coming from a type higher in the chain, or from an actual number instead |
05:09:17 | FromDiscord | <Elegantbeef> If you need to check the type at runtime you're doing something wrong |
05:09:59 | FromDiscord | <sOkam!> how do you mix fixed point math and floating point math in the same type at the same time, then? 🤔 |
05:10:20 | FromDiscord | <Elegantbeef> Why do you need runtime checks if you know one side is fixed and the other isnt? |
05:10:44 | FromDiscord | <Elegantbeef> Without concrete code i cannot say much else though |
05:11:12 | FromDiscord | <sOkam!> because the type could be running inside an int as fixed, or inside an int as int, or inside a float, and they are all Vec3 types |
05:12:47 | FromDiscord | <Elegantbeef> But there isnt any dynamism afaik |
05:12:48 | FromDiscord | <Elegantbeef> If you know if a value is typed as fixed at compile time there is no need to do anything at runtime |
05:13:38 | FromDiscord | <sOkam!> In reply to @Elegantbeef "If you know if": yeah but the math is different, and it changes the syntax everywhere |
05:14:29 | FromDiscord | <sOkam!> creating an float with `somenum.float` works. but creating it with `somenum.Alias` will break, if the alias links to `Fixed` instead of `float` as its base container |
05:15:36 | FromDiscord | <sOkam!> `let val :Alias= 1.Alias` will be `1.000` if float, or `0.0001` if Fixed |
05:16:25 | FromDiscord | <Elegantbeef> Implement `to` procedures so you can do `1f.to(Alias)` or `myAlias.to(float)` |
05:16:58 | FromDiscord | <sOkam!> there wont be any to(float) only alia |
05:17:04 | FromDiscord | <sOkam!> (edit) "alia" => "alias" |
05:17:44 | FromDiscord | <sOkam!> that's the point of the "generic" part of the type. that it does it auto, without having to refactor the whole damn engine to change from deterministic to non-deterministic math |
05:17:47 | FromDiscord | <Elegantbeef> then make that proc, you can also make userdefined literals |
05:18:18 | FromDiscord | <sOkam!> its what i did, that's what the ptype(n :SomeNumber) proc was about |
05:18:35 | FromDiscord | <Elegantbeef> Where does the runtime checks come in though? |
05:18:50 | * | rockcavera quit (Remote host closed the connection) |
05:19:08 | FromDiscord | <sOkam!> well, how do you do the same at compile time, leaving only the correct behavior, without doing a when check? |
05:19:18 | FromDiscord | <Elegantbeef> When isnt a runtime check |
05:19:23 | FromDiscord | <sOkam!> if its doable, i don't know how |
05:19:47 | FromDiscord | <sOkam!> thats what i was doing, afaik. unless 🐠 memory fails me |
05:20:17 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/0Lz |
05:20:23 | FromDiscord | <Elegantbeef> You said it required a runtime check and i was trying to figure out why it required a runtime check |
05:20:53 | FromDiscord | <sOkam!> maybe i said runtime as a total noob, im checking with a when though. my bads |
05:21:09 | FromDiscord | <Elegantbeef> Also like we pointed out you can just do `PType is SomeNumber` |
05:21:14 | FromDiscord | <Elegantbeef> There is no need for that `baseType` |
05:21:42 | FromDiscord | <sOkam!> yeah i guess its not needed in this case 🤔 |
05:28:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mKY |
05:28:46 | FromDiscord | <Elegantbeef> Then you just always call `fx` and it works |
05:28:56 | FromDiscord | <Elegantbeef> But this is in the woods i guess now |
05:31:52 | FromDiscord | <sOkam!> can you define in code, though? |
05:32:15 | FromDiscord | <Elegantbeef> You can do `{.define: fixedPoint.}` |
05:33:06 | FromDiscord | <sOkam!> does it work from any file, or does it need to be anywhere specific? |
05:33:34 | FromDiscord | <Elegantbeef> It sounds like you want to toggle fixed point on and off so nope |
05:34:14 | FromDiscord | <sOkam!> yeah, i have all the config centralized in a single file (except this part specifically, which is away due to dependency hell) |
05:51:05 | * | lumo_e quit (Ping timeout: 252 seconds) |
05:54:36 | FromDiscord | <Require Support> is there a COM guru on here that can help me with playing vs COM using nim https://learn.microsoft.com/en-us/windows/win32/api/_com/ |
06:14:31 | * | dza quit (Quit: ) |
06:35:18 | FromDiscord | <demotomohiro> @Require Support I think winim helps using COM: https://github.com/khchen/winim |
06:38:29 | * | kenran joined #nim |
06:42:00 | FromDiscord | <Require Support> ye that's what im playing with now, thanks |
06:43:31 | * | ltriant quit (Ping timeout: 252 seconds) |
07:41:19 | * | dza joined #nim |
07:46:37 | * | PMunch joined #nim |
07:47:29 | Amun-Ra | I have a seq of objects (that can be casted to uint32); I need to base64 all the data; is there a way to cast that to base64.encode? |
07:49:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mLb |
07:50:46 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[uint32]` or `cast[seq[uint32]].encode()` |
07:51:39 | Amun-Ra | the problem with having T: uint32 is base64.encode takes only one byte of each T |
07:52:00 | Amun-Ra | hmm |
07:57:58 | FromDiscord | <ElegantBeef> Oh nice matrix bridge went down yet again |
07:58:11 | FromDiscord | <ElegantBeef> One day t2bot will survive a day without going down for no reason |
07:59:50 | Amun-Ra | Elegantbeef: I modified you example, thanks for the hint |
07:59:56 | Amun-Ra | >>> cast[cstring](image.pixmap[0].addr).toOpenArray(0, image.pixmap.len * image.pixmap[0].sizeof - 1).encode |
08:00:46 | FromDiscord | <ElegantBeef> There is a possible issue with aliasing, but meh C compilers be damned 😄 |
08:01:09 | Amun-Ra | :P |
08:01:26 | Amun-Ra | passl = "-fno-strict-aliasing" |
08:01:30 | Amun-Ra | :> |
08:01:37 | FromDiscord | <ElegantBeef> Nim does by default but it still can cause issues apparently |
08:02:25 | Amun-Ra | I can implement by own pixmap encoder just to be safe |
08:06:21 | Amun-Ra | ElegantBeef: https://i.postimg.cc/50skRKqh/rv.png |
08:06:41 | FromDiscord | <Elegantbeef> We did it? 😄 |
08:06:53 | Amun-Ra | yes, we did :P |
08:07:34 | Amun-Ra | (I'm writing driver to kitty terminal that's capable of displaying bitmaps) |
08:09:46 | FromDiscord | <Rika> nice |
08:15:25 | FromDiscord | <Tuatarian> In reply to @Elegantbeef "IE you're using it": It lives exactly as long as the cursor |
08:15:42 | FromDiscord | <Tuatarian> It's a tree structure, the parent ref is cursored |
08:16:19 | FromDiscord | <Tuatarian> So if the parent dies, the kid has no counted refs, and also dies, and so forth down the tree |
08:24:11 | PMunch | Amun-Ra, why are you writing a new way to display bitmaps in Kitty? |
08:34:40 | FromDiscord | <Rika> new way? |
08:34:52 | FromDiscord | <Rika> whats the other way? |
08:42:53 | PMunch | The kitten icat? |
08:43:51 | Amun-Ra | PMunch: I'm writing new video/output driver for my image browser |
08:43:54 | Amun-Ra | https://i.postimg.cc/RCkYHs9X/rn.png |
08:44:46 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
08:45:02 | * | peterhil joined #nim |
08:45:25 | Amun-Ra | the browser supports many long since forgotten image formats (but it's not yet published) |
08:45:54 | Amun-Ra | the image seen above was taken from: https://tomseditor.com/gallery/i/1820/blubb-by-sphinx&lang=en |
08:51:06 | Amun-Ra | it supports right now the following formats: https://pastebin.com/zyR1UTfz (~30 more need to be rewritten to the new internal api) |
08:52:00 | Amun-Ra | I started the project just to learn Nim language :> |
09:06:36 | * | Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
09:07:55 | * | Batzy joined #nim |
09:11:31 | * | ltriant joined #nim |
09:16:07 | FromDiscord | <Elegantbeef> Anyone else find the devel type mismatch messages so diffcult to read? |
09:16:43 | FromDiscord | <Elegantbeef> For context |
09:16:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/KZd |
09:17:47 | FromDiscord | <Rika> i have no idea how that is read |
09:18:02 | FromDiscord | <Elegantbeef> `[2]` means teh second parameters is wrong |
09:18:07 | FromDiscord | <Rika> oh i can read it with effort |
09:18:11 | FromDiscord | <Rika> takes a while to get used to |
09:18:21 | FromDiscord | <Coachonko> Tips to quickly setup vscode for nim? What extension is the right one and which settings do you recommend? |
09:18:38 | FromDiscord | <Elegantbeef> I find it much harder to read than "Got x, but expected Y" |
09:18:40 | FromDiscord | <Coachonko> Oh sht sorry for hijacking |
09:18:41 | FromDiscord | <amadan> After a while I found them nicer to read↵Just needed to get used to them first |
09:18:59 | FromDiscord | <amadan> (I could be suffering Stockholm syndrome though) |
09:19:11 | FromDiscord | <Elegantbeef> It's lacking the useful information of what the mismatch is in this case, and i cannot even compare them to stable since i'm using devel features 😄 |
09:19:16 | * | Batzy_ joined #nim |
09:19:40 | Amun-Ra | Coachonko: Nim by nimsaem |
09:20:32 | FromDiscord | <Elegantbeef> These error messages might not be so bad if it added `(got X)` in red text next to bad params |
09:20:49 | FromDiscord | <Coachonko> In reply to @Amun-Ra "<@969109539523797062>: Nim by nimsaem": Thanks! |
09:21:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mLv |
09:21:10 | FromDiscord | <Elegantbeef> One of these i think provides much more readable information |
09:21:54 | * | Batzy quit (Ping timeout: 252 seconds) |
09:22:21 | FromDiscord | <Rika> In reply to @Elegantbeef "It's lacking the useful": its not, its just obtuse to read |
09:22:25 | FromDiscord | <Rika> so it needs better formatting |
09:23:14 | Amun-Ra | Elegantbeef: that formatting is unfortunate |
09:23:32 | FromDiscord | <Elegantbeef> I think it needs more clearly written information. Might just be old man syndrome, but i prefer the former messages |
09:23:59 | Amun-Ra | and the expression is weirdly broken |
09:24:39 | Amun-Ra | I bet "result.command)" feels alone |
09:25:00 | FromDiscord | <Elegantbeef> I dont even really care about that to be frank |
09:26:17 | FromDiscord | <Elegantbeef> The overload information is just presented in such a bad manner to me atleast |
09:26:45 | Amun-Ra | I'd prefer ^~~~~~~ styling over simple [2] |
09:45:29 | * | azimut_ quit (Ping timeout: 255 seconds) |
09:47:20 | FromDiscord | <Coachonko> sent a code paste, see https://play.nim-lang.org/#ix=4mLD |
10:10:17 | PMunch | @Elegantbeef, did you see that I fixed the varargs issuE? |
10:10:36 | FromDiscord | <Elegantbeef> yeS |
10:11:11 | PMunch | Quite an interesting bug it turns out |
10:12:31 | FromDiscord | <Elegantbeef> A funny bug atleast |
10:12:41 | FromDiscord | <Elegantbeef> All found cause a rusty api used a macro to declare ownership |
10:13:30 | FromDiscord | <Elegantbeef> I do not even remember the wasm runtime that bug was found with at this poiint |
10:13:40 | FromDiscord | <Elegantbeef> Might've been wasmer, or wasmtime 😄 |
10:26:37 | FromDiscord | <ringabout> https://github.com/pietroppeter/nimib/pull/169#issuecomment-1411818732 |
10:27:04 | FromDiscord | <ringabout> A strange bug only occurred with ARC/ORC. |
10:27:53 | FromDiscord | <ringabout> Why is the type not properly inferred in ARC/ORC? |
10:46:56 | FromDiscord | <jmgomez> How would you use koch to only compile vcc? |
10:48:11 | FromDiscord | <ringabout> What do you mean by "only compile vcc"? |
10:48:32 | FromDiscord | <jmgomez> `./koch tools` compiles all the tools, right? |
10:48:45 | FromDiscord | <jmgomez> so Im asking compiling just vcc |
10:50:31 | FromDiscord | <ringabout> It isn't supported. |
10:53:06 | FromDiscord | <ringabout> Though, you might import private `buildVccTool` by `std/importutils` to implement your own installation proc. |
11:08:22 | FromDiscord | <luteva> Hi!↵Is there an easy but complete example of how to encapsulate an external lib resource (say an object of a C++ library) through an object in nim that gets garbage collected? Afaik there should be a destructor for the ptr Object in a finalizer(??) so that, once encapsulated through a ref Object in nim, I do not have to care about freeing the memory for the ptr Object. Is that correct/possible/the way to go? Or do I totally misunderstand |
11:13:15 | FromDiscord | <mratsim> In reply to @luteva "Hi! Is there an": https://github.com/mratsim/Arraymancer/blob/e297e6d5dcad70f3a39c44d8c79e2bb171fc2bd6/src/arraymancer/tensor/backend/opencl_backend.nim#L41-L50 |
11:13:30 | FromDiscord | <mratsim> This example auto-dealloc OpenCL memory |
11:20:37 | Amun-Ra | let's say I have an empty seq of some T ie: var s = newseq[uint32](); what's the best way to get the size of that seq element? |
11:21:10 | FromDiscord | <luteva> sent a long message, see http://ix.io/4mMf |
11:21:38 | FromDiscord | <Rika> In reply to @Amun-Ra "let's say I have": "size" as in the heap size? so the allocated capacity? |
11:22:04 | Amun-Ra | Rika: oh, size as uint32.sizeof in the example above |
11:23:12 | FromDiscord | <Rika> `sizeof(s[0])` |
11:23:18 | FromDiscord | <Rika> works even if it is empty |
11:23:37 | Amun-Ra | :O |
11:23:42 | FromDiscord | <Rika> same with typeof if ever youll need that |
11:23:50 | Amun-Ra | I have never tried that, I assumed it won't work |
11:23:54 | Amun-Ra | thank you Rika |
11:24:01 | FromDiscord | <Rika> yeah thats a reasonable assumption |
11:24:03 | FromDiscord | <Rika> nim magic |
11:24:31 | Amun-Ra | nice |
11:24:58 | Amun-Ra | now I can remove "if unlikely foo.len == 0: return …" from several places ;) |
11:25:40 | FromDiscord | <Rika> nice |
11:40:08 | FromDiscord | <mratsim> sent a long message, see http://ix.io/4mMo |
11:42:23 | FromDiscord | <mratsim> In reply to @luteva "thx a lot <@570268431522201601>": same for Cuda: https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/tensor/backend/cuda.nim#L29-L39↵and CudaStorage is a ref object |
11:55:52 | * | azimut joined #nim |
11:56:40 | FromDiscord | <luteva> ok so, maybe they both together may help me. it's just a kind of 'big' as a first easy example... e.g. the CudaStorage is not in cuda.nim but in a different module data_structure etc. so i have to search around to get an understanding of the context. |
12:23:03 | * | lumo_e joined #nim |
12:32:29 | * | rockcavera joined #nim |
12:36:15 | * | jmdaemon quit (Ping timeout: 252 seconds) |
12:53:53 | Amun-Ra | Elegantbeef: I ended up sending raw pixmap via SHM + MMAP |
13:13:16 | * | azimut quit (Quit: ZNC - https://znc.in) |
13:13:46 | * | azimut joined #nim |
13:14:23 | * | lumo_e quit (Ping timeout: 252 seconds) |
13:58:27 | * | Batzy_ quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
13:58:52 | * | Batzy joined #nim |
13:59:32 | * | Batzy quit (Client Quit) |
13:59:57 | * | Batzy joined #nim |
14:01:43 | FromDiscord | <that_dude> In reply to @luteva "ok so, maybe they": https://scripter.co/binding-nim-to-c-plus-plus-std-list/ this may with c++ stuff. I'm not sure if he covers constructors or destructors |
14:16:16 | * | Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
14:17:27 | * | Batzy joined #nim |
14:31:07 | FromDiscord | <Piqueiras> are object procs supposed to be able to modify parameters even if the object is declared with let and the proc doesnt have var statement 🤔 |
14:32:09 | FromDiscord | <Phil> object procs as in methods? |
14:34:06 | PMunch | @Piqueiras, let me guess, they're not objects but ref objects |
14:34:13 | FromDiscord | <Piqueiras> oh nvm I think it was because I did it without init |
14:34:17 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4mNw |
14:35:22 | FromDiscord | <Piqueiras> and ref object is a pointer to the heap while object is just the whole thing? |
14:35:34 | PMunch | @Piqueiras, correct |
14:36:14 | PMunch | (Nim might still pass the object by a pointer under the hood if it is more efficient, but logically you can treat it like its passed by value) |
14:36:31 | FromDiscord | <Piqueiras> so what it would not allow me to modify is the ref of the ref object |
14:36:46 | FromDiscord | <Piqueiras> so idk if there is a way to make the object itself immutable |
14:37:26 | FromDiscord | <Piqueiras> need to get a bit more into it cause "newObject" and "initObject" lol |
15:02:12 | * | PMunch quit (Quit: Leaving) |
15:06:47 | FromDiscord | <Nycto> Quick question: is it possible to check whether an import/include exists before trying to import it? Something like: ‘when compiles(import foo): import foo’ |
15:14:43 | FromDiscord | <@thatrandomperson5-6310e3b26da03> `when (compiles do: import thelib):`↵(@Nycto) |
15:15:40 | FromDiscord | <@thatrandomperson5-6310e3b26da03> https://forum.nim-lang.org/t/3752 |
15:16:36 | FromDiscord | <Nycto> Thanks 😆 |
15:35:59 | * | jmdaemon joined #nim |
15:40:05 | * | azimut quit (Ping timeout: 255 seconds) |
15:56:04 | * | arkurious joined #nim |
16:04:59 | * | jmdaemon quit (Ping timeout: 260 seconds) |
16:18:02 | * | kenran quit (Remote host closed the connection) |
17:03:11 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4mOw |
17:04:35 | * | jmdaemon joined #nim |
17:10:52 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mOD |
17:10:56 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4mOD" => "https://paste.rs/BTE" |
17:11:55 | FromDiscord | <Phil> TBH I'm fascinated that you can import c++ procs to compile them to js |
17:11:57 | FromDiscord | <Phil> that's kind of wild |
17:12:11 | FromDiscord | <Phil> (edit) "TBH I'm fascinated that you ... can" added "apparently" |
17:20:14 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > TBH I'm fascinated that you apparently can import c++ procs to compile them to js↵It imports js. |
17:24:46 | * | lumo_e joined #nim |
17:31:12 | * | jmdaemon quit (Ping timeout: 248 seconds) |
18:39:53 | FromDiscord | <Nerve> Are Datamancer formulas broken? Every time I try to use one I get `undeclared identifier: 'f'` and I'm a bit stuck |
18:53:43 | FromDiscord | <gibson> @Nerve You're using this syntax? `let fn = f{ idx("a") == 5 }` |
18:53:49 | * | lumo_e quit (Ping timeout: 260 seconds) |
18:54:16 | * | lumo_e joined #nim |
19:09:04 | FromDiscord | <Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4mPc |
19:09:17 | FromDiscord | <Nerve> `lower` and `upper` are floats |
19:09:26 | FromDiscord | <Nerve> and `freq` is a float column |
19:12:05 | FromDiscord | <gibson> All I can think is try to separate that line out into multiple lines, as if making clear code. See if the formula compiles at all. |
19:14:50 | FromDiscord | <Phil> Can I make it so that a proc parameter is an array of exactly 16 entries, but also accepts sequences with 16 entries? |
19:24:38 | FromDiscord | <Nerve> In reply to @gibson "All I can think": I've tried other dead simple formulas and I still get the same thing. It's like the macro is completely missing. |
19:26:39 | FromDiscord | <Nerve> In reply to @Isofruit "Can I make it": Use an overloaded proc that takes the seq, asserts the length, drops the contents in an array, and calls the array version? |
19:27:15 | FromDiscord | <Phil> In reply to @Nerve "Use an overloaded proc": Yeah but that means I only get a runtime error for when you give me a "wrong" seq, that's why I disliked that one |
19:27:43 | FromDiscord | <Nerve> Well, seqs lengths are a runtime property... |
19:38:17 | * | lumo_e quit (Ping timeout: 252 seconds) |
19:54:23 | * | jmdaemon joined #nim |
20:01:43 | * | PMunch joined #nim |
20:39:50 | FromDiscord | <turbo> I'm interacting with a JSON API that for the same field sometimes responds with a string, sometimes an int and sometime doesn't contain the field at all. How can I capture that in an `object` definition that I can unmarshal to without constantly running into JsonKindErrors? |
20:47:33 | FromDiscord | <hotdog> In reply to @turbo "I'm interacting with a": What json library are you using? |
20:47:39 | FromDiscord | <turbo> std |
20:48:48 | FromDiscord | <planetis> imo you can't do that with any library |
20:49:26 | FromDiscord | <hotdog> In reply to @planetis "imo you can't do": You can unmarshal into an object variant |
20:49:30 | FromDiscord | <hotdog> You just need a custom hook |
20:50:09 | FromDiscord | <hotdog> I've done something along these lines before with jsony |
20:51:15 | FromDiscord | <planetis> hmm maybe that would work, but even if you can't control the json? in order to serialize the kind field |
20:51:54 | FromDiscord | <hotdog> This is just for consuming what the api responds with though right? |
20:53:27 | * | lumo_e joined #nim |
20:53:35 | FromDiscord | <planetis> right, so the custom hook first tries to parse it as a number and if it fails just creates an object variant with a string field |
20:54:09 | FromDiscord | <planetis> something like that I guess would work |
20:54:58 | FromDiscord | <hotdog> Yeah |
20:55:23 | FromDiscord | <hotdog> IIRC with jsony you can even have arbitrary json in a field too |
20:55:31 | FromDiscord | <hotdog> So you can handle that separately |
20:56:48 | FromDiscord | <planetis> I dunno what that means but I am glad it works |
21:01:46 | FromDiscord | <hotdog> This is the bit I mean https://github.com/treeform/jsony#full-support-for-json-in-json |
21:25:50 | FromDiscord | <Phil> Errr okay, how do I deal with different versions of openssl when I want to be able to be compatible with both? |
21:26:17 | FromDiscord | <Phil> Is there a way to do when flags for when a dynamically linked library is version x/y |
21:26:19 | FromDiscord | <Phil> (edit) "Is there a way to do when flags for when a dynamically linked library is version x/y ... " added "?" |
21:26:45 | FromDiscord | <Phil> (edit) "Errr okay, how do I deal with different versions of openssl ... when" added "(1 and 3)" |
21:27:40 | FromDiscord | <Phil> The main reason I'm asking is because openssl 1 uses `EVP_MD_size`, openssl3 changed that to `EVP_MD_get_size`↵So I just need to be able to deal with both modifiers |
21:29:28 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4mPL |
21:30:06 | FromDiscord | <hotdog> In reply to @@thatrandomperson5-6310e3b26da03 "> > Why does": Can you paste without the html syntax highlighting stuff? It's hard to read on discord |
21:30:49 | FromDiscord | <MetuMortis> I believe it shouldn't bee importcpp |
21:32:28 | FromDiscord | <Elegantbeef> As i say stop using gitter |
21:34:44 | FromDiscord | <hotdog> In reply to @Isofruit "Errr okay, how do": https://www.openssl.org/docs/manmaster/man3/OPENSSL_VERSION_NUMBER.html |
21:35:18 | FromDiscord | <Phil> Basically fix it at runtime? |
21:35:45 | FromDiscord | <hotdog> In reply to @Isofruit "Basically fix it at": How can you do it at runtime if it's dynamically linked and you want to support both? |
21:35:52 | FromDiscord | <hotdog> Maybe I'm misunderstanding the problem |
21:36:02 | FromDiscord | <hotdog> (edit) "runtime" => "compiletime" |
21:36:59 | FromDiscord | <hotdog> (typo'd and ninja edited runtime->compiletime) |
21:38:13 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mPO |
21:38:18 | FromDiscord | <Phil> Ah, yeah, fair point |
21:40:19 | FromDiscord | <turbo> In reply to @hotdog "This is the bit": ooh, that looks promising |
21:41:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mPP |
21:41:40 | FromDiscord | <Phil> I believe a lot of things but not that this ssl version exists |
21:43:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mPQ |
21:47:21 | FromDiscord | <turbo> Isn't that just:↵↵> OPENSSL_VERSION_NUMBER is a combination of the major, minor and patch version into a single integer 0xMNN00PP0L |
21:47:48 | FromDiscord | <Elegantbeef> Is it by anychance a bit set |
21:48:21 | FromDiscord | <Elegantbeef> Yea that's what i thought |
21:48:22 | FromDiscord | <Elegantbeef> Bitfields |
21:48:53 | FromDiscord | <turbo> (edit) "Isn't that just:↵↵> OPENSSL_VERSION_NUMBER is" => "sent" | "combination of the major, minor and patch version into a single integer 0xMNN00PP0L" => "long message, see http://ix.io/4mPS" |
21:49:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mPT |
21:50:11 | FromDiscord | <turbo> Decoding the values you get indicate version 3 for the first, and version 1 for the seconds, so yeah, it's that compound value documented above |
21:50:19 | FromDiscord | <turbo> (edit) "seconds," => "second," |
21:50:19 | FromDiscord | <Phil> Okay so how do you deal with bitfields? |
21:50:37 | FromDiscord | <Phil> Do I do it manually? Is there a lib? |
21:52:06 | FromDiscord | <Phil> I never ever had to deal with bitfields before so I'm not really sure what I'm staring at |
21:53:15 | FromDiscord | <jtv> Look at the built-in sets, they're bitfields |
21:53:56 | FromDiscord | <Elegantbeef> You can use bitwise math or use an object |
21:54:23 | FromDiscord | <Phil> All I'm currently seeing reading wiki page on bit fields is that they're a custom way to encode data in bit-patterns, at which point I'm even more wtf-ing |
21:54:31 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas |
21:55:02 | FromDiscord | <jtv> Oh, it's just a one-bit data structure; at the machine level, you can set and test bits individually or in parallel for as cheap as any op on the architecture |
21:55:26 | FromDiscord | <Elegantbeef> Instead of doing `myInt shl 16 and 0xff` you can just do `myBitField.field` |
21:55:50 | FromDiscord | <jtv> So when you have a reasonable number of boolean values it's a good space saver I guess. Most people needlessly over-optimize in general though, it's not a big deal for most apps |
21:57:06 | FromDiscord | <Piqueiras> why cant it evaluate at compile time? https://media.discordapp.net/attachments/371759389889003532/1070462826205937765/image.png |
22:00:22 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mPY |
22:00:36 | FromDiscord | <Phil> should the bitsize be the number of bits in a culong? |
22:02:17 | FromDiscord | <jtv> It's the number of true/false values you want to have |
22:02:44 | FromDiscord | <Phil> errr |
22:03:47 | FromDiscord | <Phil> What knowledge would I need to be able to figure out how many true-false values I need?↵Like I know what a bit is, I just have no clue how to interpret neither the original number, nor the bitsize pragma |
22:04:22 | FromDiscord | <Phil> I mean, if I enter 8 I get the number 112 out, which might stand for version 1.1.2?↵But that seems unlikely since the local version should be openssl3 |
22:05:05 | FromDiscord | <Elegantbeef> Read the manual for it |
22:05:26 | FromDiscord | <Elegantbeef> It'd be more like `cast[B](getOpenSslVersion())` |
22:05:55 | FromDiscord | <Phil> Read manual means diving into another comp-sci topic, uuuuuuugh, wiki entry for bit fields here I come >_> |
22:06:17 | FromDiscord | <Elegantbeef> What? |
22:06:22 | FromDiscord | <Elegantbeef> Read the openssl manual for get version |
22:11:18 | * | PMunch quit (Quit: leaving) |
22:11:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQ1 |
22:11:55 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4mQ1" => "https://play.nim-lang.org/#ix=4mQ2" |
22:13:30 | FromDiscord | <huantian> maybe for `long long`? |
22:14:33 | FromDiscord | <huantian> `805306480` in dec is `30000070` in hex |
22:14:54 | FromDiscord | <huantian> so M = `3`, NN = `00`, and PP = `07` |
22:15:10 | FromDiscord | <Phil> Oh god damnit, so take the number, convert to hex and then apply ? |
22:15:27 | FromDiscord | <Phil> yeah, 3.0.7 matches what I have |
22:15:46 | FromDiscord | <hotdog> @Phil `echo (getOpenSSLVersion() shr 28) and 0xF` |
22:16:01 | FromDiscord | <Phil> In reply to @hotdog "<@180601887916163073> `echo (getOpenSSLVersion() sh": You speak in demonic tongues! |
22:16:30 | FromDiscord | <hotdog> It should be major version number 🙂 |
22:17:12 | * | azimut joined #nim |
22:18:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mQ7 |
22:22:21 | FromDiscord | <Phil> That... squints |
22:23:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQ9 |
22:24:12 | FromDiscord | <Phil> The thingy from hotdog works though I have no concept as to why |
22:24:15 | FromDiscord | <Elegantbeef> Might not need packed |
22:24:20 | FromDiscord | <Phil> (edit) "The thingy from hotdog works ... though" added "(returns 3)" |
22:24:23 | FromDiscord | <Elegantbeef> Bit packing |
22:24:32 | FromDiscord | <Phil> Without packed it returns 0 0 0 |
22:25:57 | FromDiscord | <Phil> In reply to @hotdog "<@180601887916163073> `echo (getOpenSSLVersion() sh": Is what you're doing there having a mental image of the binary representation and telling nim "move n bits to the right and start interpreting numbers from there and convert to hex"? |
22:26:05 | FromDiscord | <Phil> (edit) "In reply to @hotdog "<@180601887916163073> `echo (getOpenSSLVersion() sh": Is what you're doing there having a mental image of the binary representation ... and" added "of that number" |
22:28:36 | FromDiscord | <turbo> sent a code paste, see https://play.nim-lang.org/#ix=4mQa |
22:29:09 | FromDiscord | <hotdog> In reply to @Isofruit "Is what you're doing": No sort of shift everything to the right and ignore everything that's now not in the first byte |
22:29:55 | FromDiscord | <turbo> (edit) "https://play.nim-lang.org/#ix=4mQa" => "https://play.nim-lang.org/#ix=4mQb" |
22:31:06 | FromDiscord | <hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4mQc |
22:31:21 | FromDiscord | <turbo> Indeed, good catch |
22:32:04 | FromDiscord | <hotdog> Did you solve your json issue @turbo ? |
22:32:41 | FromDiscord | <turbo> I've paused work on that project for today. Going to play with jsony tomorrow or so |
22:36:14 | FromDiscord | <Elegantbeef> Wait the openssl version stores itself as hex.... |
22:36:39 | FromDiscord | <Elegantbeef> Or am i misreading to unrelated conversations |
22:36:41 | FromDiscord | <Elegantbeef> two\ |
22:36:51 | FromDiscord | <Phil> And today I learned any binary I compile cannot work at the same time with openssl 3 and 1 |
22:38:49 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQg |
22:39:02 | FromDiscord | <Phil> So from what I'm seeing I have to hide them behind when switches |
22:39:20 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4mQg" => "https://paste.rs/grt" |
22:39:42 | FromDiscord | <Elegantbeef> look at `std/dynlib` |
22:42:43 | FromDiscord | <hotdog> In reply to @Elegantbeef "Wait the openssl version": No it's just documented a bit weirdly, the hex part refers to the "0xMNN00PP0L" explanation of how the version numbers are oriented |
22:43:14 | FromDiscord | <Elegantbeef> So then bitfields should work |
22:43:57 | FromDiscord | <hotdog> In reply to @Isofruit "Unless there is some": You need to do similar to what you saw in the openssl wrapper for the getOpenSslVersion impl, which uses std/dynlib as beef mentioned |
22:47:16 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQi |
22:47:35 | FromDiscord | <Phil> The type shouldn't need any additional pragmas I don't think |
22:47:46 | FromDiscord | <Elegantbeef> `{.cdecl.}` |
22:47:56 | FromDiscord | <Elegantbeef> Proc types are by default `closures` |
22:48:35 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/KJ1 |
22:49:00 | FromDiscord | <Elegantbeef> `stdcall` |
22:50:10 | FromDiscord | <Phil> Ohhh is this about how a proc needs a calling convention and "cdecl" gives you one, "stdcall" does as well? |
22:50:59 | FromDiscord | <Elegantbeef> Well Nim's default is `closure` inside type defs |
22:51:23 | FromDiscord | <Elegantbeef> So you need to specify the convention to what the dll expects |
22:55:02 | FromDiscord | <Phil> Is that the same with importc? Does it need cdecl for that reason? |
22:56:22 | FromDiscord | <Elegantbeef> Yes |
22:56:35 | FromDiscord | <Elegantbeef> ABI requires calling conventions to match |
22:56:54 | FromDiscord | <turbo> is there a std method for testing whether one seq contains all elements of another seq (seqs are strings, comparison must be literal case-sensitive)? |
22:57:38 | FromDiscord | <⚶ Zeno> In reply to @turbo "is there a std": if i were you, i would use sets but i think theres better way that somebodt here might know |
22:57:43 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/theindex.html#contains doesnt seem so |
22:57:51 | FromDiscord | <⚶ Zeno> (edit) "somebodt" => "somebody" |
22:59:55 | FromDiscord | <Phil> How necessary is that `unloadLib` ? |
23:00:07 | FromDiscord | <Phil> Like, what are the implications? |
23:00:42 | * | lumo_e quit (Quit: Quit) |
23:02:19 | FromDiscord | <Yepoleb> it just frees up a bit of memory |
23:02:59 | FromDiscord | <Yepoleb> the os will clean it up anyway after your application terminates |
23:07:15 | FromDiscord | <@thatrandomperson5-6310e3b26da03> That is a gitter problem, not mine, and the discord-safe version is already provided by isofruit↵(@hotdog) |
23:07:46 | FromDiscord | <Elegantbeef> The library is not unloaded |
23:07:50 | FromDiscord | <Elegantbeef> So it's still in memory |
23:11:06 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQn |
23:11:23 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4mQn" => "https://play.nim-lang.org/#ix=4mQo" |
23:12:46 | FromDiscord | <Phil> I know that sizeProc points to some location in memory, I get a memory location when I do `echo sizeProc.repr` |
23:13:45 | FromDiscord | <Phil> And I know that `EVP_MD_get_size` must exist because of the docs:↵https://www.openssl.org/docs/man3.0/man3/EVP_MD_get_size.html |
23:14:04 | FromDiscord | <Phil> Where it is described as `int EVP_MD_get_size(const EVP_MD md);` |
23:14:05 | FromDiscord | <Yepoleb> @Phil you leaked your name |
23:14:14 | FromDiscord | <Phil> In reply to @Yepoleb "<@180601887916163073> you leaked your": Nothing I haven't done before |
23:16:29 | * | xet7 joined #nim |
23:17:28 | FromDiscord | <Yepoleb> is EVP_MD a ref type? |
23:18:03 | FromDiscord | <Phil> I think it is (?), it is a digest function |
23:18:11 | FromDiscord | <Yepoleb> i can't find its definition |
23:18:13 | FromDiscord | <Phil> And I just assume that functions are ref types always |
23:18:24 | FromDiscord | <Phil> EVP_MD is just the type of that kind of function |
23:18:37 | FromDiscord | <Phil> And it gets imported from std/openssl |
23:19:36 | FromDiscord | <Phil> https://nim-lang.org/docs/openssl.html#EVP_MD |
23:19:51 | FromDiscord | <Yepoleb> i'd just put two `assert x != nil` before your code that explodes |
23:20:06 | FromDiscord | <Yepoleb> for sizeProc and md |
23:20:45 | FromDiscord | <Elegantbeef> is EVPMD a pointer in Nim? |
23:20:52 | FromDiscord | <Yepoleb> yes |
23:21:13 | FromDiscord | <Phil> Yeah, the sizeProc is what's nil |
23:21:15 | FromDiscord | <Yepoleb> it's `ptr SslStruct` |
23:22:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQr |
23:22:38 | FromDiscord | <Yepoleb> is `lib` already nil` |
23:22:40 | FromDiscord | <Yepoleb> (edit) "nil`" => "nil?" |
23:22:41 | FromDiscord | <Phil> And that is the thing I know should work |
23:23:05 | FromDiscord | <Phil> WTF.... yeah that's the problem |
23:23:17 | FromDiscord | <Phil> `lib != nil` [AssertionDefect] |
23:23:47 | FromDiscord | <Yepoleb> asserts ftw! |
23:24:30 | FromDiscord | <Phil> > `lib != nil` Could not find lib libcrypto.so(.3|.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|) [AssertionDefect] |
23:24:35 | FromDiscord | <Phil> Okay, hmmmm |
23:27:07 | FromDiscord | <Yepoleb> https://media.discordapp.net/attachments/371759389889003532/1070485480015155290/libcrypto.so.1.0.2 |
23:27:30 | FromDiscord | <Yepoleb> legitfreesharedobjects.com |
23:27:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQs |
23:27:52 | FromDiscord | <Phil> Wait |
23:27:53 | FromDiscord | <Phil> No |
23:27:56 | FromDiscord | <Phil> Damnit, there's a star |
23:27:58 | FromDiscord | <Phil> seriously |
23:28:05 | FromDiscord | <Yepoleb> a star in the filename? |
23:28:16 | FromDiscord | <Phil> Yeah no idea either |
23:29:03 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQt |
23:29:11 | FromDiscord | <Yepoleb> what funny os is that? |
23:29:14 | FromDiscord | <Phil> arch |
23:29:23 | FromDiscord | <Yepoleb> lmao |
23:29:33 | FromDiscord | <Yepoleb> sorry |
23:29:46 | FromDiscord | <Yepoleb> arch is not that funny |
23:30:06 | FromDiscord | <Phil> I think that was just my auto-complete adding the star |
23:30:10 | FromDiscord | <Phil> ls-l shows it differently |
23:30:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQv |
23:31:13 | FromDiscord | <Phil> Wait one single gosh darn second |
23:31:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mQx |
23:31:52 | FromDiscord | <Phil> but trying to load `DLLUtilName` (https://nim-lang.org/docs/openssl.html#DLLUtilName) doesn't |
23:33:50 | FromDiscord | <Elegantbeef> `loadLibPattern` |
23:34:46 | FromDiscord | <Phil> Ohhhhhh |
23:35:03 | FromDiscord | <Elegantbeef> there are like 10 procs inside dynlib and you read none of them 😛 |
23:35:06 | FromDiscord | <Phil> Yep that works |
23:35:26 | FromDiscord | <Phil> I read the example and tried to replicate it! I don't read all of strutils either when I need one proc from it! |
23:36:08 | FromDiscord | <Yepoleb> the expert arrived to deliver the answer and a snark 😄 |
23:39:17 | FromDiscord | <Rika> In reply to @Isofruit "I read the example": You don’t? |
23:40:07 | FromDiscord | <Phil> I read all of strutils when I'm bored and curious, not as a first task when I'm in the process for something else |
23:41:17 | FromDiscord | <Elegantbeef> The snark is for my sanity↵(@Yepoleb) |
23:48:20 | * | azimut quit (Ping timeout: 255 seconds) |
23:49:02 | * | azimut joined #nim |
23:54:41 | FromDiscord | <sOkam!> I want to do some interop with C, but still keep control over the Nim code behavior↵At the end, the result needs to be a `.dll` or `.so` that is executed by some other app↵I was thinking of how to approach the glue connection of both↵What gives more control over the interop, writing C that executes Nim, or writing Nim that executes C? |
23:55:23 | FromDiscord | <sOkam!> (edit) "both↵What" => "c-nim↵What" |
23:56:06 | FromDiscord | <Yepoleb> In reply to @Isofruit "I read all of": So you read all of strutils? Name every procedure! |