<< 23-03-2024 >>

00:04:49FromDiscord<guzba8> uglier but actually not terrible, ill revisit when i get back home
00:04:51FromDiscord<guzba8> tyty again
00:05:10FromDiscord<guzba8> its great you know about this stuff, im macro-blind so im bumping into every sharp edge
01:24:29*rockcavera quit (Remote host closed the connection)
01:33:45FromDiscord<determiedmech1> have any of you used opencv-nim↵https://github.com/dom96/nim-opencv↵↵im trying to figure out how to do color recognition stuff but i can't figure it out
01:34:09FromDiscord<determiedmech1> (edit) removed ""
01:36:00FromDiscord<determiedmech1> sent a code paste, see https://play.nim-lang.org/#pasty=LnpDMZQNdZga
01:36:17FromDiscord<determiedmech1> it just shows a camera
01:36:24FromDiscord<determiedmech1> (edit) "a" => "the"
02:01:57FromDiscord<Elegantbeef> @determiedmech1 i've not used opencv, but would you not just operate on `frame`?
02:02:35FromDiscord<determiedmech1> yeah ive tried that
02:03:48FromDiscord<determiedmech1> i got far enough to draw shapes over it, but i don't know how i can do contours
02:04:25FromDiscord<determiedmech1> ill try to translate python 💀
02:04:32FromDiscord<Elegantbeef> Should be relatively similar to how it's done in C/C++
02:04:52FromDiscord<determiedmech1> true
02:04:58FromDiscord<Elegantbeef> https://github.com/search?q=repo%3Adom96%2Fnim-opencv%20contours&type=code
02:27:27*une joined #nim
06:14:38*ntat joined #nim
06:21:54*pusewicz joined #nim
06:29:23FromDiscord<gogolxdong666> which vscode extension could go to definition
06:52:03*SchweinDeBurg joined #nim
07:32:21*pusewicz left #nim (https://www.layer22.com)
08:05:10ZevvEthin: ping
08:05:36*advesperacit joined #nim
08:50:01*KhazAkar quit (Remote host closed the connection)
08:50:36*KhazAkar joined #nim
09:27:59FromDiscord<albassort> hello im packing stuff and i forgot how to convert a integer to its binary character equivalent
09:28:18FromDiscord<albassort> e.g int32 to a 4 character string
09:30:24FromDiscord<albassort> encode it into a string
09:31:35FromDiscord<albassort> ord doesn't work with int32s :(
09:31:58FromDiscord<albassort> this question is no longer required
09:39:59FromDiscord<albassort> i can use stream :)\
10:05:10FromDiscord<albassort> I CANT USE A STREAM
10:07:52FromDiscord<kiloneie> In reply to @gogolxdong666 "which vscode extension could": https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode
10:31:24FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=qhfDVvqRyoej
10:31:27FromDiscord<albassort> i feel like theres a better way
10:31:38FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=lvtXoEhMZKeH" => "https://play.nim-lang.org/#pasty=aQsoDmodMNjN"
10:32:57FromDiscord<griffith1deadly> In reply to @albassort "i feel like theres": byte compatible type with char
10:33:24FromDiscord<albassort> doesn't work outside for anything larger than bytes
10:33:26FromDiscord<griffith1deadly> you can not make map, just `array[4, char]`
10:33:46FromDiscord<albassort> ah thats better, you're right
10:33:54NimEventerNew thread by grd: About a VFS library, see https://forum.nim-lang.org/t/11286
10:34:02FromDiscord<albassort> but I feel like there is a single command that does that lole
10:34:14FromDiscord<albassort> (edit) "command" => "proc" | "procthat does ... thatforgetting" added "all of this" | "lole" => "forgetting"
11:02:10FromDiscord<kiloneie> sent a code paste, see https://play.nim-lang.org/#pasty=toViCsbbGfxh
11:12:13*advesperacit quit ()
12:01:44*krux02 joined #nim
12:51:24FromDiscord<pzbz.> When is the TGE?
13:26:58FromDiscord<bosinski2023> In reply to @Elegantbeef "bosinski I still have": found out myself, that weird problems creep in, when you use a foreign-allocator and don't zero-out the regions it delivers. The smaller regions all were zeroed, and sure enough the largerregions not... and that surfaced as 'garbled stuff' inside my structs - so silly me 🙂
14:51:27*advesperacit joined #nim
16:03:13FromDiscord<.bobbbob> In reply to @albassort "hello im packing stuff": are you talking about toHex() in strutils?
16:16:03*junaid_ joined #nim
16:49:00NimEventerNew thread by Niminem: Why is docgen not producing the 'dochack.js' file? Nim v1.6.8-2.0.2, see https://forum.nim-lang.org/t/11289
17:14:43FromDiscord<waakul> Why do i have errors installing faster-than-requests in windows using pip?
17:16:08FromDiscord<waakul> wait this is for nim?
17:16:20FromDiscord<waakul> (edit) "wait this ... is" added "server"
17:34:58FromDiscord<myxi> In reply to @waakul "wait this server is": is that not apparent
17:40:22*krux02_ joined #nim
17:42:53*krux02 quit (Ping timeout: 240 seconds)
17:58:16FromDiscord<fosster> are arrays always zero-initialized in nim?
18:05:26FromDiscord<bosinski2023> In reply to @fosster "are arrays *always* zero-initialized": as long as you use the nim-allocater yes. if you do `-d:useMalloc' maybe not.
18:07:17*redj quit (Ping timeout: 240 seconds)
18:16:05*krux02_ quit (Quit: Leaving)
19:12:17FromDiscord<whisperecean> is there any easy guide to follow for async nim?
19:36:53NimEventerNew thread by 3-2-1: Do we have a list of breaking changes in the next major release?, see https://forum.nim-lang.org/t/11290
19:40:34FromDiscord<whisperecean> What do I do with error like this? Error: getAppDir() can raise an unlisted exception: ref OSError
19:51:59*ntat quit (Quit: Leaving)
19:58:09FromDiscord<Elegantbeef> Arrays are value types so allocator does not change anything. On top of it Nim 0-inits all memory↵(@bosinski2023)
19:58:32FromDiscord<Elegantbeef> @whisperecean `try: ... except OsError: ...`
20:00:17*advesperacit quit (Ping timeout: 272 seconds)
20:31:02FromDiscord<kumolonimbus> Hi all, I am trying to create a thread that contains a loop that checks to see if a function has been received through a channel and then executes it, but I am struggling with gcsafety. Once of the functions I want to pass through the channel references a local variable, so it complains that I am referencing a variable that is managed with GC'd memory. How can I resolve this?
20:32:00FromDiscord<Elegantbeef> Take it as a parameter or use `{.cast(gcsafe).}: myGlobalVar.doStuff(...)`
20:34:07FromDiscord<kumolonimbus> Oh awesome, I had seen references to `cast(gcsafe)` but I hadn't really understood its purpose, thanks!
20:47:51FromDiscord<guzba8> @ElegantBeef regarding our json chat from yesterday, i have an updated prototype of the type pragma https://github.com/guzba/sunny/commit/a2a577790dec47ca88646f1ab0502737ca51c41a#diff-4b5e53dd57a0e89dbb40f12d92f6d44e790a9be97c104090b249473cf667290f↵the `{}` syntax is working, however i have noticed 2 issues im not sure of the best way to overcome, perhaps your macro knowledge will be able to resolve
20:49:19FromDiscord<guzba8> first, using `cow` const instead of "cow" `Error: undeclared identifier: 'cow'` in the output of `quote do:`, is there a way to say "yo its in your context at call site"?↵and second, if i try to use integer constants for values, it is ambigous call for somesignedint and someunsignedint
20:49:21FromDiscord<Elegantbeef> Those are?
20:50:26FromDiscord<Elegantbeef> I mean `cow` will be looked up at the instantiation
20:50:43FromDiscord<Elegantbeef> The integer issue I'm uncertain what's the full error?
20:50:53FromDiscord<guzba8> one moment
20:51:09FromDiscord<guzba8> ` Error: ambiguous call; both sunny.toJson(src: SomeSignedInt, s: var string) [proc declared in C:\Users\Me\Documents\GitHub\sunny\src\sunny.nim(1228, 6)] and sunny.toJson(src: SomeUnsignedInt, s: var string) [proc declared in C:\Users\Me\Documents\GitHub\sunny\src\sunny.nim(1225, 6)] match for: (int literal(3), string)`
20:51:34FromDiscord<guzba8> it is not ambiguous generally so im not sure why it behaves differently in a `quote do`
20:51:51FromDiscord<Elegantbeef> Are you surer `toJson(10, buffer)` should not work either
20:51:54FromDiscord<Elegantbeef> sure\
20:52:20FromDiscord<guzba8> it fails when the number is the right operand, eg `"num": 3`
20:52:29FromDiscord<guzba8> ``r`.toJson(s)`
20:52:40FromDiscord<Elegantbeef> Right that's not the macro
20:52:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QytvKZBtdwMO
20:53:03FromDiscord<Elegantbeef> That's just dispatch `10` does not match either generic instantiation more
20:53:21FromDiscord<guzba8> and yet
20:53:23FromDiscord<guzba8> `echo 10.toJson()` works
20:53:47FromDiscord<Elegantbeef> Not with the above example
20:53:59FromDiscord<Elegantbeef> You can make a `int` overload if you want it to prefer it
20:54:02FromDiscord<guzba8> true, with doThing it does not
20:54:38FromDiscord<Elegantbeef> or you can just do `if val.kind == nkIntLit: val = nnkCall.newTree("int", val)`
20:54:39FromDiscord<guzba8> is it possible to understand why `10.toJson()` works but the `doThing` does not, or should i just move on as it is just arbitrary behavior
20:55:31FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=FFhzoFztxwlj
20:55:43FromDiscord<guzba8> seems like it should have the same `doThing` issue
20:56:22FromDiscord<Elegantbeef> No cause you're lying 😛
20:56:32FromDiscord<Elegantbeef> you're doing `10.toJson` not `10.toJson(buffer)`
20:56:51FromDiscord<Elegantbeef> The former is using `typeof(10)` to reason the type which is a `IntLiteral` which defaults to `int`
20:56:51FromDiscord<guzba8> mmmmmmm ok ok
20:57:17FromDiscord<Elegantbeef> The latter is attempting to match `SomeSignedInt` and `SomeUnsignedInt` but both are generic so `int` is not more convertible to either
20:57:32FromDiscord<guzba8> ill take it, its the direct-to-generic thing in my head
20:57:34FromDiscord<Robyn [She/Her]> In reply to @guzba8 "first, using `cow` const": As in, edit the line info or something?
20:57:35FromDiscord<guzba8> ok cool tyty
20:58:18FromDiscord<Elegantbeef> Now the cow issue... huh
20:58:49*FromDiscord quit (Remote host closed the connection)
20:59:02*FromDiscord joined #nim
20:59:19FromDiscord<Elegantbeef> can you `echo treeRepr` from the `addExtraFields`?
20:59:56FromDiscord<guzba8> yeah sorry just one moment im trying to iron out the int thing quick to get that out of my head
21:00:58FromDiscord<Elegantbeef> Also you should do `error(..., p)` inside that macro
21:04:02FromDiscord<guzba8> ok this appears to fix integer constants and i think did the error thing: https://github.com/guzba/sunny/commit/0760ef1e69279bab5c00984b4f3db9a59dc9ddbf
21:04:08FromDiscord<guzba8> cow time
21:05:24FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=ZeEUzaHdiUNB
21:05:37FromDiscord<Elegantbeef> Oh you're doing `typeof(`l`)`
21:05:37FromDiscord<guzba8> ^ that is the echo treeRepr from the addExtraFields
21:06:09FromDiscord<guzba8> that is inside the `quote do` and appears to happen later in typed phase i think
21:06:15FromDiscord<guzba8> it does not affect the cow issue at least
21:07:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gQkBXKrKmkKI
21:07:49FromDiscord<Elegantbeef> Your issue is that you're trying to call `typeof` on a identifier that ostensibly will not exist
21:08:08FromDiscord<Elegantbeef> technically you can do `astToStr(l)` with what you have now, but that may result in funky stuffs
21:09:07FromDiscord<Elegantbeef> To do what you're doing now you'd need to have a variable or constant named `cow`
21:09:52FromDiscord<Elegantbeef> I do not think you can mixin variable access so it'd mean that all your procs would have to be templates 😄
21:09:54FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=ZIKkHEgDAfyi
21:10:13FromDiscord<guzba8> ok thats what i thought perhaps was the case
21:10:24FromDiscord<guzba8> in which case, nope just strings baby
21:10:43FromDiscord<Elegantbeef> Cmon you can atleast just use Nim identifiers 😄
21:10:54FromDiscord<guzba8> i think perhaps i am still confused
21:10:58FromDiscord<guzba8> lets go back to basics
21:11:30FromDiscord<guzba8> is it possible to get the `const cow` thing to work without making every single thing templates
21:12:22FromDiscord<guzba8> the `let l =` above is unclear if it goes outside the `quote do` where `$` is an error, or inside, where i dont have nimnodes afaik
21:12:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=DPdgzMrCcDQV
21:12:40FromDiscord<Elegantbeef> Turns out yes variables can be mixin'd
21:12:53FromDiscord<Elegantbeef> It'd have been before quote do
21:13:10FromDiscord<Elegantbeef> If you wanted to allow `{cow: ...}` to work but not care about a variable named `cow`
21:14:00FromDiscord<Elegantbeef> But you can leave it as is aslong as you emit a `mixin l` assuming it's not string at the top level of your proc
21:14:44FromDiscord<Elegantbeef> Funnily enough as I expanded the wrapping of the matrix API I learned that it's not a constant value for all Identifiers 😄
21:14:48FromDiscord<Elegantbeef> So I guess sorry 😛
21:15:05FromDiscord<guzba8> its not a big deal, this comes up in other cases
21:16:06FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=UETuZfZooFVs
21:21:10FromDiscord<guzba8> interesting final thing
21:22:45FromDiscord<guzba8> i have cow working, but it does so by turning the ident to a strlit, which means if there does happen to be a const of the same name, it will not be used↵eg: `{cow: "moo"}` works but if you have `const cow = "notacow"` it will ignore that presently↵it seems that might be unexpected, worth seeing if can tell if an ident has a definition?
21:23:13FromDiscord<Elegantbeef> Like I said mixin the identifier
21:23:50FromDiscord<Elegantbeef> then you can do `when compiles(l.toJson(): ... else: astToStr(l).toJson()`... or w/e
21:25:30FromDiscord<guzba8> mixin l and mixin `l` dont seem to do anything, same old `Error: undeclared identifier: 'cow'`
21:25:34FromDiscord<guzba8> however this `assuming it's not string at the top level of your proc` confuses me
21:25:46FromDiscord<guzba8> how does it matter where the const is coming from?
21:26:06FromDiscord<Elegantbeef> You need to emit the `mixin l` at the top level of your proc
21:26:53FromDiscord<Elegantbeef> But you obviously do not want to emit `mixin "cow"` in the case the programmer wrote `{"cow": ...}`
21:28:35FromDiscord<guzba8> `mixin l at the top level of your proc` -> to me this is in the `quote do` building of the stmntlist in addExtraFields?
21:29:36FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=zWiZBYHgVnAN
21:29:41*advesperacit joined #nim
21:30:40FromDiscord<Elegantbeef> You probably do `result.insert 0, nnkMixinStmt.newTree(l)` instead of using add or quotedo
21:33:07FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=QcocDLxoighX
21:35:19FromDiscord<Elegantbeef> except you have a `mixin "..."` which is what you wanted to avoid
21:39:53FromDiscord<guzba8> i have no idea how to interpret that↵this has been helpful though, ill come back to this and see if i can puzzle it out later
21:40:09FromDiscord<Elegantbeef> you cannot do `mixin "num"`
21:44:09FromDiscord<guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=cBAytTVCGwjf
21:44:49FromDiscord<guzba8> sunny
21:44:54FromDiscord<ElegantBeef> Hmph bridge is down one way 😄
21:44:58FromDiscord<ElegantBeef> That's quite literally how this works
21:45:12FromDiscord<ElegantBeef> `mixin` says "Look for this symbol at instantiation and declaration"
21:45:16FromDiscord<ElegantBeef> So it works across modules
21:45:55FromDiscord<guzba8> ok ill try that more when i can work on this next cool
21:45:58FromDiscord<guzba8> tyty again
21:58:47FromDiscord<Elegantbeef> That's quite literally how mixin works
22:05:40*junaid_ quit (Remote host closed the connection)
22:25:00*advesperacit quit ()
23:08:21*def- quit (Quit: -)
23:08:36*def- joined #nim
23:52:28FromDiscord<tsoj> Is it possible to have a requires statement only for specific tasks in a nimble project file?
23:52:34FromDiscord<tsoj> (edit) "requires" => "`requires`"
23:55:12FromDiscord<Elegantbeef> There is now a `taskRequires` in Nimble after some version 😄
23:57:22FromDiscord<albassort> beef
23:57:52FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=lDovInuEANWl
23:57:54FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=VDEwavHyCuHY" => "https://play.nim-lang.org/#pasty=NfoFVMccbuzE"
23:57:57FromDiscord<albassort> is there a prettier way
23:59:22FromDiscord<albassort> and no, omitting return is not prettier
23:59:37FromDiscord<Elegantbeef> It is