00:10:41 | FromDiscord | <Patitotective> is there a way i could validate if a string is valid as an identifier? or should i use regex `IDENTIFIER ::= letter ( ['_'] (letter | digit) )`? |
00:18:22 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/strutils.html#validIdentifier%2Cstring |
00:42:19 | FromDiscord | <Zoom> https://forum.nim-lang.org/t/9079 |
00:43:56 | * | \u is now known as meowray |
00:44:03 | * | meowray quit (Changing host) |
00:44:03 | * | meowray joined #nim |
00:46:01 | FromDiscord | <Elegantbeef> So first big thing is you dont need to use cast |
00:46:07 | FromDiscord | <Elegantbeef> you can do ` let r = ^FlowVar[seq[seq[int]]](futures[futIdx])` |
00:46:25 | FromDiscord | <Zoom> Ah, I always forget about conversions... |
00:46:39 | FromDiscord | <Elegantbeef> Secondly this is an orc bug indeed |
00:51:40 | FromDiscord | <Elegantbeef> Cant put my finger on why this get's a nil error |
00:53:29 | FromDiscord | <Zoom> There's #8201 which is too long for this late hour (at my timezone) |
00:54:27 | FromDiscord | <Elegantbeef> I think it's something to do with the destructors and gc reference |
00:54:32 | FromDiscord | <Elegantbeef> thread 2 destructs the sequences whilst thread 1 is attempting to destruct them |
00:55:17 | * | vicfred quit (Quit: Leaving) |
00:56:18 | FromDiscord | <Elegantbeef> Oh expand arc how art thou |
00:57:15 | FromDiscord | <Elegantbeef> No destroy calls inside `splitToTerms` so i guess i'm wrong |
00:59:20 | FromDiscord | <Zoom> It's too late for me to investigate, even if I cared enough. Nighty night and special high five to [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) for being super helpful as usual. |
00:59:49 | FromDiscord | <Elegantbeef> Well i'll shoot you a message if i figure out the high level culprit |
01:00:41 | FromDiscord | <Zoom> Thanks, probably better to put the info in the thread |
01:18:44 | * | neurocyte861449 quit (Ping timeout: 268 seconds) |
01:44:08 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Uqu |
01:44:21 | FromDiscord | <Elegantbeef> No return type on the template |
01:45:10 | FromDiscord | <Patitotective> still same error |
01:45:59 | FromDiscord | <Elegantbeef> are you not doing `a = read("string")` |
01:46:20 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Uqw |
01:47:02 | FromDiscord | <Elegantbeef> Runs fine |
01:47:12 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Uqx |
01:47:21 | FromDiscord | <Elegantbeef> also you should do `path: static string` |
01:47:28 | FromDiscord | <Elegantbeef> And you can also you know use a procedure |
01:47:53 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Runs fine": are you compiling it with `-d:release`? |
01:48:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Uqy |
01:48:12 | * | Gustavo6046_ joined #nim |
01:49:13 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Uqz |
01:49:31 | FromDiscord | <Elegantbeef> ok got the same issue |
01:50:17 | * | Gustavo6046 quit (Ping timeout: 248 seconds) |
01:51:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/yv2 |
01:51:29 | * | Gustavo6046_ quit (Client Quit) |
01:51:47 | * | Gustavo6046 joined #nim |
01:52:12 | FromDiscord | <Elegantbeef> I dont know why it doesnt work as a proper exprression but alas |
01:52:56 | FromDiscord | <Patitotective> 🙃 |
01:54:10 | FromDiscord | <Patitotective> and in here https://nimgl.dev/docs/imgui.html#addFontFromMemoryTTF%2Cptr.ImFontAtlas%2Cpointer%2Cint32%2Cfloat32%2Cptr.ImFontConfig%2Cptr.ImWchar16↵what should i pass in `font_data`? im still confused about pointers |
01:54:57 | FromDiscord | <Elegantbeef> You should pass in your font data, which you probably generated with a procedure call before |
01:56:02 | FromDiscord | <Patitotective> i mean, if i do `"font.ttf".read()`, i get a binary string, right?↵how do i use that data to do the same as `addFronFromFileTTF` |
01:56:24 | FromDiscord | <Elegantbeef> You dont use FromFile |
01:56:28 | FromDiscord | <Elegantbeef> Like i pointed out last time |
01:56:31 | FromDiscord | <Elegantbeef> You use FromMemory |
01:59:39 | * | wyrd quit (Quit: Lost terminal) |
02:00:03 | FromDiscord | <Patitotective> yea but how do i convert the binary string i get from `"font.ttf".slurp()` to hte `font_data` param of `addFontFromMemoryTTF`? |
02:00:15 | FromDiscord | <Patitotective> (edit) "hte `font_data`" => "the `pointer`" |
02:00:25 | * | Gustavo6046_ joined #nim |
02:00:43 | FromDiscord | <Elegantbeef> `myData[0].addr` or `myData[0].unsafeaddr` |
02:01:29 | * | Gustavo6046 quit (Ping timeout: 248 seconds) |
02:01:53 | * | Gustavo6046_ quit (Remote host closed the connection) |
02:02:09 | * | Gustavo6046 joined #nim |
02:22:17 | * | Gustavo6046 quit (Ping timeout: 248 seconds) |
02:30:13 | * | Gustavo6046 joined #nim |
02:32:09 | * | Gustavo6046 quit (Max SendQ exceeded) |
02:33:19 | * | Gustavo6046 joined #nim |
02:36:11 | FromDiscord | <Alea> Say, anyone on the NimSkull team know if there are any plans with regards to variable case insensitivity? Just curious since it's the first criticism I see pop up in many nim discussions |
02:36:22 | FromDiscord | <Alea> (edit) "Say, anyone on the NimSkull team know if there are any plans with regards to variable ... case" added "name" |
02:36:34 | FromDiscord | <Elegantbeef> They havent mentioned it iirc |
02:48:02 | * | arkurious quit (Quit: Leaving) |
03:06:48 | NimEventer | New thread by Veksha: {.nodecl} VS {.importc, nodecl} and return VS result, see https://forum.nim-lang.org/t/9080 |
03:11:32 | FromDiscord | <TryAngle> I'm trying to work with winim and it uses LPSTR which is an alias for ptr Char↵how do I convert a nim string to a ptr Char ? |
03:11:46 | FromDiscord | <Elegantbeef> `cstring` |
03:12:05 | FromDiscord | <Elegantbeef> or `myString[0].addr` |
03:12:45 | * | rockcavera quit (Remote host closed the connection) |
03:13:22 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`cstring`": how do I convert a string to a cstring? |
03:13:34 | FromDiscord | <Elegantbeef> `cstring(myString)` |
03:14:50 | NimEventer | New thread by Archnim: System.sink & System.lent, see https://forum.nim-lang.org/t/9081 |
03:14:55 | FromDiscord | <TryAngle> ok that was kinda obvious 🤣 |
03:15:07 | FromDiscord | <TryAngle> hmm and how do I supply a null ptr ? |
03:15:25 | FromDiscord | <Elegantbeef> `nil` |
03:17:05 | * | jkl quit (Quit: Gone.) |
03:18:06 | * | jkl joined #nim |
03:20:45 | * | SamuelMarks joined #nim |
03:25:45 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`nil`": thanks 🥺 |
03:25:52 | * | SamuelMarks quit (Ping timeout: 260 seconds) |
03:41:18 | * | wyrd joined #nim |
03:42:49 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
04:02:41 | * | wyrd quit (Remote host closed the connection) |
04:02:53 | * | wyrd joined #nim |
04:10:31 | * | slowButPresent quit (Quit: leaving) |
04:21:37 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
04:22:08 | FromDiscord | <TryAngle> is there a difference between 1.0f and 1.0 ? |
04:22:35 | FromDiscord | <Yardanico> yes, but actually no |
04:22:41 | FromDiscord | <Yardanico> ah right, it's just a "yes" |
04:22:45 | FromDiscord | <Yardanico> @TryAngle `f` is float 32 |
04:23:02 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/961118813867368458/unknown.png |
04:23:16 | FromDiscord | <TryAngle> In reply to @Yardanico "<@!147447489316913152> `f` is float": ah ok, so if I work with graphical things I should use f postfix right ? |
04:23:23 | FromDiscord | <Yardanico> idk, it depends on the type |
04:23:31 | FromDiscord | <Yardanico> for float32 you use f, for float64 and float you use `'d` |
04:23:41 | FromDiscord | <Yardanico> or just do "123.0", Nim defaults to 64-bit float |
04:23:46 | FromDiscord | <TryAngle> or wait, when I put them in functions, nim choses correct type anywyas right ? |
04:35:44 | FromDiscord | <xflywind> Hello @PMunch do you have some testcase for futhark regarding https://github.com/nim-lang/Nim/issues/18986 ? I want to verify whether my fix work for futhark too. |
04:35:52 | FromDiscord | <xflywind> (edit) "testcase" => "testcases" |
04:35:57 | FromDiscord | <xflywind> (edit) "work" => "works" |
05:00:47 | FromDiscord | <j-james> by any chance, is there a `Radian` hidden in the stdlib? |
05:00:52 | FromDiscord | <j-james> (edit) "by any chance, is there a `Radian` ... hidden" added "type" |
05:01:46 | FromDiscord | <Rika> In reply to @Alea "Say, anyone on the": i doubt so |
05:02:21 | FromDiscord | <Rika> In reply to @j-james "by any chance, is": dont think so |
05:04:04 | * | zeus-supreme1 joined #nim |
05:07:02 | * | zeus-supreme quit (Ping timeout: 246 seconds) |
05:13:09 | FromDiscord | <huantian> `type Radian = distinct float` boom |
05:14:25 | FromDiscord | <j-james> i may just go with `type Radian = float` for convenience |
05:14:44 | FromDiscord | <Elegantbeef> Eh |
05:14:45 | FromDiscord | <Elegantbeef> What's the point of an alias for radian |
05:15:49 | FromDiscord | <j-james> fair tbh |
05:16:04 | FromDiscord | <Elegantbeef> Use a distinct or just use a float |
05:16:07 | FromDiscord | <j-james> you're usually going to be multiplying them by things that are not radians anyway |
05:27:21 | FromDiscord | <Elegantbeef> So make `(radian, float)` and `(float, radian)` |
06:03:21 | FromDiscord | <morgan> if i have a tree structure, and i want to have a ref stored that points up the tree, how would i go about assigning that in a proc that adds a new node to the tree? |
06:03:33 | FromDiscord | <morgan> would it be `addr`? |
06:04:09 | FromDiscord | <Elegantbeef> You use `ref` and then just grab it |
06:04:42 | FromDiscord | <morgan> `Error: type mismatch: got 'Command' for 'com' but expected 'ref Command'` |
06:04:52 | FromDiscord | <morgan> `parent: com` |
06:04:59 | FromDiscord | <Elegantbeef> What's your type? |
06:05:14 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/961144533230452806/unknown.png |
06:05:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ur5 |
06:05:40 | FromDiscord | <morgan> so i should make the object a ref object |
06:05:48 | FromDiscord | <Elegantbeef> Probably |
06:06:33 | FromDiscord | <Elegantbeef> you could do `ptr Command` and `myCommand.addr`, but generally for this type of stuff you want `ref` |
06:07:34 | FromDiscord | <morgan> yeah |
06:07:54 | FromDiscord | <morgan> it works with it switched over to a ref object and the ref on the parent var removed |
06:11:08 | FromDiscord | <Elegantbeef> Remember `ref` can be `nil` so if you have any uninitialised it'll be nil |
06:12:13 | FromDiscord | <morgan> yeah i have one of the new procs initing that with nil |
06:15:09 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=3Ur6 |
06:15:36 | FromDiscord | <Elegantbeef> `Vertex[T: BDef1|Bdef2|Bdef4|Sdef|Qdef` then `weightDeform: T` |
06:15:37 | FromDiscord | <aph> (edit) "https://play.nim-lang.org/#ix=3Ur6" => "https://play.nim-lang.org/#ix=3Ur7" |
06:15:49 | FromDiscord | <aph> In reply to @Elegantbeef "`Vertex[T: BDef1|Bdef2|Bdef4|Sdef|Qdef` then `weigh": thanks! |
06:15:54 | FromDiscord | <Elegantbeef> `BDef1|Bdef2|Bdef4|Sdef|Qdef` is a generic typeclass of or'd types |
06:16:53 | FromDiscord | <aph> sent a code paste, see https://paste.rs/A3m |
06:17:17 | FromDiscord | <Elegantbeef> Dont know what are `BDef`? |
06:17:45 | FromDiscord | <Tanguy> Yes you need to add a T to PMXFike |
06:17:48 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=3Ur9 |
06:17:51 | FromDiscord | <Tanguy> (edit) "PMXFike" => "PMXFile" |
06:17:55 | FromDiscord | <aph> In reply to @Tanguy "Yes you need to": yeah that resolved it, thanks |
06:18:10 | FromDiscord | <Elegantbeef> You also can just do `T: Deforms` |
06:18:54 | FromDiscord | <aph> In reply to @Elegantbeef "You also can just": heh, i was doing some weird reassign thing. i tried `var Variable: Deforms = Bdef1()` but it didn't work lo |
06:18:55 | FromDiscord | <aph> (edit) "lo" => "lo;" |
06:19:01 | FromDiscord | <aph> (edit) "lo;" => "lol" |
06:19:04 | FromDiscord | <Elegantbeef> If course not |
06:19:26 | FromDiscord | <Elegantbeef> They're `object` not `ref object` they're stack allocated as such cannot be converted between types |
06:19:46 | FromDiscord | <Elegantbeef> If you want them to abide by inheritance use `ref object` and then you can |
06:19:47 | FromDiscord | <aph> ohh |
06:20:37 | FromDiscord | <Elegantbeef> You can only safely convert to `var T` without losing fields, any other conversion copies and loses fields |
06:21:42 | FromDiscord | <aph> yes i'm doing that in my code :) |
06:21:59 | FromDiscord | <Elegantbeef> It looks like you want `ref object` |
06:22:13 | FromDiscord | <Elegantbeef> If you want to be able to assign any `of Deform` to the field |
06:22:55 | FromDiscord | <aph> `ref object` in `Deforms`? |
06:23:05 | FromDiscord | <Elegantbeef> For all of them |
06:23:12 | FromDiscord | <Elegantbeef> all of your inherit objects |
06:23:14 | FromDiscord | <aph> ohh |
06:26:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ura |
06:26:40 | FromDiscord | <Elegantbeef> Though the last one shouldnt have any runtime error |
06:27:03 | FromDiscord | <Elegantbeef> Explicitly upcasting a value type should be valid afaik |
06:27:48 | FromDiscord | <aph> wow |
06:43:43 | FromDiscord | <bryankrn> as someone whos never used operator overloading, nim's operator overloding is cool as hell |
06:44:58 | FromDiscord | <Elegantbeef> Yea it's done in a really swell way |
06:47:06 | FromDiscord | <Phil> I've used it in Java and used it like there, is there a significant difference? |
06:47:29 | FromDiscord | <Elegantbeef> In nim it's very simple and you can have user defined operators |
06:47:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Urd |
06:48:04 | FromDiscord | <Elegantbeef> No fancy keywords, just easy and sensible |
06:48:46 | FromDiscord | <Phil> Also to be on the safe side : I am correct in assuming that generic procs don't play very nicely with overloading, correct? |
06:48:56 | FromDiscord | <Elegantbeef> They do |
06:49:10 | FromDiscord | <Elegantbeef> specialzed is taken over generic |
06:49:28 | * | PMunch joined #nim |
06:50:37 | FromDiscord | <Phil> The scenarios I had were 2 generic procs with the same name but different arguments, I don't recall having used a specialized proc in there anywhere but it's possible I overlooked something |
06:50:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ure |
06:51:56 | FromDiscord | <Elegantbeef> different arguements how? |
06:55:09 | FromDiscord | <Phil> Sorry, different params. They were both called "createHandler" and the second one called the first. First took 4 parameter, second one took 2 parameters and called the first with those 2 and 2 default params. |
06:55:34 | FromDiscord | <Elegantbeef> So what's the issue they're overloadable |
06:55:40 | FromDiscord | <Phil> Everything involved in what I just described was a generic proc, even the handler. |
06:56:28 | FromDiscord | <Phil> It kept trying to use the 2 Param one even when I specified 4 params iirc. I'll play around with that again after work |
06:56:43 | FromDiscord | <Elegantbeef> Nim also has name overloading |
06:57:02 | FromDiscord | <Phil> (edit) "handler." => "parameters." |
06:57:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Urg |
06:57:33 | FromDiscord | <Phil> Holy shit |
06:58:18 | FromDiscord | <Phil> That is legitimately dope and provides a fair amount of more power than Java overloading |
06:58:31 | FromDiscord | <Elegantbeef> Well this is just normal procedure overloading |
06:58:51 | FromDiscord | <Elegantbeef> We also have all this applied to operator overloading 😛 |
06:59:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/sCV |
06:59:10 | FromDiscord | <Elegantbeef> It gets the first symbol |
06:59:43 | FromDiscord | <Elegantbeef> Need macros to get the specific symbols |
06:59:45 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=3Uri |
06:59:56 | FromDiscord | <Phil> Ooof okay that's a bit harsh |
07:00:09 | FromDiscord | <Phil> Good thing I don't typecast procs that way |
07:00:21 | FromDiscord | <Elegantbeef> Eh it's not that bad you can make a quick macro to do it |
07:00:26 | FromDiscord | <Elegantbeef> Especially with micros 😛 |
07:01:12 | FromDiscord | <Elegantbeef> Didnt or dont?↵(@aph) |
07:01:30 | FromDiscord | <aph> don't |
07:01:35 | FromDiscord | <aph> still confused lol |
07:01:50 | FromDiscord | <Elegantbeef> Nim allows you to use the parameter names of a procedure to call a specific prrocedure |
07:02:03 | FromDiscord | <Elegantbeef> You can use the `i = 10` to call the procedure with the `i: int` |
07:02:07 | FromDiscord | <aph> ohh get it now |
07:02:10 | FromDiscord | <aph> woah |
07:02:24 | FromDiscord | <Elegantbeef> I generally dont use it but I just mentioned it |
07:02:33 | FromDiscord | <Phil> Yeh, that was the moment I started using expletives |
07:02:36 | FromDiscord | <Elegantbeef> I only ever use that syntax for optional parameters |
07:03:23 | FromDiscord | <xflywind> https://github.com/nim-lang/RFCs/issues/406#issuecomment-896299144 |
07:12:04 | FromDiscord | <Hamid_Bluri> sent a long message, see http://ix.io/3Urk |
07:16:07 | FromDiscord | <Hamid_Bluri> it seems like I have i ancient clang version |
07:16:14 | FromDiscord | <Hamid_Bluri> (edit) "i" => "a" |
07:16:17 | FromDiscord | <Hamid_Bluri> (edit) "a" => "an" |
07:28:38 | * | jjido joined #nim |
07:37:29 | PMunch | Hmm, is there anything like bswap32 in Nim? |
07:38:08 | FromDiscord | <Elegantbeef> Is that endian stuff? |
07:38:14 | PMunch | Yeah |
07:38:21 | FromDiscord | <Elegantbeef> std/endians |
07:38:22 | PMunch | I guess the endians module can do it |
07:39:00 | PMunch | Hmm, can I pass the same pointer to both arguments? |
07:39:21 | FromDiscord | <Elegantbeef> I think it does a copy so i think so |
07:39:23 | FromDiscord | <Elegantbeef> I could be wrong |
07:39:46 | PMunch | Yeah it seems to work |
07:44:26 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
07:55:11 | NimEventer | New post on r/nim by thindil: [Nim Blog] This Month with Nim: February and March 2022, see https://reddit.com/r/nim/comments/txgxvi/nim_blog_this_month_with_nim_february_and_march/ |
07:56:05 | * | dtomato joined #nim |
07:57:15 | FromDiscord | <aph> can i freely copy code from forum, or are the code from users "All rights reserved" |
07:57:35 | FromDiscord | <aph> (edit) "can i freely copy code from ... forum," added "nim" |
07:57:59 | FromDiscord | <Elegantbeef> As is general no copy write does not mean public domain |
07:59:24 | FromDiscord | <aph> sad |
07:59:32 | FromDiscord | <aph> time to reply "may i copy your code" |
08:05:47 | FromDiscord | <Yardanico> @ElegantBeef no, Nim forum has a specific license for thatm |
08:05:48 | FromDiscord | <Yardanico> (edit) "thatm" => "that" |
08:05:50 | FromDiscord | <Yardanico> you can copy code from it |
08:05:53 | FromDiscord | <Yardanico> lemme find the link |
08:06:01 | FromDiscord | <Yardanico> https://forum.nim-lang.org/about/license |
08:06:04 | FromDiscord | <Yardanico> "All the content contributed to forum.nim-lang.org is cc-wiki (aka cc-by-sa) licensed, intended to be shared and remixed." |
08:06:43 | FromDiscord | <aph> interesting |
08:07:01 | FromDiscord | <aph> wait, if it's ShareAlike does that mean my license should also be under cc-by-sa lol |
08:07:05 | FromDiscord | <aph> (edit) "license" => "code" |
08:07:07 | FromDiscord | <Yardanico> compatible with it |
08:07:48 | FromDiscord | <aph> great |
08:08:14 | FromDiscord | <Yardanico> but yeah, that's a valid point, but I don't know if it's possible to add a specific clause regarding code in this license page |
08:08:38 | FromDiscord | <Yardanico> so that the people posting code on the forum agree to license it under some license like MIT |
08:09:13 | FromDiscord | <aph> > Currently, no non-CC licenses have been designated as compatible with BY-SA 3.0. ↵oh, i guess i do need to use it! |
08:09:20 | FromDiscord | <aph> i have no problem heh |
08:09:26 | FromDiscord | <aph> (edit) "heh" => "with itheh" |
08:09:28 | FromDiscord | <aph> (edit) "itheh" => "it heh" |
08:09:32 | FromDiscord | <Yardanico> GPL is one-way compatible with it I think |
08:09:38 | FromDiscord | <Yardanico> but just ask the author of the post |
08:09:42 | FromDiscord | <Yardanico> what is the post in question? |
08:09:52 | FromDiscord | <Yardanico> i think small enough code doesn't really warrant a license |
08:10:02 | FromDiscord | <Yardanico> if it's something obvious |
08:10:13 | FromDiscord | <aph> https://forum.nim-lang.org/t/5638 #4 |
08:10:42 | FromDiscord | <Yardanico> i don't think you need a license for that, but feel free to ping @Vindaar (he hangs out in #science quite a lot) if you want his explicit permission |
08:10:59 | FromDiscord | <Yardanico> I'd say this is kind of obvious code for Nim |
08:13:07 | FromDiscord | <aph> may thee grant me permission to copy the code @Vindaar ↵Orz |
08:13:23 | FromDiscord | <aph> (edit) "may thee grant me ... permission" added "the" |
08:13:41 | FromDiscord | <aph> (edit) "the" => "thy" |
08:14:35 | FromDiscord | <demotomohiro> That macro looks like fields iterator: https://nim-lang.org/docs/iterators.html#fields.i%2CT |
08:14:38 | FromDiscord | <Vindaar> I hereby grant you, aph, and everyone else on this planet (no aliens allowed!) the right to use that snippet of code. 🤭 |
08:14:55 | FromDiscord | <aph> In reply to @Vindaar "I hereby grant you,": 🛐 |
08:15:08 | FromDiscord | <Yardanico> In reply to @demotomohiro "That macro looks like": yeah, but it works on the instance of the type, not type itself |
08:15:16 | FromDiscord | <Yardanico> like Solitude mentioned in that thread |
08:15:56 | FromDiscord | <Valdar> In reply to @Vindaar "I hereby grant you,": That's racist man 🙂 |
08:16:04 | FromDiscord | <Vindaar> 🤣 |
08:16:25 | FromDiscord | <Vindaar> show me some aliens and I'll change my mind 😍 |
08:16:44 | FromDiscord | <Valdar> <-- |
08:16:50 | FromDiscord | <Vindaar> (I'm just trying to bait them into showing themselves!) |
08:16:56 | FromDiscord | <Vindaar> In reply to @Valdar "<--": your avatar isn't proof enough :/ |
08:17:11 | FromDiscord | <Valdar> fair enuf lol |
08:18:01 | FromDiscord | <demotomohiro> @Yardanico ooh, I didnt read all post excepts #4 in that thread. |
08:20:04 | PMunch | Huh, I've never considered that Nim forum code snippets would be under a license.. |
08:20:32 | PMunch | How is StackExchange in this regard? |
08:24:06 | FromDiscord | <Yardanico> https://stackoverflow.com/help/licensing |
08:24:07 | * | jmdaemon quit (Ping timeout: 260 seconds) |
08:24:14 | FromDiscord | <Yardanico> different versions of CC BY-SA |
08:25:40 | PMunch | Oh damn, I assume that a loooot of commercial software is breaking that license |
08:26:51 | FromDiscord | <aph> ~~time to sue them!~~ |
08:31:05 | PMunch | I wouldn't even be surprised if StackExchange themselves went foul of that license :P |
08:33:41 | * | via__ quit (Ping timeout: 250 seconds) |
08:33:48 | * | via_ joined #nim |
08:39:03 | FromDiscord | <Zoom> What a disgusting xenophobia! 🛸 On the other hand, I doubt our supervisors do much coding on Earth...↵(@Vindaar) |
08:49:01 | * | FromDiscord quit (Ping timeout: 240 seconds) |
08:49:36 | * | FromDiscord joined #nim |
08:50:45 | FromDiscord | <Elegantbeef> I used the code and it exploded my PC, ypu'll be hearing from my lawyerrs↵(@Vindaar) |
08:50:57 | FromDiscord | <Rika> In reply to @Vindaar "I hereby grant you,": Fuck… |
08:52:56 | * | jjido joined #nim |
08:55:23 | FromDiscord | <Elegantbeef> Poor pmunch https://www.reddit.com/r/nim/comments/txgxvi/comment/i3lopp0/?utm_source=share&utm_medium=web2x&context=3 |
08:55:52 | FromDiscord | <Elegantbeef> "A name can only exist for a single thing!" |
08:59:35 | FromDiscord | <Zoom> I think CC BY SA is not the best choice for software, and it's not very compatible. On the other hand, it's copyleft, and that's good. Not as god as GPL2-or-later, of course. |
09:01:11 | FromDiscord | <Yardanico> for some MIT is much better than GPL, just saying ;) |
09:01:35 | FromDiscord | <Elegantbeef> It clearly depends on your views |
09:03:14 | PMunch | I mean the name Futhark is even the name of something other than a programming language |
09:03:30 | PMunch | But no-one seems to mix my tool with the rune alphabet :P |
09:03:32 | FromDiscord | <Elegantbeef> No it's only the language |
09:03:48 | FromDiscord | <Elegantbeef> I dont know i did once and it made it very hard to spell |
09:04:22 | PMunch | Haha, I wonder if runes are in UTF-8 |
09:04:50 | PMunch | Maybe I should rewrite the Futhark source code to only use rune variable names |
09:06:24 | FromDiscord | <Elegantbeef> "Dear reader you might be wondering why i used the rune alphabet and the answer is 'fuck you;" |
09:06:33 | PMunch | Haha, exactly |
09:06:55 | PMunch | I know a Swede who once programmed his keyboard to be able to type runes |
09:07:22 | PMunch | Ah yes, they're in UTF-8 |
09:08:02 | FromDiscord | <Elegantbeef> Of course they are apart of utf8 is "Represent all languages from the past to future" 😛 |
09:08:46 | PMunch | ᚠᚢᚦᚨᚱᚲ |
09:08:49 | FromDiscord | <Zoom> Yeah, the whole block↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:09:52 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/961190997449113601/image.png |
09:09:55 | FromDiscord | <Elegantbeef> Nice utf8 support |
09:11:30 | FromDiscord | <aph> image.png https://media.discordapp.net/attachments/371759389889003532/961191407958261780/image.png |
09:11:35 | FromDiscord | <aph> that worked for me |
09:11:36 | FromDiscord | <aph> weird |
09:11:41 | NimEventer | New thread by Jmgomez: C++ interop via Dynamic Library, see https://forum.nim-lang.org/t/9083 |
09:11:47 | FromDiscord | <Elegantbeef> Different system fonts |
09:15:05 | FromDiscord | <Elegantbeef> Oh and zoom you could do a few things to make that code a bit cleaner but no cigar on make it not crash on orc |
09:19:27 | FromDiscord | <Elegantbeef> For context https://play.nim-lang.org/#ix=3UrH |
09:23:33 | FromDiscord | <Zoom> But your version blocks in order? |
09:23:57 | FromDiscord | <Elegantbeef> It prroduces the same logic |
09:24:05 | FromDiscord | <Elegantbeef> Atleast afaict |
09:24:37 | FromDiscord | <Zoom> Why the hell do we have `blockUntilAny` at all then? |
09:24:51 | FromDiscord | <Elegantbeef> Probably just a case of the complexity of this problem that it behaves the same |
09:24:56 | FromDiscord | <Elegantbeef> Since each step is going to take longer |
09:25:00 | FromDiscord | <Zoom> Yeah, exactly |
09:25:08 | FromDiscord | <Elegantbeef> I dont get why block until any exists really either |
09:25:13 | FromDiscord | <Elegantbeef> we have a `isReady` |
09:25:22 | FromDiscord | <Zoom> It's not really my code, I just tried to show how to use `threadpool`. |
09:25:34 | FromDiscord | <Elegantbeef> Yea i know |
09:26:02 | FromDiscord | <Elegantbeef> Yea i dont get the point of block until any and araq seems to indicate it's not great |
09:26:11 | FromDiscord | <Zoom> Well, I prefer looping polling over stuff to be hidden from plain sight \:) |
09:26:23 | FromDiscord | <Elegantbeef> It also is more readable |
09:26:41 | FromDiscord | <Elegantbeef> `blockUntilAny` sounds like it is a void proc |
09:27:04 | FromDiscord | <Zoom> It's not great for shizzle. |
09:27:33 | FromDiscord | <Elegantbeef> Anyway you can still use `blockUntilAny` with any `FlowVar[T]` |
09:27:42 | FromDiscord | <Elegantbeef> Guess it's what i was trying to point out |
09:29:01 | FromDiscord | <Zoom> returning -1 is one thing. "If there is no flowVar left to be able to wait on, -1 is returned." is basically an instruction to write a while loop on that proc, but it doesn't work that way, embarrassingly. |
09:29:37 | FromDiscord | <Elegantbeef> Yea it really should just be `for x in blockUntil(myFlows)` |
09:30:19 | FromDiscord | <Elegantbeef> Or something better named |
09:30:48 | FromDiscord | <Elegantbeef> I dont know why recently i've just been on an iterator bend, implementing everything i can as them |
09:33:02 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:34:04 | FromDiscord | <Zoom> Doing the lord's work |
09:34:33 | FromDiscord | <Zoom> I think I shall at least write a runnable example for this awful proc |
09:35:09 | FromDiscord | <Elegantbeef> Yea especially for macros it's what i crave |
09:36:21 | FromDiscord | <Elegantbeef> Being able to iterate the parameters of a proc just by doing `for param in myProc.params` or being able to iterate all the overloaded procedures in a symbol just by doing `for decl in mySym.routines`, makes code so much more readable and writable 😛 |
09:39:36 | Amun-Ra | Elegantbeef: is there a way to iterate all the elements in an object too? |
09:39:38 | FromDiscord | <Elegantbeef> Anyway I'm going to go dream of iterators, so buh bye |
10:04:12 | FromDiscord | <aph> generics broke my brain. i need a rest |
10:04:13 | FromDiscord | <aph> lol |
10:04:35 | FromDiscord | <Rika> Okay |
10:23:19 | FromDiscord | <Zoom> Welp, my runnableExample for blockUntilAny SIGSEGVs |
10:23:22 | FromDiscord | <Zoom> https://wandbox.org/permlink/dsu90Kw31Efq4hdM |
10:23:42 | FromDiscord | <Zoom> on Windows, that is. Runs on wandbox, obviously |
10:24:24 | FromDiscord | <Zoom> We can't run with `--threads:on` on playground, right? |
10:25:24 | FromDiscord | <Rika> Nope |
10:26:02 | FromDiscord | <Zoom> Thought so. We can on wandbox though |
10:50:30 | PMunch | Hmm, so I have C library that I'm wrapping. It has a `void *app` field for application specific data. I want to keep a Table of data in this variable. Now I'm not entirely sure how'd I'd do this and not have Nim just clean up the variable.. |
10:50:54 | PMunch | I guess I could just put it in a wrapper object and then just put a pointer to it in that variable |
10:50:58 | PMunch | That might be easiest |
10:52:04 | FromDiscord | <Yardanico> i mean, you can generally store any managed reference in that variable as long as you GC_ref it |
10:52:25 | FromDiscord | <Yardanico> so the refcount won't reach zero and Nim won't clean up the data |
10:52:33 | PMunch | Hmm, that's true |
10:53:18 | PMunch | So the way I've wrapped this so far is to create wrapper objects with destructors that calls the C-free options |
10:53:42 | PMunch | So I could GC_unref in that destructor |
10:53:59 | PMunch | But I could also just keep it in that wrapper object, and let Nim deal with it itself |
11:23:26 | * | jjido joined #nim |
11:34:22 | * | zeus-supreme joined #nim |
11:34:42 | FromDiscord | <Hamid_Bluri> guess what, the program compiles successfully !!!!!!!!!!!↵↵I tried different ways but non of them work https://media.discordapp.net/attachments/371759389889003532/961227446970110032/unknown.png |
11:37:29 | * | zeus-supreme1 quit (Ping timeout: 248 seconds) |
11:37:45 | FromDiscord | <Rika> I believe header only takes in the header name and not a path |
11:41:11 | FromDiscord | <Hamid_Bluri> no |
11:51:39 | * | PMunch quit (Quit: Leaving) |
11:53:18 | * | PMunch joined #nim |
12:04:53 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Usk |
12:05:51 | FromDiscord | <Rika> In reply to @d4rckh "that didnt work, im": Can you show the whole error then |
12:08:55 | FromDiscord | <d4rckh> In reply to @d4rckh "Hello! Why can't I": its here |
12:11:47 | FromDiscord | <Rika> Then can you show what you tried doing |
12:13:31 | FromDiscord | <d4rckh> just trying to echo out an object with a custom type |
12:13:36 | FromDiscord | <d4rckh> which is inherited from another type |
12:14:18 | FromDiscord | <Rika> Can you show the code |
12:15:17 | * | slowButPresent joined #nim |
12:16:40 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Usm |
12:19:49 | FromDiscord | <Rika> Didn’t we tell you to make a to string proc? |
12:28:06 | FromDiscord | <d4rckh> yes.. but im not sure how |
12:33:40 | * | rockcavera joined #nim |
12:33:40 | * | rockcavera quit (Changing host) |
12:33:40 | * | rockcavera joined #nim |
12:55:07 | FromDiscord | <aph> In reply to @d4rckh "yes.. but im not": the "proc \`$\`" thing is a string proc |
12:55:51 | PMunch | Something like this: https://play.nim-lang.org/#ix=3Usw |
13:10:44 | * | dtomato quit (Remote host closed the connection) |
13:11:02 | * | dtomato joined #nim |
13:11:02 | * | dtomato quit (Remote host closed the connection) |
13:11:19 | * | dtomato joined #nim |
13:11:19 | * | dtomato quit (Remote host closed the connection) |
13:11:36 | * | dtomato joined #nim |
13:11:36 | * | dtomato quit (Remote host closed the connection) |
13:12:22 | * | dtomato joined #nim |
13:12:22 | * | dtomato quit (Remote host closed the connection) |
13:12:38 | * | dtomato joined #nim |
13:12:38 | * | dtomato quit (Remote host closed the connection) |
13:12:54 | * | dtomato joined #nim |
13:12:54 | * | dtomato quit (Read error: Connection reset by peer) |
13:13:10 | * | dtomato joined #nim |
13:13:10 | * | dtomato quit (Remote host closed the connection) |
13:13:26 | * | dtomato joined #nim |
13:13:26 | * | dtomato quit (Remote host closed the connection) |
13:13:58 | * | dtomato joined #nim |
13:13:58 | * | dtomato quit (Remote host closed the connection) |
13:14:31 | * | dtomato joined #nim |
13:14:32 | * | dtomato quit (Read error: Connection reset by peer) |
13:14:48 | * | dtomato joined #nim |
13:14:48 | * | dtomato quit (Remote host closed the connection) |
13:15:04 | * | dtomato joined #nim |
13:15:04 | * | dtomato quit (Read error: Connection reset by peer) |
13:15:21 | * | dtomato joined #nim |
13:15:21 | * | dtomato quit (Remote host closed the connection) |
13:15:52 | * | dtomato joined #nim |
13:15:52 | * | dtomato quit (Read error: Connection reset by peer) |
13:16:38 | * | dtomato joined #nim |
13:16:38 | * | dtomato quit (Read error: Connection reset by peer) |
13:16:54 | * | dtomato joined #nim |
13:16:54 | * | dtomato quit (Read error: Connection reset by peer) |
13:17:11 | * | dtomato joined #nim |
13:20:01 | FromDiscord | <Alea> In reply to @Rika "i doubt so": Does anyone actually use that feature? It'd feel weird to not use the same case for every reference to a variable |
13:21:21 | FromDiscord | <Rika> In reply to @Alea "Does anyone actually use": It is important inter-library |
13:21:34 | * | SamuelMarks joined #nim |
13:22:07 | FromDiscord | <Rika> Someone who uses a library that uses snake case and that would want to use camel case |
13:22:23 | NimEventer | New thread by Choltreppe: Problem when casting string to cstring on js backend, see https://forum.nim-lang.org/t/9084 |
13:28:35 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
13:29:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:34:38 | FromDiscord | <Generic> I like to write offsetof instead of offsetOf because that's what I'm used to from C++ |
13:35:50 | FromDiscord | <Generic> though I've also already had some troubles, especially with _ being ignored in identifiers when wrapping a C library |
13:36:24 | FromDiscord | <demotomohiro> case sensitive means you can create variables `filename` and `fileName` in one scope. That can confuse people. |
13:37:40 | FromDiscord | <Rika> you can enforce a lint for in-project files |
13:37:55 | FromDiscord | <Rika> i believe --stylecheck:on would do so |
13:37:57 | FromDiscord | <Rika> not sure |
13:38:01 | PMunch | @Alea, ah you've fallen into the common trap when it comes to case-insensitivity |
13:38:29 | FromDiscord | <Rika> well i understand |
13:38:32 | FromDiscord | <Rika> (edit) "well i understand ... " added "the issue" |
13:38:37 | PMunch | People tend to imagine I create a variable "myVariable" and then later in my code use it as "my_variable". This is obviously not something that people actually do. |
13:38:56 | PMunch | What it is useful for, as @Rika pointer out, is when you import a library someone else has written. |
13:39:15 | FromDiscord | <Generic> https://github.com/switchbrew/libnx/blob/master/nx/include/switch/nvidia/types.h#L379-L380 |
13:39:34 | FromDiscord | <Generic> that was my concrete example which was pretty painful |
13:39:47 | FromDiscord | <Rika> i'd say that's dumb, what's the actual difference? |
13:39:53 | PMunch | In Python for example I might import two different libraries, one using camelCase, and the other using snake_case. This means that my code now has to have mixed styles, not great |
13:39:54 | FromDiscord | <Rika> why is the difference a single underscore? |
13:39:56 | FromDiscord | <Rika> what does it mean? |
13:39:56 | FromDiscord | <Generic> NvColorFormat_V8_U8 and NvColorFormat_V8U8 are two different enums |
13:40:05 | FromDiscord | <Rika> yes but what does that difference mean |
13:40:10 | FromDiscord | <Generic> no idea |
13:40:12 | FromDiscord | <Rika> and isnt that confusing for programmers nonetheless |
13:40:13 | FromDiscord | <Rika> see |
13:40:19 | FromDiscord | <Rika> its a dumb difference |
13:40:42 | PMunch | Nim's style-insensitivity means that I can write my code in whatever casing rules I prefer, regardless of what the libraries I use have opted for. |
13:40:45 | FromDiscord | <Generic> I know, though what should I do when I wrap the C library |
13:41:01 | FromDiscord | <Generic> what I did in the end was replacing all the underscores with v |
13:41:10 | DixieFlatline | Why Discord? |
13:41:11 | FromDiscord | <demotomohiro> `NvColorFormat_V8_U8`, `NvColorFormat_V8U8` and ``NvColorFormat_U8_V8` can confuse me. |
13:41:15 | FromDiscord | <Generic> which doesn't look to bad, because they're all in screaming case |
13:41:46 | FromDiscord | <Generic> ah though Nim identifiers can have unicode symbols, right? |
13:41:52 | PMunch | DixieFlatline, what do you mean? |
13:41:55 | FromDiscord | <Generic> maybe there is some symbol which looks like an underscore |
13:42:19 | PMunch | That would be painful to type though wouldn't it? |
13:42:19 | FromDiscord | <Rika> In reply to @Generic "ah though Nim identifiers": yes but that's diabolical |
13:42:28 | FromDiscord | <Rika> In reply to @DixieFlatline "Why Discord?": ? |
13:42:56 | DixieFlatline | How come yall using Discord except myself and PMunch ? |
13:43:08 | PMunch | What Futhark does in that case is just append specificities to the name until it reaches something unique |
13:43:30 | PMunch | DixieFlatline, not all of them are, but the many different platforms are all routed via Discord I believe |
13:43:33 | FromDiscord | <Rika> In reply to @DixieFlatline "How come yall using": because i want to. how come you're using irc? |
13:43:48 | FromDiscord | <Rika> my point is, so what? |
13:43:56 | FromDiscord | <demotomohiro> !eval var ◎ = 1; let ○ = 2; echo ◎, ○ |
13:43:58 | NimBot | 12 |
13:44:28 | DixieFlatline | Because we've always done it that way. |
13:44:34 | FromDiscord | <Rika> In reply to @demotomohiro "!eval var ◎ =": 正解 |
13:44:38 | PMunch | DixieFlatline, this is how it's all tied together: https://nim-lang.org/blog/2021/06/19/new-community-home.html |
13:45:11 | DixieFlatline | Is there a Discord server written in nim? |
13:45:33 | FromDiscord | <Rika> no |
13:45:46 | FromDiscord | <Rika> discord servers are closed source if you mean that |
13:45:48 | PMunch | The Telegram bridge was taken down though. The Telegram community is surprisingly quite different from this one :P |
13:45:52 | * | arkurious joined #nim |
13:45:53 | PMunch | Lots more memes and such |
13:49:04 | DixieFlatline | Is there an IRC server written in nim? |
13:50:02 | FromDiscord | <Rika> probably not |
13:50:25 | FromDiscord | <Rika> there might be one in github |
13:51:00 | DixieFlatline | Rika: is your avatar Rika Furude? |
13:51:40 | FromDiscord | <Rika> no |
13:52:24 | PMunch | There actually is an IRC server written in Nim: https://github.com/enthus1ast/libch4t |
13:53:24 | nrds | <Prestige99> oh that's cool |
13:57:54 | FromDiscord | <Alea> In reply to @PMunch "What it is useful": Ah true, hadn't considered that, and I'm pretty sure that I do use it for that as well :hmm: |
13:58:18 | * | PMunch quit (Quit: Leaving) |
13:58:47 | DixieFlatline | Rika: Then what Rika is your nickname in reference to? |
13:59:06 | FromDiscord | <Rika> its just a name i picked |
14:00:19 | FromDiscord | <Rika> i know about higurashi though |
14:00:28 | FromDiscord | <Rika> just havent read it, not sure if i will |
14:04:19 | DixieFlatline | muh s t u d i o d e e n |
14:04:25 | * | SamuelMarks joined #nim |
14:19:13 | FromDiscord | <Zoom> That's the ethos of the whole network. Custom stickers everywhere↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
14:42:13 | * | kayabaNerve quit (Ping timeout: 240 seconds) |
14:58:02 | FromDiscord | <jmgomez> is there a way to apply the same pragma to a set of proc? |
14:58:28 | FromDiscord | <Yardanico> there's a `push` pragma for cases like that |
14:58:35 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas |
15:00:00 | FromDiscord | <jmgomez> beautiful, thanks @Yardanico! |
15:07:26 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/CjD |
15:09:05 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/6FA |
15:09:26 | FromDiscord | <jmgomez> (it does work without the push) |
15:11:05 | FromDiscord | <Rika> It’s a limitation |
15:14:39 | * | Gustavo6046 joined #nim |
15:15:38 | * | Gustavo6046 quit (Remote host closed the connection) |
15:16:02 | * | Gustavo6046 joined #nim |
15:33:30 | FromDiscord | <jmgomez> The path to the headers must be relative to the current nim file that includes it or to the execution point? Im trying both (and also with the compiler option cincludes:pathToFolder) but it doesnt pick it up |
15:40:36 | * | noxnivi joined #nim |
15:40:40 | noxnivi | good day |
15:44:59 | * | PMunch joined #nim |
15:49:16 | * | PMunch quit (Client Quit) |
15:50:53 | FromDiscord | <demotomohiro> In reply to @jmgomez "The path to the": If you want your nim file include C/C++ headers, you can put them anywhere and pass `--passC:-I/path/to/include/dir` to Nim. `--passC` option pass the option to backend compiler. |
15:53:43 | FromDiscord | <jmgomez> In reply to @demotomohiro "If you want your": thanks! it was driving me crazy. Couldnt find it on the docs or elsewhere.. |
15:54:19 | FromDiscord | <jmgomez> I need to define all the member by hand, right? |
15:54:58 | FromDiscord | <demotomohiro> `--passC` and `--passL` options are explained in this doc: https://nim-lang.org/docs/nimc.html |
15:55:01 | FromDiscord | <jmgomez> I know how to do the funcs/methods but not sure how to approach the props |
15:55:53 | FromDiscord | <jmgomez> In reply to @demotomohiro "`--passC` and `--passL` options": yeah, I saw them but I was looking for something with "include" "header" etc. |
15:57:32 | FromDiscord | <demotomohiro> There are tools that automatically read C header and generate Nim bindings like c2nim or futhark but it seems they don't support C++. |
15:58:27 | FromDiscord | <demotomohiro> In reply to @jmgomez "yeah, I saw them": "include", "header" is C compiler things. You need to refer C compiler manual. |
15:58:46 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Utl |
15:59:56 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Utm |
16:02:09 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma |
16:04:19 | FromDiscord | <jmgomez> ohh you can keep defining the type in place. Thanks!! |
16:04:24 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Utp |
16:10:27 | FromDiscord | <jmgomez> It does work |
16:33:30 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Utx |
16:36:49 | FromDiscord | <mratsim> In reply to @jmgomez "it works like this": push/pop sometimes doesn't apply user-defined pragmas properly. |
16:39:49 | FromDiscord | <mratsim> sent a long message, see https://paste.rs/kNI |
16:41:02 | FromDiscord | <mratsim> ah no, in my case it was because of needing default constructor |
16:41:52 | FromDiscord | <mratsim> In reply to @jmgomez "Im able to pass": did you compile with --app:lib and --header:foo.h? |
16:42:11 | FromDiscord | <jmgomez> ohh |
16:42:11 | FromDiscord | <jmgomez> yes |
17:20:47 | * | noxnivi quit (Remote host closed the connection) |
17:21:35 | FromDiscord | <TryAngle> does nim have channels similar to rust's crossbeam or tokio library ? |
17:21:52 | * | gsalazar quit (Ping timeout: 272 seconds) |
17:22:29 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UtN |
17:22:46 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3UtN" => "https://play.nim-lang.org/#ix=3UtO" |
17:23:51 | FromDiscord | <Rika> kind of |
17:23:55 | FromDiscord | <Rika> oh wait |
17:23:59 | FromDiscord | <Rika> youre asking if it has |
17:24:00 | FromDiscord | <Rika> yes |
17:24:13 | FromDiscord | <Rika> module `channels` auto-imported when `--threads:on` |
17:24:51 | FromDiscord | <TryAngle> 😳 |
17:25:44 | FromDiscord | <TryAngle> ok time to rewrite my rust app in nim thanks 🥺 |
17:26:54 | FromDiscord | <Rika> https://nim-lang.org/docs/channels_builtin.html |
17:29:45 | FromDiscord | <TryAngle> is there somewhere an example how to use threads in nim?↵I'm looking at the docs but I'm not fully getting it |
17:30:04 | FromDiscord | <Rika> channels has some examples too lol |
17:30:06 | FromDiscord | <Rika> the link i sent |
17:30:17 | FromDiscord | <TryAngle> lol |
17:30:35 | FromDiscord | <TryAngle> thanks 🥺 |
17:35:11 | FromDiscord | <bryankrn> i was installing nim via windows x86_64 and chrome blocked the downlaod, i forcefully installed it and was extracting it and windows says this https://media.discordapp.net/attachments/371759389889003532/961318163646119946/unknown.png |
17:35:15 | FromDiscord | <bryankrn> is this normal or no |
17:39:46 | FromDiscord | <Rika> yes |
17:39:50 | FromDiscord | <Rika> false positive |
17:39:53 | FromDiscord | <bryankrn> ok |
17:41:03 | * | jmdaemon joined #nim |
17:50:49 | FromDiscord | <kevin> In reply to @bryankrn "i was installing nim": Can we take a moment to appreciate how stupid Antivirus is |
17:50:53 | FromDiscord | <kevin> https://twitter.com/ShitSecure/status/1511583637904535552 |
17:51:18 | FromDiscord | <kevin> Nim installer files being flagged by AV ^ |
17:51:53 | FromDiscord | <Zoom> You probably should be using `threading/channels` by now, especially if you're using arc/orc↵(@TryAngle) |
17:51:53 | FromDiscord | <spoon> all i did was write an app that drew over your desktop window and malwarebytes called it a trojan 😔 |
17:52:42 | FromDiscord | <kevin> In reply to @spoon "all i did was": How dare you do something not explicitly whitelisted by AV vendors |
17:52:59 | FromDiscord | <kevin> and BTW that list is different for each AV vendor |
17:53:28 | FromDiscord | <spoon> yea, i just virustotal'd it after i compiled out of curiosity |
17:53:52 | FromDiscord | <spoon> got like 9 flags, malwarebytes was the only one ive heard of |
17:54:07 | FromDiscord | <Rika> things that do anything REMOTELY shady is shady! |
17:55:39 | FromDiscord | <spoon> gotta love when norton security quarantines your dependencies though |
17:56:06 | FromDiscord | <spoon> and it takes like literally a full minute to open so you can unquarentine it |
17:56:38 | FromDiscord | <Rika> yeah thats why i go full yolo and dont have an antivirus on xd |
17:56:42 | * | rockcavera quit (Read error: Connection reset by peer) |
17:57:08 | * | rockcavera joined #nim |
17:57:08 | * | rockcavera quit (Changing host) |
17:57:08 | * | rockcavera joined #nim |
17:57:41 | FromDiscord | <kevin> on a different note, does anyone know how to setup their `config.nims` file to allow compiling multiple binaries at the same time |
17:58:01 | FromDiscord | <Rika> not really how that works i'd say |
17:58:14 | FromDiscord | <kevin> For a build script you're supposed to use setCommand (https://nim-lang.org/docs/nimscript.html#setCommand%2Cstring%2Cstring) maybe? |
17:58:43 | FromDiscord | <kevin> I am trying to define targets in my config.nims file such as `windows`, `linux`, `macosx` and `all` |
17:59:36 | FromDiscord | <kevin> but the `setCommand` proc only compiles after `config.nims` is finished -- only makes the last task in the list, not all of them |
18:00:00 | FromDiscord | <kevin> maybe there is a better way idk |
18:04:23 | * | SamuelMarks quit (Ping timeout: 250 seconds) |
18:04:50 | * | zeus-supreme1 joined #nim |
18:05:39 | FromDiscord | <TryAngle> array[0..255, WCHAR] how do I make this type to a string? |
18:08:06 | * | zeus-supreme quit (Ping timeout: 272 seconds) |
18:17:26 | * | PMunch joined #nim |
18:18:27 | FromDiscord | <TryAngle> In reply to @Zoom "You probably should be": ok will do that, thanks 😄 |
18:19:39 | * | rockcavera quit (Read error: Connection reset by peer) |
18:20:13 | * | rockcavera joined #nim |
18:20:13 | * | rockcavera quit (Changing host) |
18:20:13 | * | rockcavera joined #nim |
18:20:47 | FromDiscord | <TryAngle> In reply to @TryAngle "array[0..255, WCHAR] how do": array[0..255, uint16] |
18:21:19 | * | v9fk1yn3nu joined #nim |
18:31:16 | * | SamuelMarks joined #nim |
18:31:21 | FromDiscord | <нυηтєя> Hai |
18:32:58 | FromDiscord | <enthus1ast> Hi |
18:33:12 | FromDiscord | <TryAngle> `proc _wcsicmp(string1: ptr wchar_t, string2: ptr WCHAR): cint {.importc, header: "corecrt_wstring.h".}`↵how do Import this? nim procs can't start with _ |
18:33:21 | FromDiscord | <нυηтєя> Oo IRC |
18:34:48 | FromDiscord | <TryAngle> (edit) "wchar_t," => "WCHAR," |
18:35:05 | FromDiscord | <enthus1ast> @TryAngle\: import\: "\_wcsicmp' |
18:35:18 | FromDiscord | <enthus1ast> Sorry ↵Importc |
18:35:48 | FromDiscord | <enthus1ast> Argh, ↵importc\: "name" |
18:35:53 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
18:36:38 | FromDiscord | <TryAngle> In reply to @enthus1ast "<@147447489316913152>\: import\: "\_wcsicmp'": thanks |
18:36:57 | FromDiscord | <TryAngle> do you also know how to array[0..255, uint16] convert this to a string / cstring 🥺 |
18:37:40 | FromDiscord | <enthus1ast> i always have to google this / look this up in wnim |
18:37:58 | FromDiscord | <enthus1ast> but afaik wnim has support for wstrings |
18:38:17 | FromDiscord | <enthus1ast> i mean winim |
18:38:19 | FromDiscord | <enthus1ast> ... |
18:38:19 | FromDiscord | <TryAngle> i need to compare two strings |
18:38:30 | FromDiscord | <TryAngle> and one is cstring, the other is array[0..255, uint16] |
18:38:37 | FromDiscord | <TryAngle> winim doens't have this function 😦 |
18:39:12 | FromDiscord | <enthus1ast> then maybe convert both to a nim string or (since you're unsafe anyway) moveMem |
18:40:00 | FromDiscord | <enthus1ast> or maybe even cast is allowed |
18:40:19 | FromDiscord | <TryAngle> ye I ask how I convert 😭 I don't know this 😭 |
18:40:21 | FromDiscord | <TryAngle> (edit) removed "😭" |
18:40:50 | FromDiscord | <TryAngle> I thought I just convert to string and use strutils::cmpIgnoreCase |
18:41:03 | om3ga | how to parse that "2022-03-29 15:09:01.965000000" to dt in times? Seems there is no "." pattern... |
18:42:34 | om3ga | Please ignore |
18:42:41 | om3ga | single quotes helped |
18:42:46 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/times.html |
18:43:10 | om3ga | enthus1ast, thanks, just found about single quotes |
18:54:56 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3Uuu |
18:56:38 | FromDiscord | <Rika> yes {.bitsize: 7.} |
19:00:47 | * | dtomato quit (Read error: Connection reset by peer) |
19:02:05 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Uuy |
19:02:12 | nrds | <Prestige99> Trying to create a destroy hook for an object, getting an error about the proc signature https://i.imgur.com/vPGzJSQ.png |
19:02:20 | FromDiscord | <enthus1ast> but maybe someone knows a better (safer) way |
19:02:23 | FromDiscord | <TryAngle> ah thanks @entusiast but exactly just 1min ago I did a function myself |
19:02:26 | nrds | <Prestige99> tried a few different ways but always get this error |
19:02:30 | FromDiscord | <enthus1ast> jaja |
19:02:33 | FromDiscord | <enthus1ast> haha |
19:02:43 | FromDiscord | <TryAngle> this is what I do |
19:02:47 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Uuz |
19:02:57 | FromDiscord | <enthus1ast> im still at work at 21\:00 here should go home i guess... |
19:02:59 | * | dtomato joined #nim |
19:02:59 | FromDiscord | <TryAngle> but yours is more efficient I guess? |
19:03:07 | FromDiscord | <enthus1ast> prolly |
19:03:15 | FromDiscord | <enthus1ast> but yours is safer |
19:04:31 | nrds | <Prestige99> Or is there some limitation using destroy hooks with inheritable objects? |
19:06:41 | * | LuxuryMode joined #nim |
19:08:49 | FromDiscord | <Rika> T must be not a ref |
19:10:04 | nrds | <Prestige99> So TextBox is a ref object in this case |
19:11:34 | nrds | <Prestige99> destroy hooks don't work for refs? |
19:12:02 | FromDiscord | <Rika> they kinda do, you just have to register it on the object and not the ref |
19:12:13 | nrds | <Prestige99> ah okay, thanks |
19:12:39 | nrds | <Prestige99> Don't know if that's possible with something that's inherited, then |
19:12:51 | nrds | <Prestige99> TextBox is a ref object of Foo |
19:15:06 | * | SamuelMarks joined #nim |
19:19:59 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
19:43:20 | * | Gustavo6046 quit (Remote host closed the connection) |
19:43:46 | * | Gustavo6046 joined #nim |
19:46:49 | * | jjido joined #nim |
19:52:14 | NimEventer | New thread by Prestige: `=destroy` ref object of RootObj?, see https://forum.nim-lang.org/t/9086 |
19:56:53 | * | SamuelMarks joined #nim |
19:58:53 | FromDiscord | <luteva> is there a := operator in nim?↵somthing like:↵ course.appointments := course.appointments + [appointment]↵is that valid nim code? |
19:59:29 | FromDiscord | <exelotl> it's just `=` |
19:59:35 | FromDiscord | <spoon> `:=` does what? |
19:59:56 | FromDiscord | <luteva> don't know! I am just surprised! 🙂 |
20:00:15 | FromDiscord | <exelotl> `:=` is assignment in Pascal-like languages |
20:00:22 | FromDiscord | <spoon> isn't that used in go for creating variables without defining a type or something or am i wrong |
20:00:26 | FromDiscord | <spoon> ah |
20:00:30 | FromDiscord | <exelotl> yes, that too |
20:00:34 | FromDiscord | <spoon> then yeah it's just `=` |
20:01:44 | * | SamuelMarks quit (Ping timeout: 252 seconds) |
20:02:03 | FromDiscord | <luteva> well i just realised that the copilot project has a first public testversion released and i of course wanted to test how it behaves with nim 😄 |
20:02:18 | FromDiscord | <Rika> hint: it doesnt do well |
20:02:28 | FromDiscord | <luteva> yes i see |
20:02:30 | FromDiscord | <luteva> 🙂 |
20:02:46 | FromDiscord | <luteva> but it's impressive anyway! |
20:03:12 | FromDiscord | <spoon> copilot is good for repeating code that is very similar |
20:03:27 | FromDiscord | <spoon> i don't use it to generate procs though, it hasn't worked well even in python |
20:03:38 | FromDiscord | <spoon> or c++ |
20:03:49 | nrds | <Prestige99> it's great for repeating mistakes, too |
20:03:54 | FromDiscord | <luteva> although it makes you laugh from time to time 😉 |
20:04:09 | FromDiscord | <luteva> but that shouldn't be bad.... saves my day 😄 |
20:05:56 | FromDiscord | <Generic> I agree, if it wasn't for python copilot would spit out {} all over the place |
20:06:03 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:06:06 | FromDiscord | <Generic> tabnine is even worse, in Nim code it sometimes tries to add pascal style `end` |
20:06:32 | * | neurocyte861449 joined #nim |
20:06:51 | FromDiscord | <spoon> i used it with nim for a while and it generates the right format after you spend a little time with it |
20:07:52 | FromDiscord | <spoon> or at least it'll take from previous parts of the file |
20:17:29 | * | jmdaemon joined #nim |
20:26:47 | FromDiscord | <TryAngle> how do threads access global objects? |
20:26:57 | FromDiscord | <TryAngle> (edit) "access" => "read/write" |
20:35:34 | FromDiscord | <01> does nim have runtime exceptions/errors? |
20:36:23 | FromDiscord | <Phil> In reply to @Elegantbeef "So what's the issue": Finally got around to look at the issue again |
20:37:44 | * | SamuelMarks joined #nim |
20:39:43 | * | PMunch quit (Quit: leaving) |
20:46:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UuK |
20:48:03 | FromDiscord | <Phil> And even if I do this I get errors, because `readArticleById` assumes that the "P" that I pass in has an "id" field, which is not true for all `P` of `createReadHandler`, some of the P that I use there do not have "id" fields, so that immediately explodes in my face |
20:48:42 | FromDiscord | <Phil> Etc.↵That kind of stuff is why I moved away from overloading generics and rather give them more specific names |
20:54:45 | FromDiscord | <Phil> In reply to @01 "does nim have runtime": Yes |
20:56:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UuL |
20:56:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UuM |
20:56:40 | FromDiscord | <01> thanks |
20:57:24 | FromDiscord | <Zoom> Using a lock. Better think twice about your structure and use message passing if you can↵(@TryAngle) |
21:00:54 | FromDiscord | <morgan> is there a way to get a string representation of a procedural type? |
21:01:00 | FromDiscord | <TryAngle> In reply to @Zoom "Using a lock. Better": is there something like Arc[T] or RwLock[T] like rust has? or does nim use other patterns for that? |
21:01:46 | FromDiscord | <Zoom> @TryAngle\: I recommend going through docs first\: https://nim-lang.org/docs/threads.html https://nim-lang.org/docs/manual.html#threads |
21:02:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UuQ |
21:02:34 | FromDiscord | <Phil> That is, if you absolutely need a global variable |
21:02:40 | FromDiscord | <Phil> Generally, avoid those at all costs |
21:03:14 | FromDiscord | <TryAngle> In reply to @Isofruit "Generally, avoid those at": oh why? I come from rust where this was not doable at all and I thougth global variables were one of nims features? |
21:03:33 | FromDiscord | <Generic> global variables in non library code are good |
21:03:39 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:03:46 | FromDiscord | <Yayko> Hello all, I am in my learning of Nim, and I am on the ref object and the object, can someone explain to me the difference and which one to use in which case please? |
21:03:54 | FromDiscord | <TryAngle> In reply to @Generic "global variables in non": yes I'm writing a program, not a library |
21:03:58 | FromDiscord | <Phil> Global variables are possible, but generally they tend to be a not good idea.↵They add state that can affect your code in harder to predict ways |
21:04:12 | FromDiscord | <TryAngle> In reply to @Isofruit "Global variables are possible,": ah, that's true |
21:04:15 | FromDiscord | <Phil> (edit) "Global variables are possible, but generally they tend to be a not ... good" added "a" |
21:04:35 | FromDiscord | <Zoom> It depends on what you're writing. If it's some short script-like program, go for it. The more LoCs you have, the harder it gets to reason about your code↵(@TryAngle) |
21:04:48 | FromDiscord | <Phil> Avoiding global variables tends to make your code easier to reason about.↵There are scenarios where they're absolutely valid. E.g. I have yet to see a way to do resource pooling without a global variable |
21:05:01 | FromDiscord | <TryAngle> just figured I could use something like a "database" with read and write that is locked so I can avoid channels lol |
21:05:10 | FromDiscord | <Generic> it really depends on what you do |
21:05:48 | FromDiscord | <TryAngle> I want to separate my window / rendering and data processing thread |
21:05:58 | FromDiscord | <Zoom> You can make a shared resource, but it's always better to confine your procs to accessing only their args |
21:07:12 | FromDiscord | <Phil> Err could somebody better than me dive into ref object/object debate for Yayko?↵I for the most part stuck with "don't use ref-object" for some reason so I can't really contribute there |
21:07:32 | FromDiscord | <konsumlamm> In reply to @TryAngle "oh why? I come": there are reasons why Rust doesn't encourage global variables (it has them, but they're limited) and they're a bad idea in other languages too, for mostly the same reasons |
21:07:53 | FromDiscord | <Zoom> @TryAngle\: State is not your friend. The less, the merrier. |
21:08:05 | FromDiscord | <TryAngle> ok that is true zoom and konsumlamm |
21:08:09 | FromDiscord | <Generic> as a rule of thumb ref objects are good for larger objects passed around or in some datastructures like trees |
21:08:10 | FromDiscord | <TryAngle> I agree wit hthat |
21:08:23 | FromDiscord | <Phil> Wait, are non ref objects passed by value? |
21:08:34 | FromDiscord | <Phil> Is that the difference, pass by ref vs. pass by value in procs? |
21:08:50 | FromDiscord | <Generic> no, but once you need to mutate the object you need to use a var parameters |
21:08:51 | FromDiscord | <TryAngle> In reply to @Isofruit "Wait, are non ref": yes but procs that take: `var T` don't |
21:09:13 | FromDiscord | <Generic> and var parameters have limitations like they can't be captured by a closure |
21:09:48 | FromDiscord | <Phil> In reply to @TryAngle "yes but procs that": Yeh, makes sense, if you'd do a pass by value on a var T it wouldn't affect the object outside of the function call |
21:10:24 | FromDiscord | <Generic> they aren't passed by value above a certain size |
21:11:04 | FromDiscord | <TryAngle> In reply to @Generic "they aren't passed by": 🤔 are they a ref then |
21:11:06 | FromDiscord | <Phil> Check, so the pass by X behaviour is independent of the ref/non-ref type? |
21:11:07 | FromDiscord | <TryAngle> (edit) "then" => "then?" |
21:11:58 | FromDiscord | <TryAngle> (edit) "ref" => "referenced" |
21:12:17 | FromDiscord | <Generic> ref are traced pointers, the pass by reference (or rather pointer) for larger objects is hidden by normal Nim value type semantics |
21:12:39 | FromDiscord | <Zoom> Not exactly. References are primarily for many to one relations. They are managed pointers.↵(@Phil) |
21:28:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UuW |
21:29:13 | FromDiscord | <Phil> That is if you want a speaking proc type |
21:29:41 | FromDiscord | <morgan> interesting |
21:30:02 | FromDiscord | <Phil> Otherwise you can just call type() on the proc itself or whatever variable you put it in. ↵For the above code↵`lala.type()` would also work and give you the actual proc signature |
21:30:29 | FromDiscord | <Phil> In this case the output would be `proc (){.gcsafe, locks: 0.} == type proc (){.gcsafe, locks: 0.}` |
21:30:47 | FromDiscord | <morgan> i probably don't need it, i might just have it use a hardcoded copy of the code |
21:30:56 | FromDiscord | <Phil> (edit) removed "0.} == type proc (){.gcsafe, locks:" |
21:31:27 | FromDiscord | <Phil> I think if you can generalize your problem into an outsourced proc with a decent name that's likely better than copy-paste and adjust |
21:31:35 | FromDiscord | <Phil> But that entirely depends on your problem |
21:32:06 | FromDiscord | <Phil> Myself I found passing procs as params around very useful |
21:32:26 | FromDiscord | <Phil> Particularly while giving these types of procs specific names to make their supposed task clear |
21:32:37 | FromDiscord | <Phil> (edit) "Particularly while giving these ... types" added "proc" | removed "of procs" |
21:33:57 | FromDiscord | <morgan> in this case i have a callback type `proc (input: varargs[string, `$`]): void` and callbacks of the form `callbackInt: proc (val: int64): void` also for float, string, bool, and a fuzzy bool object |
21:34:17 | FromDiscord | <morgan> this is for a library and its intended for those to be used by someone using it |
21:34:49 | * | Gustavo6046 quit (Ping timeout: 248 seconds) |
21:35:43 | FromDiscord | <Phil> Given that you're dealing with multiple different types I'm getting a feeling overloads with signatures that accomodate for the various primitive types might be sensible |
21:35:48 | FromDiscord | <morgan> so they could be anything from for flags, setting variable if it's more complex than the mode where it assigns the variable to a stored reference, to large procs with all the logic for a cli app |
21:36:02 | FromDiscord | <Phil> (edit) "Given that you're dealing with multiple different ... types" added "primitive" |
21:36:22 | FromDiscord | <Phil> What's the general purpose of these procs |
21:36:28 | FromDiscord | <Phil> What task do they accomplish? |
21:36:46 | FromDiscord | <morgan> it's how the framework i'm writing will call the code of the user who is using it |
21:36:59 | FromDiscord | <morgan> it parses the cli input and calls their code |
21:37:11 | FromDiscord | <morgan> yes i know others stuff exists that does this |
21:37:19 | FromDiscord | <morgan> im mostly writing this for learning experience |
21:37:22 | FromDiscord | <Phil> Ahh check, so it associates some CLI inputs with a proc to execute |
21:37:26 | FromDiscord | <morgan> yep |
21:38:18 | FromDiscord | <Phil> And you take care of the parsing of the params for them? |
21:38:19 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3UuY |
21:38:22 | FromDiscord | <morgan> yea |
21:38:31 | FromDiscord | <Phil> Hmmm that makes things a bit trickier |
21:39:03 | FromDiscord | <morgan> parsing subcommands, parsing flags, generating help commands automatically, it'll have command aliases |
21:39:29 | FromDiscord | <Phil> So based on flags, subcommands and param types you determine the proc to call |
21:40:10 | FromDiscord | <morgan> so the flag is a variant type and based on that it stores different procs |
21:40:15 | FromDiscord | <morgan> subcommands store one proc |
21:40:30 | FromDiscord | <morgan> flags will be set and call their callbacks first |
21:40:33 | FromDiscord | <morgan> then the subcommand |
21:40:46 | FromDiscord | <morgan> parent commands will not have their procs called |
21:40:55 | FromDiscord | <morgan> any further logic is for the callback to contain |
21:41:40 | FromDiscord | <Phil> Ugh, sorry I think I'm hitting my cognitive limit for the day. It's a cool idea and I'd love to keep chatting about this if you're around the chat once more later, but I can already feel my grasp on the subject matter slipping and I guess I really should be going to sleep |
21:41:50 | FromDiscord | <Phil> (edit) "Ugh, sorry I think I'm hitting my cognitive limit for the day. It's a cool idea ... and" added "for sure" |
21:41:53 | FromDiscord | <morgan> oki |
21:41:55 | FromDiscord | <morgan> gnight |
21:42:11 | FromDiscord | <Phil> Ta and and night everybody |
21:43:35 | * | wyrd quit (Ping timeout: 240 seconds) |
21:50:45 | * | wyrd joined #nim |
22:07:08 | FromDiscord | <Elegantbeef> Amun-Ra yea i do have an API to iterate over elements of an object definiiton aswell |
22:16:02 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
22:16:30 | FromDiscord | <slymilano> Hey guys, how can I solve this `libwinpthread-1.dll` issue for my Nim project? https://github.com/sergiotapia/torrentinim/issues/28 - anyone have this issue for their projects? |
22:16:53 | FromDiscord | <Elegantbeef> Use MSVC i think is the answer |
22:17:01 | FromDiscord | <Elegantbeef> Or ship that dll with the binary |
22:17:41 | FromDiscord | <Elegantbeef> `libwinpthread` is the mingw posix library for pthread afaik, so when you use mingw for compiling you need it |
22:18:15 | FromDiscord | <Elegantbeef> I guess you can also try to statically link it |
22:18:44 | FromDiscord | <Elegantbeef> I assume your mingw is in your user path but not the admin path |
22:19:00 | FromDiscord | <slymilano> I don't have any devtools on my Windows machine. I'm testing this project as an end user. |
22:19:53 | FromDiscord | <slymilano> To statically link I would need to change this command, right? https://github.com/sergiotapia/torrentinim/blob/master/.github/workflows/release_asset.yml#L27 |
22:19:57 | FromDiscord | <Elegantbeef> Then yea if distributing it you may want to consider static linking it or using msvc(think this uses a different thread api) |
22:20:42 | * | rockcavera quit (Read error: Connection reset by peer) |
22:21:00 | FromDiscord | <Elegantbeef> yea it'd be something like `--dynliboverride:winpthread --passL:"-static -lwinpthread` |
22:21:05 | * | rockcavera joined #nim |
22:21:05 | * | rockcavera quit (Changing host) |
22:21:05 | * | rockcavera joined #nim |
22:21:27 | FromDiscord | <Elegantbeef> Assuming you have the `winpthread.a`(or is it .lib for windows dont recal) file on your system |
22:21:40 | FromDiscord | <Elegantbeef> Ah it's `.a` |
22:21:50 | Amun-Ra | Elegantbeef: found another compiler bug, I still haven't reported the previous one |
22:21:54 | FromDiscord | <slymilano> Hm, I don't. I just off the shelf Nim packages. What if I just use `--app:staticlib` would that fetch and static link whatever it needs? |
22:22:10 | Amun-Ra | Elegantbeef: https://github.com/nim-lang/Nim/issues/19694 |
22:22:16 | FromDiscord | <Elegantbeef> actually it might be ` --passL:"-static libwinpthread.a"` |
22:22:29 | FromDiscord | <Elegantbeef> No --staticlib is for exporting a library as static lib |
22:22:46 | FromDiscord | <Elegantbeef> Dont what? |
22:23:41 | FromDiscord | <Elegantbeef> Lol that's kinda funny amun |
22:24:07 | FromDiscord | <Elegantbeef> The reason the top level works is due to nim mangling the name, it doesnt realize it needs to mangle a name inside a procedure |
22:24:47 | FromDiscord | <Elegantbeef> As such https://play.nim-lang.org/#ix=3Uv5 works |
22:24:48 | Amun-Ra | hmm, I haven't checked whether the function needs to be imported from C world or not |
22:25:03 | FromDiscord | <Elegantbeef> It does for this error to happen |
22:25:50 | Amun-Ra | hmm |
22:26:12 | FromDiscord | <Elegantbeef> Nim generates symbols for it's own procedures so this wouldnt happen inside pure Nim |
22:26:50 | Amun-Ra | ah, right |
22:27:15 | FromDiscord | <Elegantbeef> https://wandbox.org/permlink/f6qDVoCViTV4lpk0 if you want to see |
22:27:44 | FromDiscord | <Elegantbeef> It's just a case of "When a variable is the same name as an importedC procedure Nim needs to generate a symbol for the variable" |
22:27:44 | FromDiscord | <slymilano> This seems related to my problem: https://github.com/greenfork/nimraylib_now/issues/66↵↵Not sure how I will include this as part of my github actions Windows build/release process. |
22:28:13 | * | Lord_Nightmare quit (Remote host closed the connection) |
22:28:13 | FromDiscord | <Elegantbeef> I mean does my suggestion not work? |
22:28:19 | FromDiscord | <Elegantbeef> Mingw has the static library |
22:28:28 | FromDiscord | <Elegantbeef> Atleast my linux mingw does, i doubt the windows one doesnt |
22:28:34 | * | Lord_Nightmare joined #nim |
22:28:46 | FromDiscord | <Elegantbeef> `/usr/x86_64-w64-mingw32/lib/libwinpthread.a` at this path if it's any help |
22:29:35 | FromDiscord | <slymilano> Trying to understand your suggestion. So in my Github action I would need to install mingw, find the libwinpthread.a and then use this as part of the build command specifically for Windows: `--dynliboverride:winpthread --passL:"-static -lwinpthread` |
22:31:24 | Amun-Ra | hmm, --dynliboverride:winpthread --passL:libwinpthread.a? |
22:33:04 | FromDiscord | <slymilano> I'll try some stuff out thanks for the recommendations |
22:33:58 | FromDiscord | <TryAngle> is there a way to import enums without their "values"? |
22:34:10 | FromDiscord | <Elegantbeef> You dont need to install mingw it's the default with Nim |
22:34:24 | FromDiscord | <Elegantbeef> What do you mean import enums without their values? |
22:34:31 | FromDiscord | <Elegantbeef> What's the point of an enum without values |
22:35:44 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Uv8 |
22:35:48 | FromDiscord | <TryAngle> something like htat |
22:36:05 | FromDiscord | <TryAngle> so I don't clutter the scope with a lot of "junk" |
22:36:10 | FromDiscord | <Elegantbeef> Ah you want forced namespaces, Nim doesnt have any mechanism to force this anymore |
22:36:38 | FromDiscord | <TryAngle> lol |
22:37:09 | FromDiscord | <Elegantbeef> https://github.com/beef331/micros/blob/master/tests/test1.nim#L127-L149 here's a hack |
22:37:14 | FromDiscord | <Elegantbeef> "clutter the scope" is a sorta silly statement imo, but YMMV |
22:37:22 | FromDiscord | <Elegantbeef> I know prestige wants it |
22:37:34 | FromDiscord | <Elegantbeef> There is just no nice way of enforcing it whilst still allowing user choice |
22:38:29 | FromDiscord | <Elegantbeef> Speaking of prestige, i responded to your forum post if you havent seen |
22:39:02 | FromDiscord | <TryAngle> In reply to @Elegantbeef ""clutter the scope" is": yes in 90% of cases it's silly but now I work with nimgl and winapi and I already get namecollisions in just the hello world, I really want to reduce it a bit |
22:39:25 | FromDiscord | <TryAngle> and nimgl adds huge enums |
22:39:29 | FromDiscord | <TryAngle> (edit) "and nimgl adds huge enums ... " added "for example" |
22:39:39 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Speaking of prestige, i": what forum post o_O |
22:39:49 | FromDiscord | <Elegantbeef> You can do `type MyEnum {.pure.} = enum` |
22:39:53 | FromDiscord | <Elegantbeef> Are you prestige? |
22:40:11 | FromDiscord | <TryAngle> ah lol, I thought u meant the noun |
22:40:11 | FromDiscord | <Generic> you can also use overloadable enums |
22:40:30 | FromDiscord | <TryAngle> (edit) "ah lol, I thought u meant the noun ... " added "and felt slightly attacked XD" |
22:40:57 | FromDiscord | <Elegantbeef> Yep overloadable and pure are both choices |
22:41:00 | FromDiscord | <Elegantbeef> The former is better imo |
22:41:08 | FromDiscord | <Elegantbeef> Though is behind a flag |
22:41:19 | FromDiscord | <TryAngle> yes so I would need to "fork" nimgl? |
22:41:31 | FromDiscord | <TryAngle> (edit) "nimgl?" => "nimgl to use pure pragma?" |
22:42:31 | FromDiscord | <Elegantbeef> Yes |
22:43:28 | FromDiscord | <Elegantbeef> Pure doesnt force `A1.` but it does allow ambiguous fields |
22:52:56 | NimEventer | New thread by Domogled: JsFetch fetch, see https://forum.nim-lang.org/t/9087 |
23:04:38 | FromDiscord | <TryAngle> when should I use doAssert and when assert? |
23:06:31 | FromDiscord | <exelotl> use `doAssert` if you want to check to _always_ happen, or `assert` if you want it to be disabled in a dangerous release build (`-d:danger`), or when `--assertions:off` is passed |
23:06:36 | FromDiscord | <exelotl> (edit) "to" => "the" |
23:08:00 | FromDiscord | <TryAngle> @ElegantBeef |
23:08:03 | FromDiscord | <TryAngle> I am so stupid |
23:08:07 | FromDiscord | <TryAngle> it's already pure lmao https://media.discordapp.net/attachments/371759389889003532/961401949197053992/unknown.png |
23:09:15 | FromDiscord | <Elegantbeef> So there is no issue |
23:10:11 | FromDiscord | <exelotl> it would be cool for `experimental:overloadableEnums` to become stable in 2.0 |
23:10:29 | FromDiscord | <exelotl> (edit) "stable" => "the default" |
23:10:38 | FromDiscord | <Elegantbeef> it will in the next release |
23:11:54 | FromDiscord | <exelotl> oh sweet |
23:13:07 | FromDiscord | <Elegantbeef> 1.8.x not 1.6.x 😛 |
23:13:36 | FromDiscord | <Elegantbeef> atleast afaik i might be misremembering |
23:27:17 | FromDiscord | <TryAngle> also any updates on: https://nim-lang.org/docs/manual_experimental.html#code-reordering ? |
23:33:09 | FromDiscord | <konsumlamm> In reply to @Elegantbeef "1.8.x not 1.6.x 😛": afaik the next release will be 2.0 |
23:33:32 | FromDiscord | <konsumlamm> at least devel is now 2.0 with quite some breaking changes |
23:34:04 | FromDiscord | <konsumlamm> In reply to @TryAngle "also any updates on:": no |
23:34:45 | FromDiscord | <konsumlamm> i'd say "if there were, it would be in the manual", but that wouldn't be true |
23:35:29 | FromDiscord | <Elegantbeef> The update is it'll be removed for an automatic solution |
23:36:08 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/961409000887422976/image.png |
23:36:41 | FromDiscord | <konsumlamm> (that doesn't mean it'll happen any time soon though) |
23:36:54 | FromDiscord | <TryAngle> In reply to @exelotl "use `doAssert` if you": ah I see thanks |
23:36:57 | FromDiscord | <Elegantbeef> soon \:tm\: |
23:37:50 | * | SamuelMarks joined #nim |