<< 15-12-2021 >>

00:37:37*vicecea quit (Remote host closed the connection)
00:38:07*vicecea joined #nim
00:44:13arkanoidThis is cool! https://godbolt.org/
00:47:17NimEventerNew thread by Dom96: HttpBeast 0.4.0 is here, see https://forum.nim-lang.org/t/8714
00:52:39FromDiscord<eyis> I am trying to understand slices, but I'm a bit confused.↵This is using a slice: `val[2 .. 4] = [4, 3, 10]`
00:52:58FromDiscord<eyis> (edit) "10]`" => "10]`↵but this create a new seq: `var slice = val[2 .. 4]`"
00:53:28FromDiscord<Elegantbeef> `[]=` and `[]` are different operators
00:53:42FromDiscord<eyis> I see
00:54:13FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L2621 if you want to see the impl
00:54:14FromDiscord<eyis> so you can't have a slice of an array like you can in go, can you?
00:54:46FromDiscord<Elegantbeef> You can using unsafe methods or `toOpenArray`(cannot be held in a variable)
00:55:26FromDiscord<Elegantbeef> There is also the experimental views which does allow holding openarrays in variables
00:57:01FromDiscord<pyautogui> sent a code paste, see https://play.nim-lang.org/#ix=3Irw
00:57:50FromDiscord<eyis> my next question was about openArray :D are they the recommended way to pass an array of unknown size to a proc?
00:58:00FromDiscord<Elegantbeef> They are indeed
00:58:00FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Iry
00:58:07FromDiscord<eyis> and practically when do you use slices?
00:58:21FromDiscord<eyis> (edit) "do" => "would"
00:58:29FromDiscord<Elegantbeef> They're a hidden conversion which allows arrays/sequences to colesce into a API that can be written once
00:58:45FromDiscord<Elegantbeef> Cause enum arrays/non zero indexed arrays can cause errors in generics
01:00:23FromDiscord<Elegantbeef> Dont know what to say py, havent looked at aoc in a while so i dont know the intended logic
01:00:56FromDiscord<eyis> I see. And are openarrays views into the array/seq?
01:01:07FromDiscord<Elegantbeef> Yes
01:01:22FromDiscord<pyautogui> Thanks @ElegantBeef I will keep working by myself.
01:01:48FromDiscord<Elegantbeef> Openarray is internally a pointer/len but is checked it does not get assigned to a variable without the aforementioned experimental feature
01:02:17FromDiscord<Elegantbeef> The views feature gives a borrow checker allowing safe usage of openArrays
01:03:01FromDiscord<Elegantbeef> But as the experimental name suggests it has code gen/design issues, but can be used
01:03:09FromDiscord<eyis> Great! Thank you for answering :D that covers pretty much all I was wondering about
01:03:52FromDiscord<Elegantbeef> If you're purely looking at iteration you can now implement slice operators for borrowing slices
01:04:15FromDiscord<Elegantbeef> Which i do here https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L10-L18
01:07:25*xet7 quit (Quit: Leaving)
01:07:53*xet7 joined #nim
01:08:49FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3IrC
01:08:52FromDiscord<Rika> I replied to the wrong thing
01:09:33FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3IrD
01:10:25FromDiscord<pyautogui> Got it
01:10:28FromDiscord<pyautogui> Deleting it
01:10:42FromDiscord<Rika> AFAIK it's GG for those in IRC now
01:11:07FromDiscord<Rika> Actually no I think it's fine
01:11:16FromDiscord<Rika> Since code blocks go into pastes
01:11:41FromDiscord<Rika> Anyway feel free to repost in aoc but the code goes in a paste link
01:13:37*mahlon quit (Ping timeout: 256 seconds)
01:26:14FromDiscord<pyautogui> got it
01:31:43FromDiscord<evoalg> oooo I figured out how to do: `myseq.toHashSet.toSeq` to get rid of duplicates in a list
01:38:33*src_ quit (Quit: Leaving)
02:00:53*mahlon joined #nim
02:01:18FromDiscord<Yardanico> In reply to @evoalg "oooo I figured out": why
02:01:20FromDiscord<Yardanico> there's deduplicate
02:01:33FromDiscord<Yardanico> https://nim-lang.org/docs/sequtils.html#deduplicate%2CopenArray%5BT%5D%2Cbool
02:02:55FromDiscord<evoalg> oh thank you!
02:19:46*neurocyte0132889 quit (Ping timeout: 260 seconds)
02:46:27*huantian joined #nim
02:48:00*noeontheend quit (Quit: noeontheend)
02:48:13*noeontheend joined #nim
02:56:07*huantian quit (Quit: WeeChat 3.3)
02:56:30*huantian joined #nim
03:02:53*noeontheend quit (Quit: noeontheend)
03:03:09*noeontheend joined #nim
03:22:16*arkurious quit (Quit: Leaving)
03:48:37*noeontheend quit (Ping timeout: 252 seconds)
04:04:01*rockcavera quit (Ping timeout: 252 seconds)
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:10:00*huantian quit (Quit: WeeChat 3.3)
04:57:29*noeontheend joined #nim
06:28:57*Colt quit (Quit: Leaving)
06:36:33*noeontheend quit (Ping timeout: 252 seconds)
07:15:05*Guest1650 joined #nim
07:22:11*Guest1650 quit (Quit: Client closed)
07:35:04FromDiscord<rb3.nim> sent a code paste, see https://play.nim-lang.org/#ix=3IsE
07:53:58*PMunch joined #nim
08:45:47*PMunch quit (Quit: leaving)
09:20:02*pro joined #nim
09:31:07*pro quit (Quit: WeeChat 3.3)
09:34:49FromDiscord<Elegantbeef> @pietroppeter\: like i was saying overloads are handled seemlessly though some caveats exist
09:35:27FromDiscord<Elegantbeef> `proc(a, b: int or float)` presently generates a `proc(a, b: int)` and `proc(a, b: float)` but not a `proc(a: int, b: float)`
09:35:36FromDiscord<pietroppeter> ah nice! (we are continuing a discussion that was originally in #fosdem channel)
09:36:32FromDiscord<Elegantbeef> But if you have `proc doThing(a: int)` and `proc doThing(a: string)` it'll properly handle overloads
09:36:36FromDiscord<pietroppeter> I was referring to the line in nimscripter's readme when I thought overloads would not work: "Any exported non overloaded and non generic procedures can be called from Nim"
09:36:54FromDiscord<Elegantbeef> Yea "from Nim" is key
09:37:28FromDiscord<pietroppeter> 🤦‍♂️
09:38:50FromDiscord<Elegantbeef> Eitherway i do need to work on documentation, it's as big black box presently
09:39:35FromDiscord<Elegantbeef> After helping my friend fight with godot-nim for the past few days i'm feeling very self conscious about docs and my code now
09:39:59FromDiscord<Elegantbeef> As nice as the bindings are, they're hell to use
09:53:40FromDiscord<Michal58> In reply to @Yardanico "there's deduplicate": Contrary to .toHashSet.toSeq that seems to have quadratic complexity?
10:13:07FromDiscord<lumi> what's the reasoning for allowing proc call without parenthesis? Is it just for the convenience or is there another reason? (like: `echo "hello world"`)↵I find it hard when reading code to know if `foo.bar` is accessing a field or calling a proc
10:14:16FromDiscord<Elegantbeef> Well in the case of the method call syntax it's for fields
10:14:23FromDiscord<Elegantbeef> well properties i should say
10:15:33FromDiscord<Elegantbeef> So yes mostly for convience/elegance
10:15:52FromDiscord<Elegantbeef> It's more convient to drop `()` when it's a property than to do `foo.body()` for instance
10:18:49FromDiscord<Michal58> I guess the idea is we shouldn't treat those two cases as different? Like `text.len` could very well just be a field of the string the usage would be the same
10:19:19FromDiscord<Michal58> Also, it's similar to for example C# getters
10:19:37FromDiscord<Michal58> except Nim is less explicit about it?
10:19:39FromDiscord<Elegantbeef> Well just properties all together
10:19:48FromDiscord<Elegantbeef> Nah Nim is equally implicit
10:20:08FromDiscord<Elegantbeef> If you have a property in C# it's 100% identical to a Nim property
10:20:22FromDiscord<Elegantbeef> It runs code on field access/assignment
10:20:33FromDiscord<Elegantbeef> Nim arguably more explicit since there is a proc definition
10:22:23FromDiscord<Michal58> yeah, so this behaviour in Nim is not even something unusual/suprosing, just the syntax is different?
10:22:47FromDiscord<Michal58> lol what is suprosing
10:22:57FromDiscord<Elegantbeef> The syntax they have an issue with is the dropping of `()` which i'd argue means you have badly named functions if you think they could be misconstrude as fields
10:23:42FromDiscord<Michal58> In reply to @Elegantbeef "The syntax they have": yes, but you droop the () in C# too
10:23:47FromDiscord<Michal58> (edit) "droop" => "drop"
10:24:03FromDiscord<Michal58> (edit) "In reply to @Elegantbeef "The syntax they have": yes, but you drop the () in C# too ... " added "so I'm just saying this is not only related to Nim"
10:24:05FromDiscord<Elegantbeef> No you cannot drop `()` on any proc calls
10:24:17FromDiscord<Michal58> In reply to @Elegantbeef "No you cannot drop": I mean for properties
10:24:43FromDiscord<Elegantbeef> Yea i know but they're not talking about properties i just brought it up as one reason why `()` is droppable
10:25:21FromDiscord<Elegantbeef> Chaining is another reason why you can drop them, since `10d.int.mod(2).float` is much more nice to write than `10d.int().mod(2).float()`
10:25:26FromDiscord<Michal58> And if in Nim, somebody uses that syntax, arguable that are conveying an additional semantics - meaning that the call can be viewed as accessing a property
10:25:47FromDiscord<Michal58> (edit) "syntax," => "syntax (dropping ()),"
10:25:54FromDiscord<Elegantbeef> Yea if there is ambiguity it's almost certainly a case of badly named procedures
10:25:55FromDiscord<Michal58> (edit) "arguable that" => "arguably they"
10:27:13FromDiscord<Elegantbeef> procedures afterall should be verby
10:28:07FromDiscord<Elegantbeef> @lumi\: anywho hope that gives you some stuff to reason why they're optional 😛
10:29:39FromDiscord<Michal58> right, if it's a noun than usually it can be defined as a `func` instead and be treated like a `property` and in that case it doesn't matter that you cannot tell if it is a field or calling that `func` do I make sense, @ElegantBeef ?
10:30:23FromDiscord<Elegantbeef> Yea ideally it should be a function if it's a property
10:30:46FromDiscord<Elegantbeef> Property vs field doesnt matter if your properties are properly written and not expensive
10:32:23FromDiscord<Elegantbeef> This comes down to a case of user ambiguity, really it doesnt matter if something is a proc call or a field, if it looks like a field and it's a property what's the issue "performance"? There are properties that are templates so that's not the case... it's a nothing burger to me
10:32:30FromDiscord<Michal58> In reply to @Elegantbeef "Property vs field doesnt": yeah that was my idea when I said Nim enforces us to not treat those differently
10:33:24FromDiscord<Elegantbeef> I do hope lumi chimes in really making me feel like i scared them away
10:38:24FromDiscord<lumi> Ahah sorry, I had a call.
10:38:32FromDiscord<lumi> yeah it does! Not sure I like that feature but it does make sense in the context of nim
10:38:39FromDiscord<lumi> at least your reasoning is sound
10:39:35FromDiscord<Elegantbeef> Well it's a relatively common thing in languages now, so it's here to stay 😛
10:40:28FromDiscord<lumi> yes I'm not asking for nim to change for me :D
10:43:29FromDiscord<Elegantbeef> The interesting thing to note, is that allowing dropping of `()` on proc calls actually means that only setters need to be handled specially
10:43:51FromDiscord<Elegantbeef> Since all procs can be used as if they're fields the compiler doesnt have to do anything special for getters
10:44:28FromDiscord<Elegantbeef> I suppose that's only interesting if you like compiler developing any
10:47:03FromDiscord<Michal58> In reply to @Elegantbeef "The interesting thing to": yeah, that is what I meant when I said in Nim it was less explicit - in Nim everything behaves like a getter implicitly
10:47:27FromDiscord<Elegantbeef> Ah we were talking about different sides of the coin
10:47:37FromDiscord<Elegantbeef> I was talking about implementation and you about calling 😀
10:48:08FromDiscord<Elegantbeef> Anyway i'm off so directly all questions to the nearest paper shreader
10:57:25*xet7 quit (Remote host closed the connection)
10:58:37*xet7 joined #nim
11:08:43*PMunch joined #nim
11:56:07FromDiscord<Michal58> sent a code paste, see https://play.nim-lang.org/#ix=3ItO
11:56:35FromDiscord<Michal58> (edit) "https://play.nim-lang.org/#ix=3ItO" => "https://play.nim-lang.org/#ix=3ItP"
12:00:17FromDiscord<haxscramper> toplevel procs are not mixined in generics
12:00:23FromDiscord<SuperFola> i'm guessing this is due to scope rules, you are using functions from heapQueue and HashSet which must call said operator, but they can access only what is top level?
12:00:34FromDiscord<haxscramper> when you define `>` in a local scope it is defined as `>_somelocalid`, and can't be mixined in generic
12:01:25FromDiscord<haxscramper> heapqueu looks for `>` visible in the instantiation scope, but `>` is defined locally, and has some additional data to disambiguate it, so it is not considered by gensym
12:02:23FromDiscord<haxscramper> Although I'm not sure if this is a 100% correct explanation from the compiler implementation standpoint
12:03:15FromDiscord<Michal58> I see
12:03:29FromDiscord<Michal58> makes sense actually
12:03:57FromDiscord<Michal58> but then is there another way of achieving the same?
12:04:26FromDiscord<Michal58> without having to define it globally
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:18FromDiscord<haxscramper> heapqueue does not have an additional generic parameter that would allow you to specify a comparator (like `std::map` from C++ does for example), so your only option is to define `<` globally.
12:06:30*supakeen joined #nim
12:06:34FromDiscord<haxscramper> Do you need to sort data in two different orders?
12:06:41FromDiscord<Michal58> hmm, I was afraid you'd say so
12:06:47FromDiscord<haxscramper> With different behaviors for `<`?
12:07:07FromDiscord<Michal58> In reply to @haxscramper "With different behaviors for": yes, that would be handy
12:07:54FromDiscord<haxscramper> You can define `PointSortedOneWay = distinct Point` and `PointSortedAnotherWay = distinct Point`, and define `<` for them, I think currently it is the only solution
12:08:22FromDiscord<haxscramper> There was an RFC for Table parametrization, I don't remember whether it required to change the language code
12:08:23FromDiscord<haxscramper> (edit) "code" => "core"
12:08:35FromDiscord<haxscramper> Maybe it has a library-only solution that is not as dirty as `distinct`
12:08:49FromDiscord<Michal58> In reply to @haxscramper "You can define `PointSortedOneWay": that doesn't work for what I was trying to do - I don't now the sorting methods nor their count at compile time
12:09:27FromDiscord<Michal58> by that I mean I'd like to define < inside the function and use nonlocal values in there
12:10:21FromDiscord<Michal58> so < would be different for each call of shortestDistance in my case
12:12:03FromDiscord<Michal58> I don't miss OOP in Nim but with OOP you don't have those kinda problems 😄
12:13:46FromDiscord<Tanguy> You can create a `method >` if you want to do oop
12:16:47FromDiscord<Michal58> would defining `<` as a `method` inside the function solve the problem?
12:16:58FromDiscord<Tanguy> I don't think that works
12:19:23FromDiscord<Tanguy> sent a code paste, see https://paste.rs/4mQ
12:19:34FromDiscord<Tanguy> (edit) "https://play.nim-lang.org/#ix=3ItU" => "https://paste.rs/Yu1"
12:20:27FromDiscord<Michal58> that is kinda funny, but very clever 🙂
12:20:45FromDiscord<Rika> Cursed
12:27:25FromDiscord<Michal58> thanks
12:30:41FromDiscord<haxscramper> In reply to @haxscramper "There was an RFC": I was unable to find this RFC/issue/PR
12:31:02FromDiscord<haxscramper> But I believe it was by timotheecour
13:04:33*noeontheend joined #nim
13:27:32*rockcavera joined #nim
13:27:32*rockcavera quit (Changing host)
13:27:32*rockcavera joined #nim
13:31:43FromDiscord<narimiran> we have a release candidate for Nim 1.6.2: https://forum.nim-lang.org/t/8712 - please try it and see if you encounter any regressions
13:38:40*noeontheend quit (Remote host closed the connection)
13:39:52*noeontheend joined #nim
13:43:10*dtomato quit (Quit: The Lounge - https://thelounge.chat)
13:43:49*dtomato joined #nim
13:51:22*noeontheend quit (Ping timeout: 260 seconds)
14:12:52*arkurious joined #nim
14:27:12*xet7 quit (Quit: Leaving)
14:51:37*fputs quit (Quit: The Lounge - https://thelounge.chat)
14:53:39*fputs joined #nim
14:57:22*ecs quit (Ping timeout: 268 seconds)
14:57:52*ecs joined #nim
14:58:33*blackbeard420 quit (Ping timeout: 250 seconds)
15:20:54*xet7 joined #nim
15:23:25*xet7 quit (Remote host closed the connection)
15:44:06*blackbeard420 joined #nim
15:54:46FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3Iv5
15:55:52FromDiscord<Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3Iv6
15:56:18FromDiscord<hmmm> oh this look cool except I need to import an entire module to do it. what is it
15:56:21FromDiscord<Tanguy> (edit) "https://play.nim-lang.org/#ix=3Iv6" => "https://play.nim-lang.org/#ix=3Iv7"
15:56:22FromDiscord<hmmm> "it"
15:57:11FromDiscord<Tanguy> https://nim-lang.org/docs/sequtils.html#keepItIf.t%2Cseq%2Cuntyped↵↵keepItIf will call what you give in parameter for each value in the sequence, replacing the magic `it` by the current value
15:57:26FromDiscord<hmmm> I see
15:58:09FromDiscord<Tanguy> sequtils has a lot of useful stuff, if you don't use it you'll have to do it manually, like you did, more or less
16:03:00FromDiscord<Rosen> Hold on, what's the difference between keepItIf and filterIt?
16:03:53FromDiscord<hmmm> damn sequtils is like heroi- I mean magicks
16:04:17FromDiscord<hmmm> pmunchie should do a tutorial series on sequtils tbh
16:04:29FromDiscord<hmmm> summoning pmunchie 🧔‍♂️
16:05:18FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Ivf
16:05:29FromDiscord<el__maco> perhaps unsurprisingly the runtime isn't happy with this
16:06:26FromDiscord<hmmm> maco this is the saner version I couldn't think of when I yoloed my while instead. But the sequtils one looks so much better than both
16:06:52FromDiscord<el__maco> mine doesn't work. You cannot delete from the container you're iterating over
16:07:04FromDiscord<hmmm> maybe you need to use mitems?
16:07:17FromDiscord<el__maco> maybe someone knows how to express it in a way it actually works 😅
16:07:30FromDiscord<Rosen> What do you guys use to measure runtime? I want to try a few different ways
16:08:19PMunchepochTime or monotimes
16:08:20FromDiscord<hmmm> In reply to @Rosen "What do you guys": yea I'm interested too, also I want to know how to debug without echo like a champ without hassling setups
16:08:52PMunchYou can do debugging with GDB if you like
16:09:04FromDiscord<hmmm> munchie direct me to an example
16:09:17FromDiscord<hmmm> do you use echo munchie?
16:09:21PMunchOf gdb usage?
16:09:26FromDiscord<hmmm> yes
16:09:28PMunch`gdb myprogram`
16:09:39FromDiscord<hmmm> oh really
16:09:48PMunchHuh?
16:10:11FromDiscord<hmmm> sorry for the confusion I know absolutely nothing about gdb 😅
16:12:49FromDiscord<Rika> In reply to @el__maco "maybe someone knows how": It is required to use two containers
16:13:02FromDiscord<Rika> In reply to @Rosen "Hold on, what's the": Keep on true versus remove on true
16:13:38FromDiscord<Rosen> But filter keeps on true as well
16:14:28FromDiscord<Rosen> Oh! keepItIf is in-place while filterIt is creating a new seq
16:14:44FromDiscord<Rika> ?
16:14:59FromDiscord<Rika> Let me check I was pretty sure filter was remove on true
16:15:33PMunch@hmmm, this is probably helpful: https://internet-of-tomohiro.netlify.app/nim/gdb.en.html
16:15:48FromDiscord<Rika> That’s right I guess
16:15:56FromDiscord<Rika> Strange break of naming tradition
16:16:15FromDiscord<el__maco> In reply to @Rika "It is required to": hmm, so you have to basically create a duplicate container when you remove items from it? If so, is the sequtils solution more efficient?
16:16:48FromDiscord<Rika> In reply to @el__maco "hmm, so you have": Actually I can think of a way to do filtering on one container
16:17:12FromDiscord<Rika> “Sort” the proper elements and resize the container
16:17:13FromDiscord<el__maco> I guess if a seq is dynamic array then you kinda have to copy if you want to maintain the order of the items
16:17:21FromDiscord<Rika> No resizes during iteration but swaps occur
16:17:55FromDiscord<Rika> Only extra data needed is a tracked index for the next “sorted” location I guess
16:18:04NimEventerNew question by How2: Pythonic dir(module_name) in Nim?, see https://stackoverflow.com/questions/70366960/pythonic-dirmodule-name-in-nim
16:19:48FromDiscord<Gready> hello, i can't get this simple macro example to compile : https://stackoverflow.com/questions/65519270/nim-custom-macro-pragma-to-get-ast-of-complete-module-but-get-cannot-attach-a, but i get undeclared identifer for the proc when i add the pragma to the function, any idea why? https://play.nim-lang.org/#ix=3Ivj
16:20:48FromDiscord<hmmm> In reply to @PMunch "<@887269570765791243>, this is probably": thanks munchie! I skimmed it and for my purposes looks totally overkill unless my apps grow so much I end up needing it. I was thinking along the line of some automatic logger that is not a hassle to setup
16:21:04FromDiscord<Rika> In reply to @Gready "hello, i can't get": For the proc you must return the ast again
16:21:16FromDiscord<Rika> Because the macro consumes the code
16:21:31FromDiscord<Rika> So now you can’t call it because it technically doesn’t exist
16:21:47PMunch@hmmm, automatic logger? What kind of stuff would you like to log?
16:22:30FromDiscord<Gready> @Rika thanks!
16:24:53FromDiscord<hmmm> In reply to @PMunch "<@887269570765791243>, automatic logger? What": hmm don't know how to explain. the kind of stuff I usually echo for debug. Like something that can be disabled and reenabled massively, or makes a copy on file
16:25:20FromDiscord<Rika> so literally just std/logging
16:25:21FromDiscord<Rika> ?
16:25:27FromDiscord<hmmm> hmm possibly?
16:25:32FromDiscord<hmmm> I should look into it
16:25:39PMunch@Rika, he wants it to log automatically
16:26:08FromDiscord<Rika> log...what
16:27:45PMunchExactly
16:29:39FromDiscord<hmmm> basically something that records the echo of all the variables of interest without actually peppering all the program of echo statements. I don't even know if it exist lol
16:30:32PMunchIt doesn't, and it can't really :P
16:30:41FromDiscord<hmmm> oh I see 😦
16:30:47PMunchHow would the program know what variables are interesting?
16:31:08FromDiscord<hmmm> hmm I can mark them
16:31:13PMunchI guess you could write a macro that does something, but I've never seen anything like that
16:32:47FromDiscord<Rika> In reply to @hmmm "hmm I can mark": then its not automatic lol
16:33:29FromDiscord<hmmm> I mean the pain point is having to clean up all the echoes after fixing the broken program, and when it breaks again maybe you want all the previous echoes back and it's just a hassle
16:34:56FromDiscord<Rika> std/logging then
16:35:03FromDiscord<Rika> can turn it on and off easy
16:35:11FromDiscord<hmmm> I'll look into it
16:35:24FromDiscord<Rika> can also direct debug into a file and everything else into stdout
16:35:30FromDiscord<Hamid_Bluri> have you seen this btw?↵https://github.com/hamidb80/uncomment/
16:39:05FromDiscord<hmmm> In reply to @hamidb80 "have you seen this": this is very gud my man! Now just make a version that actually comments stuff out based on a switch and you have a sell!
16:39:54PMunchYou could just create a small wrapper pragma that either adds uncomment or nothing to the pragmas set based on a switch
16:40:09*rockcavera quit (Remote host closed the connection)
16:40:23FromDiscord<hmmm> you could but I cannot since I never made a pragma in my life lol
16:41:41PMunchTime to learn something new then I guess :)
16:42:32FromDiscord<Hamid_Bluri> https://media.discordapp.net/attachments/371759389889003532/920717470782869534/unknown.png
16:42:40FromDiscord<hmmm> oh he can't see
16:42:42FromDiscord<Hamid_Bluri> he's really pmunch
16:43:03PMunchHaha :P
16:43:09nrds<Prestige99> Lol
16:45:25*PMunch quit (Quit: leaving)
16:45:50*fputs7 joined #nim
16:47:39FromDiscord<Rosen> Trying to mess around with macros, I'm wondering how to generate an unused Ident. I'm trying to make some sort of thing that will insert a timing around some code, but when I use for example ↵`result.add newLetStmt(newIdentNode("startTime"), newCall("getMonoTime"))`, if one declares the variable startTime in the block I'm passing to this macro, the compiler complains
16:47:45*fputs quit (Ping timeout: 250 seconds)
16:47:45*fputs7 is now known as fputs
16:47:50FromDiscord<Rosen> Anyone know how to solve that?
16:49:04FromDiscord<Hamid_Bluri> https://nim-lang.org/docs/macros.html#genSym%2CNimSymKind%2Cstring
16:49:19FromDiscord<Rosen> Aha! That's exactly what I was looking for, thank you!
16:50:04*rockcavera joined #nim
16:50:04*rockcavera quit (Changing host)
16:50:04*rockcavera joined #nim
17:21:54FromDiscord<z3nchada> Has anyone run across a tool for statically finding call traces? I wanted to generate call graphs for nim code and hoped to not need to go the path of regex. Also if there is a better way then regex I am all ears.
17:22:15FromDiscord<z3nchada> (edit) "Has anyone run across a tool for statically finding call traces? I wanted to generate call graphs for nim code and hoped to not need to go the path of regex. Also if there is a better way then regex I am all ears. ... " added "It would need to be across files and libraries."
17:23:07*vicecea quit (Read error: Connection reset by peer)
17:23:43*vicecea joined #nim
17:56:05FromDiscord<hmmm> with std/options an int that is 0 is different from an int that is none right?
17:57:39FromDiscord<Rika> yes
17:57:42FromDiscord<hmmm> still it's a bit verbose
17:57:48FromDiscord<Rika> yes
17:57:49FromDiscord<hmmm> how does python do the same?
17:57:57FromDiscord<Rika> it has the None type
17:58:07FromDiscord<hmmm> oh
17:58:12FromDiscord<hmmm> and where is our none
17:58:22FromDiscord<Rika> semantics are similar to nil but applicable for everything because dynamic typing
17:58:29*Colt joined #nim
17:58:35FromDiscord<hmmm> ah ok it's a dynamic vs static thingy
17:58:39FromDiscord<Rika> yes
17:58:56FromDiscord<Rika> well no, a lot of verbosity can be reduced in std/options
17:58:57FromDiscord<Rika> if
17:59:07FromDiscord<Rika> we had "reverse" type inference
17:59:14FromDiscord<Rika> rhs -> lhs inference
17:59:31FromDiscord<Rika> wait
17:59:37FromDiscord<Rika> no l -> r inference i think is what i mean
17:59:58FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3IvL
18:00:06FromDiscord<Rika> what?
18:00:08FromDiscord<hmmm> lol
18:00:14FromDiscord<hmmm> it was a dumb question don't worry
18:00:18FromDiscord<Rika> that makes no sense, you mean to build in options?
18:00:18FromDiscord<hmmm> 😅
18:03:30FromDiscord<Rika> i shall go, it is 3 am
18:04:53FromDiscord<hmmm> good sleep rika
18:40:28*src joined #nim
19:01:24*krux02 joined #nim
19:21:51*noeontheend joined #nim
19:35:13FromDiscord<spazzy> so im trying to translate a c header file and c2nim doesnt like (...) in any macro
19:35:22FromDiscord<spazzy> where its trying to load a file
19:36:53FromDiscord<spazzy> https://media.discordapp.net/attachments/371759389889003532/920761352316928060/unknown.png
19:37:15FromDiscord<spazzy> any ideas
19:43:16FromDiscord<Solitude> yeah, parser is incomplete, c2nim requires manual pre/postprocessing
19:46:05FromDiscord<spazzy> if i define it as a def it doesn't help
19:54:08*neurocyte0132889 joined #nim
19:54:08*neurocyte0132889 quit (Changing host)
19:54:08*neurocyte0132889 joined #nim
20:00:53FromDiscord<IsaacPaul> delete the macro
20:02:26FromDiscord<IsaacPaul> if you set up clangd with vscode and create a `compile_commands.json` at the root of your project you should have an option to resolve the macro into code.
20:04:53FromDiscord<geekrelief> In reply to @spazzy "so im trying to": What's the macro c2nim is failing on?
20:09:58FromDiscord<spazzy> all of them that have a variadic function
20:10:11FromDiscord<spazzy> which is most of them lol
20:10:36FromDiscord<spazzy> im trying to translate https://github.com/krychu/wfc
20:11:23FromDiscord<geekrelief> Cool library, I was hoping to do some WFC eventually.
20:11:37FromDiscord<spazzy> yeah i thought i might as well go ahead and make it a package
20:12:20FromDiscord<spazzy> it would save me a lot of time with the thing im working on
20:12:46FromDiscord<spazzy> and i might as well pass it forward
20:13:22FromDiscord<geekrelief> is `...` a preprocessor operator?
20:14:13FromDiscord<geekrelief> found it https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
20:14:23FromDiscord<geekrelief> I wonder if this works in nimterop
20:14:42FromDiscord<spazzy> yeah if it wasnt one it wouldnt work at all right?
20:16:13FromDiscord<spazzy> so ive never used nimterop
20:16:26FromDiscord<spazzy> but doesnt it not output a nim file like c2nim does?
20:16:35FromDiscord<spazzy> its mostly for inline stuff?
20:17:10FromDiscord<geekrelief> nimterop is a separate binding generator based on tree-sitter. It's been abandoned, but I forked it to wrap The Machinery.
20:17:17FromDiscord<geekrelief> I've had success so far.
20:17:29FromDiscord<spazzy> how well does your wrap work anyway
20:17:44FromDiscord<spazzy> (edit) "wrap" => "wrapper"
20:18:10FromDiscord<spazzy> i was thinking about using it for something but i settled with raylib
20:18:56FromDiscord<IsaacPaul> You could try this.. but I don't think it will help.. https://github.com/izackp/c2nim - It's a fork that recovers from errors better (in the cases I've tried)
20:21:08FromDiscord<geekrelief> In reply to @spazzy "how well does your": converted the first person example so far https://media.discordapp.net/attachments/371759389889003532/920772484607909938/Umtezvizeu-1.mp4
20:22:06FromDiscord<spazzy> nice
20:23:06FromDiscord<IsaacPaul> 😮 ... are your keywords.. glowing
20:23:10FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3IwD
20:23:18FromDiscord<geekrelief> In reply to @IsaacPaul "😮 ... are your": maybe 🙂
20:24:01FromDiscord<Elegantbeef> Geek uses that weird extension that simulates phosphorus displays
20:24:01FromDiscord<hmmm> In reply to @geekrelief "converted the first person": what is this wizardry and how can I play with it
20:24:08FromDiscord<Recruit_main707> In reply to @geekrelief "just tried nimterop on": iirc nimterop just ignored issues and emitted the c code as a comment instead of stopping
20:24:50FromDiscord<geekrelief> In reply to @Recruit_main707 "iirc nimterop just ignored": yea pretty much.
20:24:57FromDiscord<spazzy> huh
20:25:17FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3IwE
20:26:55FromDiscord<geekrelief> In reply to @hmmm "what is this wizardry": yeah I have it up here: https://github.com/geekrelief/tm-nim but it's a work in progress. I've only converted the first person example so far, but it took quite a bit of work to get there. I'm currently working on my genit macro before I continue with TM.
20:28:17FromDiscord<spazzy> you know for a language that compiles to c, i feel like the wrapping is kind of weird
20:28:34FromDiscord<spazzy> (edit) "wrapping" => "wrapping/translating"
20:30:09FromDiscord<Recruit_main707> i felt the same, but then got used to it
20:30:15FromDiscord<spazzy> or at least inconsistent
20:30:32FromDiscord<Recruit_main707> what was that other lib that everyone was using for wrapping c now?
20:30:33FromDiscord<Elegantbeef> The wrapping isnt that weird
20:30:53FromDiscord<Elegantbeef> Are you talking about futhark?
20:30:59FromDiscord<Recruit_main707> yeah
20:31:06FromDiscord<Recruit_main707> it used c2nim too didnt it?
20:31:15FromDiscord<Elegantbeef> I think it's kinda expected to be this way since Nim is a language that really uses the type system atleast imo
20:31:29FromDiscord<spazzy> doesnt futhark just import the header to be used with incline c?
20:31:39FromDiscord<spazzy> kind of?
20:31:55FromDiscord<Elegantbeef> Atleast when i wrap stuff i try to make it the best Nim experience which means it doesnt align with C's implementation
20:32:02FromDiscord<Elegantbeef> Futhark uses clang
20:32:59FromDiscord<spazzy> i mean its not the same as what im trying to do
20:33:10FromDiscord<spazzy> since im trying to make a header file a nimble package
20:33:27FromDiscord<Elegantbeef> It does automatic bindings, so not idiomatic but if you need/want a library you can get it done
20:33:29FromDiscord<spazzy> its more to use in projects iirc
20:34:03FromDiscord<Recruit_main707> In reply to @Elegantbeef "It does automatic bindings,": no tool does that and probably wont ever
20:34:18FromDiscord<Elegantbeef> Hey i just popped in here answering questions! 😛
20:34:45FromDiscord<Elegantbeef> I didnt imply otherwise, but it doesnt emit source so making it idiomatic is more tedious
20:35:51FromDiscord<Recruit_main707> ah, fair enough↵i surely prefer that to messing with c headers until c2nim likes it tho
20:36:13FromDiscord<Elegantbeef> Yea i'm daft so i prefer wrapping stuff myself, but it's tedious
20:36:37FromDiscord<hmmm> In reply to @geekrelief "yeah I have it": woa this looks so cool, and the nim code seems very readable
20:36:49FromDiscord<spazzy> so i should just use futhark for the time being and deal with wrapping it later?
20:37:05FromDiscord<Recruit_main707> its worth a try
20:37:32FromDiscord<Recruit_main707> check how it works in practice here https://github.com/arkanoid87/nimarrowglib
20:38:16FromDiscord<geekrelief> In reply to @hmmm "woa this looks so": yeah a little more concise than C at least 😄
20:38:34FromDiscord<spazzy> In reply to @Recruit_main707 "check how it works": OH
20:38:37FromDiscord<spazzy> okay
20:38:37FromDiscord<Elegantbeef> No dumb namespacesless namespaces 😛
20:40:35FromDiscord<bananahead> Quick one all. I have 2 hashSets which I am using to find a diff. How do I extract the diffed values. The docs suggest using the [], but this does not work for me, and causes an error.
20:40:36Amun-RaElegantbeef: same here, I always wrap stuff myself, and I always hide raw C stuff
20:40:57FromDiscord<spazzy> so realistically it would probably be faster to futhark the macros and c2nim the rest of it that c2nim actually likes than just messing with the header until it wraps itself?
20:42:58FromDiscord<bananahead> Oh maybe I should use a set insted of a hashset
20:47:28Amun-Rabananahead: s1 -+- s2 (hashsets); otherwise (s1 - s2) + (s2 - s1)
20:49:30Amun-Rahmm, -+- doesn't work the way I thought it works
20:49:46FromDiscord<bananahead> In reply to @Amun-Ra "<@451387344109568011>: s1 -+- s2": So the diff isn't so much the issue. if I echo it I'm left with `{'d'}` which is a new hashset. I want to get `'d'` as a string
20:50:51FromDiscord<Elegantbeef> you can do `for x in yourSet`
20:50:52FromDiscord<Elegantbeef> or do `yourSet.toSeq` with `import std/sequtils`
20:54:32FromDiscord<bananahead> Thanks as always @ElegantBeef
20:55:07FromDiscord<Elegantbeef> and yes if you're doing `HashSet[char]` stop playing games and do `set[char]` 😀
20:55:30FromDiscord<kevin> does nim have something to convert from a char array to a string and vice versa?
20:56:08FromDiscord<Elegantbeef> Are we talking about `array[10, char]` or a cstring?
20:56:12FromDiscord<kevin> c2nim formatted all of the c char array struct members into Nim char arrays
20:56:24FromDiscord<Elegantbeef> Ah those should be `cstring`
20:56:42FromDiscord<bananahead> In reply to @Elegantbeef "and yes if you're": Im having trouble getting string into a set format, without nim complaining with me
20:57:00FromDiscord<Elegantbeef> cstring is a `ptr UncheckedArray[char]` and there are easy conversions to/from
20:57:14FromDiscord<Elegantbeef> Nim's built in set only works with ordinals
20:57:33FromDiscord<Elegantbeef> So a string will not work, i assumed you had a bitset of chars which is why i mentioned it
20:57:37FromDiscord<Elegantbeef> hashset of chars\
20:57:45Amun-Rakevin: join from strutils
20:58:20FromDiscord<Elegantbeef> I should clarify that Nim's bitsets work for ordinals in the range of `0..uin16.high`
20:58:36FromDiscord<bananahead> Nope, Im attempting the AOC day 8 part 2. So and creating and diffing sets made up from strings.
20:58:56FromDiscord<Elegantbeef> Then yea disregard the set comment by me
20:59:02FromDiscord<Elegantbeef> I just seen `{'d'}` and assumed it was a char set
20:59:11FromDiscord<Elegantbeef> Cause that is not a string 😛
20:59:21FromDiscord<bananahead> Haha fair point!
21:00:14*jmdaemon quit (Ping timeout: 252 seconds)
21:03:15FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3IwN
21:03:44FromDiscord<Elegantbeef> Those are global char arrays? If so the Nim type is right imo
21:03:47FromDiscord<kevin> I'm pretty sure I'm missing something simple
21:04:24FromDiscord<kevin> It's a C type originally: `typedef struct _S_CONFIG {`
21:04:45FromDiscord<kevin> lots more members in the struct but basically the same all the way thru.
21:05:04FromDiscord<Elegantbeef> Then yes those should be cstrings
21:05:07FromDiscord<Elegantbeef> afaik atleast
21:05:23FromDiscord<Elegantbeef> Can i see the C struct and c2nim output?
21:06:03FromDiscord<kevin> https://github.com/TheWover/donut/blob/master/lib/donut.h
21:06:30FromDiscord<kevin> https://media.discordapp.net/attachments/371759389889003532/920783902405165096/donut.nim
21:06:55FromDiscord<kevin> slightly tweaked output since some things broke
21:07:19FromDiscord<Elegantbeef> Ok so yea the original type is right imo
21:08:22FromDiscord<kevin> So then if I use a Nim array[char], it's: `Error: type mismatch: got 'string' for '"asdf"' but expected 'array[0..255, char]'`
21:08:31FromDiscord<Elegantbeef> Yep one second
21:11:08nrds<Prestige99> duds: there are tutorials on the nim website that are good to read
21:11:33nrds<Prestige99> https://nim-lang.org/documentation.html
21:11:39nrds<duds99> NOT YET omg omg
21:11:49nrds<duds99> thank u but i have to wait........
21:11:49nrds<Prestige99> Haha
21:12:00nrds<duds99> do not tempt me or i will be all over the place lol
21:12:14nrds<duds99> too much picking up and dropping langs and stuff already
21:12:22nrds<duds99> adhd impulses u know
21:13:05FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3IwP\
21:13:05FromDiscord<Elegantbeef> You probably need something like taht
21:13:10FromDiscord<Elegantbeef> Since afaik the char arrays in C are fixed size regardless what you put in them
21:15:03Amun-Raor something as generic as https://play.nim-lang.org/#ix=3IwR
21:18:44Amun-Rahmm
21:20:16Amun-Rathat wouldn't work es expected if there's junk after null terminator
21:21:22FromDiscord<kevin> So i guess Nim does not have a stdlib converter from c char array to cstring?
21:21:33*neurocyte0132889 quit (Read error: Connection reset by peer)
21:21:47FromDiscord<kevin> if not that's ok but i would have thought there would be
21:22:27FromDiscord<Elegantbeef> Well the issue there Amun is that in their example there are a bunch of char arrays that are 256 characters so going to/from is going to be tedious still
21:22:28FromDiscord<Elegantbeef> For safety i think using a distinct there is the best
21:22:30*neurocyte0132889 joined #nim
21:22:30*neurocyte0132889 quit (Changing host)
21:22:30*neurocyte0132889 joined #nim
21:24:38FromDiscord<Elegantbeef> Well we have `cstring` but those arent cstrings afaik
21:24:39FromDiscord<Elegantbeef> Those are fixed size char arrays, but pretend to be cstrings cause C "has a type system"
21:24:39FromDiscord<Elegantbeef> That's kinda the point amun, these are max 256 characters, and you probably(didnt look at the actual impl, just assumed) use nul termination for ending these early
21:24:57FromDiscord<Elegantbeef> That's my assumption at least, i could be wrong
21:29:05Amun-Rapretty much
21:37:29FromDiscord<spazzy> for anyone that cares: the openbsd port of nim is still on 1.2
21:38:48FromDiscord<spazzy> for some reason
21:39:42FromDiscord<Elegantbeef> Generally it's suggested to use choosenime or gitnim to install Nim regardless where you are, though no clue if it plays well with BSD(i'd assume so)
21:39:54FromDiscord<Elegantbeef> choosenim even
21:45:59FromDiscord<spazzy> it doesnt
21:46:21FromDiscord<spazzy> it assumes the os flag is linux
22:34:11*krux02 quit (Remote host closed the connection)
23:02:43*noeontheend quit (Ping timeout: 256 seconds)
23:16:02FromDiscord<pyautogui> Hi - I am wondering, why is "ansi_c.nim" not importable from my code? "https://github.com/nim-lang/Nim/blob/69aabdab800077e9aaa08344494c83138a02f57c/lib/system/ansi_c.nim". There are a lot of situations in which it would be useful.
23:19:54FromDiscord<VideoCarp> I'm having an error with types while creating a Fibonacci series program. https://play.nim-lang.org/#ix=3Ixj↵It says it expects int32 but got string, and when I add `int32(nterms)` at the end of the variable block, it says it expects string but got int32. I am stuck.
23:21:59*sagax joined #nim
23:22:08FromDiscord<Elegantbeef> `readLine(stdin)` returns a string
23:23:04FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Ixk
23:23:27FromDiscord<Elegantbeef> Though worth noting this will error if you give a value outside of int32 range
23:24:51FromDiscord<VideoCarp> how do I fix it though?
23:27:37FromDiscord<VideoCarp> oh I found something. thanks
23:28:22FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Ixn something like this is nice, but better to just use a procedure for the parsing logic/checks
23:31:20FromDiscord<VideoCarp> what is wrong with https://play.nim-lang.org/#ix=3Ixp
23:31:50FromDiscord<Elegantbeef> If you give a non parsable string to `parseInt` it'll crash the program
23:32:01FromDiscord<VideoCarp> will put in try
23:32:04FromDiscord<Elegantbeef> For instance if you do `hfjdjkafhda` in tesponse
23:32:15FromDiscord<VideoCarp> but it's telling me it expects string now but got int
23:32:34FromDiscord<Elegantbeef> Well type mismatches are generally helpful so read the line and the expression
23:34:08FromDiscord<Elegantbeef> You can even compile with `--hint[source]:on` to get exactly where the issue is if that helps you
23:34:17FromDiscord<VideoCarp> sent a code paste, see https://play.nim-lang.org/#ix=3Ixq
23:34:28FromDiscord<VideoCarp> oh wait
23:34:30FromDiscord<VideoCarp> that is right
23:34:41FromDiscord<Elegantbeef> You're parsing an int so that's what you expect
23:34:44FromDiscord<VideoCarp> I had another `readLine`
23:53:07*jmdaemon joined #nim