00:04:49 | FromDiscord | <guzba8> uglier but actually not terrible, ill revisit when i get back home |
00:04:51 | FromDiscord | <guzba8> tyty again |
00:05:10 | FromDiscord | <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:45 | FromDiscord | <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:09 | FromDiscord | <determiedmech1> (edit) removed "" |
01:36:00 | FromDiscord | <determiedmech1> sent a code paste, see https://play.nim-lang.org/#pasty=LnpDMZQNdZga |
01:36:17 | FromDiscord | <determiedmech1> it just shows a camera |
01:36:24 | FromDiscord | <determiedmech1> (edit) "a" => "the" |
02:01:57 | FromDiscord | <Elegantbeef> @determiedmech1 i've not used opencv, but would you not just operate on `frame`? |
02:02:35 | FromDiscord | <determiedmech1> yeah ive tried that |
02:03:48 | FromDiscord | <determiedmech1> i got far enough to draw shapes over it, but i don't know how i can do contours |
02:04:25 | FromDiscord | <determiedmech1> ill try to translate python 💀 |
02:04:32 | FromDiscord | <Elegantbeef> Should be relatively similar to how it's done in C/C++ |
02:04:52 | FromDiscord | <determiedmech1> true |
02:04:58 | FromDiscord | <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:23 | FromDiscord | <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:10 | Zevv | Ethin: 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:59 | FromDiscord | <albassort> hello im packing stuff and i forgot how to convert a integer to its binary character equivalent |
09:28:18 | FromDiscord | <albassort> e.g int32 to a 4 character string |
09:30:24 | FromDiscord | <albassort> encode it into a string |
09:31:35 | FromDiscord | <albassort> ord doesn't work with int32s :( |
09:31:58 | FromDiscord | <albassort> this question is no longer required |
09:39:59 | FromDiscord | <albassort> i can use stream :)\ |
10:05:10 | FromDiscord | <albassort> I CANT USE A STREAM |
10:07:52 | FromDiscord | <kiloneie> In reply to @gogolxdong666 "which vscode extension could": https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode |
10:31:24 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=qhfDVvqRyoej |
10:31:27 | FromDiscord | <albassort> i feel like theres a better way |
10:31:38 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=lvtXoEhMZKeH" => "https://play.nim-lang.org/#pasty=aQsoDmodMNjN" |
10:32:57 | FromDiscord | <griffith1deadly> In reply to @albassort "i feel like theres": byte compatible type with char |
10:33:24 | FromDiscord | <albassort> doesn't work outside for anything larger than bytes |
10:33:26 | FromDiscord | <griffith1deadly> you can not make map, just `array[4, char]` |
10:33:46 | FromDiscord | <albassort> ah thats better, you're right |
10:33:54 | NimEventer | New thread by grd: About a VFS library, see https://forum.nim-lang.org/t/11286 |
10:34:02 | FromDiscord | <albassort> but I feel like there is a single command that does that lole |
10:34:14 | FromDiscord | <albassort> (edit) "command" => "proc" | "procthat does ... thatforgetting" added "all of this" | "lole" => "forgetting" |
11:02:10 | FromDiscord | <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:24 | FromDiscord | <pzbz.> When is the TGE? |
13:26:58 | FromDiscord | <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:13 | FromDiscord | <.bobbbob> In reply to @albassort "hello im packing stuff": are you talking about toHex() in strutils? |
16:16:03 | * | junaid_ joined #nim |
16:49:00 | NimEventer | New 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:43 | FromDiscord | <waakul> Why do i have errors installing faster-than-requests in windows using pip? |
17:16:08 | FromDiscord | <waakul> wait this is for nim? |
17:16:20 | FromDiscord | <waakul> (edit) "wait this ... is" added "server" |
17:34:58 | FromDiscord | <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:16 | FromDiscord | <fosster> are arrays always zero-initialized in nim? |
18:05:26 | FromDiscord | <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:17 | FromDiscord | <whisperecean> is there any easy guide to follow for async nim? |
19:36:53 | NimEventer | New 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:34 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> Arrays are value types so allocator does not change anything. On top of it Nim 0-inits all memory↵(@bosinski2023) |
19:58:32 | FromDiscord | <Elegantbeef> @whisperecean `try: ... except OsError: ...` |
20:00:17 | * | advesperacit quit (Ping timeout: 272 seconds) |
20:31:02 | FromDiscord | <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:00 | FromDiscord | <Elegantbeef> Take it as a parameter or use `{.cast(gcsafe).}: myGlobalVar.doStuff(...)` |
20:34:07 | FromDiscord | <kumolonimbus> Oh awesome, I had seen references to `cast(gcsafe)` but I hadn't really understood its purpose, thanks! |
20:47:51 | FromDiscord | <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:19 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> Those are? |
20:50:26 | FromDiscord | <Elegantbeef> I mean `cow` will be looked up at the instantiation |
20:50:43 | FromDiscord | <Elegantbeef> The integer issue I'm uncertain what's the full error? |
20:50:53 | FromDiscord | <guzba8> one moment |
20:51:09 | FromDiscord | <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:34 | FromDiscord | <guzba8> it is not ambiguous generally so im not sure why it behaves differently in a `quote do` |
20:51:51 | FromDiscord | <Elegantbeef> Are you surer `toJson(10, buffer)` should not work either |
20:51:54 | FromDiscord | <Elegantbeef> sure\ |
20:52:20 | FromDiscord | <guzba8> it fails when the number is the right operand, eg `"num": 3` |
20:52:29 | FromDiscord | <guzba8> ``r`.toJson(s)` |
20:52:40 | FromDiscord | <Elegantbeef> Right that's not the macro |
20:52:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QytvKZBtdwMO |
20:53:03 | FromDiscord | <Elegantbeef> That's just dispatch `10` does not match either generic instantiation more |
20:53:21 | FromDiscord | <guzba8> and yet |
20:53:23 | FromDiscord | <guzba8> `echo 10.toJson()` works |
20:53:47 | FromDiscord | <Elegantbeef> Not with the above example |
20:53:59 | FromDiscord | <Elegantbeef> You can make a `int` overload if you want it to prefer it |
20:54:02 | FromDiscord | <guzba8> true, with doThing it does not |
20:54:38 | FromDiscord | <Elegantbeef> or you can just do `if val.kind == nkIntLit: val = nnkCall.newTree("int", val)` |
20:54:39 | FromDiscord | <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:31 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=FFhzoFztxwlj |
20:55:43 | FromDiscord | <guzba8> seems like it should have the same `doThing` issue |
20:56:22 | FromDiscord | <Elegantbeef> No cause you're lying 😛 |
20:56:32 | FromDiscord | <Elegantbeef> you're doing `10.toJson` not `10.toJson(buffer)` |
20:56:51 | FromDiscord | <Elegantbeef> The former is using `typeof(10)` to reason the type which is a `IntLiteral` which defaults to `int` |
20:56:51 | FromDiscord | <guzba8> mmmmmmm ok ok |
20:57:17 | FromDiscord | <Elegantbeef> The latter is attempting to match `SomeSignedInt` and `SomeUnsignedInt` but both are generic so `int` is not more convertible to either |
20:57:32 | FromDiscord | <guzba8> ill take it, its the direct-to-generic thing in my head |
20:57:34 | FromDiscord | <Robyn [She/Her]> In reply to @guzba8 "first, using `cow` const": As in, edit the line info or something? |
20:57:35 | FromDiscord | <guzba8> ok cool tyty |
20:58:18 | FromDiscord | <Elegantbeef> Now the cow issue... huh |
20:58:49 | * | FromDiscord quit (Remote host closed the connection) |
20:59:02 | * | FromDiscord joined #nim |
20:59:19 | FromDiscord | <Elegantbeef> can you `echo treeRepr` from the `addExtraFields`? |
20:59:56 | FromDiscord | <guzba8> yeah sorry just one moment im trying to iron out the int thing quick to get that out of my head |
21:00:58 | FromDiscord | <Elegantbeef> Also you should do `error(..., p)` inside that macro |
21:04:02 | FromDiscord | <guzba8> ok this appears to fix integer constants and i think did the error thing: https://github.com/guzba/sunny/commit/0760ef1e69279bab5c00984b4f3db9a59dc9ddbf |
21:04:08 | FromDiscord | <guzba8> cow time |
21:05:24 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=ZeEUzaHdiUNB |
21:05:37 | FromDiscord | <Elegantbeef> Oh you're doing `typeof(`l`)` |
21:05:37 | FromDiscord | <guzba8> ^ that is the echo treeRepr from the addExtraFields |
21:06:09 | FromDiscord | <guzba8> that is inside the `quote do` and appears to happen later in typed phase i think |
21:06:15 | FromDiscord | <guzba8> it does not affect the cow issue at least |
21:07:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gQkBXKrKmkKI |
21:07:49 | FromDiscord | <Elegantbeef> Your issue is that you're trying to call `typeof` on a identifier that ostensibly will not exist |
21:08:08 | FromDiscord | <Elegantbeef> technically you can do `astToStr(l)` with what you have now, but that may result in funky stuffs |
21:09:07 | FromDiscord | <Elegantbeef> To do what you're doing now you'd need to have a variable or constant named `cow` |
21:09:52 | FromDiscord | <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:54 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=ZIKkHEgDAfyi |
21:10:13 | FromDiscord | <guzba8> ok thats what i thought perhaps was the case |
21:10:24 | FromDiscord | <guzba8> in which case, nope just strings baby |
21:10:43 | FromDiscord | <Elegantbeef> Cmon you can atleast just use Nim identifiers 😄 |
21:10:54 | FromDiscord | <guzba8> i think perhaps i am still confused |
21:10:58 | FromDiscord | <guzba8> lets go back to basics |
21:11:30 | FromDiscord | <guzba8> is it possible to get the `const cow` thing to work without making every single thing templates |
21:12:22 | FromDiscord | <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:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=DPdgzMrCcDQV |
21:12:40 | FromDiscord | <Elegantbeef> Turns out yes variables can be mixin'd |
21:12:53 | FromDiscord | <Elegantbeef> It'd have been before quote do |
21:13:10 | FromDiscord | <Elegantbeef> If you wanted to allow `{cow: ...}` to work but not care about a variable named `cow` |
21:14:00 | FromDiscord | <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:44 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> So I guess sorry 😛 |
21:15:05 | FromDiscord | <guzba8> its not a big deal, this comes up in other cases |
21:16:06 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=UETuZfZooFVs |
21:21:10 | FromDiscord | <guzba8> interesting final thing |
21:22:45 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> Like I said mixin the identifier |
21:23:50 | FromDiscord | <Elegantbeef> then you can do `when compiles(l.toJson(): ... else: astToStr(l).toJson()`... or w/e |
21:25:30 | FromDiscord | <guzba8> mixin l and mixin `l` dont seem to do anything, same old `Error: undeclared identifier: 'cow'` |
21:25:34 | FromDiscord | <guzba8> however this `assuming it's not string at the top level of your proc` confuses me |
21:25:46 | FromDiscord | <guzba8> how does it matter where the const is coming from? |
21:26:06 | FromDiscord | <Elegantbeef> You need to emit the `mixin l` at the top level of your proc |
21:26:53 | FromDiscord | <Elegantbeef> But you obviously do not want to emit `mixin "cow"` in the case the programmer wrote `{"cow": ...}` |
21:28:35 | FromDiscord | <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:36 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=zWiZBYHgVnAN |
21:29:41 | * | advesperacit joined #nim |
21:30:40 | FromDiscord | <Elegantbeef> You probably do `result.insert 0, nnkMixinStmt.newTree(l)` instead of using add or quotedo |
21:33:07 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=QcocDLxoighX |
21:35:19 | FromDiscord | <Elegantbeef> except you have a `mixin "..."` which is what you wanted to avoid |
21:39:53 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> you cannot do `mixin "num"` |
21:44:09 | FromDiscord | <guzba8> sent a code paste, see https://play.nim-lang.org/#pasty=cBAytTVCGwjf |
21:44:49 | FromDiscord | <guzba8> sunny |
21:44:54 | FromDiscord | <ElegantBeef> Hmph bridge is down one way 😄 |
21:44:58 | FromDiscord | <ElegantBeef> That's quite literally how this works |
21:45:12 | FromDiscord | <ElegantBeef> `mixin` says "Look for this symbol at instantiation and declaration" |
21:45:16 | FromDiscord | <ElegantBeef> So it works across modules |
21:45:55 | FromDiscord | <guzba8> ok ill try that more when i can work on this next cool |
21:45:58 | FromDiscord | <guzba8> tyty again |
21:58:47 | FromDiscord | <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:28 | FromDiscord | <tsoj> Is it possible to have a requires statement only for specific tasks in a nimble project file? |
23:52:34 | FromDiscord | <tsoj> (edit) "requires" => "`requires`" |
23:55:12 | FromDiscord | <Elegantbeef> There is now a `taskRequires` in Nimble after some version 😄 |
23:57:22 | FromDiscord | <albassort> beef |
23:57:52 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=lDovInuEANWl |
23:57:54 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=VDEwavHyCuHY" => "https://play.nim-lang.org/#pasty=NfoFVMccbuzE" |
23:57:57 | FromDiscord | <albassort> is there a prettier way |
23:59:22 | FromDiscord | <albassort> and no, omitting return is not prettier |
23:59:37 | FromDiscord | <Elegantbeef> It is |