00:13:16 | * | Gustavo6046 joined #nim |
00:16:15 | * | vicfred quit (Quit: Leaving) |
00:18:22 | * | Gustavo6046 quit (Excess Flood) |
00:20:06 | * | Gustavo6046 joined #nim |
00:24:00 | FromDiscord | <Varriount> Zevv: How difficult would it be to add an extendable optimizer to NPeg? |
00:24:53 | * | Gustavo6046_ joined #nim |
00:25:40 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
00:27:09 | * | Gustavo6046_ is now known as Gustavo6046 |
00:27:11 | FromDiscord | <Varriount> In particular, an optimizer for deduplicating alternations with choices that share common starting/ending patterns. |
00:28:37 | FromDiscord | <Varriount> For example, `(start_one start_two middle_ONE end_one end_two) | (start_one start_two middle_TWO end_one end_two)` |
00:30:13 | FromDiscord | <Varriount> While I can hand-optimize rules like these, I do have to admit that the unoptimized form is more readable. And it's how the PostgreSQL grammar is structured. |
00:32:47 | * | neurocyte quit (Ping timeout: 252 seconds) |
00:40:55 | * | neurocyte joined #nim |
00:40:55 | * | neurocyte quit (Changing host) |
00:40:55 | * | neurocyte joined #nim |
00:56:34 | * | xet7 quit (Remote host closed the connection) |
00:57:29 | * | xet7 joined #nim |
01:09:22 | FromDiscord | <cabboose> In reply to @Jasmina Kiwi "If you'd like i": You must be a first year student to be cocky enough to throw around being a med student to people who are probably a lot “smarter” than you lol |
01:12:21 | FromDiscord | <cabboose> Also thanks leno for the heads up on the devel break of cps; I’ll keep an eye on it 🙂 |
01:12:51 | FromDiscord | <Elegantbeef> I mean they were talking to me so dont overstate it↵(@cabboose) |
01:15:28 | FromDiscord | <cabboose> Well medical students will never be as cocky as beef |
01:16:55 | FromDiscord | <cabboose> Wait you are self deprecating |
01:16:56 | FromDiscord | <cabboose> awwww |
01:16:57 | FromDiscord | <Elegantbeef> Hey i was saying the exact opposite |
01:16:59 | FromDiscord | <cabboose> cute |
01:17:03 | FromDiscord | <Elegantbeef> Indeed |
01:17:09 | FromDiscord | <cabboose> i dont buy it |
01:30:49 | FromDiscord | <xflywind> In reply to @JSONBash "should https://nim-lang.github.io/Nim/channels_buil": It seems that docs gen becomes more strict. https://github.com/nim-lang/Nim/commit/6c2f041368e36bb7a6b217c7ac0c5de94c7b4a7a |
01:32:01 | * | neurocyte1 joined #nim |
01:32:01 | * | neurocyte1 quit (Changing host) |
01:32:01 | * | neurocyte1 joined #nim |
01:34:34 | * | neurocyte quit (Ping timeout: 260 seconds) |
01:34:34 | * | neurocyte1 is now known as neurocyte |
01:49:49 | FromDiscord | <cabboose> ok this might be a dumb question but with the new nimble what is the equivalent to previously just running `nimble develop` to create a link to a module |
01:50:28 | FromDiscord | <cabboose> because running that with devel nim doesn't function the same as it did before as far as i can see |
01:50:53 | FromDiscord | <cabboose> at least not with the most recent cps repo |
01:51:19 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/8404#54212 |
01:51:35 | FromDiscord | <cabboose> cheers big ears |
01:55:23 | FromDiscord | <cabboose> aw shit how did I miss all this 1.6 chatter |
01:55:27 | FromDiscord | <cabboose> golden |
01:56:58 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
02:14:55 | * | arkurious quit (Quit: Leaving) |
02:16:41 | FromDiscord | <cabboose> so although nim --version on devel still shows 1.5.1 this would be the 1.6 branch no? |
02:17:06 | FromDiscord | <cabboose> or do i need to explicitly use `choosenim '#version-1-6'` (which would fail with koch build error) |
02:17:37 | FromDiscord | <Elegantbeef> Devel is ahead of 1.6's RC afaik |
02:17:48 | FromDiscord | <cabboose> that's fine |
02:17:48 | FromDiscord | <cabboose> cool |
02:17:52 | FromDiscord | <cabboose> cheerio |
02:18:51 | * | Gustavo6046 joined #nim |
03:18:13 | FromDiscord | <aleclarson> do you guys always add `()` when using `options.get`? it looks kinda weird without them, like i'm referencing a proc property or smth |
03:18:52 | FromDiscord | <aleclarson> `foo.get` vs `foo.get()` |
03:19:13 | FromDiscord | <aleclarson> i suppose there's `get foo` too |
03:19:44 | nrds | <Prestige99> I add `()` |
03:19:50 | nrds | <Prestige99> but it's a choice |
03:21:07 | FromDiscord | <aleclarson> i think `get foo` reads best |
03:21:24 | FromDiscord | <cabboose> Yeah but if using method syntax adding the () is best |
03:28:18 | FromDiscord | <aleclarson> i thought `seq` was copy on assign. is this not true for parameters? |
03:29:16 | FromDiscord | <cabboose> I think the compiler chucks in sinks where it can |
03:29:43 | FromDiscord | <cabboose> I'm not sure how good it as at it though |
03:30:19 | FromDiscord | <aleclarson> how do i force a copy of a `seq`? |
03:30:31 | FromDiscord | <cabboose> deepcopy? |
03:31:27 | FromDiscord | <cabboose> oh for a proc though |
03:31:41 | FromDiscord | <Elegantbeef> Well you can not mutate parameters that are not passed as `var` |
03:31:59 | FromDiscord | <Elegantbeef> to copy a seq you just do `var a = yourSeq` |
03:34:19 | FromDiscord | <aleclarson> In reply to @Elegantbeef "to copy a seq": didn't seem to work |
03:34:44 | FromDiscord | <aleclarson> strange thing is, i can't reproduce in playground |
03:35:13 | FromDiscord | <aleclarson> does nim do strange things with tail calls? |
03:35:30 | FromDiscord | <aleclarson> oh, maybe `finally` runs before `except`? |
03:35:52 | FromDiscord | <Elegantbeef> No finally runs after except |
03:35:58 | FromDiscord | <cabboose> Link play dawg |
03:36:35 | FromDiscord | <aleclarson> In reply to @cabboose "Link play dawg": i would if i could reproduce the issue |
03:36:37 | FromDiscord | <cabboose> Except what? |
03:36:54 | FromDiscord | <Elegantbeef> Lol |
03:36:58 | FromDiscord | <cabboose> Ah yeah sorry didn’t see that |
03:39:08 | FromDiscord | <cabboose> I’m too used to using objects I didn’t consider seqs as just being GCd not refs |
03:39:17 | FromDiscord | <cabboose> I’m a monkey anyway |
03:39:26 | FromDiscord | <cabboose> I’m just here to spite beef |
03:54:40 | FromDiscord | <JSONBash> In reply to @flywind "It seems that docs": Cool you got it going so fast! |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
04:06:31 | * | supakeen joined #nim |
04:12:13 | FromDiscord | <aleclarson> kinda bummed that `defer` runs at end of `if` block so i can't deduplicate the condition \:( |
04:12:25 | FromDiscord | <Elegantbeef> What? |
04:13:01 | FromDiscord | <aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3ywF |
04:13:35 | FromDiscord | <Elegantbeef> That's what one would expect |
04:14:19 | FromDiscord | <Elegantbeef> I dont get what "Deduplicate" means in this context though |
04:15:09 | FromDiscord | <aleclarson> sent a code paste, see https://paste.rs/C7U |
04:15:15 | FromDiscord | <aleclarson> assuming there's more stuff after the `if` block that i want done before `undoStuff` runs |
04:17:16 | FromDiscord | <cabboose> Yeah that's what defer should do though |
04:18:52 | FromDiscord | <cabboose> I see what you are lookin for tho |
04:19:51 | FromDiscord | <cabboose> I just started playing with cps |
04:20:07 | FromDiscord | <cabboose> and that can literally provide that functionality lol |
04:20:16 | FromDiscord | <Elegantbeef> Yea i was going to say CPS could do it |
04:20:23 | FromDiscord | <Elegantbeef> Otherwise you can just use a bool |
04:22:26 | FromDiscord | <cabboose> if you look into cps though you'll need to use arc/orc |
04:22:29 | FromDiscord | <cabboose> which is not a bad thing at all |
04:22:55 | FromDiscord | <cabboose> but some libraries are not up to date with being compatible with arc/orc |
04:24:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ywG |
04:24:20 | FromDiscord | <Elegantbeef> maybe without the message inside the code block 😀 |
04:27:50 | FromDiscord | <cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3ywI |
04:27:51 | FromDiscord | <Elegantbeef> Maybe if it was formatted properly |
04:28:01 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3ywH this would though |
04:28:20 | FromDiscord | <Elegantbeef> Not that it's any more readable |
04:29:07 | FromDiscord | <Elegantbeef> Actually we can do this better |
04:29:56 | FromDiscord | <cabboose> you're about to get beefd @aleclarson |
04:30:20 | FromDiscord | <Elegantbeef> Well not that much better 😀 |
04:30:33 | FromDiscord | <cabboose> `raise Defect(nil)` |
04:31:22 | FromDiscord | <Elegantbeef> Metaprogramming not even once https://play.nim-lang.org/#ix=3ywK |
04:32:01 | FromDiscord | <aleclarson> what's that, i think the playground is saying something... "kill... me... please" |
04:32:26 | FromDiscord | <Elegantbeef> Big code block 😀 |
04:32:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ywL |
04:32:53 | FromDiscord | <cabboose> now matrix want to die |
04:33:15 | FromDiscord | <Elegantbeef> Now in hindsight i think you were just joking about the code 😀 |
04:34:06 | FromDiscord | <Elegantbeef> But hey it's like your desired defer so take that |
04:34:15 | FromDiscord | <aleclarson> think i'll just fork nim instead, thx |
04:34:18 | FromDiscord | <aleclarson> \:) |
04:34:29 | FromDiscord | <Elegantbeef> Have fun |
04:34:36 | FromDiscord | <cabboose> I don't even think the resetCond is necessary |
04:34:59 | FromDiscord | <Elegantbeef> It's not if you want to call `doReset` and `dontReset` often |
04:35:12 | FromDiscord | <aleclarson> im jk, i'll just do it the ol fashioned way |
04:35:14 | FromDiscord | <aleclarson> as god intended |
04:35:17 | FromDiscord | <cabboose> just make it DNR() instead |
04:35:21 | FromDiscord | <cabboose> (do not resuscitate) |
04:35:36 | FromDiscord | <Elegantbeef> the old fashioned way is what? |
04:35:47 | FromDiscord | <cabboose> `raise Defect(nil)` |
04:35:57 | FromDiscord | <Elegantbeef> Having a comment that says `#dont move this code`? |
04:36:36 | FromDiscord | <aleclarson> duplicate the `if` condition, and add a test case (jk i don't write tests) |
04:38:05 | * | rockcavera quit (Remote host closed the connection) |
04:38:46 | FromDiscord | <aleclarson> i made a deal with the devil that he'll test my spaghetti and i'll `raise Defect(nil)` in return |
04:40:51 | FromDiscord | <cabboose> why metaprogram when you can metajoke |
04:44:52 | FromDiscord | <aleclarson> that or metaphysics, and im not really in the mood for an existential crisis. maybe in them orning |
04:44:56 | FromDiscord | <aleclarson> (edit) "them orning" => "the morning" |
04:46:50 | FromDiscord | <aleclarson> what's the difference between `name` and `msg` in Exception type? |
04:48:21 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#Exception |
04:49:30 | FromDiscord | <cabboose> Recommond the DevDocs extension on vscode if you use vscode, quick access to docs that can be cached for offline use too |
04:49:54 | FromDiscord | <aleclarson> so `name` equals `"Defect"` if i `raise newException(Defect, "blah")`? |
04:51:17 | FromDiscord | <cabboose> so you can just highlight Exception and run the command to see the documentation for it |
04:51:30 | FromDiscord | <cabboose> From my understanding yes |
04:51:32 | FromDiscord | <Elegantbeef> It should |
05:21:13 | * | neocron joined #nim |
05:23:46 | * | Doraemon quit (Ping timeout: 252 seconds) |
06:02:02 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3yx7 |
06:02:36 | FromDiscord | <Elegantbeef> That does compile |
06:03:33 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3yx8 |
06:03:44 | FromDiscord | <impbox [ftsf]> uhh, hold on, just realised my nim version is 1.0 on this laptop |
06:04:09 | FromDiscord | <Elegantbeef> Ah that's before typedef macros were added |
06:06:59 | FromDiscord | <impbox [ftsf]> \o/ |
06:07:52 | FromDiscord | <Elegantbeef> Assuming you looked at my code the benefit of `static` is you dont get an AST you get the value as is |
06:12:17 | FromDiscord | <treeform> In reply to @cabboose "not unless you specifically": its not a `jsony` bug right? |
06:14:00 | FromDiscord | <treeform> In reply to @arkanoid "yeah! thanks treeform": you welcome |
06:19:44 | FromDiscord | <impbox [ftsf]> ahh dang, i can only edit the typedef, i can't add extra stuff after it like procs using that type |
06:21:15 | FromDiscord | <Elegantbeef> Nah there is a RFC for typesection macros though but yea nothing presently implemented to do as such you need to make your own typedef macro |
06:21:17 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3yxi |
06:31:46 | FromDiscord | <impbox [ftsf]> gotcha |
06:31:50 | FromDiscord | <impbox [ftsf]> that rfc sounds nice |
06:32:05 | FromDiscord | <impbox [ftsf]> though i'm not sure if it would allow this |
06:34:46 | FromDiscord | <Elegantbeef> Ah not a RFC i guess it's a issue https://github.com/nim-lang/Nim/issues/13830 |
06:35:29 | FromDiscord | <impbox [ftsf]> ayup that's what i was looking at |
06:36:59 | FromDiscord | <Elegantbeef> The best way to do what you want to do is to make a template(I seen the forum post) |
06:37:38 | FromDiscord | <impbox [ftsf]> yeah, the template was easy |
06:37:45 | FromDiscord | <impbox [ftsf]> but making it look nice >_> |
06:37:53 | FromDiscord | <Hamid Bluri> https://github.com/alaviss/union↵↵i cant get it |
06:38:51 | FromDiscord | <Hamid Bluri> what does this package do ? |
06:39:14 | FromDiscord | <Elegantbeef> It creates anonymous union values |
06:39:57 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3yxo what's wrong with this imp |
06:40:38 | FromDiscord | <impbox [ftsf]> yeah pretty much what i was doing |
06:40:59 | FromDiscord | <impbox [ftsf]> was just hoping i could keep it tied to the type |
06:41:04 | FromDiscord | <Elegantbeef> Ah |
06:41:07 | FromDiscord | <impbox [ftsf]> rather than having to add it as an extra thing afterwards |
06:41:14 | FromDiscord | <Hamid Bluri> In reply to @Elegantbeef "It creates anonymous union": use case? |
06:41:34 | FromDiscord | <Elegantbeef> Having a variable that can hold a specified variety of types without making a tagged union |
06:42:16 | FromDiscord | <Hamid Bluri> ok, thanks |
06:43:16 | FromDiscord | <Elegantbeef> Yea aside from your own typesection operating macro you cannot do that sadly imp |
06:45:20 | FromDiscord | <Elegantbeef> Still thinking if there is some way one can abuse other features to get it |
06:47:06 | FromDiscord | <impbox [ftsf]> time to learn how to break nim internally! |
06:47:50 | FromDiscord | <impbox [ftsf]> sounds like a fun challenge during post-vax delirium |
07:18:22 | FromDiscord | <Elegantbeef> I've got half of it done with a term rewriting macro, the fun part is trying to make it call the emitted code ;D |
07:19:33 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3yxu |
07:20:04 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/xGV |
07:20:24 | FromDiscord | <haxscramper> This is a bug, that is supposed to work |
07:26:09 | FromDiscord | <impbox [ftsf]> is there a way to make quote do not add gensym? |
07:26:30 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix= |
07:26:32 | FromDiscord | <Elegantbeef> think genast from devel solves issues like that iirc |
07:39:27 | FromDiscord | <Elegantbeef> @impbox [ftsf]\: doesnt work with stable but works on devel https://play.nim-lang.org/#ix=3yxA |
07:39:50 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/886154049911676928/image.png |
07:39:51 | FromDiscord | <Elegantbeef> Lovely output |
07:39:58 | FromDiscord | <impbox [ftsf]> wow magic |
07:40:14 | FromDiscord | <Elegantbeef> term rewriting macros are magic indeed |
07:40:48 | FromDiscord | <Elegantbeef> You can basically do your own post semantic passes if you can use your noggin, though it can be rather confusing |
07:41:04 | FromDiscord | <impbox [ftsf]> _reads up on them_ |
07:41:16 | FromDiscord | <Elegantbeef> Heavily abusing them here, they're typically for making optimizations not for making a whole new variety of macros |
07:41:22 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#term-rewriting-macros well read up |
07:41:37 | FromDiscord | <Elegantbeef> They're basically macros that apply after semantic passing and have a pattern |
07:44:49 | FromDiscord | <Elegantbeef> The biggest issue with that impl is that any`serialize(x)` call gets converted to `doSerialize(x)` |
07:47:06 | FromDiscord | <impbox [ftsf]> pretty impressive you can do such crazy stuff though, kinda hard to follow |
07:48:38 | FromDiscord | <Elegantbeef> I'm surprised it actually sorta works |
07:50:44 | * | max22- joined #nim |
08:18:45 | FromDiscord | <Jasmina Kiwi> In reply to @cabboose "You must be a": I never said im smarter than anyone nor was i cocky and no im a 3rd year med student and i just asked for info and i suggested i can say a few things in return if they wanted |
08:22:42 | FromDiscord | <cabboose> I can smell the elitism from here; I do apologise for my lash out, my meds hadn't kicked in yet and I was a grumpy man |
08:22:50 | FromDiscord | <cabboose> I have a massive aversion to medical students and drs |
08:22:59 | FromDiscord | <cabboose> arrogant until proven otherwise |
08:23:55 | FromDiscord | <cabboose> However trust me when I say the things that these people do is way beyond the scope of difficulty compared to medicine |
08:24:22 | FromDiscord | <impbox [ftsf]> #offtopic pls if you must |
08:24:33 | FromDiscord | <cabboose> fair |
08:24:36 | FromDiscord | <impbox [ftsf]> or better yet not at all |
08:25:09 | FromDiscord | <cabboose> yis I am sorry |
08:25:13 | FromDiscord | <cabboose> that is all |
08:25:25 | * | jjido joined #nim |
08:30:36 | FromDiscord | <Rika> Woah hella drama |
08:34:59 | FromDiscord | <cabboose> image.png https://media.discordapp.net/attachments/371759389889003532/886167927890513940/image.png |
08:52:46 | FromDiscord | <gogolxdong (liuxiaodong)> What's the max length allocation of an array , like array[1 shl 32, uint32]? |
08:54:11 | FromDiscord | <Elegantbeef> I feel like the max size is more of "How big and fast is your swap" |
08:55:08 | FromDiscord | <Rika> No it’s limited by stack size I would believe |
09:17:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:25:33 | FromDiscord | <Varriount> Anyone know how I would begin to debug a Nim program that makes the C compiler use up all my computer's memory? |
09:25:54 | FromDiscord | <Varriount> (16 GiB) |
09:27:20 | FromDiscord | <impbox [ftsf]> cut it in half and test both halves |
09:28:22 | FromDiscord | <impbox [ftsf]> try a different c compiler |
09:36:26 | FromDiscord | <impbox [ftsf]> whoa. super odd behaviour... generating a proc but the output tree is rearranged =\ |
09:37:01 | FromDiscord | <impbox [ftsf]> https://play.nim-lang.org/#ix=3yy0 swaps the order of the last two statements, puts the return before the call to deserialize |
09:46:37 | FromDiscord | <impbox [ftsf]> seems to be caused by using `&` in `newIdentNode` |
09:48:18 | * | max22- quit (Remote host closed the connection) |
09:49:03 | * | max22- joined #nim |
09:54:44 | FromDiscord | <impbox [ftsf]> woo got it working, can now serialize and deserialize a seq of objects with a common base type |
10:05:02 | FromDiscord | <levovix> is there a way to store a `proc() {.closure.}` in `seq[byte]`? |
10:08:04 | FromDiscord | <impbox [ftsf]> pretty sure that's possible, it's just a pointer |
10:08:23 | FromDiscord | <impbox [ftsf]> so you'd be storing the address of the proc as bytes |
10:19:16 | * | Zevv joined #nim |
10:21:00 | FromDiscord | <impbox [ftsf]> (probably not a great idea though) why? |
10:25:55 | FromDiscord | <levovix> I need to make a universal dynamic type, I wanted to store a nim function there |
10:26:36 | FromDiscord | <impbox [ftsf]> why not use a `seq[proc() {.closure.}]` ? |
10:27:46 | FromDiscord | <levovix> because i also need to store other types |
10:28:20 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/system.html#rawEnv%2CT↵https://nim-lang.org/docs/system.html#rawProc%2CT |
10:28:50 | FromDiscord | <demotomohiro> I think such idea would make your program less type safe. |
10:32:03 | FromDiscord | <demotomohiro> You might accidentally read bytes as float that you wrote as int.↵And there is no safety guards to prevent such error. |
11:20:27 | * | supakeen quit (Remote host closed the connection) |
11:20:51 | * | supakeen joined #nim |
12:01:40 | * | max22- quit (Ping timeout: 260 seconds) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
12:06:30 | * | supakeen joined #nim |
12:15:04 | FromDiscord | <auxym> so, nested macros/templates: the inner one is expanded first, and the resulting AST is passed to the outer one, right? |
12:15:10 | FromDiscord | <haxscramper> In reply to @levovix "is there a way": https://nim-lang.org/docs/system.html#rawProc%2CT |
12:16:29 | FromDiscord | <haxscramper> In reply to @levovix "is there a way": https://github.com/haxscramper/hmisc/blob/master/src/hmisc/algo/procbox.nim |
12:21:05 | * | arkurious joined #nim |
12:21:59 | FromDiscord | <auxym> I'm trying to create a macro that creates a whole bunch of `... == ...` expressions, to be called inside unittest's `check` macro, but I get a compile time error: `Error: expression 'cast[int](PORT.DIRCLR0.p) == 1090536452' is of type 'bool' and has to be used (or discarded)` |
12:22:25 | FromDiscord | <haxscramper> In reply to @auxym "so, nested macros/templates: the": https://forum.nim-lang.org/t/8357#53872 |
12:23:55 | FromDiscord | <haxscramper> In reply to @auxym "I'm trying to create": 'check' is an untyped macro, it does some transformations of the passed arguments |
12:24:12 | FromDiscord | <auxym> I see, thanks, so I might have to roll my own "check" that takes `typed`, or just fall back to plain `doAssert`s |
12:24:13 | FromDiscord | <haxscramper> Your macro is evaluated after checks is executed, not before |
12:24:28 | FromDiscord | <auxym> got it |
12:24:46 | FromDiscord | <auxym> so asserts it is for now |
12:56:25 | * | max22- joined #nim |
13:27:29 | NimEventer | New thread by Alexeypetrushin: Is it possible to tell `import` to not create const with same name as imported module?, see https://forum.nim-lang.org/t/8413 |
13:34:05 | * | max22- quit (Remote host closed the connection) |
13:34:34 | * | max22- joined #nim |
13:35:27 | * | neurocyte quit (Quit: The Lounge - https://thelounge.chat) |
13:44:20 | * | max22- quit (Ping timeout: 260 seconds) |
13:45:02 | FromDiscord | <Kiloneie> When having a huge object that needs to be passed around, the best way to do it would be to make it a reference object right ?↵↵And if one has loads of tiny objects to be passed around, one would make the normal/plain objects ? Say a sequence to store a game's bullets ? |
13:45:35 | FromDiscord | <Yardanico> In reply to @Kiloneie "When having a huge": > the best way to do it would be to make it a reference object right ?↵no, nim passes big objects by reference by itself |
13:45:44 | FromDiscord | <Rika> yard too quick 4 me |
13:45:56 | FromDiscord | <Yardanico> ideally you should only use ref objects when you need shared ownership |
13:46:12 | FromDiscord | <Yardanico> or when you can't use `var` arguments, e.g. for async procedures since they get converted to closures |
13:46:14 | FromDiscord | <Rika> many tiny objects passed around are best passed in a contiguous chunk of memory |
13:46:53 | FromDiscord | <Rika> In reply to @Rika "many tiny objects passed": rather a pointer to a contiguous chunk of memory containing such objects |
13:47:25 | FromDiscord | <Yardanico> why would you need to pass that bullet sequence around though? 🤔 won't it be like a part of the scene object? |
13:48:55 | FromDiscord | <Kiloneie> okay wrong question then xD...↵↵I assume that using a sequence with reference object bullets would be better than using plain objects because the memory would never be freed while if bullets are ref objects GC will keep cleaning them up over the course of the game |
13:49:09 | FromDiscord | <Yardanico> wat |
13:49:11 | FromDiscord | <Rika> wat |
13:49:23 | FromDiscord | <Yardanico> as long as the bullet objects are in the seq they won't get deallocated by the GC |
13:49:28 | FromDiscord | <Yardanico> doesn't matter if they're ref objects |
13:50:02 | FromDiscord | <Yardanico> in most cases you really don't need ref objects :P |
13:50:03 | FromDiscord | <Kiloneie> no but when i say bullets, i mean, you shoot 100 , they hit enemies and get destroyed, get off screen get destroyed, then you shoot some more |
13:50:17 | FromDiscord | <Rika> when something is deleted on the seq then (object) it will just plainly be deleted, no freeing necessary (ref) it will be freed by the GC if no other things reference it |
13:50:39 | FromDiscord | <Yardanico> In reply to @Kiloneie "no but when i": it's better to have a seq with non-ref objects and pre-allocate it with some big enough number |
13:50:47 | FromDiscord | <Yardanico> so when you delete/add bullets there are no reallocations needed at all |
13:50:52 | FromDiscord | <Rika> In reply to @Rika "when something is deleted": no freeing necessary if the object has no refs in it as well |
13:51:04 | FromDiscord | <Rika> In reply to @Yardanico "it's better to have": aka newSeqOfCap |
13:51:32 | FromDiscord | <Rika> or maybe just newSeq if you're fine with dealing with empty (and potentially invalid) Bullet objects |
13:52:39 | FromDiscord | <Yardanico> well, another issue is that it's not really efficient to store bullet objects like that, is it? |
13:53:00 | FromDiscord | <Yardanico> since if you e.g. shoot 500 bullets, and first 100 of them get deleted, then you have to delete them from the start of the seq since they were added earlier |
13:53:07 | FromDiscord | <Yardanico> and that's not really fast |
13:53:31 | FromDiscord | <Yardanico> removing from the end is really easy though - just setLen and you're done |
13:53:57 | FromDiscord | <Yardanico> but yes @Kiloneie , in any way, most of the time ref objects are only needed when you want shared ownership |
13:54:05 | FromDiscord | <Yardanico> e.g. store references to the same object in two different places |
13:54:28 | FromDiscord | <Rika> maybe a ring buffer then |
13:54:33 | FromDiscord | <Yardanico> or for specific cases like async where you can't have "var ObjType" in async procs so you are forced to use ref objects |
13:54:59 | FromDiscord | <Yardanico> or maybe I'm wrong and it works now, lemme check |
13:55:44 | FromDiscord | <ant1fact> sent a long message, see http://ix.io/3yzb |
13:55:45 | FromDiscord | <Kiloneie> i hate this subject D: |
13:56:12 | FromDiscord | <Kiloneie> no wonder i quit making the video on it about a year ago |
13:57:51 | FromDiscord | <impbox [ftsf]> hmm trying to use `hasCustomPragma` but apparently it is an undeclared routine despite importing macros |
13:58:23 | * | max22- joined #nim |
13:58:39 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3yzc |
13:59:32 | FromDiscord | <Kiloneie> So to double check, any container that has a dynamic size that gets an element removed from it will have that part of the memory cleared, deallocated right...? |
13:59:52 | FromDiscord | <impbox [ftsf]> unlikely |
14:00:10 | FromDiscord | <Yardanico> In reply to @Kiloneie "So to double check,": no, in most cases it won't |
14:00:11 | FromDiscord | <Rika> not deallocated |
14:00:20 | FromDiscord | <Rika> most of the time not cleared either |
14:00:26 | FromDiscord | <Yardanico> and specifically for Nim sequences - they don't get reallocated to the smaller size |
14:00:39 | FromDiscord | <Rika> though if you're using a security focused container it will definitely be cleared |
14:00:59 | FromDiscord | <Yardanico> so if you create a seq and add 1000 objects then remove all of them except 1 - the seq will still have at least sizeof(objectType) 1000 bytes allocated (actually a bit more because of the seq header) |
14:01:31 | FromDiscord | <Kiloneie> Oh okay |
14:01:39 | FromDiscord | <Rika> In reply to @Yardanico "so if you create": and also because of the growth factor not being exactly a mutliple of 10 |
14:01:40 | FromDiscord | <Rika> lol |
14:02:03 | FromDiscord | <Yardanico> yes :) |
14:03:28 | FromDiscord | <impbox [ftsf]> `mySeq = @[]` will give you a fresh start thoguh |
14:03:31 | FromDiscord | <impbox [ftsf]> (edit) "thoguh" => "though" |
14:03:38 | FromDiscord | <impbox [ftsf]> and the old mem will get GCed |
14:03:53 | FromDiscord | <impbox [ftsf]> i'm not sure about setLen |
14:04:00 | FromDiscord | <Rika> setLen prolly wont |
14:04:18 | FromDiscord | <Yardanico> yeah if you shrink the seq by setLen it's not reallocated |
14:07:26 | FromDiscord | <Kiloneie> I think i get it now, use normal struct objects, got a big one? You can make a pointer or ref? (im not done learning all on nim's pointers). For optimization reasons, essess(whats the word...) the aprox mem needed and pre allocate. For modifying a plain object there is "var" keyword. Ownership... Ref objects owned = unique, i think "let ownedRefObject = smthing" |
14:08:05 | FromDiscord | <Yardanico> arghhh, why didn't you read my message :( |
14:08:27 | FromDiscord | <Yardanico> as I said above, Nim passes big objects by reference itself, you don't have to make big objects `ref`s |
14:08:59 | FromDiscord | <Yardanico> and the part about ref objects - as I said, they should be used when you need _shared_ ownership, not _unique_ ownership |
14:09:00 | FromDiscord | <Kiloneie> Okay but how does it know? There a size cap it checks for? |
14:09:19 | FromDiscord | <Yardanico> In reply to @Kiloneie "Okay but how does": yes, but you shouldn't mention that in a video since it's implementation-dependent :) |
14:10:13 | FromDiscord | <Yardanico> but if you really want to know the limit for pass-by-copy vs pass-by-ref is sizeof(int) 3 |
14:10:31 | FromDiscord | <Yardanico> ah right sortry, it's sizeof(float64) 3 |
14:10:35 | FromDiscord | <Yardanico> (edit) "sortry," => "sorry," |
14:10:40 | FromDiscord | <Kiloneie> Okay i will write this down and butcher my script... |
14:10:59 | FromDiscord | <Kiloneie> For the third time... |
14:11:19 | FromDiscord | <Yardanico> i think it might be better to actually ask all your questions on the forum so you don't post a video with some info that's not right :) |
14:11:37 | FromDiscord | <Rika> In reply to @Yardanico "ah right sorry, it's": dont put this on the script though |
14:11:38 | FromDiscord | <Yardanico> about this sensitive topic about memory |
14:11:39 | FromDiscord | <Kiloneie> The video will go first up as private |
14:11:47 | FromDiscord | <Kiloneie> Im taking no risks with this one |
14:12:55 | FromDiscord | <Kiloneie> Probably gonna be standard procedure from now on, a day in advance as private. |
14:13:16 | FromDiscord | <Kiloneie> Some of these topics are just... Hell... |
14:13:24 | FromDiscord | <Yardanico> do you send the private one to araq or to the forum in general? |
14:13:52 | FromDiscord | <Kiloneie> Probably both? |
14:14:04 | FromDiscord | <Yardanico> sounds good enough |
14:15:26 | FromDiscord | <Rika> private? you mean unlisted right? |
14:15:26 | FromDiscord | <Kiloneie> i should call these videos "preview" right ? |
14:15:29 | FromDiscord | <Kiloneie> no |
14:15:40 | FromDiscord | <Rika> whats the point then? |
14:15:57 | FromDiscord | <Kiloneie> isn't private on YT being if you share link they can see it |
14:16:00 | FromDiscord | <Rika> no |
14:16:01 | FromDiscord | <Kiloneie> unlisted is NONE can |
14:16:02 | FromDiscord | <Rika> thats unlisted |
14:16:07 | FromDiscord | <Rika> private is none |
14:16:17 | FromDiscord | <Yardanico> :D |
14:16:25 | FromDiscord | <Yardanico> yeah, @Kiloneie , unlisted = link only, private = you only |
14:16:31 | FromDiscord | <Rika> i mean its in the name 😛 |
14:16:35 | FromDiscord | <Kiloneie> ohhh okay |
14:16:55 | FromDiscord | <Kiloneie> remembered it wrong |
14:17:07 | FromDiscord | <Yardanico> well actually you can share private videos to other people by their google email addresses |
14:17:56 | FromDiscord | <Rika> yeah but he said forum too so i was suspicious |
14:18:15 | FromDiscord | <Yardanico> well obv it'll be unlisted for the forunm |
14:18:16 | FromDiscord | <Yardanico> (edit) "forunm" => "forum" |
14:18:36 | FromDiscord | <Kiloneie> well if the forum will turn out to be useless i will stop sharing it there, will see how that goes |
14:19:22 | FromDiscord | <Yardanico> well, just name your thread appropriately, like "asking for feedback" |
14:19:33 | FromDiscord | <Yardanico> <video title> - asking for feedback or something like that |
14:23:10 | FromDiscord | <Kiloneie> or PREVIEW OF VIDEO SERIES - VIDEO/EPISODE |
14:23:19 | FromDiscord | <Kiloneie> not all caps of course |
14:23:32 | FromDiscord | <Yardanico> i think preview might be a bit more confusing |
14:23:53 | FromDiscord | <Kiloneie> okay PROTOTYPE then ? |
14:24:04 | FromDiscord | <Yardanico> asking for feedback conveys the fact that you want people to check the video contents more than prototype/preview |
14:24:16 | FromDiscord | <Yardanico> iMO prototype/preview just sounds like you want to share |
14:24:24 | FromDiscord | <Yardanico> and not ask for corrections or something like that |
14:24:30 | FromDiscord | <Kiloneie> okay then |
14:25:55 | FromDiscord | <Rika> maybe "new episode of <name of series> - requesting for feedback" or something |
14:26:26 | FromDiscord | <Yardanico> then "asking for feedback" and "requesting feedback" is almost the same thing though, isn't it? :) |
14:27:18 | FromDiscord | <Rika> o i didnt realise you said that already |
14:29:05 | FromDiscord | <Yardanico> also @Kiloneie you might want to read http://zevv.nl/nim-memory/ if you haven't seen it already |
14:30:05 | FromDiscord | <Kiloneie> no i have not, will look into it |
14:31:33 | FromDiscord | <Yardanico> although some parts are a bit different with ARC/ORC, namely the way seqs and strings are represented in memory |
14:32:15 | FromDiscord | <Kiloneie> okay i will keep that in mind |
15:15:28 | * | supakeen quit (Remote host closed the connection) |
15:15:53 | * | supakeen joined #nim |
15:18:49 | Zevv | Someone should extend that doc to talk about arc one day |
15:25:07 | FromDiscord | <deech> Is there a way to generate a C header with `exportc` modules? |
15:28:03 | FromDiscord | <Rika> i can predict the future and im expecting hax to answer |
15:28:04 | FromDiscord | <Yardanico> In reply to @deech "Is there a way": Don't think so, you'll have to write one yourself |
15:29:16 | FromDiscord | <deech> Thanks! |
15:29:26 | FromDiscord | <Yardanico> but maybe there's some lib that does this that I'm not aware of/forgot |
15:29:36 | FromDiscord | <Yardanico> just like there's https://github.com/treeform/genny for node/python |
15:29:39 | nrds | <R2D299> itHub: 7"Generate a shared library and bindings for many languages." |
15:41:02 | FromDiscord | <treeform> In reply to @Yardanico "just like there's https://github.com/treeform/genny": @deech @Yardanico I have a WIP C header generator in a branch: https://github.com/treeform/genny/pull/18 |
15:43:02 | FromDiscord | <Yardanico> oh cool |
15:44:02 | FromDiscord | <deech> In reply to @treeform "<@!271498588981297157> <@!177365113899057152> I hav": This is really cool! Can't help thinking this would be so much easier if there was direct support in the compiler. I can see the `extern "C" N_LIB_PRIVATE N_NIMCALL ...` line in the generated C/C++, unless I'm missing something it shouldn't be hard to toss that into a header file. |
15:47:29 | FromDiscord | <xflywind> --header:FILE (already deprecated) |
15:48:56 | FromDiscord | <xflywind> https://nim-lang.org/docs/backends.html#interfacing-backend-code-calling-nim |
15:48:57 | * | rockcavera joined #nim |
15:48:57 | * | rockcavera quit (Changing host) |
15:48:57 | * | rockcavera joined #nim |
15:52:20 | FromDiscord | <deech> Wait, what? This seems like exactly what I want! `nim --fullhelp` doesn't even show the `--header` option which is why I didn't know about it! |
15:53:21 | FromDiscord | <deech> Oh wow that adding `--header` worked! |
15:53:44 | FromDiscord | <haxscramper> header is DePreCaTeD |
15:54:38 | FromDiscord | <deech> Why? Seems pretty useful, was it buggy or something? |
15:55:05 | FromDiscord | <deech> I'll ask in `internals`. |
15:55:56 | FromDiscord | <xflywind> it is buggy, so it was removed from --fullhelp |
15:56:03 | FromDiscord | <xflywind> https://github.com/nim-lang/Nim/commit/279df834bae8b6972af6cbcbdd57c1d53e1df9c7 |
15:56:09 | FromDiscord | <xflywind> https://github.com/nim-lang/Nim/issues/4723 |
15:57:31 | * | rockcavera quit (Remote host closed the connection) |
15:58:19 | FromDiscord | <xflywind> maybe someone can deprecate it properly(add a warning and add it back to --fullhelp). |
15:59:35 | FromDiscord | <treeform> In reply to @deech "This is really cool!": I disagree about having C header generator in compiler for exportc. Exportc just does the name mangling, how do you do ref objects? How does GC work? how do you do seq? How do you do overloads? Enums, constants... Many things can't just be exported to C plainly and require opinions and problems to solve. That is why we made genny there is enough to think about. |
16:01:31 | FromDiscord | <Rika> i told you guys hax was gonna answer |
16:02:25 | FromDiscord | <haxscramper> Well, deprecating `--header` without having any suitable alternative (it happened two years ago), because of some random bug seems |
16:03:29 | FromDiscord | <haxscramper> Quite questionable. genny is available now, and it does make sense to have an external tool, but for large APIs etc. it still might be useful |
16:04:10 | FromDiscord | <Rika> i dont think it was just because of some random bug |
16:04:11 | FromDiscord | <haxscramper> Also it might as well be a separate program that uses compiler API |
16:04:19 | FromDiscord | <Rika> i think no one was just willing to maintain it |
16:04:26 | * | stkrdknmibalz quit (Ping timeout: 265 seconds) |
16:10:13 | FromDiscord | <haxscramper> It does not seem to be an overly complicated - after all, what it really needs to to is to copy cgen of every `.exportc.` symbol into separate file |
16:10:40 | FromDiscord | <haxscramper> And that's it, at least that's what I would really expect from it. |
16:11:26 | FromDiscord | <haxscramper> And compiler does already generate all the C code, and all procs are foward-declared in generated C headers as well |
16:26:22 | * | stkrdknmibalz joined #nim |
16:47:40 | FromDiscord | <deech> In reply to @treeform "I disagree about having": I agree with your points, but with orc/arc isn't GC a non issue? TMK there's no need to explicitly spin up/down a Nim runtime to use exported procs. |
16:49:20 | FromDiscord | <treeform> well you still need to export unref for each object for C if you are going to use ref objects in C land. |
16:49:38 | FromDiscord | <treeform> is it simpler yes? do you still have to think about it, also yes. |
16:49:49 | FromDiscord | <Gumber aka Zachary Carter> using ref objects in C land is not simpler I'd argue |
16:50:00 | FromDiscord | <Gumber aka Zachary Carter> and is way less explicit |
16:50:04 | FromDiscord | <Gumber aka Zachary Carter> than custom destructors and pointers |
16:50:11 | FromDiscord | <Gumber aka Zachary Carter> but to each their own... |
16:50:15 | FromDiscord | <treeform> yeah you just need to free them |
16:50:28 | FromDiscord | <Gumber aka Zachary Carter> and ref / unref them |
16:50:33 | FromDiscord | <Gumber aka Zachary Carter> oh you mean pointers |
16:50:38 | FromDiscord | <Gumber aka Zachary Carter> or... |
16:51:24 | FromDiscord | <Gumber aka Zachary Carter> it's say that automatic memory management looses much of its benefit when you have to manually ref and unref objects |
16:52:12 | FromDiscord | <Gumber aka Zachary Carter> and it actually makes things more complicated, because now you have to think about when you need to perform these actions |
16:52:23 | FromDiscord | <Gumber aka Zachary Carter> whereas if you just wrote custom destructors |
16:52:32 | FromDiscord | <Gumber aka Zachary Carter> it makes reasoning about things much simpler |
16:53:19 | FromDiscord | <Gumber aka Zachary Carter> (edit) "it's" => "i'd" |
17:02:35 | FromDiscord | <treeform> C does not have custom destructors |
17:02:45 | FromDiscord | <treeform> I would argue the C api can be made simple |
17:02:51 | FromDiscord | <treeform> when you `new` a ref object you get it |
17:02:59 | FromDiscord | <treeform> then you `unref` when you are done with it. |
17:03:35 | FromDiscord | <treeform> in see you already have to free everything |
17:03:42 | FromDiscord | <treeform> (edit) "see" => "C" |
17:06:36 | FromDiscord | <Gumber aka Zachary Carter> no I'm talking about Nim custom destructors |
17:06:58 | FromDiscord | <Gumber aka Zachary Carter> and passing GC ref'd objects to C code from Nim |
17:07:22 | FromDiscord | <Gumber aka Zachary Carter> basically the opposite of what you're describing |
17:07:47 | FromDiscord | <Gumber aka Zachary Carter> I know C doesn't have destructors or RAII semantics |
17:07:51 | FromDiscord | <Gumber aka Zachary Carter> but Nim does now |
17:08:28 | FromDiscord | <Gumber aka Zachary Carter> (if you use ARC/ORC) |
17:14:02 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3yAn |
17:14:11 | FromDiscord | <treeform> all exported to C |
17:40:08 | FromDiscord | <Gumber aka Zachary Carter> sure |
17:40:20 | FromDiscord | <Gumber aka Zachary Carter> but if you want to pass them around and store references to them |
17:40:40 | FromDiscord | <Gumber aka Zachary Carter> by around - I mean between C and Nim code |
17:40:51 | FromDiscord | <Gumber aka Zachary Carter> you still need to ref and unref them appropriately |
17:41:26 | * | mdbauman joined #nim |
17:46:56 | FromDiscord | <treeform> nim can handle that |
17:47:04 | FromDiscord | <treeform> in C you just need to unref it once you are done |
17:52:37 | FromDiscord | <Gumber aka Zachary Carter> hmm? |
17:52:49 | FromDiscord | <Gumber aka Zachary Carter> if you pass a gc ref'd object to some C code and the C code makes a reference to it |
17:52:55 | FromDiscord | <Gumber aka Zachary Carter> Nim is not going to know that |
17:53:12 | FromDiscord | <Gumber aka Zachary Carter> (edit) "makes" => "stores" |
17:53:35 | FromDiscord | <Gumber aka Zachary Carter> you'd need to GCRef it on the Nim side first |
17:53:41 | FromDiscord | <Rika> ...unless C tells Nim about it |
17:53:44 | FromDiscord | <Gumber aka Zachary Carter> right |
17:53:45 | FromDiscord | <Rika> which is what treeform means i believe |
17:53:51 | FromDiscord | <Gumber aka Zachary Carter> yeah but I'm saying this is a lot of work |
17:53:54 | FromDiscord | <Gumber aka Zachary Carter> and just as dangerous IMO |
17:54:00 | FromDiscord | <Gumber aka Zachary Carter> as just using pointers |
17:54:19 | FromDiscord | <Gumber aka Zachary Carter> in fact I'd say it's more dangerous - but... I guess if you're working on some way to do this automatically |
17:54:27 | FromDiscord | <haxscramper> Can't this be solved by `T copied = copy_T(base value)` |
17:54:29 | FromDiscord | <Gumber aka Zachary Carter> without any overhead from the user - then yeah that'd be really swell |
17:56:24 | FromDiscord | <haxscramper> It gets more problematic when you store refs in the C structs, but overall having ref does not seem more dangerous and cumbersome than free pointer |
17:56:41 | FromDiscord | <haxscramper> At worst you are left with the same bugs as regular pointer |
17:58:29 | FromDiscord | <Gumber aka Zachary Carter> I mean a lot of time you don't have control over the C code you're calling into |
17:59:23 | FromDiscord | <Gumber aka Zachary Carter> but I'm not sure if that factors into this discussion or not |
18:01:43 | FromDiscord | <haxscramper> I'm not sure what C not under my control you refer to. I want to make my nim ref type available to C side, so I expose RefT, and provide memory management functions for it |
18:03:28 | FromDiscord | <haxscramper> These memory management functions allow to create, copy and delete and object, and if copy is correctly used then RefT needs to be freed (unrefed) multiple times. If copy is not used at all I simply need to call unref once |
18:03:46 | FromDiscord | <haxscramper> So it works like a regular pointer, or as poor man's shared\_ptr |
18:05:55 | FromDiscord | <haxscramper> C++ bindigs can just use destructors etc. and do all the ref-unref things internally. |
18:07:22 | FromDiscord | <ant1fact> In reply to @ant1fact "I am planning to": Sorry to bump this, can anyone chime in? ❤️ |
18:08:52 | FromDiscord | <haxscramper> In reply to @ant1fact "Sorry to bump this,": You cant codegen C++ class from nim . The best solution would be to exportc nim procs, then call it on the C++ side |
18:09:15 | FromDiscord | <haxscramper> In reply to @haxscramper "https://github.com/haxscramper/hnimast/blob/master/": This |
18:09:27 | FromDiscord | <haxscramper> Actually next message, with code example |
18:09:52 | FromDiscord | <haxscramper> And I already managed to break and deprecate macro example I linked to so, just follow general idea |
18:10:31 | FromDiscord | <haxscramper> Also if you accept/return any nim types in your proc implementation you would have to put them to header as well |
18:11:21 | FromDiscord | <haxscramper> Actually it is another reason why --header might be useful ... |
18:12:21 | FromDiscord | <ant1fact> wow |
18:12:28 | FromDiscord | <ant1fact> not sure if you just save me days or weeks |
18:12:34 | FromDiscord | <ant1fact> of banging my head against the wall |
18:12:51 | FromDiscord | <haxscramper> @treeform do you plan to support C++ class generation in genny? |
18:13:00 | * | jjido joined #nim |
18:13:09 | FromDiscord | <haxscramper> For this specific kind of problem |
18:14:06 | FromDiscord | <haxscramper> And also for things like general interop with libraries that rely on OOP features. Like qt etc. considering you already would need to implement mapping of the Nim types to C/C++ |
18:15:13 | FromDiscord | <haxscramper> Or would you be interested in me adding support for this? |
18:16:44 | FromDiscord | <haxscramper> I need to (re) implement it either way for qt wrappers, bit having related code on one place would be beneficial in the long run, since this stuff is really general and needed in fair number of places. |
18:17:34 | FromDiscord | <Gumber aka Zachary Carter> In reply to @haxscramper "I'm not sure what": Yeah I guess the use case you're describing differs quite a bit from what I had in mind |
18:17:59 | FromDiscord | <Gumber aka Zachary Carter> Because normally when I interop with C/C++ code I'm consuming C or C++ code from a static or shared library |
18:18:13 | FromDiscord | <Gumber aka Zachary Carter> and I normally don't write that code |
18:18:30 | FromDiscord | <Gumber aka Zachary Carter> I don't have too many situations where I'm writing some code in Nim and then calling it from C or C++ |
18:18:52 | FromDiscord | <Gumber aka Zachary Carter> but I guess in the case of stuff like Qt this is very much necessary |
18:18:57 | FromDiscord | <Gumber aka Zachary Carter> since it's probably like all C++ virtual interfaces |
18:19:04 | FromDiscord | <Gumber aka Zachary Carter> that you have to provide implementations for |
18:19:26 | FromDiscord | <Gumber aka Zachary Carter> sorry - I just guess the context of the discussion went completely over my head initially heh |
18:19:52 | FromDiscord | <haxscramper> yes, those are two separate problems |
18:20:16 | FromDiscord | <Gumber aka Zachary Carter> agreed |
18:23:45 | * | max22- quit (Ping timeout: 260 seconds) |
18:24:19 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3yAI |
18:24:41 | FromDiscord | <Gumber aka Zachary Carter> ugh |
18:24:43 | FromDiscord | <haxscramper> Generating C++ classes requires `#include` of all things that were used in public API for that class |
18:25:15 | FromDiscord | <haxscramper> Which naturally brings us back to genny, since I need to `exportc` all things that were used, in order to be able to include them in C++ again |
18:25:22 | FromDiscord | <Gumber aka Zachary Carter> right |
18:25:28 | FromDiscord | <Gumber aka Zachary Carter> all this for Qt huh? |
18:25:33 | FromDiscord | <haxscramper> yes |
18:25:34 | FromDiscord | <Gumber aka Zachary Carter> jesus... |
18:26:14 | FromDiscord | <haxscramper> And I also need to make sure that generated classes are placed somewhere qt moc can see, because I don't want to reimplement it from scratch |
18:26:40 | FromDiscord | <treeform> In reply to @haxscramper "<@107140179025735680> do you plan": Yes I eventually would like to support C++, and generate the proper OOP features like we do for python/node. |
18:27:11 | FromDiscord | <treeform> In reply to @haxscramper "I need to (re)": I think genny works the other way, you have nim library and what you want to export it to C++ people. |
18:27:33 | FromDiscord | <haxscramper> Qt use case is like both things at once |
18:27:34 | FromDiscord | <treeform> its nim -> X language, not X language -> nim. |
18:27:44 | FromDiscord | <haxscramper> I need to export nim to C++ and then import C++ back to nim |
18:27:58 | FromDiscord | <haxscramper> But nim to C++ comes first |
18:28:10 | FromDiscord | <treeform> ok |
18:36:12 | FromDiscord | <ant1fact> @haxscramper any good alternatives to Qt ? I would like to avoid the troubles you described earlier |
18:36:51 | FromDiscord | <haxscramper> Any other nim gui framework |
18:37:17 | FromDiscord | <haxscramper> I don't do gui, I do qt for the sake of doing qt |
18:37:33 | FromDiscord | <haxscramper> Torture test for hcparse basically |
18:37:46 | FromDiscord | <haxscramper> And for nim interop capabilities |
18:37:52 | FromDiscord | <haxscramper> And for haxdoc as well |
18:37:53 | FromDiscord | <ant1fact> I see |
18:52:45 | * | max22- joined #nim |
18:59:53 | FromDiscord | <treeform> do you have an example of what hexdoc generated output looks like? |
19:01:14 | FromDiscord | <haxscramper> the question is whether I have haxdoc in the first place ... |
19:02:32 | FromDiscord | <haxscramper> And so far the answer is no, I don't. The best I can give you right now is raw data, like json (via jsony), or sql database, or XML. |
19:02:44 | FromDiscord | <treeform> ok not ready yet, got it |
19:17:33 | FromDiscord | <enthus1ast> @ant1fact\: the gtk wrapper is capable (gintro) |
19:18:14 | FromDiscord | <enthus1ast> https://github.com/StefanSalewski/gintro |
19:18:17 | nrds | <R2D299> itHub: 7"High level GObject-Introspection based GTK3/GTK4 bindings for Nim language" |
19:18:48 | FromDiscord | <ant1fact> Many thanks, I will take a look |
19:19:04 | FromDiscord | <enthus1ast> also https://github.com/Dankr4d/BF2142Unlocker |
19:19:07 | nrds | <R2D299> itHub: 7"This project aims to unlock all weapons in BF2142 (coop/lan mode). You can equip/customize your soldier ingame." |
19:19:14 | FromDiscord | <enthus1ast> this is a big application in gintro |
19:20:04 | FromDiscord | <ant1fact> looks pretty good tbh |
19:20:41 | FromDiscord | <QueenFuckingAdrielle> Hiii, quick question.... are generics completely resolved during compilation or is there a runtime cost to performance? |
19:20:59 | NimEventer | New thread by Ggibson: Weave+ARC WIP or my bug?, see https://forum.nim-lang.org/t/8414 |
19:27:54 | FromDiscord | <Rika> In reply to @QueenFuckingAdrielle "Hiii, quick question.... are": Compile time only |
19:28:00 | FromDiscord | <Rika> No runtime cost I believe |
19:28:40 | FromDiscord | <Elegantbeef> Indeed it's all expanded at CT to be a procedure that takes all the args |
19:29:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3yAW |
19:29:39 | FromDiscord | <QueenFuckingAdrielle> okay cool, its my understanding that some languages will end up type casting at runtime, didnt think that was the case with nim though |
19:29:57 | FromDiscord | <Yardanico> usually it's the case with languages that have a VM/bytecode interpreter |
19:30:10 | FromDiscord | <Yardanico> nim is fully statically compiled though, it doesn't have any VM at runtime |
19:30:21 | FromDiscord | <QueenFuckingAdrielle> ahhh i see, yea i heard that about java specifically, but wasn't sure |
19:30:36 | FromDiscord | <QueenFuckingAdrielle> cool, thank you for the help! |
19:59:44 | FromDiscord | <SivadNai> Can anyone find me an example for " https://nim-lang.org/docs/registry.html#getUnicodeValue%2Cstring%2Cstring%2CHKEY " like, say I want to get the value of HKLM\Software\Microsoft\Windows NT\CurrentVersion (sorry to be dim) |
20:01:30 | FromDiscord | <Elegantbeef> Is it not `getUnicodeValue("Software\Microsoft\Windows NT", "CurrentVersion", HkeyLocalMachine)`? |
20:09:30 | FromDiscord | <eliyanov> Hey guys |
20:09:41 | FromDiscord | <SivadNai> I thought so, but that doesn't work for me |
20:10:14 | FromDiscord | <eliyanov> sent a code paste, see https://play.nim-lang.org/#ix= |
20:11:06 | FromDiscord | <eliyanov> sent a long message, see http://ix.io/3yB7 |
20:11:30 | FromDiscord | <eliyanov> sent a code paste, see https://play.nim-lang.org/#ix=3yB8 |
20:11:43 | FromDiscord | <eliyanov> sent a code paste, see https://play.nim-lang.org/#ix=3yB8 |
20:11:57 | FromDiscord | <Yardanico> can you please use playground or some pasting service? |
20:12:01 | FromDiscord | <Yardanico> your code is not being inserted correctly to discord |
20:12:02 | FromDiscord | <Gumber aka Zachary Carter> yeah |
20:12:07 | FromDiscord | <Gumber aka Zachary Carter> stop please |
20:12:10 | FromDiscord | <eliyanov> sent a code paste, see https://play.nim-lang.org/#ix=3yB9 |
20:12:31 | FromDiscord | <SivadNai> my eyes |
20:12:34 | FromDiscord | <Gumber aka Zachary Carter> please use some clipboard service or play.nim-lang.org or something |
20:12:56 | FromDiscord | <Rika> I have long given up my eyes for better abilities |
20:13:07 | FromDiscord | <Yardanico> and also please ask the question itself :) @eliyanov |
20:13:07 | FromDiscord | <Gumber aka Zachary Carter> you a cyborg now? |
20:13:08 | FromDiscord | <eliyanov> If I edit it does it send a new one every time? |
20:13:15 | FromDiscord | <Rika> But seriously who thought changing the matrix bot was a good idea |
20:13:20 | FromDiscord | <Gumber aka Zachary Carter> yes on some bridged channels |
20:13:22 | FromDiscord | <Rika> Yes |
20:13:29 | FromDiscord | <Gumber aka Zachary Carter> but besides - the rule is not to copy and paste large blocks of code in here |
20:13:52 | FromDiscord | <Gumber aka Zachary Carter> you can just leave those unedited |
20:13:59 | FromDiscord | <Gumber aka Zachary Carter> don't worry about it 🙂 |
20:14:02 | FromDiscord | <Yardanico> In reply to @Gumber "but besides - the": well it was the rule before the IRC bridge got proper code pasting support :) |
20:14:09 | FromDiscord | <Yardanico> but the matrix bridge isn't made by me and it has some issues like that |
20:14:16 | FromDiscord | <Gumber aka Zachary Carter> eh either way I think it's best to limit it |
20:14:40 | FromDiscord | <Gumber aka Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=3yBb |
20:14:46 | FromDiscord | <Gumber aka Zachary Carter> and it's a PITA to scroll through for logs |
20:15:00 | FromDiscord | <eliyanov> Okay I'll try asking with words. If I want to assign the result of a macro that happens to be an ObjectTy block, why does it say "Error\: invalid expression\: object ..." |
20:15:00 | FromDiscord | <Gumber aka Zachary Carter> you da boss tho 😉 |
20:15:46 | FromDiscord | <Yardanico> @eliyanov because IIRC you have to generate the whole typedef block yourself] |
20:15:47 | FromDiscord | <Yardanico> (edit) "yourself]" => "yourself" |
20:15:50 | FromDiscord | <Yardanico> I think you can't just do `type Dat = typeDef(@["name"], @["string"])` |
20:15:54 | FromDiscord | <Gumber aka Zachary Carter> you need to return a nimnode |
20:16:05 | FromDiscord | <Yardanico> you have to do typedef(Dat, ...) and generate `type Dat` inside of the macro |
20:16:08 | FromDiscord | <Gumber aka Zachary Carter> and it needs to be a statement list |
20:16:26 | FromDiscord | <Yardanico> In reply to @Gumber "and it needs to": not neccesarily |
20:16:30 | FromDiscord | <Yardanico> (edit) "neccesarily" => "necessarily" |
20:16:37 | FromDiscord | <Gumber aka Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=3yBc |
20:16:41 | FromDiscord | <eliyanov> Why does it work with procTy blocks though |
20:16:42 | FromDiscord | <Gumber aka Zachary Carter> yeah you're right |
20:17:00 | FromDiscord | <SivadNai> Ah, it is getUnicodeValue("Software\\Microsoft\\Windows NT\\CurrentVersion", "CurrentVersion", registry.HKEY_LOCAL_MACHINE) |
20:18:31 | FromDiscord | <SivadNai> I would almost be tempted to update the documentation there |
20:25:27 | FromDiscord | <Gumber aka Zachary Carter> In reply to @eliyanov "Why does it work": I think this is because when you do it with a proc, you're still generating the entire proc inside the macro |
20:25:49 | FromDiscord | <Gumber aka Zachary Carter> if you're putting it on the right hand side of the assignment operator, then you're creating essentially a function pointer |
20:26:11 | FromDiscord | <Gumber aka Zachary Carter> unless you mean you can do like |
20:26:40 | FromDiscord | <Gumber aka Zachary Carter> `type MyFunctionPointerType = genProcHere` |
20:26:47 | FromDiscord | <Gumber aka Zachary Carter> if that's the case, then I don't really have a good explanation |
20:27:15 | FromDiscord | <Gumber aka Zachary Carter> I assume when you asked that question you meant doing something like:↵↵`var myFunctionPointer = genProcSignatureHere(...)` |
20:27:58 | FromDiscord | <Gumber aka Zachary Carter> although that doesn't even really make sense... I guess I'm not sure what you're trying to do with the `procTy` blocks |
20:32:53 | FromDiscord | <Yardanico> In reply to @Gumber "I assume when you": i mean that does make sense since you can make anonymous procs and assign them to variables |
20:33:12 | FromDiscord | <Gumber aka Zachary Carter> yeah true |
20:33:22 | FromDiscord | <Gumber aka Zachary Carter> sorry I have covid too so my brain is a little foggy |
20:33:32 | FromDiscord | <Gumber aka Zachary Carter> but yeah closures |
20:33:39 | FromDiscord | <Gumber aka Zachary Carter> forgot they are a thing for a moment |
20:33:47 | FromDiscord | <Yardanico> !eval var test = (proc = echo "hi"); test() |
20:33:49 | NimBot | hi |
20:33:49 | FromDiscord | <Gumber aka Zachary Carter> or sorry |
20:33:52 | FromDiscord | <Gumber aka Zachary Carter> first class function |
20:33:55 | FromDiscord | <Gumber aka Zachary Carter> jesus |
20:34:01 | FromDiscord | <Gumber aka Zachary Carter> my brain really isn't working |
20:34:11 | FromDiscord | <Yardanico> with anon procedures you can achieve one-line programs in nim for most cases |
20:34:11 | FromDiscord | <Gumber aka Zachary Carter> hi NimBot |
20:34:15 | FromDiscord | <Yardanico> !ping |
20:34:15 | NimBot | pong |
20:34:15 | FromDiscord | <StardustAnnouncer> Pong! |
20:34:31 | FromDiscord | <Yardanico> !uptime |
20:40:30 | FromDiscord | <Ale_S> Hi everyone ... I'm trying Nim, but when I compile the antivirus 'Bitdefender' it finds a virus in the .exe file that is created .. it tells me "the file has been infected with Gen: Variant.Bulz.494784" .. have you also had similar problems? |
20:41:12 | FromDiscord | <enthus1ast> yeah, a few weeks ago all nim stuff was flagged |
20:41:13 | FromDiscord | <SivadNai> sounds familiar |
20:41:36 | FromDiscord | <enthus1ast> all false positives, maybe report it to bitdefender |
20:42:44 | FromDiscord | <enthus1ast> have reported my stuff to microsoft |
21:12:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:49:55 | FromDiscord | <gerwy> @treeform god, you make so many nim packages, when do you have time for that? How do you keep up with everything? |
21:51:58 | * | max22- quit (Quit: Leaving) |
21:54:34 | FromDiscord | <treeform> In reply to @Life Sucks "<@!107140179025735680> god, you make": 1. I like to program and am pretty fast at it. ↵2. I work on Nim at my job (we might be hiring more Nim programmers soon) and some of the libs I make are for work.↵3. Programming is my hobby, so instead of watching TV, playing computer games I just make stuff with Nim. Some times I publish it as libraries. |
21:55:12 | FromDiscord | <gerwy> Ahh sounds like a dream life |
21:56:20 | FromDiscord | <gerwy> for real, i would love to use nim in my future job too and to spend time programming instead of talking about programming |
21:56:43 | FromDiscord | <treeform> Yeah I work on a team of 1 and its pretty sweet. |
21:57:12 | FromDiscord | <treeform> I hate needless meetings, jet let me code. |
21:57:19 | FromDiscord | <treeform> (edit) "jet" => "just" |
21:58:15 | FromDiscord | <treeform> My company uses a ton of python, and they constantly have performance issues, crashes and bugs that would have been caught by Nim's type system. |
22:03:51 | FromDiscord | <gerwy> hah yeah i guess Nim would perfectly replace python in that case↵well unfortunately i can't use Nim anywhere other than my own projects, i will have big exam in a year and there are rumors we will be able to use the language of our choice (probably those that we had to learn) but if not, then maybe i could make them let me use Nim if its similar to Python so they don't need to worry about checking source code (because Python is one of tho |
22:26:09 | FromDiscord | <Gumber aka Zachary Carter> Just compile your code to C and submit the C code |
22:26:19 | FromDiscord | <Gumber aka Zachary Carter> 🙂 |
22:54:10 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
22:57:08 | * | Gustavo6046 joined #nim |