<< 12-12-2021 >>

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:29FromDiscord<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:54FromDiscord<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:15FromDiscord<pmunch> What do you mean?
00:50:27FromDiscord<Elegantbeef> Looking at it further it seems you only have the streamwrite method
00:50:44FromDiscord<DMI-1407> is there already a discord api for nim ?
00:50:47FromDiscord<Elegantbeef> My friend tried it yesterday and suffice to say he ran into a fair bit of issues
00:50:52FromDiscord<Elegantbeef> Dimscord yep
00:51:43FromDiscord<pmunch> Ah yes, it's built around streams
00:52:34FromDiscord<pmunch> So you parse your spec, create your object, and then write it to a stream
00:52:37FromDiscord<Elegantbeef> It does have a nice bug with nested empty messages aswell, though I've got a fix
00:53:14FromDiscord<Elegantbeef> Questioning whether i should clean up these macros though since it's very hard to read
00:56:38FromDiscord<pmunch> Oh yeah, they definitely need a cleanup..
00:57:05FromDiscord<pmunch> I believe protobuf was my first major macros project
00:57:13FromDiscord<Elegantbeef> Well there just made a PR for you
00:58:46FromDiscord<Elegantbeef> Yea i can really tell you used `astGenRepr` a lot 😛
00:59:51FromDiscord<Elegantbeef> Now to think of it, i've never used `astGenRepr` for anything but testing if logic is sound
00:59:52FromDiscord<pmunch> Haha, yup. I think that was actually what I wrote 'astGenRepr' for 😋
01:00:16FromDiscord<Elegantbeef> Oh you wrote `astGenRepr` for the stdlib?
01:00:24FromDiscord<pmunch> Yup
01:01:04FromDiscord<pmunch> I think I wrote it for protobuf, then realized it was probably a bad idea and barely ever touched it again 😅
01:01:37FromDiscord<pmunch> Then someone wrote \`quote\` which is a way nicer solution
01:01:44FromDiscord<Elegantbeef> It does what it promises but produces heavily unmaintainable macros
01:02:06FromDiscord<pmunch> Of course \`astGenRepr\` still has its uses, but not nearly as many after quote came along
01:02:14FromDiscord<Elegantbeef> quote/genast and the less verbose procedures are just nicer
01:02:29FromDiscord<Elegantbeef> well with genast i thinkg astgenrepr is mostly just a debug tool
01:02:54FromDiscord<pmunch> I then of course wrote superQuote in macroutils after that failed to get merged into Nim
01:02:55FromDiscord<Elegantbeef> You can now easily inject symbols/generate them
01:03:37FromDiscord<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:23FromDiscord<pmunch> Hmm, what's genast?
01:05:47FromDiscord<Elegantbeef> A new module in 1.6 that gives an alternative to quote removing many issues
01:06:01FromDiscord<pmunch> I wrote macroutils to try and fix a lot of the gripes I've had with writing macros over the years
01:06:05FromDiscord<Elegantbeef> Instead of making temporary variables before you just do `genAst(name = ident"ThisisAName")`
01:06:33FromDiscord<Elegantbeef> Now inside the scope `name` is the right hand of the `=`
01:06:34FromDiscord<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:47FromDiscord<Elegantbeef> It doesnt require accquoting either
01:06:50FromDiscord<pmunch> But it does have some nice tools, like superQuote
01:08:14FromDiscord<pmunch> Wait, so that's just \`let name = "ThisIsAName".ident\`?
01:11:00FromDiscord<pmunch> But I'm going to bed now
01:11:31FromDiscord<Elegantbeef> I mean it works like quote do but you can inject variables through parameters instead of capturing all variables in scope
01:11:43FromDiscord<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:54NimEventerNew 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:30arkanoidI have a nimpy function named "int8" that I have to call, but it calls nim's one
02:13:04arkanoidhow can I disambiguate?
02:14:17FromDiscord<Elegantbeef> `nimpy.int8(args)`
02:14:26arkanoidsolved with obj.`int8()`
02:14:39FromDiscord<Elegantbeef> If that doesnt help i guess commence operation cryalot
02:14:42arkanoidjust in time! thanks
02:15:12arkanoidthere's the callMethod proc in nimpy in case of emergency
02:15:54arkanoidI might have just found the perfect zero-copy interop between arraymancer and numpy/pandas and possibly many other scientific stacks
02:16:10FromDiscord<Elegantbeef> nice you've donest it
02:17:04arkanoiddonest?
02:17:16FromDiscord<Elegantbeef> done it but said jovial
02:17:36FromDiscord<valerga> running a nim binary seems to take at least 50ms, even on empty code, is that normal?
02:17:45FromDiscord<Elegantbeef> Nope
02:17:55FromDiscord<Elegantbeef> is this a release program?
02:18:27FromDiscord<valerga> https://media.discordapp.net/attachments/371759389889003532/919412853419679784/nimtime.jpg
02:18:30FromDiscord<valerga> that's release on empty code
02:18:44FromDiscord<valerga> im counting usr time
02:18:45FromDiscord<Elegantbeef> Are you compiling the binary and running it or counting the compil time?
02:18:56FromDiscord<valerga> i ran in twice
02:19:07FromDiscord<Elegantbeef> That doesnt answer my question
02:19:15FromDiscord<Elegantbeef> Are you actually timing the binary or the compiler?
02:19:19FromDiscord<valerga> ohh
02:19:26FromDiscord<valerga> i thought since it was cached it would just run it straight
02:19:37FromDiscord<valerga> i'll check the binary
02:19:38FromDiscord<Elegantbeef> Well it has to make sure it has no file changes
02:19:51FromDiscord<Elegantbeef> Which requires some computation
02:19:57FromDiscord<valerga> yeah it runs in 2ms
02:20:23FromDiscord<Elegantbeef> There we go that's a bit more reasonable since it has to set everything up and talk to the OS
02:20:57FromDiscord<valerga> 1ms on empty code
02:22:19FromDiscord<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:36FromDiscord<Elegantbeef> Ah yes that's a fun PR
02:25:14FromDiscord<huantian> wonder if that'l ever get merged...
02:25:40FromDiscord<Elegantbeef> probably not
02:26:17FromDiscord<Elegantbeef> To me it seems like a big "Work around the problems instead of fix them"
02:27:16FromDiscord<huantian> but writing `.toSeq` before my maps is so much work!
02:27:17FromDiscord<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:56FromDiscord<leorize> try sequtils.all?
02:28:03FromDiscord<evoalg> this is a simple example, but in reality it would be complicated so I can't use all or any
02:28:05arkanoidwhat's better "static: var ..." or "var {.compiletime.}" ?
02:28:47FromDiscord<evoalg> unless I put it in a proc, then I could use "all" I guess?
02:28:52FromDiscord<leorize> would allIt work then?
02:29:16FromDiscord<leorize> same as all but you don't have to make a proc
02:29:49FromDiscord<huantian> you could always use an anonomous proc or sugar ->, or just use allit
02:30:01FromDiscord<huantian> (edit) "->," => "+>,"
02:30:04FromDiscord<huantian> (edit) "+>," => "=>,"
02:30:57FromDiscord<Elegantbeef> Also why the hell are you using `discard """` we have multiline comments?!
02:31:03FromDiscord<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:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HM3
02:31:42FromDiscord<leorize> @evoalg\: you can use a code block with allIt
02:32:30FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3HM4
02:32:32FromDiscord<ajusa> Wait seriously I've using discard """ since like 2017, when did we get multiline comments
02:32:39FromDiscord<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:44FromDiscord<Elegantbeef> A while
02:32:55FromDiscord<Elegantbeef> WE even have multiple line doc comments
02:33:02FromDiscord<evoalg> In reply to @leorize "<@900872397224280125>\: you can use": Thank you! that's nice 🙂
02:33:04arkanoidhow can I create a const array 0..1000 int8?
02:33:25FromDiscord<Elegantbeef> `const arr: array[1000, uint8]`
02:33:38*noeontheend_ joined #nim
02:33:38*noeontheend joined #nim
02:34:20arkanoidElegantbeef, doesnt work, it expects an initialization
02:34:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HM6
02:34:40FromDiscord<leorize> beware of the const array trap (if it's still a thing)
02:35:03arkanoidooh, thanks
02:35:09arkanoidwhat's const array trap?
02:35:22FromDiscord<leorize> it's very much a thing for strings, though
02:35:38FromDiscord<leorize> the compiler attempting to inline array/string everywhere
02:35:59FromDiscord<leorize> exploding compile-time memory usage and binary size
02:36:12arkanoidwell I will have to test this zero-copy experiment for strings too, so I'll check this
02:36:14arkanoidthanks
02:37:47*noeontheend_ quit (Ping timeout: 252 seconds)
02:37:47*noeontheend quit (Ping timeout: 252 seconds)
02:49:39arkanoidturning a seq to an arraymancer tensor requires 4x memory and 13 allocations, apparently https://play.nim-lang.org/#ix=3HM8
02:50:11arkanoidit's quite more convenient staying with seqs
02:51:02arkanoidups, wrong channel, was or #nim-science
03:12:59*vicecea quit (Remote host closed the connection)
03:13:28*vicecea joined #nim
03:25:34arkanoidis GC_getStatistics() unavailable for ARC?
03:25:54arkanoidit runs, but I'm getting zero in any context
03:28:14arkanoidoh! 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:18FromDiscord<Rika> In reply to @evoalg "Sometimes I have to": `not container.anyIt(condition)`?
04:01:30FromDiscord<Rika> In reply to @evoalg "this is a simple": why not?
04:01:44FromDiscord<Rika> you can always make the proc not-inline
04:02:17FromDiscord<Rika> proc ...[T](a, b: T): bool = ...↵echo not container.any(...)
04:03:57FromDiscord<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:51FromDiscord<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:54FromDiscord<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:19ozzzI spent couple of hour yeasterday, just to find out that Nim not works well with gcc 11.1
08:24:44FromDiscord<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:48FromDiscord<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:15FromDiscord<valerga> a file you compiled or a file from gcc?
11:07:11FromDiscord<el__maco> always fun when the antivirus quarantines the file you just compiled
11:16:14FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOc
11:16:24FromDiscord<valerga> im thinking this might be a bottleneck
11:16:45FromDiscord<valerga> basically want to iterate over lowercase strings
11:16:48FromDiscord<Rika> No idea what any of these variables are in terms of type
11:17:05FromDiscord<valerga> seq of strings
11:17:11FromDiscord<Rika> Use a count table
11:23:07NimEventerNew 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:16FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOf
11:26:22FromDiscord<valerga> I'm copying a seq to a new seq
11:26:33FromDiscord<valerga> add an item to it, then it to the queue seq
11:26:42FromDiscord<valerga> wondering if there's a better way
11:27:44FromDiscord<Rika> Better as in?
11:27:59FromDiscord<Rika> Shorter code or faster or memory efficient or idiomatic or what
11:29:36FromDiscord<valerga> faster, there's some bottleneck somewhere, thinking maybe there
11:29:52FromDiscord<valerga> since the count table didn't change speed
11:31:33FromDiscord<Rika> q.add(p & c)
11:31:37FromDiscord<Rika> I think that works
11:31:38FromDiscord<Rika> Not sure
11:33:04FromDiscord<valerga> that works, but same speed heh
11:33:30FromDiscord<Rika> You need to change the algorithm then
11:33:48FromDiscord<Rika> Avoid the double copy from that sequence adding
11:34:00FromDiscord<Rika> It feels wrong too
11:34:10FromDiscord<Rika> Surely there’s a different way?
11:35:09FromDiscord<valerga> it's this algorithm https://www.geeksforgeeks.org/print-paths-given-source-destination-using-bfs/
11:35:31FromDiscord<valerga> https://play.nim-lang.org/#ix=3HOh
11:37:49FromDiscord<valerga> it finds the solution but in 400s !!
11:42:09*src joined #nim
11:49:13FromDiscord<valerga> sent a code paste, see https://play.nim-lang.org/#ix=3HOo
11:49:23FromDiscord<valerga> that's ok?
11:49:23FromDiscord<Rika> Use a deque for that
11:49:49FromDiscord<Rika> If you’re not accessing middle items use a deque
11:57:14*krux02 joined #nim
11:58:12FromDiscord<valerga> wow @Rika that really made a difference
11:58:41FromDiscord<valerga> reduced it from 400s to 2s
11:58:57FromDiscord<valerga> thank you
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:30*supakeen joined #nim
12:13:27FromDiscord<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:49FromDiscord<valerga> any text in particular you recommend?
13:46:20*jjido joined #nim
13:47:50FromDiscord<Rika> unfortunately i dont
14:13:57*arkurious joined #nim
14:33:28NimEventerNew 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:21arkanoidI don't remember it there's a std proc to take just N elements from iterable
15:37:38NimEventerNew thread by Icedquinn: Renovate Bot, see https://forum.nim-lang.org/t/8705
15:43:07Amun-Rawhat's nim's equivalent of python's: except (FooError, BarError) as e:?
15:46:58FromDiscord<Rika> `except A, B:\n let e = getCurrentException()`
15:47:09FromDiscord<0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3HRq
15:48:17Amun-RaRika: thanks
15:49:13FromDiscord<Rika> In reply to @0ffh "Hi, I'm implementing a": 0x55 is not coerced into a uint64 it seems?
15:49:23FromDiscord<Rika> honestly i wouldnt use a tuple here
15:50:31FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3HRs
15:50:51FromDiscord<planetis> Has anyone worked on a function chain macro? Any examples?
15:51:07FromDiscord<0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3HRt
15:51:44FromDiscord<Rika> okay then
15:51:44FromDiscord<Rika> wait
15:51:47FromDiscord<Rika> ill see
15:52:13FromDiscord<Rika> ah
15:52:14FromDiscord<Rika> lol
15:52:29FromDiscord<Rika> seems like generic tuple `[]` is taking precedence over your `[]`
15:52:43FromDiscord<0ffh> oh, i see
15:53:01FromDiscord<Rika> i dont know why
15:53:01FromDiscord<0ffh> maybe i can get around that my making it distinct?
15:53:10FromDiscord<0ffh> (edit) "my" => "by"
15:53:45FromDiscord<Rika> honestly go with the object
15:54:34FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3HRu
15:54:39FromDiscord<0ffh> okay, i'll try that thanks!↵making the tuple distinct prevents field access
15:55:41FromDiscord<Rika> notably with the object, the templates are now procs and you have to use object construction syntax `BV(val: ..., ...)`
15:56:26FromDiscord<0ffh> okay
16:03:45FromDiscord<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:10FromDiscord<Rika> no
16:04:33FromDiscord<Rika> well, from what i know, nimble has a "private" directory
16:04:50FromDiscord<Rika> but i dont know if it actually does anything from outside of nimble
16:05:17FromDiscord<deech> I suppose it's academic because Nim now allows the caller to expose private fields.
16:05:28FromDiscord<0ffh> In reply to @Rika "notably with the object,": works fine now, thanks a bunch!
16:07:39FromDiscord<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:04arkanoidthe 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:15FromDiscord<Rika> it usually does before "Error:"
16:24:38FromDiscord<Rika> "/file.nim(line, character) Error:`
16:24:40FromDiscord<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:46arkanoidyeah but sometimes is way off the real line, it seems
16:33:26arkanoidI'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:22FromDiscord<Rika> as a seq?
16:43:41*lumo_e quit (Ping timeout: 268 seconds)
16:46:01arkanoidRika: no, something like https://play.nim-lang.org/#ix=3HRR
16:46:52arkanoidI think is something eveybody has already faced (and also what zero_functional is all about), chaining iterators
16:47:03arkanoidchaining *inline* iterators
16:50:54FromDiscord<Rika> you cant use iterable[] in procs
16:53:13arkanoidI'm confused
16:53:15arkanoidwhy not?
16:53:19*lumo_e joined #nim
16:54:01arkanoiddocs says "Represents an expression that yields T"
16:55:23FromDiscord<Rika> probably has to do with compile time construct and whatever but i dont know
16:55:34FromDiscord<Rika> i dont have experience with newest nim features right now
16:59:22arkanoidhmm, 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:42arkanoidit works if I import sequtils, don't know what I am using of sequtils in that example
17:02:31FromDiscord<Rika> items
17:02:35FromDiscord<coldfussion> sent a code paste, see https://play.nim-lang.org/#ix=3HS1
17:02:43FromDiscord<Rika> https://nim-lang.org/docs/sequtils.html#items.i
17:03:09FromDiscord<Rika> cold there is no error here it looks
17:03:19FromDiscord<Rika> plugin can be wrong
17:03:31FromDiscord<Rika> error on compile should be your source of truth
17:04:26FromDiscord<Solitude> or your `l` is not mutable
17:06:07FromDiscord<planetis> macros hard me dumb
17:06:25arkanoiddoes `for x in foo` always means calling foo.items no matter what is the type of foo?
17:06:57FromDiscord<Solitude> yes
17:07:29arkanoidok, thanks, now everything clicks
17:09:30FromDiscord<coldfussion> sent a code paste, see https://play.nim-lang.org/#ix=3HS3
17:10:08arkanoidwhere 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:14FromDiscord<Rika> your l is not mutable
17:10:17FromDiscord<Solitude> In reply to @coldfussion "Probably, I currently have": https://nim-lang.org/docs/manual.html#procedures-var-parameters
17:10:40FromDiscord<Rika> arkanoid inline iterators do not exist on runtime (of course, because theyre inlined)
17:10:51FromDiscord<Rika> closure iterators can be halted and resumed at will
17:11:06FromDiscord<Rika> at the expense of memory and speed
17:11:24FromDiscord<pmunch> Well, not quite "at will"
17:11:43FromDiscord<coldfussion> Oh, thank you↵(@Solitude)
17:14:24FromDiscord<coldfussion> the type mismatch error message is quite a bit misleading tbh...
17:14:48arkanoidyeah, 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:50FromDiscord<Solitude> In reply to @coldfussion "the type mismatch error": its intentional, to drive more people to chat
17:16:54FromDiscord<0ffh> how can i do a reinterpreting cast between signed and unsigned integers?
17:17:12FromDiscord<Rika> cast
17:17:19FromDiscord<Rika> cast is reinterpret cast
17:18:31FromDiscord<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:42FromDiscord<0ffh> (edit) "iÄm" => "i'm"
17:19:34FromDiscord<azazello> sent a code paste, see https://play.nim-lang.org/#ix=3HSa
17:20:24FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3HSc
17:21:04FromDiscord<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:22FromDiscord<azazello> (edit) "it" => "the parameters" | "the parametersnot to be known during init? ... " added "assume not"
17:21:35FromDiscord<Solitude> no, arrays have statically known size
17:21:46FromDiscord<Solitude> if you dont know the size, why are you using arrays?
17:22:12FromDiscord<azazello> make sense, could use seq (just learning nim, for aoc!)↵thanks for your help
17:22:44FromDiscord<Solitude> good read https://nim-lang.org/docs/tut1.html
17:49:00arkanoidcould you please give me an example where I can use iterable[T] type? https://nim-lang.org/docs/system.html#iterable
17:50:24arkanoidit'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:04NimEventerNew 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:47arkanoidfound 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:06FromDiscord<Pralkarz> I think my compiler broke after I leaked so much memory that my computer crashed. 😅
18:44:24FromDiscord<Pralkarz> sent a code paste, see https://play.nim-lang.org/#ix=3HT2
18:44:25FromDiscord<Pralkarz> Is there any way to rebuild it?
18:45:02NimEventerNew 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:12FromDiscord<el__maco> I don't know anything about anything but have you tried deleting the cache folder
18:45:24FromDiscord<Pralkarz> I just did that and it works now, shouldn't have asked so soon.
18:45:26FromDiscord<Pralkarz> Thanks tho!
18:45:32FromDiscord<el__maco> np 🙂
18:46:11NimEventerNew 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:16ozzzRika, 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:38ozzzwith gcc-7 everything works well.
19:50:38FromDiscord<Fish-Face> is there any convenient way to use `parallel` for recursive problems
19:55:01FromDiscord<Zoom> Давай во вторник?
19:55:46FromDiscord<Fish-Face> (the process deadlocks when the threadpool gets exhausted. I have tried `spawnX` but get an internal error when compiling)
20:18:42FromDiscord<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:30FromDiscord<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:23FromDiscord<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:41FromDiscord<reilly> Oh wait, forget that first one, it's deprecated. Didn't read.
20:41:53FromDiscord<reilly> (edit) removed "https://nim-lang.org/docs/sets.html#toSet%2CopenArray%5BA%5D or"
20:42:03FromDiscord<pjz> sweet
20:43:08FromDiscord<nwilburn> sent a code paste, see https://play.nim-lang.org/#ix=3HTU
20:49:01FromDiscord<pjz> is there a 1.6 build for ubuntu 20.04LTS ?
20:49:29FromDiscord<pjz> I'd rather install a package than a manual install... they're so messy
20:49:44FromDiscord<Yardanico> well debian sid (unstable) has nim 1.6.0
20:49:49FromDiscord<Yardanico> so _maybe_ you can install that
20:49:54FromDiscord<Yardanico> but I'd still recommend a manual install :)
20:50:08FromDiscord<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:33FromDiscord<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:50FromDiscord<Yardanico> you can create your own tag and tag your functions
21:14:57FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#effect-system-tag-tracking
21:21:11*noeontheend quit (Ping timeout: 268 seconds)
21:22:28arkanoidProfessor 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:12arkanoidwell, maybe it could also be possible to tacke the memory allocator and tag the malloc
21:23:43*nrds joined #nim
21:26:45arkanoidI 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:38FromDiscord<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:07FromDiscord<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:12FromDiscord<Yardanico> In reply to @SivadNai "can somebody remind me,": can you try doing `echo repr mystr`
21:46:16FromDiscord<Yardanico> it'll show the spaces and all stuff
21:46:22FromDiscord<Yardanico> if it's just spaces you can use `strip` from `strutils`
21:50:13arkanoidcould you please explain me here why proc returns error but template does not? https://play.nim-lang.org/#ix=3HUo
21:50:59FromDiscord<Yardanico> because iterable[T] currently only works with templates
21:51:14FromDiscord<Yardanico> don't ask me for the reason, i'm not the one who made it that way
21:51:40FromDiscord<SivadNai> to take a different line in the output, '000000000017F960"\01\07\06\03\02\0"↵invalid integer: 17632`
21:52:04FromDiscord<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:07FromDiscord<Yardanico> how are you getting this string?
21:52:26FromDiscord<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:29arkanoidFINALLY 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:16FromDiscord<Yardanico> @arkanoid see the original pr https://github.com/nim-lang/Nim/pull/17196
21:53:26FromDiscord<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:57FromDiscord<Yardanico> very weird, but yeah, you can clean that null byte
21:54:08FromDiscord<Yardanico> but i really think that you shouldn't be getting a null character here
21:54:11FromDiscord<SivadNai> so I didn't expect to get some strange format error like that
21:54:14FromDiscord<Yardanico> and how do you get it in nim ?
21:54:17FromDiscord<Yardanico> just reading the file?
21:54:30arkanoidYardanico: 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:42FromDiscord<Yardanico> because iterable[t] has been discussed previously
21:54:46FromDiscord<Yardanico> multiple times
21:54:57FromDiscord<Yardanico> about other people being confused why it only works with templates
21:55:25FromDiscord<SivadNai> yes, just going over `for line in lines "Code.txt":`
21:55:55FromDiscord<Yardanico> then you can use https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D with `chars` set to `{'\0'}`
21:56:08FromDiscord<Yardanico> but as I said, try to actually find why it's adding a null byte here
21:56:52FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3HUr
21:57:19FromDiscord<Michal58> what is the best way to create an array full of some constant (different from zero)?
21:57:29FromDiscord<Yardanico> https://nim-lang.org/docs/algorithm.html#fill%2CopenArray%5BT%5D%2CT
21:57:37FromDiscord<SivadNai> thanks, I will try that. I'd already stripped Whitespace
21:57:44FromDiscord<Yardanico> but it's not "creating" it with some value, but actually filling after creating
21:57:58FromDiscord<Yardanico> the proc itself just does a simple loop really
21:59:55FromDiscord<Michal58> thanks
22:16:23FromDiscord<huantian> In reply to @Yardanico "don't ask me for": Isn't it something something iterables aren't actually first class objecs?
22:20:43arkanoidhuantian, inline iterators are something, closure iterator are something else. Closure iterators are first class afaik
22:38:34FromDiscord<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:35FromDiscord<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:52FromDiscord<Elegantbeef> Strscans is nice
23:41:56FromDiscord<Elegantbeef> Doesnt even require splitting 😀
23:43:22FromDiscord<evoalg> oh!
23:43:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HUN
23:43:41FromDiscord<evoalg> I keep forgetting about that - thank you!
23:44:02FromDiscord<Elegantbeef> Alternatively you could do it yourself
23:47:55FromDiscord<AmjadHD> sent a code paste, see https://paste.rs/Ssl
23:47:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HUP
23:48:34FromDiscord<Elegantbeef> I'd imagine it'd move the memory, but i could be wrong
23:50:47FromDiscord<AmjadHD> In reply to @Elegantbeef "I'd imagine it'd move": Is there a way to check ?
23:51:25FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3HUQ
23:51:27FromDiscord<Elegantbeef> Look where the data is
23:52:09FromDiscord<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:07FromDiscord<AmjadHD> Thanks, so isn't this an oppotunity for optimaization ?
23:55:43FromDiscord<AmjadHD> (edit) "optimaization" => "optimization"
23:58:23FromDiscord<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.