00:06:30 | arkanoid | is it safe to cast an object into another, if the two objects have the same number of fields:type, where type are all non-ref and they are just different "distinct floats"? |
00:10:24 | FromDiscord | <Generic> it should be safe, though at this point why don't you create a small proc which just assigns the respective values one by one? |
00:10:53 | FromDiscord | <Elegantbeef> Yep |
00:13:03 | arkanoid | I mean, this https://play.nim-lang.org/#ix=4gqx |
00:14:20 | arkanoid | it seems working to me in my small project according to tests, but I feel like betting on something I should not bet |
00:17:07 | arkanoid | Generic, for 2 reasons: 1) should be a cast much faster than a proc that would copy over fields? 2) my object is quite massive, lots and lots of fields. I have all them with different distinc floats as I am using "unchained" packages that gives me units of measures, so basically I have each object in 3 different "versions", one for International System, one for Imperial System, and one using plain |
00:17:09 | arkanoid | floats for numpy/python interface |
00:18:09 | FromDiscord | <Elegantbeef> You're copying regardless so it's the same thing |
00:18:18 | FromDiscord | <Elegantbeef> I still dont get why it's not just a generic |
00:18:36 | FromDiscord | <Elegantbeef> Ah vnm |
00:18:36 | arkanoid | Elegantbeef, a generic type? |
00:18:38 | FromDiscord | <Elegantbeef> nvm even |
00:18:52 | FromDiscord | <Elegantbeef> Actually it could be a generic |
00:19:32 | FromDiscord | <Horizon [She/Her]> I wonder how easy it'd be for a Nim documentation search bot |
00:19:49 | FromDiscord | <Horizon [She/Her]> Maybe even for multiple projects by providing a URL or something |
00:19:59 | arkanoid | vnm, nvm, stands for? |
00:20:18 | FromDiscord | <Elegantbeef> nevermind |
00:21:35 | arkanoid | oh, ok. Well, by generic you mean type MyObject[T] = object ... "? |
00:22:15 | FromDiscord | <Horizon [She/Her]> Wait you can do that? Neat |
00:23:05 | arkanoid | I've tried wrapping my head around it, but it really did not produce safer or less code than the "flat and exploded" mode |
00:23:28 | arkanoid | here I'm quite sure I'm not using full type system/compile thing potential here |
00:24:19 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4gqB |
00:24:20 | FromDiscord | <Elegantbeef> Is what i practically mean |
00:27:02 | FromDiscord | <Horizon [She/Her]> Jvm bytecode is horrible |
00:28:07 | arkanoid | Elegantbeef, I was writing this while you were producing your https://play.nim-lang.org/#ix=4gqC |
00:28:14 | FromDiscord | <Horizon [She/Her]> I should probably look at the `asm` package for Java, for inspiration on generating jvm bytecode |
00:29:25 | arkanoid | neat solution, I've not yet wrapped my head around concepts, so I was not considering them into the equation |
00:34:23 | FromDiscord | <Elegantbeef> Hopefully that makes sense arkanoid, i just dont believe in repeating oneself |
00:35:10 | FromDiscord | <Elegantbeef> Concepts are really just "Every expression needs to evaluate true and compile" |
00:36:04 | * | derpydoo quit (Ping timeout: 260 seconds) |
00:36:19 | FromDiscord | <dizzyliam [they/them]> Can you check if threads are enabled from a `when` statement? |
00:37:31 | FromDiscord | <Horizon [She/Her]> Would `when declared(threads)` work? |
00:37:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gqG |
00:37:51 | FromDiscord | <dizzyliam [they/them]> Thanks |
00:38:02 | FromDiscord | <Horizon [She/Her]> Ah didn't know about compileOptions, that's good to know |
00:38:16 | FromDiscord | <Elegantbeef> Dont recall if threads enables a define |
00:38:17 | FromDiscord | <Elegantbeef> So both might work |
00:39:03 | arkanoid | ElegantBeef, yes I understand the potential, but here I risk losing the the units static check performed by "unchained" just to save some typing. Would be nice though. I'll try to apply some good idea, feels like a good exercise |
00:39:55 | FromDiscord | <Elegantbeef> "I risk losing the the units static check" ? |
00:40:42 | FromDiscord | <Elegantbeef> you can always insert a `convertToUnit(myFloatDistinct, myTarget)` |
00:40:59 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Dont recall if threads": I used `declared`, since the threads module is imported with `threads:on`, and iirc shouldn't be declared if it's off |
00:41:54 | FromDiscord | <Elegantbeef> sure |
01:16:03 | FromDiscord | <Al-Jahksun Laheen Hyelis> finally wrote my first good cli app with nim. https://media.discordapp.net/attachments/371759389889003532/1044058582246752368/Screenshot_2022-11-21-12-14-40_1920x1080.png |
01:16:12 | FromDiscord | <Al-Jahksun Laheen Hyelis> Nim is actually a lot better than python for these things |
01:16:55 | FromDiscord | <Elegantbeef> Did you use a CLI library or parse yourself? |
01:17:29 | FromDiscord | <Al-Jahksun Laheen Hyelis> In reply to @Elegantbeef "Did you use a": I did it myself :D |
01:18:39 | FromDiscord | <Al-Jahksun Laheen Hyelis> also is there a better way to do this than using `&`? maybe like the eqv of an f-string? |
01:18:43 | FromDiscord | <Al-Jahksun Laheen Hyelis> cmd("/usr/local/lib/redseagen " & paramStr(2) & " " & paramStr(3)) |
01:19:35 | FromDiscord | <Elegantbeef> there is `std/strformat` but there is also `execprocess` inside std/osproc |
01:20:12 | FromDiscord | <Elegantbeef> `execProcess("redseagen", args = [paramStr(2), paramStr(1))` |
01:20:31 | FromDiscord | <Elegantbeef> Whoops lacking a `]` |
01:21:03 | FromDiscord | <Al-Jahksun Laheen Hyelis> is execShellCmd not good in this case? |
01:22:35 | FromDiscord | <Al-Jahksun Laheen Hyelis> sent a code paste, see https://play.nim-lang.org/#ix=4gqM |
01:22:50 | FromDiscord | <Al-Jahksun Laheen Hyelis> The reason why I'm using an environmental viarable is because the program that I'm running recquires it |
01:23:29 | FromDiscord | <Elegantbeef> Well execProcess allows adding args in a cleaner way |
01:23:36 | FromDiscord | <Elegantbeef> String concatenation is ugh |
01:23:37 | FromDiscord | <Al-Jahksun Laheen Hyelis> what about env? |
01:24:24 | FromDiscord | <Elegantbeef> you can use strformat if you want |
01:24:29 | FromDiscord | <Al-Jahksun Laheen Hyelis> because execProcess executes it as a process not through shell so it doesn't takes environmental variables right? |
01:25:01 | FromDiscord | <Elegantbeef> there is an `env` argument that is a `StringTableRef` |
01:25:13 | FromDiscord | <Al-Jahksun Laheen Hyelis> ehh too much, ill just keep doing what im doing |
01:41:39 | * | adium joined #nim |
01:42:44 | FromDiscord | <Al-Jahksun Laheen Hyelis> probably not an advanced question, but will the same piece of code always produce the same binary? |
01:45:29 | FromDiscord | <Elegantbeef> Yes, but no |
01:45:48 | FromDiscord | <Elegantbeef> Different compilers C compiler and settings will change the generated code |
01:45:56 | FromDiscord | <Elegantbeef> different c compilers |
02:16:56 | FromDiscord | <voxal> and also on different operating systems |
02:19:45 | FromDiscord | <Rika> Different CPUs can make it generate different (assembly) code too |
02:21:40 | FromDiscord | <voxal> yes different cpus have different instruction sets. like x86 is different from arm |
02:24:57 | FromDiscord | <Array in a Matrix> different standard c library implementation would as well |
02:25:07 | FromDiscord | <Array in a Matrix> glibc vs musl |
02:25:34 | FromDiscord | <ChocolettePalette> Different programmers write different code too |
02:27:50 | FromDiscord | <voxal> > but will the same piece of code always produce the same binary↵we are assuming the code is the sam |
02:27:51 | FromDiscord | <voxal> (edit) "sam" => "same" |
02:31:30 | FromDiscord | <LYNESTAR> ohh |
02:31:51 | FromDiscord | <LYNESTAR> What's the best way to make sure a binary file actually came from a particular source file? |
02:32:08 | FromDiscord | <Rika> You don’t |
02:33:05 | FromDiscord | <Elegantbeef> Compile it yourself |
02:37:50 | FromDiscord | <voxal> In reply to @LYNESTAR "What's the best way": generally you just run the binary and test some inputs and outputs against it, check if it matches against a self compiled version. |
03:03:39 | FromDiscord | <nixfreak> Is that only because of inim ? |
03:04:58 | FromDiscord | <nixfreak> sent a code paste, see https://paste.rs/xUV |
03:06:05 | FromDiscord | <ajusa> I was looking at https://github.com/nim-lang/RFCs/issues/418 and noticed that folks were saying that this functionality could be done with a macro - is this actually possible to do? Have the object be constructed based on the names of the variables that are being passed in? |
03:12:05 | FromDiscord | <nixfreak> I figured it out you need mozilla Fira-sans ttf |
03:12:19 | FromDiscord | <Elegantbeef> of course↵(@ajusa) |
03:12:27 | FromDiscord | <Elegantbeef> my macro i mention does just that |
03:12:44 | FromDiscord | <ajusa> constructor does that? |
03:12:54 | FromDiscord | <Elegantbeef> https://github.com/beef331/constructor#constructor-1 |
03:13:52 | FromDiscord | <ajusa> right, but I assume I can't do `initUser(age)` without specifying that overload myself |
03:14:28 | FromDiscord | <ajusa> but in the proposal, that would be built into the language |
03:16:54 | FromDiscord | <Elegantbeef> you could make `init` a macro |
03:17:00 | FromDiscord | <Elegantbeef> problem solved |
03:21:42 | * | derpydoo joined #nim |
03:25:04 | FromDiscord | <albassort> i need a circular import |
03:25:09 | FromDiscord | <albassort> otherwise my code doesn't make any sense |
03:25:11 | FromDiscord | <albassort> how can i do that |
03:25:21 | FromDiscord | <albassort> currently two files depend on each other |
03:25:35 | FromDiscord | <albassort> ah wait |
04:01:20 | * | arkurious quit (Quit: Leaving) |
04:52:00 | * | sgc joined #nim |
05:26:24 | * | junaid_ joined #nim |
06:00:48 | * | sgc quit (Quit: sgc) |
06:01:23 | * | rockcavera quit (Remote host closed the connection) |
06:42:27 | FromDiscord | <dlesnoff> You can do circular imports but it might not work like you think |
06:45:53 | FromDiscord | <dlesnoff> If you have two modules A and B importing each other it works like this:↵- if you compile module A, it reads until module B import, loads all the env variables read so far and compile module B.↵- it does not return to module A if you import it from module B↵- it only returns to A if module B compilation ends |
06:46:39 | FromDiscord | <dlesnoff> That's what I have understood from Mastering Nim |
06:46:55 | FromDiscord | <Elegantbeef> That's correct |
06:47:05 | FromDiscord | <Elegantbeef> Cyclical imports work up until the first cycle you get all symbols above that |
06:47:08 | FromDiscord | <albassort> Converting int to enum |
06:47:14 | FromDiscord | <Elegantbeef> You need to delay them and be smart about where you `input` |
06:47:23 | FromDiscord | <albassort> oh long since solved that |
06:47:27 | FromDiscord | <albassort> reorganized everything |
06:47:31 | FromDiscord | <ChocolettePalette> This is why I'm into the C programming language, #includes are kinda simple doe |
06:47:46 | FromDiscord | <Elegantbeef> `if myInt in MyEnum.low..MyEnum.high: MyEnum(myInt)` |
06:47:49 | FromDiscord | <albassort> includes are so easy I love them sooooooooooooooo much |
06:47:58 | FromDiscord | <Elegantbeef> Your shitposts are reknowned |
06:48:03 | FromDiscord | <Elegantbeef> renowned even 😄 |
06:48:22 | FromDiscord | <Elegantbeef> Nim has include aswell so just make a big file and cry at how bad it is |
06:48:26 | * | vicecea quit (Remote host closed the connection) |
06:48:37 | FromDiscord | <ChocolettePalette> Oooo |
06:48:37 | FromDiscord | <albassort> will do |
06:48:48 | FromDiscord | <Elegantbeef> Please do not use include |
06:48:59 | FromDiscord | <Elegantbeef> Chocolette do you even write nim or do you just sit around and meme it? |
06:49:11 | FromDiscord | <dlesnoff> Ouch |
06:49:16 | FromDiscord | <albassort> I'll use Threadpools, Marshall, TypeInfo, and include |
06:49:18 | FromDiscord | <albassort> in one script |
06:49:28 | FromDiscord | <albassort> (edit) "script" => "file" |
06:49:32 | FromDiscord | <Rika> > marshal |
06:49:36 | FromDiscord | <Rika> god bless you |
06:50:07 | FromDiscord | <albassort> (i say that as i write a manual deseralizer because #ihatejson |
06:50:09 | FromDiscord | <albassort> (edit) "#ihatejson" => "#ihatejson)" |
06:50:28 | FromDiscord | <Elegantbeef> I only say that Chocolette cause you say something that's on the line of satire and knowledge |
06:50:57 | FromDiscord | <ChocolettePalette> I has been writing a cool program in Nim, but unfortunately I had to stop because of a bug in HttpClient which prevented me from reusing an instance... I'll wait until it's fixed and continue my coding in Nim |
06:51:51 | FromDiscord | <Elegantbeef> Is there an issue? |
06:53:51 | FromDiscord | <Elegantbeef> Imports in Nim are more sensible than includes though |
06:53:52 | FromDiscord | <ChocolettePalette> You should try python\:`eval(open("mymodule.py", "r").read())`↵(@albassort) |
06:54:06 | FromDiscord | <Elegantbeef> You basically get the entire `ifndef` and no need to worry about overloading symbols |
06:54:14 | FromDiscord | <albassort> when i was learning how to program i did that |
06:57:28 | FromDiscord | <albassort> my deseralizer is 110% fater |
06:57:32 | FromDiscord | <albassort> (edit) "fater" => "faster" |
06:57:33 | FromDiscord | <ChocolettePalette> There is https://github.com/nim-lang/Nim/issues/16572And it's open for so long which makes me suffer so much because it's impossible to write my cool program because of that bug |
06:57:36 | FromDiscord | <albassort> lets aim for 300% |
06:58:03 | FromDiscord | <ChocolettePalette> Will I do anything about it though? No... |
06:58:18 | FromDiscord | <Elegantbeef> 300% is too easy |
06:58:20 | FromDiscord | <Elegantbeef> Go for 1000% |
06:59:08 | FromDiscord | <albassort> im trying to think of how im going to thread arbitrary data |
07:00:09 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gri |
07:00:20 | FromDiscord | <ChocolettePalette> Oh btw, @Elegantbeef, in the C++ programming language and the C programming language you can do ASM insertions... Can you do it in Nim? |
07:00:32 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement |
07:01:03 | FromDiscord | <ChocolettePalette> > unsafe↵😔 |
07:01:13 | FromDiscord | <Elegantbeef> Well asm sure isnt safe |
07:02:37 | FromDiscord | <ChocolettePalette> Well I was happier before I knew it |
07:02:47 | FromDiscord | <Elegantbeef> I'm confused |
07:05:00 | FromDiscord | <albassort> eh |
07:05:08 | FromDiscord | <albassort> actually im only 700% faster |
07:06:30 | FromDiscord | <Elegantbeef> Hmph that error you linked is odd, seems it's not reading any data from the client on the second request |
07:06:55 | FromDiscord | <Elegantbeef> Atleast `fullyRead` is never being set to true |
07:07:41 | * | junaid_ quit (Remote host closed the connection) |
07:08:34 | FromDiscord | <ChocolettePalette> There was an open issue with someone "get"-ting stuff, then "sleep"-ing for a minute or smth, then trying to get another page after sleeping and having this errorBUTThere has been a workaround somewhere on Github |
07:09:03 | FromDiscord | <Elegantbeef> Yea it's called `client.close; client = newHttpClient()` |
07:09:34 | FromDiscord | <ChocolettePalette> Nooo, this one is too obvious and brings in too much overhead |
07:10:07 | FromDiscord | <ChocolettePalette> That one was really complicated and intricate, heavily using async module |
07:10:07 | FromDiscord | <Elegantbeef> Does the issue persist with the async client? |
07:10:50 | FromDiscord | <ChocolettePalette> Idk, I never use async functions, I prefer threads |
07:11:13 | FromDiscord | <Elegantbeef> That's like saying i dont use roads i take a plane |
07:13:06 | FromDiscord | <ChocolettePalette> Well blocking httpclient procs in essence are just async calls and those async returns paired together, so I don't think that it is the issue |
07:13:32 | FromDiscord | <ChocolettePalette> But idk, I'm a C/C++ expert, not a Nim expert yet |
07:13:44 | FromDiscord | <Elegantbeef> Yea i mean the issue looks like it's an issue with the implementation |
07:14:01 | FromDiscord | <Elegantbeef> Something about reusing a client means `fullyRead` isnt set |
07:16:36 | FromDiscord | <ChocolettePalette> One day it'll get fixed hopefully and if it happens before my graduation, I'll write a thing to cheat on my online courses |
07:18:32 | * | kenran joined #nim |
07:53:43 | * | PMunch joined #nim |
08:39:22 | * | vicecea joined #nim |
09:02:19 | FromDiscord | <UnderShell> If I have found a github repository with a nim library I want to install, which command do I use to install it after I cloned it down? |
09:03:56 | FromDiscord | <ChocolettePalette> Give us a link, there must be a nimble install command in the description or smth |
09:04:12 | FromDiscord | <UnderShell> https://github.com/def-/nim-syscall |
09:07:31 | FromDiscord | <Elegantbeef> `nimble install theGiturl` |
09:07:40 | FromDiscord | <Elegantbeef> so `nimble install https://github.com/def-/nim-syscall` |
09:07:54 | FromDiscord | <Elegantbeef> or `nimble install syscall` |
09:07:56 | FromDiscord | <UnderShell> thank you! |
09:08:02 | FromDiscord | <Elegantbeef> as it's known in the default nimble repository |
09:30:11 | * | kenran` joined #nim |
09:32:01 | * | kenran quit (Ping timeout: 256 seconds) |
10:00:00 | NimEventer | New post on r/nim by nim_rod_: How to import LowercaseLetters and UppercaseLetters from strutils?, see https://reddit.com/r/nim/comments/z0v3bs/how_to_import_lowercaseletters_and/ |
10:01:50 | * | derpydoo quit (Ping timeout: 240 seconds) |
10:03:58 | * | kenran` quit (Remote host closed the connection) |
11:04:38 | FromDiscord | <hmmm> broskis do we have some comfy sugar for getting the sum of a seq[int]? like @[1,2,3] -> 6? |
11:12:55 | PMunch | foldl? |
11:14:06 | PMunch | !eval import sequtils; echo @[1, 2, 3].foldl(a + b) |
11:14:12 | NimBot | 6 |
11:14:35 | FromDiscord | <hmmm> I'll look into it ty munchie |
11:20:14 | FromDiscord | <Yardanico> In reply to @hmmm "broskis do we have": https://nim-lang.org/docs/math.html#sum%2CopenArray%5BT%5D |
11:20:21 | FromDiscord | <Yardanico> just literally `sum` from math |
11:20:29 | FromDiscord | <Yardanico> openarrays accept seqs |
11:22:28 | FromDiscord | <hmmm> hmm they both give me the correct result, but sequtils was already an import for me so maybe it makes more sense to use foldl |
11:23:31 | FromDiscord | <Yardanico> foldl's implementation is a bit more complex :P |
11:23:55 | FromDiscord | <hmmm> I see 🧐 |
11:47:08 | * | jjido joined #nim |
12:01:37 | * | jmdaemon quit (Ping timeout: 256 seconds) |
12:38:39 | FromDiscord | <hmmm> hooooooy broskis: when I do for i,v in xyz: how do I make v mutable? |
12:39:37 | FromDiscord | <Yardanico> if you're iterating over a table, use mpairs |
12:39:57 | FromDiscord | <hmmm> oh I actually remember mpairs, ty yardy |
13:58:12 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
13:58:45 | FromDiscord | <dlesnoff> What does `lent` do ? |
13:59:45 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4gt6 |
14:01:00 | * | derpydoo joined #nim |
14:05:26 | FromDiscord | <dlesnoff> Sorry, I just found the manual part: https://nim-lang.org/docs/destructors.html#lent-type |
14:22:12 | * | rockcavera joined #nim |
14:29:40 | * | tanami quit (Ping timeout: 248 seconds) |
14:41:07 | * | lucerne joined #nim |
14:47:37 | NimEventer | New thread by dlesnoff: Nim Table, type iterators and lent type, see https://forum.nim-lang.org/t/9641 |
14:48:12 | * | arkurious joined #nim |
15:06:31 | * | PMunch quit (Quit: Leaving) |
15:46:34 | * | Phytolizer joined #nim |
15:47:16 | Phytolizer | hi guys, i'm working on wrapping a c library. all has been going smoothly until i wrote the `[]` proc, and i am getting a warning about circular dependency. how can i get more details? https://play.nim-lang.org/#ix=4gty |
15:47:35 | Phytolizer | line 252 gives the warning |
15:49:54 | * | kenran joined #nim |
15:57:57 | Phytolizer | please tell me i don't have to rebuild the compiler:) https://github.com/nim-lang/Nim/blob/7f6e800cafc7b73625893fb5280eb8b51a15b252/compiler/reorder.nim#L196-L210 |
16:14:42 | FromDiscord | <tandy> you can enable code reordering, its somewhere in the manual↵(<@709044657232936960_=50hytolizer=5b=49=52=43=5d>) |
16:16:29 | Phytolizer | actually i found a bug with this code i linked, so i'm going down the rabbit hole of opening an issue/PR :) |
16:16:52 | Phytolizer | the compiler doesn't build with -d:debugReorder |
16:19:56 | FromDiscord | <dlesnoff> @Phytolizer Maybe check this issue first https://github.com/nim-lang/Nim/issues/14290 ? |
16:31:09 | Phytolizer | yeah, the compiler not building with the define above is still a bug |
16:32:53 | Phytolizer | i opened the issue here: https://github.com/nim-lang/Nim/issues/20887 |
16:34:20 | Phytolizer | that issue does seem related to the warning i'm getting, but i have them in the correct order according to that (pragma came first) |
16:40:47 | Phytolizer | actually funny thing @tandy: i only get the warning with code reordering enabled |
16:42:47 | Phytolizer | ok i'm kind of flabbergasted. the warning is because line 252 somehow depends on line 324. line 324 declares a method `key` on a completely different type, and `key` is also the name of the argument to `[]`. |
16:52:11 | Phytolizer | LOL https://play.nim-lang.org/#ix=4gtM |
16:55:06 | Phytolizer | the warning only appears if the first method is a quoted identifier and the second has the name of an argument of the first |
16:55:17 | FromDiscord | <tandy> RIP lol |
17:20:50 | * | pro joined #nim |
17:23:32 | * | Phytolizer quit (Quit: Client closed) |
17:29:15 | * | pro left #nim (#nim) |
17:39:08 | * | fallback quit (Remote host closed the connection) |
17:45:00 | * | kenran quit (Remote host closed the connection) |
18:03:07 | * | Phytolizer joined #nim |
18:08:03 | * | Phytolizer quit (Ping timeout: 260 seconds) |
18:11:47 | * | jjido joined #nim |
18:14:14 | * | cyraxjoe quit (Quit: I'm out!) |
18:15:28 | * | Phytolizer joined #nim |
18:16:00 | * | cyraxjoe joined #nim |
18:19:19 | * | fallback joined #nim |
18:25:07 | * | xet7 joined #nim |
18:32:42 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
18:34:53 | * | Phytolizer quit (Ping timeout: 260 seconds) |
19:04:16 | FromDiscord | <Goat> Which one is faster: using `discard myseq.pop` or `myseq.del myseq.len-1`? |
19:22:29 | * | cyraxjoe quit (Ping timeout: 260 seconds) |
19:22:40 | * | cyraxjoe joined #nim |
19:23:58 | FromDiscord | <.tochka> really depends on what compiler decides to do |
19:24:05 | FromDiscord | <.tochka> benchmark it |
19:24:26 | FromDiscord | <huantian> you might also wanna try `mysql.setLen(mysq.len - 1)` |
19:25:16 | FromDiscord | <.tochka> my bet is setlen should be the fastest, unless calls arent interpreted literally as they're written |
19:26:02 | FromDiscord | <.tochka> as its just subtraction from length counter, with some sanity checks |
19:26:15 | FromDiscord | <.tochka> (edit) "subtraction from" => "setting" |
19:26:26 | FromDiscord | <.tochka> (edit) "checks" => "checks, probably" |
19:27:04 | FromDiscord | <.tochka> (edit) "probably" => "probably, and missed branch to reallocation" |
19:37:05 | * | lucerne quit (Read error: Connection reset by peer) |
19:50:36 | FromDiscord | <voxal> sent a code paste, see https://play.nim-lang.org/#ix=4guk |
19:51:21 | FromDiscord | <voxal> i'm representing the message attribution as a option type right now, but i can't directly insert it into the database |
20:02:27 | FromDiscord | <hmmm> broskis what does it mean in the docs that multireplace does the repalcements in a single pass? |
20:02:37 | * | jmdaemon joined #nim |
20:07:41 | FromDiscord | <amadan> Instead of making multiple loops to perform each replacement it is looping over the string once and doing replacements when it can do them |
20:08:50 | FromDiscord | <hmmm> it's different from how str.replace(x,y).replace(z,k) would work? |
20:11:17 | FromDiscord | <amadan> That would need to loop over `str` twice so it would be less efficient.↵The only difference in terms of how it works is that `str.replace("X", "y").replace("y", "Z")` would make all "X" become "Z" while multi replace would make "X" become "y" and any y's before replacement become "Z" |
20:12:31 | FromDiscord | <hmmm> so the result is the same but it's much more efficient |
20:13:20 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4guo |
20:13:59 | FromDiscord | <hmmm> oh I see the result is not the same if you use something in the first pass in the second pass, I see |
20:16:10 | FromDiscord | <hmmm> very tricky but still, if you need to replace x with y you don't really want to replace y with z at the same time because you could go directly x with z |
20:17:20 | FromDiscord | <hmmm> anyway ty danny very instructive 😀 |
20:43:40 | FromDiscord | <haywireSSC> can I do += with setters? |
20:44:05 | * | nyeaa49284 quit (Ping timeout: 256 seconds) |
20:49:11 | FromDiscord | <huantian> yes |
20:49:14 | FromDiscord | <huantian> pretty sure |
21:14:04 | FromDiscord | <haywireSSC> ty |
21:17:21 | * | nyeaa49284 joined #nim |
21:27:40 | NimEventer | New post on r/nim by Dry-Sweet7045: is it possible to write a DAW (digital audio workstation) or VSTs with Nim? any audio software, in general, see https://reddit.com/r/nim/comments/z1ar6u/is_it_possible_to_write_a_daw_digital_audio/ |
21:28:07 | * | xet7 quit (Ping timeout: 260 seconds) |
21:41:02 | * | xet7 joined #nim |
21:50:49 | * | lucerne joined #nim |
21:52:51 | * | lucerne quit (Read error: Connection reset by peer) |
21:58:24 | * | lucerne joined #nim |
22:16:02 | * | lucerne quit (Read error: Connection reset by peer) |
22:19:49 | * | derpydoo quit (Ping timeout: 260 seconds) |