<< 16-04-2023 >>

00:07:25*ltriant quit (Ping timeout: 250 seconds)
00:16:41*rockcavera quit (Read error: Connection reset by peer)
00:17:00*rockcavera joined #nim
00:17:00*rockcavera quit (Changing host)
00:17:00*rockcavera joined #nim
00:23:55*pharonix71 quit (Changing host)
00:23:55*pharonix71 joined #nim
00:26:24FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4twV
00:26:39FromDiscord<gogolxdong> devel latest
00:32:52*lucasta joined #nim
00:34:36*ltriant joined #nim
00:37:36FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4twW
00:39:39*ltriant quit (Ping timeout: 255 seconds)
00:41:43FromDiscord<Elegantbeef> They're different version so look into the source to see the cause
00:43:51FromDiscord<gogolxdong> I've checked stable and finds the cause but have no idea about devel.
00:55:23FromDiscord<leorize> someone wrote a thing to hook it up with null-ls, which makes it work with nvim lsp\: https://github.com/alaviss/nim.nvim/issues/49↵(@&_dükk ™)
00:55:54FromDiscord<gogolxdong> How to define int160 and int24
00:55:58FromDiscord<leorize> eventually the plugin will be rewritten in lua and bundle with this stuff, but for now this is the best I can offer
01:22:32*derpydoo joined #nim
03:29:37*ltriant joined #nim
03:37:51*ltriant quit (Ping timeout: 255 seconds)
03:46:17*arkurious quit (Quit: Leaving)
04:47:37*casaca quit (Ping timeout: 252 seconds)
04:50:54*casaca joined #nim
05:04:05*derpydoo quit (Ping timeout: 240 seconds)
05:09:14FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4txC
06:08:53*lucasta quit (Remote host closed the connection)
06:25:04FromDiscord<cmc> sent a long message, see http://ix.io/4txM
06:25:28FromDiscord<Elegantbeef> You cannot really
06:25:54FromDiscord<cmc> I see, it's magic?
06:25:58FromDiscord<Elegantbeef> It is
06:26:23FromDiscord<Elegantbeef> Do you have a more practical example?
06:26:40FromDiscord<Elegantbeef> I mean like you obviously do not just want an open array of nothing 😄
06:26:55FromDiscord<cmc> Don't judge me!
06:27:01FromDiscord<cmc> 😉
06:28:26FromDiscord<cmc> It would be a custom object with a pointer and a length, so the toOpenArray would allow it to be indexed
06:28:35FromDiscord<Elegantbeef> Right
06:29:37FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/G1U
06:29:57FromDiscord<Elegantbeef> Use overloading instead of attempting to convert
06:30:33FromDiscord<cmc> Yeah that's not that bad either, thanks. I was mostly irked I couldn't find the seq mechanism
06:30:40FromDiscord<Elegantbeef> you can even make a `template toOa(myFoo: Foo): untyped = myFoo.data.toOpenArray(0, myFoo.len)`
06:30:52FromDiscord<Elegantbeef> so anywhere you need to convert you can just do `myFoo.toOa()`
06:31:14FromDiscord<Elegantbeef> Yea it's an implicit conversion that cannot be done in user code cause `openArray[T]` cannot be returned from a proc
06:31:27FromDiscord<Elegantbeef> With views, maybe one day it'll work 😄
06:32:38FromDiscord<cmc> Aah, views
06:32:45FromDiscord<cmc> Oh so that's why! Ok
06:33:10FromDiscord<cmc> Cool thanks
06:40:17FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4txT
06:40:27*onetwo quit (Ping timeout: 256 seconds)
06:40:39FromDiscord<sOkam!> is the size pragma meant to achieve this?
06:40:48FromDiscord<ElegantBeef> `type MyEnum {.size: sizeof(int32).}`
06:40:56FromDiscord<sOkam!> ✍️ ty
06:59:20*onetwo joined #nim
07:07:23*henrytill quit (Ping timeout: 248 seconds)
07:07:44*casaca quit (Ping timeout: 246 seconds)
07:08:20*henrytill joined #nim
07:09:13*casaca joined #nim
07:15:18FromDiscord<sOkam!> is it possible to mark a proc so that it errors during compilation when used?
07:20:52FromDiscord<Elegantbeef> `{.error.}`
07:22:45*henrytill quit (Ping timeout: 260 seconds)
07:23:20*casaca quit (Ping timeout: 260 seconds)
07:24:10*henrytill joined #nim
07:25:52*casaca joined #nim
07:28:43*Notxor joined #nim
07:43:59*azimut quit (Ping timeout: 255 seconds)
07:47:31FromDiscord<ajusa> Is std/channels the best module to use when dealing with multiple threads, or are there alternatives? I'm trying to see if there's a way to listen to two channels at once in the same thread, but I'm not seeing any way of doing that
07:53:18FromDiscord<ajusa> Nevermind, found stashtable which seems to be what I want in the end
07:54:27FromDiscord<Void> I was doing exercism exercises and wanted to know why the same line works for echo but when I use return the compiler says indentation error:
07:54:32FromDiscord<Void> sent a code paste, see https://play.nim-lang.org/#ix=4tyb
07:54:44FromDiscord<Void> (edit) "echo" => "'echo'" | "return" => "'return'"
08:00:55*lumo_e joined #nim
08:06:16FromDiscord<cmc> Indent each return line by two spaces.
08:09:28FromDiscord<Void> the return line is indented two spaces from the if/else point, unless you mean spaces somewhere else
08:09:43FromDiscord<Yardanico> In reply to @Void "I was doing exercism": because you're using the wrong syntax for `return`
08:09:49FromDiscord<Yardanico> `echo "One for ", name, ", one for me."` calls echo with 3 arguments
08:10:17*PMunch joined #nim
08:10:17FromDiscord<Yardanico> because echo is actually a procedure that takes a variable number of arguments, while `return` is a separate statement that takes the return value if you provide it
08:10:38FromDiscord<Yardanico> so if you want to concat, use `return "One for " & name & ", one for me."`
08:10:44FromDiscord<Yardanico> or, for general formatting, there's https://nim-lang.org/docs/strformat.html
08:11:24FromDiscord<Void> Thanks, I'll go through that
08:12:05*tiorock joined #nim
08:12:05*tiorock quit (Changing host)
08:12:05*tiorock joined #nim
08:12:05*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
08:12:05*tiorock is now known as rockcavera
08:16:44FromDiscord<Yardanico> In reply to @Void "Thanks, I'll go through": basically you need to be aware of https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax
08:17:12FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tyf
08:17:16FromDiscord<Yardanico> both of those echo statements are 100% equivalent
08:18:19FromDiscord<Yardanico> well, they're not even echo "statements" since echo is just a proc defined in the main system module
08:18:23FromDiscord<Yardanico> it's not a keyword
08:19:21FromDiscord<Void> so the proc echo can take multiple arguments but we don't need to specifically put them in the bracket
08:19:34FromDiscord<Yardanico> In reply to @Void "so the proc echo": it is because of the feature I linked
08:19:43FromDiscord<Yardanico> Nim doesn't generally require you to use parentheses for proc calls
08:19:48FromDiscord<Yardanico> it's not specific to echo
08:19:51FromDiscord<Void> Ah
08:20:33FromDiscord<Void> I am still getting used to the proc calls but your links help. 👍
08:20:35FromDiscord<Yardanico> sent a code paste, see https://paste.rs/ZNF
08:20:45FromDiscord<Yardanico> all 4 last lines here mean exactly the same
08:21:30Amun-Rayou only have to add parentheses on a few specific occasions, like let x = …
08:22:56FromDiscord<Void> Can you explain the let x = ... example?
08:23:06Amun-Ralet x = foo(bar, baz)
08:23:24Amun-Raalhough in that example let x = bar.foo baz is fine
08:24:01Amun-RaNim has Uniform Function Call: foo(x, y, z) is the same as x.foo(y, z)
08:24:48FromDiscord<Yardanico> In reply to @Void "Can you explain the": I think Amun-Ra was referring to calling a proc without arguments
08:25:01FromDiscord<Yardanico> because `let x = twoFer` would be ambiguous otherwise - do you want to assign the proc to the variable, or the proc's result?
08:25:22Amun-RaYardanico: and a proc with many arguments
08:25:29FromDiscord<Yardanico> hm?
08:25:37FromDiscord<Yardanico> ah, you mean without , with multiple args, yeah
08:25:42FromDiscord<lauvrens> sent a code paste, see https://paste.rs/Mrd
08:25:48Amun-RaI could make an example but the play.nim seems to be down
08:26:10FromDiscord<Yardanico> In reply to @lauvrens "is it bad practice": it's not bad practice, you didn't even simplify it, you just removed some newlines
08:26:12FromDiscord<Elegantbeef> Fuuuuck 😄
08:26:14FromDiscord<Void> sent a code paste, see https://paste.rs/8RQ
08:26:20FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/5xY
08:26:21FromDiscord<Yardanico> In reply to @Void "Nice, I managed to": also you're missing one obvious thing
08:26:31FromDiscord<Yardanico> you can just set the default `name` to `you` and have one return statement only
08:26:46FromDiscord<Yardanico> and even then, in Nim `return` is optional if the last expression in your proc is the same type
08:26:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tyi
08:27:10FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tyj
08:27:23Amun-RaI write nim code in a way to reduce parenthese usage, byte.sizeof instead of sizeof(byte) or sizeof byte
08:27:48FromDiscord<Yardanico> In reply to @Amun-Ra "I write nim code": it depends on semantics, for "simple" procs I also use procs without ()
08:27:50FromDiscord<Yardanico> like len
08:27:55FromDiscord<Elegantbeef> subtle difference with yard's and mine is his causes a string interpolation every call, though it's minor
08:28:29FromDiscord<Void> Ok since we are on topic, can you explain what the (name = "you") does in this case please.
08:28:44FromDiscord<lauvrens> default value
08:28:54FromDiscord<lauvrens> or whatever its called
08:29:06FromDiscord<Void> Don't we have to set type for parameter or does it infer automatically?
08:29:28FromDiscord<lauvrens> i guess its inferred from the "you"
08:29:45FromDiscord<Yardanico> In reply to @Void "Don't we have to": you original code already had that
08:29:59FromDiscord<Yardanico> `name = ""` means that name is a string argument with the default value of an empty string
08:30:08FromDiscord<Yardanico> if you provide a default value, the type is optional
08:30:19FromDiscord<Void> Yea I was confused about that too, but thanks the explanations make sense now
08:30:40FromDiscord<Elegantbeef> \:d
08:30:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tyk
08:31:58FromDiscord<lauvrens> beautiful
08:33:00FromDiscord<Yardanico> yeah, the power of overloading
08:33:18FromDiscord<sOkam!> over ❤️ ing
08:33:21FromDiscord<Void> sent a code paste, see https://play.nim-lang.org/#ix=4tyl
08:33:46FromDiscord<Yardanico> In reply to @Void "So this example defines": it's not the same proc since one has no arguments, the other has 1 argument
08:33:49FromDiscord<Yardanico> it's called overloading
08:33:51FromDiscord<sOkam!> In reply to @Void "So this example defines": exactly. and the compiler knows what to pick
08:34:45FromDiscord<lauvrens> it will pick by the argument passed, so if you defined two procs with the same parameters the compiler will be like wtf
08:35:02FromDiscord<Yardanico> In reply to @lauvrens "it will pick by": it depends
08:35:28FromDiscord<Yardanico> look at this magic:
08:35:52FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tyo
08:36:13FromDiscord<Yardanico> ofc it's a proc call, I just omitted (), basically the overload resolution takes argument names into account as well
08:36:33FromDiscord<Yardanico> so if they're clearly different the compiler allows you to call different procs, even if their basic signature is the same (excluding argument names)
08:36:49FromDiscord<lauvrens> huh i did not know that thats cool
08:36:52FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4typ
08:38:00FromDiscord<Yardanico> sent a code paste, see https://paste.rs/onK
08:38:04FromDiscord<Yardanico> but I don't know C++, I might be wrong
08:38:08FromDiscord<Yardanico> but reinterpret_cast should be Nim's cast, yeah
08:38:16FromDiscord<sOkam!> ✍️
08:39:09FromDiscord<Void> Yea I am definitely writing down ✍️ these extreme optimization tricks too.
08:39:20FromDiscord<lauvrens> ✍️ same
08:39:30FromDiscord<Yardanico> In reply to @Void "Yea I am definitely": they're not optimization tricks, casting is a different thing :)
08:39:40FromDiscord<Yardanico> and the proc overloading is just for writing stuff in a nicer way
08:39:59NimEventerNew thread by alexeypetrushin: Mono UI, high productivity, simple and clean code, see https://forum.nim-lang.org/t/10102
08:42:17FromDiscord<Void> In reply to @Yardanico "and the proc overloading": at least I am learning how to write stuff better. less lines means cleaner code to my sub-amateur eyes
08:43:02PMunchPlayground should be back up now Amun-Ra
08:43:24Amun-RaPMunch: yes, it works, thank you
08:44:44FromDiscord<cmc> Is there a uniform way to get pointer and length from any type that supportsCopyMem?
08:45:40PMunchOoh, that would be useful
08:46:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tyr
08:47:30FromDiscord<Elegantbeef> `import std/typetraits`
08:54:19*derpydoo joined #nim
08:54:53Amun-Rathat'll exclude some types (mainly from C world) that support copyMem (cstring, etc.)
08:55:58Amun-Rathat's nice approach imo
08:56:47FromDiscord<Elegantbeef> Well cstring doesnt really support copymem
08:56:48FromDiscord<Elegantbeef> If you use a copymem on a cstring you leak memory
08:57:25FromDiscord<Elegantbeef> It's not about whether you can copymem over the data, it's about whether you can copymem on the data
08:57:35Amun-Raperhaps cstring wasn't the best example
08:58:10FromDiscord<Elegantbeef> `supportsCopyMem` is more like "has no pointers"
08:58:16Amun-RaI see
08:59:14FromDiscord<planetis> nope, it's actually "has no destructors attached". You can have pointers and supportsCopyMem returns true
08:59:24FromDiscord<Elegantbeef> Lol
08:59:27FromDiscord<Elegantbeef> That seems like a bug
09:00:59FromDiscord<Elegantbeef> Well we'll go with "has no managed pointers"
09:01:26FromDiscord<Elegantbeef> Really need a `hasNoPointers` or `hasPointers`
09:02:14FromDiscord<planetis> sent a code paste, see https://play.nim-lang.org/#ix=4tyt
09:02:39FromDiscord<planetis> If it's a bug I am happy to report it
09:02:58FromDiscord<Elegantbeef> I do not know really
09:05:50Amun-Rahttps://play.nim-lang.org/#ix=4tyu
09:06:25FromDiscord<Elegantbeef> It thinks differently to how i think
09:06:34FromDiscord<Elegantbeef> I think a type only supports copymem if it has no pointers
09:07:13FromDiscord<Elegantbeef> `ptr T` shouldnt support copy mem but `openArray[T]` should
09:07:49FromDiscord<Elegantbeef> It's a slice of memory, we safely know the length of the data and know we can copy/from it predictible
09:08:31FromDiscord<Elegantbeef> `ptr T` doesnt support copy mem in my opinion cause if you copymem to it corrupts the pointer leaking memory
09:08:45FromDiscord<Elegantbeef> Only fully pointless types i'd argue support copymem
09:10:43FromDiscord<Elegantbeef> But yea the definition fits with planetis' comment
09:10:48FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/XQR
09:11:50FromDiscord<Elegantbeef> And with that rambling i'm outta here
09:13:41Amun-RacopyMem works on pointers too, https://play.nim-lang.org/#ix=4tyv
09:14:20Amun-Rathis example is as close to C as it can get ;>
09:22:25*fredrik92 joined #nim
09:22:43Amun-Rawith dealloc there's not memory leakage
09:23:07*fredrikhr quit (Killed (NickServ (GHOST command used by [email protected])))
09:23:11FromDiscord<cmc> Neat!
09:23:14*fredrik92 is now known as fredrikhr
09:23:33*fredrikhr92 joined #nim
09:23:49Amun-Racmc: this is just a demo, I wouldn't write that way, ever
09:25:30NimEventerNew post on r/nim by h234sd: Mono, Web UI for Nim, high productivity, simple and clean code, see https://reddit.com/r/nim/comments/12o2ju0/mono_web_ui_for_nim_high_productivity_simple_and/
09:28:19*rockcavera quit (Remote host closed the connection)
09:35:40FromDiscord<Phil> I always have such a hard time justifying a webUI framework to myself when the JS bases that already exist have a pretty solid featureset
09:35:49FromDiscord<Phil> (edit) "bases" => "based ones"
09:35:50FromDiscord<cmc> Too late! This is now attached to your name! 😉Brutal, yet effective. Good to know sometimes you need this sort of thing↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>)
09:39:02FromDiscord<cmc> I suppose ptr types would need to be excluded, or you could argue whoever uses them deserves whatever undefined behavior they get
10:17:39FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4tyI
10:20:01FromDiscord<sOkam!> is this a usecase for `UncheckedArray[uint8]` ?
10:30:10*ltriant joined #nim
10:34:27*lumo_e quit (Ping timeout: 250 seconds)
10:34:45*ltriant quit (Ping timeout: 240 seconds)
10:59:31*derpydoo quit (Ping timeout: 240 seconds)
11:03:07NimEventerNew question by Alexandre Daubricourt: How to create strings inside of a Nim formatted string, see https://stackoverflow.com/questions/76027330/how-to-create-strings-inside-of-a-nim-formatted-string
11:20:35*ltriant joined #nim
11:27:31*ltriant quit (Ping timeout: 240 seconds)
11:42:59FromDiscord<cmc> Does an object need to be {.packed.} for a safe copyMem or is it just a performance thing?
11:49:39PMunchJust a performance thing
11:49:56PMunchIn particular memory size performance, speed performance will actually go down
11:50:35*pharonix71 quit (Ping timeout: 255 seconds)
11:53:37*pharonix71 joined #nim
11:58:44FromDiscord<cmc> Cool thanks
12:00:20*ltriant joined #nim
12:06:19*ltriant quit (Ping timeout: 250 seconds)
12:26:39*ltriant joined #nim
12:28:14FromDiscord<sOkam!> how do you convert a `pointer` to an `seq[uint8]` or `array[uint8]`?
12:28:32FromDiscord<sOkam!> (edit) "an" => "a"
12:30:03FromDiscord<Andreas> In reply to @sOkam! "how do you convert": `cast[UncheckedArray[uint8]](your_seq[0].addr)`
12:30:31FromDiscord<sOkam!> In reply to @Andreas "`cast[UncheckedArray[uint8]](your_seq[0].addr)`": i dont have a seq. i have a `void` from C, so `pointer`
12:31:05*ltriant quit (Ping timeout: 240 seconds)
12:31:39FromDiscord<Andreas> In reply to @sOkam! "i dont have a": AFAIK, one cannot cast a `nim Seq` directly, you need to cast to UncheckedArray, then loop and maybe fill a `seq`.
12:31:59FromDiscord<sOkam!> no biggie. but... how do you convert it to something usable?
12:32:10FromDiscord<sOkam!> my issue is from pointer-to-nim
12:32:28FromDiscord<sOkam!> (edit) "pointer-to-nim" => "pointer-to-nimAnything"
12:32:39FromDiscord<Andreas> In reply to @sOkam! "no biggie. but... how": cast[UncheckedArray[uint8]](your_pointer)
12:32:57FromDiscord<sOkam!> that was giving me error last time i tried
12:33:07FromDiscord<sOkam!> its the first thing i tried before asking
12:33:38FromDiscord<Andreas> In reply to @sOkam! "that was giving me": maybe try again, i'm confident it will work, unless the C-side gives you a bogus ptr..
12:34:24FromDiscord<Andreas> is it a `cstring` char[uint8] you are after ?
12:34:46FromDiscord<sOkam!> `Error: expression cannot be cast to UncheckedArray[uint8]`
12:35:25FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4tz3
12:36:11FromDiscord<sOkam!> In reply to @Andreas "is it a `cstring`": its a byte buffer, that contains unit8 because i sent it to C in that way, and this is coming back from an async callback
12:36:24FromDiscord<sOkam!> in this case it fits uint8, but other times might not
12:36:28FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4tz4
12:36:37FromDiscord<sOkam!> In reply to @Andreas "so you get a": yep
12:37:17FromDiscord<Andreas> sry, my bad `cast[ptr UncheckedArray[uint8]]`, trz this pls..
12:37:26FromDiscord<Andreas> (edit) "trz" => "try"
12:38:07FromDiscord<sOkam!> that compiled so far, yeah. its the solution i had so far, but since the app is not working i was still wondering if that is the right syntax for this
12:38:48FromDiscord<Andreas> In reply to @sOkam! "that compiled so far,": i guess this is the recommended way of doing things... AFAIk
12:40:14FromDiscord<Andreas> (edit) "AFAIk" => "AFAIK↵i found a proposal/solution in the forum - try search for 'CBuffer' smth.."
12:45:08*ltriant joined #nim
12:51:45*ltriant quit (Ping timeout: 240 seconds)
12:58:46*fredrik92 joined #nim
13:02:31*fredrikhr quit (Ping timeout: 240 seconds)
13:03:25*couven92 joined #nim
13:06:47*fredrik92 quit (Ping timeout: 260 seconds)
13:19:24Amun-Racmc: packed object nowadays almost always is going to be slower
13:20:19Amun-Racmc: you do the copy once, you access object members multiple times, extra cycles for misaligned reads will accumulate
13:34:37FromDiscord<cmc> Amun-Ra\_[IRC]#0000\: neat username btw!↵↵Ok so same tradeoff as on-the-fly compression just less pronounced
13:39:21Amun-Racmc: thanks!
13:41:05*jmdaemon quit (Ping timeout: 246 seconds)
13:45:42*ltriant joined #nim
13:45:44Amun-Rayou should use {.packed.} only in a few cases: to keep your object compliant with some ABI that uses __attribute__((packed)); not do depend on implementation defined struct paddings (if your code writes binary files that need to be read on several different systems)
13:50:25*ltriant quit (Ping timeout: 240 seconds)
13:53:44*junaid_ joined #nim
13:56:46*junaid_ quit (Remote host closed the connection)
14:32:44FromDiscord<stisa> anyone knows what's the status of hot code reloading with nim v2? Is it working with arc?
14:37:48FromDiscord<kodkuce> when Nim compiles to C can we force it to use /fp:strict like https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170
14:42:09FromDiscord<Anuke> Anyone know why the Nim output on godbolt always has an endbr64 at the start of each function, while other languages don't? https://media.discordapp.net/attachments/371759389889003532/1097170068984569967/image.png
14:54:47*lucasta joined #nim
15:06:25NimEventerNew post on r/nim by TooDeep94: Nim Language Server does often crash in VSCode, see https://reddit.com/r/nim/comments/12oc9mc/nim_language_server_does_often_crash_in_vscode/
15:07:11Amun-RaAnuke: looks like CF protection is on
15:07:34Amun-Raif you add --passc=-fcf-protection=none it'll dissapear
15:07:52Amun-Rahttps://nim.godbolt.org/z/63oqbvvMh
15:08:39NimEventerNew question by Alexandre Daubricourt: Nim import from project root directory, see https://stackoverflow.com/questions/76028551/nim-import-from-project-root-directory
15:08:47Amun-Rathe code is compiled with -fcf-protection=branch by default on godbolt
15:12:44*azimut joined #nim
15:13:20FromDiscord<Anuke> In reply to @Amun-Ra "<@123539225919488000>: looks like CF": ah, thanks
15:16:27FromDiscord<guttural666> can somebody tell me what is wrong here, I thought {.async.} gives me an implicit return value of type Future[void]? https://media.discordapp.net/attachments/371759389889003532/1097178698505011321/image.png
15:17:00FromDiscord<guttural666> (edit) "can somebody tell me what is wrong here, I thought {.async.} gives me an implicit return value of type Future[void]? ... https://media.discordapp.net/attachments/371759389889003532/1097178698505011321/image.png" added "says that async_api does not have a return type"
15:17:13*fredrikhr joined #nim
15:18:30NimEventerNew post on r/nim by Akronae: Nim import from project root directory, see https://reddit.com/r/nim/comments/12ocum1/nim_import_from_project_root_directory/
15:20:15*couven92 quit (Ping timeout: 260 seconds)
15:26:31NimEventerNew thread by noah: How to make os (e.g. ubuntu) interpret nimscript shebang , see https://forum.nim-lang.org/t/10104
15:26:39FromDiscord<Yardanico> In reply to @guttural666 "can somebody tell me": your code seems to be wrong for a few other reasons as we ll, can you actually show the compiler error?
15:26:52FromDiscord<Yardanico> at least I can see one problem - `var seq` won't work for async procs, you have to use references instead
15:27:02FromDiscord<guttural666> sent a long message, see http://ix.io/4tA4
15:27:03FromDiscord<Yardanico> also [V: Object] - I don't think generic async procs will work
15:27:06FromDiscord<Yardanico> yeah, probably because of generics
15:27:34FromDiscord<Yardanico> are you sure you actually want to make this proc async? Nim async is meant for IO, it doesn't spawn a new thread
15:28:31FromDiscord<guttural666> In reply to @Yardanico "are you sure you": yeah my terminology is wrong here, I want to spawn a bunch of API requests and the round trip to the server and back takes 2 seconds
15:29:08FromDiscord<Yardanico> yeah that should work if you're just doing http(s) requests, but yeah, no generics and no `var` captures
15:30:01FromDiscord<guttural666> hmmm
15:30:17FromDiscord<guttural666> (edit) "hmmm" => "hmmm, yeah doing https requests"
15:31:49FromDiscord<sOkam!> what matrix client do you guys recommend?
15:32:09FromDiscord<sOkam!> trying cinny, but no resize.... 😔
15:33:15FromDiscord<Ayy Lmao> Is there a way to get `echo` to do printouts in the debug console when debugging a dll hosted inside another program?
15:39:08Amun-RaAyy Lmao: debugprint
15:39:14Amun-Radebugecho I mean
15:39:27Amun-Raah, I misread it
15:40:26FromDiscord<Ayy Lmao> debugEcho doesn't seem to print anything out either.
15:40:56FromDiscord<Yardanico> @Amun-Ra debugEcho is only regarding Nim `func`, it doesn't relate to DLL stuff
15:41:10FromDiscord<Yardanico> In reply to @Ayy Lmao "Is there a way": what do you mean by the "debug console"?
15:42:13FromDiscord<Ayy Lmao> In reply to @Yardanico "what do you mean": So I'm trying to do an audio plugin hosted in a DAW. I have it set up in VSCode where it builds the dll and then launches the DAW. In VSCode there is a debug console where I can see info when there are seg faults.
15:42:39FromDiscord<Ayy Lmao> I don't seem to get any stack traces or anything though.
15:44:19FromDiscord<Ayy Lmao> I'm using LLDB to attach to the DAW.
15:45:02FromDiscord<Yardanico> i think this "debug console" has nothing to do with Nim, it's an LLDB thing probably as you said
15:45:31FromDiscord<Yardanico> you can make Nim output stack traces and exceptions as windows popup messages instead of the console, so maybe you can somehow reuse that?
15:45:38FromDiscord<Yardanico> nim does that with --app:gui
15:46:12FromDiscord<Yardanico> or maybe you can just have a try/except on the top of your code and log all exceptions yourself to a new console window spawned by your DLL, or to a file, or to the DAW's log, you get the idea
15:47:40FromDiscord<Ayy Lmao> I'm not sure --app:gui is an option with this. Doing some sort of roundabout thing was going to be the next thing I tried but I just wanted to be sure there wasn't a way to somehow pipe the output to LLDB.
15:48:28FromDiscord<Ayy Lmao> I'll have to see if try/except works. I need to be able to log errors before it crashes the program.
15:48:32FromDiscord<Yardanico> In reply to @Ayy Lmao "I'm not sure --app:gui": I don't think it'd be any easier than what you're doing already
15:48:45FromDiscord<Yardanico> In reply to @Ayy Lmao "I'll have to see": well yes, full try/except would do exactly that, unless you'll be getting segfaults that couldn't be caught
15:49:26FromDiscord<kodkuce> do i like this pass c compiler parasm , nim c --passC=fp:strict -d:release fu.nim
15:49:46NimEventerNew post on r/nim by Sentmoraap: wasMoved and =destroy does not cancel each other out, see https://reddit.com/r/nim/comments/12oeb48/wasmoved_and_destroy_does_not_cancel_each_other/
15:49:53FromDiscord<Yardanico> In reply to @kodkuce "do i like this": except the parameter seems to with / https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170
15:50:03FromDiscord<Yardanico> and since Nim uses a vccexe wrapper it might convert those options already, but yeah, it should just work
15:50:15FromDiscord<Yardanico> although changing those options might break Nim code
15:51:04FromDiscord<kodkuce> w8 what
15:51:07FromDiscord<Yardanico> ?
15:51:25FromDiscord<Yardanico> I mean not this option exactly, but it seems to modify the behaviour of float operations
15:51:33FromDiscord<kodkuce> if i use fp:strict i can brake Nim?
15:51:46FromDiscord<Yardanico> probably it won't do anything, I'm just speaking generally
15:54:00FromDiscord<kodkuce> you mean i have to pass fp:strict with / infront
15:54:11FromDiscord<kodkuce> but then it complains about linker stuff
15:54:22FromDiscord<kodkuce> like it parseses wrongly the command
15:54:33FromDiscord<guttural666> In reply to @Yardanico "yeah that should work": this is compiling now with var and generics, would have surprised me if this wasn't possible
15:54:48FromDiscord<Yardanico> In reply to @guttural666 "this is compiling now": can you show the code? :)
15:56:11FromDiscord<Yardanico> I mean if you're doing it without async, it will of course work, but as far as I know var captures don't work in async because they don't work in closure iterators
15:56:33FromDiscord<guttural666> In reply to @Yardanico "can you show the": bit of a mess, working on template api rn↵https://pastebin.com/y6nP08Gx
15:56:53FromDiscord<Yardanico> well, this is a template, so actually types and generics are kinda useless in it :)
15:57:08FromDiscord<Yardanico> templates are just code substitution, I was talking about using those for an async proc specifically
15:57:35FromDiscord<Yardanico> ah I see below, hm
15:58:02FromDiscord<guttural666> yeah, all the types are known at compile time when calling band or album api
15:58:41FromDiscord<Yardanico> wait, did you actually run the code yet?
15:58:44FromDiscord<Yardanico> i mean the api template
15:58:54FromDiscord<Yardanico> since your async proc is a generic, some compiler errors might not appear until you've instantiated it
15:59:00FromDiscord<guttural666> if I understood it correctly, I will have to await JSON Response in the actual async call to return control flow to the caller to spawn new async calls?
15:59:12FromDiscord<guttural666> I will in a minute 😛
15:59:40FromDiscord<Yardanico> well, my bet is that it wouldn't work, sorry :P
15:59:46FromDiscord<Yardanico> also any reason you'd have this weird mix of async and non-async?
16:00:01FromDiscord<Yardanico> e.g. you could make template api itself a proper async proc, and just `await all(futures)`
16:00:31FromDiscord<guttural666> seems happy 😄 https://media.discordapp.net/attachments/371759389889003532/1097189788097970206/image.png
16:01:19FromDiscord<guttural666> uhm, I really just want to make the JSON parts async, that is what is taking up 99% of my runtime
16:01:32FromDiscord<guttural666> waiting for server responses
16:05:33FromDiscord<guttural666> maybe I'm just clueless and I really need threading for my use case, I guess I'll find out
16:06:09FromDiscord<Yardanico> In reply to @guttural666 "maybe I'm just clueless": if you just need to do a lot of http(s) requests at the same time and don't want to wait for each one separately, then yeah, async will help
16:06:15FromDiscord<Yardanico> just be careful with rate limiting if the API has one
16:06:33FromDiscord<guttural666> In reply to @Yardanico "just be careful with": yeah got that mental note written down 😛
16:08:27FromDiscord<guttural666> In reply to @Yardanico "if you just need": yeah, that is what I thought, while the request is doing its round trip I can spawn more, first time I'm doing something like this, but Peter's blog post is helping https://peterme.net/asynchronous-programming-in-nim.html
16:13:31*fallback_ quit (Remote host closed the connection)
16:16:41FromDiscord<guttural666> just realized that I don't even need to partition my target sequence for my async tasks to write to, since me own program is still single threaded, so I can still safely seq.add my results contrary to multi-threading where I would use partitioning and give every thread it's own index window to write into
16:17:14FromDiscord<Yardanico> yeah, that's what I usually did in similar cases too
16:17:37FromDiscord<Yardanico> <https://github.com/Yardanico/adbscan/blob/master/src/adbscan.nim#L122> using a table instead, but same idea
16:17:56FromDiscord<Yardanico> and the actual loop in <https://github.com/Yardanico/adbscan/blob/master/src/adbscan.nim#L161>
16:18:25FromDiscord<kodkuce> nim c --passC= can i see somehow what args did gcc recive for complation
16:18:33FromDiscord<guttural666> In reply to @Yardanico "and the actual loop": this all looks very familiar 😄 nice
16:20:47FromDiscord<Yardanico> In reply to @kodkuce "nim c --passC= ": https://nim-lang.org/docs/nimc.html :))
16:22:17FromDiscord<Nilts> sent a code paste, see https://paste.rs/WjL
16:22:32FromDiscord<kodkuce> i think in nimcache it does not show gcc got any param at least not in json file
16:22:42FromDiscord<Yardanico> In reply to @kodkuce "i think in nimcache": why do you not just read docs :(
16:22:48FromDiscord<Yardanico> the file i linked has that option
16:23:03FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1097195459069612212/image.png
16:24:02FromDiscord<Yardanico> In reply to @not logged in "Idk why, but i": i mean, the big part of your gather proc is the condition for the while statement
16:24:13FromDiscord<Yardanico> you can instead just use `await all(futs)` at the top of the proc
16:24:33FromDiscord<Yardanico> ah actually, all does return all the original values too
16:24:33FromDiscord<Yardanico> https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D
16:24:36FromDiscord<Rika> ~~it reads best without parens~~
16:24:37*deadmarshal_ quit (Quit: IRCNow and Forever!)
16:24:38FromDiscord<kodkuce> cuz i scroll at least 80% of it and i did not see
16:24:39FromDiscord<Yardanico> so it is quite literally the same as your gather
16:25:20FromDiscord<Yardanico> sent a code paste, see https://paste.rs/xKF
16:25:31FromDiscord<Yardanico> asyncfutures defines `all`, but `asyncfutures` is exported by `asyncdispatch`
16:25:40FromDiscord<Nilts> In reply to @Yardanico "https://nim-lang.org/docs/asyncfutures.html#all%2Cv": It already existed! just under a different name, sneaky
16:26:03FromDiscord<Yardanico> yeah it might be a bit harder to find since it's in an asyncfutures module which you don't usually import explicitly
16:26:07FromDiscord<Nilts> Well that made me kind of sad
16:26:11FromDiscord<Nilts> whatever tho
16:26:18FromDiscord<Yardanico> In reply to @not logged in "Well that made me": why :forsenDespair:
16:26:32FromDiscord<Yardanico> more stuff actually being in the stdlib = better 🤔
16:27:16FromDiscord<Nilts> In reply to @Yardanico "why <:forsenDespair:964336722118836224>": Because i made something pointless
16:27:22FromDiscord<Rika> ah i understand that feel
16:28:07FromDiscord<Nilts> Mine is even less efficient
16:28:12FromDiscord<Nilts> Sadge
16:28:39FromDiscord<Yardanico> well, your implementation is simpler :)
16:29:10FromDiscord<kodkuce> gcc -o .... it does not mention anywhere fp:strict when i do nim c --listCmd --passC:/fp:strict -d:release fu.nim
16:29:25FromDiscord<kodkuce> (edit) "gcc -o .... it does not mention anywhere fp:strict when i do nim c --listCmd --passC:/fp:strict -d:release fu.nim" => "sent a code paste, see https://play.nim-lang.org/#ix=4tAg"
16:29:59FromDiscord<Yardanico> In reply to @kodkuce "gcc -o": try with `--forceBuild`
16:30:23FromDiscord<Yardanico> gcc -o is the last command which is used to link all object files into the executable
16:30:37FromDiscord<Yardanico> you should get a lot of lines with `CC: ` before that unless Nim already has a cache
16:30:52*hochata joined #nim
16:31:01*arkurious joined #nim
16:31:30FromDiscord<Nilts> notin is valid right
16:32:21FromDiscord<Rika> yes
16:32:24FromDiscord<Yardanico> In reply to @not logged in "notin is valid right": yes, it's a keyword
16:32:27FromDiscord<kodkuce> sent a code paste, see https://play.nim-lang.org/#ix=4tAj
16:32:35FromDiscord<Yardanico> In reply to @kodkuce "now it shows ": well yes, because that compiler option is for MSVC
16:32:39FromDiscord<Yardanico> and you're building with gcc (probably mingw)
16:32:55FromDiscord<Yardanico> search for how to do the same as this argument does with GCC or compile with MSVC instead
16:33:24FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4tAk
16:33:36FromDiscord<Yardanico> btw @kodkuce just curious, why you'd want this argument?
16:33:40FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4tAl
16:33:42*fredrik92 joined #nim
16:36:27FromDiscord<kodkuce> In reply to @Yardanico "btw <@158560671301107722> just curious,": deterministic lockstep for multyplayer game, tough i am still long away from making anything nice yet
16:36:47FromDiscord<Yardanico> In reply to @kodkuce "deterministic lockstep for multyplayer": I don't think even with that option you'll achieve full determinism, since you're dealing with floating point operations after all
16:37:11*deadmarshal_ joined #nim
16:37:25FromDiscord<Yardanico> check https://stackoverflow.com/questions/3234042/is-there-a-linux-g-equivalent-to-the-fpprecise-and-fpfast-flags-used-in for what you can do in GCC to mimic that MSVC option, I don't know much about determinism, but personally I think that you won't be able to get 100% determinism with floats, no matter the compiler arguments
16:37:59*fredrikhr quit (Ping timeout: 264 seconds)
16:41:41FromDiscord<kodkuce> rapier rust can do it
16:45:41FromDiscord<ieltan> oh man i really am at a loss lol
16:55:40FromDiscord<ieltan> Just found out about https://github.com/capocasa/limdb and oh my god, documentation.
17:05:22FromDiscord<Nilts> In reply to @ieltan "Just found out about": Is that just a client or a client and a db backend
17:07:23FromDiscord<ieltan> I think it's a db backend, the client is just a nim binding to libmdbx
17:07:53FromDiscord<ieltan> should you say client or interface ? thats not clear to me
17:07:58FromDiscord<Nilts> In reply to @ieltan "I think it's a": I think you got those revered.
17:08:25FromDiscord<Nilts> The backend is a server that you connect to, the client is the thing you use to connect
17:09:43*fredrikhr joined #nim
17:10:39*rockcavera joined #nim
17:10:55termerDoes anyone know how to create a mutable seq in shared memory?
17:11:25termerI have an object with a seq parameter, and using createShared on it makes it impossible to mutate the seq
17:11:44termerimpossible to mutate the seq property, taht is
17:11:53FromDiscord<ieltan> In reply to @not logged in "The backend is a": well the database is a local directory i generate and/or connect to with `mydb = initDatabase("dir/to/db")` then i can just add and remove stuff
17:12:05termerI can't do createShared on the object if the property is of type var seq[...]
17:12:08FromDiscord<ieltan> i dont know if that answer your question 😒
17:12:11FromDiscord<ieltan> (edit) "😒" => ":c"
17:12:13FromDiscord<ieltan> (edit) ":c" => "😦"
17:12:47*fredrik92 quit (Ping timeout: 264 seconds)
17:15:12termerLooks like if my type is a ref object then it doesn't have that issue
17:15:13termervery odd to me
17:15:16termerbut it works
17:15:37NimEventerNew Nimble package! mcsrvstat.nim - A hybrid and asynchronous Nim wrapper for the Minecraft Server Status API., see https://github.com/hitblast/mcsrvstat.nim
17:15:52termerI knew ref objects were mutable so I assumed ptr objects were as well
17:15:57termerwell, pointers to objects rather
17:18:54FromDiscord<cmc> Why thank you for pointing out LimDB's documentstion! Be the change you want to see in the world.Working on native support for more types and easier transactions.↵(@ieltan)
17:20:51FromDiscord<cmc> It's in-process, so you don't need to set up a seperate server.↵(@Nilts)
17:20:59*ltriant joined #nim
17:25:45*ltriant quit (Ping timeout: 240 seconds)
17:32:52FromDiscord<Nilts> In reply to @cmc "It's in-process, so you": kinda like sqlite? ncie
17:32:55FromDiscord<Nilts> (edit) "ncie" => "nice"
17:58:03FromDiscord<Nilts> Does multipart data = form data
18:06:41FromDiscord<Nilts> It apparently is not as my thing does not work
18:10:51*hochata quit (Ping timeout: 248 seconds)
18:16:22FromDiscord<cmc> Yeah exactly!I use them together a lot, like you would use redis and postgres in python.↵(@Nilts)
18:22:05FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4tAy
18:24:33FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4tAA
18:25:48FromDiscord<Nilts> sent a code paste, see https://paste.rs/XDd
18:26:22FromDiscord<qb> That's just an example. I'm trying to return any int types and strings as well
18:27:12FromDiscord<Nilts> In reply to @qb "That's just an example.": then just return them as normal?
18:27:37FromDiscord<qb> as normal?
18:30:36FromDiscord<Nilts> In reply to @qb "as normal?": as in my example
18:31:41FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4tAC
18:34:02FromDiscord<Nilts> In reply to @qb "Well lets make another": That would not work in nim normally
18:34:05FromDiscord<Yardanico> In reply to @qb "Well lets make another": you can't write Nim code that will violate Nim's own rules
18:34:08FromDiscord<Yardanico> even if you're using nimpy
18:34:20FromDiscord<Yardanico> so you have to check the nimpy api for something lower-level, not just return different types
18:34:52FromDiscord<Yardanico> also, fyi, you can just write `5'i8` and `1.5'd` for an int8 and a float64 respectively
18:34:59FromDiscord<Nilts> In reply to @not logged in "What is the nim": and bump now that someone who is smart is online
18:35:23FromDiscord<Yardanico> In reply to @not logged in "and bump now that": just do it manually?
18:35:35FromDiscord<Yardanico> if you want to submit a form, just concat the same data manually and send it with the post request?
18:36:34FromDiscord<Nilts> In reply to @Yardanico "if you want to": So do not use multipart?
18:36:45FromDiscord<Yardanico> no, multipart is for the different type
18:36:49FromDiscord<Nilts> In reply to @Yardanico "no, multipart is for": ah
18:36:52FromDiscord<Yardanico> with curl -d it just sends as a form by default
18:37:02FromDiscord<Yardanico> just use https://nim-lang.org/docs/uri.html#encodeQuery%2CopenArray%5B%5D
18:37:13FromDiscord<cmc> I think you want to export seperate procs for different return types. Python usually doesn't mix types either.Alternatively, you could return a tuple and populate the field you want, leaving the others as default.↵(@qb)
18:37:44FromDiscord<Nilts> In reply to @Yardanico "just use https://nim-lang.org/docs/uri.html#encodeQ": thanks!
18:38:30FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4tAF
18:38:37FromDiscord<qb> In reply to @cmc "I think you want": Yea thats what I'm doing atm. I have a ton of procs which actually do the same except returning the correct type. Thinking about one proc which can wrap them
18:39:31FromDiscord<Yardanico> In reply to @not logged in "wait, so like this:": no, check again, encodeQuery already url-encodes stuff
18:40:22FromDiscord<cmc> I think you want to export seperate procs for different return types. Python usually doesn't mix return types either, even though you can.↵Alternatively, you could return a tuple with an element for each type you want, and populate the one you need, leaving the others as default.
18:40:36FromDiscord<Nilts> In reply to @Yardanico "no, check again, encodeQuery": ok
18:41:57FromDiscord<Nilts> still getting `not enough segments in path` w/ `400 bad request` from the server
18:42:04FromDiscord<Nilts> but not with curl
18:42:10NimEventerNew question by Oecophylla: Process output encoding using execProcess with Nim, see https://stackoverflow.com/questions/76029679/process-output-encoding-using-execprocess-with-nim
18:42:32FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4tAG
18:42:35FromDiscord<cmc> Ah.Well, the way Nim accounts for different types in the same variable is object variants.That's like I described, except with an added enum field called 'kind' to explicitly set the object subtype. I think that's the best you can do.↵(@qb)
18:42:46FromDiscord<Yardanico> In reply to @not logged in "Here is the code:": if curl is sending it as a form, you'd have to send the same headers as curl too
18:43:01FromDiscord<Yardanico> so at least Content-Type - application/x-www-form-urlencoded
18:43:08FromDiscord<Nilts> In reply to @Yardanico "if curl is sending": idk what headers it sends, and my python version is fine
18:43:10FromDiscord<Yardanico> and you can really just run curl with debug
18:43:15FromDiscord<Yardanico> and see what exactly it sends
18:43:15*fredrik92 joined #nim
18:43:31FromDiscord<Nilts> In reply to @Yardanico "so at least Content-Type": ah, yeah probably need that. The python version probably automatically does that oo
18:44:08FromDiscord<Nilts> wait, is there no headers param
18:44:25FromDiscord<Yardanico> you set headers to your http client
18:44:38FromDiscord<Yardanico> or pass to newhttpclient when creating it
18:44:46FromDiscord<Yardanico> https://nim-lang.org/docs/httpclient.html#using-http-post
18:44:50FromDiscord<Yardanico> third example shows
18:45:07FromDiscord<Nilts> In reply to @Yardanico "you set headers to": no, I am using one http client for alot of different requests, and only this one needs that header
18:45:34FromDiscord<Yardanico> In reply to @not logged in "no, I am using": then just set it and unset later
18:45:49FromDiscord<Yardanico> also, reusing is only useful if you're doing requests to the same domain afaik
18:45:57FromDiscord<Yardanico> because then you'll retain the same connection
18:46:15FromDiscord<Nilts> In reply to @Yardanico "also, reusing is only": I am
18:46:24*fredrikhr quit (Ping timeout: 248 seconds)
18:46:56FromDiscord<Nilts> In reply to @Yardanico "then just set it": Does just doing `client.request(url, HttpPost, headers=...)` not work
18:47:24FromDiscord<Yardanico> if you want that way, the `request` proc accepts headers
18:47:28FromDiscord<Yardanico> yeah
18:47:47FromDiscord<Yardanico> i don't remember all docs 100%, I just almost always do it the client.headers way so I didn't remember the request one
19:21:29*pharonix71 quit (Ping timeout: 255 seconds)
19:24:01*pharonix71 joined #nim
19:38:16FromDiscord<Nilts> Should nim be taking 99% of 0.5 cpu's?
19:38:21FromDiscord<Nilts> (edit) "cpu's?" => "cpus?"
19:38:27FromDiscord<Nilts> (edit) "cpus?" => "vcpus?"
19:38:52PMunchIf you're doing computations, sure
19:39:33PMunchNim programs, along any good program, will use 100% of any CPU if there is work to be done
19:39:39FromDiscord<Nilts> In reply to @PMunch "If you're doing computations,": I'm compiling a pretty small program
19:40:05PMunchYeah, that's a computation. The alternative is to use 50% of the CPU and spend twice as long
19:40:54PMunchIf anything Nim is inefficient in this matter as it will only use a single core
19:41:11PMunchTry to compile something with GCC and see that it takes 100% of the entire CPU
19:41:59FromDiscord<Nilts> In reply to @PMunch "Try to compile something": Nim uses gcc?
19:42:58FromDiscord<Elegantbeef> It's the default compiler on linux
19:43:01FromDiscord<Elegantbeef> Clang on mac and mingw on windows
19:44:04PMunchIndeed, but even GCC without Nim will do this
19:44:54FromDiscord<Elegantbeef> Well Nim is single threaded so it can only take 100% of a single thread
19:51:24FromDiscord<firasuke> In reply to @Elegantbeef "Well Nim is single": so Nim applications can't be multithreaded?
19:51:41FromDiscord<Elegantbeef> Applications can be
19:51:48FromDiscord<Elegantbeef> The compiler itself is single threaded
19:55:19*fredrik92 quit (Quit: Disconnecting)
19:57:32FromDiscord<Nilts> In reply to @firasuke "so Nim applications can't": the threading is wonky and kind of hard to use cuase the mem is not shared, but it is possible
19:57:44FromDiscord<Elegantbeef> Mem is shared with Orc/ARc
19:57:48FromDiscord<Elegantbeef> Which you should be using anyway
19:58:51FromDiscord<Nilts> In reply to @Elegantbeef "Mem is shared with": with threading? Oooo, I can finally do some of my old ideas!
19:59:01FromDiscord<Elegantbeef> I mean they have shared heap
19:59:07FromDiscord<Nilts> Btw, is Orc or Arc better
19:59:26FromDiscord<Nilts> In reply to @Elegantbeef "I mean they have": Can you access a var from across threads?
19:59:29FromDiscord<Elegantbeef> If you have to ask that you use Orc
19:59:31FromDiscord<Elegantbeef> Arc is for a subset of users
20:00:04FromDiscord<Elegantbeef> Yes, safely is another question though
20:00:09FromDiscord<guttural666> In reply to @Yardanico "yeah, that's what I": rewritten it to use async, awesome gainz 🥳 https://media.discordapp.net/attachments/371759389889003532/1097250095793193000/image.png
20:00:38FromDiscord<Elegantbeef> Nice no more IO slowdowns
20:01:23FromDiscord<Nilts> In reply to @Elegantbeef "Yes, safely is another": what do you mean?
20:01:27FromDiscord<firasuke> In reply to @guttural666 "rewritten it to use": does using async equal multithreading?
20:01:33PMunchNo
20:01:35FromDiscord<guttural666> In reply to @firasuke "does using async equal": no
20:01:46FromDiscord<guttural666> In reply to @firasuke "does using async equal": https://peterme.net/asynchronous-programming-in-nim.html
20:01:49PMunchAsync is co-operative multitasking
20:01:54PMunch@guttural666, :)
20:02:27FromDiscord<Nilts> In reply to @firasuke "does using async equal": async is single threaded, with small tasks of bigger tasks lined up on that thread.
20:03:20FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, :)": you should write more, good stuff
20:03:25FromDiscord<Nilts> Compiling with ORC, RAM go brrrrrrr and explode
20:03:31FromDiscord<firasuke> In reply to @not logged in "async is single threaded,": yes that was what I initially knew, so it's a bit hard to write a multi-threaded application in Nim?
20:03:43PMunchActually the first part of that article explains the difference better: https://peterme.net/multitasking-in-nim.html
20:03:52PMunch@guttural666, I'm actually writing an article as we speak
20:04:01FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, I'm actually writing": been a while, huh? 😄
20:04:01PMunchHope to publish it before I go to bed
20:04:04FromDiscord<Nilts> In reply to @firasuke "yes that was what": yes, well, idk about with orc, but with whatever the default is yes
20:04:17FromDiscord<Elegantbeef> Damn pmunch using two keyboards
20:04:19FromDiscord<firasuke> I see, thanks for your insight
20:04:44PMunch@guttural666, February? Not the longest I've gone without an article :P
20:05:01PMunch@Elegantbeef, I'm writing it asynchronously ;)
20:05:37FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, February? Not the": you're right, but the gap between articles[^1] and articles[^2] 😄
20:05:50PMunchYeah..
20:05:54PMunchWe don't speak about that :P
20:05:55FromDiscord<guttural666> 😄
20:09:53FromDiscord<Elegantbeef> Imagine writing articles
20:12:34FromDiscord<Elegantbeef> Sorry i mean imagine publishing articles in an easily accessible place, and not just hidden on your domain 😛
20:14:16FromDiscord<guttural666> async goes brrr 😄 apparently 30 requests with 10 ms gaps is fine by them ^^ https://media.discordapp.net/attachments/371759389889003532/1097253647752122399/image.png
20:14:49FromDiscord<Elegantbeef> Just remember guttural when scraping a site you should be respectful of their server
20:15:10FromDiscord<Elegantbeef> Just cause you can do 10000 requests per minute doesnt mean you should
20:15:14FromDiscord<guttural666> In reply to @Elegantbeef "Just remember guttural when": yeah, but this seems fine and it's just for the initial load 😛
20:15:36FromDiscord<guttural666> have no clue what "a lot" is for web servers
20:16:35NimEventerNew thread by Oecophylla: ExecProgram() - Managing encoding outputs / indentation, see https://forum.nim-lang.org/t/10105
20:18:04FromDiscord<Elegantbeef> a lot depends on the server but depending how much i hate the corporation that runs the server changes my rate 😛
20:18:41FromDiscord<Elegantbeef> Though many servers of corporations rate limit
20:24:13FromDiscord<⃟⃟> is the last name "Rumpf" derived from "rump"
20:24:21PMunchArticle is up: https://peterme.net/wrapping-c-libraries-in-nim.html
20:24:41PMunchAs always it's written without spellcheck, so please report any mistakes :P
20:25:13FromDiscord<Elegantbeef> Started a sentence with `but` shame on you
20:25:36FromDiscord<Elegantbeef> 3 sentences in a row starting with but
20:25:44PMunch>_>
20:26:30FromDiscord<Elegantbeef> Consider 'however' and other fun conjunctions!
20:27:40PMunchI don't see what you mean, there's not a single sentence starting with "but" in the first paragraph (at least not after a Ctrl+F5)
20:28:03FromDiscord<Elegantbeef> Lol
20:30:19FromDiscord<Elegantbeef> I do appreciate that we right in totally different styles. I go for formal nonsense and you do formal sensible. 😄
20:30:30PMunchHaha :P
20:30:41FromDiscord<Elegantbeef> informal sensible\
20:31:11PMunchI mostly just write how I think about a subject
20:31:49FromDiscord<Elegantbeef> Yea I feel like when I'm writing I want to instil some humour in my writing
20:32:10PMunchWhere do you publish your stuff? I read them when I come upon them, but as you said without an easy to find domain it's not easy to find :P
20:32:32FromDiscord<Elegantbeef> https://www.jasonbeetham.com/codereuse.html i have a few nimib generated writeups on my domain just hidden
20:32:51FromDiscord<Elegantbeef> https://www.jasonbeetham.com/pointerexplanation.html
20:33:04FromDiscord<Elegantbeef> I do want to link to these on my site proper, but havent got to it
20:33:39FromDiscord<Elegantbeef> As you can see I do not use contractions or 'you'
20:33:57FromDiscord<Elegantbeef> Makes it technically more formal, but then I load nonsense into it 😛
20:35:31PMunchI used to write more formally when I was writing at university, but since my audience now is just other hobbyists I don't bother
20:36:00FromDiscord<Elegantbeef> "couple of gripes" follows with a list of 3
20:36:02FromDiscord<Elegantbeef> Nice 😛
20:36:15FromDiscord<Elegantbeef> Sorry list of 4
20:36:22PMunchAn Amish couple :P
20:36:28FromDiscord<Elegantbeef> The quartet of three is the scariest
20:36:49PMunchQuartet of three?
20:37:36FromDiscord<Elegantbeef> It's the inverse of what you did
20:37:41PMunchAnyways, I'm off to bed
20:37:53FromDiscord<Elegantbeef> A quartet is made of 4 hence 'quart' three is not a quartet 😄
20:38:01PMunchYeah I know that part :P
20:38:36PMunchI was just afraid I had said I have "three" of something and listed four somewhere :P
20:38:40*PMunch quit (Quit: leaving)
20:38:51FromDiscord<Elegantbeef> You did say 2 then listed 4 though!
20:39:57FromDiscord<Elegantbeef> You do seem to skip of `{.passl: "-lcoap-3".}`
20:39:57FromDiscord<Elegantbeef> skip over\
20:47:41FromDiscord<guttural666> if I provide a var string to a proc that takes a non var string, the compiler won't complain, even if I then mutate the string inside the proc, that can't be right?
20:48:51FromDiscord<guttural666> to be more specific: I define a var string in a proc, then pass it to a template, that expects a non var string, maybe that makes a difference
20:49:40FromDiscord<Elegantbeef> `var T -> T` is fine
20:50:01FromDiscord<Elegantbeef> templates do not validate the varness
20:50:23FromDiscord<Elegantbeef> Since the template expands in place the validation is done by whether you declared it as a var
20:51:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tAW
20:54:50FromDiscord<⃟⃟> ill ask again
20:54:51FromDiscord<⃟⃟> is the last name "Rumpf" derived from "rump"
20:55:42FromDiscord<Elegantbeef> Doubt we have a etymologist that specialises in names
20:56:13FromDiscord<frank456> "I'll help anyone interested on how to earn 100k in just 24hours from the crypto market. But you will have to pay me my commission! when you receive your profit! if interested send me a direct message https://t.me/victormarck by asking me HOW
20:56:28FromDiscord<⃟⃟> wtf
20:56:34FromDiscord<⃟⃟> crypto scammer
20:56:36FromDiscord<Yardanico> In reply to @⃟⃟ "is the last name": huh?
20:56:40FromDiscord<Yardanico> where'd that question come from
20:56:50FromDiscord<⃟⃟> In reply to @Yardanico "where'd that question come": andreas rumpf
20:56:53FromDiscord<⃟⃟> made nim
20:56:56FromDiscord<Yardanico> yes, but why ask here and not in #offtopic
20:57:05FromDiscord<⃟⃟> its about nim?
20:57:07FromDiscord<Yardanico> its a really weird question
20:57:11FromDiscord<Yardanico> In reply to @⃟⃟ "its about nim?": no, it's about names
21:06:08FromDiscord<pmunch> And quite easy to Google the answer to for that matter
21:22:35*ltriant joined #nim
21:23:49FromDiscord<guttural666> I am getting an IOSelectorsException when using asyncdispatch, any tips on how to release system IO selectors manually or how do they work? I am just creating 30 async futures at any time and think I am releasing the sequence of futures again with futures = @[]
21:27:05*ltriant quit (Ping timeout: 240 seconds)
21:27:20*Notxor quit (Quit: Leaving)
22:11:04*pbsds quit (Ping timeout: 276 seconds)
22:17:50*ltriant joined #nim
22:25:29*jmdaemon joined #nim
22:34:26*lucasta quit (Remote host closed the connection)
22:40:06*tjaden joined #nim
22:47:13*ltriant quit (Ping timeout: 250 seconds)
22:53:12FromDiscord<JeysonFlores> how can I get the quantity or the reference to all the running threads in a program?
22:53:41*ltriant joined #nim
22:57:32FromDiscord<Elegantbeef> On linux you can just iterate the TID directory iirc
22:58:29FromDiscord<Elegantbeef> Sorry it seems to be `/proc/$PID/task/threads`
23:03:11FromDiscord<Elegantbeef> Windows probably has an API for it
23:05:11FromDiscord<JeysonFlores> so.... there's no function from the standard library to do it?
23:05:25FromDiscord<Elegantbeef> Doubt it
23:06:45FromDiscord<JeysonFlores> ok thanks!
23:07:31FromDiscord<Elegantbeef> There isnt much reason for that afaik
23:09:37FromDiscord<JeysonFlores> yeah I was afraid of that, it's quite a rare use case
23:10:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tBa
23:12:23FromDiscord<Elegantbeef> probably should usue `walkDir` no clue though i'm too lazy to read about the spec for task 😄
23:12:43FromDiscord<Elegantbeef> Windows probably does this through 80 bazillion procedure calls that are very tedious
23:16:02FromDiscord<JeysonFlores> ey thanks for the snippet, don't worry about windows support 😜 this code is meant to be ran in linux servers
23:18:24FromDiscord<Elegantbeef> Ah you mean it's supposed to be ran on servers 😛
23:58:16FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4tBe