<< 09-07-2020 >>

00:07:28FromDiscord<me2beats> I can't write like this?↵```↵if a>4 and a <5: echo "4..5"↵```
00:07:39FromDiscord<me2beats> (edit) 'this?↵```↵if' => 'this?↵```nim↵if'
00:08:01FromDiscord<XxDiCaprioxX> To the else: discard thing: maybe you want to do something in the else statement
00:08:21FromDiscord<XxDiCaprioxX> Like else: function()
00:08:39FromDiscord<Rika> what do you mean with that lest message, me2beats
00:08:44FromDiscord<Rika> last*
00:09:19FromDiscord<XxDiCaprioxX> It is a conditional that 4 < a < 5
00:09:31FromDiscord<XxDiCaprioxX> To do that you need a to be a float, not an int
00:09:50FromDiscord<Rika> you dont?
00:09:50FromDiscord<me2beats> @XxDiCaprioxX yea, but I think nim is wise to check if the user uses `else` inside a `case`
00:09:56FromDiscord<XxDiCaprioxX> And I dont think you can list that way, because that would be an infinite amount of floats
00:10:10FromDiscord<XxDiCaprioxX> Yeah you're right on that
00:10:18FromDiscord<XxDiCaprioxX> (edit) 'Yeah you're right on that ... ' => 'Yeah you're right on that@me2beats'
00:10:19FromDiscord<impbox> for 4..5 you probably want a >= 4 and a <= 5 ?
00:10:31FromDiscord<XxDiCaprioxX> Nah he wants to list all floats from 4 to 5
00:10:36FromDiscord<XxDiCaprioxX> Which is totally impossible
00:10:42FromDiscord<XxDiCaprioxX> Because there is 4.1
00:10:42FromDiscord<impbox> in an if?
00:10:51FromDiscord<XxDiCaprioxX> 4.01 4.001 4.0001 etc
00:10:55FromDiscord<Rika> i'm not sure you interpreted him properly
00:11:14FromDiscord<XxDiCaprioxX> He probably means if the float a is between 4 and 5
00:11:15FromDiscord<impbox> that'd be `for a in 4..5:` ?
00:11:22FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2rex
00:11:41FromDiscord<Elegant Beef> Well my two cents is that not including `else : discard` is useful incase you dont want discard on other cases, and it can tell the programer "Hey dumb dumb you forgot logic"
00:11:48FromDiscord<XxDiCaprioxX> Ok guys I'm out sorry and good luck with the issue
00:11:58FromDiscord<Elegant Beef> i believe the issue is the `a>4`
00:12:11FromDiscord<Clyybber> no
00:12:17FromDiscord<Rika> literally no case will match it
00:12:20FromDiscord<Clyybber> its the a <5
00:12:20FromDiscord<impbox> i think stopping programmers from doing stupid stuff by default is good, because i do a lot of stupid stuff
00:12:22FromDiscord<Rika> unless you use floats
00:12:43FromDiscord<Elegant Beef> i mean the issue is that there is no spacing between the operator and symbols
00:12:47FromDiscord<impbox> but sometimes I want to do stuff that looks stupid, so give me a way to do that =)
00:12:50FromDiscord<Clyybber> because the inconsistent spacing will make it treat it like as an unary operator
00:12:53FromDiscord<Elegant Beef> Isnt that an issue
00:12:59FromDiscord<Rika> well why do you think i asked what really was the issue
00:13:00FromDiscord<Clyybber> yeah
00:13:04FromDiscord<Elegant Beef> Yea clyyber that's what i implied
00:13:14FromDiscord<impbox> wait until we know what the issue is =)
00:13:19FromDiscord<Elegant Beef> `a > 4` and `a < 5`
00:13:20FromDiscord<me2beats> well I mean just python like if statements with `and` operator
00:13:20FromDiscord<Elegant Beef> Yea
00:13:27FromDiscord<Rika> thats correct
00:13:35FromDiscord<Rika> we use `and` for boolean and
00:13:43FromDiscord<Rika> just careful with the spacing
00:14:04FromDiscord<Elegant Beef> we also use `and` and `or` for bitwise ops
00:14:07FromDiscord<Elegant Beef> So it's wild 😄
00:14:28FromDiscord<Rika> honestly
00:14:33FromDiscord<Rika> that has *never* confused me
00:14:41FromDiscord<Elegant Beef> It never confused me either
00:14:50FromDiscord<impbox> i do find using the same keyword for both a bit confusing
00:14:52FromDiscord<Elegant Beef> I mean the first thing i did was attempt to use C# bitwise ops and it went no
00:14:56FromDiscord<me2beats> ah spacing is important↵hmm↵ok
00:15:05FromDiscord<Clyybber> it can be confusing with the fact that not has high precedence
00:15:07FromDiscord<impbox> and have to think "is this a logical and or bitwise op here"
00:15:35FromDiscord<impbox> you can figure it out, but i'd prefer bitAnd bitOr or something
00:15:38FromDiscord<Elegant Beef> `bor` and `band` the most awesome solution cause we have bans then
00:15:45FromDiscord<Elegant Beef> (edit) 'bans' => 'bands'
00:15:47FromDiscord<Clyybber> because 'if not a == b' is if (not a) == b'
00:16:19*laqq3 joined #nim
00:16:21FromDiscord<Clyybber> which is not bad
00:16:29FromDiscord<Clyybber> but not what python does :D
00:16:33FromDiscord<Elegant Beef> Yea but we have the != shortcut
00:16:38FromDiscord<Elegant Beef> So it's not a big issue
00:16:43FromDiscord<Clyybber> yeah
00:17:14*Tlongir joined #nim
00:18:14FromDiscord<Clyybber> it wouldn't make sense to change it either because then not doesn't have the precedence of ~ or ! anymore, which makes it incompatible with C
00:18:30FromDiscord<Clyybber> so the current rules are the best so far
00:20:01*oddp quit (Ping timeout: 264 seconds)
00:21:08FromDiscord<me2beats> is it better to compare floats with floats or it doesn't matter?
00:21:14*Tongir joined #nim
00:21:29FromDiscord<Elegant Beef> It doesnt matter afaik
00:21:44FromDiscord<Elegant Beef> There are operators implemented that ensure it works, so it's fine! 😄
00:22:20FromDiscord<Rika> actually
00:22:34FromDiscord<Rika> if you want to compare int to float you have to `import lenientops` i think
00:23:23FromDiscord<Elegant Beef> Ah you're right
00:24:05FromDiscord<Elegant Beef> `if(0.1 < 10)` compiles but `if(0.1 < 10.int)` does not
00:24:20*Tlongir quit (Ping timeout: 272 seconds)
00:41:20FromDiscord<me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reB
00:41:59FromDiscord<Elegant Beef> The oneline is↵`var a = [1,3,7]`
00:42:04*krux02_ quit (Remote host closed the connection)
00:42:11FromDiscord<Elegant Beef> You can include the explict type though
00:42:54FromDiscord<Elegant Beef> Also arrays are compile time constant sizes, so if you want more than 3 elements you'd probably either want to allocate a larger array or use a sequence
00:43:23FromDiscord<Elegant Beef> sequence is declared as such↵`var a = @[1,3,7]` or `var a: seq[int]`
00:47:08FromDiscord<Elegant Beef> I do highly suggest reading the tutorial/manual 😄
00:47:32FromDiscord<me2beats> ah thanks)↵possible to tell it that [1,3,7] is intArray in one line?
00:47:46FromDiscord<Elegant Beef> do you mean explcitly state it?
00:48:12FromDiscord<Elegant Beef> `var a : array[3,int] = [1,3,7]` if i understand you right
00:48:58FromDiscord<Elegant Beef> Type inference is typically preferable in that case so you dont have to change values for the array size and values
00:49:02FromDiscord<impbox> var a = [1.int8,2,3]
00:49:09FromDiscord<impbox> it'll use the type of the first element
00:49:24FromDiscord<Elegant Beef> or `var a = [1'i8,2,3]`
00:49:36FromDiscord<Elegant Beef> Pretty much any explict method of indicating the type
00:49:41FromDiscord<me2beats> oh so many ways
00:49:41FromDiscord<Rika> you can also use 1i8 tho
00:50:00FromDiscord<Elegant Beef> oh didnt know we could drop the `'`
00:50:06FromDiscord<Elegant Beef> that's cool
00:50:18FromDiscord<Rika> its only needed when the number is in hex
00:50:29FromDiscord<Rika> since `f` would be ambiguous there afaik
00:50:51FromDiscord<Rika> though ive never seen someone use hex notations for a float
00:50:59FromDiscord<Elegant Beef> sadists that's who would
00:51:08FromDiscord<Elegant Beef> So im suprised you dont 😛
00:51:11FromDiscord<Rika> you mean masochists
00:51:33FromDiscord<Elegant Beef> I mean they'd be both
00:51:43FromDiscord<Rika> i am not both
00:52:04FromDiscord<Elegant Beef> If you make a library that has a hex float, and someone else reads it you're a sadist
00:52:17FromDiscord<Elegant Beef> If you make a library that has a hex float, you're a masochist
00:52:35FromDiscord<Rika> if you make a library, you're a masochist
00:52:52FromDiscord<Rika> imagine binding yourself to a repo as a maintainer willfully
00:52:54FromDiscord<Rika> xddd
00:52:58FromDiscord<Rika> (i am joking)
00:53:02FromDiscord<Elegant Beef> Nah the issue is if it's usable
00:53:15*Tlanger joined #nim
00:53:21FromDiscord<Elegant Beef> Like my nim_rofi thing, is super simple and probably not something anyone looks for 😄
00:53:29FromDiscord<Elegant Beef> Although pmunch was interested in it
00:53:39FromDiscord<Elegant Beef> And that was before i made it nice!
00:53:49FromDiscord<Rika> nice
00:54:02*Tlanger quit (Remote host closed the connection)
00:54:12FromDiscord<Elegant Beef> Lol i was using interfaced and reference objects for something that stays alive for all of .1 seconds
00:54:13*lritter quit (Ping timeout: 246 seconds)
00:54:28FromDiscord<Elegant Beef> It was like my first thing using nim, so it was awful
00:54:46FromDiscord<Elegant Beef> But now it uses object variants and forward declaration
00:55:04FromDiscord<Rika> i dont think ive ever used forward declaration significantly
00:55:23FromDiscord<impbox> I use it a lot, but less so now that we have codeReordering
00:55:24FromDiscord<Elegant Beef> I mean my "learning nim" solution was making a variable and setting it to a proc
00:55:26FromDiscord<impbox> which is <3
00:55:37*Tongir quit (Ping timeout: 246 seconds)
00:55:39*Tlongir joined #nim
00:55:53FromDiscord<Elegant Beef> Is this implict or explcit behaviour?
00:56:03FromDiscord<Elegant Beef> the reordering
00:56:08FromDiscord<impbox> you have to opt in
00:56:17FromDiscord<Rika> i dont use code reordering either
00:56:29FromDiscord<impbox> https://nim-lang.org/docs/manual.html#scope-rules-code-reordering
00:56:35FromDiscord<Rika> ~~i manually reorder my code until it works~~
00:56:52FromDiscord<impbox> @Rika same most of the time, I reorder until it's all broken and I give up
00:57:00FromDiscord<Elegant Beef> Well for recursive proc calls that's not always possible without forward declaration
00:57:03FromDiscord<impbox> but letting the compiler do it for me is nice
00:57:18FromDiscord<Rika> i've no recursive proc calls so 'tis all good
00:57:28FromDiscord<Elegant Beef> yea
00:57:46FromDiscord<Elegant Beef> I did not when i made nim rofi, since it has proc calls to go back, but also forward
00:58:03FromDiscord<Elegant Beef> Damn code reording will make many new people happy
00:58:19FromDiscord<Elegant Beef> Since other languages dont rely on declaration order
00:59:45FromDiscord<me2beats> annd what if I need only ints and floats in an array?
01:00:17FromDiscord<Elegant Beef> You learn object variance really quickly 😄
01:00:35FromDiscord<Rika> you cant have two types in an array unless you use one type to box them in
01:01:21*bung joined #nim
01:02:37*laqq3 quit (Ping timeout: 264 seconds)
01:02:50FromDiscord<Elegant Beef> Small example of the object variance↵https://play.nim-lang.org/#ix=2reC
01:03:06FromDiscord<Elegant Beef> You can clearly make procs that just take a float/int and return a DataHolder
01:03:15FromDiscord<Rika> usually called Box btw
01:03:58FromDiscord<Elegant Beef> The nice thing here is that this even lets you have more complicated types added seemlessly
01:04:13FromDiscord<Rika> ...until you need to box an object/tuple
01:04:16FromDiscord<Elegant Beef> aslong as you check kind before accesing when iterating, you can have any complex type
01:04:43FromDiscord<Elegant Beef> What do you mean rika?
01:07:08FromDiscord<Rika> how do you box many differing objects 😛
01:07:22FromDiscord<Elegant Beef> ah differing
01:07:38FromDiscord<Elegant Beef> I was like "It's not that hard" :D↵https://github.com/beef331/nvg/blob/master/src/shape.nim#L18
01:07:56FromDiscord<Rika> many *unknown* differing objects
01:08:09FromDiscord<impbox> @Rika, you could use ref objects of a common base
01:10:10FromDiscord<Rika> eehh inheritance :Yuuneh:
01:10:21FromDiscord<impbox> or seq of pointers =)
01:11:03FromDiscord<Elegant Beef> I mean it's a tool there
01:11:48FromDiscord<Elegant Beef> I still want that RFC for variants 😄
01:16:01*endragor joined #nim
01:21:59FromDiscord<me2beats> how to say that a proc returns nothing?
01:22:29FromDiscord<me2beats> void
01:24:04FromDiscord<Elegant Beef> you dont need anything
01:24:21FromDiscord<Elegant Beef> `proc a()= ##` is a proc that doesnt do anything and returns nothing 😄
01:24:30FromDiscord<Elegant Beef> or `proc a()= discard`
01:24:44FromDiscord<Rika> whats up with yall and weird ass spacing
01:26:06FromDiscord<Elegant Beef> what?
01:27:53FromDiscord<Rika> `a()=`
01:27:57FromDiscord<Rika> weird spacing
01:28:10FromDiscord<impbox> `proc a ()=`
01:28:36FromDiscord<Elegant Beef> `proc a ( ) =`
01:29:56FromDiscord<Rika> dont make me pull a `pRoC` on you
01:33:17FromDiscord<Elegant Beef> the way i typically write it is if there is no return type `()=` if there is a return type `():type =`
01:35:31FromDiscord<Elegant Beef> Im sure that triggers atleast 2 people
01:37:18*endragor quit (Remote host closed the connection)
01:37:29*endragor joined #nim
01:38:19*Tongir joined #nim
01:39:21*chemist69 quit (Ping timeout: 272 seconds)
01:40:45*chemist69 joined #nim
01:40:58*Tlongir quit (Ping timeout: 272 seconds)
01:48:13*vicfred_ joined #nim
01:50:14*vicfred quit (Ping timeout: 240 seconds)
01:56:01*vr0n quit (Ping timeout: 264 seconds)
01:57:56*ftsf joined #nim
01:59:13FromDiscord<Technisha Circuit (LGBTQIAP+)> DeFiNItLy
01:59:14FromDiscord<Technisha Circuit (LGBTQIAP+)> Jk
01:59:20FromDiscord<Technisha Circuit (LGBTQIAP+)> That's how I do it :p
02:04:53FromDiscord<me2beats> is there calling super?
02:05:28FromDiscord<Rika> no
02:05:50FromDiscord<Rika> you have to explicitly call the proper procs of the base class
02:06:39FromDiscord<me2beats> https://play.nim-lang.org/#ix=2reH↵like that?
02:07:44FromDiscord<me2beats> need A and B to be printed
02:16:40FromDiscord<Avatarfighter> How would I go about calling ObjC methods from nim? I know how to call nim from objc but not the other way around. I assume I need to create a wrapper around libobjc but just wanted to know if anyone knows of a better way.
02:25:55*NimBot joined #nim
02:27:17FromGitter<bung87> there's a obcj runtime wrapper in nim , not updated for years
02:28:34*muffindrake quit (Ping timeout: 244 seconds)
02:28:58FromDiscord<Avatarfighter> Yeah I saw that lmao looks like I'm going to try my best and update/make a new wrapper for libobjc
02:31:02*muffindrake joined #nim
02:31:04FromDiscord<Elegant Beef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma
02:31:14FromDiscord<Elegant Beef> I mean doesnt this still work?
02:31:36FromDiscord<Avatarfighter> I did not see that wow
02:31:53FromDiscord<Avatarfighter> hm I guess I can try
02:31:57FromDiscord<Elegant Beef> Yea it's just like C with an extra step or two it seems
02:32:13FromDiscord<Avatarfighter> I'm doing something a bit bold atm and I'm trying to make an iOS daemon with nim to run on my jailbroken phone lol
02:33:03*audiophile quit (Ping timeout: 256 seconds)
02:37:54FromDiscord<me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reJ
02:39:04FromDiscord<me2beats> inheritance in nim is very unusual
02:40:02FromDiscord<Avatarfighter> I can get an example in a second I'm trying to remember how to indent correctly
02:41:36FromDiscord<Avatarfighter> Inheritance is weird, I will agree but once you get the syntax down its pretty straight forward https://play.nim-lang.org/#ix=2reK
02:42:19FromDiscord<Avatarfighter> When you inherit in nim you need to make your object inherit RootObj
02:42:55FromDiscord<Avatarfighter> I'm pretty bad at explaining but I find that this section of the tutorial describes what I'm trying to say in greater detail https://nim-lang.org/docs/tut2.html#object-oriented-programming-inheritance
02:43:00shashlickdisruptek: almost have v1.0.1 libgit2 ready for direct download
02:43:12*sagax quit (Remote host closed the connection)
02:47:19FromDiscord<me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reM
02:48:17FromDiscord<Avatarfighter> ah im stupid, you need to provide the initialization value for b(), I forgot to say but nim defaults types to their default values
02:49:01FromDiscord<Avatarfighter> so in the example I sent the type for attribute x is an int which defaults to 0 if you don't set a value with the syntax like b(x: VALUE)
02:51:37FromDiscord<me2beats> what could it look like? I'm confused
02:56:42FromDiscord<Elegant Beef> https://play.nim-lang.org/#ix=2reQ
02:57:11FromDiscord<Elegant Beef> Ah shit those are references
02:57:21FromDiscord<Elegant Beef> so should be `newA` and `newB`
02:57:29FromDiscord<Elegant Beef> but anywho that's the nim way of making custom constructors
02:57:44FromDiscord<Elegant Beef> You wrap the named parameters with a proc and pass in parameters you want to change
02:57:55FromDiscord<Elegant Beef> I do have this which automates it↵https://github.com/beef331/constructor
02:58:50FromDiscord<Elegant Beef> But that is just for removing named parameters and doesnt give any special logic
02:59:21*waleee-cl quit (Quit: Connection closed for inactivity)
02:59:35*sagax joined #nim
03:00:35FromDiscord<Elegant Beef> I did want to add an optional proc call which gets called after construction so you can quickly do multiple constructors with seperate logic
03:47:11FromDiscord<j$> does anyone know how multiple defers work in the same scope
04:00:41*nsf joined #nim
04:06:01*supakeen quit (Quit: WeeChat 2.8)
04:06:43*supakeen joined #nim
04:13:12*vicfred_ quit (Quit: Leaving)
04:20:40FromDiscord<impbox> @j$ https://play.nim-lang.org/#ix=2rf3 does this answer your question?
04:20:59FromDiscord<impbox> it appears they happen in reverse order
04:31:22FromDiscord<Elegant Beef> Well it's a `try` below then `finally` next
04:32:08FromDiscord<Elegant Beef> sent a code paste, see https://play.nim-lang.org/#ix=2rf4
04:32:30FromDiscord<Elegant Beef> (edit) 'https://play.nim-lang.org/#ix=2rf4' => 'https://play.nim-lang.org/#ix=2rf5'
05:13:46*narimiran joined #nim
05:35:31*fredrikhr joined #nim
05:49:35*maier joined #nim
05:49:50*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
05:51:25*Lord_Nightmare joined #nim
06:36:39*solitudesf joined #nim
06:38:10*vr0n joined #nim
06:40:10*waleee-cl joined #nim
06:42:29*B4s1l3 joined #nim
06:42:39*B4s1l3 is now known as opDispatch
06:46:25*CyDefect joined #nim
06:54:47*msmorgan quit (Ping timeout: 260 seconds)
06:58:02*msmorgan joined #nim
07:02:36*Vladar joined #nim
07:06:27FromDiscord<flywind> Where is `ast` semantized? I want to know which module I should look at.
07:06:29FromDiscord<flywind> https://play.nim-lang.org/#ix=2rfm
07:12:49FromDiscord<flywind> I need something like `getRawImpl`(corresponding to `getImpl` in macros).
07:23:25*CyDefect quit (Ping timeout: 246 seconds)
07:25:02*CyDefect joined #nim
07:31:17*Tlanger joined #nim
07:33:48*Tongir quit (Ping timeout: 256 seconds)
07:59:59FromDiscord<Varriount> @flywind look at the sem*.nim modules in the compiler directory
08:00:04bungwhat's vue's react's refs in karax?
08:01:01FromDiscord<flywind> @Varriount Thank you! I will have a look at them.
08:01:56FromDiscord<Varriount> @flywind What is your overall goal?
08:02:11FromGitter<alehander92> hmm what's vue ref
08:02:32FromDiscord<flywind> Fix my issues: https://github.com/nim-lang/Nim/issues/14847
08:02:33disbotcreate a new function definitions got Internal error: environment misses: ; snippet at 12https://play.nim-lang.org/#ix=2qsm
08:02:43bungkeep a referrence to a virtual node
08:03:58FromGitter<alehander92> hm, why would one do that
08:04:36bungsince you dont use querySelector in virtual dom right
08:05:07FromGitter<alehander92> hmm
08:05:22*ormiret quit (Ping timeout: 260 seconds)
08:05:31FromGitter<alehander92> well .. i guess you can
08:05:50FromGitter<alehander92> keep a reference to the nim value
08:05:57*npgm quit (Ping timeout: 260 seconds)
08:06:03FromGitter<alehander92> but i am not sure how well would this work
08:06:28bungem, so just assign a node to a variable ?
08:06:32FromGitter<alehander92> like, just preserve the VNode value somewhere
08:06:34FromGitter<alehander92> yes
08:06:48FromGitter<alehander92> if VNode is ref
08:06:51FromGitter<alehander92> it should be ok
08:07:25*LyndsySimon quit (Ping timeout: 244 seconds)
08:07:33*ormiret joined #nim
08:07:57*npgm joined #nim
08:07:57bungok ,got it, think the bad parts is not obvious in dsl structure
08:09:47*LyndsySimon joined #nim
08:15:04FromGitter<alehander92> hmm
08:15:08FromGitter<alehander92> what is not obvious
08:16:19FromGitter<alehander92> i dont know how does it look in react
08:16:22FromGitter<alehander92> vue
08:16:51FromGitter<alehander92> very often tho, the idea is that your state is in your model
08:16:58FromGitter<alehander92> so you just dont need to access your own vnodes
08:17:05FromGitter<alehander92> because you created them based on model
08:17:10FromGitter<alehander92> sometimes there might be exceptions of course
08:17:33Oddmongerfor exporting function, i need the '*'
08:18:01Oddmongerotherwise it will be hidden in imported modules, correct ?
08:18:16FromGitter<alehander92> yeah
08:18:50Oddmongerso, i've understood simple export like « proc foo*:string »
08:19:06FromGitter<alehander92> yeah
08:19:10Oddmongerbut how to export foo( name:string):string ?
08:19:19bungit will add a attribute to node like as ref={theref} in vue and react
08:19:24FromGitter<alehander92> `foo*(name: string)`
08:19:36FromGitter<alehander92> after the name which you export
08:19:39FromGitter<alehander92> same with fields
08:19:42Oddmongeryes, i tried this, bus doen't compile
08:19:56FromGitter<alehander92> there must be something else
08:20:24Oddmongerhum in fact it compiles, but the unit test fails
08:20:34FromGitter<alehander92> hm!
08:22:19Oddmongerlet me show you…
08:22:43Oddmongerhttp://ix.io/2rfD
08:28:46Oddmongerah ok, i've found it
08:29:06Oddmongerthe optional argument
08:31:16*Vladar quit (Quit: Leaving)
08:32:49FromGitter<alehander92> ahh!
08:32:52FromGitter<alehander92> yeah
08:32:58FromGitter<alehander92> what language are you coming from
08:33:30OddmongerC and Lua
08:37:54*vr0n quit (Ping timeout: 240 seconds)
08:41:59bunghmm I mapping js's switch to case of ,found it evaluate at CT.
08:43:03bungjust matching sematics
08:56:02Oddmongerfor completing exercise, i just put a value in the parameter, for having a default value when no args
08:56:18Oddmongerbut how to test the argument is null , if no default value ?
08:56:56FromDiscord<lqdev> there's always a value
08:57:07FromDiscord<lqdev> for strings you would check if the length == 0
08:57:12FromDiscord<lqdev> same for seqs
08:57:26FromDiscord<lqdev> but if you really want some null value, check out the `options` module
09:00:06bungyou can have same name procs with deffrient params.
09:00:35Oddmongerok
09:01:08FromDiscord<lqdev> or that, yeah
09:06:53Oddmongerbut i cannot call a function with no value, if in function declaration there is no default value declared
09:08:06FromDiscord<lqdev> of course you can
09:08:39FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rfK
09:09:17Oddmongerthank you
09:09:37FromDiscord<lqdev> there's a shortcut you can take:
09:09:52FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rfL
09:10:02Oddmongerahhh function overloading
09:10:07FromDiscord<lqdev> the type of `name` is inferred from the default value you pass
09:10:11FromDiscord<lqdev> to reduce typing
09:11:11Oddmongeryes for the moment, i was only using the default value
09:11:28Oddmongerbut i was wondering how to treat no param when no default value defined
09:11:45FromDiscord<lqdev> you can just overload the proc
09:11:45Oddmongerand your first sample with overloaded foo() answered
09:12:04FromDiscord<lqdev> or use an Option[T] from the options module, but that's a less clean solution
09:12:18FromDiscord<lqdev> in terms of API
09:15:00*Vladar joined #nim
09:22:27*oddp joined #nim
09:32:14FromDiscord<dilawar_uchiha> any clues on how i can build nim from my WSL ubuntu for my raspberry pi 1 ( armv6 )
09:38:42Oddmongermay be getting an ARM binary would be easier
09:40:18FromDiscord<dilawar_uchiha> i want the latest release
09:40:29FromDiscord<dilawar_uchiha> raspberry pi repo sucks
09:41:02Oddmongeror build it directly on the raspberry, that's not a big thing to compile
09:42:07Oddmongersetting a toolchain for cross-compiling with WSL is surely interesting, though (may be mingw can do it, else?)
09:42:21FromDiscord<dilawar_uchiha> i tried building on pi
09:42:26FromDiscord<dilawar_uchiha> its failing
09:42:34FromDiscord<dilawar_uchiha> i am retrying for the last time
09:55:36Oddmongerwhich plugin do you use for nim with vim ? I'm using neovim and i saw there was a dedicated plugin, but may be the vim one is more stable
09:59:55FromDiscord<dilawar_uchiha> i dont use vim
10:00:07FromDiscord<dilawar_uchiha> unless its my only option
10:00:27FromDiscord<dilawar_uchiha> because i generate security tokens trying to exit it
10:00:29FromDiscord<dilawar_uchiha> XD
10:01:08Oddmongeri don't use notepad, because i'm always hitting esc for getting command mode :þ
10:01:55Oddmongervim suxx, but other editors suxx even more
10:02:19FromDiscord<dilawar_uchiha> i use vcode when available
10:02:26FromDiscord<dilawar_uchiha> otherwise nano editor
10:02:57*krux02 joined #nim
10:04:45*hoijui joined #nim
10:13:45FromDiscord<dilawar_uchiha> its been like 30 minutes
10:13:59FromDiscord<dilawar_uchiha> it looks like compiler has passed out
10:17:29Yardanicoyou might want -d:leanCompiler
10:17:52Yardanicoit builds much less parts of the compiler, e.g. no js backend, no doc backend
10:18:38FromDiscord<dilawar_uchiha> reducing opt level would be fine ?
10:19:05FromDiscord<dilawar_uchiha> i looked at build.sh
10:19:14FromDiscord<dilawar_uchiha> but no
10:19:25FromDiscord<dilawar_uchiha> its failing koch build tools
10:19:42Yardanicowell you can build tools individually
10:19:46Yardanicoe.g. ./koch nimble
10:20:34FromDiscord<dilawar_uchiha> thats a good idea
10:20:39FromDiscord<dilawar_uchiha> i will try
10:20:45FromDiscord<dilawar_uchiha> thanks !
10:25:31*waleee-cl quit (Quit: Connection closed for inactivity)
10:44:01*chemist69 quit (Ping timeout: 272 seconds)
10:44:48*chemist69 joined #nim
10:47:13FromDiscord<Rika> its prolly failing at nimsuggest i assume
10:51:00FromGitter<alehander92> OddMonger ah lua sounds good
10:52:42FromDiscord<Recruit_main707> can someone help me wrapping this c++ class?↵https://github.com/kipje13/RLBotCPP/blob/8ea082d6d3fd370eabc491e1117eb24cc9231c31/inc/bot.h
10:53:29FromDiscord<dilawar_uchiha> @Rika is nim suggest heavy or something ?
10:54:25FromDiscord<Rika> from what ive heard, its pretty heavy
10:54:35FromDiscord<lqdev> just poorly optimized
10:54:36FromDiscord<Rika> also only useful if you're writing code on the pi
10:57:05FromDiscord<lqdev> on the pi?
10:57:33FromDiscord<dilawar_uchiha> raspberry pi
10:58:00FromDiscord<lqdev> raspberry pi can't handle a resource hog like this though
10:58:10FromDiscord<lqdev> unless the newer ones are really damn powerful
10:58:16FromDiscord<lqdev> I only have a 3B
10:58:18FromDiscord<dilawar_uchiha> its pi1
10:58:32FromDiscord<dilawar_uchiha> armv6 and 250mb ram
10:58:37FromDiscord<Rika> jesus
10:58:44FromDiscord<Rika> thats not gonna handle nimsuggest at all
10:58:52FromDiscord<Rika> dont build nimsuggest you dont need it
10:59:10FromDiscord<dilawar_uchiha> i am totally excited to build games using raylib and nim
10:59:22FromDiscord<dilawar_uchiha> and checking if its the failing part
10:59:40FromDiscord<dilawar_uchiha> yup
10:59:42FromDiscord<dilawar_uchiha> it is
11:04:34FromDiscord<dilawar_uchiha> what tools are absolutely important ?
11:04:39Yardaniconimble
11:04:46Yardanicoall others are optional really
11:04:58Yardanicowell even nimble is optional but then you'll have a much harder time installing packages
11:05:02FromDiscord<dilawar_uchiha> than its done i guess
11:05:21FromDiscord<dilawar_uchiha> nimsuggest is language server kind of thing right ?
11:05:59FromDiscord<lqdev> yeah
11:06:02shashlickThere's already armv6 nightlies builds
11:07:25FromDiscord<dilawar_uchiha> where? @shashlick
11:07:54FromDiscord<dilawar_uchiha> tho its done here now , but from next time i will keep that in mind
11:08:50shashlickhttps://github.com/nim-lang/nightlies/releases
11:12:30FromDiscord<dilawar_uchiha> thanks
11:14:07*abm joined #nim
11:28:49FromDiscord<Recruit_main707> when importing an struct from c++, should i use importc or importcpp?
11:35:10FromDiscord<Zed> i have no experience with import c++, but importcpp seems like the most logical solution
11:35:16FromDiscord<Zed> (edit) 'import' => 'importing'
11:37:42FromDiscord<mratsim> you need to use importcpp or the mangling will be wrong
11:41:44*sagax quit (Remote host closed the connection)
11:41:47FromDiscord<Recruit_main707> ok
11:46:06*vr0n joined #nim
11:49:27*abm quit (Quit: Leaving)
11:51:14*vr0n quit (Quit: WeeChat 2.8)
12:01:21*vicfred joined #nim
12:06:02*supakeen quit (Quit: WeeChat 2.8)
12:06:38*supakeen joined #nim
12:10:47*jken joined #nim
12:40:56*waleee-cl joined #nim
13:08:16*abm joined #nim
13:16:09*lritter joined #nim
13:18:06*filcuc joined #nim
13:19:40filcucis there a reason why the BuildConfigurationFactory doesn't call the doInitialize in restore? i thought to put all my BuildConfiguration initialization in the initializer. Right now it seems that i've to reimplement the fromMap() and manually call the initializer. Is this correct?
13:24:34bungkarax nref seems not work , it looking for `proc setAttr(n: VNode; key: kstring; val: kstring = "")`
13:26:28filcucignore my message
13:34:35FromGitter<alehander92> disruptek
13:34:38FromGitter<alehander92> you on?
13:41:05FromDiscord<Stuffe> according to this page there is an experimental incremental compilation flag for the nim compiler: https://nim-lang.org/docs/nimc.html
13:41:11FromDiscord<Yardanico> no it's not working
13:41:16FromDiscord<Stuffe> ah ok i see :/
13:41:33FromDiscord<Stuffe> man I just did a huge refactoring and now it takes me 9 seconds to compile
13:41:46FromGitter<alehander92> why
13:41:51FromGitter<alehander92> this doesn't sound so usual
13:42:09FromDiscord<Stuffe> why it takes 9 seconds?
13:42:10FromGitter<alehander92> how much time does it take you to compile nim ?
13:42:27FromGitter<alehander92> do you have any large modules
13:42:36FromDiscord<Stuffe> i have about 20k lines of code
13:42:38FromGitter<alehander92> and how much did it take you before
13:42:41FromDiscord<Yardanico> that's not that much
13:42:52FromDiscord<Stuffe> i used choosenim to install nim
13:42:53FromGitter<alehander92> we need numbers on your machine
13:43:01FromGitter<alehander92> because 9 seconds doesnt mean much mate
13:43:05FromDiscord<Stuffe> 1 sec
13:43:14FromDiscord<Stuffe> 2.2 GHz Quad-Core Intel Core i7
13:43:16FromGitter<alehander92> ok, so 9 times slower, this is a good number
13:43:50FromDiscord<Yardanico> does it take a long time on some specific module?
13:43:52FromGitter<alehander92> is it possible that you compare a build including `CC` generation
13:43:58*kayw joined #nim
13:44:02FromDiscord<Stuffe> it was way faster before the refactor though and i removed 2k lines
13:44:03FromGitter<alehander92> for all files
13:44:09FromDiscord<Yardanico> for example you might have a recursive template expansion
13:44:11FromDiscord<Stuffe> which module should I try?
13:44:16FromDiscord<Stuffe> ah
13:44:17FromGitter<alehander92> well, one thing is
13:44:31FromGitter<alehander92> enable the verbosity level and see for which module does it slow down
13:44:35FromDiscord<Yardanico> yeah
13:44:37FromGitter<alehander92> it should show hints with names
13:44:40FromDiscord<Stuffe> ok
13:44:58FromGitter<alehander92> i am not sure about the flag ? Hints:on ? is it enough
13:46:44FromDiscord<Stuffe> im trying with verbose:3
13:47:00FromDiscord<Stuffe> didnt see it, let me try hints
13:47:11*Tlanger quit (Ping timeout: 256 seconds)
13:47:17alehander92_--verbosity:3
13:48:06Yardanicoalehander92_: won't help
13:48:23alehander92_sorry
13:48:31YardanicoAraq ^ is there a way to somehow see which modules are being processed currently? even with --verbosity:3 it shows modules being processed as dots
13:48:42Yardanicoso you can't for example see which module takes long time to process
13:50:01*narimiran quit (Ping timeout: 258 seconds)
13:50:42alehander92_we need to find where does it echo `.` from
13:50:50Yardanicoalehander92_: it's hint[Processing]
13:50:54Yardanicoit was replaced with dots recently
13:51:02Yardanicohttps://github.com/nim-lang/Nim/pull/14418
13:51:04disbotchange the [Processing] messages into dots
13:52:15alehander92_!
13:52:16alehander92_i see
13:53:35FromDiscord<Stuffe> could i compile some of it into a library and link that for "manual incremental compilation"?
13:53:42FromDiscord<Stuffe> i guess the answer is yes, but im a noob
13:53:50Yardanicowell yes but there are no tools for easy "nim-nim" shared library usage
13:53:54Yardanicoyou'll have to exportc/importc
13:54:14FromDiscord<Stuffe> is it a pain?
13:54:32FromDiscord<Stuffe> ill try searching around
13:54:45alehander92_well one can patch msgs.nim
13:54:52alehander92_to just not do the `.` thing for now
13:54:56alehander92_and see what is slow this way
13:54:59alehander92_it works for me
13:55:37alehander92_http://ix.io/2rgI !
13:55:38alehander92_<3
13:55:48alehander92_but otherwise please try to find out what happened
13:55:53alehander92_because if it worked for 1s before
13:56:00alehander92_it should probably work for ~1s now
13:56:07alehander92_do you have like 500 files
13:56:16FromDiscord<Stuffe> no maybe 50
13:56:38alehander92_hm, did you introduce stuff like many generics
13:56:42alehander92_or concepts or new macros
13:56:42Yardanicowell what can make compilation slow is generics/macros
13:56:47alehander92_^
13:56:53Yardanicoalso you can try recompiling nim compiler with PGO for example :)
13:56:57FromDiscord<Stuffe> yeah i refactored 5k lines of macros to 3k...
13:57:00Yardanicoit can give like 20-40% speedup
13:57:07alehander92_hmm
13:57:17Yardanicohttps://forum.nim-lang.org/t/6295
13:57:19FromDiscord<Stuffe> but I tried echoing at the top and at the end of the macros and they seem fast
13:57:20Yardanicohttps://forum.nim-lang.org/t/6295#38828
13:57:34FromDiscord<Recruit_main707> how can i tell the compiler that i want to use an specific version of c++?
13:57:51YardanicopassC/passL ?
13:58:19FromDiscord<Recruit_main707> passC:c++17?
13:58:24Yardanicono
13:58:29Yardanicolike you do it for the C++ compiler
13:58:49Yardanico-std=c++17
13:58:53alehander92_Stuffe is it an open source project
13:59:08FromDiscord<Recruit_main707> ok, ill try that
13:59:09alehander92_zevv had something like a vm profiler
13:59:14Yardanicooh yeah
13:59:17alehander92_i am not sure if this got easily used
13:59:22Yardanicoit is quite easy to use
13:59:23Yardanicokinda
13:59:32Yardanicohttps://github.com/nim-lang/Nim/pull/14833
14:01:24FromDiscord<Stuffe> > Stuffe is it an open source project↵@alehander92_[IRC]#0000 no maybe one day
14:01:33FromDiscord<Stuffe> right now its very experimental
14:01:38alehander92_ook ^
14:04:57*kayw left #nim ("WeeChat 2.8")
14:23:19FromDiscord<Shucks> What memory protection has the memory block allocated with `alloc0`?
14:27:01FromDiscord<lqdev> it's zeroed
14:27:25FromDiscord<lqdev> not exactly sure what you mean by "protection".
14:27:43FromDiscord<Recruit_main707> its what it says in the description of the function iirc
14:27:50FromDiscord<Recruit_main707> i guess thats why he asks
14:29:16*suchasurge quit (Quit: Ping timeout (120 seconds))
14:29:36*suchasurge joined #nim
14:30:19*idxu quit (Quit: ZNC - https://znc.in)
14:30:37*idxu joined #nim
14:30:47*Senketsu joined #nim
14:31:10FromDiscord<Shucks> well with the winapi `VirtualAlloc` allows you to set a protection for the allocated memory. Like rw, rwx, r etc.
14:31:39FromDiscord<Shucks> `https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc`
14:33:09*Senketsu quit (Client Quit)
14:33:13alehander92_it should be possible to call it directly
14:36:24FromDiscord<Recruit_main707> how should this function be wrapped so that it can be overloaded in nim:↵`class Bot {`↵`public:`↵` virtual [AType] GetOutput([AnotherType] gametickpacket) = 0;`
14:37:42FromDiscord<Recruit_main707> func getOutput*(gametickpacket: [AnotherType]): [AType] {.header: headerfile, importcpp.}`
14:37:50FromDiscord<Recruit_main707> would that work?
14:43:25Zevvalehander92_: it's easy peasy. It just never got merged
14:45:51alehander92_awesome
14:50:11FromDiscord<Stuffe> alehander92, yardanico I just realized I generate like 30 procs with the same name but different signatures (I have a lot of enums) and then later I call that function name in a case/switch from another macro proc. Do you guys think it would be worthwhile to uniquely name these procs?
14:51:55FromDiscord<Stuffe> seems like a pattern that could entertain a type checker for a while
14:54:50*maier_ joined #nim
14:57:08*maier quit (Ping timeout: 258 seconds)
14:59:20*filcuc quit (Ping timeout: 245 seconds)
14:59:42*maier_ quit (Ping timeout: 256 seconds)
15:00:09*mikebelanger joined #nim
15:00:58*filcuc joined #nim
15:01:33mikebelangerhey guys! looks like latest nim devel (1.3.5 on MacOSX: amd64) trips on Jester
15:01:51Yardanicowhat jester?
15:02:02YardanicoI mean what version
15:02:04Yardanicoand what error
15:02:19mikebelangersimple fix though. Just changed the daysForward function's initInterval -> initTimeInterval
15:02:21Yardanicobecause latest tagged jester might not be compatible with devel (some long-deprecated procs were removed in devel)
15:02:23mikebelangeruh let me just check jester
15:02:27Yardanicoah yes, that's fixed in jester head
15:02:47Yardaniconimble install jester@#head
15:02:49Yardanicoto install latest jester
15:03:50*NimBot joined #nim
15:04:20mikebelangerohh ok I'm sorry :P. sorry I'm just getting used to the nimble
15:04:48mikebelanger@Yardanico just upgraded as per your command. I see the fix :)
15:06:13*ssbr quit (Ping timeout: 264 seconds)
15:09:03mikebelangerthanks
15:12:29*sagax joined #nim
15:19:25FromDiscord<Recruit_main707> i love this idea https://github.com/nim-lang/RFCs/issues/174
15:19:27disbotC++ interop: cppMethod/cppVirtual/cppOverride ; snippet at 12https://play.nim-lang.org/#ix=2rh9
15:21:32*Trustable joined #nim
15:29:44*mbuchel joined #nim
15:29:58FromDiscord<Clyybber> Araq: Hey, are you there?
15:31:28*nsf quit (Quit: WeeChat 2.8)
15:31:59*mbuchel quit (Client Quit)
15:33:28*filcuc quit (Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/)
15:43:13FromDiscord<konradmb> Quick (maybe not) question: how to create a directory?
15:44:02FromGitter<ynfle> https://nim-lang.org/docs/os.html#createDir%2Cstring
15:45:04FromGitter<ynfle> or https://nim-lang.org/docs/os.html#existsOrCreateDir%2Cstring
15:45:43FromDiscord<konradmb> Oh, really 🤦‍♂️
15:46:00FromDiscord<konradmb> I've been always searching for mkdir
15:46:06FromDiscord<konradmb> Thanks!
15:56:11FromDiscord<Shucks> I'm trying to nop some bytes in memory. Any idea why this doesn't works? https://play.nim-lang.org/#ix=2rhi
15:57:12FromDiscord<Shucks> ignore detour size
16:03:07FromDiscord<Clyybber> @Shucks What specifically doesn't work?
16:03:18FromDiscord<Clyybber> The snippet itself I would expect to fail
16:03:25FromDiscord<Clyybber> even after removing DETOUR_SIZE
16:03:33FromDiscord<Clyybber> since you are accessing some random pointer
16:04:27FromDiscord<Shucks> thats just a example. I know which memory address I want to nop out
16:05:36FromDiscord<Shucks> Well there happens actually nothing at that memory region im calling it
16:05:46FromDiscord<Clyybber> https://play.nim-lang.org/#ix=2rhm seems to work
16:06:31FromDiscord<Clyybber> https://play.nim-lang.org/#ix=2rho overwriting the whole region also works
16:08:03FromDiscord<Shucks> https://play.nim-lang.org/#ix=2rhr
16:08:11FromDiscord<Shucks> true. Might be a issue on my end. Gonna check it out
16:09:35FromDiscord<Shucks> What I was wondering: cast[pointer](hkTmp[0]) would be the same as hkTmp[0].addr right
16:10:03FromDiscord<Shucks> Well nvm. Gonna check it out on nim playground
16:10:45FromDiscord<Clyybber> nope
16:11:00FromDiscord<Clyybber> casting to a pointer will reinterpret whatever is at hkTmp[0] as a pointer
16:11:25FromDiscord<Clyybber> hkTmp[0].addr will give you where hkTmp[0] is actually at
16:11:26FromDiscord<Shucks> so cast[pointer](hkTmp)
16:12:37FromDiscord<Clyybber> Not a good idea since hkTmp is a seq
16:12:46FromDiscord<Recruit_main707> cast[pointer](addr hkTmp[0]) maybe is wat you want?
16:13:03FromDiscord<Shucks> sent a code paste, see https://play.nim-lang.org/#ix=2rhs
16:13:24FromDiscord<Shucks> Yea theres a difference ;p
16:13:47FromDiscord<Clyybber> Yep, since seqs point somewhere
16:14:03FromDiscord<Clyybber> So when you want to know where the array part begins, take the address of the first element
16:14:35FromDiscord<Clyybber> cast[pointer](a) will give you the pointer pointing to the array part of the sequence
16:15:01FromDiscord<Clyybber> But its not a good idea
16:15:15FromDiscord<Clyybber> since it relies on the underlying representation of a seq
16:15:29FromDiscord<Clyybber> and I'm pretty sure you don't actually want that
16:15:37FromDiscord<Clyybber> this won't work on arc for example
16:15:44FromDiscord<Clyybber> since a seq there is a pointer + len pair
16:15:57PrestigeDid PMunch die? He disappeared right before I wanted to talk to him
16:16:12FromDiscord<Clyybber> ~last PMunch
16:16:13FromDiscord<Recruit_main707> i think so, i also tried to contact him
16:16:13disbotno footnotes for `last`. 🙁
16:16:18FromDiscord<Clyybber> !last PMunch
16:16:19disbotPMunch quit 74 days ago and last spoke 4 days ago
16:16:22FromDiscord<Shucks> Fancy. Thank you 🙂
16:16:26FromDiscord<Clyybber> np
16:16:30FromDiscord<Recruit_main707> F
16:16:40FromDiscord<Clyybber> Prestige: Looks like he's off for a few days now
16:16:48PrestigeYeah :(
16:17:20*mikebelanger quit ()
16:17:54FromDiscord<Shucks> Also filling that sequence feels weird. Theres nothing like memset which allows me to set the value aswell. zeroMem just fills it with zeros (well how the name says)
16:18:15FromDiscord<Vindaar> PMunch is on vacation afaik. He mentionet that on his test stream on the weekend
16:18:31PrestigeThanks
16:18:58FromDiscord<Recruit_main707> so he will come back, nice
16:20:43FromDiscord<Clyybber> @Shucks You can implement a memSet yourself
16:20:48FromDiscord<Recruit_main707> or wrap one
16:21:09FromDiscord<Clyybber> But IMO a for loop is better in all cases really
16:21:15FromDiscord<Clyybber> (edit) 'for' => ''
16:21:36FromDiscord<Clyybber> easier to read/understand
16:21:37*vsantana joined #nim
16:21:38FromDiscord<Recruit_main707> https://forum.nim-lang.org/t/1854↵as this thread says, it will be optimised by the compiler in most cases
16:22:52FromDiscord<Shucks> interesting
16:23:19FromDiscord<Recruit_main707> wrapping things is interesing, but i am not sure if i am doing things correctly, and i feel that after having spent 2 hours wrapping a basic thing, i t¡will test it and wont work, too much tension xD
16:23:40FromDiscord<Recruit_main707> (edit) 't¡will' => 'will'
16:27:48*tane joined #nim
16:28:28*dadada joined #nim
16:28:32dadadahi
16:28:40dadadamaybe someone can help me out with this https://github.com/nim-lang/x11/issues/37
16:28:40disbotIcon changing example wanted
16:32:21FromDiscord<Recruit_main707> no experience with x11
16:32:26Prestigedadada: can you show what you've tried, and what the error is?
16:36:19PrestigeThis has some examples for XChangeProperty if that's what you're struggling with: https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdowpkg/windowmanager.nim
16:47:36*skelett1 joined #nim
16:48:00*Hotbees_ joined #nim
16:55:28*matlock quit (*.net *.split)
16:55:29*Hotbees quit (*.net *.split)
16:55:36*lnxw37d4 quit (*.net *.split)
16:55:39*Cadey quit (*.net *.split)
16:55:41*skelett quit (*.net *.split)
16:55:42*qwertfisch quit (*.net *.split)
16:55:44*ldlework quit (*.net *.split)
16:55:45*Hotbees_ is now known as Hotbees
16:56:42*stisa[m] quit (Remote host closed the connection)
16:56:44*MTRNord[m] quit (Remote host closed the connection)
16:56:44*planetis[m] quit (Read error: Connection reset by peer)
16:56:45*Zoom[m] quit (Read error: Connection reset by peer)
16:56:45*oneark quit (Read error: Connection reset by peer)
16:56:46*unclechu quit (Read error: Connection reset by peer)
16:56:46*skrylar[m] quit (Read error: Connection reset by peer)
16:56:47*nerdrat[m] quit (Read error: Connection reset by peer)
16:56:47*watzon quit (Read error: Connection reset by peer)
16:56:49*codic quit (Read error: Connection reset by peer)
16:56:49*dzamo[m] quit (Remote host closed the connection)
16:56:50*reversem3 quit (Read error: Connection reset by peer)
16:56:55*sendell quit (Read error: Connection reset by peer)
16:56:56*neceve quit (Write error: Connection reset by peer)
16:56:56*slackytude[m] quit (Remote host closed the connection)
16:56:57*ee7[m] quit (Read error: Connection reset by peer)
16:56:59*Zambyte[m] quit (Remote host closed the connection)
16:56:59*BitPuffin quit (Write error: Connection reset by peer)
16:57:00*GitterIntegratio quit (Write error: Connection reset by peer)
16:57:01*k0mpjut0r quit (Write error: Connection reset by peer)
16:57:02*wontruefree[m] quit (Read error: Connection reset by peer)
16:57:02*xicheng[m] quit (Read error: Connection reset by peer)
16:58:47*matlock joined #nim
16:58:47*Cadey joined #nim
16:58:47*qwertfisch joined #nim
16:58:47*ldlework joined #nim
17:00:13*smitop joined #nim
17:03:53*reversem3 joined #nim
17:06:20Oddmongeris it mandatory to define a type of an array, before assigning the array itself ?
17:06:57Oddmongerah no
17:07:00FromDiscord<lqdev> the type can be inferred from the elements
17:07:16Oddmongeri was trying to do var a = array[10, int]
17:07:25Oddmongerinstead of var a:array[10,int]
17:18:46*fredrikhr quit (Ping timeout: 246 seconds)
17:23:22Oddmongercan you tell me where in the manual i could find the way to define a variable with a number, and the sum of all preceding numbers (at compile time if possible) ?
17:23:51Oddmongerah, metaprogramming it is (i was searching macros)
17:24:14FromDiscord<dilawar_uchiha> is it possible to output android compatible C source from nim
17:24:26FromDiscord<dilawar_uchiha> (edit) 'nim' => 'nim?'
17:25:03Oddmongeryou need the ndk for cross compilation
17:25:15FromDiscord<dilawar_uchiha> if i get that right
17:25:32*natrys joined #nim
17:25:43FromDiscord<dilawar_uchiha> it means i can compile nim c source for android/
17:25:44FromDiscord<dilawar_uchiha> ?
17:26:03FromDiscord<dilawar_uchiha> even though android uses linux kernal
17:26:24FromDiscord<dilawar_uchiha> it uses lib bionic intead of glibc
17:27:04Oddmongeryou need a java bridge too, if you want to execute your code from elsewhere than android's terminal
17:27:47Oddmongeryou will have to generate an APK (you can autosign for a debug packet, if you don't have dev account)
17:27:54FromDiscord<dilawar_uchiha> it might sound little weird
17:28:01FromDiscord<dilawar_uchiha> but i want to do game dev in nim
17:28:12FromDiscord<dilawar_uchiha> on android and raspberry pi
17:28:35Oddmongerlook at sdl2 sources, there a simple example shipped with , for understanding how to proceed with android
17:29:01Oddmongeri guess there is documentation too for android, in the compiler's guide of nim
17:29:42FromDiscord<dilawar_uchiha> i am planning to use raylib
17:32:34Oddmongerhehe, i've written the linux script for android building
17:32:47*BitPuffin joined #nim
17:32:47*MTRNord[m] joined #nim
17:32:47*planetis[m] joined #nim
17:32:47*unclechu joined #nim
17:32:47*oneark joined #nim
17:32:47*watzon joined #nim
17:32:47*k0mpjut0r joined #nim
17:32:47*Zambyte[m] joined #nim
17:32:47*lnxw37d4 joined #nim
17:32:47*sendell joined #nim
17:32:48*codic joined #nim
17:32:48*GitterIntegratio joined #nim
17:32:48*nerdrat[m] joined #nim
17:32:48*dzamo[m] joined #nim
17:32:48*neceve joined #nim
17:32:53*stisa[m] joined #nim
17:32:53*ee7[m] joined #nim
17:32:53*xicheng[m] joined #nim
17:32:53*skrylar[m] joined #nim
17:32:54*Zoom[m] joined #nim
17:32:54*slackytude[m] joined #nim
17:32:54Oddmongerfor raylib
17:32:55*wontruefree[m] joined #nim
17:33:11Oddmongerbut is raylib wrapped in nim ?
17:34:42FromDiscord<dilawar_uchiha> no
17:35:00FromDiscord<dilawar_uchiha> i am gonna use the version right off the trunk
17:35:19FromDiscord<Zachary Carter> raylib does have nim bindings
17:35:23FromDiscord<Zachary Carter> !repo raylib-forever
17:35:24disbothttps://github.com/Guevara-chan/Raylib-Forever -- 9Raylib-Forever: 11:.raylib headers for Nim anytime.: 15 32⭐ 0🍴 7& 1 more...
17:35:49*mbuchel joined #nim
17:35:59FromDiscord<dilawar_uchiha> i actually want to learn doing all this myself
17:36:03mbucheldoes anyone know how to use an extern nim in nimterop?
17:36:13mbuchelextern variable
17:36:27FromDiscord<Zachary Carter> learn doing what exactly?
17:36:34FromDiscord<Zachary Carter> wrapping raylib?
17:37:47FromDiscord<dilawar_uchiha> and compiling it for android os
17:39:29FromDiscord<dilawar_uchiha> i can skip android for now
17:40:37FromDiscord<Zachary Carter> maybe wrap some other library that isn't already wrapped as a learning exercise?
17:40:47FromDiscord<Zachary Carter> it's just a suggestion - ultimately do whatever you feel like doing 🙂
17:40:53FromDiscord<dilawar_uchiha> sdl ? done
17:40:57FromDiscord<dilawar_uchiha> opengl ? done
17:41:04FromDiscord<Zachary Carter> there are a ton of libraries out there
17:41:11FromDiscord<dilawar_uchiha> vulkan ?
17:41:17FromDiscord<Recruit_main707> done
17:41:35FromDiscord<Zachary Carter> maybe the bullet C API that's on github
17:41:50FromDiscord<Zachary Carter> or if you're really feeling ambitious nvidia's physx
17:41:52FromDiscord<Recruit_main707> That’s a good one
17:42:03FromDiscord<dilawar_uchiha> that wont run on pi
17:42:04FromDiscord<dilawar_uchiha> XD
17:43:07FromDiscord<Zachary Carter> microui
17:43:19FromDiscord<dilawar_uchiha> i am planning to get arm intrinsics on nim though
17:43:25FromDiscord<Zachary Carter> I dunno - was just a suggestion.
17:43:51FromDiscord<lqdev> when should I use {.inline.}?
17:44:02FromDiscord<Zachary Carter> when you want to inline a function?
17:44:08FromDiscord<lqdev> well I know that
17:44:17FromDiscord<dilawar_uchiha> i think he is asking when to inline
17:44:28FromDiscord<lqdev> so basically for simpler functions (for math, etc)?
17:44:32FromDiscord<Zachary Carter> well compilers are pretty good about already inlining functions
17:44:36FromDiscord<dilawar_uchiha> normally its a good idea to let compiler to it
17:44:38FromDiscord<Zachary Carter> but if a small function gets called often
17:44:52FromDiscord<Zachary Carter> you can inline it
17:44:56FromDiscord<lqdev> ok
17:45:15FromDiscord<dilawar_uchiha> if you inline wrongly it will cause cache misses , ultimately hitting performance worse
17:46:17FromDiscord<Zachary Carter> only way to really know is to checkout the asm
17:46:33FromDiscord<Zachary Carter> and executable size
17:46:45FromDiscord<dilawar_uchiha> @Zachary Carter how to tell nim to give -Ofast flag to gcc
17:46:51FromDiscord<dilawar_uchiha> while compiling code
17:46:56FromDiscord<lqdev> --passC:-Ofast
17:47:03FromDiscord<Zachary Carter> well
17:47:10FromDiscord<dilawar_uchiha> thanks @lqdev
17:47:15FromDiscord<Zachary Carter> I wouldn't do it that way...
17:47:23FromDiscord<dilawar_uchiha> why ?
17:47:39FromDiscord<lqdev> well we already have --opt:speed
17:47:42FromDiscord<lqdev> and -d:releas
17:47:43FromDiscord<Zachary Carter> `--opt:none|speed|size`
17:47:43FromDiscord<lqdev> (edit) '-d:releas' => '-d:release'
17:47:49FromDiscord<Zachary Carter> or `-d:release` / `-d:danger`
17:47:59FromDiscord<dilawar_uchiha> -d danger is ?
17:48:07FromDiscord<dilawar_uchiha> aggressive optimisation ?
17:48:12FromDiscord<lqdev> disables checks
17:48:21FromDiscord<lqdev> and otherwise is the same as -d:release
17:48:28FromDiscord<Zachary Carter> yeah - you can see exactly what it does if you look at the nim source
17:48:57FromDiscord<lqdev> https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L55
17:48:58FromDiscord<dilawar_uchiha> c interop with nim is almost 0 cost right ?
17:49:07FromDiscord<lqdev> not almost
17:49:09FromDiscord<lqdev> it *is* 0 cost
17:50:08FromDiscord<Zachary Carter> yes because Nim compiles to C/C++
17:50:18FromDiscord<Zachary Carter> or Obj-C or JS
17:51:44FromDiscord<dilawar_uchiha> i am tracking this project since 0.20 release
17:52:05FromDiscord<dilawar_uchiha> i knew it was something good
17:52:30FromDiscord<dilawar_uchiha> but it 0 cost interop exceeded my expectation
17:52:57FromDiscord<Clyybber> :)
17:53:37FromDiscord<lqdev> well, for Nim it's as simple as generating an appropriate C call
17:53:44FromDiscord<lqdev> so no wonder it's zero-cost
17:54:02*mbuchel quit (Quit: WeeChat 2.8)
17:54:37FromDiscord<dilawar_uchiha> so i can pass nim arrays in c functions without thinking ?
17:54:46FromDiscord<lqdev> not really
17:55:03FromDiscord<lqdev> `array`s would work but you have to take the address of the first element where C expects a pointer
17:55:09FromDiscord<lqdev> aka `addr myArray[0]`
17:55:43FromDiscord<Clyybber> no arrays just work
17:55:55FromDiscord<Clyybber> for sequences you have to take the address of the first element of course
17:55:59FromDiscord<Clyybber> since sequences are on the heap
17:56:41FromDiscord<dilawar_uchiha> there is this android release in this nightly build
17:56:58FromDiscord<dilawar_uchiha> it means it runs on android terminal or it outputs for android ?
17:57:00FromDiscord<lqdev> @Clyybber ah good to know, never dealt with arrays :P
17:57:39FromDiscord<Clyybber> @dilawar_uchiha Both :)
17:57:53FromDiscord<Clyybber> But yeah its the build that is compiled to run on android
17:58:01*vsantana_ joined #nim
17:58:15FromDiscord<Clyybber> You can cross-compile too
18:00:04*vsantana quit (Ping timeout: 246 seconds)
18:05:57FromGitter<Knaque> I've made a thing: https://github.com/Knaque/jeknil
18:06:02FromDiscord<dilawar_uchiha> https://github.com/akavel/hellomello ↵its still valid right @Clyybber
18:06:28FromDiscord<Clyybber> yeah
18:15:15*narimiran joined #nim
18:28:39FromDiscord<Shucks> sent a code paste, see https://play.nim-lang.org/#ix=2ri1
18:28:59FromDiscord<Shucks> (edit) 'https://play.nim-lang.org/#ix=2ri1' => 'https://play.nim-lang.org/#ix=2ri2'
18:29:02dadadaPrestige: https://pastebin.com/ASyApFjD
18:29:24dadadaPrestige: Error: type mismatch: got <int64> but expected 'int literal(16)'
18:29:33dadadaPrestige: this error shows up where the first 42... number is
18:30:18PrestigeHow is that 'puchar' not throwing an error
18:31:55Prestige4294901760 too large for a culong
18:32:13dadadaPrestige: oh, I copied the example from line 172 onwards from https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdowpkg/windowmanager.nim
18:32:16*endragor quit (Remote host closed the connection)
18:32:20dadadacorrected puchar to Puchar now
18:32:39dadadaPrestige: those numbers came from the C example
18:32:43*endragor joined #nim
18:33:05dadadaPcuchar
18:33:57shashlickmbuchel: what exactly are you trying to wrap?
18:34:04shashlickvars should be supported already
18:35:14Prestigedadada: check the data type for culong, looks like it was expecting a 16 bit int for some reason
18:37:04dadada culong* {.importc: "unsigned long", nodecl.} = uint
18:37:05dadada ## This is the same as the type ``unsigned long`` in *C*
18:37:08*endragor quit (Ping timeout: 258 seconds)
18:37:49*endragor joined #nim
18:38:23FromGitter<matrixbot> `pooggy` Is there a true random generator module in Nim?
18:39:16*audiophile joined #nim
18:40:36FromDiscord<exelotl> @Shucks is this the same error from the other day? Sorry I don't know the solution but you might get some new answers by making a forum post
18:40:50dadadaPrestige: I get the same error even when using uint64..
18:40:58FromDiscord<exelotl> (edit)
18:41:08PrestigeI think I know why
18:41:16Prestigegive me 1 sec to test it
18:41:28dadadaokay, you get 2 seconds
18:41:48dadadafor second in 0..1
18:42:14PrestigeI'm getting a different error: type mismatch: got <array[0..1283, int]> but expected 'array[0..1283, culong]'
18:42:32*endragor quit (Ping timeout: 272 seconds)
18:42:41Prestigeyou values are seen as ints instead of culongs?
18:43:09dadadamaybe
18:44:20dadadaPrestige: if I do longnumber.culong ... it complains that it gets a culong but expects int16
18:45:45PrestigeI'm not getting an error
18:45:57dadadaah, it's the first number 16 that controls it... when I change it to 64, it expects 64 bit int literals but it's not satisfied either
18:46:27dadadaPrestige: what nim version
18:46:28dadada?
18:46:40Prestige1.2.0
18:46:44dadadame too
18:47:00Prestigetry with a 1 length array
18:47:05Prestigeto debug it
18:47:38Prestigevar buffer: array[1, culong] = [4294901760.culong]
18:49:33dadadaPrestige: yes, that compiles and runs, but the icon is unchanged ... :-( that would have been a nice thing to see the icon changed
18:49:48*skelett1 quit (Quit: WeeChat 2.7.1)
18:50:13*skelett joined #nim
18:54:54dadadaPrestige: all previous literals also need to be culong so it recognizes it correctly..., I'd like tell Nim that all of them are culongs
18:55:02dadadawithout needing to add .culong everywhere
18:58:07*maier joined #nim
18:58:29dadadasomething like = culongArray[323, 432, ...]
18:59:14dadadamaybe I can do it with a converter
18:59:34*SunnyDave joined #nim
19:00:53dadadayes, works with a converter, and icon is visible now
19:01:06FromDiscord<Zachary Carter> Hmm.... I'm writing a C API with Nim around a C++ API that I wrapped and I'm not sure how to call a default wrapped C++ constructor. The C++ code for the library I'm wrapping tries to deallocate an object and then reallocate it - so it assumes the default constructor has been callled
19:01:29FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2ric
19:02:33FromDiscord<Zachary Carter> but I receive the following error - ```/Users/zacharycarter/dev/junkers/src/animation.nim:4:262: error: call to implicitly-deleted default constructor of 'union (anonymous union at↵ /Users/zacharycarter/dev/junkers/src/animation.nim:4:168)'```
19:02:36*CyDefect quit (Quit: Verlassend)
19:07:38FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2rid
19:10:00*SunnyDave quit (Remote host closed the connection)
19:12:34Prestigedadada: had to step away. You got everything working?
19:14:44FromDiscord<Recruit_main707> are there any plans on adding more backends to nim? kind of how haxe does?
19:15:26dadadaPrestige: yes, the first array entries need to be written as 234.culong and for the rest I could use a converter from int64 to culong ... that worked
19:16:50FromDiscord<Zachary Carter> maybe a Zig backend at some point?
19:16:56FromDiscord<Zachary Carter> what other backends would you want?
19:17:26*endragor joined #nim
19:19:31FromDiscord<Recruit_main707> id love .net somehow, if i had to choose something, i dont feel like i need it thoigh
19:19:35FromDiscord<Recruit_main707> thouh*
19:19:39FromDiscord<Recruit_main707> fuck
19:21:30FromDiscord<Zachary Carter> have you read - https://www.euantorano.co.uk/posts/nim-with-c-sharp-net/ ?
19:21:59*endragor quit (Ping timeout: 258 seconds)
19:21:59FromDiscord<Zachary Carter> I don't think C# would make much sense for a Nim backend
19:22:14FromDiscord<Recruit_main707> not c# as such, bare .net rather
19:22:29FromDiscord<Zachary Carter> like bytecode?
19:22:33FromDiscord<Recruit_main707> yes
19:22:49FromGitter<kennymalac> how come my nim let variables are being overriden by other C threads? any ideas why this would be the case?
19:23:29FromDiscord<exelotl> Surely a zig backend isn't worth it right? Since zig is another young language and Nim can already run in all the places that zig can
19:23:52FromGitter<kennymalac> I am compiling it as a shared library and using it in a C program, and that C program is using several thraeds calling that function. it seems that the memory addresses in each of the functions that are nimcalled is the same
19:23:59FromDiscord<Zachary Carter> well once Zig becomes a safer C and more mature it does
19:24:43FromDiscord<Zachary Carter> @Recruit_main707 - I don't see it happening
19:24:49FromDiscord<Zachary Carter> Just use Nim 🙂
19:24:57FromDiscord<Zachary Carter> or C# if you prefer it
19:25:36FromDiscord<Varriount> kennymalac: Do you have a code sample?
19:26:17FromDiscord<Recruit_main707> yeah, me neither, but it would allow us to, basically use nim wherever c# can, without the need of wrappers of any kind
19:27:28FromDiscord<Zachary Carter> but you might as well just write in C# then heh
19:27:45FromDiscord<Zachary Carter> C# isn't a bad language at all
19:28:01FromGitter<kennymalac> dealing with a proprietary codebase so would be difficult to produce. But I have multiple c threads calling the same {.exportc.} function. It seems that the nimcall function that I call within it sometimes has the same memory addresses for the variables, even when the separate thread is not finished with those addresses
19:28:12FromGitter<kennymalac> Is https://github.com/nim-lang/Nim/issues/6208 relevant ? or is this expected behavior
19:28:12FromDiscord<Shucks> So I got a proc defined with asmNoStackFrame, which should result in a naked function correct? I still got a push and mov in that function for any reason: https://media.discordapp.net/attachments/371759389889003532/730867920728621215/nimlangasm.png
19:28:13disbotStack bottom issues in foreign thread.
19:31:09*evilkhaoskat joined #nim
19:37:42leorize[m]I'd love a jvm backend just so I can write android apps :P
19:39:17*evilkhaoskat quit ()
19:41:13*evilkhaoskat joined #nim
19:42:36FromDiscord<Recruit_main707> why doesnt c2nim add {importcpp, etc.} pragmas when i run it?↵it just does a transpilation
19:42:46FromGitter<kennymalac> https://news.ycombinator.com/item?id=11693299 here people talk about problems with Nim GC and C interop
19:43:22FromDiscord<Varriount> kennymalac: Does the code keep in mind that (at least with the default GC) Nim uses thread-local heaps?
19:43:30FromGitter<kennymalac> I wonder if this is relevant. do I have to manually manage memory
19:43:42FromGitter<kennymalac> I have no control over the C code
19:43:53FromDiscord<Recruit_main707> you can, i dont think you will need
19:44:08FromDiscord<Varriount> Yes, but are you passing Nim allocated memory back into the C program?
19:45:21FromGitter<kennymalac> I think so, I nimcall a function and get a value back called results and then basically return $results back to C program
19:46:02FromDiscord<Varriount> kennymalac: Do $results contain references?
19:46:14FromDiscord<Varriount> (reference types)
19:46:22FromDiscord<Varriount> Also, I'm trying to remember whether the GC needs to be initialized if called from a thread that wasn't created by Nim.
19:47:26FromGitter<kennymalac> it's a string
19:48:14FromGitter<kennymalac> for context, I'm using https://github.com/ba0f3/ngxcmod.nim and my function is being called by nginx essentially
19:49:45FromGitter<kennymalac> so I'm calling a function within proc hello(ctx: Context) {.exportc.} or equivalent and within that function, I call httpclient to get some HTML, and for some reason after that the variables are not correct anymore if a separate thread became active before that
19:50:01FromGitter<kennymalac> the function calls in separate threads have the same memory locations
19:50:44FromGitter<kennymalac> to get some JSON*
19:51:46FromDiscord<Varriount> kennymalac: And you're sure that different Nginx threads are calling those functions?
19:53:38*evilkhaoskat quit (Remote host closed the connection)
19:53:44FromGitter<kennymalac> not 100% sure. let me see if bug is still there when I set worker_processes to 1
19:53:45FromDiscord<Varriount> kennymalac: Try compiling with --gc:arc
19:53:54*endragor joined #nim
19:55:15FromGitter<kennymalac> I'm on 1.0.2, nim 1.2 doesn't compile the shared library correctly for some reason, I suspect ngxcmod is broken with 1.2
19:55:34FromDiscord<Varriount> Hm, what error do you get with 1.0.2?
19:55:39FromDiscord<Varriount> *1.2
19:56:04FromGitter<kennymalac> a symbol was missing being called in the shared library
19:56:25FromDiscord<Varriount> What symbol?
19:56:43FromDiscord<Varriount> Could you post the entire error in a gist?
19:57:26FromDiscord<Zachary Carter> are you adding `{.exportc, dynlib, cdecl.]` to the exported proc?
19:57:37FromDiscord<Zachary Carter> if you don't have `exportc` and `dynlib` it will not be exported in the shared library
19:57:39FromDiscord<Zachary Carter> just FYI
19:58:06FromGitter<kennymalac> nginx: [error] function ngx_link_func_init_cycle(ngx_link_func_cycle_t *cycle) not found in "/usr/local/nginx/modules/dataAPIServer.so", at least create an empty init function block
19:58:09FromGitter<kennymalac> that was the error
19:58:33FromGitter<kennymalac> in the ngxcmod code it shows only exportc, was this a recent change then?
19:59:19FromDiscord<Zachary Carter> I don't think so?
19:59:35FromDiscord<Zachary Carter> it's probably a bug
19:59:48*endragor quit (Ping timeout: 272 seconds)
20:00:33*evilkhaoskat joined #nim
20:01:23FromGitter<kennymalac> mmm. memory corruptioin still happens with 1 nginx worker process
20:01:48FromDiscord<Varriount> Are you calling setupForeignThreadGC?
20:02:02FromGitter<kennymalac> no
20:03:04FromDiscord<Varriount> @Zachary Carter It looks like this macro is misbehaving on 1.2? https://github.com/ba0f3/ngxcmod.nim/blob/df9823355b2450d160d5858fa2d06b24826b3ea0/src/ngxcmod.nim#L24
20:04:45FromDiscord<Varriount> That being said, its not hard to work around. kennymalac: replace the `init` pragma with `exportc: "ngx_link_func_init_cycle", dynlib, cdecl`
20:05:01*evilkhaoskat quit (Ping timeout: 246 seconds)
20:05:54FromDiscord<Varriount> And the same if you have an exit function, `exportc: "ngx_link_func_exit_cycle", dynlib, cdecl`
20:06:13FromDiscord<Varriount> Then try compiling with --gc:arc
20:07:03FromGitter<kennymalac> iirc arc isn't stable yet?
20:08:22FromGitter<kennymalac> setupForeignThreadGc() doesn't seem to help
20:08:37*maier quit (Ping timeout: 264 seconds)
20:10:14FromGitter<kennymalac> I can try arc but I am weirded out I am getting such memory corruption
20:10:32FromDiscord<Varriount> Arc is stable enough. And if you want to easily call Nim from C, it's either Arc or Boehm
20:11:39FromDiscord<Varriount> Interop from Nim *to* C is easy. The other way around is harder, because C doesn't have any notion of things like type information, garbage collectors, closures, etc.
20:11:42FromGitter<kennymalac> I'll try boehm first
20:12:08FromDiscord<Varriount> You'll have to have the Boehm library installed. Depending on your system it might be a package
20:12:53FromGitter<kennymalac> oh lol
20:13:00FromGitter<kennymalac> in that case I'll try arc
20:13:44FromDiscord<Varriount> Boehm is a library that you can actually use to give plain C a garbage collector. It's neat, if not super-performant (because of the tracking it has to do).
20:14:22FromGitter<kennymalac> yes
20:14:25*Vladar quit (Quit: Leaving)
20:14:44FromDiscord<Varriount> And don't forget to add the cdecl and dynlib pragmas. Incorrect calling conventions can cause memory corruption too
20:18:28FromDiscord<Varriount> kennymalac: Any luck?
20:19:26FromGitter<kennymalac> LOL okay it works with arc
20:19:27FromGitter<kennymalac> wtf
20:19:35FromGitter<kennymalac> wtf I love arc now
20:21:12FromDiscord<Varriount> Yeah, it's because the regular GC needs to be initialized. It would probably also work if you called setupForeignThreadGc at the beginning of every function.
20:21:24FromGitter<kennymalac> every damn function?
20:21:35FromDiscord<Varriount> Well, every function that Nginx calls
20:21:51*vsantana_ quit (Quit: leaving)
20:22:39FromDiscord<Varriount> It's because the nginx link library doesn't have a hook for thread initialization (which is odd, since even C/C++ programs would need that at some point).
20:23:07*vsantana joined #nim
20:23:10FromGitter<kennymalac> well I tried adding the setup at the beginning of the proc and teardown at the end, did not fix it
20:23:25FromGitter<kennymalac> but the proc calls another proc. so that proc has to have it too or what?
20:24:35FromGitter<kennymalac> I wish there were more docs for this kind of desired interop... in my experience it is difficult to not justify making use of existing C programs alongside nim code ...unless you don't already know C or C++, ofc
20:24:39FromDiscord<Varriount> https://gist.github.com/Varriount/37c0a0cc77982d790bb625bb83306caa
20:24:48*endragor joined #nim
20:25:33FromGitter<kennymalac> with arc I don't need to have the foreign GC thing there. also setupForeignThreadGC does not exist when compiling with arc?
20:25:52FromDiscord<Varriount> kennymalac: Well, it seems that people tend to write applications in Nim that call C libraries, rather than have C applications call Nim libraries.
20:26:27FromDiscord<Varriount> Arc doesn't do the same kind of bookkeeping that the regular GC does.
20:26:45FromDiscord<Zachary Carter> I have a C application that calls Nim
20:26:50FromDiscord<Zachary Carter> but I'm using `--gc:arc`
20:27:12FromDiscord<Zachary Carter> if I wasn't - I probably would just not use the GC and the stdlib
20:27:16FromDiscord<Varriount> But Arc also doesn't handle reference cycles either. I don't know if Orc needs setupForeignThreadGc
20:27:31FromDiscord<Varriount> @Zachary Carter Do you know?
20:29:10*endragor quit (Ping timeout: 256 seconds)
20:29:48FromDiscord<Varriount> Araq: Does --gc:orc mode require setupForeignThreadGc?
20:30:25FromGitter<kennymalac> it should be made clear that if you are using Nim from C you should not use the default GC
20:30:37FromGitter<kennymalac> I know arc will be defualt soon. but still very frustrating
20:36:14FromDiscord<Zachary Carter> I don't know
20:36:23FromDiscord<Zachary Carter> this isn't true
20:36:29FromDiscord<Zachary Carter> you can use the default GC
20:37:05FromDiscord<Zachary Carter> I don't fully understand what your issue is tbh - but you can definitely use the default GC with C
20:37:25FromDiscord<Zachary Carter> and C calling into Nim code
20:38:10FromGitter<kennymalac> memory gets corrupted, not sure why
20:38:13FromDiscord<Zachary Carter> if you have an example project / code anywhere I can look at I will
20:38:34FromDiscord<Zachary Carter> well keep in mind every thread in Nim in the default memory model has its own local heap
20:38:54FromDiscord<Zachary Carter> I don't know if you're passing things between Nim and C or just from C to Nim
20:39:10FromDiscord<Zachary Carter> but Nim's GC will only try to collect what it has references to
20:39:24FromDiscord<Zachary Carter> it won't try to collect memory allocated by your C program
20:39:34FromDiscord<Zachary Carter> unless it has references to it
20:40:26FromGitter<kennymalac> httpclient might be the culprit, I'm not really sure, I just know that after that "slow" network operation finishes, all values within the proc's scope are corrupted
20:40:55FromGitter<kennymalac> there 's some undefined behavior... the vars inside the proc have random bits of a string returned from the network response and assigned to a separate variable
20:41:18FromGitter<kennymalac> that were assigned to a separate variable*
20:41:39FromDiscord<Zachary Carter> can you show me some code?
20:42:02FromGitter<kennymalac> I will put together an example together at some point, it'd have to be a new repo and different use case as this codebase is not open source
20:42:09FromDiscord<Zachary Carter> okay
20:43:33FromDiscord<Varriount> kennymalac: I know that frustration. "I'd like to show you, I really would. But I can't."
20:44:16FromDiscord<Zachary Carter> Does anyone know how to work around `default constructor of↵ 'tyObject_AnimationUnion__0HultalfmzDh9c6nAe7mJ8A' is implicitly deleted because variant field 'cpp' has a non-trivial default↵ constructor`
20:44:29FromDiscord<Zachary Carter> this C++ class I'm binding to doesn't have a non-trivial default constructor defined
20:44:54FromDiscord<Zachary Carter> and I'm trying to create a C API (with Nim) which wraps this C++ API
20:45:12FromGitter<kennymalac> yeah. definetly motivated to put a repo together though because it could be a pretty critical bug
20:45:18FromDiscord<Zachary Carter> so that I can call it from another Nim program which I'm compiling to C
20:47:40FromDiscord<Varriount> I feel like we should just have a long page of Question/Answer formats. "How do I..." "create a dynamic library", "use generics", etc.
20:49:32*hoijui quit (Ping timeout: 260 seconds)
20:51:34*narimiran quit (Ping timeout: 240 seconds)
20:51:57*natrys quit (Quit: natrys)
20:53:54*solitudesf quit (Ping timeout: 240 seconds)
21:01:13*endragor joined #nim
21:07:34*endragor quit (Ping timeout: 272 seconds)
21:09:55FromDiscord<Shucks> Finally. A pure nim detour hook ;D https://media.discordapp.net/attachments/371759389889003532/730893520528736317/86yGsFxWuI.gif
21:16:32*revere quit (Ping timeout: 256 seconds)
21:16:59*revere joined #nim
21:17:40FromDiscord<XxDiCaprioxX> What is a generic paramater?
21:21:03FromDiscord<exelotl> @Shucks ohhh nice you got your asm stuff working? :D
21:22:34*vsantana quit (Ping timeout: 240 seconds)
21:29:11*endragor joined #nim
21:36:10*endragor quit (Ping timeout: 260 seconds)
21:42:41*audiophile quit (Ping timeout: 256 seconds)
21:43:25FromDiscord<Varriount> @Shucks You mean detour, as in the Windows API call hook?
21:49:10*chemist69 quit (Ping timeout: 256 seconds)
21:49:51*chemist69 joined #nim
21:53:22*tane quit (Quit: Leaving)
21:55:48FromDiscord<exelotl> @XxDiCaprioxX it's like a template parameter in C++, it has no runtime impact. A different version of the proc or datatype will be created for each different generic argument you pass. For example `log[float32](a, b)` and `log[float64](a, b)` can basically be treated as two different functions
21:57:32*endragor joined #nim
22:02:58*endragor quit (Ping timeout: 246 seconds)
22:06:15*Jesin quit (Quit: Leaving)
22:06:31*Trustable quit (Remote host closed the connection)
22:09:43*tinga_ joined #nim
22:10:26*tinga quit (Read error: Connection reset by peer)
22:10:56FromDiscord<Zachary Carter> Hrm - since I'm not getting much traction on my C++ question - maybe I can rephrase it. If I'm wrapping a C++ API with a C API for consumption in C - how would I deal with a C++ class that doesn't have a non-trivial default constructor defined?
22:11:23FromDiscord<Zachary Carter> would I create a union with a constructor?
22:19:58FromDiscord<XxDiCaprioxX> Nevermind my question haha I found out
22:20:03FromDiscord<XxDiCaprioxX> Thank you tho
22:20:26*Jesin joined #nim
22:21:30FromDiscord<exelotl> 👌
22:21:45FromGitter<gogolxdong> Anyone works on IPFS?
22:23:23FromDiscord<Recruit_main707> > would I create a union with a constructor?↵@Zachary Carter i have no idea :/
22:25:31*endragor joined #nim
22:29:33FromDiscord<Zachary Carter> me either!
22:30:41FromDiscord<Recruit_main707> just to be sure, you wrap the c++ api to a c api to wrap that from nim?
22:30:49*endragor quit (Ping timeout: 264 seconds)
22:35:32FromDiscord<Recruit_main707> cant c2nim parse function pointers?
22:36:06*hyiltiz joined #nim
22:46:45FromDiscord<Recruit_main707> apparently it can, but sometimes it doesnt want to
22:54:13*endragor joined #nim
22:57:17*hyiltiz quit (Ping timeout: 260 seconds)
22:58:24*krux02 quit (Remote host closed the connection)
22:59:42*krux02 joined #nim
23:01:32*hyiltiz joined #nim
23:01:32*hyiltiz quit (Changing host)
23:01:32*hyiltiz joined #nim
23:02:10*endragor quit (Ping timeout: 256 seconds)
23:16:55FromDiscord<Elegant Beef> Is there a way to get the bytes of any type?
23:22:08*abm quit (Quit: Leaving)
23:23:42FromDiscord<Recruit_main707> https://discordapp.com/channels/371759389889003530/371759389889003532/730444342002581544 like this?
23:24:09FromDiscord<Elegant Beef> Yea seems like it'd do 😄
23:25:09FromDiscord<Recruit_main707> what does this error mean?↵https://play.nim-lang.org/#ix=2rj1
23:26:34FromDiscord<Elegant Beef> the nim.cpp doesnt have a function that's attempting to call
23:26:39*krux02_ joined #nim
23:27:25FromDiscord<Zachary Carter> @Recruit_main707 - not quite. I'm wrapping the C++ API with Nim and attempting to produce a C API using Nim
23:27:39FromDiscord<Zachary Carter> so that I can call it from other Nim code that is compiled to C
23:28:11FromDiscord<Recruit_main707> right...
23:28:28FromDiscord<Recruit_main707> is it that crucial to use the c backend?
23:28:59FromDiscord<Zachary Carter> no - but I can't get the nimterop bindings for the main driver code to compile with the C++ backend
23:29:14FromDiscord<Zachary Carter> but that would make life easier for sure
23:29:14*krux02 quit (Ping timeout: 244 seconds)
23:29:20FromDiscord<Zachary Carter> I might just work on that problem instead
23:35:17FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2rj3
23:36:26FromDiscord<Zachary Carter> it seems the distinct int enum created by nimterop is being generated as (int) 7
23:39:46FromDiscord<Zachary Carter> or is there some way to disable the `defineEnum` functionality?
23:48:09FromDiscord<Zachary Carter> well cOverride with a enum that's imported works for this