<< 29-10-2022 >>

01:46:05FromDiscord<Bung> https://github.com/nim-lang/Nim/issues/16688 Elegantbeef
02:26:41*arkurious quit (Quit: Leaving)
03:00:23FromDiscord<albassort> can i iterate over the number of items in a non array in json
03:00:57FromDiscord<albassort> the data is setup like this {"a" : {"A" : [...], "B" : [...]}}
03:01:15FromDiscord<albassort> I want to iterate over A and B
03:03:41FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1035750743124222112/unknown.png
03:03:45FromDiscord<albassort> nice i solved it myself
03:07:50FromDiscord<albassort> the kanji parser cant handle special characters
03:07:51FromDiscord<albassort> o.o
03:51:05*rockcavera quit (Remote host closed the connection)
06:33:14*derpydoo joined #nim
07:17:11*jjido joined #nim
07:36:40*derpydoo quit (Ping timeout: 250 seconds)
07:45:40*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
08:00:18*derpydoo joined #nim
08:40:21*jjido joined #nim
09:26:13FromDiscord<dlesnoff> In reply to @Isofruit "Create a folder `.vscode`": Isn't it a way to replace automatically the placeholder when creating a new project ? (after automatically running nimble init) ?
09:30:36FromDiscord<Phil> sent a long message, see http://ix.io/4en8
09:31:47FromDiscord<dlesnoff> No I was asking for t
09:31:53FromDiscord<dlesnoff> two things actually
09:32:14FromDiscord<dlesnoff> Whether we could run nimble init at the creation of a project
09:32:50FromDiscord<dlesnoff> and automatically replace placeholders/variables in the json by the project's name
09:38:34*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
09:41:17FromDiscord<hotdog> In reply to @Isofruit "You mean have .vscode/tasks.json": Nimble does automatically provide a task to compile - it’s “nimble build” no?
09:41:41FromDiscord<ChocolettePalette> I cross compiled a Nim program on GNU/Linux and then ran it on windows \:-)
09:42:49FromDiscord<Phil> In reply to @hotdog "Nimble does automatically provide": Not for me it doesn't
09:43:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ene
09:43:44FromDiscord<Phil> Could contain nimble tasks to: Release compile, debug compile and compile docs
09:43:45*jjido joined #nim
09:44:17FromDiscord<hotdog> No but it’s an implied task, it doesn’t need to be defined it’s just there
09:44:57FromDiscord<hotdog> In reply to @Isofruit "Could contain nimble tasks": This could be useful
09:45:12FromDiscord<Phil> It doesn't really show up with `nimble tasks`
09:45:56FromDiscord<Phil> Ahhh, under `nimble -h`
09:47:09FromDiscord<hotdog> In reply to @Isofruit "It doesn't really show": Yeah it would make sense if it was listed there too
09:53:59FromDiscord<Phil> Unrelated question, if something was merged into devel, at which point will it actually be available via choosenim?
09:54:56FromDiscord<Phil> sent a code paste, see https://paste.rs/E5W
10:02:17FromDiscord<pmunch> \`choosenim devel\` grabs the latest nightly
10:03:14FromDiscord<pmunch> There is a command that grabs the latest commit and builds it, but I'm on mobile now so I can't find it for you
10:03:32FromDiscord<ringabout> Yeah, it is `choosenim devel --latest`
10:11:05FromDiscord<haywireSSC> How would I have functions call each other?
10:12:01FromDiscord<haywireSSC> Because one has to be compiled before the other, it gives a error saying the other proc is not defined
10:12:15FromDiscord<haywireSSC> (edit) "functions" => "two procs"
10:12:56FromDiscord<Rika> You can forward declare one of the procedures
10:13:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4enj
10:13:12FromDiscord<Rika> Copy the second function signature and put it above the first function
10:13:22FromDiscord<Rika> (Without the equals sign)
10:13:27FromDiscord<haywireSSC> In reply to @Rika "Copy the second function": Ty
10:13:37FromDiscord<haywireSSC> That's neat
10:13:52FromDiscord<Rika> It’s unfortunate we still need to do it
10:13:57FromDiscord<Rika> Some languages don’t need it at all
10:14:03FromDiscord<Rika> Oh well, at least it’s possible
10:15:01FromDiscord<haywireSSC> In reply to @Elegantbeef "You can use the": I found a thingy called macros2 and it's perfect for this
10:17:10FromDiscord<haywireSSC> There is the experimental code reordering which helps slightly ig
10:17:56FromDiscord<haywireSSC> In reply to @Rika "Oh well, at least": Yeah, just glad I now have a way to do it finally
10:20:48*jmdaemon quit (Ping timeout: 252 seconds)
10:50:08FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4enr
11:03:11FromDiscord<Phil> In reply to @flywind "`choosenim update devel --latest`": Well... I mean, `default` for objects with `DateTime` fields works now then.↵Can't really do anything for `distinct DateTime` types though, that errors out still.↵I didn't quite understand your comment in the github issue about that though, where you writing that the issue with `distinct DateTime` type has been around for a while already and requires a separate issue?
11:03:29FromDiscord<Phil> (edit) removed "Well... I mean," | "then.↵Can't" => "then, nice.↵Can't"
11:03:35FromDiscord<Phil> (edit) "nice.↵Can't" => "nice!↵Can't"
11:05:50FromDiscord<ringabout> It is probably caused by a pre-existing bug.
11:06:32FromDiscord<ringabout> I will work on it next week.
11:09:25FromDiscord<Phil> Ah, so no need for me to open a separate issue?
11:12:05FromDiscord<ringabout> It's the problem
11:12:05FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4enu
11:12:55FromDiscord<ringabout> You can reproduce it with old Nim versions.
11:21:23FromDiscord<Phil> In reply to @flywind "Yeah, it would better": In that case, here we go: https://github.com/nim-lang/Nim/issues/20695
11:27:59FromDiscord<ringabout> nice
12:09:52*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:10:18*dnh joined #nim
12:11:30*dnh quit (Client Quit)
12:11:58*dnh joined #nim
12:42:44FromDiscord<hovsater> I want to try solve a few LeetCode problems using Nim. Unfortunately, there's support for Nim. Is there a way around it? Could emit C from my Nim program and run that through LeetCode? Any ideas?
12:43:03FromDiscord<hovsater> (edit) "I want to try solve a few LeetCode problems using Nim. Unfortunately, there's support for Nim. Is there a way around it? Could ... emit" added "I make nim" | removed "from my Nim program"
12:43:10FromDiscord<hovsater> (edit) "nim" => "Nim"
12:44:30FromDiscord<ringabout> In reply to @hovsater "I want to try": There is a hack way => https://maskray.me/blog/2021-09-26-competitive-programming-in-nim
12:47:31FromDiscord<hovsater> In reply to @flywind "There is a hack": Interesting. Thanks for that. Definitely looks like a hack, but I guess it is what it is.
13:02:47*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:03:13*dnh joined #nim
13:08:12*dnh quit (Ping timeout: 264 seconds)
13:09:26NimEventerNew Nimble package! formatstr - string interpolation, complement of std/strformat for runtime strings, see https://github.com/guibar64/formatstr
13:44:08*arkurious joined #nim
13:54:01FromDiscord<guttural666> is there an easy/correct way to delete an entry from a sequence while iterating, without the iterator shitting itself and everything breaking? 😄
13:54:48FromDiscord<enthus1ast> return a new filtered one
13:55:19FromDiscord<guttural666> maybe without wasting memory
13:55:43FromDiscord<guttural666> just manipulate the iterator in case of a deletion maybe?
14:00:14FromDiscord<enthus1ast> another option is to iterate from the end to the start, getting the value manually by its index, and when it matches delete it
14:01:11FromDiscord<guttural666> that sounds pretty good, thanks!
14:02:25FromDiscord<guttural666> but not sure if backwards or forwards makes a difference then
14:03:02FromDiscord<enthus1ast> if you go forward, then you must check the len in every iteration
14:03:23FromDiscord<d4rckh> any cool sqlite library for nim that supports models e.g. it can return actual nim objects
14:05:23FromDiscord<enthus1ast> norm maybe
14:06:19FromDiscord<guttural666> right, thanks!
14:08:14FromDiscord<d4rckh> norm seems good, thanks
14:12:08FromDiscord<Eino> sent a code paste, see https://play.nim-lang.org/#ix=4eoh
14:14:49FromDiscord<enthus1ast> idk if it is any better but you could also cast the uint16 to an array[2, uint8] and just set it; or look through https://nim-lang.org/docs/bitops.html if there is something better
14:39:48FromDiscord<Eino> sent a code paste, see https://paste.rs/24a
15:02:30FromDiscord<deech> Is there an `Either` or `Result` type in the Nim standard library? The closest one I could find is `status-im/nim-stew` but that doesn't work with with the HEAD of Nim.
15:05:17FromDiscord<Tanguy> In reply to @deech "Is there an `Either`": You can use this branch https://github.com/status-im/nim-stew/pull/146
15:05:43FromDiscord<Tanguy> Stdlib only has Option afaik
15:23:05FromDiscord<sOkam!> In reply to @deech "Is there an `Either`": `std/options` maybe fits? 🤔
15:30:23NimEventerNew thread by gcao: Multithread support in a dynamic language interpreter, see https://forum.nim-lang.org/t/9560
15:41:18arkanoidhow can I create a template that gets an body:untyped arg that contains async code? compiler says that I can't attach {.async.} to template signature
15:48:51FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4eoL
15:49:16FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4eoL" => "https://paste.rs/HxZ"
15:54:05FromDiscord<hotdog> In reply to @sOkam! "How is this an": You’ve got the echo where nim is expecting the proc return type
15:54:32FromDiscord<hotdog> Change “):” to “)=“
15:54:50FromDiscord<sOkam!> oh crap, too much gdscript this weekend broke my brain lol
15:54:57FromDiscord<sOkam!> ty for noticing the syntax 😄
15:55:43Amun-Ragdscript? looks very pythony
15:55:50FromDiscord<hotdog> No worries, I do it too when jumping between languages a lot 🙂
16:05:21FromDiscord<sOkam!> yeah, the syntax highlight in discord for nim works better for gdscript than python does 😄
16:06:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4eoS
16:06:22FromDiscord<deech> sent a code paste, see https://paste.rs/JWk
16:06:36FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4eoS" => "https://play.nim-lang.org/#ix=4eoT"
16:10:03arkanoidis it possible to build a proc name from untyped arg plug a string? like template(foo: untyped) = proc `foo`Plugin(...)
16:26:37FromDiscord<Tanguy> In reply to @deech "<@427483936587907082> FYI the following": I would way Nim, any invalid C code is nim's fault↵Seems similar to https://github.com/status-im/nim-stew/issues/142
16:30:46FromDiscord<deech> In reply to @Tanguy "I would way Nim,": You're right, I reported: https://github.com/nim-lang/Nim/issues/20699
16:32:37FromDiscord<Ricky Spanish> What profiling tools is there for nim? I was looking for a pyroscope integration or something similar so I can visualize function call times
16:43:57FromDiscord<Tanguy> Anything that profiles C will also work with nim, the function names will just be ugly
16:47:23FromDiscord<Ricky Spanish> Ah but there's no common specific ones that work well for nim meant? I was trying to to avoid something like Tracy where it has a bunch of setup steps
17:14:17FromDiscord<hotdog> In reply to @Ricky Spanish "Ah but there's no": Callgrind/kcachegrind doesn't really require any setup and works well with Nim
17:22:17FromDiscord<Ricky Spanish> In reply to @hotdog "Callgrind/kcachegrind doesn't really require": awesome thanks hadnt heard of callgrind before
17:24:15FromDiscord<hotdog> In reply to @Ricky Spanish "awesome thanks hadnt heard": No problem 🙂 You just have to add a couple of compile flags then run the tool. Pretty good introduction here: https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html
17:33:22*derpydoo quit (Ping timeout: 250 seconds)
18:54:46FromDiscord<Ricky Spanish> In reply to @hotdog "No problem 🙂 You": yes tried this thank you its exactly what i wanted
18:59:25FromDiscord<Tuatarian> In theory, if I wanted to turn arc off for whatever reason and go gc-free, would I lose stdlib access?
19:00:56FromDiscord<Tuatarian> Ie would the stdlib functions leak huge amts of memory
19:01:19FromDiscord<Tuatarian> If so, is there a way to leave the refcount of arc off but still use the static destructors?
19:02:07FromDiscord<Generic> with arc it's pretty much pay what you use
19:02:29FromDiscord<Generic> if you don't use ref types, you don't pay for ref counting
19:02:43FromDiscord<Generic> if you don't use heap types (seq, string) you don't pay for their allocation/deallocation
19:03:05FromDiscord<Tuatarian> Right, but if I wanted ref types without refcounting?
19:03:18FromDiscord<Tuatarian> And obviously I'd be willing to manage them manually (that's my goal)
19:03:31FromDiscord<Generic> yes, you can do that
19:03:42FromDiscord<Generic> note that most of the standard library uses heap types like seq and string
19:03:46FromDiscord<Tuatarian> But would stdlib modules leak
19:03:50FromDiscord<Generic> but doesn't use ref types
19:03:59FromDiscord<Generic> seq and string aren't ref counted
19:04:10FromDiscord<Generic> that's why they have copy semantics
19:04:41FromDiscord<Tuatarian> Right, but if I go --gc:none anything the stdlib allocates would never get freed right?
19:06:18FromDiscord<Recruit_main707> exactly
19:06:32*cyraxjoe quit (Ping timeout: 250 seconds)
19:06:37FromDiscord<Generic> really? Does gc:none also turn of destructors?
19:06:43FromDiscord<Recruit_main707> that idk
19:06:56*cyraxjoe joined #nim
19:07:30FromDiscord<Tuatarian> I would imagine it does right?
19:08:04*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
19:08:48FromDiscord<Recruit_main707> gc:regions is discontinued, but its basically gc:none with the option to allocate refs in memory regions and later deallocate the whole region (manually)
19:09:41FromDiscord<Generic> ok it doesn't
19:10:17FromDiscord<Recruit_main707> nice
19:11:28FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=4epx
19:12:08FromDiscord<Recruit_main707> whats the issue with RootObj?
19:13:02FromDiscord<Recruit_main707> `type Parent {.inheritable.} = object` would work, but its essentially the same as RootObj internally
19:15:09FromDiscord<deech> I've found it a pretty buggy construct. https://github.com/nim-lang/Nim/issues/20699 is just one example.
19:31:50FromDiscord<whisper> Is there any lib that provides something like a secure vault? It can be very simple not looking for anything complex
19:35:54FromDiscord<Elegantbeef> You can use a concept for the procedure and it'll work↵(@deech)
19:39:53FromDiscord<Elegantbeef> Or in typical concept fashion it's more difficult than first imagined
19:42:44FromDiscord<jmgomez> Can you convert in comp time a nim node literal into a type instance? Like traveling from static MyType to MyType Instance
19:58:09FromDiscord<Elegantbeef> `newLit`
19:58:41*jjido joined #nim
20:01:04FromDiscord<Tuatarian> arc seems to be freeing things that it really shouldn't be
20:01:29FromDiscord<Tuatarian> can I not disable refcounting without also disabling the static destructors
20:01:42FromDiscord<jmgomez> In reply to @Elegantbeef "`newLit`": newLit does the opposite of what Im asking, doesnt it?
20:01:48FromDiscord<Tuatarian> could i perhaps use unmanaged pointers?
20:02:11FromDiscord<Elegantbeef> Unlikely, but you can do `-d:useMalloc` and valgrind it
20:02:37FromDiscord<Tuatarian> would using a `ptr` type instead of a `ref` type be a solution at all?
20:02:47FromDiscord<Tuatarian> I'm of course willing to manage these manually
20:02:49FromDiscord<Tuatarian> that's the goal actually
20:03:31FromDiscord<Elegantbeef> I mean i'd say that's not the solution but you can
20:03:59FromDiscord<Tuatarian> is there anything special that I need to do with ptr types that I don't with ref types?
20:04:05FromDiscord<exelotl> In reply to @iWonderAboutTuatara "Right, but if I": in my experience (targeting an embedded platform) `--gc:none --os:standalone` doesnt work that great nowadays (due to the exceptions being disabled at compile time so your macros stop working too), but you can do well with `--gc:arc --os:any -d:useMalloc -d:noSignalHandler --threads:off` and just not use string/seq/ref/closures
20:04:11FromDiscord<Tuatarian> other than obviously calling `=destroy` when needed
20:04:49FromDiscord<Tuatarian> I'm not actually doing embedded here, but I think things are getting freed when they shouldn't be
20:07:20FromDiscord<exelotl> nothing special, well `=destroy` hooks aren't hooks anymore if you're using raw pointers so it might be strange to call them that way, could just rename them to "destroy" or something, but I might be wrong there anyways or it doesnt matter
20:08:44FromDiscord<exelotl> arc shouldn't destroy stuff if its still in use, unless you're doing something weird
20:09:18FromDiscord<exelotl> But you could set a breakpoint with GDB to try and figure out where its freed and why
20:09:59FromDiscord<Tuatarian> I'm not doing anything too weird, but I guess it's high time to finally learn how gdb works lmao
20:16:30*pro joined #nim
20:26:09*pro quit (Quit: pro)
20:33:42FromDiscord<Raynei486> how do you use `musl-gcc` as the compiler with nimble
20:33:53FromDiscord<Raynei486> it says it's not an available option
20:40:34*jmdaemon joined #nim
20:46:38FromDiscord<Yardanico> You need to change gcc.exe and gcc.linkerexe, maybe also gcc.path
20:47:08FromDiscord<Yardanico> try with `nim --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static file.nim`, maybe this will also work for Nimble but I'm not sure if it passes those options
20:47:16FromDiscord<Yardanico> See e.g. https://scripter.co/nim-deploying-static-binaries/
20:58:21FromDiscord<Elegantbeef> This implies a logical error with your code, the solution is generally to fix that↵(@Tuatarian)
21:01:11FromDiscord<deech> In reply to @Elegantbeef "You can use a": Yeah unfortunately all the alternatives I can think of are bad. 😦
21:01:26FromDiscord<Elegantbeef> Eh single parent inheritance works for this case
21:02:31*wallabra quit (Ping timeout: 260 seconds)
21:02:50FromDiscord<Elegantbeef> You said `static T` to non static↵(@jmgomez)
21:03:03FromDiscord<Elegantbeef> 'Like traveling from static MyType to MyType Instance'
21:04:08FromDiscord<deech> In theory, toss it into one of these (https://github.com/status-im/nim-stew/blob/master/stew/results.nim#L19) and that triggers the codegen bug I reported (https://github.com/nim-lang/Nim/issues/20699).
21:04:31FromDiscord<Elegantbeef> With arc/orc anyway `RootRef` doesnt work that way iirc
21:05:39FromDiscord<Elegantbeef> Seems like it's actually `object of RootRef` causing the codegen
21:05:41FromDiscord<exp1oit> guys what's nim's equivalant of rust's .parse()
21:06:04FromDiscord<Elegantbeef> `object of RootObj` doesnt error there
21:06:06FromDiscord<deech> Yeah it's generating a bad default value for `object of RootRef`.
21:06:34FromDiscord<Elegantbeef> It's a regression with devel, seems to work with stable
21:06:38FromDiscord<Elegantbeef> What does rust's `parse` do
21:06:49FromDiscord<Elegantbeef> That's more helpful than asking random procedures from X language 😛
21:07:17FromDiscord<exp1oit> In reply to @Elegantbeef "It's a regression with": its basicly changes the type from string to int
21:07:24FromDiscord<Elegantbeef> `parseInt`
21:07:28FromDiscord<exp1oit> (edit) "basicly" => "basicaly"
21:09:12*derpydoo joined #nim
21:12:06FromDiscord<exp1oit> func is the same as proc ?
21:26:05FromDiscord<sOkam!> func is the func-tional version of proc. its meant to not have any side-effects
21:29:29*wallabra joined #nim
21:31:35FromDiscord<deech> In reply to @Elegantbeef "It's a regression with": It was that big ropes commit, crap. https://github.com/nim-lang/Nim/commit/ca1f3f36b9aff3b8284b2f529fd6fedb72a396c5
21:54:34*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
21:58:17*rb left #nim (WeeChat 3.5)
22:04:18FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4eqc
22:15:44FromDiscord<sOkam!> Oh, found it! Totally didn't understand the text of this one`poParentStreams`
22:15:55FromDiscord<sOkam!> (edit) "one`poParentStreams`" => "one `poParentStreams`"
22:18:57FromDiscord<jmgomez> In reply to @Elegantbeef "You said `static T`": maybe I didnt express it good enough then. ↵What I want is to convert something that's in the macro cache as NimNode to the actual type, kinda of the inverse of newLit. Does something like that exist?
22:26:28FromDiscord<Elegantbeef> Nope you need to do a hack where you use a template/macro to emit the macro
22:28:17*derpydoo quit (Ping timeout: 240 seconds)
22:54:09*arkurious quit (Quit: Leaving)
23:29:21FromDiscord<Mr.Ender> sent a code paste, see https://play.nim-lang.org/#ix=4eqq
23:29:28FromDiscord<Mr.Ender> (edit) "https://play.nim-lang.org/#ix=4eqq" => "https://play.nim-lang.org/#ix=4eqr"
23:30:17FromDiscord<Mr.Ender> (edit) "https://play.nim-lang.org/#ix=4eqr" => "https://play.nim-lang.org/#ix=4eqs"
23:30:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eqt
23:31:16FromDiscord<Mr.Ender> thank you very much
23:34:01FromDiscord<Elegantbeef> Though depending what you're doing there might be a cleaner way
23:41:16FromDiscord<albassort> is there a proc for counting occurrences of substrings?
23:41:19FromDiscord<albassort> im sure there is
23:41:22FromDiscord<albassort> i know I programmed one
23:41:28FromDiscord<albassort> i dont wanna look at my code though
23:42:55FromDiscord<Elegantbeef> `strutils`
23:43:17FromDiscord<albassort> beef is tired of answering strutils to all my questions
23:43:44FromDiscord<Elegantbeef> Eventually you're going to learn "Hey i need a string operation, maybe i should open up the docs for strutils"
23:44:00FromDiscord<albassort> its been years
23:44:15FromDiscord<albassort> when will i learn
23:44:15FromDiscord<Elegantbeef> If it requires me to drive a flagpole that has a flag with"strutils" on it through your skull so be it
23:45:20FromDiscord<Elegantbeef> I'm hoping soon you will RTFM but who knows
23:45:29FromDiscord<Elegantbeef> Lucky dis isnt here any longer
23:46:23FromDiscord<albassort> i read the manual more than you would think
23:46:33FromDiscord<Elegantbeef> Clearly not strutils manual
23:53:12FromDiscord<Rika> In reply to @Elegantbeef "Clearly not strutils manual": That ain’t no manual