00:57:35 | FromDiscord | <brendo-m> sent a code paste, see https://play.nim-lang.org/#ix=4hQM |
00:57:54 | FromDiscord | <Elegantbeef> nimsuggest sometimes says false positives |
00:59:28 | FromDiscord | <Rika> maybe save again |
01:03:13 | FromDiscord | <brendo-m> I tried, it reliably flags this one as an error. I think it's probably this: https://github.com/nim-lang/nimsuggest/issues/127 |
01:19:39 | FromDiscord | <albassort> i want to do thiis |
01:19:56 | FromDiscord | <albassort> 1. Have a variable declared on compile↵2. Mutated on compile↵3. static in runtime |
01:20:19 | FromDiscord | <albassort> oh wait, const function |
01:20:24 | FromDiscord | <albassort> thanks me |
01:30:57 | * | rockcavera joined #nim |
01:45:21 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4hQP |
01:45:47 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4hQP" => "https://play.nim-lang.org/#ix=4hQQ" |
01:45:48 | FromDiscord | <Boston> if im receiving a UDP packet and i know which ip and port it's coming from but I do not know the size of the packet coming which proc do I use |
01:45:53 | FromDiscord | <Elegantbeef> No etra |
01:46:40 | FromDiscord | <Elegantbeef> Assuming `Stack` is an `array` or `seq` `a[b..c]` heap allocates a new sequence |
01:46:59 | FromDiscord | <Elegantbeef> `other.inner.toOpenArray(other.head, other.head + n)` would be more equivlent |
01:47:32 | FromDiscord | <etra> yes, `Stack.inner` is an array |
02:00:00 | FromDiscord | <etra> In reply to @Elegantbeef "`other.inner.toOpenArray(other.head, other.head + n": you're right, using this, it went from 0.749 to 0.401 |
02:00:02 | FromDiscord | <etra> nice! |
02:00:22 | FromDiscord | <etra> how would you know that'd be optimized that way? |
02:00:35 | FromDiscord | <Elegantbeef> cause `toOpenArray` doesnt copy |
02:00:48 | FromDiscord | <Elegantbeef> It's a 0 cost slice |
02:00:57 | FromDiscord | <etra> oh, ok, good to know |
02:01:34 | FromDiscord | <Elegantbeef> It's practically a safe `ptr, len` |
02:01:35 | FromDiscord | <EOF> quick question, if I have a sequence of sequences, how do I split on an empty sequence? |
02:02:19 | FromDiscord | <etra> In reply to @Elegantbeef "It's practically a safe": I have trouble assigning it into a variable, though, I can't do either `let`, `var` nor `const`, but I can use it as rvalue |
02:02:29 | FromDiscord | <Elegantbeef> Correct |
02:02:44 | FromDiscord | <etra> oh, that's a feature? |
02:02:48 | FromDiscord | <Elegantbeef> It must be consumed cause it's memory safe |
02:02:53 | FromDiscord | <Elegantbeef> Yes |
02:02:58 | FromDiscord | <Elegantbeef> Nim doesnt have a borrow checker |
02:03:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hQT |
02:03:29 | FromDiscord | <Elegantbeef> Which is a dangling pointer |
02:03:56 | FromDiscord | <Elegantbeef> It has an experimental view system which has a borrow checker not dissimilar to rust's |
02:04:04 | FromDiscord | <Elegantbeef> But it's very experimental |
02:06:08 | * | disso_peach joined #nim |
02:10:47 | FromDiscord | <etra> gotchu, I'm pretty happy with the results, one person did AOC in rust and optimized it a bit and got 370ms for a more heavy case, and with this solution, which is very readable, with types and all, it takes 402ms, nice! |
02:10:58 | FromDiscord | <Elegantbeef> What day is this? |
02:11:03 | FromDiscord | <etra> day 5 |
02:11:14 | FromDiscord | <Elegantbeef> You sure you mean `ms`? |
02:11:17 | FromDiscord | <etra> https://www.reddit.com/r/adventofcode/comments/zd1hqy/comment/iyzvsnp/?utm_source=reddit&utm_medium=web2x&context=3 |
02:11:29 | FromDiscord | <etra> yes, I'm using a more heavy input, 6mb |
02:11:36 | FromDiscord | <Elegantbeef> Ah |
02:13:32 | FromDiscord | <Elegantbeef> my solution would take eons to solve 😄 |
02:14:12 | FromDiscord | <Elegantbeef> Yep `Answer: Part1 - GATHERING Part2 - DEVSCHUUR | 24 seconds, 56 milliseconds, 971 microseconds, and 150 nanoseconds` 😄 |
02:14:34 | FromDiscord | <Elegantbeef> Turns out parsing and processing at the same time is slow |
02:15:55 | FromDiscord | <etra> haha, mine took a long time too, because I was using linked list as stack, lol, then I remembered that you can do a silly array for stacks, it's been ages since I implemented primitive types |
02:16:11 | FromDiscord | <Elegantbeef> Ugh |
02:16:12 | FromDiscord | <Elegantbeef> Your parsing! |
02:16:24 | FromDiscord | <etra> yeah, wildly unsafe, I know :laugh: |
02:16:33 | FromDiscord | <Elegantbeef> No not unsafe |
02:16:36 | FromDiscord | <Elegantbeef> It's fugly |
02:16:46 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/aoc2022/day5/day5.nim#L12 |
02:17:06 | FromDiscord | <etra> wtf what is that kind of magic |
02:17:12 | FromDiscord | <Elegantbeef> It's scanf |
02:17:32 | FromDiscord | <etra> damn, thanks for the tip |
02:18:10 | FromDiscord | <etra> I've been using nim for this week only and it's been pretty cool, and I'm in awe with the results for this problem |
02:18:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hQY |
02:20:46 | FromDiscord | <Elegantbeef> I still dont know if pop is slower than the allocation + reversing |
02:20:54 | FromDiscord | <Elegantbeef> also what're your compile flags? |
02:23:22 | FromDiscord | <etra> I was trusting god, `nim c -d:danger aoc5.nim` |
02:23:40 | FromDiscord | <Elegantbeef> also throw `--mm:arc` or `--mm:orc` if you want to live happier |
02:24:05 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4hQZ |
02:24:07 | FromDiscord | <Elegantbeef> and maybe `-d:lto` or `--passC:"-flto" --passL:"-flto"` if your C compiler dont like it |
02:24:08 | FromDiscord | <Elegantbeef> yes it does |
02:24:29 | FromDiscord | <etra> https://bpa.st/B5QQ |
02:24:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hR0 |
02:24:42 | FromDiscord | <etra> I tried `other.inner.toOpenArray(other.head, other.head + n - 1).reverse()` |
02:24:46 | FromDiscord | <etra> oh, it's reverseD |
02:26:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hR1 |
02:26:30 | FromDiscord | <Elegantbeef> Is faster or slower than your allocating/sorting |
02:27:40 | FromDiscord | <etra> oh, that's surprising, doing openarray.reversed is slower than doing a copy and reverse the slice |
02:29:47 | FromDiscord | <Elegantbeef> Finally a pointless addition `me: var Stack[T], other: var Stack[T]` can be written `me, other: var Stack[T]` 😄 |
02:30:47 | FromDiscord | <etra> oh right i forgot about that, in rust land we don't have that 😔 |
02:32:23 | FromDiscord | <Elegantbeef> Are you timing parsing aswell? |
02:32:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hR3 |
02:34:34 | FromDiscord | <Elegantbeef> \I'd argue the whole `split("\n\n")` is another issue if you are |
03:10:26 | FromDiscord | <voidwalker> I can't do `it = if it>0: 1 else: 0` inside the mapIt template ? |
03:11:17 | FromDiscord | <Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hRf |
03:11:20 | FromDiscord | <Elegantbeef> `applyIt` |
03:11:34 | FromDiscord | <Elegantbeef> `cast[cstring](myPtrChar)` |
03:11:39 | FromDiscord | <Gumbercules> thanks |
03:12:05 | FromDiscord | <Elegantbeef> Dont know if `cstring(myPtrChar)` works |
03:12:22 | FromDiscord | <Gumbercules> yeah that's what I tried first, still wasn't happy |
03:12:31 | FromDiscord | <Gumbercules> the cast worked |
04:11:35 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hRr |
04:11:48 | FromDiscord | <Tuatarian> the part the compiler dislikes here is the fact that the case statement doesn't have a known type at comptime right? |
04:12:05 | FromDiscord | <Tuatarian> one branch is a `HvNum` and the other an `HvExpr` |
04:12:26 | FromDiscord | <Tuatarian> I didn't quite provide enough context I now realize, but the first part of the cast statement returns a `HvNum` and the second `HvExpr`s |
04:12:42 | FromDiscord | <Elegantbeef> The issue is that the return type hast to be homgenous |
04:12:43 | FromDiscord | <Elegantbeef> has\ |
04:12:59 | FromDiscord | <Elegantbeef> You have a generic type class as a return, that's still only a single possible value for the entire expression |
04:13:02 | * | vicecea quit (Remote host closed the connection) |
04:13:02 | FromDiscord | <Tuatarian> yeah so we can't have different things in different parts of the case statements |
04:13:10 | FromDiscord | <Elegantbeef> Of course not |
04:13:23 | FromDiscord | <Tuatarian> ok just confirming |
04:13:36 | FromDiscord | <Tuatarian> trying to evade static typing is really not fun |
04:13:45 | FromDiscord | <Elegantbeef> Especially since it's impossible to |
04:14:00 | FromDiscord | <Tuatarian> you can definitely violate the spirit of it |
04:14:12 | FromDiscord | <Tuatarian> but it's not particularly easy or clean |
04:14:28 | FromDiscord | <Tuatarian> (understandably, but I definitely want to here, it would make this a thousand times easier to do ) |
04:14:31 | FromDiscord | <jtv> Well, you can check out the Any type if you really are carrying around enough context dynamically |
04:14:47 | FromDiscord | <Tuatarian> would that solve this problem at all? |
04:14:49 | FromDiscord | <Elegantbeef> We dont talk about RTTI 😄 |
04:15:06 | FromDiscord | <Elegantbeef> Yea you'd be generating everything at runtime |
04:15:14 | FromDiscord | <Elegantbeef> It's not easy nor elegant, but it's doable |
04:15:29 | FromDiscord | <jtv> Well, it's useful enough in small doses for writing other compilers where I'm carrying around my own type info |
04:16:04 | FromDiscord | <Elegantbeef> I've personally never used `std/typeinfo` it's just much nicer to have code evaluated statically to do the reflection |
04:16:13 | FromDiscord | <Tuatarian> I'm writing an interpreter here |
04:16:23 | FromDiscord | <Tuatarian> yes but the problem is that none of my type info is known till runtime |
04:16:45 | FromDiscord | <Elegantbeef> Well the problem is you're attempting to minimise code that cannot be minimised |
04:17:08 | FromDiscord | <Tuatarian> I'd imagine it should be possible, but probably not in a particularly pleasant |
04:17:11 | FromDiscord | <Tuatarian> pleasant way |
04:22:46 | * | rockcavera quit (Remote host closed the connection) |
04:44:27 | * | ltriant quit (Changing host) |
04:44:27 | * | ltriant joined #nim |
05:00:55 | FromDiscord | <voidwalker> In reply to @Elegantbeef "`applyIt`": was this reply for me ? |
05:02:38 | FromDiscord | <voidwalker> I want to run mapIt on a sequence, but ommit some elements if some condition is not satisfied (leave it as is). Tried it like `it = if it.scheme.startsWith("http")... else: it` but it seems it is outside the template's scope if I write it like that. Alternatives/ |
05:02:42 | FromDiscord | <voidwalker> (edit) "Alternatives/" => "Alternatives?" |
05:04:05 | FromDiscord | <Elegantbeef> I dont do FP so i say use a loop |
05:05:14 | FromDiscord | <Rika> Use the filter one too then |
05:05:38 | FromDiscord | <Rika> Similarly named |
05:08:23 | FromDiscord | <voidwalker> filterIt.. filters. returns same elements as in the original seq, if they meet the condition |
05:09:37 | FromDiscord | <Rika> You filter then you map |
05:12:40 | FromDiscord | <voidwalker> but filter would change the length of the sequence to map |
05:13:44 | FromDiscord | <Rika> I misunderstood |
05:13:52 | FromDiscord | <Rika> Your current sample should work as is |
05:14:09 | FromDiscord | <Rika> Actually no |
05:14:20 | FromDiscord | <Rika> Remove the it = then it should work |
05:14:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hRC |
05:14:27 | FromDiscord | <voidwalker> ` Error: undeclared identifier: 'it'` |
05:15:41 | FromDiscord | <Rika> In reply to @Rika "Remove the it =": Yeah this |
05:16:23 | FromDiscord | <Rika> The expression return value is what is used for map, the it value is just a read value |
05:18:29 | FromDiscord | <voidwalker> hm you are right, how could I have missed that.. bonobo |
06:12:54 | * | arkurious quit (Quit: Leaving) |
06:33:28 | * | pbotfullerton quit (Quit: WeeChat 3.7.1) |
06:52:04 | * | systemdsucks quit (Ping timeout: 248 seconds) |
07:02:53 | * | systemdsucks joined #nim |
07:32:05 | * | kenran joined #nim |
07:34:22 | * | kenran quit (Remote host closed the connection) |
07:43:09 | * | PMunch joined #nim |
07:56:17 | * | droidrage joined #nim |
08:29:38 | * | Vladar joined #nim |
08:44:42 | * | pro joined #nim |
08:47:05 | * | pro left #nim (#nim) |
09:35:34 | * | vicecea joined #nim |
10:32:19 | * | Guest82 joined #nim |
10:33:01 | * | Guest82 left #nim (#nim) |
12:05:49 | * | ltriant quit (Ping timeout: 260 seconds) |
12:06:20 | FromDiscord | <b1rdf00d> does nim have an equivalent (to c++) of returning a const reference? Or is making a copy the better appraoch? |
12:10:02 | FromDiscord | <b1rdf00d> sent a code paste, see https://play.nim-lang.org/#ix=4hSP |
12:10:48 | FromDiscord | <Rika> it is not a reference, you're returning a value |
12:11:00 | FromDiscord | <Rika> mutability is not inherent to the type in nim |
12:11:21 | FromDiscord | <Rika> only outside of views, i guess |
12:11:33 | FromDiscord | <Rika> (edit) "only outside of views," => "(if it's not a view," | "guess" => "guess)" |
12:12:17 | FromDiscord | <b1rdf00d> sent a code paste, see https://play.nim-lang.org/#ix=4hSQ |
12:12:50 | FromDiscord | <b1rdf00d> (trying to understand your second point) you need to specify mutability, it's not encoded in the type? |
12:13:54 | FromDiscord | <b1rdf00d> is it always a value type, the compiler won't make the decision to use a reference? |
12:14:44 | FromDiscord | <Rika> In reply to @b1rdf00d "(trying to understand your": the type cannot transmit mutability, so "var seq" as a return type doesnt make sense |
12:14:58 | FromDiscord | <Rika> mutability is up to holders like parameters or arguments |
12:15:08 | FromDiscord | <Rika> i mean, parameters or variables |
12:16:09 | FromDiscord | <Rika> In reply to @b1rdf00d "is it always a": you require explicit `ref` if you want to ("actually always") return a reference, and mutability of such returned reference is not up to the return type or the function |
12:21:44 | FromDiscord | <b1rdf00d> okay cool, thanks Rika 🙂 |
12:22:20 | FromDiscord | <Rika> In reply to @b1rdf00d "yes like this (not": in this case, there's a copy |
12:23:17 | FromDiscord | <Hamid_Bluri> Hey, is there any library for `YAML` like `std/json` that parses the string to YAML nodes? |
12:23:29 | FromDiscord | <Hamid_Bluri> seems like https://nimble.directory/pkg/yaml is for aliens |
12:29:37 | FromDiscord | <Rika> That package has a node style version for YAML too |
12:35:46 | FromDiscord | <Hamid_Bluri> In reply to @Rika "That package has a": it's not documented |
12:36:24 | FromDiscord | <Hamid_Bluri> found it thanks |
12:37:23 | FromDiscord | <Rika> its really hidden |
12:37:32 | FromDiscord | <Rika> i was troubleshooting smth sorry |
13:16:04 | * | ltriant joined #nim |
13:22:15 | * | ltriant quit (Ping timeout: 268 seconds) |
13:28:05 | FromDiscord | <Goat> sent a code paste, see https://play.nim-lang.org/#ix=4hT5 |
13:30:10 | * | rockcavera joined #nim |
13:33:48 | * | jmdaemon quit (Ping timeout: 256 seconds) |
13:48:19 | FromDiscord | <hmmm> broskis how do I check if something is of type int |
13:48:55 | FromDiscord | <hmmm> hmm maybe I should just try / except parseint |
14:03:59 | FromDiscord | <ChocolettePalette> typeof↵(@hmmm) |
14:04:20 | FromDiscord | <hmmm> I tried, I got a weird typedesc error bro |
14:04:42 | FromDiscord | <ChocolettePalette> Nvm, this is the thinghttps://nim-lang.org/docs/typeinfo.html |
14:08:54 | * | TakinOver quit (Ping timeout: 260 seconds) |
14:11:31 | * | TakinOver joined #nim |
14:19:11 | FromDiscord | <demotomohiro> !eval echo 1 is int, 1.0 is int |
14:19:16 | NimBot | truefalse |
14:22:55 | FromDiscord | <rutenl> hope this is the right channel, I'm trying to figure out if I'm doing something wrong in this jetbrains nim plugin run/debug configuration. It gives an error at the bottom about the working directory but I did specify it. Should i make an issue for this on the plugin issue tracker or am I doing it wrong https://media.discordapp.net/attachments/371759389889003532/1049692416044699748/image.png |
14:26:07 | FromDiscord | <Yardanico> In reply to @ChocolettePalette "Nvm, this is the": this is not the thing |
14:26:09 | FromDiscord | <starch> what does 'git' not in PATH mean |
14:26:15 | FromDiscord | <Yardanico> you need to install git |
14:26:19 | FromDiscord | <starch> how |
14:26:24 | FromDiscord | <starch> nimble install git |
14:26:26 | FromDiscord | <Yardanico> In reply to @ChocolettePalette "Nvm, this is the": typeinfo is only for runtime type info with RTTI |
14:26:36 | FromDiscord | <Yardanico> In reply to @starch "nimble install git": install it via your system package manager if you're on linux |
14:26:41 | FromDiscord | <Yardanico> otherwise download git for windows if you're on windows |
14:26:53 | FromDiscord | <Yardanico> https://git-scm.com/book/en/v2/Getting-Started-Installing-Git |
14:26:54 | FromDiscord | <starch> alright |
14:27:58 | FromDiscord | <demotomohiro> Or install package manager for windows like scoop or msys2 and run `scoop install git` or `pacman -S git`. |
14:33:44 | FromDiscord | <rutenl> anyone using the jetbrains nim plugin here? does the run/debug config work? |
14:33:45 | FromDiscord | <starch> i installed git but what do i add in the PATH |
14:34:40 | FromDiscord | <Yardanico> it should've added itself automatically |
14:34:45 | FromDiscord | <hmmm> In reply to @demotomohiro "!eval echo 1 is": SO CONFY! ty demo 💓 |
14:34:52 | FromDiscord | <Yardanico> In reply to @hmmm "SO CONFY! ty demo": that won't work for what you want though |
14:34:57 | FromDiscord | <Yardanico> I assume you want to parse strings at runtime |
14:34:57 | FromDiscord | <hmmm> wot |
14:35:06 | FromDiscord | <Yardanico> then you do need to try parseInt except ValueError |
14:35:08 | FromDiscord | <Yardanico> or use parseutils |
14:35:42 | FromDiscord | <starch> In reply to @Yardanico "it should've added itself": oh nvm it worked after i restarted the thing |
14:35:44 | FromDiscord | <hmmm> I want to check if something after a string is an int, so "examplestring456" should check true |
14:35:45 | FromDiscord | <starch> thanku |
14:35:54 | FromDiscord | <Yardanico> In reply to @hmmm "I want to check": yes, so the best way is parseutils |
14:36:02 | FromDiscord | <Yardanico> then you can also use parseInt from strutils with try/except ValueError |
14:36:03 | FromDiscord | <hmmm> so I split the string and check the second part I guess |
14:36:06 | FromDiscord | <Yardanico> `is int` won't help you there at all |
14:36:10 | FromDiscord | <hmmm> ah ok ok |
14:36:12 | FromDiscord | <Yardanico> because types don't exist at runtime |
14:36:17 | FromDiscord | <Yardanico> In reply to @hmmm "ah ok ok": or strscans actually |
14:36:26 | FromDiscord | <Yardanico> https://nim-lang.org/docs/strscans.html |
14:36:30 | FromDiscord | <Yardanico> if your examplestring is static |
14:36:40 | FromDiscord | <hmmm> no it's not |
14:37:09 | FromDiscord | <Yardanico> and how do you get where the string ends? |
14:37:17 | FromDiscord | <Yardanico> you find the first digit? |
14:37:35 | FromDiscord | <hmmm> I know that the identifier is exactly examplestring |
14:37:48 | FromDiscord | <Yardanico> oh, so just use strscans if you know `examplestring` at compile-time |
14:37:54 | FromDiscord | <hmmm> ah ok |
14:38:14 | FromDiscord | <hmmm> I'll check it, ty yardy |
14:38:44 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4hTu |
14:39:03 | FromDiscord | <hmmm> CONFY |
14:39:27 | FromDiscord | <Yardanico> n? |
14:39:33 | FromDiscord | <hmmm> M COMFY |
14:40:32 | arkanoid | I have question about stack+recursion+arc. If I have a recursive function that calls itself as last statement, will all the stack variables created in the above scope be freed before entering the new recursion? |
14:41:22 | FromDiscord | <Yardanico> i don't know, but you can always write a custom destructor and see if it gets executed |
14:41:34 | FromDiscord | <Yardanico> or try `--expandArc:yourprocname` to see how the transformed code looks like (with all destructors injected) |
14:41:52 | arkanoid | good idea |
14:47:17 | FromDiscord | <demotomohiro> How about to make a scope to make sure variables in stack are freed before entering the new recursion?: |
14:47:59 | FromDiscord | <Phil> In reply to @rutenl "anyone using the jetbrains": I am, but I'm currently at work and I use it with intellij ^^' |
14:48:57 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hTz |
14:49:39 | FromDiscord | <Phil> I'd need to check on my private hardware what I do there. But generally I'd simply use nimble tasks for everything.↵I'd argue you may want some compiler parameters in there such as -d:release for when you compile actual release binaries because those are around 10x faster than binaries not compiled with it |
14:49:45 | FromDiscord | <demotomohiro> But stacks used to pass parameters to new recursion cannot be freed. |
14:50:09 | FromDiscord | <rutenl> In reply to @Isofruit "I'd need to check": oh so you dont use the plugin's built in run config? |
14:50:14 | FromDiscord | <Phil> Depending on what exactly you want to do/use other parameters may also be helpful, such as turning of/on specific warnings |
14:50:42 | FromDiscord | <Phil> In reply to @rutenl "oh so you dont": I prefer CLI generally, I use the nim plugin mostly for the better auto-completion |
14:50:56 | FromDiscord | <Phil> Or rather, I prefer CLI with nim |
14:51:06 | FromDiscord | <rutenl> In reply to @Isofruit "I prefer CLI generally,": i'll have to do that as well for now :p thx for replying |
14:51:08 | FromDiscord | <Phil> I can not be bothered to learn that stuff for java so I use proper run configs there |
14:51:14 | arkanoid | not sure if I'm reading the result of this experiment correctly, but it seems to me that vars are not freed before the recursive calls: https://play.nim-lang.org/#ix=4hTA |
14:51:40 | FromDiscord | <Yardanico> what do you expect to be freed here? |
14:51:48 | FromDiscord | <Phil> In reply to @rutenl "i'll have to do": Happy to help.↵Another side benefit of using nimble tasks is that you can do a lot more and they integrate nicely with, e.g. github CI pipelines |
14:51:55 | FromDiscord | <Yardanico> normal stack variables like ints get thrown out automatically, they don't need destructors |
14:52:01 | FromDiscord | <Yardanico> since they're value types without a destructor |
14:53:03 | FromDiscord | <starch> where can i get the nim ide |
14:53:05 | FromDiscord | <Phil> See for example, norm or prologue packages, those automatically run nimble tasks in their github CI pipelines |
14:53:13 | FromDiscord | <Phil> nim ide? |
14:53:18 | arkanoid | Yardanico: when are they "thrown out"? consider a very very deep recursion |
14:53:20 | FromDiscord | <starch> yah |
14:53:27 | FromDiscord | <Phil> There's VSCode with a nim plugin and Intellij with a nim plugin |
14:53:33 | FromDiscord | <Yardanico> In reply to @arkanoid "<@177365113899057152>: when are they": I mean that's not specific to Nim at all, it would work just like it does in C |
14:53:34 | FromDiscord | <starch> nono |
14:53:37 | FromDiscord | <starch> nim ide |
14:53:43 | FromDiscord | <starch> or editor |
14:53:43 | FromDiscord | <Phil> Those are your main options, though naturally vim/neovim with nimlsp exist |
14:53:52 | FromDiscord | <Yardanico> In reply to @starch "or editor": https://github.com/fox0430/moe |
14:53:57 | FromDiscord | <starch> nimedit was the thing i saw |
14:54:03 | FromDiscord | <starch> but it doesnt work |
14:54:04 | FromDiscord | <Yardanico> it was a very old experiment |
14:54:06 | arkanoid | Yardanico: sure, I'm not blaming Nim at all, it's just I don't even know how it would work in C :P |
14:55:08 | arkanoid | Yardanico: also, in my example `v` is a string. I know it has value semantics, but shouldn't it be freed anyway? |
14:55:53 | FromDiscord | <Yardanico> no, because the proc doesn't own it |
14:56:04 | FromDiscord | <Yardanico> and actually just a literal string doesn't even need a destructor with arc/orc iirc |
14:56:36 | FromDiscord | <Yardanico> even if it's in a separate variable, as long as you don't mutate it |
14:56:47 | FromDiscord | <Yardanico> because string literals with arc/orc are CoW |
14:56:57 | * | pro joined #nim |
14:58:02 | FromDiscord | <Yardanico> try |
14:58:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4hTF |
14:58:15 | FromDiscord | <Yardanico> and then |
14:58:21 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4hTG |
14:58:24 | FromDiscord | <Yardanico> and check expandArc for main in both of those |
14:58:30 | FromDiscord | <Yardanico> in the former it won't destroy v, in the latter it will |
15:02:39 | * | PMunch quit (Quit: Leaving) |
15:03:54 | FromDiscord | <demotomohiro> Variables passed to a proc are freed only when the proc is returned. So stacks and heaps used for `a&a` should increase everytime you call the recursive proc. |
15:07:20 | arkanoid | Yardanico: you're right, but this doesn't answer the question about recursion, let me move it inside the recursion |
15:10:14 | * | pro left #nim (#nim) |
15:10:33 | arkanoid | https://play.nim-lang.org/#ix=4hTQ if I move bif outside the block, it would be freed only after recursion, so making a block scope is essential |
15:10:45 | arkanoid | I would really like to read something about how to make recursion fast |
15:11:08 | arkanoid | or have general rules: for example, should I try to have as few as possible arguments? |
15:19:32 | FromDiscord | <starch> In reply to @Yardanico "https://github.com/fox0430/moe": how do i open it |
15:20:45 | FromDiscord | <demotomohiro> @Arkanoid How about to use loop instead of recursion? |
15:21:45 | FromDiscord | <demotomohiro> If possible |
15:28:08 | arkanoid | demotomohiro: I'd like to, but the algorithm does naturally fit into a recursion (I'm dealing with a random-walk like problem, basically) |
15:28:53 | arkanoid | basically a point generates N new points according to some rules, then each new points generates new point according to same rules, and so on |
15:29:17 | arkanoid | it's a O(X^N) problem |
15:29:40 | arkanoid | that's why I need very fast recursion and max speed |
15:34:49 | * | Phytolizer joined #nim |
15:39:40 | * | ehmry joined #nim |
15:39:46 | FromDiscord | <EchoPouet> In reply to @starch "how do i open": I use VScode with this extension -> https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode |
15:45:50 | Phytolizer | any reason deque doesn't support [] with HSlice? would it be a good idea to PR? |
15:47:47 | FromDiscord | <starch> In reply to @PotAuFeu "I use VSCode with": how do i use it on atom |
15:47:58 | FromDiscord | <starch> (please dont make fun of me for using atom) |
15:53:09 | FromDiscord | <EchoPouet> I don't know sorry |
15:53:10 | FromDiscord | <demotomohiro> @Arkanoid↵You might be able to write such a code in loop using seq as stack:↵https://play.nim-lang.org/#ix=4hTX |
15:54:35 | FromDiscord | <EchoPouet> (edit) "sorry" => "sorry, maybe with OpenVX -> https://open-vsx.org/extension/nimsaem/nimvscode" |
15:54:47 | FromDiscord | <EchoPouet> (edit) "OpenVX" => "OpenVSX" |
15:59:00 | arkanoid | demotomohiro, kinda yes, but I have to drop some useful domain-specific metadata that recurision was generating, but yes I think I can manage it |
16:05:13 | * | Phytolizer quit (Ping timeout: 260 seconds) |
16:14:28 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
16:15:30 | FromDiscord | <deeuu> Hey,↵when using `nimble`, is it possible to specify the compiler path of the mingw toolchain? I'm building from osx and mingw is under my local user's homebrew directory |
16:15:49 | * | ehmry joined #nim |
16:21:52 | FromDiscord | <starch> The term 'nim' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, ↵verify that the path is correct and try again. |
16:22:11 | * | Phytolizer joined #nim |
16:25:43 | FromDiscord | <demotomohiro> try `echo %PATH%` to see path env var. |
16:25:53 | FromDiscord | <demotomohiro> Or `echo $PATH` on linux. |
16:27:35 | FromDiscord | <demotomohiro> Or your anti-virus software blocks or removed nim. |
16:31:19 | FromDiscord | <starch> In reply to @demotomohiro "Or your anti-virus software": nvm i just had to restard vcs |
16:31:22 | FromDiscord | <starch> now it shows |
16:31:28 | FromDiscord | <starch> Error: undeclared identifier: 'nimble' |
16:31:38 | FromDiscord | <starch> (edit) "restard" => "restart" |
16:32:55 | FromDiscord | <demotomohiro> nimble and nim should be in same directly. |
16:33:41 | nisstyre | is there a library for querying parsed html from htmlparser using XPath or something similar? |
16:33:46 | nisstyre | couldn't find anything from googling |
16:33:54 | FromDiscord | <huantian> I know there's one for CSS selectors |
16:34:02 | FromDiscord | <huantian> but I couldn't find one for XPath last I checked |
16:34:11 | nisstyre | maybe cssselect will be enough |
16:34:31 | nisstyre | I understand xpath is really hard to fully implement |
16:35:00 | nisstyre | or maybe I could just use selenium or some JS engine |
16:35:19 | FromDiscord | <starch> In reply to @demotomohiro "nimble and nim should": nvm another stupid thing i didnt see |
16:35:23 | FromDiscord | <starch> sorry |
16:35:24 | FromDiscord | <starch> it works now |
16:37:22 | arkanoid | demotomohiro: why did you use "while stack.len < 1000"? |
16:37:40 | arkanoid | sorry, wrong paste. Real is "while stack.len != 0:" |
16:40:34 | arkanoid | nevermind, got it |
16:58:00 | FromDiscord | <starch> how do i run nim files with python |
17:00:15 | FromDiscord | <Phil> Nimpy |
17:00:41 | FromDiscord | <Phil> The readme of that projects repo should have enough info to get you started, it's fairly simple |
17:01:03 | FromDiscord | <demotomohiro> There are also:↵https://github.com/treeform/genny↵https://github.com/Pebaz/nimporter |
17:01:09 | FromDiscord | <Phil> That is, if you want to use Nim as a python lib |
17:06:26 | * | Phytolizer quit (Remote host closed the connection) |
17:06:48 | * | Phytolizer joined #nim |
17:11:53 | * | ltriant joined #nim |
17:12:14 | NimEventer | New post on r/nim by BigPotato2: Overloading equality operator with macro?, see https://reddit.com/r/nim/comments/zec57i/overloading_equality_operator_with_macro/ |
17:17:00 | * | ltriant quit (Ping timeout: 264 seconds) |
17:25:29 | FromDiscord | <auxym> In reply to @starch "how do i run": `subprocess.run("yourNimExec.exe")` |
17:43:01 | * | PMunch joined #nim |
17:44:44 | FromDiscord | <emanresu3> Can I get information of a proc signature? Like the type of the the parameters and return? |
17:45:17 | PMunch | Yes |
17:45:35 | FromDiscord | <emanresu3> how? |
17:45:53 | PMunch | std/macros getTypeImpl I believe it is |
17:47:00 | PMunch | By the way, getting ready for day 6 AoC streaming. I don't have a lot of time today so it'll be a bit of a whirlwind |
17:47:04 | PMunch | Hopefully it's an easy one |
17:51:04 | FromDiscord | <emanresu3> what are you streaming? |
17:53:20 | Phytolizer | advent of code is what AoC stands for |
17:54:00 | FromDiscord | <Phil> Is such a thing as module wide concepts feasible? Essentially defining what procedures a given module after code generation must provide and maybe arbitrary conditions they must fulfill.↵↵I will admit this is basically the idea of java interfaces in order to be able to exchange modules seamlessly with one another |
17:54:30 | FromDiscord | <Phil> Maybe even write unit tests against the hypothetical procs of the module concept |
17:55:37 | FromDiscord | <auxym> In reply to @PMunch "Hopefully it's an easy": it is (IMO) |
17:56:47 | FromDiscord | <Phil> I'm also wondering about general testing of nim code, because things start to get tricky when you just want to test the code of one proc, but that proc calls another proc of another module, meaning you now need to take that logic in there into account as well etc. That makes unit testing pretty difficult, kinda leaving you with only integration tests |
17:59:38 | FromDiscord | <auxym> "write tests, not too many, mostly integration" 😉 (can't remember where the quote is from however) |
18:01:16 | FromDiscord | <Phil> So the general idea for testing in Oop is integration or bust? |
18:01:31 | FromDiscord | <Phil> Procedural, not oop |
18:01:43 | FromDiscord | <Phil> Damn my brain, semi distracted by sports |
18:05:35 | FromDiscord | <Phil> Just basically how to isolate procedures is the core question for me I guess |
18:06:46 | FromDiscord | <Phil> Since e.g. in webdev you will test a controller proc at some point and if you can't isolate it you must integration test essentially... Or are so close you may as well go the extra step to boot up a server and actually integration test instead of just calling the proc |
18:09:13 | FromDiscord | <QuiteQuietQ> sent a code paste, see https://play.nim-lang.org/#ix=4hUu |
18:09:50 | FromDiscord | <QuiteQuietQ> without using `HashSet` |
18:11:24 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4hUv |
18:11:51 | FromDiscord | <demotomohiro> In reply to @QuiteQuietQ "is there a better": I think you can use this std proc:https://nim-lang.org/docs/setutils.html#toSet.t,untyped |
18:12:26 | FromDiscord | <huantian> oh that's a thing |
18:12:30 | * | Vladar quit (Remote host closed the connection) |
18:12:30 | FromDiscord | <huantian> yeah that probably works the best |
18:14:49 | FromDiscord | <QuiteQuietQ> In reply to @demotomohiro "I think you can": damn, i missed this, thanks! |
18:15:32 | FromDiscord | <Phil> @treeform what's your stance for testing in procedural programming?↵Integration tests and nothing else? |
18:16:00 | * | ehmry quit (Ping timeout: 256 seconds) |
18:19:47 | PMunch | Alright, stream is up: https://www.twitch.tv/pmunche https://www.youtube.com/watch?v=DM0TgDOGTpo |
18:20:38 | FromDiscord | <QuiteQuietQ> In reply to @huantian "I'd do it imperatively:": how does the `result` work? is it a builtin thing that can be used in every proc as some kind of return generic? |
18:21:08 | * | Phytolizer quit (Ping timeout: 260 seconds) |
18:24:26 | FromDiscord | <auxym> yes, in fact it's the idiomatic way to return in nim |
18:26:15 | * | ehmry joined #nim |
18:26:39 | FromDiscord | <auxym> https://nim-lang.org/docs/nep1.html#introduction-coding-conventions |
18:28:39 | FromDiscord | <treeform> In reply to @Isofruit "<@107140179025735680> what's your stance": I am not a fan of TDD or test everything, test small functions, test every function, because 1. its really boring to write tests. 2. its really hard to change anything because you have to rewrite the boring tests. |
18:29:02 | FromDiscord | <treeform> But I am huge fan of testing the public interface of things. To make sure new things did not change functionality. Most of my repos have some thing like that. |
18:29:49 | FromDiscord | <treeform> Test has helped me catch countless bugs |
18:29:55 | FromDiscord | <treeform> (edit) "Test" => "Testing" |
18:30:11 | FromDiscord | <treeform> Testing is a tool, it helps in some areas and does not help in others |
18:30:22 | FromDiscord | <treeform> like testing UI is really hard and kind of pointless |
18:30:32 | FromDiscord | <treeform> while testing compilers is a hard requirement |
18:30:51 | FromDiscord | <QuiteQuietQ> In reply to @auxym "yes, in fact it's": cool! thanks for pointing me to the docs↵so I don't even have to declare `result`? it is just there and i can just specify the type by initializing it |
18:31:11 | FromDiscord | <arkanoid> The test everything thing popped up with dynamic languages, and it makes sense |
18:31:29 | FromDiscord | <treeform> yes dynamic languages require more testing |
18:31:37 | FromDiscord | <treeform> static typing is almost kind of a test |
18:31:41 | FromDiscord | <arkanoid> Lots of it |
18:32:24 | FromDiscord | <treeform> I am huge fan of gold master testing see: https://en.wikipedia.org/wiki/Characterization_test |
18:32:34 | FromDiscord | <treeform> take output your program produced and save it as a test |
18:32:45 | FromDiscord | <treeform> when output differs figure out why |
18:32:53 | FromDiscord | <treeform> and accept new output or change your code |
18:34:40 | FromDiscord | <arkanoid> Does this have a name? I basically have been doing this forever |
18:34:53 | FromDiscord | <treeform> i called it print testing |
18:34:57 | FromDiscord | <treeform> or output testing for a while |
18:35:10 | FromDiscord | <auxym> In reply to @QuiteQuietQ "cool! thanks for pointing": yes, it's a variably automatically created in each proc, with the proc's return type. It is also automatically returned when the proc exits, unless you used `return` |
18:35:28 | FromDiscord | <arkanoid> I call it\: finally it works let's save this |
18:35:49 | FromDiscord | <treeform> ... so it never changes again! |
18:36:07 | FromDiscord | <treeform> I am a huge fan of this type of test |
18:36:15 | FromDiscord | <treeform> because its easy |
18:36:22 | FromDiscord | <treeform> your program generates it |
18:36:40 | FromDiscord | <arkanoid> Exactly |
18:39:23 | FromDiscord | <huantian> In reply to @auxym "yes, it's a variably": it's also used if you use `return` but don't provide a value to `return` |
18:39:39 | FromDiscord | <arkanoid> Actually, it would be nice to have a lib that takes an input, a function, and writes a test to match output |
18:43:55 | FromDiscord | <Phil> In reply to @treeform "your program generates it": But also if you overlooked unintended buggy behaviour you're now declaring it intended behaviour, hmm |
18:44:13 | FromDiscord | <Phil> I'll need to meditate about that one |
18:44:32 | FromDiscord | <Phil> I do like tests as a definition of how my system should behave |
18:44:51 | FromDiscord | <Phil> Unit Vs integration tests just defines how granular you go |
18:48:42 | FromDiscord | <Phil> The nice thing with unit testing is that you have a much more detailed explanation on how the system should work.↵The drawback is that it can lead to specifying meaningless behaviour that can not occur during actual usage, providing no benefit but still slowing down development |
18:49:05 | FromDiscord | <Phil> (edit) "work.↵The" => "work in case something breaks.↵↵The" |
18:49:37 | FromDiscord | <arkanoid> Phil, to solve that, you end up on the other edge, where you find contracts |
18:58:54 | FromDiscord | <Phil> In reply to @arkanoid "Phil, to solve that,": That doesn't ring a bell I don't think.↵Like, I know concepts related to that, like that names are contracts as to what's inside of them and that tests are contracts as to how a piece of code must behave to fulfill the task assigned, but this feels like you mean a bigger idea |
19:01:53 | * | PMunch quit (Quit: leaving) |
19:05:42 | FromDiscord | <Phil> I feel like we should have some kind of helper lib for prologue testing either way, at the very least so I can just call "start up my server" and fire http client calls from there... Well I guess that's my next package then |
19:06:01 | FromDiscord | <Phil> (edit) "there..." => "there instead of having to do some semi-complicated setup..." |
19:08:47 | * | arkurious joined #nim |
19:14:18 | FromDiscord | <Phil> In reply to @arkanoid "Phil, to solve that,": Is this the concept?↵https://pactflow.io/what-is-contract-testing-page/↵That kind of matches my previous understanding of BDD / the general purpose that I understood to be behind integration testing |
19:14:20 | FromDiscord | <jmgomez> In reply to @treeform "static typing is almost": plus in langs like Nim you can compile time assert I would add |
19:14:44 | FromDiscord | <Phil> In reply to @jmgomez "plus in langs like": God I love the fact that is possible, I make copious amounts of usage of that feature |
19:16:23 | FromDiscord | <Phil> I love being able to make the compiler scream at you if you use my lib code wrong |
19:16:39 | FromDiscord | <Phil> ~~Definitely a healthy dev attitude~~ |
19:38:08 | arkanoid | is an inline iterator == for loop performance wise? |
19:43:30 | FromDiscord | <Cheesy Brik> If I wanna build a data type similar to a Python List (mostly for the challenge not necessarily for a use case) should I use a sequence of pointers or is there a faster way of doing that? |
19:43:55 | FromDiscord | <Phil> In reply to @Cheesy Brik "If I wanna build": List as in linked list? |
19:44:54 | FromDiscord | <Phil> I'm not quite seeing what aspects of a python list is missing for you in just a seq, thus my question |
19:48:09 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "I'm not *quite* seeing": Really it’s just the multiple type functionality |
19:55:57 | FromDiscord | <Phil> So like, a list that can contain multiple types at once?↵That...errr... I don't actually see that being possible outside of using an object variant or JSON, which both feel like they kinda render the point moot, specifically JSON would likely be slow |
19:57:04 | FromDiscord | <Phil> Basically you'd need to store all data as the same type so you don't violate the rule of one-seq one-type.↵Then you'd need to define procs to convert to/from whatever you're storing. |
20:04:48 | * | kenran joined #nim |
20:04:56 | * | kenran quit (Remote host closed the connection) |
20:05:23 | FromDiscord | <Horizon [She/Her]> I don't get what the `ev` parameter is supposed to be in the `addEventListener` proc, in the `std/dom` module |
20:05:33 | FromDiscord | <Horizon [She/Her]> (I'm working with the JS backend) |
20:06:03 | FromDiscord | <Horizon [She/Her]> Anyone able to point it out to me? I don't know the equivalent |
20:06:33 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hUM |
20:09:45 | FromDiscord | <Phil> Wouldn't ev be the event that gets thrown? |
20:10:04 | FromDiscord | <huantian> ^ |
20:10:23 | FromDiscord | <Phil> in JS you just get away with ignoring that parameter because... well... JS |
20:11:55 | FromDiscord | <Horizon [She/Her]> JS doesn't even have that param in the docs? |
20:12:06 | FromDiscord | <huantian> It’s the type string |
20:12:27 | FromDiscord | <huantian> addEventListener(type, listener) |
20:12:34 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hUN |
20:12:36 | FromDiscord | <huantian> > A case-sensitive string representing the event type to listen for. |
20:13:20 | FromDiscord | <Horizon [She/Her]> In reply to @huantian "> A case-sensitive string": Ah |
20:14:41 | FromDiscord | <Horizon [She/Her]> In reply to @Event Horizon "Also, `addEventListener(DragStart, "dragstart".cstr": I don't understand the issue here at all 😅 |
20:14:56 | FromDiscord | <Require Support> is there a websockets library that doesnt use async? or where i can disable async |
20:16:11 | FromDiscord | <huantian> In reply to @Event Horizon "I don't understand the": You need to give it an EventTarget, but you gave it DragStart which is a DragEventType |
20:16:36 | * | tiorock joined #nim |
20:16:36 | * | tiorock quit (Changing host) |
20:16:36 | * | tiorock joined #nim |
20:16:36 | * | rockcavera is now known as Guest2272 |
20:16:36 | * | Guest2272 quit (Killed (silver.libera.chat (Nickname regained by services))) |
20:16:36 | * | tiorock is now known as rockcavera |
20:17:05 | FromDiscord | <huantian> It should be something like elem.addEventListener(DragEvent, (_) => discard) |
20:17:08 | FromDiscord | <huantian> I think |
20:19:45 | FromDiscord | <hotdog> In reply to @Event Horizon "I don't understand the": What is DragStart? It should be an element/node |
20:20:42 | FromDiscord | <hotdog> Yeah like @huantian said, didn’t see those messages before |
20:22:02 | * | anddam quit (Quit: WeeChat 3.7.1) |
20:23:36 | FromDiscord | <Horizon [She/Her]> In reply to @huantian "You need to give": Ooh, i didn't get that before haha |
20:36:35 | * | ltriant joined #nim |
20:41:36 | * | ltriant quit (Ping timeout: 264 seconds) |
20:44:28 | * | anddam joined #nim |
20:45:34 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hUT |
20:45:50 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hUU |
20:47:07 | FromDiscord | <Horizon [She/Her]> Compiling the file works just fine |
20:47:20 | FromDiscord | <Horizon [She/Her]> That's... Really odd |
20:48:00 | FromDiscord | <Horizon [She/Her]> How would i suppress that individual error? Seems to be misleading |
20:49:49 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hUW |
20:51:59 | FromDiscord | <Horizon [She/Her]> No errors on stable |
20:52:15 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4gkR |
20:52:34 | FromDiscord | <Horizon [She/Her]> Looks like something broke nimsuggest on devel? |
20:52:48 | * | anddam quit (Quit: WeeChat 3.7.1) |
20:54:56 | * | oprypin quit (Quit: Bye) |
20:55:13 | * | oprypin joined #nim |
20:59:33 | * | jmdaemon joined #nim |
21:09:02 | FromDiscord | <hmmm> uh oh times format("dd/MM/yy") assumes that 06/12/99 it's 06/12/2099 🧐 |
21:09:36 | FromDiscord | <hmmm> [karen face intensifies] I desire to speak to the nim manager |
21:12:46 | * | rockcavera quit (Remote host closed the connection) |
21:19:23 | FromDiscord | <hmmm> very modernly 😃 I asked ChatGPT to :"write a python script to set a string var "061299" parse it in ddMMyy format and reformat it to dd/MM/yyyy" |
21:19:37 | FromDiscord | <hmmm> and it works as I expected |
21:20:05 | FromDiscord | <hmmm> sent a code paste, see https://paste.rs/cgb |
21:20:45 | FromDiscord | <hmmm> outputting 06/12/1999 |
21:26:48 | FromDiscord | <hmmm> apparently it doesn't know the nim lang very well because the nim version of the above doesn't compile 🤨 we are AI proof bois |
21:33:09 | * | junaid_ joined #nim |
21:33:41 | FromDiscord | <Yardanico> In reply to @hmmm "uh oh times format("dd/MM/yy")": "The last two digits of the year. When parsing, the current century is assumed. " |
21:33:53 | FromDiscord | <hmmm> hmmmmmm |
21:34:08 | FromDiscord | <Yardanico> how would it know what century you want specifically if it just gets a string |
21:34:21 | FromDiscord | <hmmm> and why python assumes the sane default century? 😃 |
21:34:34 | FromDiscord | <Yardanico> who knows? |
21:34:37 | FromDiscord | <Yardanico> nim is not python |
21:34:42 | * | rockcavera joined #nim |
21:34:53 | FromDiscord | <hmmm> yea but sane defaults are better than futurama defaults 🧐 |
21:35:30 | FromDiscord | <Yardanico> so we should assume that 061215 is 1915 ? |
21:35:41 | FromDiscord | <hmmm> this is a very interesting question |
21:35:45 | FromDiscord | <hmmm> 😃 |
21:35:52 | FromDiscord | <hmmm> let's see what python does |
21:36:31 | FromDiscord | <Yardanico> we don't need to |
21:36:32 | FromDiscord | <hmmm> nu python has actually super magicks |
21:36:41 | FromDiscord | <hmmm> it detects always the right century |
21:37:12 | FromDiscord | <Yardanico> In reply to @hmmm "it detects always the": anyway, what's the issue? |
21:37:20 | FromDiscord | <Yardanico> you can just use std/times and subtract 100 years |
21:37:25 | * | junaid_ quit (Remote host closed the connection) |
21:37:48 | FromDiscord | <hmmm> absolutely none, it was just funny and I wanted to know the whys and why nots 🥳 |
21:42:01 | FromDiscord | <Yardanico> i just feel like python behaviour is much more prone to surprising errors |
21:43:18 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1049803239610134588/image.png |
21:43:23 | FromDiscord | <Yardanico> this is python's behaviour |
21:43:36 | FromDiscord | <Yardanico> <https://github.com/python/cpython/blob/main/Lib/_strptime.py#L380> |
21:43:44 | FromDiscord | <hmmm> wow, that's interesting |
21:43:53 | FromDiscord | <hmmm> 69 99 |
21:43:55 | FromDiscord | <hmmm> hmm |
21:43:56 | FromDiscord | <Elegantbeef> always 1900 is just the wrong behaviour |
21:44:00 | FromDiscord | <hmmm> ty yardy very interesting |
21:44:11 | FromDiscord | <Yardanico> @beef well, nim defaults to the current century |
21:44:16 | FromDiscord | <Yardanico> and python uses this check |
21:44:17 | FromDiscord | <Elegantbeef> That's better |
21:45:13 | FromDiscord | <Elegantbeef> really though the century used should be the one closest to |
21:45:31 | FromDiscord | <Elegantbeef> if it's 2022 and you have 99 that's the last century not 2099 |
21:45:35 | FromDiscord | <Yardanico> in Python that behaviour was implemented in 2.3 |
21:45:36 | FromDiscord | <Yardanico> <https://github.com/python/cpython/commit/08e54270f2dae5014f04d627739f71ecce5ad19e> |
21:45:48 | FromDiscord | <Yardanico> and no docs actually specify it as far as I searched |
21:45:56 | FromDiscord | <Yardanico> datetime python docs don't say anything about this behaviour |
21:45:58 | FromDiscord | <Yardanico> very nice |
21:46:33 | FromDiscord | <Yardanico> actually sorry, it does, but in the time module |
21:46:34 | FromDiscord | <Yardanico> https://docs.python.org/3/library/time.html |
21:46:37 | FromDiscord | <Yardanico> "Function strptime() can parse 2-digit years when given %y format code. When 2-digit years are parsed, they are converted according to the POSIX and ISO C standards: values 69–99 are mapped to 1969–1999, and values 0–68 are mapped to 2000–2068." |
21:47:48 | FromDiscord | <hmmm> well from a practical point of view if you have 15/12/89 it's much more probable that it's 1989 than 2089. On the other hand a simple rule like nim is easy to remember so you can make preparation for it I guess |
21:48:58 | FromDiscord | <Elegantbeef> It's more sensible to a programmer to do the closest, but parsing based off the users time isnt the greatest |
21:49:22 | FromDiscord | <Elegantbeef> custom parser per decade when! |
22:19:05 | * | anddam joined #nim |
22:19:55 | * | anddam quit (Client Quit) |
22:30:01 | FromDiscord | <hmmm> broskis any magical incantation to echo all the proc names in a project? |
22:33:11 | * | anddam joined #nim |
23:01:26 | arkanoid | most efficient way to have a fifo with a seq? is there a "pop head"? |
23:01:49 | FromDiscord | <! Nilts> Is there any way to import procs types and constants from a pre-compiled file and create these pre-compiled files in nim |
23:02:28 | FromDiscord | <Elegantbeef> Seq's are not efficient FIFO queues |
23:02:40 | FromDiscord | <Elegantbeef> They're efficient FILO queues |
23:03:21 | FromDiscord | <hmmm> well if you reverse them they become FIFO efficient 😃 |
23:03:40 | FromDiscord | <hmmm> or so pmunchie told me years ago |
23:03:42 | FromDiscord | <Elegantbeef> Uhh |
23:03:50 | arkanoid | nope, a stack is a stack |
23:04:16 | FromDiscord | <Elegantbeef> If you have to reverse them you lose your efficiency |
23:05:03 | FromDiscord | <Elegantbeef> There is std/deque |
23:05:12 | arkanoid | I'll use deque then |
23:05:14 | FromDiscord | <hmmm> yea that strange thingy |
23:14:25 | * | ltriant joined #nim |
23:14:30 | arkanoid | hmmm, your username check's out most of the times you write something, you know |
23:16:48 | * | genpaku quit (Remote host closed the connection) |
23:20:42 | * | genpaku joined #nim |
23:22:39 | FromDiscord | <auxym> In reply to @arkanoid "most efficient way to": std/deques |
23:23:24 | FromDiscord | <AmjadHD> @ElegantBeef are you planning to add support for `openarray[char]` to `strutils` procedures ? |
23:23:36 | FromDiscord | <Elegantbeef> Araq said no |
23:23:46 | FromDiscord | <AmjadHD> In reply to @Elegantbeef "Araq said no": Why ? |
23:35:01 | FromDiscord | <robdog> you awake ?? |
23:35:43 | FromDiscord | <Elegantbeef> No clue why |