00:21:11 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "What kind of callbacks": filling a buffer |
00:21:50 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3suR |
00:25:14 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3suT |
00:26:05 | * | jkl joined #nim |
00:49:33 | * | jkl quit (Quit: ZNC 1.8.2 - https://znc.in) |
00:50:24 | * | jkl joined #nim |
00:54:59 | * | jkl quit (Remote host closed the connection) |
00:56:53 | * | jkl joined #nim |
01:06:02 | * | neceve quit (Ping timeout: 255 seconds) |
01:46:42 | * | cyraxjoe quit (Ping timeout: 272 seconds) |
02:09:21 | FromDiscord | <vishnumad> What's the best way to do wrapping arithmetic in Nim? Looking for the Nim equivalent to Rust's `wrapping_add` or Wrapping↵https://doc.rust-lang.org/std/num/struct.Wrapping.html |
02:10:08 | FromDiscord | <ElegantBeef> !eval echo 0u32 - 1u32 |
02:10:11 | NimBot | 4294967295 |
02:10:45 | FromDiscord | <ElegantBeef> Atleast if i understand the question properly |
02:10:59 | FromDiscord | <ElegantBeef> Nim's unsigned doesnt have overflow protections so just work that way |
02:11:23 | FromDiscord | <vishnumad> Thanks! That works |
02:12:47 | FromDiscord | <vishnumad> I was using `byte`, but changing it to `uint8` makes the compiler happy |
02:13:08 | * | cyraxjoe joined #nim |
02:13:18 | FromDiscord | <ElegantBeef> It's an alias so that shouldnt matter |
02:14:22 | FromDiscord | <vishnumad> It's erroring out if I try to do `let a: uint8 = 0` and then later try to do `a += 256` 🤔 |
02:14:44 | FromDiscord | <ElegantBeef> `256u8` |
02:14:49 | FromDiscord | <ElegantBeef> (edit) "`256u8`" => "`255u8`" |
02:14:58 | FromDiscord | <ElegantBeef> bytes only can have 0..255 😄 |
02:15:04 | FromDiscord | <ElegantBeef> also `var a` |
02:15:11 | FromDiscord | <vishnumad> Yeah, I'm trying to make it overflow |
02:16:26 | FromDiscord | <ElegantBeef> with that the issue is `+=` uses `SomeInteger` |
02:16:31 | FromDiscord | <ElegantBeef> (edit) "`SomeInteger`" => "`T: SomeInteger`" |
02:18:20 | FromDiscord | <ElegantBeef> !eval var a = 255u8; a += 3; echo a |
02:18:22 | NimBot | 2 |
02:20:02 | FromDiscord | <vishnumad> Yup that works, thanks for the help! |
02:20:35 | FromDiscord | <ElegantBeef> the value has to be in the valid range or this gets really odd 😄 |
02:21:19 | FromDiscord | <vishnumad> Something like `wrapping_add` would be convenient. I supposed I can do the math manually. |
02:26:24 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3svj something like this? |
02:26:34 | FromDiscord | <ElegantBeef> Excuse the bad maths 😄 |
02:29:20 | FromDiscord | <ElegantBeef> There is `+%` and `-%` but they only work for homogeneous signed types |
02:30:00 | FromDiscord | <vishnumad> I just went back to Rust's `wrapping_add` and it works the exact same way as Nim's add for unsigned ints so I was misremembering. |
02:30:23 | FromDiscord | <ElegantBeef> You cannot use `255u8 + 256`? |
02:31:19 | FromDiscord | <vishnumad> Don't believe so. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=160157b9c207f8835f8e91c461d67d63 |
02:31:56 | FromDiscord | <ElegantBeef> Ah nice |
02:32:15 | FromDiscord | <ElegantBeef> Though some do have their views against Nim's default lack of overflow protection on uints 😄 |
02:33:43 | FromDiscord | <vishnumad> I prefer opting into overflow as well, but at least I can do what I need to 😄 |
02:38:33 | * | cyraxjoe quit (Ping timeout: 252 seconds) |
02:40:33 | FromDiscord | <ElegantBeef> Hey atleast it's relatively simple to override(though not certain if this is right) https://play.nim-lang.org/#ix=3svn |
02:46:44 | * | cyraxjoe joined #nim |
02:46:44 | * | cyraxjoe quit (Client Quit) |
02:54:28 | * | cyraxjoe joined #nim |
03:00:40 | * | MightyJoe joined #nim |
03:03:20 | * | cyraxjoe quit (Ping timeout: 272 seconds) |
03:06:21 | * | arkurious quit (Quit: Leaving) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:37 | * | supakeen joined #nim |
04:13:20 | FromDiscord | <Bung> @ElegantBeef am wondering cant the json data part serialize using json module directly? |
04:17:21 | FromDiscord | <ElegantBeef> json is slow, vastly slower than my marshal method |
04:17:58 | FromDiscord | <Bung> that's the only reason ? |
04:18:06 | FromDiscord | <ElegantBeef> yes |
04:18:17 | FromDiscord | <ElegantBeef> I originally used json for the communication, and it was stupid slow |
04:18:37 | FromDiscord | <Bung> oh, no , use it make your lib complete right ? |
04:19:16 | FromDiscord | <Bung> json module is safe to use |
04:20:31 | FromDiscord | <Bung> if performance is concerns have you tried packedjson |
04:21:54 | FromDiscord | <ElegantBeef> I had not, i went straight into this method of binary stream communication |
04:22:18 | FromDiscord | <ElegantBeef> I can rather easily add a flag for using json in the new rewrite |
04:22:28 | FromDiscord | <ElegantBeef> The code is much cleaner so easier to append to |
04:24:15 | FromDiscord | <Bung> ok, atleast I know that's the only reason, I can also try it in my fork. |
04:24:17 | FromDiscord | <ElegantBeef> https://github.com/beef331/nimscripter/blob/bigrewrite/src/nimscripter/macros.nim for reference |
04:24:57 | FromDiscord | <ElegantBeef> Well the macro in the old version is a mess to maintain, so highly suggest forking the rewrite 😄 |
04:25:54 | FromDiscord | <ElegantBeef> It works slightly different you now do `exportToScript: someName` then you do `const yourProcs = implNimscriptModule(someName)` and pass that to `loadScript` |
04:26:30 | FromDiscord | <Bung> guess I just need write few lines in marshalns.nim |
04:26:46 | FromDiscord | <ElegantBeef> You can just delete the marshalns mostly |
04:27:07 | FromDiscord | <ElegantBeef> Just make the parameters send as a string and be recieved as a string |
04:27:17 | FromDiscord | <Bung> why is that , your big rewrite no need it now ? |
04:27:38 | FromDiscord | <ElegantBeef> so if you have 5 parameters just do `%(a, b, c, d, e, f)` |
04:28:04 | FromDiscord | <ElegantBeef> Nah it's just with json you're only needing the string logic which the vm gives you automagically |
04:29:44 | FromDiscord | <ElegantBeef> If you want to give me a few minutes i can make a json switch on the rewrite branch 😄 |
04:32:58 | FromDiscord | <Bung> have a json switch much better |
04:33:48 | FromDiscord | <Bung> In reply to @ElegantBeef "You can just delete": I was thinking this, it will need wraps marcos to my procs. |
04:52:19 | FromDiscord | <Hi02Hi> how do i deep copy on arc since system.deepCopy is not an option? |
04:56:06 | FromDiscord | <ElegantBeef> @Bung well generics + sym's are not playing nice so this sucks 😄 |
04:56:31 | FromDiscord | <xflywind> In reply to @Hi02Hi "how do i deep": --deepcopy:on|off enable 'system.deepCopy' for ``--gc:arc|orc`` |
05:05:09 | FromDiscord | <Bung> @ElegantBeef am waiting your json switch. |
05:05:30 | FromDiscord | <ElegantBeef> I'm working on it, tuples are annoying |
05:17:30 | FromDiscord | <ElegantBeef> Well hit an issue that needs to be fixed now, cannot use a devel version of the compiler which is needed to fix an issue with `std` imports |
05:20:25 | * | pro joined #nim |
05:29:36 | FromDiscord | <Hi02Hi> In reply to @flywind "--deepcopy:on|off ": it errors with invalid cmdline option, i think im on too old nim |
05:29:40 | FromDiscord | <Bung> well , use compiler package also will face compatibility issue |
05:29:50 | FromDiscord | <ElegantBeef> I dont know what you mean |
05:30:31 | FromDiscord | <ElegantBeef> There was an issue with the `std/import` with the embedded nimscript that i resolved, which is needed to use json now, but i cannot compile the most recent compiler |
05:30:42 | FromDiscord | <ElegantBeef> So i can only push my changes and make an issue since i cannot see how to resolve this issue |
05:31:11 | FromDiscord | <Bung> compiler package relys something from nim , that may changes when you switch nim version |
05:31:52 | FromDiscord | <ElegantBeef> I'm using nightly nim and the most recent compiler package, so idk seems like a regression to me |
05:32:19 | FromDiscord | <ElegantBeef> Hax you around? You capable of building with compiler 1.5.1? |
05:32:53 | * | MightyJoe quit (Quit: I'm out!) |
05:33:13 | FromDiscord | <ElegantBeef> Ok so now it's working 😄 |
05:33:19 | FromDiscord | <ElegantBeef> Odd behaviour here folks |
05:33:35 | FromDiscord | <ElegantBeef> I spent a good 10 minutes trying to find where the regression happened |
05:33:38 | FromDiscord | <xflywind> well add your package to importantant-packages, if you have tests. |
05:33:44 | FromDiscord | <xflywind> (edit) "importantant-packages," => "important-packages," |
05:34:25 | * | cyraxjoe joined #nim |
05:37:49 | FromDiscord | <xflywind> Especially when you called compiler procs. |
05:40:26 | * | cyraxjoe quit (Quit: I'm out!) |
05:40:52 | FromDiscord | <gogolxdong (liuxiaodong)> Why there are so many libraries about GUI instead of a popular one? |
05:45:34 | FromDiscord | <j-james> Because GUI is hard and libraries are competing to be the least bad, and because there aren't an awful lot of Nim programs that make extensive use of GUI |
05:45:49 | FromDiscord | <j-james> I think Rust's in a similar place |
05:47:59 | FromDiscord | <ElegantBeef> Ugh everywhere i go there is an issue 😄 |
05:48:19 | FromDiscord | <ElegantBeef> Excuse me whilst i just nuke nimscripter so i dont fee like i have any need to continue this 😛 |
05:55:54 | FromDiscord | <Bung> where is nimscripted.nim? |
05:56:03 | FromDiscord | <ElegantBeef> In the rewrite? |
05:56:20 | FromDiscord | <Bung> yes |
05:56:36 | FromDiscord | <ElegantBeef> Nuked to hell and back, it's present dumb name is `macros` |
05:57:03 | FromDiscord | <Bung> better your macros file have a prefix |
05:57:41 | FromDiscord | <ElegantBeef> Like i said it's dumbly named i just started writting and named it macros, will change the name before a proper release |
06:07:10 | FromDiscord | <ElegantBeef> There i've cleaned up a bit, but stdlib json is the main meanie now due to not supporting tuple serializationg |
06:09:53 | FromDiscord | <ElegantBeef> Do hope that this is easier to work with since the last was a fucking monster 😛 |
06:13:04 | FromDiscord | <Bung> `Error: invalid pragma: exportToScript` |
06:13:16 | FromDiscord | <Bung> tests/exportedprocs |
06:13:47 | FromDiscord | <ElegantBeef> I just tested and it worked, so might be on old commit? |
06:18:15 | FromDiscord | <ElegantBeef> But i'm taking a break for now, hopefully hax can show what they meant and i can implement it |
06:18:51 | FromDiscord | <Bung> oh you changed tests file |
06:24:38 | * | mst quit (*.net *.split) |
06:24:39 | * | redj quit (*.net *.split) |
06:24:39 | * | fn quit (*.net *.split) |
06:24:39 | * | nisstyre quit (*.net *.split) |
06:24:39 | * | pjz quit (*.net *.split) |
06:24:40 | * | federico3 quit (*.net *.split) |
06:24:58 | * | redj joined #nim |
06:24:58 | * | fn joined #nim |
06:24:58 | * | nisstyre joined #nim |
06:24:58 | * | pjz joined #nim |
06:24:58 | * | mst joined #nim |
06:24:58 | * | federico3 joined #nim |
06:30:38 | FromDiscord | <haxscramper> Alright, I'm back, now going to build an example for what I was talking earlier @ElegantBeef |
06:30:39 | FromDiscord | <Bung> `Error: cannot instantiate: 'getFromBuffer[int]'` |
06:31:20 | FromDiscord | <ElegantBeef> Uhh |
06:31:38 | FromDiscord | <Bung> https://github.com/bung87/nimscripter/tree/slim |
06:32:03 | FromDiscord | <garett> I was looking in std/macros today, and it appears to me that pragmas should appear in the last node of a ProcTy, but I always get nnkEmpty even when I have a custom pragma on my proc |
06:32:26 | FromDiscord | <garett> (edit) "I always get" => "dumpTree shows" |
06:33:53 | FromDiscord | <ElegantBeef> You have an older marshalns no? |
06:34:12 | FromDiscord | <garett> https://play.nim-lang.org/#ix=3suy |
06:35:54 | FromDiscord | <garett> Maybe I need to try an older version of Nim to check whether this ever worked |
06:36:46 | FromDiscord | <garett> The Nim manual suggests that macros can check for custom pragmas, but maybe it never worked for procs? |
06:36:53 | FromDiscord | <Bung> oh yes, thats one |
06:37:51 | FromDiscord | <ElegantBeef> @garett pst https://play.nim-lang.org/#ix=3swd |
06:38:41 | FromDiscord | <ElegantBeef> notice the output of `getImpl.treeRepr` does have them |
06:41:40 | FromDiscord | <garett> Thanks, beef! |
06:42:07 | FromDiscord | <garett> Looks like hasCustomPragma has a bug or is incomplete |
06:44:35 | FromDiscord | <garett> Now I can easily use a pragma to control how I rewrite Nim vector swizzle procs in HLSL |
06:46:49 | FromDiscord | <garett> Ideally, I would like to express many of the rewrite rules with pragmas. Currently I have a lookup table to map Vec4f to float4, etc |
06:48:48 | FromDiscord | <Bung> @ElegantBeef hmm, where you handle json? I only see you import json module .. |
06:50:36 | FromDiscord | <ElegantBeef> It's not implemented 100% yet |
06:50:40 | FromDiscord | <ElegantBeef> Due to stdlib issues |
06:54:01 | FromDiscord | <Bung> 😩 |
06:54:15 | FromDiscord | <ElegantBeef> Yea hoping hax has something nice |
07:15:45 | * | Vladar joined #nim |
07:17:58 | FromDiscord | <haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test10/test10.nim#L28 alright, so my claim is basically - this is the fastest way to pass data around, because all other methods would force VM to do the same internally |
07:18:28 | FromDiscord | <haxscramper> `dump` on object inside of a VM looks like this https://media.discordapp.net/attachments/371759389889003532/863318236627075082/unknown.png |
07:19:34 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3swq |
07:19:43 | FromDiscord | <haxscramper> Also constructs list of nkExprColonExpr nodes |
07:20:27 | FromDiscord | <haxscramper> In reply to @haxscramper "https://github.com/haxscramper/hack/blob/master/tes": I used `hnimast` and my other libraries because I don't want to reimplement get-list-of-fields-from-type-in-macro for 100th time |
07:21:11 | FromDiscord | <haxscramper> https://haxscramper.github.io/hnimast/src/hnimast/object_decl.html#ObjectField `for field in iterateFields(impl)` iterates over this objects |
07:23:42 | FromDiscord | <haxscramper> God, I absolutely HATE this horrible error messages in invalid kind for variant |
07:23:44 | FromDiscord | <haxscramper> `Error: unhandled exception: 'node' is not accessible using discriminant 'kind' of type 'TFullReg'` |
07:23:56 | FromDiscord | <haxscramper> using discriminant `'kind'` |
07:24:09 | FromDiscord | <haxscramper> which god damn value you found and what the hell did you expect? |
07:24:12 | FromDiscord | <haxscramper> nope, just "error" |
07:28:07 | FromDiscord | <haxscramper> https://github.com/nim-lang/Nim/pull/11955 at least shows current value |
07:36:40 | FromDiscord | <Bung> that should be `foo.f2` is not ... |
07:38:18 | FromDiscord | <haxscramper> I want to have just something |
07:38:33 | FromDiscord | <haxscramper> concrete word placement can be fixed later |
07:42:12 | FromDiscord | <Bung> get merged always after years.. |
07:42:43 | FromDiscord | <haxscramper> `> Aug 15, 2019` |
07:44:39 | FromDiscord | <ElegantBeef> Hmm still have to figure out a way to do the communication with this Pnode |
07:45:04 | FromDiscord | <ElegantBeef> Guess i could instead of a mangled proc have a tuple or similar to hold args/ret which is then accessed |
07:46:00 | FromDiscord | <haxscramper> What do you mean "figure out a way to do the communication"? You accept `PNode` and convert it to object, or create `PNode` and `setResult` to return data to VM |
07:47:09 | FromDiscord | <ElegantBeef> I havent looked at it much, just cursory look |
07:58:49 | * | max22- joined #nim |
07:59:07 | * | max22- quit (Remote host closed the connection) |
07:59:30 | * | max22- joined #nim |
08:06:33 | * | neceve joined #nim |
08:59:41 | * | pro quit (Ping timeout: 252 seconds) |
09:04:32 | * | xet7 quit (Remote host closed the connection) |
09:46:42 | * | max22- quit (Remote host closed the connection) |
09:53:26 | * | max22- joined #nim |
10:04:54 | * | Tejas joined #nim |
10:05:05 | Tejas | hi |
10:08:04 | FromDiscord | <whyy cant i install choosenim> https://nohello.net |
10:08:13 | FromDiscord | <whyy cant i install choosenim> (edit) "https://nohello.net" => "https://nohello.com" |
10:08:35 | FromDiscord | <whyy cant i install choosenim> https:/nohello.net |
10:08:40 | FromDiscord | <whyy cant i install choosenim> (edit) "https:/nohello.net" => "https://nohello.net" |
10:08:43 | FromDiscord | <whyy cant i install choosenim> whyy |
10:09:02 | FromDiscord | <whyy cant i install choosenim> https://nohello.net/ |
10:09:17 | FromDiscord | <whyy cant i install choosenim> https://nohello.net/ |
10:10:24 | FromDiscord | <Rika> Hello, what’s up? |
10:13:05 | * | Tejas is now known as TejasAgarwal |
10:20:41 | FromDiscord | <PsychoClay> is there a way to get more info on an illformed ast error? |
10:23:08 | * | TejasAgarwal quit (Quit: Client closed) |
10:24:51 | FromDiscord | <haxscramper> No, it is used like `assert` in compiler |
10:24:57 | FromDiscord | <konsumlamm> posting the code here maybe |
10:24:58 | FromDiscord | <haxscramper> So not a lot of additional information available |
10:25:15 | FromDiscord | <haxscramper> You can do `dumpTree` and compare expected structure vs what you got |
10:26:21 | FromDiscord | <PsychoClay> i tried dumptree but i dont really know what a correct ast looks like |
10:27:05 | FromDiscord | <vindaar> feel free to paste the tree. maybe we can help |
10:30:30 | FromDiscord | <PsychoClay> https://pastebin.com/f6jLtkAf |
10:31:53 | FromDiscord | <dom96> In reply to @richard stallmen(crazy GNU guy) "https://nohello.net/": This only applies to PMs or pings. |
10:33:04 | FromDiscord | <Rika> In reply to @dom96 "This only applies to": I think it applies in general, I just do not like the way he put it |
10:34:39 | FromDiscord | <haxscramper> people sometimes starts with two consecutive messages here |
10:34:41 | FromDiscord | <haxscramper> hi |
10:34:42 | FromDiscord | <haxscramper> <question> |
10:34:47 | FromDiscord | <dom96> It’s okay to join a chat channel and say hello. Not everybody has questions to ask |
10:34:59 | FromDiscord | <dom96> Maybe they just want to say hello? 🙂 |
10:36:42 | FromDiscord | <vindaar> @PsychoClay\: that AST looks fine, no? The tree is just the output of that `dumpTree` call |
10:36:51 | FromDiscord | <PsychoClay> yea |
10:37:02 | FromDiscord | <vindaar> so where is your problem |
10:37:03 | FromDiscord | <vindaar> ? |
10:37:36 | FromDiscord | <PsychoClay> https://media.discordapp.net/attachments/371759389889003532/863368350427774976/unknown.png |
10:38:04 | FromDiscord | <vindaar> how is that code generated though? |
10:38:31 | FromDiscord | <PsychoClay> with a template, its in the pastebin at the bottom |
10:39:40 | FromDiscord | <vindaar> not sure, but injecting a local variable with the same name as the template into the calling scope seems fishy to me |
10:40:23 | FromDiscord | <haxscramper> I'm not sure but `--hint[MsgOrigin]:on` might show which compiler check is reponsible for the message |
10:45:37 | FromDiscord | <PsychoClay> In reply to @vindaar "not sure, but injecting": renaming the templates doesnt seem to change anything |
10:50:32 | FromDiscord | <vindaar> I honestly don't really understand how the template is supposed to work. Why do these templates need to be nested in this way? Can't you define them individually? |
10:51:03 | FromDiscord | <PsychoClay> i could but then the varibles in the outer template would be unavailble in the inner ones |
10:51:59 | FromDiscord | <vindaar> ah you mean those `headerData` and friends variables |
10:52:02 | FromDiscord | <PsychoClay> yea |
10:52:15 | FromDiscord | <PsychoClay> maybe i should just redesign the whole thing |
10:54:16 | FromDiscord | <vindaar> without being able to compile this locally I don't really see the issue (aside from being confused, haha) |
11:01:25 | fn | <enthus1ast[web]99> what is the preferred way to test if a value is valid enum data? |
11:02:04 | fn | <enthus1ast[web]99> before i build a macro that generates a case i was wondering if there is something like this already |
11:02:46 | * | Amun-Ra quit (Ping timeout: 272 seconds) |
11:02:53 | fn | <enthus1ast[web]99> i could do a parseEnum[MyEnum](myEnum) |
11:03:01 | fn | <enthus1ast[web]99> i could do a parseEnum[MyEnum]($myEnum) |
11:03:44 | * | xet7 joined #nim |
11:03:51 | FromDiscord | <PsychoClay> In reply to @vindaar "without being able to": https://github.com/PsychoClay/aberrant |
11:03:52 | fn | <R2D299> itHub: 7"some webscraper in nim" |
11:10:45 | FromDiscord | <haxscramper> In reply to @fn "<enthus1ast[web]> what is the": Your enum has holes or not? |
11:11:15 | FromDiscord | <haxscramper> If it doesn't have holes you can simply check for `ord() in ord(low(E)) .. ord(high(E))` |
11:11:23 | FromDiscord | <haxscramper> (edit) "`ord()" => "`value" |
11:12:42 | fn | <enthus1ast[web]99> it hast holes |
11:12:44 | fn | <enthus1ast[web]99> has |
11:17:52 | FromDiscord | <haxscramper> `devel` has `std/enumutils.items` that can iterate over enum with holes https://github.com/nim-lang/Nim/blob/devel/lib/std/enumutils.nim#L79 |
11:18:19 | * | Amun-Ra joined #nim |
11:18:23 | FromDiscord | <haxscramper> Otherwise you need to write custom macro or something simila |
11:23:48 | fn | <enthus1ast[web]99> ah nice, thank you haxscramper i'll have a look at this |
11:26:37 | fn | <enthus1ast[web]99> i wonder why testing if an enum has correct values is not yet in the stdlib |
11:26:58 | fn | <enthus1ast[web]99> looks like a common job to me :) |
11:27:09 | FromDiscord | <Rika> prolly was neglected |
11:27:37 | FromDiscord | <Rika> we're a pretty small community, its relatively difficult for things to be worked on (i think) |
11:51:13 | * | max22- quit (Ping timeout: 268 seconds) |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:36 | * | supakeen joined #nim |
12:07:13 | fn | <ForumUpdaterBot99> New post on r/nim by thelolrus: Nim livestream | Jambone template language | Episode 2, see https://reddit.com/r/nim/comments/ohhi29/nim_livestream_jambone_template_language_episode_2/ |
12:17:14 | FromDiscord | <Hastur> I am investigating how to call Nim from C.↵According to the "Nim Backend Integration", `NimMain` is required for garbage collection, but is it necessary to call `NimMain` even if `--gc:arc` is specified? |
12:28:52 | FromDiscord | <offbeat-stuff (offbeat-stuff)> Hi how can i get .79 to become 0.79 in nim. I tried dot operator but only `.`79 works with macros |
12:29:01 | FromDiscord | <offbeat-stuff (offbeat-stuff)> \`.\`79 |
12:30:01 | FromDiscord | <System64 ~ Flandre Scarlet> I have to put NimMain for garbage collection? |
12:42:32 | * | max22- joined #nim |
12:45:26 | FromDiscord | <haxscramper> This is not supported, but can hack it with `.` operator, but I don't know why you would want this |
12:45:27 | FromDiscord | <haxscramper> You want to write `echo .79` instead of `echo 0.79`? |
12:51:09 | FromDiscord | <Hastur> sent a long message, see http://ix.io/3sxJ |
12:51:43 | FromDiscord | <Hastur> sent a long message, see http://ix.io/3sxK |
12:58:52 | * | beshr joined #nim |
13:02:56 | FromDiscord | <Kingherring> Livestream of some Nim programming begins in 1hr!!!! (10am EST). https://www.youtube.com/watch?v=rJzUanZ35c8 or https://www.twitch.tv/kingherring↵YouTube |
13:03:24 | FromDiscord | <Kingherring> oh I see the reddit post was posted above. 🙂 |
13:12:23 | * | pro joined #nim |
13:14:20 | * | max22- quit (Ping timeout: 252 seconds) |
13:32:18 | FromDiscord | <dom96> In reply to @Hastur "I am investigating how": probably is yeah, NimMain also runs initialisation procs for each module (so if you have top-level code in a module it gets run) |
13:34:11 | * | arkurious joined #nim |
14:07:34 | FromDiscord | <Hastur> In reply to @dom96 "probably is yeah, NimMain": Thanks you!↵It is true that the top level code was not executed without calling `NimMain`. |
14:44:17 | FromDiscord | <Bung> @haxscramper how you get type string representation put into parsePNodeStr ? |
14:45:01 | FromDiscord | <haxscramper> I don't understand the question. `parsePNodeStr` accepts string and returns node |
14:45:40 | FromDiscord | <haxscramper> If you need to convert `PNode` to string use `compiler/renderer.$` |
14:46:22 | FromDiscord | <Bung> well, your example show's the type string representation is static string |
14:47:16 | FromDiscord | <haxscramper> what is "type string" and which example you are talking about |
14:47:23 | * | cyraxjoe joined #nim |
14:48:42 | FromDiscord | <Bung> let node = """↵type Type = object↵ hello: float↵""".parsePNodeStr() |
14:51:20 | FromDiscord | <haxscramper> https://haxscramper.github.io/hnimast/src/hnimast/obj_field_macros.html#parseObject%2CN%2Cbool%2Cseq%5BN%5D |
14:52:12 | FromDiscord | <haxscramper> Also `enum_decl` has `parseEnum` |
14:52:50 | FromDiscord | <Bung> so I can put a type name not just string representation |
14:54:39 | FromDiscord | <haxscramper> `parse_object` accepts `PNode or NimNode` and returns you a structured object that at unparsed from the noed |
14:54:57 | FromDiscord | <haxscramper> as good as it managed to do this\ |
14:55:27 | FromDiscord | <haxscramper> Due to some ugly quirks in typed AST it requires additional hacks, like passing constant values separately |
14:56:20 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3syg |
14:57:42 | FromDiscord | <Bung> then how to restore instance by using parse_object returns? |
14:58:25 | FromDiscord | <haxscramper> `.toNNode()` |
14:58:50 | FromDiscord | <haxscramper> The round-trip conversion does loose some information, and in general it was designed to do only one-way conversion |
14:59:03 | FromDiscord | <haxscramper> Either generate object declarations, or process existing ondes |
15:02:53 | FromDiscord | <Bung> oh, it works as that does it means I actually have dynamic type? |
15:03:58 | FromDiscord | <haxscramper> no, it does not have any dynamic type or anything related. It is just an IR for object structure |
15:05:01 | FromDiscord | <Bung> but I can put any type declartion string into parsePNodeStr ? |
15:05:49 | FromDiscord | <haxscramper> yes, you can put any syntactically valid nim code in here |
15:09:39 | FromDiscord | <Bung> wait , toNNode just get type structure, dont event put data into it |
15:10:33 | FromDiscord | <haxscramper> yes, because there is no object to put data into |
15:10:49 | FromDiscord | <haxscramper> `ObjectDecl` describe structure of the object declaration |
15:11:22 | FromDiscord | <haxscramper> `ObjectField` has `value: Option[N]`, but it is not |
15:11:26 | FromDiscord | <haxscramper> Used by `toNNode()` |
15:11:33 | FromDiscord | <haxscramper> Since it would generate invalid AST |
15:11:50 | FromDiscord | <haxscramper> So I can parse object with `field: type = default`, but won't render it back again |
15:12:30 | FromDiscord | <Bung> I thought it works like protobuf, like you get type structure and data, restore back to a instance |
15:12:56 | FromDiscord | <haxscramper> No, it has nothing to do with data and everything to do with declaration |
15:13:05 | FromDiscord | <haxscramper> If you want to use it fo |
15:13:06 | FromDiscord | <haxscramper> hmm |
15:13:16 | FromDiscord | <haxscramper> Example for nimscript interop I showed earlier used `getObjectStructure()` |
15:13:30 | FromDiscord | <haxscramper> It internally calls `parseObject()` and I used it in macro to unpack fields |
15:13:42 | FromDiscord | <Bung> so how could it be used in nimscript |
15:14:05 | FromDiscord | <haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test10/test10.nim#L33 |
15:15:13 | FromDiscord | <haxscramper> Let's put the question differently - what are you trying to do? |
15:16:59 | FromDiscord | <Bung> am trying to use nimscript but it has problem with marshal things |
15:18:08 | FromDiscord | <haxscramper> Have you looked at my example? |
15:20:00 | * | beshr quit (Remote host closed the connection) |
15:20:27 | FromDiscord | <Bung> yes, vmNode: untyped is what |
15:21:29 | FromDiscord | <haxscramper> `PNode` |
15:22:07 | FromDiscord | <haxscramper> Well, it all based on my assumption that cheapest way to interface with VM is to directly operate on `PNode`s |
15:22:20 | FromDiscord | <haxscramper> So in deserializes PNode to type |
15:22:24 | FromDiscord | <haxscramper> And serializes type to PNode |
15:22:50 | FromDiscord | <haxscramper> Identical to json serialization, except all conversion happen on the caller side |
15:23:02 | FromDiscord | <haxscramper> In onther words - compiled nim code |
15:23:09 | FromDiscord | <haxscramper> And no conversion are performed in the VM |
15:23:31 | FromDiscord | <haxscramper> While all other ideas - json/flatty rely on code runnin in VM as well |
15:23:40 | * | max22- joined #nim |
15:29:33 | FromDiscord | <Bung> it I call vm proc I do toVm on args then fromVm get results ? |
15:31:22 | FromDiscord | <haxscramper> `fromVm` is used to convert data that came from vm to your nim code. `toVm` is used to send data to vm |
15:31:34 | FromDiscord | <haxscramper> So `args.setResult toVM(<some nim runtime data>)` |
15:32:15 | FromDiscord | <haxscramper> Or `let passedFromVm = fromVm(<some concrete type>, args.getNode(0))` |
15:32:57 | FromDiscord | <haxscramper> A little more involved than this, but core ide stays the same, regardless of the number of `case` checks |
15:33:32 | FromDiscord | <Bung> looks like it will works in this use case I'll try it |
15:39:54 | FromDiscord | <EMPTY> Hi |
15:45:49 | FromDiscord | <whyy cant i install choosenim> there we go again |
15:46:52 | FromDiscord | <shadow.> what's the easiest way for me to create a string with a certain len |
15:46:53 | FromDiscord | <shadow.> (edit) "len" => "len?" |
15:47:08 | FromDiscord | <vindaar> `newString(<myLen>)` |
15:47:35 | FromDiscord | <shadow.> where is that defined? |
15:47:38 | FromDiscord | <shadow.> i didnt see it in strutils |
15:47:44 | FromDiscord | <vindaar> it's in system |
15:47:56 | FromDiscord | <vindaar> https://nim-lang.github.io/Nim/system.html#newString%2CNatural |
15:48:19 | FromDiscord | <shadow.> ah okay |
15:48:20 | FromDiscord | <shadow.> thanks |
15:49:29 | FromDiscord | <EMPTY> Do anyone have a good tutorial on a simple chat app? |
15:52:49 | FromDiscord | <zetashift> The Nim in Action book has a great one, it's paid tho, there is also this https://xmonader.github.io/nimdays/day19_witai.html |
15:53:26 | FromDiscord | <dom96> you can access the example from the book freely though https://github.com/dom96/nim-in-action-code/tree/v1.2.6/Chapter3/ChatApp |
15:53:47 | FromDiscord | <EMPTY> Thanks guys, imma check those out |
15:55:54 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:07:52 | FromDiscord | <EMPTY> Sorry to annoy you guys but I just want to create a little server and client that can just send strings between them, how is it possible? |
16:31:21 | FromDiscord | <EMPTY> No thanks, I got something working that I base on a reverse-shell |
16:32:43 | FromDiscord | <EMPTY> sent a long message, see https://paste.rs/g6L |
16:33:42 | FromDiscord | <EMPTY> sent a code paste, see https://paste.rs/JuK |
16:40:02 | * | beshr joined #nim |
16:40:02 | * | beshr quit (Changing host) |
16:40:02 | * | beshr joined #nim |
16:40:04 | FromDiscord | <dom96> You can literally just copy the example I gave, it's fairly simple and has plenty of comments |
16:43:09 | FromDiscord | <EMPTY> Yes but it's more than what I need, I said I wanted a chat app just to get something that can send basic strings between 2 software, yours iw yes simple but uses more things that I wanted so I would have to remove like 80% of the code, mine is as simplest as it could be.↵↵But when I need something to chat I'll try yours |
16:48:54 | * | SebastianM joined #nim |
16:51:21 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3szb |
16:51:23 | FromDiscord | <haxscramper> This code does not give any errors |
16:52:13 | FromDiscord | <haxscramper> No generics, nothing |
16:52:14 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3szc |
16:52:44 | FromDiscord | <haxscramper> Changing `func`/`proc` does not affect it in any way of course |
17:00:44 | * | pro quit (Ping timeout: 252 seconds) |
17:24:53 | FromDiscord | <hamidb80> why do i get this ? ↵note: the code compiles successfully https://media.discordapp.net/attachments/371759389889003532/863470845593780233/unknown.png |
17:25:20 | FromDiscord | <hamidb80> example from here: https://github.com/karaxnim/karax#event-model |
17:25:21 | fn | <R2D299> itHub: 7"Karax. Single page applications for Nim." |
17:33:14 | FromDiscord | <hugogranstrom> I think it's a false positive (read it in one of the tutorials on Karax sometime ago)↵(@hamidb80) |
17:45:48 | FromDiscord | <aleclarson> What is "Undefined symbols for architecture" saying when I know the symbols exist in a header included with `header` pragma? |
17:46:49 | FromDiscord | <aleclarson> What's weird is that symbols in `/usr/local/include/node/node_api.h` are found by the linker, but not symbols in `/usr/local/include/node/js_native_api.h` (even though `node_api.h` includes that header) |
17:47:00 | FromDiscord | <Hi02Hi> closure iterator bug: https://play.nim-lang.org/#ix=3szz |
17:47:32 | FromDiscord | <hamidb80> In reply to @Hi02Hi "closure iterator bug: https://play.nim-lang.org/#ix": whaaaat |
17:47:40 | FromDiscord | <aleclarson> (edit) "header)" => "header)↵Maybe this is better suited for stackoverflow" |
17:47:45 | FromDiscord | <Hi02Hi> i only goes through 1 iteration |
17:47:51 | FromDiscord | <Hi02Hi> (edit) "i" => "`i`" |
17:48:13 | FromDiscord | <hamidb80> open an issue for it |
17:49:10 | FromDiscord | <hamidb80> In reply to @hugogranstrom "I think it's a": should i care about it? is there any solution ,.. ? |
17:49:15 | FromDiscord | <hamidb80> (edit) "solution" => "solutions" |
17:51:06 | FromDiscord | <hugogranstrom> The message I got from reading it was that I just shouldn't care or hope someone fixes it. Not sure how though↵(@hamidb80) |
17:53:57 | FromDiscord | <hugogranstrom> @hamidb80 here's the link to it: https://moigagoo.svbtle.com/exploring-karax |
17:54:07 | FromDiscord | <hugogranstrom> Seems to be a nimsuggest bug |
17:54:56 | FromDiscord | <hamidb80> oh, thank u |
17:56:31 | * | Vladar quit (Remote host closed the connection) |
17:58:41 | FromDiscord | <Hi02Hi> https://github.com/nim-lang/Nim/issues/18474 |
18:00:52 | FromDiscord | <EMPTY> Yeah this kind of jug appears a lot, I mean my IDE frics a lot sometime but the program runs and compiles correctly↵(@hamidb80) |
18:16:22 | * | SebastianM quit (Quit: Bye) |
18:29:56 | FromDiscord | <aleclarson> How do i find what version of `clang` nim uses? Is it the system-wide clang? |
18:33:07 | FromDiscord | <aleclarson> only 469 #nim-lang questions on stackoverflow 🤯 |
18:33:24 | fn | <ForumUpdaterBot99> New question by aleclarson: Clang linker finding some symbols but not others, see https://stackoverflow.com/questions/68330584/clang-linker-finding-some-symbols-but-not-others |
18:50:28 | * | beshr quit (Remote host closed the connection) |
19:21:33 | * | supakeen quit (Remote host closed the connection) |
19:21:57 | * | supakeen joined #nim |
20:29:18 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3sAn |
20:29:50 | FromDiscord | <Ayy Lmao> (edit) "https://play.nim-lang.org/#ix=3sAn" => "https://play.nim-lang.org/#ix=3sAo" |
20:29:58 | * | emery quit (Ping timeout: 246 seconds) |
20:30:01 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3sAp |
20:30:03 | FromDiscord | <ElegantBeef> Soon atleast |
20:31:42 | FromDiscord | <Ayy Lmao> In reply to @ElegantBeef "Well it's going to": You mean that is going to be possible even with name conflicts soon? |
20:31:53 | FromDiscord | <ElegantBeef> Well whenever this PR gets finished yes |
20:31:59 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/pull/18470 |
20:32:01 | FromDiscord | <Ayy Lmao> That will be awesome |
20:33:19 | FromDiscord | <Ayy Lmao> I've always found it verbose to fully qualify pure enums, but hated the idea of not using pure enums |
20:34:19 | FromDiscord | <ElegantBeef> Join the club |
20:36:24 | FromDiscord | <Ayy Lmao> I wonder if it will work when passing to proc arguments that expect an enum field as well |
20:37:10 | FromDiscord | <ElegantBeef> Based off the test he's written i dont know if it's supposed to error or supposed to work 😄 |
20:37:23 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3sAt |
20:39:32 | FromDiscord | <Ayy Lmao> Hopefully it's meant to work. |
20:44:57 | * | emery joined #nim |
21:11:50 | FromDiscord | <exelotl> mannn I'm trying to build a simple program with wNim but it takes so long to build every time |
21:12:04 | FromDiscord | <exelotl> very much looking forward to IC |
21:12:28 | FromDiscord | <ElegantBeef> Are you using the dsl? |
21:15:00 | FromDiscord | <exelotl> yes but it's not the bottleneck |
21:15:45 | FromDiscord | <exelotl> just the sheer number of modules (and probably the amount of macros being used in those modules) x) |
21:18:05 | FromDiscord | <ElegantBeef> Just use devel with `--ic:on` and hope nothing explodes 😛 |
21:21:44 | FromDiscord | <dom96> anybody with experience grabbing crypto price data, what's the best API (preferably free) for this? |
21:38:23 | FromDiscord | <Ayy Lmao> @dom96 I was messing around with making a crypto bot a while ago, I was using the binance API. Binance is pretty much the authority on what the price should be of most cryptos |
21:43:49 | FromDiscord | <dom96> cool, looks like they provide some nice websocket streams |
21:48:51 | FromDiscord | <Ayy Lmao> Yeah you can do websocket for realtime price data and http requests for past market data |
22:07:50 | FromDiscord | <glasso> sent a code paste, see https://play.nim-lang.org/#ix=3sAO |
22:08:17 | FromDiscord | <Elegantbeef> annotated the procedure with `{.cdecl.}` |
22:08:28 | FromDiscord | <glasso> (edit) "https://play.nim-lang.org/#ix=3sAO" => "https://play.nim-lang.org/#ix=3sAP" |
22:08:47 | FromDiscord | <ElegantBeef> Nim has calling conventions which if they dont match causes mismatches |
22:09:16 | FromDiscord | <glasso> In reply to @Elegantbeef "annotated the procedure with": It worked ^^↵↵I am new to Nim, I dont understand how pragma works... |
22:09:20 | FromDiscord | <glasso> Thanks |
22:09:35 | FromDiscord | <ElegantBeef> In this case these pragmas just change how the undelying code is written |
22:09:53 | FromDiscord | <glasso> In reply to @ElegantBeef "In this case these": I don't like this :9 |
22:09:53 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#types-procedural-type it's explained here |
22:09:55 | FromDiscord | <glasso> 😦 |
22:10:12 | FromDiscord | <ElegantBeef> There's a reason it exists and as such it's useful |
22:10:45 | FromDiscord | <ElegantBeef> Nim devel has a change in the error messages from procedure pragma mismatches which makes this less of a "What's the issue?!" |
22:11:24 | FromDiscord | <ElegantBeef> `tproc_mismatch.nim(69, 9) Error: type mismatch: got <proc (a: int): int{.nimcall.}> but expected 'proc (a: int): int{.cdecl.}'↵ Calling convention mismatch: got '{.nimcall.}', but expected '{.cdecl.}'.↵` |
22:11:37 | FromDiscord | <ElegantBeef> Notice the mention of calling convention mismatch |
22:12:12 | FromDiscord | <glasso> I think this makes easier for newcomers |
22:12:17 | FromDiscord | <ElegantBeef> It also shows pragma mismatches so if you try to pass a non `gcSafe` to a `gcSafe` proc |
22:12:33 | FromDiscord | <ElegantBeef> Well it's also just more readable which is why i did it 😛 |
22:12:56 | FromDiscord | <ElegantBeef> There are a few more PRs that aid to increase readability presently being worked on |
22:25:52 | FromDiscord | <exelotl> hmmm does anyone know how I can start a process and then terminate my program without killing the process? |
22:26:31 | * | beshr joined #nim |
22:26:31 | * | beshr quit (Changing host) |
22:26:31 | * | beshr joined #nim |
22:33:13 | FromDiscord | <exelotl> ah startProcess seems to work |
23:12:41 | fn | <ForumUpdaterBot99> New post on r/nim by richardd08: Does nim have context managers, tuple unpacking or abstract base classes?, see https://reddit.com/r/nim/comments/oht2s0/does_nim_have_context_managers_tuple_unpacking_or/ |
23:20:33 | * | max22- quit (Remote host closed the connection) |