<< 29-11-2022 >>

00:01:34*xet7 quit (Remote host closed the connection)
00:03:57*xet7 joined #nim
00:12:00*jmd_ joined #nim
00:25:08FromDiscord<hotdog> In reply to @Corazone "Thank you so much,": No problem at all. I’d prefer the header style too, easier to add extra values if you need them in the future. Feel free to ping me on here if you have more questions or get stuck with it
00:32:48FromDiscord<huantian> In reply to @dani "Hi. I'm new to": I don’t think you can store `typedesc`s, even at compile time
00:33:03FromDiscord<huantian> Or at least not in an array like that?
00:33:23FromDiscord<huantian> Maybe you could make a macro to do it
00:36:25FromDiscord<iffy (Matt Haggard)> This code succeeds on the playground, but fails with SIGSEGV locally (nim 1.6.10). Locally, if I run with `--mm:orc` the assertion fails (`res` is empty string). Does the code fail for you locally?
00:36:28FromDiscord<iffy (Matt Haggard)> https://play.nim-lang.org/#ix=4h8Z
00:40:22FromDiscord<dani> @huantian thanks for the feedback. The idea is to store their string representation ( $ typedesc ). Should I walk the AST gathering their idents ?
00:41:02FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4h91
00:41:21FromDiscord<huantian> (edit) "https://play.nim-lang.org/#ix=4h91" => "https://play.nim-lang.org/#ix=4h92"
00:42:02FromDiscord<iffy (Matt Haggard)> I should also add, I'm on macOS. Running the same code in docker nimlang/nim\:1.6.10-alpine it works with `refc`, and fails with SIGSEGV with `orc` and `arc`
00:42:30FromDiscord<huantian> though the error with yours seems to be because of some weird interaction with generics and teypdesc
00:43:55FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4h94
00:44:17FromDiscord<Yepoleb> In reply to @iffy (Matt Haggard) "This code succeeds on": i think unsafeAddr dereferences the reference, but when you cast it back to `ptr[MyObj]` you get a pointer to a ref object
00:46:22FromDiscord<iffy (Matt Haggard)> I should back up. I'm trying to interface with a c library which accepts some data as a `void ` and later calls some of my procs with that same `void ` so my proc can use the associated data. I'm failing to get it right, so I made this minimal example. Now I'm yak shaving the example. Is it producing inconsistent behavior because I'm using `unsafeAddr` wrong?
00:48:42FromDiscord<dani> sent a code paste, see https://play.nim-lang.org/#ix=4h96
00:49:00FromDiscord<dani> I'm trying to figure out how to harness the compile time magic. But it's difficult to find good introduction material about the topic. Can anyone point me to a good resource to learn from?
00:57:05FromDiscord<Yepoleb> In reply to @Yepoleb "i think unsafeAddr dereferences": i was wrong about that
01:03:40FromDiscord<iffy (Matt Haggard)> Alright, this works in all the places now\: https://play.nim-lang.org/#ix=4h98 Am I liable to run into problems storing the dereferenced `ref` address? https://play.nim-lang.org/#ix=4h98
01:08:16FromDiscord<Yepoleb> you are still casting the dereferenced pointer to an implicit reference, because you defined MyObj as ref object
01:08:50FromDiscord<Yepoleb> i don't understand why it works lol
01:09:09FromDiscord<Yepoleb> imo you should define a non-ref base type and pass around pointers to that
01:13:56*arkanoid quit (Ping timeout: 268 seconds)
01:15:31FromDiscord<iffy (Matt Haggard)> Yeah, it doesn't feel right -- I think you're right
01:23:44FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4h9c
01:24:25FromDiscord<Rika> problem with first is you get a stack address (result.addr, points to stack of call to makeObj function) and that gets invalidated quickly
01:24:50FromDiscord<Rika> second is that you cast that stack address pointer (ptr ref object) into MyObj (ref object)
01:29:48FromDiscord<iffy (Matt Haggard)> Does `new` not allocate on the heap?
01:30:19FromDiscord<Yepoleb> hi rika
01:30:44FromDiscord<Rika> In reply to @iffy (Matt Haggard) "Does `new` not allocate": new allocates the ref
01:31:05FromDiscord<Yepoleb> thanks for the explanation, i forgot how references work internally for a moment
01:31:28FromDiscord<Rika> you dont want to mix references and pointers
01:31:32FromDiscord<Rika> they wont work right
01:32:28FromDiscord<iffy (Matt Haggard)> So changing it to `type MyObj = object` is likely a good idea, like Yepoleb said
01:33:00FromDiscord<Rika> if you really want `pointer` sure maybe
01:33:08FromDiscord<iffy (Matt Haggard)> Okay, I think I see (I'll need to think through it for a minute)↵(@Rika)
01:33:44FromDiscord<voidwalker> blah, I have a 4 byte string that has the values of an ipv4 address. How do I convert that to IpAdress type, which has array[0..3] uint8 type ?
01:33:48FromDiscord<iffy (Matt Haggard)> The library wanting a `void ` is my only requirement
01:34:17FromDiscord<Rika> if its a c library it is unlikely to understand a reference
01:34:30FromDiscord<voidwalker> Tried something like `IpAddress(family: IpAddressFamily.IPv4, address_v4: (cast[seq[uint8]](x[p..p+3])))` but I am not good with the casting, got `type mismatch: got 'seq[uint8]' for 'cast[seq[uint8]](x[p .. p + 3])' but expected 'array[0..3, uint8]'`
01:34:32FromDiscord<Rika> maybe you can do with some gcref or whatnot but thats not my territory
01:34:42FromDiscord<iffy (Matt Haggard)> It's doesn't interpret the data, it just passes it back as I passed it in
01:35:24FromDiscord<Rika> then maybe you can cast the ref to a pointer
01:36:09FromDiscord<Rika> `cast[pointer](result)` of course not really that safe because reference structure layout might change in the future etc
01:36:56*rockcavera joined #nim
01:37:02FromDiscord<Yepoleb> just combine dereference and addr and it should be safe
01:37:20FromDiscord<Yepoleb> instead of casting directly to pointer
01:38:01FromDiscord<Rika> then you get the issue of getting the address to the stack entry of the reference pointer again
01:38:56FromDiscord<Yepoleb> no, that's why you dereference first
01:40:29FromDiscord<iffy (Matt Haggard)> Looks like `thing = cast[pointer](result)` and `thing = result[].unsafeAddr` cause `thing` to have the same value (at least according to `.repr` w/ `--mm:refc`)
01:41:05FromDiscord<Yepoleb> yes, that's expected
01:41:56FromDiscord<iffy (Matt Haggard)> Oh, I thought you said "combine dereference and addr ... instead of casting directly to pointer"
01:43:21FromDiscord<Yepoleb> it does effectively the same thing, but the deref variant would still work with a changed reference layout
01:43:37FromDiscord<iffy (Matt Haggard)> oh, I see
01:44:16FromDiscord<iffy (Matt Haggard)> Well thank you both!
01:44:55FromDiscord<Yepoleb> you're welcome, thanks for the interesting question
02:35:59FromDiscord<ringabout> Can someone reproduce it on Macos? https://github.com/nim-lang/Nim/issues/20949
02:36:10FromDiscord<ringabout> I cannot reproduce it on Windows or Linux.
02:37:28NimEventerNew Nimble package! cgi - Helper procs for CGI applications in Nim., see https://github.com/nim-lang/cgi
03:05:09FromDiscord<iffy (Matt Haggard)> sent a long message, see http://ix.io/4h9D
03:05:23FromDiscord<iffy (Matt Haggard)> sent a long message, see https://paste.rs/lCd
03:05:33FromDiscord<iffy (Matt Haggard)> sent a long message, see http://ix.io/4h9F
03:08:40FromDiscord<ringabout> In reply to @iffy (Matt Haggard) "I can't repro\: \`\`\`$": I see. Thank you!
04:00:57*arkurious quit (Quit: Leaving)
04:12:46*derpydoo quit (Remote host closed the connection)
04:21:56FromDiscord<yrashk> Are there any efforts similar to `nimfmt` with some more recent activity?
04:51:48FromDiscord<voidwalker> trying to parse a string that has each 6bytes - ips/ports, encoded as 4bytes ip, 2 bytes port (in big endian order)
04:52:13FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4ha0
04:52:20FromDiscord<voidwalker> cand it be done better than this ?
04:53:54FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4ha0" => "https://play.nim-lang.org/#ix=4ha1"
05:18:39FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4ha4
05:19:37*vicecea joined #nim
05:24:22*rockcavera quit (Remote host closed the connection)
05:27:32FromDiscord<ringabout> In reply to @ynfle "Anyone here have any": I dunno. But it works with ORC.
05:28:03FromDiscord<ringabout> Perhaps a gc issue.
05:32:46FromDiscord<ynfle> Doesn't work for me with orc
05:32:54FromDiscord<ynfle> Did you try hitting the endpoint?
05:33:37FromDiscord<ringabout> Yeah
05:33:38FromDiscord<ringabout> https://media.discordapp.net/attachments/371759389889003532/1047022506579595364/image.png
05:34:04FromDiscord<ringabout> I'm on windows.
05:34:16FromDiscord<ringabout> I also tested 1.6.8
05:36:16FromDiscord<voidwalker> crashes for me on linux, 1.6.8, default everything
05:42:30FromDiscord<ynfle> Interesting I'm on 1.6.8 on macOs
05:42:32FromDiscord<ynfle> (edit) "macOs" => "macOS"
05:44:22FromDiscord<ringabout> In reply to @voidwalker "crashes for me on": Could you also try `--mm:orc`?
05:48:54FromDiscord<voidwalker> no crash with orc @ringabout
05:49:13FromDiscord<ringabout> That's weird.
05:54:51FromDiscord<ynfle> In reply to @ringabout "Could you also try": Same
06:02:52*ltriant quit (Ping timeout: 256 seconds)
06:30:02*ltriant joined #nim
06:34:28*ltriant quit (Ping timeout: 248 seconds)
06:49:23*jmd_ quit (Ping timeout: 265 seconds)
07:36:54*kenran joined #nim
07:40:58*PMunch joined #nim
07:41:36*kenran quit (Remote host closed the connection)
08:20:42*krydos joined #nim
08:24:25FromDiscord<luteva> Hi! I want to start using/learning macros and as my first "project" i would like to inspect an object that has a special field/property (to do some AST manipulation) and getting the caller (to intercept the call and do something before the call). So can anyone help me to start?↵I there a tutorial on macros that shows how to inspect objects, intercept calls and do something with it?
08:25:02FromDiscord<ShalokShalom> dumbTree
08:25:07FromDiscord<ShalokShalom> Gimme a second
08:25:21FromDiscord<ShalokShalom> https://dev.to/beef331/demystification-of-macros-in-nim-13n8
08:25:36FromDiscord<ShalokShalom> @luteva
08:36:51PMunch@luteva, define "intercept" a call
08:37:29PMunchWhat you'd probably do is to create some kind of wrapper handler thing
08:41:46FromDiscord<tbrekalo> Is there a way to use gRCP with nim? Or something similar?
08:44:13PMunch@tbrekalo, is there a way? Of course. Is there a ready made library for Nim? Not so much
08:46:38PMunchIf you just need some RPC maybe have a look here: https://nimble.directory/search?query=rpc
08:47:30FromDiscord<luteva> In reply to @PMunch "<@954521401073754212>, define "intercept" a": yes, exactly! any hint/starting point?
08:48:46FromDiscord<luteva> (edit) "point?" => "point?↵beside "demystification-of-macros""
08:51:58FromDiscord<tbrekalo> In reply to @PMunch "<@894896849461325844>, is there a": Thanks 🙂
08:52:42PMunch@luteva, what? I was asking you what you where trying to achieve..
08:57:32FromDiscord<Vitality> how do i stop system.nim from including <string.h>
08:58:09FromDiscord<Yardanico> In reply to @Vitality "how do i stop": first of all, why do you need that?
08:58:19FromDiscord<Vitality> osdev
08:59:10PMunchI assume something like --os:any might do it
08:59:27FromDiscord<Yardanico> for that you don't avoid it, you usually write string.h implementation in Nim code yourself (or in C if you want to) and for example just add an empty string.h header
08:59:33FromDiscord<Yardanico> that's how hobby OSes in Nim did that
08:59:59FromDiscord<Yardanico> also make sure to at least also use `-d:useMalloc --gc:arc`
09:00:17FromDiscord<Yardanico> probably you'd want `-d:danger` too because it disables all the stack tracing and stuff (although you can disable that yourself separately too)
09:00:42FromDiscord<Vitality> ok
09:05:47FromDiscord<luteva> In reply to @PMunch "<@954521401073754212>, what? I was": uh sorry! I misunderstood. so what i would like to do is: inspect an object for a property (with a given type). And whenever the object has this property, do "something special" when the object is used.
09:06:17FromDiscord<Vitality> In reply to @Yardanico "for that you don't": wait how do i write that in nim
09:06:49FromDiscord<Yardanico> you just write nim code with functions with same name as in string.h that also have the exact same argument and return types
09:06:58FromDiscord<Vitality> oh
09:08:34PMunch@luteva, yes that's the same thing you said earlier, just with the words in a slightly different order
09:08:46PMunchI still don't exactly know what you're trying to achieve
09:08:51FromDiscord<luteva> like e.g. i could do some validation. whenever an email adress is set. or do some caching cleanup/updates whenever a value has changed. or somethign like this.
09:09:10FromDiscord<Rika> you dont need macros for that
09:09:11NimEventerNew thread by drkameleon: Not able to get `in` for sets to work properly, see https://forum.nim-lang.org/t/9674
09:12:35FromDiscord<luteva> i think i need macros as a would like to build a library, that could be dropped in just by using a pragma or a property of a special type in an object. so the code that uses this library is not yet written. So as far as i understand, i need some compiletime evaluation/AST manipulation etc.
09:12:47FromDiscord<luteva> (edit) "a" => "i"
09:14:06FromDiscord<luteva> but maybe i am totally wrong and this could be easier being done without macros?
09:18:03FromDiscord<luteva> also: the main goal for me is to learn about macros. so even if it is possible without macros, it could maybe help to do the same thing in two different ways: with and without macros.
09:18:24PMunchTry to write up an example of what you want
09:19:43FromDiscord<Phil> In reply to @luteva "i think i need": If you want to do something if pragma x is present (or not do something if pragma x is present) all you need is a template to build the pragma, when statements and the typetraits lib to be able to check if a given object / field is annotated with a pragma
09:22:53FromDiscord<Stuffe> does anyone know how to call name spaced functions in a dll from nim using the dynlib library?
09:23:45FromDiscord<Stuffe> For example `lib.symAddr("Galaxy::init")` doesn't work
09:24:28PMunchC++ does name mangling much the same way Nim does doesn't it?
09:24:50PMunchSo the identifier in the binary wouldn't be called `Galaxy::init` any longer
09:25:28PMunchSince you mentioned DLL I guess you're on windows, but maybe you have something similar to `nm` on there which you can use to get the symbol table
09:29:15FromDiscord<luteva> how can i paste code? it is like ↵'''nim ↵#my code↵'''
09:29:42FromDiscord<Yardanico> yes, with triple backquotes
09:29:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4haI
09:30:10FromDiscord<ringabout> Why does `nimble publish` require password?
09:30:28FromDiscord<ShalokShalom> Which password?
09:30:36FromDiscord<ringabout> > Output: remote: Support for password authentication was removed on August 13, 2021.
09:30:37FromDiscord<Yardanico> In reply to @ringabout "Why does `nimble publish`": because it pushes to github
09:30:39FromDiscord<ShalokShalom> Someone yesterday said, it requires a Github account
09:30:44FromDiscord<Yardanico> it forks the nimble packages repo
09:30:51FromDiscord<Yardanico> adds the package to the index and crates a PR
09:30:54FromDiscord<Yardanico> (edit) "crates" => "creates"
09:31:04FromDiscord<ringabout> I use a full access token but it doesn't work.
09:31:05FromDiscord<Yardanico> In reply to @ringabout "> Output: remote: Support": yes, use a token instead
09:31:22FromDiscord<ShalokShalom> It seems to try with password.
09:31:45FromDiscord<Stuffe> In reply to @PMunch "Since you mentioned DLL": Ok thanks I will check out `nm`
09:31:50FromDiscord<Yardanico> In reply to @ShalokShalom "It seems to try": you can use the token as a password
09:31:52FromDiscord<Yardanico> on github
09:31:56FromDiscord<ShalokShalom> Ah.
09:32:45FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#ix=4haJ
09:33:34FromDiscord<arkanoid> Elegantbeef\: just landed on your blog post from 2020 about macros. Thanks! Very well done. Actually I'd be happy to read more posts like that
09:33:54FromDiscord<ringabout> In reply to @Yardanico "yes, use a token": Thanks, it is misleading. I tried with a full access token, it works.
09:34:13FromDiscord<ringabout> (edit) "works." => "works now."
09:34:21FromDiscord<Yardanico> yeah kind of, it's just not updated since nimble is not really maintained that much :P
09:34:43FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#ix=4haK
09:35:31FromDiscord<luteva> (edit) "https://play.nim-lang.org/#ix=4haK" => "https://play.nim-lang.org/#ix=4haL"
09:35:40FromDiscord<ringabout> In reply to @Yardanico "yeah kind of, it's": I mean the pop window
09:35:45FromDiscord<ringabout> https://media.discordapp.net/attachments/371759389889003532/1047083432393576478/image.png
09:36:40FromDiscord<ringabout> (edit) "In reply to @Yardanico "yeah kind of, it's": I mean the pop window ... " added "of GitHub"
09:36:41FromDiscord<Yardanico> well blame github for that
09:36:53FromDiscord<Yardanico> vscode just does the usual Git stuff, and Git knows username and password
09:37:01FromDiscord<Yardanico> it is github that removed password auth and replaced it with tokens :P
09:37:57FromDiscord<ringabout> Yeah
09:38:50FromDiscord<ShalokShalom> Funny, considering they are both done my the same company
09:39:00FromDiscord<Yardanico> In reply to @ShalokShalom "Funny, considering they are": what?
09:39:06FromDiscord<Yardanico> ah, you mean vscode, meh
09:39:11FromDiscord<Yardanico> vscode integrates with Git first of all
09:39:24FromDiscord<Yardanico> that popup is integrated with git, not github
09:39:49FromDiscord<ShalokShalom> Yep
09:39:52FromDiscord<ShalokShalom> I know
09:39:59FromDiscord<ShalokShalom> Still, it creates issues
09:40:21FromDiscord<ShalokShalom> And I mean, VSCode could at least say "Password or Token"
09:40:39FromDiscord<ShalokShalom> That would already create a much clearer context 🙂
09:50:39FromDiscord<ringabout> https://github.com/nim-lang/packages/pulls/ringabout more stdlibs are going to move to nimble packages, especially some libraries which are used internally.
09:52:35FromDiscord<ringabout> Once I can manage to have the corresponding PR pass CI.
10:10:53*dnh joined #nim
10:19:51NimEventerNew Nimble package! asyncftpclient - FTP client implementation (originally in the stdlib)., see https://github.com/nim-lang/asyncftpclient
10:35:27FromDiscord<emanresu3> Is there a way to coalesce a seq indexation to false if the index is not reachable?
10:37:02NimEventerNew post on r/nim by ModishNouns: xmltree: Attrs in closing tag?, see https://reddit.com/r/nim/comments/z7qdlc/xmltree_attrs_in_closing_tag/
10:37:20FromDiscord<Yardanico> In reply to @emanresu3 "Is there a way": what do you mean by false? and no, I don't think there is if you mean "return something else if seq doesn't have this index"
10:37:33FromDiscord<Yardanico> but it's just a few lines of code to do
10:39:29FromDiscord<emanresu3> If I want to grab myseq[3], but there's no element in index 3, I would like to get false
10:39:52FromDiscord<Yardanico> but wouldn't that be a different type from your seq's type?
10:39:55FromDiscord<Yardanico> or your seq contains booleans?
10:40:18FromDiscord<Yardanico> nim is statically typed after all, so if you want multiple types then you need extra stuff like object variants
10:40:25FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4haS
10:40:26FromDiscord<Yardanico> this is what i meant with just a few lines of a proc
10:40:29FromDiscord<Kermithos> In reply to @ringabout "https://github.com/nim-lang/packages/pulls/ringabou": will httpclient be moved out of the stdlib too?
10:40:43FromDiscord<ringabout> No
10:40:59FromDiscord<Yardanico> In reply to @Kermithos "will httpclient be moved": httpclient is used quite commonly white asyncftpclient not at all :P
10:41:16FromDiscord<Kermithos> yea thats true
10:41:37FromDiscord<Kermithos> so only unpopular packages are moved out of stdlib?
10:41:41FromDiscord<ringabout> Only if it doesn't break too many important packages because I'm too lazy to fix them all 😛
10:41:57FromDiscord<ringabout> There is a RFC
10:42:19FromDiscord<ringabout> (edit) "a RFC" => "an RFC."
10:42:48FromDiscord<ringabout> (edit) "There" => "Joking aside, there" | "RFC." => "RFC for the list."
10:43:22FromDiscord<emanresu3> No it doesn't, yeah my bad. I'm instead trying to get a boolean comparing a seq's value↵(@Yardanico)
10:43:30FromDiscord<ringabout> In reply to @Kermithos "so only unpopular packages": https://github.com/nim-lang/RFCs/issues/473
10:43:45FromDiscord<Yardanico> In reply to @emanresu3 "No it doesn't, yeah": can you show example code that you'd like to work?
10:43:49FromDiscord<Kermithos> okay, thank you
10:44:32FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#ix=4haT
10:44:43FromDiscord<emanresu3> In a loop
10:45:14FromDiscord<emanresu3> So when the seq is empty, indexation no longer works and I'd like to get a false from that comparison
10:45:49FromDiscord<Yardanico> you can make it simpler, and actually should, since modifying a seq during iteration isn't really allowed
10:46:34FromDiscord<Yardanico> but again, instead of those you can just check the seq length
10:46:43FromDiscord<Yardanico> you don't need any special stuff, just check if seq length is == 0
10:48:50FromDiscord<emanresu3> Yeah, I tried with with sorting the array first, and then pop, but still there's an error at some point, I could check the seq's length, but I didn't want to add another conditional, since entering that loop already checks the seq's length↵(@Yardanico)
10:49:23FromDiscord<Yardanico> then can you give a bit more code? I don't see how checking if the seq is empty is different from checking `seq.length == 0`
10:49:28FromDiscord<Yardanico> (edit) "`seq.length" => "`seq.len"
10:50:15FromDiscord<Yardanico> i just feel like your code can be implemented in a shorter way but I don't know what exactly you want to do with the seq values and seq itself
10:50:59FromDiscord<emanresu3> alright just give me a minute
10:55:32FromDiscord<luteva> In reply to @Isofruit "If you want to": do you have any concrete example of that?
10:55:59FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4haV
10:56:15FromDiscord<ShalokShalom> (edit) "http://ix.io/4haV" => "http://ix.io/4haW"
10:56:45FromDiscord<Yardanico> I don't think "functionalprogramming" is a good tag though :P
10:57:00FromDiscord<ShalokShalom> Yeah, I didnt knew how to do that
10:57:00FromDiscord<Yardanico> just "functional"
10:57:04FromDiscord<emanresu3> Hello @ShalokShalom that's awesome, thanks a lot!↵(@ShalokShalom)
10:57:06FromDiscord<ShalokShalom> yeah, was thinking about that
10:57:16FromDiscord<ShalokShalom> Can I just add a PR, that changes that?
10:57:22FromDiscord<ShalokShalom> Ah, I know how to do.
10:57:24FromDiscord<Yardanico> just edit your PR itself?
10:57:28FromDiscord<ShalokShalom> Yeah
10:57:30FromDiscord<Yardanico> no need to create another one
10:57:59FromDiscord<emanresu3> Here's the code I'm trying to simplify https://codeberg.org/emanresu3/nim-pipexp/src/commit/6acf3675541b7ebef866af301887538696eb4792/src/pipexp.nim#L33↵(@Yardanico)
10:59:28FromDiscord<ShalokShalom> done
10:59:48FromDiscord<ShalokShalom> In reply to @Yardanico "no need to create": yeah, this was what I meant, its just early in the morning and my English is still sleeping 😄
11:01:41FromDiscord<emanresu3> So I'm doing an `in` in the conditional, but since the seq `u` is sorted I though I could optimize it by checking the first index [0] and then deleting the first element. But if I do that, when the seq is empty it raises an error
11:02:13FromDiscord<Yardanico> well optimization here is really a minor thing since it's a macro and doesn't do thousands of iterations, so it's all precomputed at compile-time and doesn't affect runtime
11:02:21FromDiscord<Yardanico> i don't think deleting the elements would actually speed it up
11:03:37FromDiscord<Yardanico> but if you meant shorten, you can for example replace that loop with ` for i, elem in fn: result.add if i in u: arg else: elem`
11:03:43FromDiscord<Yardanico> with the newlines back of course :P
11:03:59FromDiscord<emanresu3> I see, I thought so, and since this is an operator that pipes into another proc, I don't think people should use that many parameters in their procs to begin with
11:05:08FromDiscord<Yardanico> does the multiple placeholder branch already has tests for that?
11:05:17FromDiscord<Yardanico> so i can check
11:08:21FromDiscord<emanresu3> Not yet, I'll add them in a bit when I put the new proc in the other `pipe` macro↵(@Yardanico)
11:08:47FromDiscord<Phil> sent a long message, see http://ix.io/4hb2
11:09:40FromDiscord<Phil> (edit) "http://ix.io/4hb2" => "http://ix.io/4hb3"
11:09:58FromDiscord<Yardanico> In reply to @emanresu3 "I see, I thought": wait so this multiple placeholder thing is only for when people want to pass the same argument more than once?
11:10:27FromDiscord<Phil> (edit) "http://ix.io/4hb3" => "http://ix.io/4hb4"
11:10:43FromDiscord<Yardanico> also you can just remove the separate conditional for u.len == 0, since you check with `in` anyway and if `u` is empty then it'll just never hit that branch
11:15:10FromDiscord<Phil> Sometimes I wonder if I'm overdoing it with my desire to do all the stuff that I do in generics and with compiletime procs
11:15:21FromDiscord<Phil> But it just works so well
11:17:40FromDiscord<emanresu3> @Yardanico\: I just pushed tests for that branch↵(@Yardanico)
11:18:07FromDiscord<Yardanico> okay
11:18:18FromDiscord<emanresu3> Yeah, to multiple arguments, do you think is it not a good idea?↵(@Yardanico)
11:18:49FromDiscord<Yardanico> i mean it's nice to support, but I doubt anyone would actually need that
11:18:50FromDiscord<emanresu3> The argument comes from a previous pipe so I though it would be convinient
11:18:55FromDiscord<luteva> In reply to @Isofruit "Sometimes I wonder if": one day, every developer will do so and we all know why.... it's just a matter of time 😄
11:19:06FromDiscord<Yardanico> i mean passing the same argument multiple times into the same proc
11:19:18FromDiscord<Yardanico> but it's okay to support it, even for consistency
11:20:39FromDiscord<luteva> so: declaring a custom pragma is (always?) done using a template? or is this just a specific case?
11:20:51FromDiscord<luteva> (edit) "specific" => "special"
11:24:10FromDiscord<emanresu3> It doesn't pass `nimble test` thou↵(@Yardanico)
11:24:30FromDiscord<Yardanico> yeah I didn't fully understand the code when i said that, now I do :P
11:24:48FromDiscord<emanresu3> I'll add comments, yeah
11:25:58FromDiscord<Yardanico> i mean your code looks simple enough already, there isn't much left to simplify
11:27:35FromDiscord<Yardanico> well there is one possibility of shortening it a bit
11:29:16FromDiscord<Yardanico> or not, I thought you can insert 1 to u if it's empty, but it changes the code because fn[1] wouldn't get inserted
11:30:24FromDiscord<Yardanico> even then you can shorten it, but it'll be a bit weird
11:30:39FromDiscord<Yardanico> basically this https://media.discordapp.net/attachments/371759389889003532/1047112350672633886/image.png
11:30:55FromDiscord<Yardanico> it will always check `if i in u` even if u is empty, but we get less code :P
11:31:05FromDiscord<Yardanico> and it wouldn't really matter for compilation speed at this scale
11:40:43FromDiscord<Phil> In reply to @luteva "so: declaring a custom": I'm not sure about always or if it's even possible to do with macros, but I haven't seen a usecase where I'd need to do it in any other way.↵I can only exclude procs so far from being able to do pragmas... on the sole basis that I've never seen it done
11:41:39FromDiscord<Phil> This is a "special case" in the sense though that it's a pragma with a value
11:41:40FromDiscord<luteva> In reply to @Isofruit "I'm not sure about": oh i found it:↵https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations
11:42:05FromDiscord<luteva> (edit) "it:↵https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations" => "it:↵https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations↵so thx, phil!"
11:42:07FromDiscord<Yardanico> yeah for pragma _annotations_ you just use templates with the pragma pragma
11:42:21FromDiscord<Yardanico> yes, it is called a pragma pragma btw
11:42:22FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma
11:42:28FromDiscord<Yardanico> pragma pragma pragma pragma
12:20:03NimEventerNew thread by sls1005: Ideas about the exception-tracing system, see https://forum.nim-lang.org/t/9675
12:37:30FromDiscord<emanresu3> Oh interesting, thanks, yeah if the code is so small then it wouldn't matter, but I'm thinking if anyone would use this pipe operator thousands of times in their codebase, their compilation time could scale badly↵(@Yardanico)
12:37:57FromDiscord<Yardanico> nope, I think even 1000 times wouldn't slow it down at all
12:38:27FromDiscord<Yardanico> You can actually check, just generate a Nim file with 10000 lines :P
12:40:53FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4hbi
12:41:28FromDiscord<sOkam!> it seems to be breaking the code that i had before, which was using `GLEnum` from nimgl/opengl. But switched to the official bindings and having this probl
12:50:43FromDiscord<Phil> In reply to @sOkam! "Can you define a": IIRC types are compile-time information that goes away at runtime
12:50:48FromDiscord<Phil> (edit) "goes" => "go"
12:51:16FromDiscord<Phil> Feel free to correct me here Yard, that's just how I keep explaining to myself why I can't have seqs of typedescs
12:52:45FromDiscord<Phil> ~~Because if I could have seqs of typedescs, my job with snorlogue would be a crapton easier~~
13:08:24FromDiscord<arkanoid> In my head types just vanish during compilation. They don't/can't exist at runtime
13:08:37FromDiscord<arkanoid> Correct me too if I'm wrong
13:12:33FromDiscord<sOkam!> nvm, i was needing to use `cGL_FLOAT` which is a GLEnum, instead of `GLFloat` which is a typedesc 🤷‍♂️
13:42:42*bola joined #nim
13:45:41*bola quit (Client Quit)
13:48:48*derpydoo joined #nim
13:55:41FromDiscord<ali> More nuanced I'd say. Size differences obviously remain
13:57:07FromDiscord<huantian> The object will keep type information if you make it an `object of RootObj`
14:15:04FromDiscord<ali> More nuanced I'd say. Size differences obviously remain (so do floats) [realised this is entirely unrelated]
14:29:41FromDiscord<VisakhChekur (VisakhChekur)> Hi. I just started learning Nim and I was going through Nim in Action. It mentions that sets are used to represent a collection of unique flags whereas in C flags are represented by integers. It also mentions that the approach taken by C is unsafe. Why is that?
14:42:05*derpydoo quit (Ping timeout: 265 seconds)
14:42:39FromDiscord<planetis> well it's simple, if a function takes an enum the parameter is of that type, but when it expects a set it's set[T]
14:43:51FromDiscord<planetis> but with C bit flags it's all the same, so you can pass an OR'ed values when it should have been just a single flag
15:01:49*PMunch quit (Quit: Leaving)
15:38:03*LuxuryMode joined #nim
15:40:14*Phytolizer joined #nim
15:42:38FromDiscord<A Very Merry Reimu ッ> when is the general rule of using `method` vs `func`/`proc`
15:46:54Phytolizer`method` is for when you need dynamic dispatch, ie when you're doing OOP. if you aren't doing that, the other two are preferable
15:49:05FromDiscord<A Very Merry Reimu ッ> will `method` allow me to have two "classes" with seperate `visit` functions defined?
15:50:04Phytolizeryes, and itll pick the correct one
15:50:20FromDiscord<A Very Merry Reimu ッ> so then i would want to use method right
15:50:28Phytolizerwhereas if you have a base object ref and call a proc on it, it will always pick the base version
15:50:37Phytolizeryeah that application makes sense
15:51:37FromDiscord<choltreppe> is there a way to get line/column num of where NimNode is in code ?
15:56:09NimEventerNew Nimble package! smtp - SMTP client implementation (originally in the stdlib)., see https://github.com/nim-lang/smtp
16:05:25*derpydoo joined #nim
16:10:30FromDiscord<locria> How do I hide a field from struct in the default `$` implementation
16:26:48*Phytolizer quit (Ping timeout: 260 seconds)
16:27:58*Phytolizer joined #nim
16:30:12FromDiscord<auxym> define your own $ implementation
16:31:48*wallabra quit (Ping timeout: 265 seconds)
16:35:17NimEventerNew thread by samdze: Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC, see https://forum.nim-lang.org/t/9676
16:36:57*wallabra joined #nim
16:42:12*wallabra quit (Ping timeout: 264 seconds)
16:58:42*wallabra joined #nim
17:09:33FromDiscord<Phil> Question, anyone have an idea how these docs were generated?↵http://filcuc.github.io/nimqml/
17:11:23FromDiscord<locria> nimdoc
17:11:33FromDiscord<locria> (edit) "nimdoc" => "nim doc"
17:11:43FromDiscord<Jessa> Woot, working custom REPL for windows https://media.discordapp.net/attachments/371759389889003532/1047198185690505296/2022-11-29_18-09-59.mp4
17:13:10FromDiscord<Phil> Hmmm I've only seen those for doc-comments for individual modules
17:28:46*jmdaemon joined #nim
17:39:25*pro joined #nim
17:39:59*pro left #nim (#nim)
17:54:19FromDiscord<@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4hcU
17:54:47FromDiscord<@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4hcV
17:54:51FromDiscord<@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4hcU
18:00:14FromDiscord<@thatrandomperson5-6310e3b26da03> Never mind, i found the issue
18:07:07*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:07:34*dnh joined #nim
18:11:21FromDiscord<@thatrandomperson5-6310e3b26da03> How would i do these charchters and not those, right now im using this\: `{' '..'~'} !{'\\','"'}` and i don’t think it’s working
18:12:11*dnh quit (Ping timeout: 264 seconds)
18:22:31FromDiscord<Phil> I will admit I could read pretty much none of that... was that because matrix mangled it up?
18:22:46FromDiscord<Phil> This is what I got https://media.discordapp.net/attachments/371759389889003532/1047216065769373757/image.png
18:23:16FromDiscord<Phil> Can't say I understand anything that's going on there
18:29:37FromDiscord<hotdog> In reply to @@thatrandomperson5-6310e3b26da03 "How would i do": You can subtract sets, try `({' '..'~'} - {'\\','"'})`
18:29:49FromDiscord<hotdog> Though it might not work in npeg
18:30:02FromDiscord<hotdog> (thatrandomperson5-6310e3b26da03)
18:30:57FromDiscord<hotdog> In reply to @Isofruit "Can't say I understand": I think peg parser grammar using https://github.com/zevv/npeg
18:31:15NimEventerNew post on r/nim by Outrageous_Stomach_8: Godot projects to learn from, see https://reddit.com/r/nim/comments/z81v2t/godot_projects_to_learn_from/
18:43:10*ltriant joined #nim
18:48:19*ltriant quit (Ping timeout: 260 seconds)
19:40:18*arkurious joined #nim
19:43:42FromDiscord<ShalokShalom> Hey, that looks quite cool
19:43:43FromDiscord<ShalokShalom> https://github.com/status-im/questionable
19:45:13*pro joined #nim
19:45:54FromDiscord<huantian> `?!int` always looked kinda funny fro me
19:45:58FromDiscord<huantian> it's like they're confused and angry
19:46:21FromDiscord<huantian> it is cool tho
19:51:32FromDiscord<ShalokShalom> yeah
19:51:38FromDiscord<ShalokShalom> I like it cause its expressive
19:51:50FromDiscord<ShalokShalom> And true, it looks like its angry and confused a bit ^^
20:28:29FromDiscord<guttural666> sent a long message, see http://ix.io/4hdP
20:30:51FromDiscord<amadan> You could use `inNanoseconds` first (or one of the other inUnit procs for what ever precision you want) and then get the average time in that unit
20:32:37FromDiscord<guttural666> In reply to @amadan "You could use `inNanoseconds`": yeah, this sounds really reasonable, gonna try and implement that
20:32:43FromDiscord<guttural666> thanks!
20:39:41FromDiscord<guttural666> just made sure my expected micro seconds won't overflow an int64 like an idiot 😄
20:45:22*pro quit (Quit: pro)
20:45:37*pro joined #nim
20:53:47*ltriant joined #nim
20:55:34FromDiscord<Yepoleb> i always work in float seconds whenever it is reasonable
21:05:30*junaid_ joined #nim
21:07:20FromDiscord<guttural666> user will know millisecond differences, so I'm choosing microseconds
21:07:27FromDiscord<guttural666> (edit) "user" => "users"
21:08:14FromDiscord<guttural666> any tips on how to juggle int <> int64 conversions, most algos in the std seem to be written for the more generic int
21:08:39FromDiscord<guttural666> time prefers the explicit 64 bit int so the compiler is mad at me 🙂 https://media.discordapp.net/attachments/371759389889003532/1047257807981912184/image.png
21:08:50FromDiscord<guttural666> toFloat uses the generic int
21:09:29*pro quit (Quit: pro)
21:09:39FromDiscord<Generic> What function do you need which is only available for int?
21:11:13FromDiscord<guttural666> the avg time calculation foldl all the int64 durations and devides it by the int64 number of items, which yields an int64, which toFloat does not approve of 😄
21:11:37FromDiscord<Generic> Ah the string functions
21:12:00FromDiscord<Generic> Don't they use BiggestInt though?
21:12:24FromDiscord<guttural666> string functions=
21:12:25FromDiscord<guttural666> ?
21:12:34FromDiscord<guttural666> (edit) "functions=" => "functions?"
21:12:43FromDiscord<guttural666> not using any here
21:13:19FromDiscord<Generic> Eh yeah I somehow had addFloat in my head sorry
21:13:53FromDiscord<Generic> For conversion between number types just use the type as a function call
21:14:05FromDiscord<guttural666> toFloat expects an int which on my machine is in fact 64 bit, but the compiler isn't happy with me giving an int64 ^^
21:14:07FromDiscord<Generic> Like C++ style casts
21:14:16FromDiscord<guttural666> oh okay
21:14:36FromDiscord<Generic> I'm not sure why toFloat is a thing
21:15:12FromDiscord<Generic> might be something old (and I'm already using Nim for quite a few years)
21:17:08FromDiscord<guttural666> amazing, thanks, didn't even know that kind of casting yet
21:17:58FromDiscord<guttural666> and it does compile 🙂 not the prettiest thing in the world but if I have to use force, I shall xD https://media.discordapp.net/attachments/371759389889003532/1047260151641554994/image.png
21:18:44FromDiscord<guttural666> In reply to @Generic "I'm not sure why": curious, why you think that should not be a thing, how would you handle that?
21:19:38FromDiscord<Generic> Because the other casts exist
21:20:09FromDiscord<guttural666> casting was kind of looked down upon in cpp
21:21:07FromDiscord<Generic> Well yes it is better to keep things in one type as long as possible
21:21:22FromDiscord<guttural666> maybe templating things like toFloat to be able to deal with var len integers? I dunno
21:21:49FromDiscord<Generic> There is no such thing in the language or the stdlib
21:22:08FromDiscord<guttural666> no? generics?
21:22:12FromDiscord<guttural666> or whats the term
21:22:30FromDiscord<guttural666> proc pls[T](thing: T)
21:22:35FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4he4
21:22:46FromDiscord<Generic> Haha
21:23:19FromDiscord<Generic> In reply to @guttural666 "proc pls[T](thing: T)": I still don't understand what you mean
21:23:52FromDiscord<Generic> For a moment I thought you meant arbitrarily sized integers
21:24:15FromDiscord<guttural666> yeah, beginning to think I haven't thought this through on a deeper level hahaha
21:24:25FromDiscord<pyolyokh> you wouldn't need templating, you'd just need another `toFloat` overloaded for the other type you want to handle
21:25:08FromDiscord<guttural666> or wait, aren't int and int64 distinct types
21:25:14FromDiscord<guttural666> templating should work then
21:25:21FromDiscord<Generic> Also I think one thing to consider is that Nim type conversions (iirc that's their proper name) are different from casts
21:25:30FromDiscord<pyolyokh> you still wouldn't need templating. Just a `proc toFloat(i: int64) = float = ...`
21:25:57FromDiscord<guttural666> In reply to @pyolyokh "you still wouldn't need": sure that would be human function overloading vs. compiler function overloading
21:25:58FromDiscord<Generic> I've been saying cast the whole time, but they're actually something and indeed unsafe
21:26:02FromDiscord<guttural666> same thing
21:26:26FromDiscord<Generic> (edit) "I've been saying cast the whole time, but they're actually something ... and" added "different"
21:26:42FromDiscord<guttural666> (but you do the mental work and typing vs. the computer 😄 )
21:27:10FromDiscord<pyolyokh> OK, what you mean is that that a generic toFloat could take any type and float(x) it.
21:27:40FromDiscord<guttural666> yes and it would instantiate the appropriate version, i dunno I'm a pleb coming from c++
21:27:52FromDiscord<pyolyokh> and this would've saved you the trouble of noticing that stdlib doesn't have a lot of support for int64
21:28:37FromDiscord<pyolyokh> that's easy to understand, I was just confused by the way you introduced the topic
21:29:05FromDiscord<guttural666> In reply to @pyolyokh "and this would've saved": I too am confused about my thoughts so no worries mate hahaha
21:30:01FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4he6
21:31:59FromDiscord<guttural666> yeah, wonder why this is not the standard way to do things, don't even know if these nim templates have the same problems the cpp ones have
21:32:39FromDiscord<guttural666> most of what I've seen in the std seems to be type explicit i.e. using system dependent types
21:33:30FromDiscord<guttural666> things like time of course require a certain type width to fit etc. so it's enforced there
21:33:32FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4he9
21:33:46FromDiscord<4zv4l> `time ./crunch 5 8 abcdefgh > wd.txt`
21:33:50FromDiscord<4zv4l> that's how I benchmark it
21:34:04FromDiscord<pyolyokh> they have similar potential problems of confusing error messages, taking longer to compile, not existing unless instantiated (usually a plus), resulting in N instantiations when used with N types (mixed bag). And they might fight with the benefits of distinct types: you go to the trouble of saying "this is a special int, don't just treat it like an int" and then the generic toFloat instantiates for it anyway
21:34:11FromDiscord<Generic> In reply to @guttural666 "and it does compile": You can just directly cast int64 to float
21:34:46FromDiscord<Generic> Also writing it like C style casts does work
21:34:49FromDiscord<guttural666> In reply to @pyolyokh "they have similar potential": yeah makes sense, thanks for your insight
21:34:56FromDiscord<Generic> But it's dangerous
21:35:17FromDiscord<guttural666> In reply to @Generic "But it's dangerous": there be dragons, even in Nim
21:35:23FromDiscord<guttural666> haha
21:35:54FromDiscord<Generic> (int)variable is the same as int variable
21:36:06FromDiscord<Generic> So command style calling
21:36:21FromDiscord<Generic> So it binds differently
21:36:50FromDiscord<Generic> Casting has very high precedence in C
21:36:53FromDiscord<guttural666> yeah, so if say my times would overflow an int32 and I'm forcing it into one just do use a convenient abstraction, I may get fucked
21:36:56FromDiscord<huantian> In reply to @4zv4l "`time ./crunch 5 8": I would try timing just the computational parts of each code
21:37:13*junaid_ quit (Remote host closed the connection)
21:37:33FromDiscord<Generic> In reply to @guttural666 "yeah, so if say": For conversions to signed types you get an overflow defect
21:37:45FromDiscord<huantian> (edit) "code" => "code, remove any variance due to printing and such"
21:37:46FromDiscord<guttural666> In reply to @huantian "I would try timing": not a benchmark, it's a gui thing
21:37:55FromDiscord<4zv4l> In reply to @huantian "I would try timing": you mean that would be the redirection the issue ?
21:37:59FromDiscord<Generic> Unsigned types are defined to always mask in Nim
21:38:33FromDiscord<guttural666> (edit) "In reply to @huantian "I would try timing": not a benchmark, it's a gui thing ... " added "(sorry, got confused with the profile pics)"
21:39:24FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4hec
21:39:28FromDiscord<guttural666> In reply to @Generic "Unsigned types are defined": you mean they just loose precision and nothing more
21:39:44FromDiscord<Generic> You loose the upper bits
21:40:00FromDiscord<Generic> Which don't fit
21:40:07FromDiscord<guttural666> In reply to @Generic "You loose the upper": which is basically what I said yeah?
21:40:22FromDiscord<Generic> Well no
21:40:24FromDiscord<guttural666> oh no it's not with int
21:40:30FromDiscord<4zv4l> In reply to @pyolyokh "some possibilities: 1. you": with danger it goes wayyyyyyyy faster, why ?
21:40:32FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4hed
21:40:39FromDiscord<Generic> Loosing precision would be loosing lower bits
21:40:49FromDiscord<guttural666> In reply to @Generic "Loosing precision would be": yeah, so I'm fucked haha
21:40:56FromDiscord<Generic> Yeah
21:41:08FromDiscord<guttural666> (edit) "In reply to @Generic "Loosing precision would be": yeah, so I'm fucked ... haha" added "and my earlier statement was correct"
21:41:14FromDiscord<Generic> Unsigned in Nim is for low level worj
21:41:16FromDiscord<pyolyokh> In reply to @4zv4l "with danger it goes": what were you doing before? -d:release ? If not even that, you're making a debug build with -Og passed to the C compiler. With -d:danger you strip asserts and range checks.
21:41:37FromDiscord<Generic> (edit) "worj" => "work"
21:41:41FromDiscord<4zv4l> I was doing↵`nim c --opt:speed --d:release --d:useMalloc crunch`
21:42:11FromDiscord<guttural666> In reply to @Generic "Unsigned in Nim is": yeah, okay got a good grasp on the situation now, thanks so much for helping, really helped me understand @pyolyokh thank you as well!
21:42:52FromDiscord<4zv4l> In reply to @pyolyokh "also, `echo` might flush": well in C stdout is new newline buffered right ? just like echo in nim I guess
21:43:00FromDiscord<huantian> Also not really relevant but the fact that lines and bytes are floats and not ints is cursed to me ↵Ig it makes slightly more sense for huge values but still
21:43:35FromDiscord<pyolyokh> In reply to @4zv4l "well in C stdout": typically libc decides between line- or block- buffering based on a tty check, probably of stdout
21:45:12FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4hee
21:45:27FromDiscord<pyolyokh> in the second case you'll get a single write() syscall for the first loop, then ten syscalls for each of the echos
21:45:33FromDiscord<pyolyokh> because `echo` flushes
21:45:57FromDiscord<guttural666> In reply to @Generic "Unsigned in Nim is": I'm thinking doesn't any (int)int64 instantly make your application incompatible with 32 bit machines? i think int just means this or the other when compiling right? I think 32 bit machines have ways to deal with 64 bit integers?
21:46:00FromDiscord<pyolyokh> in the first case you get twenty syscalls because libc decided to line buffering
21:46:47FromDiscord<Generic> In reply to @guttural666 "I'm thinking doesn't any": Yes, it will just be slower
21:47:11FromDiscord<4zv4l> In reply to @pyolyokh "some possibilities: 1. you": is there another way I could use to concat the string then ?
21:47:21FromDiscord<Generic> So e.g. one add will be an add and an adc
21:47:27FromDiscord<guttural666> In reply to @Generic "Yes, it will just": okay, so the compilation target still fixes those things, was just wondering
21:47:59FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4heg
21:48:14FromDiscord<Generic> Also don't use the C style casts 😬
21:48:14FromDiscord<4zv4l> I gain 30% speed
21:48:40FromDiscord<guttural666> In reply to @Generic "Also don't use the": only if I have to haha, but very insightful discussion thanks a lot for the insight
21:48:57FromDiscord<Generic> No you never have to
21:49:11FromDiscord<Generic> I think you might have misunderstood me
21:49:42FromDiscord<Generic> I when I say C style cast I mean (int)variable
21:49:56FromDiscord<Generic> Those only work accidentally in Nim
21:50:18FromDiscord<Generic> When I say C++ style casts I mean int(variable)
21:50:59FromDiscord<Generic> Thanks to universal calling convention you can also write variable.int
21:51:15FromDiscord<Generic> Or int variable
21:51:57FromDiscord<Generic> (edit) "Thanks to universal ... calling" added "function" | removed "convention"
21:52:38FromDiscord<pyolyokh> In reply to @4zv4l "is there another way": `s.add c`
21:52:59FromDiscord<guttural666> In reply to @Generic "Or int variable": so these should be the same https://media.discordapp.net/attachments/371759389889003532/1047268963060547774/image.png
21:53:21FromDiscord<Generic> Yes
21:53:48FromDiscord<Generic> But (int)a+b in Nim is int(a+b)
21:54:12FromDiscord<Generic> While in C++ it is ((int)a)+b
21:54:22FromDiscord<guttural666> yeah, got tripped up by some of that when iffing and if notting etc.
21:54:31FromDiscord<guttural666> yeah yeah
21:55:46FromDiscord<guttural666> the .int() syntax is way better imo
21:56:17FromDiscord<guttural666> well I actually don't know, (int) does seem to be more expressive, since this is not a normal occurrence
21:59:17FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4hei
22:02:21FromDiscord<4zv4l> well mostly changing from `echo` to `c_printf` changed everything
22:03:04FromDiscord<4zv4l> with echo: `./crunch 5 8 abcdefgh > wd.txt 3,08s user 18,53s system 99% cpu 21,624 total`
22:03:06FromDiscord<huantian> slapping it in benchy gives me a 5x improvement without the string allocs it seems
22:03:12FromDiscord<guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4hem
22:03:24FromDiscord<4zv4l> with c_printf `./crunch 5 8 abcdefgh > wd.txt 0,68s user 0,10s system 99% cpu 0,783 total`
22:03:35FromDiscord<4zv4l> In reply to @huantian "slapping it in benchy": I'll check that
22:03:53FromDiscord<4zv4l> In reply to @guttural666 "you are aware that": lmao what ? what's the sin ?
22:04:13FromDiscord<guttural666> In reply to @4zv4l "lmao what ? what's": such heresy cannot remain unanswered haha
22:04:18FromDiscord<guttural666> just kidding haha
22:04:51FromDiscord<guttural666> the fool comes blasting in here claiming Nim is slow, ridiculous! the king shall hear of this hahaha
22:04:58FromDiscord<guttural666> I'm a bit stupid tonight
22:08:01FromDiscord<4zv4l> with this code
22:08:08FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4hep
22:08:09FromDiscord<4zv4l> I get same performance as C
22:08:23FromDiscord<4zv4l> well
22:08:24FromDiscord<4zv4l> almost
22:08:34FromDiscord<4zv4l> 0.550 Nim↵0.450 C
22:08:55FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4heq
22:09:09FromDiscord<huantian> no need for the float conversions
22:09:10FromDiscord<huantian> (edit) "https://play.nim-lang.org/#ix=4heq" => "https://play.nim-lang.org/#ix=4her"
22:10:20FromDiscord<huantian> probably has minimal speed implications but just in case
22:11:00*Phytolizer quit (Remote host closed the connection)
22:11:20*Phytolizer joined #nim
22:11:46FromDiscord<4zv4l> I changed, indeed much cleaner
22:12:59FromDiscord<4zv4l> and
22:13:03FromDiscord<4zv4l> exactly the same speed as C
22:13:05FromDiscord<4zv4l> if not faster
22:13:12FromDiscord<4zv4l> 0.434 Nim
22:13:20FromDiscord<4zv4l> what does `-d:danger` does ?
22:13:29FromDiscord<huantian> it disables bound checks
22:13:37FromDiscord<4zv4l> oh it doesn't change the speed
22:13:44FromDiscord<4zv4l> gonna remove the flag then
22:14:27FromDiscord<huantian> yeah it can have speed improvements based on the situation
22:14:33FromDiscord<4zv4l> In reply to @4zv4l "oh it doesn't change": I meant I tried now and it didn't change it
22:14:44FromDiscord<4zv4l> well
22:14:47FromDiscord<4zv4l> pretty amazed
22:14:52FromDiscord<4zv4l> same speed as C
22:24:07FromDiscord<guttural666> In reply to @4zv4l "0.550 Nim 0.450 C": this is what we want to see haha
22:24:30FromDiscord<huantian> yeah Nim can definitely be as fast as C, just depends on the code!
22:25:25FromDiscord<guttural666> yeah, that [depending on the code] is a huge question mark in most cases, especially stuff like c++
22:25:32FromDiscord<guttural666> sadly
22:27:50FromDiscord<guttural666> languages that give you the tools to and through bad training for decades have encouraged shit software engineering will result in really bad performance, even if stuff like c++ theoretically is really just better c
22:28:26FromDiscord<guttural666> (edit) "c" => "c, will always yield bad results"
22:28:46FromDiscord<4zv4l> I'm wondering why people still write tools in C when there is a language like Nim
22:29:00FromDiscord<4zv4l> I got interested in Nim again because of `dnscat2` in which the client is made in C
22:29:04FromDiscord<4zv4l> could totally be made in Nim
22:29:11FromDiscord<A Very Merry Reimu ッ> im torn between loving this language, and really really really hating parts of it
22:29:11FromDiscord<4zv4l> would be easier to read/write/improve/...
22:29:20FromDiscord<guttural666> In reply to @4zv4l "I'm wondering why people": I do too honestly, I pray for a GUI framework like Qt in Rust, Nim, Zig, Odin every day
22:29:29FromDiscord<A Very Merry Reimu ッ> anyone else relate?
22:29:38FromDiscord<guttural666> In reply to @A Very Merry Reimu ッ "anyone else relate?": talking about c++?
22:29:41FromDiscord<A Very Merry Reimu ッ> nim
22:29:56FromDiscord<A Very Merry Reimu ッ> i love the syntax but hate the objects/enum types
22:30:08FromDiscord<4zv4l> the thing that is missing about Nim is a bigger amount of libraries to me
22:30:09FromDiscord<A Very Merry Reimu ッ> i am not a fan of pascal style OOP
22:30:32FromDiscord<4zv4l> like I am coding in Perl now mostly because Ruby didn't have the libs I needed for networking
22:30:49FromDiscord<4zv4l> and the only advantage Go has over Nim to me, is the amount of libs
22:31:29FromDiscord<guttural666> In reply to @A Very Merry Reimu ッ "i love the syntax": started couple weeks ago, already wrote 2 console apps, loving it every step of the way, the cock and ball torture that was reflection less c++ in 22 was just a faint memory
22:31:41FromDiscord<A Very Merry Reimu ッ> not on about that
22:31:46FromDiscord<4zv4l> same goes for Zig, missing some libs to me↵and I don't wanna write wrappers for each libs I need
22:31:54FromDiscord<A Very Merry Reimu ッ> having to prefix enums and not having proper ADTs like in rust/haskell
22:32:16FromDiscord<A Very Merry Reimu ッ> but then also not having a fully baked OOP w/ inheritance either
22:32:28FromDiscord<A Very Merry Reimu ッ> (edit) "enums" => "enum members to avoid conflicts"
22:32:36FromDiscord<A Very Merry Reimu ッ> these are the only things i dislike
22:32:43FromDiscord<A Very Merry Reimu ッ> dont get me wrong the language is greta
22:32:49FromDiscord<A Very Merry Reimu ッ> (edit) "greta" => "great aside from these"
22:33:18FromDiscord<A Very Merry Reimu ッ> (edit) "having to prefix enum members" => "hungarian notation"
22:33:27FromDiscord<A Very Merry Reimu ッ> @guttural666
22:33:48FromDiscord<4zv4l> @A Very Merry Reimu ッ I agree about `ISO 8601` date format
22:34:04FromDiscord<A Very Merry Reimu ッ> fellow iso 8601 enjoyer
22:34:27FromDiscord<4zv4l> USA people always confused me↵using MM-DD-YYYY
22:36:57FromDiscord<guttural666> In reply to @A Very Merry Reimu ッ "dont get me wrong": yeah, you're probably more experienced than i am
22:37:35*xet7 quit (Read error: Connection reset by peer)
22:40:56FromDiscord<guttural666> I just see serialization that I have to do for a hobby project in standard c++ and I already get mad, get the name of a field? nope, alright just fill all fields of an obj with an index? nope
22:41:14FromDiscord<A Very Merry Reimu ッ> In reply to @guttural666 "yeah, you're probably more": in nim? no↵in programming in general? maybe idk
22:41:23FromDiscord<guttural666> the compiler knows all this stuff and it simply doesn't talk to me
22:42:32FromDiscord<guttural666> In reply to @A Very Merry Reimu ッ "in nim? no in": and people do type erasure and crazy perverse things just to trick the damn compiler and it's just crazy
22:43:28FromDiscord<A Very Merry Reimu ッ> sent a code paste, see https://play.nim-lang.org/#ix=4hez
22:43:33FromDiscord<guttural666> if a human understand something, the compiler should, that is my naiive pleb expectation of a user 🤣
22:44:50FromDiscord<guttural666> D is the language of the funny and genious Balkan guy right?
22:44:59FromDiscord<A Very Merry Reimu ッ> its like C++ but actually good
22:45:03FromDiscord<A Very Merry Reimu ッ> unfortunatelt its very niche
22:45:20FromDiscord<guttural666> who talks on CPP conferences as well?
22:45:31FromDiscord<A Very Merry Reimu ッ> walter bright?
22:46:23FromDiscord<albassort> i want to have a proc as a parameter, where i can put any proc which has the same parameters in the same place but is allowed to have extra
22:46:28FromDiscord<albassort> oh wait that mekes no sense
22:46:38FromDiscord<albassort> (edit) "mekes" => "makes"
22:46:40FromDiscord<albassort> ignore that
22:47:50*Phytolizer quit (Remote host closed the connection)
22:48:10*Phytolizer joined #nim
22:50:40FromDiscord<guttural666> Andrei Alexandrescu
22:51:52FromDiscord<guttural666> yeah, not Bright, which would be the other designer ^^
22:54:22FromDiscord<guttural666> source compatibility with C/CPP is a must though, think that's one reason It's niche maybe?
23:13:00FromDiscord<guttural666> cant I comma seperate these bad boys? https://media.discordapp.net/attachments/371759389889003532/1047289101004570694/image.png
23:14:39FromDiscord<huantian> I think you can use underscores
23:15:05FromDiscord<guttural666> yes, thank you, just got it right
23:16:18*Phytolizer quit (Ping timeout: 260 seconds)
23:32:14FromDiscord<guttural666> how do I reduce the stringyfied version of a float to x,xx without too much hassle? https://media.discordapp.net/attachments/371759389889003532/1047293940300255232/image.png
23:33:38FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1047294295050305626/image.png
23:34:02FromDiscord<huantian> https://nim-lang.org/docs/strformat.html#formatting-floats
23:34:37FromDiscord<guttural666> grazie mille
23:36:49FromDiscord<guttural666> 200 lines of code and I've written an API to Metal Archives in Nim it's just bonkers how much fun this is
23:39:06FromDiscord<ahungry> sent a long message, see http://ix.io/4heI
23:39:57FromDiscord<ahungry> (edit) "http://ix.io/4heI" => "http://ix.io/4heJ"
23:41:05FromDiscord<huantian> well if you want to use libcurl and SDL, there are already existing wrappers I believe
23:43:13FromDiscord<ahungry> direct nim implemented/supported cross platform would be preferable I think - maybe I should just dive in 😀 the lang seems like a lot of fun - couldnt get nimlsp to work with Emacs eglot, but lsp-mode was fine
23:47:49*disso_peach quit (Ping timeout: 260 seconds)
23:49:08*disso_peach joined #nim
23:52:23FromDiscord<pyolyokh> I'd go with raylib and start with std/httpclient myself. Should be few snags that way.
23:54:24FromDiscord<guttural666> In reply to @ahungry "Hi all - hopefully": "Hi all - hopefully I can come in and bombard with all the noob questions"↵moves on to be a sophisticated young person who knows a lot, just shut up alhungry xD
23:55:40FromDiscord<guttural666> vim works (smirking ultra chad)
23:56:18FromDiscord<pyolyokh> a sophisticated young person who knows a lot seems pretentious if humble in a middle school class room, but seems arrogant if not humble among professionals at a conference. That remark's just some high expectations