00:00:35 | * | jmdaemon joined #nim |
00:03:36 | * | jmdaemon quit (Changing host) |
00:03:36 | * | jmdaemon joined #nim |
00:04:52 | * | jmdaemon quit (Client Quit) |
00:07:05 | * | noeontheend_ quit (Ping timeout: 252 seconds) |
00:07:05 | * | noeontheend quit (Ping timeout: 252 seconds) |
00:10:29 | FromDiscord | <pmunch> Those where a good mix of copy paste from other languages and guesswork from my side. If they're incorrect please create a PR to fix them \:)↵(@Cloudperry) |
00:20:54 | FromDiscord | <Elegantbeef> Hey pmunch i've got to ask how does one properly serialize using your protobuf library? |
00:27:11 | * | src quit (Quit: Leaving) |
00:50:15 | FromDiscord | <pmunch> What do you mean? |
00:50:27 | FromDiscord | <Elegantbeef> Looking at it further it seems you only have the streamwrite method |
00:50:44 | FromDiscord | <DMI-1407> is there already a discord api for nim ? |
00:50:47 | FromDiscord | <Elegantbeef> My friend tried it yesterday and suffice to say he ran into a fair bit of issues |
00:50:52 | FromDiscord | <Elegantbeef> Dimscord yep |
00:51:43 | FromDiscord | <pmunch> Ah yes, it's built around streams |
00:52:34 | FromDiscord | <pmunch> So you parse your spec, create your object, and then write it to a stream |
00:52:37 | FromDiscord | <Elegantbeef> It does have a nice bug with nested empty messages aswell, though I've got a fix |
00:53:14 | FromDiscord | <Elegantbeef> Questioning whether i should clean up these macros though since it's very hard to read |
00:56:38 | FromDiscord | <pmunch> Oh yeah, they definitely need a cleanup.. |
00:57:05 | FromDiscord | <pmunch> I believe protobuf was my first major macros project |
00:57:13 | FromDiscord | <Elegantbeef> Well there just made a PR for you |
00:58:46 | FromDiscord | <Elegantbeef> Yea i can really tell you used `astGenRepr` a lot 😛 |
00:59:51 | FromDiscord | <Elegantbeef> Now to think of it, i've never used `astGenRepr` for anything but testing if logic is sound |
00:59:52 | FromDiscord | <pmunch> Haha, yup. I think that was actually what I wrote 'astGenRepr' for 😋 |
01:00:16 | FromDiscord | <Elegantbeef> Oh you wrote `astGenRepr` for the stdlib? |
01:00:24 | FromDiscord | <pmunch> Yup |
01:01:04 | FromDiscord | <pmunch> I think I wrote it for protobuf, then realized it was probably a bad idea and barely ever touched it again 😅 |
01:01:37 | FromDiscord | <pmunch> Then someone wrote \`quote\` which is a way nicer solution |
01:01:44 | FromDiscord | <Elegantbeef> It does what it promises but produces heavily unmaintainable macros |
01:02:06 | FromDiscord | <pmunch> Of course \`astGenRepr\` still has its uses, but not nearly as many after quote came along |
01:02:14 | FromDiscord | <Elegantbeef> quote/genast and the less verbose procedures are just nicer |
01:02:29 | FromDiscord | <Elegantbeef> well with genast i thinkg astgenrepr is mostly just a debug tool |
01:02:54 | FromDiscord | <pmunch> I then of course wrote superQuote in macroutils after that failed to get merged into Nim |
01:02:55 | FromDiscord | <Elegantbeef> You can now easily inject symbols/generate them |
01:03:37 | FromDiscord | <Elegantbeef> Given how much time i spend toying with macros it's kinda funny the only thing i've written to make it easier is a toy that is pointless |
01:05:23 | FromDiscord | <pmunch> Hmm, what's genast? |
01:05:47 | FromDiscord | <Elegantbeef> A new module in 1.6 that gives an alternative to quote removing many issues |
01:06:01 | FromDiscord | <pmunch> I wrote macroutils to try and fix a lot of the gripes I've had with writing macros over the years |
01:06:05 | FromDiscord | <Elegantbeef> Instead of making temporary variables before you just do `genAst(name = ident"ThisisAName")` |
01:06:33 | FromDiscord | <Elegantbeef> Now inside the scope `name` is the right hand of the `=` |
01:06:34 | FromDiscord | <pmunch> Then of course I've gotten so used to the old way of writing macros I couldn't really get used to using macroutils |
01:06:47 | FromDiscord | <Elegantbeef> It doesnt require accquoting either |
01:06:50 | FromDiscord | <pmunch> But it does have some nice tools, like superQuote |
01:08:14 | FromDiscord | <pmunch> Wait, so that's just \`let name = "ThisIsAName".ident\`? |
01:11:00 | FromDiscord | <pmunch> But I'm going to bed now |
01:11:31 | FromDiscord | <Elegantbeef> I mean it works like quote do but you can inject variables through parameters instead of capturing all variables in scope |
01:11:43 | FromDiscord | <Elegantbeef> so in the above case it finds `name` an replaces it with the right hand |
01:17:37 | * | krux02_ quit (Remote host closed the connection) |
01:23:54 | NimEventer | New post on r/nim by shujidev: How to return a var seq from proc input, see https://reddit.com/r/nim/comments/redpcp/how_to_return_a_var_seq_from_proc_input/ |
01:53:24 | * | arkurious quit (Quit: Leaving) |
02:10:30 | arkanoid | I have a nimpy function named "int8" that I have to call, but it calls nim's one |
02:13:04 | arkanoid | how can I disambiguate? |
02:14:17 | FromDiscord | <Elegantbeef> `nimpy.int8(args)` |
02:14:26 | arkanoid | solved with obj.`int8()` |
02:14:39 | FromDiscord | <Elegantbeef> If that doesnt help i guess commence operation cryalot |
02:14:42 | arkanoid | just in time! thanks |
02:15:12 | arkanoid | there's the callMethod proc in nimpy in case of emergency |
02:15:54 | arkanoid | I might have just found the perfect zero-copy interop between arraymancer and numpy/pandas and possibly many other scientific stacks |
02:16:10 | FromDiscord | <Elegantbeef> nice you've donest it |
02:17:04 | arkanoid | donest? |
02:17:16 | FromDiscord | <Elegantbeef> done it but said jovial |
02:17:36 | FromDiscord | <valerga> running a nim binary seems to take at least 50ms, even on empty code, is that normal? |
02:17:45 | FromDiscord | <Elegantbeef> Nope |
02:17:55 | FromDiscord | <Elegantbeef> is this a release program? |
02:18:27 | FromDiscord | <valerga> https://media.discordapp.net/attachments/371759389889003532/919412853419679784/nimtime.jpg |
02:18:30 | FromDiscord | <valerga> that's release on empty code |
02:18:44 | FromDiscord | <valerga> im counting usr time |
02:18:45 | FromDiscord | <Elegantbeef> Are you compiling the binary and running it or counting the compil time? |
02:18:56 | FromDiscord | <valerga> i ran in twice |
02:19:07 | FromDiscord | <Elegantbeef> That doesnt answer my question |
02:19:15 | FromDiscord | <Elegantbeef> Are you actually timing the binary or the compiler? |
02:19:19 | FromDiscord | <valerga> ohh |
02:19:26 | FromDiscord | <valerga> i thought since it was cached it would just run it straight |
02:19:37 | FromDiscord | <valerga> i'll check the binary |
02:19:38 | FromDiscord | <Elegantbeef> Well it has to make sure it has no file changes |
02:19:51 | FromDiscord | <Elegantbeef> Which requires some computation |
02:19:57 | FromDiscord | <valerga> yeah it runs in 2ms |
02:20:23 | FromDiscord | <Elegantbeef> There we go that's a bit more reasonable since it has to set everything up and talk to the OS |
02:20:57 | FromDiscord | <valerga> 1ms on empty code |
02:22:19 | FromDiscord | <huantian> man I was looking at pull #11992 and started down the rabbit hole of random issues and pull requests that have a lot of text |
02:23:36 | FromDiscord | <Elegantbeef> Ah yes that's a fun PR |
02:25:14 | FromDiscord | <huantian> wonder if that'l ever get merged... |
02:25:40 | FromDiscord | <Elegantbeef> probably not |
02:26:17 | FromDiscord | <Elegantbeef> To me it seems like a big "Work around the problems instead of fix them" |
02:27:16 | FromDiscord | <huantian> but writing `.toSeq` before my maps is so much work! |
02:27:17 | FromDiscord | <evoalg> Sometimes I have to check that a condition isn't true for everything in a container. In python I would use a for-each trick, but in nim I'd do it like this I guess: https://play.nim-lang.org/#ix=3HM1 ... not sure if it's the best way? |
02:27:56 | FromDiscord | <leorize> try sequtils.all? |
02:28:03 | FromDiscord | <evoalg> this is a simple example, but in reality it would be complicated so I can't use all or any |
02:28:05 | arkanoid | what's better "static: var ..." or "var {.compiletime.}" ? |
02:28:47 | FromDiscord | <evoalg> unless I put it in a proc, then I could use "all" I guess? |
02:28:52 | FromDiscord | <leorize> would allIt work then? |
02:29:16 | FromDiscord | <leorize> same as all but you don't have to make a proc |
02:29:49 | FromDiscord | <huantian> you could always use an anonomous proc or sugar ->, or just use allit |
02:30:01 | FromDiscord | <huantian> (edit) "->," => "+>," |
02:30:04 | FromDiscord | <huantian> (edit) "+>," => "=>," |
02:30:57 | FromDiscord | <Elegantbeef> Also why the hell are you using `discard """` we have multiline comments?! |
02:31:03 | FromDiscord | <evoalg> I mean in a real programing there are many lines and it get's complicated to use all / allIt (or not very readable), but if I put the many lines in a proc then I could use all or allIt and it would still be readable, true |
02:31:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HM3 |
02:31:42 | FromDiscord | <leorize> @evoalg\: you can use a code block with allIt |
02:32:30 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=3HM4 |
02:32:32 | FromDiscord | <ajusa> Wait seriously I've using discard """ since like 2017, when did we get multiline comments |
02:32:39 | FromDiscord | <evoalg> In reply to @Elegantbeef "Also why the hell": Ahh sorry I liked the colors better? ... I tend to use discard for notes, and multi-line comments for code ... but yea I guess it's not ideal |
02:32:44 | FromDiscord | <Elegantbeef> A while |
02:32:55 | FromDiscord | <Elegantbeef> WE even have multiple line doc comments |
02:33:02 | FromDiscord | <evoalg> In reply to @leorize "<@900872397224280125>\: you can use": Thank you! that's nice 🙂 |
02:33:04 | arkanoid | how can I create a const array 0..1000 int8? |
02:33:25 | FromDiscord | <Elegantbeef> `const arr: array[1000, uint8]` |
02:33:38 | * | noeontheend_ joined #nim |
02:33:38 | * | noeontheend joined #nim |
02:34:20 | arkanoid | Elegantbeef, doesnt work, it expects an initialization |
02:34:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HM6 |
02:34:40 | FromDiscord | <leorize> beware of the const array trap (if it's still a thing) |
02:35:03 | arkanoid | ooh, thanks |
02:35:09 | arkanoid | what's const array trap? |
02:35:22 | FromDiscord | <leorize> it's very much a thing for strings, though |
02:35:38 | FromDiscord | <leorize> the compiler attempting to inline array/string everywhere |
02:35:59 | FromDiscord | <leorize> exploding compile-time memory usage and binary size |
02:36:12 | arkanoid | well I will have to test this zero-copy experiment for strings too, so I'll check this |
02:36:14 | arkanoid | thanks |
02:37:47 | * | noeontheend_ quit (Ping timeout: 252 seconds) |
02:37:47 | * | noeontheend quit (Ping timeout: 252 seconds) |
02:49:39 | arkanoid | turning a seq to an arraymancer tensor requires 4x memory and 13 allocations, apparently https://play.nim-lang.org/#ix=3HM8 |
02:50:11 | arkanoid | it's quite more convenient staying with seqs |
02:51:02 | arkanoid | ups, wrong channel, was or #nim-science |
03:12:59 | * | vicecea quit (Remote host closed the connection) |
03:13:28 | * | vicecea joined #nim |
03:25:34 | arkanoid | is GC_getStatistics() unavailable for ARC? |
03:25:54 | arkanoid | it runs, but I'm getting zero in any context |
03:28:14 | arkanoid | oh! it does work, but requires "useMalloc" to NOT be defined (actually makes sense). I was trying to get line-by line memory usage but also cross boundary nim-python usage via valgrind, apparently I can only do one of the two |
04:01:18 | FromDiscord | <Rika> In reply to @evoalg "Sometimes I have to": `not container.anyIt(condition)`? |
04:01:30 | FromDiscord | <Rika> In reply to @evoalg "this is a simple": why not? |
04:01:44 | FromDiscord | <Rika> you can always make the proc not-inline |
04:02:17 | FromDiscord | <Rika> proc ...[T](a, b: T): bool = ...↵echo not container.any(...) |
04:03:57 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3HMx |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
04:25:28 | * | noeontheend joined #nim |
05:43:41 | * | stkrdknmibalz quit (Ping timeout: 252 seconds) |
06:17:51 | FromDiscord | <satoro.tadziri> sent a code paste, see https://play.nim-lang.org/#ix=3HMS |
06:25:51 | * | noeontheend quit (Ping timeout: 252 seconds) |
07:16:54 | FromDiscord | <Sabena Sema> In reply to @Elegantbeef "WE even have multiple": tbh I'm in the habit of using discard """ because I learned nim when it didn't have multiline comments 😄 |
08:17:19 | ozzz | I spent couple of hour yeasterday, just to find out that Nim not works well with gcc 11.1 |
08:24:44 | FromDiscord | <Rika> It doesn't? How |
08:58:58 | * | jjido joined #nim |
09:29:23 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:51:37 | * | jjido joined #nim |
09:58:53 | * | jmdaemon joined #nim |
10:11:39 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:34:48 | FromDiscord | <demotomohiro> Did windows defender deleted some executable files in gcc? |
10:56:23 | * | terminalpusher joined #nim |
10:57:19 | * | lumo_e joined #nim |
10:57:28 | * | terminalpusher left #nim (#nim) |
11:02:15 | FromDiscord | <valerga> a file you compiled or a file from gcc? |
11:07:11 | FromDiscord | <el__maco> always fun when the antivirus quarantines the file you just compiled |
11:16:14 | FromDiscord | <valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOc |
11:16:24 | FromDiscord | <valerga> im thinking this might be a bottleneck |
11:16:45 | FromDiscord | <valerga> basically want to iterate over lowercase strings |
11:16:48 | FromDiscord | <Rika> No idea what any of these variables are in terms of type |
11:17:05 | FromDiscord | <valerga> seq of strings |
11:17:11 | FromDiscord | <Rika> Use a count table |
11:23:07 | NimEventer | New thread by Elcritch: Keyxn: Shamir Secret Sharing in pure Nim, see https://forum.nim-lang.org/t/8703 |
11:26:06 | * | lumo_e quit (Ping timeout: 268 seconds) |
11:26:16 | FromDiscord | <valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOf |
11:26:22 | FromDiscord | <valerga> I'm copying a seq to a new seq |
11:26:33 | FromDiscord | <valerga> add an item to it, then it to the queue seq |
11:26:42 | FromDiscord | <valerga> wondering if there's a better way |
11:27:44 | FromDiscord | <Rika> Better as in? |
11:27:59 | FromDiscord | <Rika> Shorter code or faster or memory efficient or idiomatic or what |
11:29:36 | FromDiscord | <valerga> faster, there's some bottleneck somewhere, thinking maybe there |
11:29:52 | FromDiscord | <valerga> since the count table didn't change speed |
11:31:33 | FromDiscord | <Rika> q.add(p & c) |
11:31:37 | FromDiscord | <Rika> I think that works |
11:31:38 | FromDiscord | <Rika> Not sure |
11:33:04 | FromDiscord | <valerga> that works, but same speed heh |
11:33:30 | FromDiscord | <Rika> You need to change the algorithm then |
11:33:48 | FromDiscord | <Rika> Avoid the double copy from that sequence adding |
11:34:00 | FromDiscord | <Rika> It feels wrong too |
11:34:10 | FromDiscord | <Rika> Surely there’s a different way? |
11:35:09 | FromDiscord | <valerga> it's this algorithm https://www.geeksforgeeks.org/print-paths-given-source-destination-using-bfs/ |
11:35:31 | FromDiscord | <valerga> https://play.nim-lang.org/#ix=3HOh |
11:37:49 | FromDiscord | <valerga> it finds the solution but in 400s !! |
11:42:09 | * | src joined #nim |
11:49:13 | FromDiscord | <valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOo |
11:49:23 | FromDiscord | <valerga> that's ok? |
11:49:23 | FromDiscord | <Rika> Use a deque for that |
11:49:49 | FromDiscord | <Rika> If you’re not accessing middle items use a deque |
11:57:14 | * | krux02 joined #nim |
11:58:12 | FromDiscord | <valerga> wow @Rika that really made a difference |
11:58:41 | FromDiscord | <valerga> reduced it from 400s to 2s |
11:58:57 | FromDiscord | <valerga> thank you |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:30 | * | supakeen joined #nim |
12:13:27 | FromDiscord | <Rika> It really helps learning about data structures here, maybe take a look at resources about that |
12:37:20 | * | neurocyte0132889 joined #nim |
12:37:20 | * | neurocyte0132889 quit (Changing host) |
12:37:20 | * | neurocyte0132889 joined #nim |
12:40:44 | * | src quit (Quit: Leaving) |
12:47:12 | * | lumo_e joined #nim |
12:57:05 | * | jmdaemon quit (Quit: WeeChat 3.3) |
13:14:01 | * | lumo_e quit (Ping timeout: 268 seconds) |
13:14:49 | * | lumo_e joined #nim |
13:33:49 | FromDiscord | <valerga> any text in particular you recommend? |
13:46:20 | * | jjido joined #nim |
13:47:50 | FromDiscord | <Rika> unfortunately i dont |
14:13:57 | * | arkurious joined #nim |
14:33:28 | NimEventer | New thread by Greenfork: Why windows.h file is always included into compilation on Windows?, see https://forum.nim-lang.org/t/8704 |
14:56:24 | * | lumo_e quit (Ping timeout: 268 seconds) |
15:13:09 | * | src joined #nim |
15:37:21 | arkanoid | I don't remember it there's a std proc to take just N elements from iterable |
15:37:38 | NimEventer | New thread by Icedquinn: Renovate Bot, see https://forum.nim-lang.org/t/8705 |
15:43:07 | Amun-Ra | what's nim's equivalent of python's: except (FooError, BarError) as e:? |
15:46:58 | FromDiscord | <Rika> `except A, B:\n let e = getCurrentException()` |
15:47:09 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3HRq |
15:48:17 | Amun-Ra | Rika: thanks |
15:49:13 | FromDiscord | <Rika> In reply to @0ffh "Hi, I'm implementing a": 0x55 is not coerced into a uint64 it seems? |
15:49:23 | FromDiscord | <Rika> honestly i wouldnt use a tuple here |
15:50:31 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3HRs |
15:50:51 | FromDiscord | <planetis> Has anyone worked on a function chain macro? Any examples? |
15:51:07 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3HRt |
15:51:44 | FromDiscord | <Rika> okay then |
15:51:44 | FromDiscord | <Rika> wait |
15:51:47 | FromDiscord | <Rika> ill see |
15:52:13 | FromDiscord | <Rika> ah |
15:52:14 | FromDiscord | <Rika> lol |
15:52:29 | FromDiscord | <Rika> seems like generic tuple `[]` is taking precedence over your `[]` |
15:52:43 | FromDiscord | <0ffh> oh, i see |
15:53:01 | FromDiscord | <Rika> i dont know why |
15:53:01 | FromDiscord | <0ffh> maybe i can get around that my making it distinct? |
15:53:10 | FromDiscord | <0ffh> (edit) "my" => "by" |
15:53:45 | FromDiscord | <Rika> honestly go with the object |
15:54:34 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3HRu |
15:54:39 | FromDiscord | <0ffh> okay, i'll try that thanks!↵making the tuple distinct prevents field access |
15:55:41 | FromDiscord | <Rika> notably with the object, the templates are now procs and you have to use object construction syntax `BV(val: ..., ...)` |
15:56:26 | FromDiscord | <0ffh> okay |
16:03:45 | FromDiscord | <deech> Does nim support a package private qualifier? I have a module that I would like to only use from other modules within the package but not expose to the user. |
16:04:10 | FromDiscord | <Rika> no |
16:04:33 | FromDiscord | <Rika> well, from what i know, nimble has a "private" directory |
16:04:50 | FromDiscord | <Rika> but i dont know if it actually does anything from outside of nimble |
16:05:17 | FromDiscord | <deech> I suppose it's academic because Nim now allows the caller to expose private fields. |
16:05:28 | FromDiscord | <0ffh> In reply to @Rika "notably with the object,": works fine now, thanks a bunch! |
16:07:39 | FromDiscord | <planetis> anyone knows how to correctly traverse a function chain using a macro? |
16:10:14 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
16:21:04 | arkanoid | the most confusing error of it's kind to me is "Error: attempting to call routine: <routine name> found <signature> in [line]". It doesn't say anything about where the error is |
16:23:56 | * | lumo_e joined #nim |
16:24:15 | FromDiscord | <Rika> it usually does before "Error:" |
16:24:38 | FromDiscord | <Rika> "/file.nim(line, character) Error:` |
16:24:40 | FromDiscord | <Rika> (edit) "Error:`" => "Error:"" |
16:29:14 | * | src_ joined #nim |
16:32:02 | * | src quit (Ping timeout: 240 seconds) |
16:32:39 | * | jjido joined #nim |
16:32:46 | arkanoid | yeah but sometimes is way off the real line, it seems |
16:33:26 | arkanoid | I'm failing to write a trivial thing: `take` iterator. Where you feed an interable in and it spits out N next elements of it |
16:38:45 | * | src_ quit (Quit: Leaving) |
16:38:55 | * | src joined #nim |
16:42:22 | FromDiscord | <Rika> as a seq? |
16:43:41 | * | lumo_e quit (Ping timeout: 268 seconds) |
16:46:01 | arkanoid | Rika: no, something like https://play.nim-lang.org/#ix=3HRR |
16:46:52 | arkanoid | I think is something eveybody has already faced (and also what zero_functional is all about), chaining iterators |
16:47:03 | arkanoid | chaining *inline* iterators |
16:50:54 | FromDiscord | <Rika> you cant use iterable[] in procs |
16:53:13 | arkanoid | I'm confused |
16:53:15 | arkanoid | why not? |
16:53:19 | * | lumo_e joined #nim |
16:54:01 | arkanoid | docs says "Represents an expression that yields T" |
16:55:23 | FromDiscord | <Rika> probably has to do with compile time construct and whatever but i dont know |
16:55:34 | FromDiscord | <Rika> i dont have experience with newest nim features right now |
16:59:22 | arkanoid | hmm, this works on my machine but doesn't on play.nim-lang: https://play.nim-lang.org/#ix=3HRX |
16:59:58 | * | lumo_e quit (Ping timeout: 260 seconds) |
17:01:42 | arkanoid | it works if I import sequtils, don't know what I am using of sequtils in that example |
17:02:31 | FromDiscord | <Rika> items |
17:02:35 | FromDiscord | <coldfussion> sent a code paste, see https://play.nim-lang.org/#ix=3HS1 |
17:02:43 | FromDiscord | <Rika> https://nim-lang.org/docs/sequtils.html#items.i |
17:03:09 | FromDiscord | <Rika> cold there is no error here it looks |
17:03:19 | FromDiscord | <Rika> plugin can be wrong |
17:03:31 | FromDiscord | <Rika> error on compile should be your source of truth |
17:04:26 | FromDiscord | <Solitude> or your `l` is not mutable |
17:06:07 | FromDiscord | <planetis> macros hard me dumb |
17:06:25 | arkanoid | does `for x in foo` always means calling foo.items no matter what is the type of foo? |
17:06:57 | FromDiscord | <Solitude> yes |
17:07:29 | arkanoid | ok, thanks, now everything clicks |
17:09:30 | FromDiscord | <coldfussion> sent a code paste, see https://play.nim-lang.org/#ix=3HS3 |
17:10:08 | arkanoid | where can I read how iterator works? I'm playing with inline and closure iterators and I'd like to understand how (and if) they can be used together |
17:10:14 | FromDiscord | <Rika> your l is not mutable |
17:10:17 | FromDiscord | <Solitude> In reply to @coldfussion "Probably, I currently have": https://nim-lang.org/docs/manual.html#procedures-var-parameters |
17:10:40 | FromDiscord | <Rika> arkanoid inline iterators do not exist on runtime (of course, because theyre inlined) |
17:10:51 | FromDiscord | <Rika> closure iterators can be halted and resumed at will |
17:11:06 | FromDiscord | <Rika> at the expense of memory and speed |
17:11:24 | FromDiscord | <pmunch> Well, not quite "at will" |
17:11:43 | FromDiscord | <coldfussion> Oh, thank you↵(@Solitude) |
17:14:24 | FromDiscord | <coldfussion> the type mismatch error message is quite a bit misleading tbh... |
17:14:48 | arkanoid | yeah, I quite nicely fit closure iterators with other programming patterns I tend to use in different languages. But inline iterator are another kind of beast. Also, what is type Iterable and when can/should use it? |
17:15:50 | FromDiscord | <Solitude> In reply to @coldfussion "the type mismatch error": its intentional, to drive more people to chat |
17:16:54 | FromDiscord | <0ffh> how can i do a reinterpreting cast between signed and unsigned integers? |
17:17:12 | FromDiscord | <Rika> cast |
17:17:19 | FromDiscord | <Rika> cast is reinterpret cast |
17:18:31 | FromDiscord | <0ffh> hum, i must have effed it up somehow, i get value out of range. but if iÄm on the right track with cast, i suppose i'll figure it out through the docs. thanks! |
17:18:42 | FromDiscord | <0ffh> (edit) "iÄm" => "i'm" |
17:19:34 | FromDiscord | <azazello> sent a code paste, see https://play.nim-lang.org/#ix=3HSa |
17:20:24 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3HSc |
17:21:04 | FromDiscord | <azazello> In reply to @Solitude "you didnt specify generic": it appears to work if I define the Matrix size↵would it be possible for it not to be known during init? |
17:21:22 | FromDiscord | <azazello> (edit) "it" => "the parameters" | "the parametersnot to be known during init? ... " added "assume not" |
17:21:35 | FromDiscord | <Solitude> no, arrays have statically known size |
17:21:46 | FromDiscord | <Solitude> if you dont know the size, why are you using arrays? |
17:22:12 | FromDiscord | <azazello> make sense, could use seq (just learning nim, for aoc!)↵thanks for your help |
17:22:44 | FromDiscord | <Solitude> good read https://nim-lang.org/docs/tut1.html |
17:49:00 | arkanoid | could you please give me an example where I can use iterable[T] type? https://nim-lang.org/docs/system.html#iterable |
17:50:24 | arkanoid | it's defined as type iterable*[T] {.magic: IterableType.} and I'm trying to figure out what's the intended use. It's not a type alias of "iterator(): T" but the doc says that "Represents an expression that yields T" |
17:54:32 | * | al1ranger joined #nim |
17:55:04 | NimEventer | New question by bottomresults: Error: identifier expected, but got: paramStr(1), see https://stackoverflow.com/questions/70326183/error-identifier-expected-but-got-paramstr1 |
17:57:13 | * | al1ranger quit (Client Quit) |
18:01:47 | arkanoid | found my answer here https://github.com/disruptek/gitnim_osx/blob/7625eab936b24c75f6016b8b15bbbc0d8df272ff/tests/types/titerable.nim |
18:14:41 | * | noeontheend joined #nim |
18:23:44 | * | beshr joined #nim |
18:44:06 | FromDiscord | <Pralkarz> I think my compiler broke after I leaked so much memory that my computer crashed. 😅 |
18:44:24 | FromDiscord | <Pralkarz> sent a code paste, see https://play.nim-lang.org/#ix=3HT2 |
18:44:25 | FromDiscord | <Pralkarz> Is there any way to rebuild it? |
18:45:02 | NimEventer | New post on r/nim by LogoKidd: Error: identifier expected, but got: paramStr(1), see https://reddit.com/r/nim/comments/revbdd/error_identifier_expected_but_got_paramstr1/ |
18:45:12 | FromDiscord | <el__maco> I don't know anything about anything but have you tried deleting the cache folder |
18:45:24 | FromDiscord | <Pralkarz> I just did that and it works now, shouldn't have asked so soon. |
18:45:26 | FromDiscord | <Pralkarz> Thanks tho! |
18:45:32 | FromDiscord | <el__maco> np 🙂 |
18:46:11 | NimEventer | New thread by Luqaska: Error: identifier expected, but got: paramStr(1), see https://forum.nim-lang.org/t/8706 |
19:02:45 | * | GnuYawk joined #nim |
19:31:13 | * | neurocyte0132889 quit (Ping timeout: 250 seconds) |
19:39:16 | ozzz | Rika, demotomohiro, valerga, I dont use windows. I wrapped C library - libfcgi, which not works using gcc 11, when -d:release provided, or optimization flags higher than -O0 passed to compiler. |
19:39:38 | ozzz | with gcc-7 everything works well. |
19:50:38 | FromDiscord | <Fish-Face> is there any convenient way to use `parallel` for recursive problems |
19:55:01 | FromDiscord | <Zoom> Давай во вторник? |
19:55:46 | FromDiscord | <Fish-Face> (the process deadlocks when the threadpool gets exhausted. I have tried `spawnX` but get an internal error when compiling) |
20:18:42 | FromDiscord | <Fish-Face> weave documentation seems to consist only of examples? |
20:18:52 | * | sagax quit (Excess Flood) |
20:20:12 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:31:15 | * | neurocyte0132889 joined #nim |
20:31:16 | * | neurocyte0132889 quit (Changing host) |
20:31:16 | * | neurocyte0132889 joined #nim |
20:36:47 | * | neurocyte0132889 quit (Ping timeout: 268 seconds) |
20:40:30 | FromDiscord | <pjz> how do I turn a string into a set[char]? I'm sure it's obvious, but I've written < 100 lines of nim so far in my life 🙂 |
20:41:23 | FromDiscord | <reilly> In reply to @Xand*r*nius "how do I turn": https://nim-lang.org/docs/sets.html#toSet%2CopenArray%5BA%5D or https://nim-lang.org/docs/setutils.html#toSet.t%2Cuntyped |
20:41:41 | FromDiscord | <reilly> Oh wait, forget that first one, it's deprecated. Didn't read. |
20:41:53 | FromDiscord | <reilly> (edit) removed "https://nim-lang.org/docs/sets.html#toSet%2CopenArray%5BA%5D or" |
20:42:03 | FromDiscord | <pjz> sweet |
20:43:08 | FromDiscord | <nwilburn> sent a code paste, see https://play.nim-lang.org/#ix=3HTU |
20:49:01 | FromDiscord | <pjz> is there a 1.6 build for ubuntu 20.04LTS ? |
20:49:29 | FromDiscord | <pjz> I'd rather install a package than a manual install... they're so messy |
20:49:44 | FromDiscord | <Yardanico> well debian sid (unstable) has nim 1.6.0 |
20:49:49 | FromDiscord | <Yardanico> so _maybe_ you can install that |
20:49:54 | FromDiscord | <Yardanico> but I'd still recommend a manual install :) |
20:50:08 | FromDiscord | <Yardanico> https://packages.debian.org/sid/amd64/nim/download |
21:06:15 | * | tinytoast joined #nim |
21:06:42 | * | tinystoat quit (Read error: Connection reset by peer) |
21:14:33 | FromDiscord | <Professor Actual Factual> Anyone know of a good way of managing memory-related as side-effects? I know there was some discussion surrounding this topic on the forum a while back. Having a pragma like `{.noAllocations.}` would be great IMO. If the stdlib doesn't provide this, thats fine. How can I implement my own solution? |
21:14:50 | FromDiscord | <Yardanico> you can create your own tag and tag your functions |
21:14:57 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#effect-system-tag-tracking |
21:21:11 | * | noeontheend quit (Ping timeout: 268 seconds) |
21:22:28 | arkanoid | Professor Actual Factual, interesting feature, but it would require to tag all procs that allocates memory beforehand. Not sure if there's an automatic way to do that, but one idea could be to create a pragma to wrap a function and runs getOccupiedMem() as first and last op and saves the results to a log file if it differs, then use this info for further analysis |
21:23:03 | * | nrds quit (Remote host closed the connection) |
21:23:12 | arkanoid | well, maybe it could also be possible to tacke the memory allocator and tag the malloc |
21:23:43 | * | nrds joined #nim |
21:26:45 | arkanoid | I mean https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/memalloc.nim#L90 , but not sure if there are other hooks available |
21:31:09 | * | jjido joined #nim |
21:31:38 | FromDiscord | <Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HUj |
21:35:47 | * | pch quit (Remote host closed the connection) |
21:37:21 | * | pch joined #nim |
21:41:07 | FromDiscord | <SivadNai> can somebody remind me, when i see an exception message from parseInt like <pre> invalid integer: 14676 </pre> and sure enough it seems to be a format issue because the string length is 11, what options to i have to reformat this |
21:44:10 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:46:12 | FromDiscord | <Yardanico> In reply to @SivadNai "can somebody remind me,": can you try doing `echo repr mystr` |
21:46:16 | FromDiscord | <Yardanico> it'll show the spaces and all stuff |
21:46:22 | FromDiscord | <Yardanico> if it's just spaces you can use `strip` from `strutils` |
21:50:13 | arkanoid | could you please explain me here why proc returns error but template does not? https://play.nim-lang.org/#ix=3HUo |
21:50:59 | FromDiscord | <Yardanico> because iterable[T] currently only works with templates |
21:51:14 | FromDiscord | <Yardanico> don't ask me for the reason, i'm not the one who made it that way |
21:51:40 | FromDiscord | <SivadNai> to take a different line in the output, '000000000017F960"\01\07\06\03\02\0"↵invalid integer: 17632` |
21:52:04 | FromDiscord | <Yardanico> In reply to @SivadNai "to take a different": i think it might be an xy problem and you're actually getting your string in a wrong way from somewhere |
21:52:07 | FromDiscord | <Yardanico> how are you getting this string? |
21:52:26 | FromDiscord | <Yardanico> sure you can "clean" all the non-printable characters, but I think the problem is in the way you get that string |
21:52:29 | arkanoid | FINALLY I got my answer. Thanks yardanico, I've been playing a lot around this today and I couldn't undertand. The manual doesn't say that afaik |
21:53:16 | FromDiscord | <Yardanico> @arkanoid see the original pr https://github.com/nim-lang/Nim/pull/17196 |
21:53:26 | FromDiscord | <SivadNai> it's a bat file which calls a powerhshell `Get-CimInstance Win32_Process -Filter "name = 'Code.exe'" | select ProcessId , CommandLine | Format-Table -AutoSize -Wrap > Code.txt` |
21:53:57 | FromDiscord | <Yardanico> very weird, but yeah, you can clean that null byte |
21:54:08 | FromDiscord | <Yardanico> but i really think that you shouldn't be getting a null character here |
21:54:11 | FromDiscord | <SivadNai> so I didn't expect to get some strange format error like that |
21:54:14 | FromDiscord | <Yardanico> and how do you get it in nim ? |
21:54:17 | FromDiscord | <Yardanico> just reading the file? |
21:54:30 | arkanoid | Yardanico: how did you find this pr so fast? I've been using advanced github search for a while looking for something like this |
21:54:42 | FromDiscord | <Yardanico> because iterable[t] has been discussed previously |
21:54:46 | FromDiscord | <Yardanico> multiple times |
21:54:57 | FromDiscord | <Yardanico> about other people being confused why it only works with templates |
21:55:25 | FromDiscord | <SivadNai> yes, just going over `for line in lines "Code.txt":` |
21:55:55 | FromDiscord | <Yardanico> then you can use https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D with `chars` set to `{'\0'}` |
21:56:08 | FromDiscord | <Yardanico> but as I said, try to actually find why it's adding a null byte here |
21:56:52 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3HUr |
21:57:19 | FromDiscord | <Michal58> what is the best way to create an array full of some constant (different from zero)? |
21:57:29 | FromDiscord | <Yardanico> https://nim-lang.org/docs/algorithm.html#fill%2CopenArray%5BT%5D%2CT |
21:57:37 | FromDiscord | <SivadNai> thanks, I will try that. I'd already stripped Whitespace |
21:57:44 | FromDiscord | <Yardanico> but it's not "creating" it with some value, but actually filling after creating |
21:57:58 | FromDiscord | <Yardanico> the proc itself just does a simple loop really |
21:59:55 | FromDiscord | <Michal58> thanks |
22:16:23 | FromDiscord | <huantian> In reply to @Yardanico "don't ask me for": Isn't it something something iterables aren't actually first class objecs? |
22:20:43 | arkanoid | huantian, inline iterators are something, closure iterator are something else. Closure iterators are first class afaik |
22:38:34 | FromDiscord | <nwilburn> In reply to @nwilburn "Hello again! I am": Alright just to complete this saga I think I found a bug in lib/pure/net.nim. It doesn't look like newContext was passing CVerifyPeerUseEnvVars to sslScanCertificates, so we were creating an sslContext that wasn't using our supplied `SSL_CERT_DIR` and `SSL_CERT_FILE` certificate locations. ↵↵I submitted a bug and pull request taking a jab at fixing this. <https://github.com/nim-lang/Nim/pu |
23:38:35 | FromDiscord | <evoalg> I figured out four ways to split these lines of text: https://play.nim-lang.org/#ix=3HUH ... the 3rd way might be inefficient, so the 1st or 4th way might be my fav ... but is there a short way that's still readable? |
23:41:52 | FromDiscord | <Elegantbeef> Strscans is nice |
23:41:56 | FromDiscord | <Elegantbeef> Doesnt even require splitting 😀 |
23:43:22 | FromDiscord | <evoalg> oh! |
23:43:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HUN |
23:43:41 | FromDiscord | <evoalg> I keep forgetting about that - thank you! |
23:44:02 | FromDiscord | <Elegantbeef> Alternatively you could do it yourself |
23:47:55 | FromDiscord | <AmjadHD> sent a code paste, see https://paste.rs/Ssl |
23:47:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HUP |
23:48:34 | FromDiscord | <Elegantbeef> I'd imagine it'd move the memory, but i could be wrong |
23:50:47 | FromDiscord | <AmjadHD> In reply to @Elegantbeef "I'd imagine it'd move": Is there a way to check ? |
23:51:25 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3HUQ |
23:51:27 | FromDiscord | <Elegantbeef> Look where the data is |
23:52:09 | FromDiscord | <Elegantbeef> The `doStuff` method shares address which means it moves it fine, but the block method doesnt which means it deep copies the string |
23:55:07 | FromDiscord | <AmjadHD> Thanks, so isn't this an oppotunity for optimaization ? |
23:55:43 | FromDiscord | <AmjadHD> (edit) "optimaization" => "optimization" |
23:58:23 | FromDiscord | <AmjadHD> In reply to @Elegantbeef "The `doStuff` method shares": many templates and macros use a similar code, it would be wasteful to copy the block's returned expression. |