00:00:13 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:39 | * | tk joined #nim |
00:32:12 | * | krux02 quit (Remote host closed the connection) |
01:03:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
01:12:23 | * | noeontheend joined #nim |
01:16:23 | * | syl quit (Quit: ZNC 1.8.2 - https://znc.in) |
01:17:01 | * | syl joined #nim |
01:58:06 | * | noeontheend quit (Ping timeout: 268 seconds) |
02:26:43 | FromDiscord | <TryAngle> hmm I ran into a "weird issue"↵my goal↵implement something that requires division of two numbers but I want it for float and ints |
02:28:32 | FromDiscord | <TryAngle> I think a quick fix is implementing a "unified" div ↵or a div for floats lol |
02:29:15 | FromDiscord | <TryAngle> is there a reason that there is no `div` for floats? |
02:29:48 | FromDiscord | <Rika> because it makes no sense? |
02:32:41 | * | rockcavera joined #nim |
02:32:41 | * | rockcavera quit (Changing host) |
02:32:41 | * | rockcavera joined #nim |
02:33:12 | FromDiscord | <impbox [ftsf]> because there is `/` for floats |
02:33:20 | FromDiscord | <TryAngle> In reply to @Rika "because it makes no": o_O ↵I might misunderstand the intention of div |
02:33:45 | FromDiscord | <TryAngle> In reply to @impbox "because there is `/`": yes but `/` for ints produces floats |
02:33:48 | FromDiscord | <Rika> integer division when you do not want floats |
02:34:00 | FromDiscord | <impbox [ftsf]> `div` computes integer division |
02:34:10 | FromDiscord | <impbox [ftsf]> i guess you might want integer division of floats |
02:34:14 | FromDiscord | <Rika> there are scenarios where you do not want float division |
02:34:28 | FromDiscord | <impbox [ftsf]> and float division of ints |
02:34:37 | FromDiscord | <impbox [ftsf]> but both would use internal conversions |
02:35:09 | FromDiscord | <impbox [ftsf]> but you could define them if you want them |
02:35:17 | FromDiscord | <TryAngle> In reply to @impbox "i guess you might": I want to write an algorithm that works for ints aswell as for floats that requires a division that produces the respective type |
02:35:17 | FromDiscord | <impbox [ftsf]> but their use case is pretty niche |
02:35:36 | FromDiscord | <impbox [ftsf]> @TryAngle you can use `when x is SomeFloat:` |
02:35:40 | FromDiscord | <impbox [ftsf]> to use / else div |
02:35:42 | FromDiscord | <Rika> In reply to @TryAngle "I want to write": when T is int: ...div... elif T is float: .../... |
02:36:06 | FromDiscord | <TryAngle> ah true that works 🤔 |
02:36:13 | FromDiscord | <impbox [ftsf]> but you might want to use / in either case and convert to float and back for ints |
02:36:18 | FromDiscord | <impbox [ftsf]> depending on your requirements |
02:39:37 | * | neurocyte0132889 quit (Ping timeout: 240 seconds) |
02:41:55 | FromDiscord | <TryAngle> ok I guess I add "div" for floats lol |
02:58:34 | FromDiscord | <Rosen> you want it to return a int or a float? |
02:59:34 | FromDiscord | <Rika> In reply to @TryAngle "I want to write": this |
02:59:39 | FromDiscord | <Rika> ints for int, floats for float |
02:59:57 | FromDiscord | <Rika> In reply to @TryAngle "ok I guess I": i would highly suggest not doing this if you are releasing this as a library |
03:05:38 | FromDiscord | <TryAngle> In reply to @Rika "i would highly suggest": hmm ok I reconsider this then, I thought div would be same type while / is a conventient way to write fractions lol |
03:05:52 | FromDiscord | <TryAngle> (edit) "div" => "`div`" | "/" => "`/`" |
03:06:06 | FromDiscord | <Rika> well it isnt |
03:06:29 | FromDiscord | <Rika> what function are you making that needs int -> int and float -> float and ALSO does division? |
03:06:42 | FromDiscord | <TryAngle> when I want to use something like fmod from c (modulo for floats)↵nim has nothing like that right?↵so the simplest thing would just use importc progma? |
03:07:39 | FromDiscord | <leorize> @TryAngle\: I suppose you're looking for this? https://nim-lang.github.io/Nim/math#floorMod%2CT%2CT |
03:08:09 | FromDiscord | <Elegantbeef> nah `math.mod` is `fmod` |
03:08:26 | FromDiscord | <Elegantbeef> Like it's `fmod` imported from C's `math.h` 😀 |
03:08:38 | FromDiscord | <Rika> speaking of which it's strange that we dont have fused divmod |
03:09:52 | FromDiscord | <TryAngle> I wanted to implement gcd and lcm↵I didn't know it was in std/math already lol |
03:10:08 | FromDiscord | <TryAngle> In reply to @leorize "<@147447489316913152>\: I suppose you're": just saw after I clicked on this link |
03:10:17 | FromDiscord | <Rika> please use the search box xd |
03:10:21 | FromDiscord | <Rika> saves a lot of time |
03:10:26 | FromDiscord | <Rika> <-- speaking from experience |
03:10:37 | FromDiscord | <TryAngle> I thought yeah this would be in std/algorithms if it was there |
03:10:49 | FromDiscord | <TryAngle> pressed control + f and didn't find |
03:11:03 | FromDiscord | <TryAngle> totally forgot std/math exists o_O |
03:11:25 | FromDiscord | <TryAngle> In reply to @Rika "please use the search": will do in futurel ol |
03:40:13 | * | arkurious quit (Quit: Leaving) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:32 | * | supakeen joined #nim |
04:15:20 | * | rockcavera quit (Remote host closed the connection) |
04:29:56 | FromDiscord | <huantian> hey, what times.parse format do I use to parse this? `2019-11-12T16:37:40.000Z`↵The main part I'm not sure about is the .000Z at the end |
04:30:18 | FromDiscord | <huantian> is that miliseconds or utc offset |
04:33:51 | FromDiscord | <huantian> I think actually `"yyyy-MM-dd'T'HH:mm:ss'.'fffz"` should be correct |
04:36:18 | FromDiscord | <Rika> Milliseconds |
04:36:23 | FromDiscord | <Rika> Z denotes offset |
04:36:56 | FromDiscord | <Rika> https://en.m.wikipedia.org/wiki/List_of_UTC_time_offsets |
04:42:18 | FromDiscord | <huantian> Thank 🙏 |
04:52:23 | FromDiscord | <Rika> I think this should be useful maybe |
04:52:24 | FromDiscord | <Rika> https://en.m.wikipedia.org/wiki/ISO_8601 |
04:54:18 | * | noeontheend joined #nim |
04:57:55 | FromDiscord | <huantian> ah cool |
05:13:09 | * | Gustavo6046 joined #nim |
06:30:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
07:17:44 | FromDiscord | <Michal58> I feel like it should be possible to return a proc without the return keyword. |
07:21:24 | FromDiscord | <Elegantbeef> What do you mean? |
07:24:17 | * | PMunch joined #nim |
07:27:39 | FromDiscord | <Michal58> sent a code paste, see https://play.nim-lang.org/#ix=3IV0 |
07:28:20 | FromDiscord | <Elegantbeef> Ah i dont use lambdas so make sense why this hasnt bothered me |
07:28:32 | FromDiscord | <Elegantbeef> Yea i mean it should be an R val so it should be returned |
07:30:12 | FromDiscord | <Elegantbeef> Seems it's a parse error afaict |
07:31:03 | FromDiscord | <Michal58> In reply to @Elegantbeef "Seems it's a parse": yeah, it doesn't parse |
07:31:29 | FromDiscord | <Michal58> it is possible to return a proc as the last expression just not in the way like above |
07:31:49 | FromDiscord | <Michal58> sent a code paste, see https://play.nim-lang.org/#ix=3IV2 |
07:31:51 | FromDiscord | <Elegantbeef> Yea i know |
07:31:59 | FromDiscord | <Elegantbeef> I know this bug, it just doesnt bother me |
07:32:09 | FromDiscord | <Elegantbeef> you can also do `result =` |
07:41:06 | FromDiscord | <Elegantbeef> Do you know if there is an issue made? |
08:06:35 | * | Gustavo6046 quit (Quit: Leaving) |
08:07:21 | * | neurocyte0132889 joined #nim |
08:07:21 | * | neurocyte0132889 quit (Changing host) |
08:07:21 | * | neurocyte0132889 joined #nim |
08:11:25 | * | xet7 quit (Quit: Leaving) |
08:20:35 | FromDiscord | <Michal58> I don't |
08:20:50 | FromDiscord | <Michal58> I wanted to ask here first before making it |
08:52:05 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVq |
08:53:36 | FromDiscord | <KatrinaKitten> (edit) "https://play.nim-lang.org/#ix=3IVq" => "https://play.nim-lang.org/#ix=3IVr" |
08:57:04 | FromDiscord | <Elegantbeef> What is `Parser[T]`? |
08:58:20 | FromDiscord | <KatrinaKitten> It's a `proc(input: string): ParseResult[T]`, where `ParseResult` is just an `object`. |
08:58:27 | FromDiscord | <Elegantbeef> Ok |
09:03:35 | * | Vladar joined #nim |
09:05:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVt |
09:06:56 | FromDiscord | <KatrinaKitten> No, it still gives the same `undeclared identifier: 'input'` error. |
09:07:11 | FromDiscord | <Elegantbeef> `nim -v`? |
09:07:45 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVu |
09:08:03 | FromDiscord | <Elegantbeef> I mean the above work fine for me, so we'll need more i guess |
09:09:24 | FromDiscord | <KatrinaKitten> Here's a playground link for the full actual file. https://play.nim-lang.org/#ix=3IVv |
09:10:19 | FromDiscord | <Elegantbeef> Oh there is a second step of indirection |
09:10:35 | FromDiscord | <KatrinaKitten> The `s` func on its own seems to work, but `|` creates a compilation error because `input` isn't declared. |
09:13:54 | FromDiscord | <Elegantbeef> Well i removed some of what made it less readable to me but seems if you pass the type as a parameter instead of use it like a generic it seems to work https://play.nim-lang.org/#ix=3IVw |
09:14:13 | FromDiscord | <Elegantbeef> I also added `{.dirty.}` which makes the template not hygenic, but for this example it seems fine |
09:15:45 | FromDiscord | <KatrinaKitten> Hmm, very odd. That error is resolved now, need to do some finegling to clean up other issues now but I should be able to work it out now I'm past that roadblock. Thanks! |
09:16:01 | FromDiscord | <Elegantbeef> No problem |
09:16:59 | FromDiscord | <Elegantbeef> I think i see why with dirty one needs to pass a typedesc as a parameter, since it's dirty the T isnt injected as a symbol i assume |
09:17:31 | FromDiscord | <Elegantbeef> Nope that's not right 😀 |
09:17:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVx |
09:17:56 | FromDiscord | <KatrinaKitten> After a little playing it works just fine continuing to use `{.inject.}` instead of `{.dirty.}`, so long as it's a `typedesc` instead of a generic. |
09:18:10 | FromDiscord | <Elegantbeef> Odd |
09:18:22 | FromDiscord | <Elegantbeef> I need to find the mechanism that causes this and see how easy it is to fix |
09:26:30 | * | Lord_Nightmare quit (Ping timeout: 260 seconds) |
09:26:32 | FromDiscord | <Elegantbeef> Ah i've got it! |
09:27:17 | FromDiscord | <Elegantbeef> It's actually a generic issue not a template issue |
09:29:35 | FromDiscord | <Elegantbeef> Oh methinks i see the issue, it's attempting to semantically check this call and as such `echo(input)` fails as the generic messes with the logic |
09:29:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVy |
09:30:10 | FromDiscord | <KatrinaKitten> Interesting 🤔 |
09:32:55 | FromDiscord | <qb> Elegantbeef is a great nim support bot 😄 |
09:33:16 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVz |
09:33:20 | FromDiscord | <qb> Are you `ba0f3` on github btw? |
09:33:28 | FromDiscord | <Elegantbeef> We can actually make your code work |
09:33:30 | FromDiscord | <Elegantbeef> Me? |
09:33:34 | FromDiscord | <qb> Yups |
09:33:44 | FromDiscord | <Elegantbeef> Nah beef331 |
09:33:53 | FromDiscord | <qb> Alright |
09:34:19 | FromDiscord | <Elegantbeef> Line 38 katrina https://play.nim-lang.org/#ix=3IVA |
09:34:31 | FromDiscord | <Elegantbeef> Forces `input` to remain open until the instantiation of the generic |
09:35:02 | FromDiscord | <Elegantbeef> I dont think it's possible to constrain like that |
09:35:41 | FromDiscord | <Elegantbeef> It makes 100% sense now why it errors and i think it's technically "right" though i dont know |
09:36:56 | FromDiscord | <Elegantbeef> Actually i'm wrong |
09:36:59 | FromDiscord | <Elegantbeef> You can constrain them |
09:37:10 | FromDiscord | <Elegantbeef> `[X, Y; Z: X or Y` |
09:37:23 | FromDiscord | <Elegantbeef> Or `X | Y` if you're a degenerate that likes farts or some jovial insult |
09:37:56 | FromDiscord | <KatrinaKitten> Ahhh the `;`, that makes sense. `mixin` seems to have the desired effect in this case, but I'm guessing is less typesafe? |
09:38:40 | FromDiscord | <Elegantbeef> Well `mixin` will allow selecting any variables into the scope |
09:38:54 | FromDiscord | <Elegantbeef> It's not a typesafe thing as a selecting of symbols |
09:39:27 | FromDiscord | <Elegantbeef> So basically when you instantiate a generic with `mixin` in it'll be capable of selecting any in scope, but it should always pick the one in the template |
09:39:42 | FromDiscord | <KatrinaKitten> Cool! |
09:40:37 | FromDiscord | <Elegantbeef> I'm apparently wrong, it'll crash if there is another input in scope |
09:40:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVD |
09:41:07 | FromDiscord | <Elegantbeef> Oh wait i'm dumb |
09:41:20 | FromDiscord | <Elegantbeef> There we go |
09:41:22 | FromDiscord | <Elegantbeef> That runs |
09:41:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVE |
09:41:38 | FromDiscord | <Elegantbeef> The input before was erroring since forcing the symbol open made it go "Yep this really doesnt work |
09:44:39 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVF |
09:45:10 | FromDiscord | <KatrinaKitten> Typecasts being there or not makes no apparent difference. |
09:45:12 | FromDiscord | <Elegantbeef> Ah maybe instantiating types with the parameters doesnt work |
09:46:30 | FromDiscord | <Elegantbeef> Uhh you wrote a custom `as`? |
09:47:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVG |
09:47:17 | FromDiscord | <KatrinaKitten> Ah, no, that was just my offhand guess. The documentation is a pain to search through. |
09:47:27 | FromDiscord | <Elegantbeef> Nah it's just `Parser[V] (t)` |
09:47:37 | FromDiscord | <Elegantbeef> Space isnt required that's me being dumb |
09:47:44 | FromDiscord | <Elegantbeef> Any form of call works for it |
09:48:18 | FromDiscord | <Elegantbeef> I have a hypothesis for the issue so give me a moment |
09:49:06 | FromDiscord | <KatrinaKitten> That gives the same error, even if I wrap it in `cast`. I'm guessing the issue is I'm trying to get it to infer the generics and it's freaking out at `V` not having an explicitly inferable definition, even though it has a constraint that should be inferable. |
09:49:49 | FromDiscord | <KatrinaKitten> I.e. I'm calling it as `doThing(<params>)` not `doThing[<types>](<params>)`. |
09:50:03 | FromDiscord | <KatrinaKitten> (edit) "`doThing[<types>](<params>)`." => "`doThing[<types>](<params>)`, in part because of operator syntax." |
09:50:44 | FromDiscord | <Elegantbeef> Hmm |
09:50:52 | FromDiscord | <Elegantbeef> Nah i dont think so |
09:51:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVI |
09:51:42 | FromDiscord | <Elegantbeef> Can you pass the full file again? |
09:52:34 | FromDiscord | <KatrinaKitten> Ah, see, I don't have any parameters that use `V` in their type. https://play.nim-lang.org/#ix=3IVJ |
09:53:01 | FromDiscord | <KatrinaKitten> It's only used in the output type and as a parameter to the `createParserTo` template, not in any of the input parameter types. |
09:53:02 | FromDiscord | <Elegantbeef> Yea that's the issue |
09:53:32 | FromDiscord | <Elegantbeef> You can just do `Parser[T or U]` i think |
09:53:54 | FromDiscord | <KatrinaKitten> That would work, but I also |
09:54:19 | FromDiscord | <KatrinaKitten> That would work, but on passing `T or U` to `createParserTo`, it complains that it's getting a type node rather than a `typedesc`. |
09:54:34 | FromDiscord | <Elegantbeef> I meant just as the return type |
09:55:06 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVK |
09:55:28 | FromDiscord | <Elegantbeef> Ah yea just do `Parser` than |
09:55:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IVL |
09:57:11 | FromDiscord | <KatrinaKitten> Hmm... Let me play around a little and see if I can get it to work along those lines. |
09:57:12 | FromDiscord | <Elegantbeef> You cant really constrain return types that well |
09:57:21 | FromDiscord | <KatrinaKitten> If not, `mixin` may have to do, which is fine. |
09:57:49 | FromDiscord | <Elegantbeef> And btw `cast` is a lowlevel bit for bit cast |
09:57:55 | FromDiscord | <Elegantbeef> So it's almost never what you want |
09:58:48 | FromDiscord | <Elegantbeef> !eval echo cast[float](256) |
09:58:50 | NimBot | 1.264808053353591e-321 |
09:58:55 | FromDiscord | <Elegantbeef> damn bridge |
09:58:58 | FromDiscord | <Elegantbeef> Wait it worked 😀 |
09:59:16 | FromDiscord | <Elegantbeef> that's `echo cast[float](256)` since it got destroyed |
09:59:58 | FromDiscord | <KatrinaKitten> Yeah, it doesn't like me trying to work around it that way since I need to wrap that entire body in a template call, rather than just the result. |
10:04:23 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IVN |
10:04:44 | FromDiscord | <KatrinaKitten> (edit) "https://play.nim-lang.org/#ix=3IVN" => "https://play.nim-lang.org/#ix=3IVO" |
10:06:42 | FromDiscord | <Elegantbeef> Yea it's too late for me to think about this |
10:06:55 | FromDiscord | <KatrinaKitten> Mood. Thanks for all the help, I should probably head to bed myself. |
10:07:12 | FromDiscord | <Elegantbeef> I can only say "probably give up the idea of constraining result" |
10:07:22 | FromDiscord | <Elegantbeef> Just make it a `Parser` and call it a day there |
10:07:40 | FromDiscord | <Elegantbeef> It's a generic so it can only return 1 possible type at a time |
10:08:17 | FromDiscord | <KatrinaKitten> Yeah, I may just have to make it so combinators like `|` can't combine parsers which return differing types. |
10:08:49 | FromDiscord | <Elegantbeef> I mean if you want to combine them you'd just need to use a tagged union |
10:08:53 | FromDiscord | <Elegantbeef> Or as Nim calls them object variants |
10:09:10 | FromDiscord | <Elegantbeef> Anyway i'm out |
11:09:40 | NimEventer | New Nimble package! flower - A pure Nim bloom filter., see https://github.com/dizzyliam/flower |
11:18:25 | * | xet7 joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:30 | * | supakeen joined #nim |
12:50:15 | Amun-Ra | I like seeing "The `.raises` requirements differ." without disclosing any details |
13:40:08 | * | rockcavera joined #nim |
13:40:09 | * | rockcavera quit (Changing host) |
13:40:09 | * | rockcavera joined #nim |
14:00:10 | * | arkurious joined #nim |
14:11:38 | Amun-Ra | is there alternative that'd work here? https://play.nim-lang.org/#ix=3IWK |
14:13:59 | FromDiscord | <Yardanico> i don't think so |
14:14:04 | FromDiscord | <Yardanico> one alternative you can do is create a compile time seq |
14:14:08 | FromDiscord | <Yardanico> and then convert it into an array |
14:16:13 | Amun-Ra | thanks |
14:16:13 | FromDiscord | <tbrekalo> what could I try to build over a weekend to get a grasp on nim's metaprogramming? something with a heavy macro/template use? |
14:27:09 | FromDiscord | <haxscramper> In reply to @tbrekalo "what could I try": DSL for some repetitive task you have to do |
14:27:15 | FromDiscord | <haxscramper> Or just html generator DSL |
14:30:21 | FromDiscord | <exelotl> `use` keyword is a fun exercise: https://youtu.be/QM1iUe6IofM?t=2470 |
14:34:04 | FromDiscord | <tbrekalo> Okay; thanks; Will try something like that 🙂 |
14:38:50 | FromDiscord | <sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=3IWZ |
14:42:15 | FromDiscord | <haxscramper> `when t is int`, `elif t is string` |
14:43:32 | FromDiscord | <sigmasd> That's nice, thanks! |
15:00:53 | Amun-Ra | I'm trying to convert seq to array (compile time) and I hit compiler error: https://play.nim-lang.org/#ix=3IX6 |
15:38:45 | FromDiscord | <sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=3IXp |
15:44:10 | FromDiscord | <SolitudeSF> you can write a for loop macro for that |
16:00:43 | FromDiscord | <sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=3IXx |
16:08:30 | FromDiscord | <sigmasd> replacing r with r = newStmtList() seems to work |
16:14:52 | * | noeontheend joined #nim |
16:19:10 | * | noeontheend quit (Remote host closed the connection) |
16:26:05 | FromDiscord | <sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=3IXJ |
16:27:16 | arkanoid | Is nim forum broken? |
16:28:44 | nrds | <Prestige99> It's up for me |
16:30:45 | FromDiscord | <SolitudeSF> try `ident Extra` |
16:30:57 | FromDiscord | <SolitudeSF> in quotes ofc |
16:40:41 | FromDiscord | <sigmasd> `proc \`ident Extra\` ()=\` is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:40:55 | FromDiscord | <sigmasd> proc `ident Extra` ()=↵is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:41:02 | FromDiscord | <sigmasd> proc \`ident Extra\` ()=↵is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:41:07 | FromDiscord | <sigmasd> `proc `ident Extra` ()=`↵is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:41:11 | FromDiscord | <sigmasd> proc `ident Extra` ()=↵is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:41:18 | FromDiscord | <sigmasd> proc \`ident Extra\` ()=↵is accepted by the compiler but its seems to ignore the extra and only quote the ident |
16:43:17 | FromDiscord | <SolitudeSF> well, you are already in a macro, you can always construct new identifier |
16:45:30 | FromDiscord | <sigmasd> nice! ident(fmt( works |
16:49:32 | * | PMunch quit (Quit: Leaving) |
16:49:55 | * | xet7 quit (Quit: Leaving) |
17:11:43 | FromDiscord | <kevin> Is there a preferred way to check if a seq is empty? |
17:11:59 | FromDiscord | <kevin> Python has `if(not myList):` |
17:12:23 | FromDiscord | <Rika> if sq.len == 0 |
17:12:41 | FromDiscord | <kevin> gotcha. Wasnt' sure if there was a simpler way, thanks |
17:13:14 | FromDiscord | <Rika> nim isnt a supporter of "truthiness" |
17:13:32 | FromDiscord | <kevin> damn thats unlucky |
17:14:24 | nrds | <Prestige99> I think it's easier to read |
17:17:21 | nrds | <Prestige99> Truthiness can be very different between languages (see JavaScript) so I like that we just check the length in this case |
17:17:50 | nrds | <Prestige99> E.g. in js if (myList) would be true if the array were empty |
17:18:13 | FromDiscord | <retkid> oii |
17:18:34 | FromDiscord | <retkid> i forget, how do i safe a hex string to a encoded file |
17:18:44 | FromDiscord | <retkid> like, not as text but as the binary of the file itself |
17:22:06 | FromDiscord | <retkid> i got it |
17:22:13 | FromDiscord | <retkid> (edit) "i got ... itas" added "it, had to parse" | "it, had to parseit ... " added "as a hex string <3" |
17:28:53 | FromDiscord | <retkid> when i convert ints to hex im getting leading 0s? |
17:28:58 | FromDiscord | <retkid> why/ |
17:29:00 | FromDiscord | <retkid> (edit) "why/" => "why?" |
17:46:33 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3IXZ |
17:46:37 | FromDiscord | <hmmm> someone told me by I forgot 🤔 |
17:48:53 | * | tiorock joined #nim |
17:48:53 | * | tiorock quit (Changing host) |
17:48:53 | * | tiorock joined #nim |
17:48:53 | * | rockcavera is now known as Guest3200 |
17:48:53 | * | Guest3200 quit (Killed (zirconium.libera.chat (Nickname regained by services))) |
17:48:53 | * | tiorock is now known as rockcavera |
17:48:59 | nrds | <Prestige99> var mySeq |
17:49:09 | FromDiscord | <hmmm> ye ok but why |
17:49:11 | FromDiscord | <Rosen> declare it as var seq[string] to have the mutations persist out of the scope of the function, or make a var copy if you want to only mutate it in the function |
17:50:51 | FromDiscord | <IsaacPaul> In reply to @retkid "i forget, how do": Translate the string to a byte array and write that to a file |
17:51:37 | nrds | <Prestige99> @hmmm variables are immutable by default |
17:52:20 | FromDiscord | <hmmm> yea but why, does Araq hates mutable variables or there is some important reason for it |
17:53:03 | FromDiscord | <IsaacPaul> In reply to @retkid "when i convert ints": https://nim-lang.org/docs/strutils.html#toHex%2CT↵The second parameter in toHex is the length |
17:54:19 | FromDiscord | <IsaacPaul> In reply to @hmmm "yea but why, does": immutable reduces cognitive load of the developer. You know that data can't change so you don't have to worry about it. |
17:54:43 | FromDiscord | <hmmm> hmm, this seems like a good reason |
17:55:57 | * | neurocyte0132889 quit (Ping timeout: 240 seconds) |
18:01:01 | * | xet7 joined #nim |
18:06:57 | FromDiscord | <jfmonty2> fighting with the compiler about static generics\: https://play.nim-lang.org/#ix=3IY0 |
18:07:12 | FromDiscord | <jfmonty2> this compiles and runs just fine, in particular it is correctly choosing the type for `len` based on `Size` |
18:08:03 | FromDiscord | <jfmonty2> but as soon as I try to define a proc that takes a `FixedSeq` as a parameter, it spits out a compile error "Cannot generate code for\: Size" |
18:12:36 | nrds | <Prestige99> Don't you need to provide the generics? |
18:12:41 | nrds | <Prestige99> e.g. proc doSomething(s: FixedSeq[8, int]) = |
18:14:03 | nrds | <Prestige99> although the defeats the purpose |
18:14:09 | nrds | <Prestige99> s/the/that/ |
18:16:13 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3IY7 |
18:17:22 | nrds | <Prestige99> For some reason it semes to be printing uint8 on line 23 for me, but then uint16 on line 25 🤔 |
18:17:29 | nrds | <Prestige99> @jfmonty2 ^ |
18:20:24 | FromDiscord | <Abi> sent a code paste, see https://play.nim-lang.org/#ix=3IYb |
18:20:43 | FromDiscord | <Abi> (edit) "https://play.nim-lang.org/#ix=3IYb" => "https://play.nim-lang.org/#ix=3IYc" |
18:21:25 | FromDiscord | <Yardanico> but splitLines returns either a seq[string] if it's a func or a string if it's an iterator |
18:21:30 | FromDiscord | <jfmonty2> Right, that's intentional because the size is 256 the second time↵(<@709044657232936960_nrds=5b=49=52=43=5d>) |
18:21:33 | FromDiscord | <Abi> (edit) "https://play.nim-lang.org/#ix=3IYc" => "https://play.nim-lang.org/#ix=3IYe" |
18:21:39 | FromDiscord | <Yardanico> if you want to call `pairs` on something it needs to have that function defined for it obviously |
18:21:45 | FromDiscord | <Yardanico> and there's no pairs for seq[string] or string |
18:22:03 | FromDiscord | <Yardanico> ah i see what you mean |
18:22:14 | FromDiscord | <Yardanico> yeah it's because in this case nim thinks splitLines is an iterator or something |
18:22:20 | FromDiscord | <Abi> In reply to @Yardanico "and there's no pairs": https://nim-lang.org/docs/iterators.html#pairs.i%2Cseq%5BT%5D ? |
18:22:42 | FromDiscord | <Yardanico> yeah that's the general pairs |
18:22:50 | nrds | <Prestige99> @jfmonty2 oh I didn't see you were echoing fs and not fs2 |
18:22:56 | * | neurocyte0132889 joined #nim |
18:22:56 | * | neurocyte0132889 quit (Changing host) |
18:22:56 | * | neurocyte0132889 joined #nim |
18:22:57 | FromDiscord | <Abi> which should apply to `seq[string]`, I'd have thought |
18:23:25 | FromDiscord | <Yardanico> well in your case it's weird |
18:23:31 | FromDiscord | <Yardanico> splitLines returns seq[string] _once_ |
18:23:45 | FromDiscord | <Yardanico> and yeah i think it doesn't work in 2nd case because nim takes splitLines iterator overload |
18:23:56 | FromDiscord | <Yardanico> instead of the seq[string] overload |
18:24:05 | FromDiscord | <Abi> this is what I assumed, but I thought I'd check |
18:24:10 | FromDiscord | <Yardanico> just saying - if you need indexes, just use std/enumerate for iterators :) |
18:24:12 | FromDiscord | <krisppurg> Has anyone used jsony?# |
18:24:18 | FromDiscord | <Yardanico> @Solitude has |
18:24:20 | FromDiscord | <krisppurg> (edit) "jsony?#" => "jsony?" |
18:24:22 | FromDiscord | <Yardanico> In reply to @0xAb1 "this is what I": https://nim-lang.org/docs/enumerate.html |
18:24:34 | FromDiscord | <Abi> that's weird though, I feel like it should have worked like in part two |
18:24:51 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3IYj |
18:25:07 | FromDiscord | <Yardanico> and this is more efficient too |
18:25:11 | FromDiscord | <Abi> gahhh i never liked `enumerate` in Python, it's always felt somewhat cumbersome lol |
18:25:19 | FromDiscord | <Yardanico> since you don't need to preallocate a new seq for storing split strings |
18:25:27 | FromDiscord | <Abi> either way - ty for your help! |
18:26:01 | FromDiscord | <Abi> (edit) "it" => "part two" | removed "like in part two" |
18:29:06 | * | neurocyte0132889 quit (Ping timeout: 256 seconds) |
18:32:48 | * | krux02__ joined #nim |
18:36:50 | * | neurocyte0132889 joined #nim |
18:36:50 | * | neurocyte0132889 quit (Changing host) |
18:36:50 | * | neurocyte0132889 joined #nim |
18:36:56 | FromDiscord | <exelotl> In reply to @IsaacPaul "immutable reduces cognitive load": I like this succinct explanation ^^ |
18:42:14 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3IYk |
18:42:19 | FromDiscord | <krisppurg> sorry for huge message |
18:43:38 | FromDiscord | <theangryepicbanana> it probably expects an array of flags rather than a number representing a bitset |
18:43:47 | FromDiscord | <theangryepicbanana> (edit) "a bitset" => "bitflags" |
18:44:11 | * | tiorock joined #nim |
18:44:11 | * | tiorock quit (Changing host) |
18:44:11 | * | tiorock joined #nim |
18:44:11 | * | rockcavera quit (Killed (strontium.libera.chat (Nickname regained by services))) |
18:44:11 | * | tiorock is now known as rockcavera |
18:44:48 | FromDiscord | <Yardanico> In reply to @krisppurg "So, I was looking": i think it's fair to just ping treeform or open an issue in jsony so he can respond quicker |
18:45:38 | FromDiscord | <Yardanico> also I don't understand why do you use `JsonNode` if you want to use jsony and have better performance |
18:46:00 | FromDiscord | <Yardanico> ah, to change public_flags later I guess |
18:48:37 | FromDiscord | <krisppurg> @treeform |
18:50:49 | FromDiscord | <krisppurg> In reply to @Yardanico "also I don't understand": well if I do also change it to string, I would have to go through parts where I call `.newUser` on other files and it would be a long tedious process to change since they are called commonly. |
18:51:02 | FromDiscord | <Yardanico> have you tried packedjson at least though? |
18:51:03 | FromDiscord | <krisppurg> (edit) "In reply to @Yardanico "also I don't understand": well if I do also change it to string, I would have to go through parts where I call `.newUser` on other files and it would be a long tedious process to change ... since" added "the json to string" |
18:51:07 | FromDiscord | <krisppurg> packedjson? |
18:51:10 | FromDiscord | <Yardanico> yes? |
18:51:16 | FromDiscord | <Yardanico> https://github.com/Araq/packedjson |
18:51:47 | FromDiscord | <Yardanico> also why specifically optimize json? is that the slowest part of dimscord? |
18:52:25 | FromDiscord | <krisppurg> not just optimising but to shorten objects.nim |
18:52:36 | FromDiscord | <krisppurg> since it is getting repetitive and long |
18:52:49 | FromDiscord | <Yardanico> i thought you were already using json.to? |
18:53:07 | FromDiscord | <krisppurg> json.to is not the best |
18:53:12 | FromDiscord | <krisppurg> I do use at some |
18:53:18 | FromDiscord | <krisppurg> (edit) "I do use at some ... " added "parts of the code" |
18:53:24 | FromDiscord | <Yardanico> In reply to @krisppurg "json.to is not the": you can create custom procs for some types too |
18:53:35 | FromDiscord | <krisppurg> wdym |
18:53:37 | FromDiscord | <Yardanico> https://nim-lang.org/docs/jsonutils.html |
18:53:41 | FromDiscord | <Yardanico> if you mean you can' |
18:53:46 | FromDiscord | <Yardanico> (edit) "can'" => "can't use it with set[Type]" |
18:56:05 | FromDiscord | <treeform> In reply to @krisppurg "<@!107140179025735680>": Give me a small example and i'll figure it out. I think set[Foo] expects [1,2,3] not 6. But one can write a custom hook for set[UserFlags] thats bit based? |
18:58:19 | FromDiscord | <treeform> I need sample of your json and your nim object |
19:00:08 | FromDiscord | <krisppurg> bare with me in a sec |
19:00:19 | * | noeontheend joined #nim |
19:01:03 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3IYu |
19:01:27 | FromDiscord | <treeform> I can write one for you if you provide the more info |
19:02:08 | FromDiscord | <krisppurg> https://play.nim-lang.org/#ix=3IYv |
19:02:17 | FromDiscord | <krisppurg> here is minimal example |
19:10:32 | FromDiscord | <retkid> alright so |
19:10:52 | FromDiscord | <retkid> im generating around 37324800000 or 37 billion random numbers between 0 and 255 |
19:11:03 | FromDiscord | <retkid> is there anyway to speed that up? |
19:12:14 | FromDiscord | <retkid> well holy shit my computer doesn't have enough space for this data |
19:15:23 | nrds | <Prestige99> Could do it in parallel but idk what your use case is |
19:15:57 | FromDiscord | <retkid> i guess |
19:16:02 | FromDiscord | <retkid> race conditions be crazy tho |
19:16:18 | nrds | <Prestige99> What race conditions? |
19:16:32 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3IYx |
19:16:35 | FromDiscord | <treeform> But am not sure your cast to flags it correct |
19:16:42 | FromDiscord | <treeform> how is it supposed to work? |
19:16:59 | FromDiscord | <treeform> set is an array to nim? you can't just cast a number to it? |
19:17:00 | FromDiscord | <retkid> anyway, the nim side of the equation is the least bottlenecked |
19:17:47 | FromDiscord | <treeform> In reply to @krisppurg "https://play.nim-lang.org/#ix=3IYv": https://play.nim-lang.org/#ix=3IYz |
19:18:17 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3IYA |
19:18:27 | FromDiscord | <hmmm> oh noes it didn't format! 😦 |
19:19:07 | FromDiscord | <treeform> In reply to @krisppurg "https://play.nim-lang.org/#ix=3IYv": I don't think your flag format can be decomposed like this. You have flags=256 but your enums are not power of 2, so they can't be packed into an integer C style... |
19:19:15 | FromDiscord | <krisppurg> In reply to @treeform "how is it supposed": user flags is bitwise. |
19:19:23 | FromDiscord | <treeform> but your enums are not? |
19:19:28 | FromDiscord | <krisppurg> they are |
19:19:39 | FromDiscord | <krisppurg> just doesn't look like it |
19:20:03 | FromDiscord | <krisppurg> ufHouseBravery is the same as saying 2^6 |
19:20:08 | FromDiscord | <krisppurg> (edit) "ufHouseBravery ... is" added "= 6" |
19:20:24 | FromDiscord | <treeform> ufNone is 0, ufDiscordEmployee is 1, ufPartneredServerOwner is 2, ufHypesquadEvents, is 3 |
19:20:34 | FromDiscord | <krisppurg> well technically yes |
19:20:42 | FromDiscord | <treeform> 2^6 is 64 ? |
19:20:46 | FromDiscord | <treeform> not 6 |
19:20:52 | FromDiscord | <krisppurg> yes |
19:21:23 | FromDiscord | <krisppurg> if you do cast[uint]({ufHouseBravery}) |
19:21:40 | FromDiscord | <treeform> well you are casting a set which is an array? |
19:21:46 | FromDiscord | <Solitude> its not an array |
19:22:02 | FromDiscord | <Solitude> bitarray i guess |
19:22:38 | FromDiscord | <Solitude> whats wrong with doing that? thats the data he expects |
19:22:54 | FromDiscord | <treeform> if it works it works, I just did not know sets worked like this |
19:23:17 | * | neurocyte0132889 quit (Ping timeout: 240 seconds) |
19:24:22 | * | Gustavo6046 joined #nim |
19:24:35 | FromDiscord | <treeform> the more you know! |
19:24:37 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3IYE |
19:24:45 | FromDiscord | <treeform> Then the code I posted earlier is correct. |
19:24:54 | FromDiscord | <treeform> https://play.nim-lang.org/#ix=3IYz |
19:27:01 | * | joshbaptiste quit (Ping timeout: 245 seconds) |
19:28:52 | FromDiscord | <krisppurg> also treeform is there any other examples for your jsony library? I've read your readme btw |
19:28:53 | * | joshbaptiste joined #nim |
19:29:00 | FromDiscord | <krisppurg> (edit) "your" => "the" |
19:30:06 | FromDiscord | <krisppurg> and what does the argument `i` in `parseHook` supposed to represent? |
19:34:02 | FromDiscord | <retkid> whats this thing with genetic tyes? |
19:34:21 | FromDiscord | <retkid> nvm |
19:34:28 | FromDiscord | <retkid> misnomer |
19:36:34 | FromDiscord | <krisppurg> @treeform? |
19:43:05 | FromDiscord | <Solitude> current position of parser |
19:43:19 | FromDiscord | <Solitude> @krisppurg |
19:43:44 | FromDiscord | <krisppurg> something like how many chars left? |
19:43:55 | FromDiscord | <Solitude> something like which character is next |
19:44:05 | FromDiscord | <treeform> In reply to @krisppurg "and what does the": index in into the string, just pass it through |
19:45:29 | FromDiscord | <krisppurg> alright |
19:48:36 | * | Lord_Nightmare joined #nim |
19:59:56 | * | Onionhammer quit (Quit: Ping timeout (120 seconds)) |
20:00:14 | * | Onionhammer joined #nim |
20:05:53 | * | Vladar quit (Quit: Leaving) |
20:08:22 | * | neurocyte0132889 joined #nim |
20:08:22 | * | neurocyte0132889 quit (Changing host) |
20:08:22 | * | neurocyte0132889 joined #nim |
20:08:37 | * | noeontheend quit (Ping timeout: 240 seconds) |
20:16:47 | FromDiscord | <krisppurg> In reply to @treeform "I got everything to": wait what what if flags in json were strings like `"512"` or `"256"` |
20:17:05 | FromDiscord | <treeform> then parse it as a string and cast? |
20:17:18 | FromDiscord | <krisppurg> in parseHook? |
20:18:03 | FromDiscord | <treeform> yeah, here you go: https://play.nim-lang.org/#ix=3IYR |
20:18:26 | * | noeontheend joined #nim |
20:18:33 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3IYT |
20:18:56 | FromDiscord | <treeform> basically says when you need a `set[UserFlags]`, parse it as a string first, then cast/parseInt it. |
20:19:01 | FromDiscord | <krisppurg> Well I want it as parseBiggestInt, but thanks I got the gist of it I think |
20:19:11 | FromDiscord | <treeform> yeah that would work |
20:20:30 | FromDiscord | <treeform> For json its very common to encode things in strings |
20:20:49 | FromDiscord | <treeform> timestamps, urls, addresses, emails etc.... |
20:21:04 | FromDiscord | <treeform> so you can parse then as a string, then convert to a richer type |
20:23:46 | FromDiscord | <krisppurg> interesting |
20:26:18 | FromDiscord | <hmmm> jsony is gud stuff treeformy, I was amazed when the first time I used it it worked at first try and been a fan ever since 💪 |
20:36:36 | * | rockcavera quit (Ping timeout: 256 seconds) |
21:03:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
21:07:55 | * | neurocyte0132889 quit (Read error: Connection reset by peer) |
21:11:29 | FromDiscord | <treeform> In reply to @hmmm "jsony is gud stuff": Thanks! |
21:22:44 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IZe |
21:23:15 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3IZe" => "https://play.nim-lang.org/#ix=3IZf" |
21:23:18 | * | rockcavera joined #nim |
21:23:18 | * | rockcavera quit (Changing host) |
21:23:18 | * | rockcavera joined #nim |
21:23:39 | FromDiscord | <konsumlamm> `B.T` doesn't really make sense |
21:24:03 | * | tiorock joined #nim |
21:24:03 | * | tiorock quit (Changing host) |
21:24:03 | * | tiorock joined #nim |
21:24:03 | * | rockcavera quit (Killed (strontium.libera.chat (Nickname regained by services))) |
21:24:03 | * | tiorock is now known as rockcavera |
21:24:08 | FromDiscord | <konsumlamm> the `type T` in the definition of `B` just means that `T` is the type implementing the concept |
21:24:38 | FromDiscord | <konsumlamm> it's not an associated type or anything like that |
21:24:39 | * | tiorock joined #nim |
21:24:39 | * | tiorock quit (Changing host) |
21:24:39 | * | tiorock joined #nim |
21:24:39 | * | rockcavera is now known as Guest2035 |
21:24:39 | * | Guest2035 quit (Killed (zirconium.libera.chat (Nickname regained by services))) |
21:24:39 | * | tiorock is now known as rockcavera |
21:25:09 | FromDiscord | <TryAngle> ah I see↵🤔 ↵do concepts have associated types somehow? |
21:27:43 | * | tiorock joined #nim |
21:27:43 | * | tiorock quit (Changing host) |
21:27:43 | * | tiorock joined #nim |
21:27:43 | * | rockcavera is now known as Guest2812 |
21:27:43 | * | tiorock is now known as rockcavera |
21:28:53 | * | rockcavera quit (Remote host closed the connection) |
21:31:01 | * | Guest2812 quit (Ping timeout: 240 seconds) |
21:32:40 | FromDiscord | <Elegantbeef> I dont know what an associated type is, but you can make concepts generic |
21:44:18 | * | rockcavera joined #nim |
21:44:18 | * | rockcavera quit (Changing host) |
21:44:18 | * | rockcavera joined #nim |
21:46:57 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IZl |
21:47:45 | FromDiscord | <KatrinaKitten> Everywhere I've thought of either doesn't register it as connected to `eof`, ignores it entirely (like this example), or errors. |
21:50:19 | FromDiscord | <KatrinaKitten> The only way I can get it to work is if I separate it into an `eofImpl` and document the `let eof = eofImpl` instead, which is okay I guess, but a little annoying. |
21:51:39 | FromDiscord | <Elegantbeef> Yea if you want docgen to work with it i dont think you can simply cause any usage of doc comments will be taken by the parser template |
21:52:00 | FromDiscord | <KatrinaKitten> Fair enough, `impl` it is. Not the end of the world haha |
21:52:28 | FromDiscord | <Elegantbeef> Nim doc comments are taken as AST which means templates just eat them |
21:53:59 | FromDiscord | <tandy> why cant u use waitFor with asyncjs? |
21:54:23 | * | sagax quit (Ping timeout: 250 seconds) |
21:55:48 | * | geek_ joined #nim |
22:00:53 | * | noeontheend joined #nim |
22:11:51 | FromDiscord | <Elegantbeef> [tandy](https://matrix.to/#/@tandy1000:matrix.org)\: waitfor isnt implemented in asyncjs afaik |
22:11:57 | FromDiscord | <Elegantbeef> Which is why |
22:12:05 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IZs |
22:12:55 | FromDiscord | <tandy> hmmm |
22:13:47 | FromDiscord | <tandy> is there any way to interact with results of async procs in a non-async proc/ |
22:28:05 | NimEventer | New thread by Sixte: F-bound polymorphism in C++ and(?) Nim , see https://forum.nim-lang.org/t/8728 |
23:08:28 | FromDiscord | <KatrinaKitten> Is there a way to mark a `{.deprecated.}` a symbol, but only outside of the module it's defined in? For example, for something used internally which is exposed "just in case", but shouldn't be used if it can be avoided. |
23:08:37 | FromDiscord | <KatrinaKitten> (edit) "`{.deprecated.}` a symbol," => " symbol `{.deprecated.}`," |
23:10:19 | FromDiscord | <Elegantbeef> You could make it a template that has a macro that emits a warning used from outside the module |
23:11:48 | FromDiscord | <KatrinaKitten> It's already a macro, so that's one thing down; how would I check whether it's in the same module? |
23:13:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IZB |
23:17:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IZC |
23:17:43 | FromDiscord | <Elegantbeef> Probably want another parameter for `warningMessage` |
23:18:17 | FromDiscord | <Elegantbeef> But that's the basic idea, what `someTemplate` does is what your macro needs to emit, and since your macro is emitting the code you might even be able to get the symbol and pass that node as a parameter to `warning` |
23:18:25 | FromDiscord | <KatrinaKitten> You know what I think I might do, I may just separate it into an internal and external version, only export the latter, and put the warning in there. |
23:18:41 | FromDiscord | <Elegantbeef> "Fuck you beef" 😛 |
23:18:58 | FromDiscord | <KatrinaKitten> That's a very cool solution, don't get me wrong XD Just seems like overkill |
23:20:59 | FromDiscord | <Elegantbeef> Oh i guess you can also use instantiation info |
23:23:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/mQb |
23:23:15 | FromDiscord | <KatrinaKitten> Aye, that seems like a good solution 🙂 |
23:23:22 | FromDiscord | <Elegantbeef> A much less overkill version 😀 |
23:25:59 | * | kayabaNerve joined #nim |
23:26:50 | FromDiscord | <Elegantbeef> Gotta give bad solutions then good solutions |
23:26:56 | FromDiscord | <Elegantbeef> That way people dont ever trust your code |
23:33:12 | FromDiscord | <inv> Question about arc: does it correct the `var a = b` with arc will reuse b ? |
23:33:29 | FromDiscord | <inv> (edit) "Question about arc:" => "Q:" |
23:34:11 | FromDiscord | <inv> In reply to @inv "Q: does it correct": if so, it is clear that fix is to use, for example deepCopy, but should I expect that code for refc does not work with arc in the case ? |
23:35:17 | * | geek_ quit (Ping timeout: 240 seconds) |
23:38:31 | FromDiscord | <Elegantbeef> Arc can do many optimizations so it's probably it reuses b |
23:41:05 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3IZH |
23:41:07 | FromDiscord | <Elegantbeef> probable even, Arc/Orc will behave differently to the other GCs |
23:41:37 | FromDiscord | <KatrinaKitten> (edit) "https://play.nim-lang.org/#ix=3IZH" => "https://play.nim-lang.org/#ix=3IZI" |
23:42:22 | FromDiscord | <Elegantbeef> Are you sure it doesnt work? |
23:42:35 | FromDiscord | <inv> In reply to @Elegantbeef "probable even, Arc/Orc will": Yep, it is clear that logic behind it is not the same, but is it ok that arc does not work on the same code like refc? |
23:42:44 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3IZL |
23:42:55 | FromDiscord | <Elegantbeef> Yes it's ok unless you rely on the GC's collection methods |
23:43:04 | FromDiscord | <Elegantbeef> Arc is deterministic so it's so much better for many things |
23:45:58 | FromDiscord | <KatrinaKitten> In reply to @Elegantbeef "Are you sure ": Yep, even in the playground example you sent it doesn't turn off the warning as expected. |
23:46:32 | FromDiscord | <KatrinaKitten> Er, nvm, that one is working I think? |
23:46:38 | FromDiscord | <inv> In reply to @Elegantbeef "Yes it's ok unless": sorry, did not get "it is ok that it does not work" or "it is ok that it works" 🙂 In my case it is simple var a = b and some code after it |
23:46:44 | FromDiscord | <inv> (edit) "In reply to @Elegantbeef "Yes it's ok unless": sorry, did not get "it is ok that it does not work" or "it is ok that it works" 🙂 In my case it is simple var a = b and some ... code" added "simple" |
23:47:10 | FromDiscord | <inv> (edit) "that" => "-" | "-it ... works"" added "should" |
23:47:15 | FromDiscord | <inv> (edit) "works"" => "work"" |
23:47:40 | FromDiscord | <KatrinaKitten> Got it! I needed to put them inside the proc where I was using the macro, rather than around the entire proc. Works like a charm now. |
23:48:22 | FromDiscord | <KatrinaKitten> Thanks again for the help, beef! |
23:51:47 | FromDiscord | <inv> @ElegantBeef I will prepare minimal example later, was trying to understand is it correct behaviour or not |
23:58:22 | * | Gustavo6046 quit (Remote host closed the connection) |