00:07:28 | FromDiscord | <me2beats> I can't write like this?↵```↵if a>4 and a <5: echo "4..5"↵``` |
00:07:39 | FromDiscord | <me2beats> (edit) 'this?↵```↵if' => 'this?↵```nim↵if' |
00:08:01 | FromDiscord | <XxDiCaprioxX> To the else: discard thing: maybe you want to do something in the else statement |
00:08:21 | FromDiscord | <XxDiCaprioxX> Like else: function() |
00:08:39 | FromDiscord | <Rika> what do you mean with that lest message, me2beats |
00:08:44 | FromDiscord | <Rika> last* |
00:09:19 | FromDiscord | <XxDiCaprioxX> It is a conditional that 4 < a < 5 |
00:09:31 | FromDiscord | <XxDiCaprioxX> To do that you need a to be a float, not an int |
00:09:50 | FromDiscord | <Rika> you dont? |
00:09:50 | FromDiscord | <me2beats> @XxDiCaprioxX yea, but I think nim is wise to check if the user uses `else` inside a `case` |
00:09:56 | FromDiscord | <XxDiCaprioxX> And I dont think you can list that way, because that would be an infinite amount of floats |
00:10:10 | FromDiscord | <XxDiCaprioxX> Yeah you're right on that |
00:10:18 | FromDiscord | <XxDiCaprioxX> (edit) 'Yeah you're right on that ... ' => 'Yeah you're right on that@me2beats' |
00:10:19 | FromDiscord | <impbox> for 4..5 you probably want a >= 4 and a <= 5 ? |
00:10:31 | FromDiscord | <XxDiCaprioxX> Nah he wants to list all floats from 4 to 5 |
00:10:36 | FromDiscord | <XxDiCaprioxX> Which is totally impossible |
00:10:42 | FromDiscord | <XxDiCaprioxX> Because there is 4.1 |
00:10:42 | FromDiscord | <impbox> in an if? |
00:10:51 | FromDiscord | <XxDiCaprioxX> 4.01 4.001 4.0001 etc |
00:10:55 | FromDiscord | <Rika> i'm not sure you interpreted him properly |
00:11:14 | FromDiscord | <XxDiCaprioxX> He probably means if the float a is between 4 and 5 |
00:11:15 | FromDiscord | <impbox> that'd be `for a in 4..5:` ? |
00:11:22 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2rex |
00:11:41 | FromDiscord | <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:48 | FromDiscord | <XxDiCaprioxX> Ok guys I'm out sorry and good luck with the issue |
00:11:58 | FromDiscord | <Elegant Beef> i believe the issue is the `a>4` |
00:12:11 | FromDiscord | <Clyybber> no |
00:12:17 | FromDiscord | <Rika> literally no case will match it |
00:12:20 | FromDiscord | <Clyybber> its the a <5 |
00:12:20 | FromDiscord | <impbox> i think stopping programmers from doing stupid stuff by default is good, because i do a lot of stupid stuff |
00:12:22 | FromDiscord | <Rika> unless you use floats |
00:12:43 | FromDiscord | <Elegant Beef> i mean the issue is that there is no spacing between the operator and symbols |
00:12:47 | FromDiscord | <impbox> but sometimes I want to do stuff that looks stupid, so give me a way to do that =) |
00:12:50 | FromDiscord | <Clyybber> because the inconsistent spacing will make it treat it like as an unary operator |
00:12:53 | FromDiscord | <Elegant Beef> Isnt that an issue |
00:12:59 | FromDiscord | <Rika> well why do you think i asked what really was the issue |
00:13:00 | FromDiscord | <Clyybber> yeah |
00:13:04 | FromDiscord | <Elegant Beef> Yea clyyber that's what i implied |
00:13:14 | FromDiscord | <impbox> wait until we know what the issue is =) |
00:13:19 | FromDiscord | <Elegant Beef> `a > 4` and `a < 5` |
00:13:20 | FromDiscord | <me2beats> well I mean just python like if statements with `and` operator |
00:13:20 | FromDiscord | <Elegant Beef> Yea |
00:13:27 | FromDiscord | <Rika> thats correct |
00:13:35 | FromDiscord | <Rika> we use `and` for boolean and |
00:13:43 | FromDiscord | <Rika> just careful with the spacing |
00:14:04 | FromDiscord | <Elegant Beef> we also use `and` and `or` for bitwise ops |
00:14:07 | FromDiscord | <Elegant Beef> So it's wild 😄 |
00:14:28 | FromDiscord | <Rika> honestly |
00:14:33 | FromDiscord | <Rika> that has *never* confused me |
00:14:41 | FromDiscord | <Elegant Beef> It never confused me either |
00:14:50 | FromDiscord | <impbox> i do find using the same keyword for both a bit confusing |
00:14:52 | FromDiscord | <Elegant Beef> I mean the first thing i did was attempt to use C# bitwise ops and it went no |
00:14:56 | FromDiscord | <me2beats> ah spacing is important↵hmm↵ok |
00:15:05 | FromDiscord | <Clyybber> it can be confusing with the fact that not has high precedence |
00:15:07 | FromDiscord | <impbox> and have to think "is this a logical and or bitwise op here" |
00:15:35 | FromDiscord | <impbox> you can figure it out, but i'd prefer bitAnd bitOr or something |
00:15:38 | FromDiscord | <Elegant Beef> `bor` and `band` the most awesome solution cause we have bans then |
00:15:45 | FromDiscord | <Elegant Beef> (edit) 'bans' => 'bands' |
00:15:47 | FromDiscord | <Clyybber> because 'if not a == b' is if (not a) == b' |
00:16:19 | * | laqq3 joined #nim |
00:16:21 | FromDiscord | <Clyybber> which is not bad |
00:16:29 | FromDiscord | <Clyybber> but not what python does :D |
00:16:33 | FromDiscord | <Elegant Beef> Yea but we have the != shortcut |
00:16:38 | FromDiscord | <Elegant Beef> So it's not a big issue |
00:16:43 | FromDiscord | <Clyybber> yeah |
00:17:14 | * | Tlongir joined #nim |
00:18:14 | FromDiscord | <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:30 | FromDiscord | <Clyybber> so the current rules are the best so far |
00:20:01 | * | oddp quit (Ping timeout: 264 seconds) |
00:21:08 | FromDiscord | <me2beats> is it better to compare floats with floats or it doesn't matter? |
00:21:14 | * | Tongir joined #nim |
00:21:29 | FromDiscord | <Elegant Beef> It doesnt matter afaik |
00:21:44 | FromDiscord | <Elegant Beef> There are operators implemented that ensure it works, so it's fine! 😄 |
00:22:20 | FromDiscord | <Rika> actually |
00:22:34 | FromDiscord | <Rika> if you want to compare int to float you have to `import lenientops` i think |
00:23:23 | FromDiscord | <Elegant Beef> Ah you're right |
00:24:05 | FromDiscord | <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:20 | FromDiscord | <me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reB |
00:41:59 | FromDiscord | <Elegant Beef> The oneline is↵`var a = [1,3,7]` |
00:42:04 | * | krux02_ quit (Remote host closed the connection) |
00:42:11 | FromDiscord | <Elegant Beef> You can include the explict type though |
00:42:54 | FromDiscord | <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:23 | FromDiscord | <Elegant Beef> sequence is declared as such↵`var a = @[1,3,7]` or `var a: seq[int]` |
00:47:08 | FromDiscord | <Elegant Beef> I do highly suggest reading the tutorial/manual 😄 |
00:47:32 | FromDiscord | <me2beats> ah thanks)↵possible to tell it that [1,3,7] is intArray in one line? |
00:47:46 | FromDiscord | <Elegant Beef> do you mean explcitly state it? |
00:48:12 | FromDiscord | <Elegant Beef> `var a : array[3,int] = [1,3,7]` if i understand you right |
00:48:58 | FromDiscord | <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:02 | FromDiscord | <impbox> var a = [1.int8,2,3] |
00:49:09 | FromDiscord | <impbox> it'll use the type of the first element |
00:49:24 | FromDiscord | <Elegant Beef> or `var a = [1'i8,2,3]` |
00:49:36 | FromDiscord | <Elegant Beef> Pretty much any explict method of indicating the type |
00:49:41 | FromDiscord | <me2beats> oh so many ways |
00:49:41 | FromDiscord | <Rika> you can also use 1i8 tho |
00:50:00 | FromDiscord | <Elegant Beef> oh didnt know we could drop the `'` |
00:50:06 | FromDiscord | <Elegant Beef> that's cool |
00:50:18 | FromDiscord | <Rika> its only needed when the number is in hex |
00:50:29 | FromDiscord | <Rika> since `f` would be ambiguous there afaik |
00:50:51 | FromDiscord | <Rika> though ive never seen someone use hex notations for a float |
00:50:59 | FromDiscord | <Elegant Beef> sadists that's who would |
00:51:08 | FromDiscord | <Elegant Beef> So im suprised you dont 😛 |
00:51:11 | FromDiscord | <Rika> you mean masochists |
00:51:33 | FromDiscord | <Elegant Beef> I mean they'd be both |
00:51:43 | FromDiscord | <Rika> i am not both |
00:52:04 | FromDiscord | <Elegant Beef> If you make a library that has a hex float, and someone else reads it you're a sadist |
00:52:17 | FromDiscord | <Elegant Beef> If you make a library that has a hex float, you're a masochist |
00:52:35 | FromDiscord | <Rika> if you make a library, you're a masochist |
00:52:52 | FromDiscord | <Rika> imagine binding yourself to a repo as a maintainer willfully |
00:52:54 | FromDiscord | <Rika> xddd |
00:52:58 | FromDiscord | <Rika> (i am joking) |
00:53:02 | FromDiscord | <Elegant Beef> Nah the issue is if it's usable |
00:53:15 | * | Tlanger joined #nim |
00:53:21 | FromDiscord | <Elegant Beef> Like my nim_rofi thing, is super simple and probably not something anyone looks for 😄 |
00:53:29 | FromDiscord | <Elegant Beef> Although pmunch was interested in it |
00:53:39 | FromDiscord | <Elegant Beef> And that was before i made it nice! |
00:53:49 | FromDiscord | <Rika> nice |
00:54:02 | * | Tlanger quit (Remote host closed the connection) |
00:54:12 | FromDiscord | <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:28 | FromDiscord | <Elegant Beef> It was like my first thing using nim, so it was awful |
00:54:46 | FromDiscord | <Elegant Beef> But now it uses object variants and forward declaration |
00:55:04 | FromDiscord | <Rika> i dont think ive ever used forward declaration significantly |
00:55:23 | FromDiscord | <impbox> I use it a lot, but less so now that we have codeReordering |
00:55:24 | FromDiscord | <Elegant Beef> I mean my "learning nim" solution was making a variable and setting it to a proc |
00:55:26 | FromDiscord | <impbox> which is <3 |
00:55:37 | * | Tongir quit (Ping timeout: 246 seconds) |
00:55:39 | * | Tlongir joined #nim |
00:55:53 | FromDiscord | <Elegant Beef> Is this implict or explcit behaviour? |
00:56:03 | FromDiscord | <Elegant Beef> the reordering |
00:56:08 | FromDiscord | <impbox> you have to opt in |
00:56:17 | FromDiscord | <Rika> i dont use code reordering either |
00:56:29 | FromDiscord | <impbox> https://nim-lang.org/docs/manual.html#scope-rules-code-reordering |
00:56:35 | FromDiscord | <Rika> ~~i manually reorder my code until it works~~ |
00:56:52 | FromDiscord | <impbox> @Rika same most of the time, I reorder until it's all broken and I give up |
00:57:00 | FromDiscord | <Elegant Beef> Well for recursive proc calls that's not always possible without forward declaration |
00:57:03 | FromDiscord | <impbox> but letting the compiler do it for me is nice |
00:57:18 | FromDiscord | <Rika> i've no recursive proc calls so 'tis all good |
00:57:28 | FromDiscord | <Elegant Beef> yea |
00:57:46 | FromDiscord | <Elegant Beef> I did not when i made nim rofi, since it has proc calls to go back, but also forward |
00:58:03 | FromDiscord | <Elegant Beef> Damn code reording will make many new people happy |
00:58:19 | FromDiscord | <Elegant Beef> Since other languages dont rely on declaration order |
00:59:45 | FromDiscord | <me2beats> annd what if I need only ints and floats in an array? |
01:00:17 | FromDiscord | <Elegant Beef> You learn object variance really quickly 😄 |
01:00:35 | FromDiscord | <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:50 | FromDiscord | <Elegant Beef> Small example of the object variance↵https://play.nim-lang.org/#ix=2reC |
01:03:06 | FromDiscord | <Elegant Beef> You can clearly make procs that just take a float/int and return a DataHolder |
01:03:15 | FromDiscord | <Rika> usually called Box btw |
01:03:58 | FromDiscord | <Elegant Beef> The nice thing here is that this even lets you have more complicated types added seemlessly |
01:04:13 | FromDiscord | <Rika> ...until you need to box an object/tuple |
01:04:16 | FromDiscord | <Elegant Beef> aslong as you check kind before accesing when iterating, you can have any complex type |
01:04:43 | FromDiscord | <Elegant Beef> What do you mean rika? |
01:07:08 | FromDiscord | <Rika> how do you box many differing objects 😛 |
01:07:22 | FromDiscord | <Elegant Beef> ah differing |
01:07:38 | FromDiscord | <Elegant Beef> I was like "It's not that hard" :D↵https://github.com/beef331/nvg/blob/master/src/shape.nim#L18 |
01:07:56 | FromDiscord | <Rika> many *unknown* differing objects |
01:08:09 | FromDiscord | <impbox> @Rika, you could use ref objects of a common base |
01:10:10 | FromDiscord | <Rika> eehh inheritance :Yuuneh: |
01:10:21 | FromDiscord | <impbox> or seq of pointers =) |
01:11:03 | FromDiscord | <Elegant Beef> I mean it's a tool there |
01:11:48 | FromDiscord | <Elegant Beef> I still want that RFC for variants 😄 |
01:16:01 | * | endragor joined #nim |
01:21:59 | FromDiscord | <me2beats> how to say that a proc returns nothing? |
01:22:29 | FromDiscord | <me2beats> void |
01:24:04 | FromDiscord | <Elegant Beef> you dont need anything |
01:24:21 | FromDiscord | <Elegant Beef> `proc a()= ##` is a proc that doesnt do anything and returns nothing 😄 |
01:24:30 | FromDiscord | <Elegant Beef> or `proc a()= discard` |
01:24:44 | FromDiscord | <Rika> whats up with yall and weird ass spacing |
01:26:06 | FromDiscord | <Elegant Beef> what? |
01:27:53 | FromDiscord | <Rika> `a()=` |
01:27:57 | FromDiscord | <Rika> weird spacing |
01:28:10 | FromDiscord | <impbox> `proc a ()=` |
01:28:36 | FromDiscord | <Elegant Beef> `proc a ( ) =` |
01:29:56 | FromDiscord | <Rika> dont make me pull a `pRoC` on you |
01:33:17 | FromDiscord | <Elegant Beef> the way i typically write it is if there is no return type `()=` if there is a return type `():type =` |
01:35:31 | FromDiscord | <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:13 | FromDiscord | <Technisha Circuit (LGBTQIAP+)> DeFiNItLy |
01:59:14 | FromDiscord | <Technisha Circuit (LGBTQIAP+)> Jk |
01:59:20 | FromDiscord | <Technisha Circuit (LGBTQIAP+)> That's how I do it :p |
02:04:53 | FromDiscord | <me2beats> is there calling super? |
02:05:28 | FromDiscord | <Rika> no |
02:05:50 | FromDiscord | <Rika> you have to explicitly call the proper procs of the base class |
02:06:39 | FromDiscord | <me2beats> https://play.nim-lang.org/#ix=2reH↵like that? |
02:07:44 | FromDiscord | <me2beats> need A and B to be printed |
02:16:40 | FromDiscord | <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:17 | FromGitter | <bung87> there's a obcj runtime wrapper in nim , not updated for years |
02:28:34 | * | muffindrake quit (Ping timeout: 244 seconds) |
02:28:58 | FromDiscord | <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:04 | FromDiscord | <Elegant Beef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma |
02:31:14 | FromDiscord | <Elegant Beef> I mean doesnt this still work? |
02:31:36 | FromDiscord | <Avatarfighter> I did not see that wow |
02:31:53 | FromDiscord | <Avatarfighter> hm I guess I can try |
02:31:57 | FromDiscord | <Elegant Beef> Yea it's just like C with an extra step or two it seems |
02:32:13 | FromDiscord | <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:54 | FromDiscord | <me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reJ |
02:39:04 | FromDiscord | <me2beats> inheritance in nim is very unusual |
02:40:02 | FromDiscord | <Avatarfighter> I can get an example in a second I'm trying to remember how to indent correctly |
02:41:36 | FromDiscord | <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:19 | FromDiscord | <Avatarfighter> When you inherit in nim you need to make your object inherit RootObj |
02:42:55 | FromDiscord | <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:00 | shashlick | disruptek: almost have v1.0.1 libgit2 ready for direct download |
02:43:12 | * | sagax quit (Remote host closed the connection) |
02:47:19 | FromDiscord | <me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2reM |
02:48:17 | FromDiscord | <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:01 | FromDiscord | <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:37 | FromDiscord | <me2beats> what could it look like? I'm confused |
02:56:42 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2reQ |
02:57:11 | FromDiscord | <Elegant Beef> Ah shit those are references |
02:57:21 | FromDiscord | <Elegant Beef> so should be `newA` and `newB` |
02:57:29 | FromDiscord | <Elegant Beef> but anywho that's the nim way of making custom constructors |
02:57:44 | FromDiscord | <Elegant Beef> You wrap the named parameters with a proc and pass in parameters you want to change |
02:57:55 | FromDiscord | <Elegant Beef> I do have this which automates it↵https://github.com/beef331/constructor |
02:58:50 | FromDiscord | <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:35 | FromDiscord | <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:11 | FromDiscord | <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:40 | FromDiscord | <impbox> @j$ https://play.nim-lang.org/#ix=2rf3 does this answer your question? |
04:20:59 | FromDiscord | <impbox> it appears they happen in reverse order |
04:31:22 | FromDiscord | <Elegant Beef> Well it's a `try` below then `finally` next |
04:32:08 | FromDiscord | <Elegant Beef> sent a code paste, see https://play.nim-lang.org/#ix=2rf4 |
04:32:30 | FromDiscord | <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:27 | FromDiscord | <flywind> Where is `ast` semantized? I want to know which module I should look at. |
07:06:29 | FromDiscord | <flywind> https://play.nim-lang.org/#ix=2rfm |
07:12:49 | FromDiscord | <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:59 | FromDiscord | <Varriount> @flywind look at the sem*.nim modules in the compiler directory |
08:00:04 | bung | what's vue's react's refs in karax? |
08:01:01 | FromDiscord | <flywind> @Varriount Thank you! I will have a look at them. |
08:01:56 | FromDiscord | <Varriount> @flywind What is your overall goal? |
08:02:11 | FromGitter | <alehander92> hmm what's vue ref |
08:02:32 | FromDiscord | <flywind> Fix my issues: https://github.com/nim-lang/Nim/issues/14847 |
08:02:33 | disbot | ➥ create a new function definitions got Internal error: environment misses: ; snippet at 12https://play.nim-lang.org/#ix=2qsm |
08:02:43 | bung | keep a referrence to a virtual node |
08:03:58 | FromGitter | <alehander92> hm, why would one do that |
08:04:36 | bung | since you dont use querySelector in virtual dom right |
08:05:07 | FromGitter | <alehander92> hmm |
08:05:22 | * | ormiret quit (Ping timeout: 260 seconds) |
08:05:31 | FromGitter | <alehander92> well .. i guess you can |
08:05:50 | FromGitter | <alehander92> keep a reference to the nim value |
08:05:57 | * | npgm quit (Ping timeout: 260 seconds) |
08:06:03 | FromGitter | <alehander92> but i am not sure how well would this work |
08:06:28 | bung | em, so just assign a node to a variable ? |
08:06:32 | FromGitter | <alehander92> like, just preserve the VNode value somewhere |
08:06:34 | FromGitter | <alehander92> yes |
08:06:48 | FromGitter | <alehander92> if VNode is ref |
08:06:51 | FromGitter | <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:57 | bung | ok ,got it, think the bad parts is not obvious in dsl structure |
08:09:47 | * | LyndsySimon joined #nim |
08:15:04 | FromGitter | <alehander92> hmm |
08:15:08 | FromGitter | <alehander92> what is not obvious |
08:16:19 | FromGitter | <alehander92> i dont know how does it look in react |
08:16:22 | FromGitter | <alehander92> vue |
08:16:51 | FromGitter | <alehander92> very often tho, the idea is that your state is in your model |
08:16:58 | FromGitter | <alehander92> so you just dont need to access your own vnodes |
08:17:05 | FromGitter | <alehander92> because you created them based on model |
08:17:10 | FromGitter | <alehander92> sometimes there might be exceptions of course |
08:17:33 | Oddmonger | for exporting function, i need the '*' |
08:18:01 | Oddmonger | otherwise it will be hidden in imported modules, correct ? |
08:18:16 | FromGitter | <alehander92> yeah |
08:18:50 | Oddmonger | so, i've understood simple export like « proc foo*:string » |
08:19:06 | FromGitter | <alehander92> yeah |
08:19:10 | Oddmonger | but how to export foo( name:string):string ? |
08:19:19 | bung | it will add a attribute to node like as ref={theref} in vue and react |
08:19:24 | FromGitter | <alehander92> `foo*(name: string)` |
08:19:36 | FromGitter | <alehander92> after the name which you export |
08:19:39 | FromGitter | <alehander92> same with fields |
08:19:42 | Oddmonger | yes, i tried this, bus doen't compile |
08:19:56 | FromGitter | <alehander92> there must be something else |
08:20:24 | Oddmonger | hum in fact it compiles, but the unit test fails |
08:20:34 | FromGitter | <alehander92> hm! |
08:22:19 | Oddmonger | let me show you… |
08:22:43 | Oddmonger | http://ix.io/2rfD |
08:28:46 | Oddmonger | ah ok, i've found it |
08:29:06 | Oddmonger | the optional argument |
08:31:16 | * | Vladar quit (Quit: Leaving) |
08:32:49 | FromGitter | <alehander92> ahh! |
08:32:52 | FromGitter | <alehander92> yeah |
08:32:58 | FromGitter | <alehander92> what language are you coming from |
08:33:30 | Oddmonger | C and Lua |
08:37:54 | * | vr0n quit (Ping timeout: 240 seconds) |
08:41:59 | bung | hmm I mapping js's switch to case of ,found it evaluate at CT. |
08:43:03 | bung | just matching sematics |
08:56:02 | Oddmonger | for completing exercise, i just put a value in the parameter, for having a default value when no args |
08:56:18 | Oddmonger | but how to test the argument is null , if no default value ? |
08:56:56 | FromDiscord | <lqdev> there's always a value |
08:57:07 | FromDiscord | <lqdev> for strings you would check if the length == 0 |
08:57:12 | FromDiscord | <lqdev> same for seqs |
08:57:26 | FromDiscord | <lqdev> but if you really want some null value, check out the `options` module |
09:00:06 | bung | you can have same name procs with deffrient params. |
09:00:35 | Oddmonger | ok |
09:01:08 | FromDiscord | <lqdev> or that, yeah |
09:06:53 | Oddmonger | but i cannot call a function with no value, if in function declaration there is no default value declared |
09:08:06 | FromDiscord | <lqdev> of course you can |
09:08:39 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rfK |
09:09:17 | Oddmonger | thank you |
09:09:37 | FromDiscord | <lqdev> there's a shortcut you can take: |
09:09:52 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rfL |
09:10:02 | Oddmonger | ahhh function overloading |
09:10:07 | FromDiscord | <lqdev> the type of `name` is inferred from the default value you pass |
09:10:11 | FromDiscord | <lqdev> to reduce typing |
09:11:11 | Oddmonger | yes for the moment, i was only using the default value |
09:11:28 | Oddmonger | but i was wondering how to treat no param when no default value defined |
09:11:45 | FromDiscord | <lqdev> you can just overload the proc |
09:11:45 | Oddmonger | and your first sample with overloaded foo() answered |
09:12:04 | FromDiscord | <lqdev> or use an Option[T] from the options module, but that's a less clean solution |
09:12:18 | FromDiscord | <lqdev> in terms of API |
09:15:00 | * | Vladar joined #nim |
09:22:27 | * | oddp joined #nim |
09:32:14 | FromDiscord | <dilawar_uchiha> any clues on how i can build nim from my WSL ubuntu for my raspberry pi 1 ( armv6 ) |
09:38:42 | Oddmonger | may be getting an ARM binary would be easier |
09:40:18 | FromDiscord | <dilawar_uchiha> i want the latest release |
09:40:29 | FromDiscord | <dilawar_uchiha> raspberry pi repo sucks |
09:41:02 | Oddmonger | or build it directly on the raspberry, that's not a big thing to compile |
09:42:07 | Oddmonger | setting a toolchain for cross-compiling with WSL is surely interesting, though (may be mingw can do it, else?) |
09:42:21 | FromDiscord | <dilawar_uchiha> i tried building on pi |
09:42:26 | FromDiscord | <dilawar_uchiha> its failing |
09:42:34 | FromDiscord | <dilawar_uchiha> i am retrying for the last time |
09:55:36 | Oddmonger | which 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:55 | FromDiscord | <dilawar_uchiha> i dont use vim |
10:00:07 | FromDiscord | <dilawar_uchiha> unless its my only option |
10:00:27 | FromDiscord | <dilawar_uchiha> because i generate security tokens trying to exit it |
10:00:29 | FromDiscord | <dilawar_uchiha> XD |
10:01:08 | Oddmonger | i don't use notepad, because i'm always hitting esc for getting command mode :þ |
10:01:55 | Oddmonger | vim suxx, but other editors suxx even more |
10:02:19 | FromDiscord | <dilawar_uchiha> i use vcode when available |
10:02:26 | FromDiscord | <dilawar_uchiha> otherwise nano editor |
10:02:57 | * | krux02 joined #nim |
10:04:45 | * | hoijui joined #nim |
10:13:45 | FromDiscord | <dilawar_uchiha> its been like 30 minutes |
10:13:59 | FromDiscord | <dilawar_uchiha> it looks like compiler has passed out |
10:17:29 | Yardanico | you might want -d:leanCompiler |
10:17:52 | Yardanico | it builds much less parts of the compiler, e.g. no js backend, no doc backend |
10:18:38 | FromDiscord | <dilawar_uchiha> reducing opt level would be fine ? |
10:19:05 | FromDiscord | <dilawar_uchiha> i looked at build.sh |
10:19:14 | FromDiscord | <dilawar_uchiha> but no |
10:19:25 | FromDiscord | <dilawar_uchiha> its failing koch build tools |
10:19:42 | Yardanico | well you can build tools individually |
10:19:46 | Yardanico | e.g. ./koch nimble |
10:20:34 | FromDiscord | <dilawar_uchiha> thats a good idea |
10:20:39 | FromDiscord | <dilawar_uchiha> i will try |
10:20:45 | FromDiscord | <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:13 | FromDiscord | <Rika> its prolly failing at nimsuggest i assume |
10:51:00 | FromGitter | <alehander92> OddMonger ah lua sounds good |
10:52:42 | FromDiscord | <Recruit_main707> can someone help me wrapping this c++ class?↵https://github.com/kipje13/RLBotCPP/blob/8ea082d6d3fd370eabc491e1117eb24cc9231c31/inc/bot.h |
10:53:29 | FromDiscord | <dilawar_uchiha> @Rika is nim suggest heavy or something ? |
10:54:25 | FromDiscord | <Rika> from what ive heard, its pretty heavy |
10:54:35 | FromDiscord | <lqdev> just poorly optimized |
10:54:36 | FromDiscord | <Rika> also only useful if you're writing code on the pi |
10:57:05 | FromDiscord | <lqdev> on the pi? |
10:57:33 | FromDiscord | <dilawar_uchiha> raspberry pi |
10:58:00 | FromDiscord | <lqdev> raspberry pi can't handle a resource hog like this though |
10:58:10 | FromDiscord | <lqdev> unless the newer ones are really damn powerful |
10:58:16 | FromDiscord | <lqdev> I only have a 3B |
10:58:18 | FromDiscord | <dilawar_uchiha> its pi1 |
10:58:32 | FromDiscord | <dilawar_uchiha> armv6 and 250mb ram |
10:58:37 | FromDiscord | <Rika> jesus |
10:58:44 | FromDiscord | <Rika> thats not gonna handle nimsuggest at all |
10:58:52 | FromDiscord | <Rika> dont build nimsuggest you dont need it |
10:59:10 | FromDiscord | <dilawar_uchiha> i am totally excited to build games using raylib and nim |
10:59:22 | FromDiscord | <dilawar_uchiha> and checking if its the failing part |
10:59:40 | FromDiscord | <dilawar_uchiha> yup |
10:59:42 | FromDiscord | <dilawar_uchiha> it is |
11:04:34 | FromDiscord | <dilawar_uchiha> what tools are absolutely important ? |
11:04:39 | Yardanico | nimble |
11:04:46 | Yardanico | all others are optional really |
11:04:58 | Yardanico | well even nimble is optional but then you'll have a much harder time installing packages |
11:05:02 | FromDiscord | <dilawar_uchiha> than its done i guess |
11:05:21 | FromDiscord | <dilawar_uchiha> nimsuggest is language server kind of thing right ? |
11:05:59 | FromDiscord | <lqdev> yeah |
11:06:02 | shashlick | There's already armv6 nightlies builds |
11:07:25 | FromDiscord | <dilawar_uchiha> where? @shashlick |
11:07:54 | FromDiscord | <dilawar_uchiha> tho its done here now , but from next time i will keep that in mind |
11:08:50 | shashlick | https://github.com/nim-lang/nightlies/releases |
11:12:30 | FromDiscord | <dilawar_uchiha> thanks |
11:14:07 | * | abm joined #nim |
11:28:49 | FromDiscord | <Recruit_main707> when importing an struct from c++, should i use importc or importcpp? |
11:35:10 | FromDiscord | <Zed> i have no experience with import c++, but importcpp seems like the most logical solution |
11:35:16 | FromDiscord | <Zed> (edit) 'import' => 'importing' |
11:37:42 | FromDiscord | <mratsim> you need to use importcpp or the mangling will be wrong |
11:41:44 | * | sagax quit (Remote host closed the connection) |
11:41:47 | FromDiscord | <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:40 | filcuc | is 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:34 | bung | karax nref seems not work , it looking for `proc setAttr(n: VNode; key: kstring; val: kstring = "")` |
13:26:28 | filcuc | ignore my message |
13:34:35 | FromGitter | <alehander92> disruptek |
13:34:38 | FromGitter | <alehander92> you on? |
13:41:05 | FromDiscord | <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:11 | FromDiscord | <Yardanico> no it's not working |
13:41:16 | FromDiscord | <Stuffe> ah ok i see :/ |
13:41:33 | FromDiscord | <Stuffe> man I just did a huge refactoring and now it takes me 9 seconds to compile |
13:41:46 | FromGitter | <alehander92> why |
13:41:51 | FromGitter | <alehander92> this doesn't sound so usual |
13:42:09 | FromDiscord | <Stuffe> why it takes 9 seconds? |
13:42:10 | FromGitter | <alehander92> how much time does it take you to compile nim ? |
13:42:27 | FromGitter | <alehander92> do you have any large modules |
13:42:36 | FromDiscord | <Stuffe> i have about 20k lines of code |
13:42:38 | FromGitter | <alehander92> and how much did it take you before |
13:42:41 | FromDiscord | <Yardanico> that's not that much |
13:42:52 | FromDiscord | <Stuffe> i used choosenim to install nim |
13:42:53 | FromGitter | <alehander92> we need numbers on your machine |
13:43:01 | FromGitter | <alehander92> because 9 seconds doesnt mean much mate |
13:43:05 | FromDiscord | <Stuffe> 1 sec |
13:43:14 | FromDiscord | <Stuffe> 2.2 GHz Quad-Core Intel Core i7 |
13:43:16 | FromGitter | <alehander92> ok, so 9 times slower, this is a good number |
13:43:50 | FromDiscord | <Yardanico> does it take a long time on some specific module? |
13:43:52 | FromGitter | <alehander92> is it possible that you compare a build including `CC` generation |
13:43:58 | * | kayw joined #nim |
13:44:02 | FromDiscord | <Stuffe> it was way faster before the refactor though and i removed 2k lines |
13:44:03 | FromGitter | <alehander92> for all files |
13:44:09 | FromDiscord | <Yardanico> for example you might have a recursive template expansion |
13:44:11 | FromDiscord | <Stuffe> which module should I try? |
13:44:16 | FromDiscord | <Stuffe> ah |
13:44:17 | FromGitter | <alehander92> well, one thing is |
13:44:31 | FromGitter | <alehander92> enable the verbosity level and see for which module does it slow down |
13:44:35 | FromDiscord | <Yardanico> yeah |
13:44:37 | FromGitter | <alehander92> it should show hints with names |
13:44:40 | FromDiscord | <Stuffe> ok |
13:44:58 | FromGitter | <alehander92> i am not sure about the flag ? Hints:on ? is it enough |
13:46:44 | FromDiscord | <Stuffe> im trying with verbose:3 |
13:47:00 | FromDiscord | <Stuffe> didnt see it, let me try hints |
13:47:11 | * | Tlanger quit (Ping timeout: 256 seconds) |
13:47:17 | alehander92_ | --verbosity:3 |
13:48:06 | Yardanico | alehander92_: won't help |
13:48:23 | alehander92_ | sorry |
13:48:31 | Yardanico | Araq ^ 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:42 | Yardanico | so you can't for example see which module takes long time to process |
13:50:01 | * | narimiran quit (Ping timeout: 258 seconds) |
13:50:42 | alehander92_ | we need to find where does it echo `.` from |
13:50:50 | Yardanico | alehander92_: it's hint[Processing] |
13:50:54 | Yardanico | it was replaced with dots recently |
13:51:02 | Yardanico | https://github.com/nim-lang/Nim/pull/14418 |
13:51:04 | disbot | ➥ change the [Processing] messages into dots |
13:52:15 | alehander92_ | ! |
13:52:16 | alehander92_ | i see |
13:53:35 | FromDiscord | <Stuffe> could i compile some of it into a library and link that for "manual incremental compilation"? |
13:53:42 | FromDiscord | <Stuffe> i guess the answer is yes, but im a noob |
13:53:50 | Yardanico | well yes but there are no tools for easy "nim-nim" shared library usage |
13:53:54 | Yardanico | you'll have to exportc/importc |
13:54:14 | FromDiscord | <Stuffe> is it a pain? |
13:54:32 | FromDiscord | <Stuffe> ill try searching around |
13:54:45 | alehander92_ | well one can patch msgs.nim |
13:54:52 | alehander92_ | to just not do the `.` thing for now |
13:54:56 | alehander92_ | and see what is slow this way |
13:54:59 | alehander92_ | it works for me |
13:55:37 | alehander92_ | http://ix.io/2rgI ! |
13:55:38 | alehander92_ | <3 |
13:55:48 | alehander92_ | but otherwise please try to find out what happened |
13:55:53 | alehander92_ | because if it worked for 1s before |
13:56:00 | alehander92_ | it should probably work for ~1s now |
13:56:07 | alehander92_ | do you have like 500 files |
13:56:16 | FromDiscord | <Stuffe> no maybe 50 |
13:56:38 | alehander92_ | hm, did you introduce stuff like many generics |
13:56:42 | alehander92_ | or concepts or new macros |
13:56:42 | Yardanico | well what can make compilation slow is generics/macros |
13:56:47 | alehander92_ | ^ |
13:56:53 | Yardanico | also you can try recompiling nim compiler with PGO for example :) |
13:56:57 | FromDiscord | <Stuffe> yeah i refactored 5k lines of macros to 3k... |
13:57:00 | Yardanico | it can give like 20-40% speedup |
13:57:07 | alehander92_ | hmm |
13:57:17 | Yardanico | https://forum.nim-lang.org/t/6295 |
13:57:19 | FromDiscord | <Stuffe> but I tried echoing at the top and at the end of the macros and they seem fast |
13:57:20 | Yardanico | https://forum.nim-lang.org/t/6295#38828 |
13:57:34 | FromDiscord | <Recruit_main707> how can i tell the compiler that i want to use an specific version of c++? |
13:57:51 | Yardanico | passC/passL ? |
13:58:19 | FromDiscord | <Recruit_main707> passC:c++17? |
13:58:24 | Yardanico | no |
13:58:29 | Yardanico | like you do it for the C++ compiler |
13:58:49 | Yardanico | -std=c++17 |
13:58:53 | alehander92_ | Stuffe is it an open source project |
13:59:08 | FromDiscord | <Recruit_main707> ok, ill try that |
13:59:09 | alehander92_ | zevv had something like a vm profiler |
13:59:14 | Yardanico | oh yeah |
13:59:17 | alehander92_ | i am not sure if this got easily used |
13:59:22 | Yardanico | it is quite easy to use |
13:59:23 | Yardanico | kinda |
13:59:32 | Yardanico | https://github.com/nim-lang/Nim/pull/14833 |
14:01:24 | FromDiscord | <Stuffe> > Stuffe is it an open source project↵@alehander92_[IRC]#0000 no maybe one day |
14:01:33 | FromDiscord | <Stuffe> right now its very experimental |
14:01:38 | alehander92_ | ook ^ |
14:04:57 | * | kayw left #nim ("WeeChat 2.8") |
14:23:19 | FromDiscord | <Shucks> What memory protection has the memory block allocated with `alloc0`? |
14:27:01 | FromDiscord | <lqdev> it's zeroed |
14:27:25 | FromDiscord | <lqdev> not exactly sure what you mean by "protection". |
14:27:43 | FromDiscord | <Recruit_main707> its what it says in the description of the function iirc |
14:27:50 | FromDiscord | <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:10 | FromDiscord | <Shucks> well with the winapi `VirtualAlloc` allows you to set a protection for the allocated memory. Like rw, rwx, r etc. |
14:31:39 | FromDiscord | <Shucks> `https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc` |
14:33:09 | * | Senketsu quit (Client Quit) |
14:33:13 | alehander92_ | it should be possible to call it directly |
14:36:24 | FromDiscord | <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:42 | FromDiscord | <Recruit_main707> func getOutput*(gametickpacket: [AnotherType]): [AType] {.header: headerfile, importcpp.}` |
14:37:50 | FromDiscord | <Recruit_main707> would that work? |
14:43:25 | Zevv | alehander92_: it's easy peasy. It just never got merged |
14:45:51 | alehander92_ | awesome |
14:50:11 | FromDiscord | <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:55 | FromDiscord | <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:33 | mikebelanger | hey guys! looks like latest nim devel (1.3.5 on MacOSX: amd64) trips on Jester |
15:01:51 | Yardanico | what jester? |
15:02:02 | Yardanico | I mean what version |
15:02:04 | Yardanico | and what error |
15:02:19 | mikebelanger | simple fix though. Just changed the daysForward function's initInterval -> initTimeInterval |
15:02:21 | Yardanico | because latest tagged jester might not be compatible with devel (some long-deprecated procs were removed in devel) |
15:02:23 | mikebelanger | uh let me just check jester |
15:02:27 | Yardanico | ah yes, that's fixed in jester head |
15:02:47 | Yardanico | nimble install jester@#head |
15:02:49 | Yardanico | to install latest jester |
15:03:50 | * | NimBot joined #nim |
15:04:20 | mikebelanger | ohh ok I'm sorry :P. sorry I'm just getting used to the nimble |
15:04:48 | mikebelanger | @Yardanico just upgraded as per your command. I see the fix :) |
15:06:13 | * | ssbr quit (Ping timeout: 264 seconds) |
15:09:03 | mikebelanger | thanks |
15:12:29 | * | sagax joined #nim |
15:19:25 | FromDiscord | <Recruit_main707> i love this idea https://github.com/nim-lang/RFCs/issues/174 |
15:19:27 | disbot | ➥ C++ 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:58 | FromDiscord | <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:13 | FromDiscord | <konradmb> Quick (maybe not) question: how to create a directory? |
15:44:02 | FromGitter | <ynfle> https://nim-lang.org/docs/os.html#createDir%2Cstring |
15:45:04 | FromGitter | <ynfle> or https://nim-lang.org/docs/os.html#existsOrCreateDir%2Cstring |
15:45:43 | FromDiscord | <konradmb> Oh, really 🤦♂️ |
15:46:00 | FromDiscord | <konradmb> I've been always searching for mkdir |
15:46:06 | FromDiscord | <konradmb> Thanks! |
15:56:11 | FromDiscord | <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:12 | FromDiscord | <Shucks> ignore detour size |
16:03:07 | FromDiscord | <Clyybber> @Shucks What specifically doesn't work? |
16:03:18 | FromDiscord | <Clyybber> The snippet itself I would expect to fail |
16:03:25 | FromDiscord | <Clyybber> even after removing DETOUR_SIZE |
16:03:33 | FromDiscord | <Clyybber> since you are accessing some random pointer |
16:04:27 | FromDiscord | <Shucks> thats just a example. I know which memory address I want to nop out |
16:05:36 | FromDiscord | <Shucks> Well there happens actually nothing at that memory region im calling it |
16:05:46 | FromDiscord | <Clyybber> https://play.nim-lang.org/#ix=2rhm seems to work |
16:06:31 | FromDiscord | <Clyybber> https://play.nim-lang.org/#ix=2rho overwriting the whole region also works |
16:08:03 | FromDiscord | <Shucks> https://play.nim-lang.org/#ix=2rhr |
16:08:11 | FromDiscord | <Shucks> true. Might be a issue on my end. Gonna check it out |
16:09:35 | FromDiscord | <Shucks> What I was wondering: cast[pointer](hkTmp[0]) would be the same as hkTmp[0].addr right |
16:10:03 | FromDiscord | <Shucks> Well nvm. Gonna check it out on nim playground |
16:10:45 | FromDiscord | <Clyybber> nope |
16:11:00 | FromDiscord | <Clyybber> casting to a pointer will reinterpret whatever is at hkTmp[0] as a pointer |
16:11:25 | FromDiscord | <Clyybber> hkTmp[0].addr will give you where hkTmp[0] is actually at |
16:11:26 | FromDiscord | <Shucks> so cast[pointer](hkTmp) |
16:12:37 | FromDiscord | <Clyybber> Not a good idea since hkTmp is a seq |
16:12:46 | FromDiscord | <Recruit_main707> cast[pointer](addr hkTmp[0]) maybe is wat you want? |
16:13:03 | FromDiscord | <Shucks> sent a code paste, see https://play.nim-lang.org/#ix=2rhs |
16:13:24 | FromDiscord | <Shucks> Yea theres a difference ;p |
16:13:47 | FromDiscord | <Clyybber> Yep, since seqs point somewhere |
16:14:03 | FromDiscord | <Clyybber> So when you want to know where the array part begins, take the address of the first element |
16:14:35 | FromDiscord | <Clyybber> cast[pointer](a) will give you the pointer pointing to the array part of the sequence |
16:15:01 | FromDiscord | <Clyybber> But its not a good idea |
16:15:15 | FromDiscord | <Clyybber> since it relies on the underlying representation of a seq |
16:15:29 | FromDiscord | <Clyybber> and I'm pretty sure you don't actually want that |
16:15:37 | FromDiscord | <Clyybber> this won't work on arc for example |
16:15:44 | FromDiscord | <Clyybber> since a seq there is a pointer + len pair |
16:15:57 | Prestige | Did PMunch die? He disappeared right before I wanted to talk to him |
16:16:12 | FromDiscord | <Clyybber> ~last PMunch |
16:16:13 | FromDiscord | <Recruit_main707> i think so, i also tried to contact him |
16:16:13 | disbot | no footnotes for `last`. 🙁 |
16:16:18 | FromDiscord | <Clyybber> !last PMunch |
16:16:19 | disbot | PMunch quit 74 days ago and last spoke 4 days ago |
16:16:22 | FromDiscord | <Shucks> Fancy. Thank you 🙂 |
16:16:26 | FromDiscord | <Clyybber> np |
16:16:30 | FromDiscord | <Recruit_main707> F |
16:16:40 | FromDiscord | <Clyybber> Prestige: Looks like he's off for a few days now |
16:16:48 | Prestige | Yeah :( |
16:17:20 | * | mikebelanger quit () |
16:17:54 | FromDiscord | <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:15 | FromDiscord | <Vindaar> PMunch is on vacation afaik. He mentionet that on his test stream on the weekend |
16:18:31 | Prestige | Thanks |
16:18:58 | FromDiscord | <Recruit_main707> so he will come back, nice |
16:20:43 | FromDiscord | <Clyybber> @Shucks You can implement a memSet yourself |
16:20:48 | FromDiscord | <Recruit_main707> or wrap one |
16:21:09 | FromDiscord | <Clyybber> But IMO a for loop is better in all cases really |
16:21:15 | FromDiscord | <Clyybber> (edit) 'for' => '' |
16:21:36 | FromDiscord | <Clyybber> easier to read/understand |
16:21:37 | * | vsantana joined #nim |
16:21:38 | FromDiscord | <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:52 | FromDiscord | <Shucks> interesting |
16:23:19 | FromDiscord | <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:40 | FromDiscord | <Recruit_main707> (edit) 't¡will' => 'will' |
16:27:48 | * | tane joined #nim |
16:28:28 | * | dadada joined #nim |
16:28:32 | dadada | hi |
16:28:40 | dadada | maybe someone can help me out with this https://github.com/nim-lang/x11/issues/37 |
16:28:40 | disbot | ➥ Icon changing example wanted |
16:32:21 | FromDiscord | <Recruit_main707> no experience with x11 |
16:32:26 | Prestige | dadada: can you show what you've tried, and what the error is? |
16:36:19 | Prestige | This 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:20 | Oddmonger | is it mandatory to define a type of an array, before assigning the array itself ? |
17:06:57 | Oddmonger | ah no |
17:07:00 | FromDiscord | <lqdev> the type can be inferred from the elements |
17:07:16 | Oddmonger | i was trying to do var a = array[10, int] |
17:07:25 | Oddmonger | instead of var a:array[10,int] |
17:18:46 | * | fredrikhr quit (Ping timeout: 246 seconds) |
17:23:22 | Oddmonger | can 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:51 | Oddmonger | ah, metaprogramming it is (i was searching macros) |
17:24:14 | FromDiscord | <dilawar_uchiha> is it possible to output android compatible C source from nim |
17:24:26 | FromDiscord | <dilawar_uchiha> (edit) 'nim' => 'nim?' |
17:25:03 | Oddmonger | you need the ndk for cross compilation |
17:25:15 | FromDiscord | <dilawar_uchiha> if i get that right |
17:25:32 | * | natrys joined #nim |
17:25:43 | FromDiscord | <dilawar_uchiha> it means i can compile nim c source for android/ |
17:25:44 | FromDiscord | <dilawar_uchiha> ? |
17:26:03 | FromDiscord | <dilawar_uchiha> even though android uses linux kernal |
17:26:24 | FromDiscord | <dilawar_uchiha> it uses lib bionic intead of glibc |
17:27:04 | Oddmonger | you need a java bridge too, if you want to execute your code from elsewhere than android's terminal |
17:27:47 | Oddmonger | you will have to generate an APK (you can autosign for a debug packet, if you don't have dev account) |
17:27:54 | FromDiscord | <dilawar_uchiha> it might sound little weird |
17:28:01 | FromDiscord | <dilawar_uchiha> but i want to do game dev in nim |
17:28:12 | FromDiscord | <dilawar_uchiha> on android and raspberry pi |
17:28:35 | Oddmonger | look at sdl2 sources, there a simple example shipped with , for understanding how to proceed with android |
17:29:01 | Oddmonger | i guess there is documentation too for android, in the compiler's guide of nim |
17:29:42 | FromDiscord | <dilawar_uchiha> i am planning to use raylib |
17:32:34 | Oddmonger | hehe, 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:54 | Oddmonger | for raylib |
17:32:55 | * | wontruefree[m] joined #nim |
17:33:11 | Oddmonger | but is raylib wrapped in nim ? |
17:34:42 | FromDiscord | <dilawar_uchiha> no |
17:35:00 | FromDiscord | <dilawar_uchiha> i am gonna use the version right off the trunk |
17:35:19 | FromDiscord | <Zachary Carter> raylib does have nim bindings |
17:35:23 | FromDiscord | <Zachary Carter> !repo raylib-forever |
17:35:24 | disbot | https://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:59 | FromDiscord | <dilawar_uchiha> i actually want to learn doing all this myself |
17:36:03 | mbuchel | does anyone know how to use an extern nim in nimterop? |
17:36:13 | mbuchel | extern variable |
17:36:27 | FromDiscord | <Zachary Carter> learn doing what exactly? |
17:36:34 | FromDiscord | <Zachary Carter> wrapping raylib? |
17:37:47 | FromDiscord | <dilawar_uchiha> and compiling it for android os |
17:39:29 | FromDiscord | <dilawar_uchiha> i can skip android for now |
17:40:37 | FromDiscord | <Zachary Carter> maybe wrap some other library that isn't already wrapped as a learning exercise? |
17:40:47 | FromDiscord | <Zachary Carter> it's just a suggestion - ultimately do whatever you feel like doing 🙂 |
17:40:53 | FromDiscord | <dilawar_uchiha> sdl ? done |
17:40:57 | FromDiscord | <dilawar_uchiha> opengl ? done |
17:41:04 | FromDiscord | <Zachary Carter> there are a ton of libraries out there |
17:41:11 | FromDiscord | <dilawar_uchiha> vulkan ? |
17:41:17 | FromDiscord | <Recruit_main707> done |
17:41:35 | FromDiscord | <Zachary Carter> maybe the bullet C API that's on github |
17:41:50 | FromDiscord | <Zachary Carter> or if you're really feeling ambitious nvidia's physx |
17:41:52 | FromDiscord | <Recruit_main707> That’s a good one |
17:42:03 | FromDiscord | <dilawar_uchiha> that wont run on pi |
17:42:04 | FromDiscord | <dilawar_uchiha> XD |
17:43:07 | FromDiscord | <Zachary Carter> microui |
17:43:19 | FromDiscord | <dilawar_uchiha> i am planning to get arm intrinsics on nim though |
17:43:25 | FromDiscord | <Zachary Carter> I dunno - was just a suggestion. |
17:43:51 | FromDiscord | <lqdev> when should I use {.inline.}? |
17:44:02 | FromDiscord | <Zachary Carter> when you want to inline a function? |
17:44:08 | FromDiscord | <lqdev> well I know that |
17:44:17 | FromDiscord | <dilawar_uchiha> i think he is asking when to inline |
17:44:28 | FromDiscord | <lqdev> so basically for simpler functions (for math, etc)? |
17:44:32 | FromDiscord | <Zachary Carter> well compilers are pretty good about already inlining functions |
17:44:36 | FromDiscord | <dilawar_uchiha> normally its a good idea to let compiler to it |
17:44:38 | FromDiscord | <Zachary Carter> but if a small function gets called often |
17:44:52 | FromDiscord | <Zachary Carter> you can inline it |
17:44:56 | FromDiscord | <lqdev> ok |
17:45:15 | FromDiscord | <dilawar_uchiha> if you inline wrongly it will cause cache misses , ultimately hitting performance worse |
17:46:17 | FromDiscord | <Zachary Carter> only way to really know is to checkout the asm |
17:46:33 | FromDiscord | <Zachary Carter> and executable size |
17:46:45 | FromDiscord | <dilawar_uchiha> @Zachary Carter how to tell nim to give -Ofast flag to gcc |
17:46:51 | FromDiscord | <dilawar_uchiha> while compiling code |
17:46:56 | FromDiscord | <lqdev> --passC:-Ofast |
17:47:03 | FromDiscord | <Zachary Carter> well |
17:47:10 | FromDiscord | <dilawar_uchiha> thanks @lqdev |
17:47:15 | FromDiscord | <Zachary Carter> I wouldn't do it that way... |
17:47:23 | FromDiscord | <dilawar_uchiha> why ? |
17:47:39 | FromDiscord | <lqdev> well we already have --opt:speed |
17:47:42 | FromDiscord | <lqdev> and -d:releas |
17:47:43 | FromDiscord | <Zachary Carter> `--opt:none|speed|size` |
17:47:43 | FromDiscord | <lqdev> (edit) '-d:releas' => '-d:release' |
17:47:49 | FromDiscord | <Zachary Carter> or `-d:release` / `-d:danger` |
17:47:59 | FromDiscord | <dilawar_uchiha> -d danger is ? |
17:48:07 | FromDiscord | <dilawar_uchiha> aggressive optimisation ? |
17:48:12 | FromDiscord | <lqdev> disables checks |
17:48:21 | FromDiscord | <lqdev> and otherwise is the same as -d:release |
17:48:28 | FromDiscord | <Zachary Carter> yeah - you can see exactly what it does if you look at the nim source |
17:48:57 | FromDiscord | <lqdev> https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L55 |
17:48:58 | FromDiscord | <dilawar_uchiha> c interop with nim is almost 0 cost right ? |
17:49:07 | FromDiscord | <lqdev> not almost |
17:49:09 | FromDiscord | <lqdev> it *is* 0 cost |
17:50:08 | FromDiscord | <Zachary Carter> yes because Nim compiles to C/C++ |
17:50:18 | FromDiscord | <Zachary Carter> or Obj-C or JS |
17:51:44 | FromDiscord | <dilawar_uchiha> i am tracking this project since 0.20 release |
17:52:05 | FromDiscord | <dilawar_uchiha> i knew it was something good |
17:52:30 | FromDiscord | <dilawar_uchiha> but it 0 cost interop exceeded my expectation |
17:52:57 | FromDiscord | <Clyybber> :) |
17:53:37 | FromDiscord | <lqdev> well, for Nim it's as simple as generating an appropriate C call |
17:53:44 | FromDiscord | <lqdev> so no wonder it's zero-cost |
17:54:02 | * | mbuchel quit (Quit: WeeChat 2.8) |
17:54:37 | FromDiscord | <dilawar_uchiha> so i can pass nim arrays in c functions without thinking ? |
17:54:46 | FromDiscord | <lqdev> not really |
17:55:03 | FromDiscord | <lqdev> `array`s would work but you have to take the address of the first element where C expects a pointer |
17:55:09 | FromDiscord | <lqdev> aka `addr myArray[0]` |
17:55:43 | FromDiscord | <Clyybber> no arrays just work |
17:55:55 | FromDiscord | <Clyybber> for sequences you have to take the address of the first element of course |
17:55:59 | FromDiscord | <Clyybber> since sequences are on the heap |
17:56:41 | FromDiscord | <dilawar_uchiha> there is this android release in this nightly build |
17:56:58 | FromDiscord | <dilawar_uchiha> it means it runs on android terminal or it outputs for android ? |
17:57:00 | FromDiscord | <lqdev> @Clyybber ah good to know, never dealt with arrays :P |
17:57:39 | FromDiscord | <Clyybber> @dilawar_uchiha Both :) |
17:57:53 | FromDiscord | <Clyybber> But yeah its the build that is compiled to run on android |
17:58:01 | * | vsantana_ joined #nim |
17:58:15 | FromDiscord | <Clyybber> You can cross-compile too |
18:00:04 | * | vsantana quit (Ping timeout: 246 seconds) |
18:05:57 | FromGitter | <Knaque> I've made a thing: https://github.com/Knaque/jeknil |
18:06:02 | FromDiscord | <dilawar_uchiha> https://github.com/akavel/hellomello ↵its still valid right @Clyybber |
18:06:28 | FromDiscord | <Clyybber> yeah |
18:15:15 | * | narimiran joined #nim |
18:28:39 | FromDiscord | <Shucks> sent a code paste, see https://play.nim-lang.org/#ix=2ri1 |
18:28:59 | FromDiscord | <Shucks> (edit) 'https://play.nim-lang.org/#ix=2ri1' => 'https://play.nim-lang.org/#ix=2ri2' |
18:29:02 | dadada | Prestige: https://pastebin.com/ASyApFjD |
18:29:24 | dadada | Prestige: Error: type mismatch: got <int64> but expected 'int literal(16)' |
18:29:33 | dadada | Prestige: this error shows up where the first 42... number is |
18:30:18 | Prestige | How is that 'puchar' not throwing an error |
18:31:55 | Prestige | 4294901760 too large for a culong |
18:32:13 | dadada | Prestige: 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:20 | dadada | corrected puchar to Puchar now |
18:32:39 | dadada | Prestige: those numbers came from the C example |
18:32:43 | * | endragor joined #nim |
18:33:05 | dadada | Pcuchar |
18:33:57 | shashlick | mbuchel: what exactly are you trying to wrap? |
18:34:04 | shashlick | vars should be supported already |
18:35:14 | Prestige | dadada: check the data type for culong, looks like it was expecting a 16 bit int for some reason |
18:37:04 | dadada | culong* {.importc: "unsigned long", nodecl.} = uint |
18:37:05 | dadada | ## 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:23 | FromGitter | <matrixbot> `pooggy` Is there a true random generator module in Nim? |
18:39:16 | * | audiophile joined #nim |
18:40:36 | FromDiscord | <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:50 | dadada | Prestige: I get the same error even when using uint64.. |
18:40:58 | FromDiscord | <exelotl> (edit) |
18:41:08 | Prestige | I think I know why |
18:41:16 | Prestige | give me 1 sec to test it |
18:41:28 | dadada | okay, you get 2 seconds |
18:41:48 | dadada | for second in 0..1 |
18:42:14 | Prestige | I'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:41 | Prestige | you values are seen as ints instead of culongs? |
18:43:09 | dadada | maybe |
18:44:20 | dadada | Prestige: if I do longnumber.culong ... it complains that it gets a culong but expects int16 |
18:45:45 | Prestige | I'm not getting an error |
18:45:57 | dadada | ah, 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:27 | dadada | Prestige: what nim version |
18:46:28 | dadada | ? |
18:46:40 | Prestige | 1.2.0 |
18:46:44 | dadada | me too |
18:47:00 | Prestige | try with a 1 length array |
18:47:05 | Prestige | to debug it |
18:47:38 | Prestige | var buffer: array[1, culong] = [4294901760.culong] |
18:49:33 | dadada | Prestige: 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:54 | dadada | Prestige: 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:02 | dadada | without needing to add .culong everywhere |
18:58:07 | * | maier joined #nim |
18:58:29 | dadada | something like = culongArray[323, 432, ...] |
18:59:14 | dadada | maybe I can do it with a converter |
18:59:34 | * | SunnyDave joined #nim |
19:00:53 | dadada | yes, works with a converter, and icon is visible now |
19:01:06 | FromDiscord | <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:29 | FromDiscord | <Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2ric |
19:02:33 | FromDiscord | <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:38 | FromDiscord | <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:34 | Prestige | dadada: had to step away. You got everything working? |
19:14:44 | FromDiscord | <Recruit_main707> are there any plans on adding more backends to nim? kind of how haxe does? |
19:15:26 | dadada | Prestige: 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:50 | FromDiscord | <Zachary Carter> maybe a Zig backend at some point? |
19:16:56 | FromDiscord | <Zachary Carter> what other backends would you want? |
19:17:26 | * | endragor joined #nim |
19:19:31 | FromDiscord | <Recruit_main707> id love .net somehow, if i had to choose something, i dont feel like i need it thoigh |
19:19:35 | FromDiscord | <Recruit_main707> thouh* |
19:19:39 | FromDiscord | <Recruit_main707> fuck |
19:21:30 | FromDiscord | <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:59 | FromDiscord | <Zachary Carter> I don't think C# would make much sense for a Nim backend |
19:22:14 | FromDiscord | <Recruit_main707> not c# as such, bare .net rather |
19:22:29 | FromDiscord | <Zachary Carter> like bytecode? |
19:22:33 | FromDiscord | <Recruit_main707> yes |
19:22:49 | FromGitter | <kennymalac> how come my nim let variables are being overriden by other C threads? any ideas why this would be the case? |
19:23:29 | FromDiscord | <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:52 | FromGitter | <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:59 | FromDiscord | <Zachary Carter> well once Zig becomes a safer C and more mature it does |
19:24:43 | FromDiscord | <Zachary Carter> @Recruit_main707 - I don't see it happening |
19:24:49 | FromDiscord | <Zachary Carter> Just use Nim 🙂 |
19:24:57 | FromDiscord | <Zachary Carter> or C# if you prefer it |
19:25:36 | FromDiscord | <Varriount> kennymalac: Do you have a code sample? |
19:26:17 | FromDiscord | <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:28 | FromDiscord | <Zachary Carter> but you might as well just write in C# then heh |
19:27:45 | FromDiscord | <Zachary Carter> C# isn't a bad language at all |
19:28:01 | FromGitter | <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:12 | FromGitter | <kennymalac> Is https://github.com/nim-lang/Nim/issues/6208 relevant ? or is this expected behavior |
19:28:12 | FromDiscord | <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:13 | disbot | ➥ Stack bottom issues in foreign thread. |
19:31:09 | * | evilkhaoskat joined #nim |
19:37:42 | leorize[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:36 | FromDiscord | <Recruit_main707> why doesnt c2nim add {importcpp, etc.} pragmas when i run it?↵it just does a transpilation |
19:42:46 | FromGitter | <kennymalac> https://news.ycombinator.com/item?id=11693299 here people talk about problems with Nim GC and C interop |
19:43:22 | FromDiscord | <Varriount> kennymalac: Does the code keep in mind that (at least with the default GC) Nim uses thread-local heaps? |
19:43:30 | FromGitter | <kennymalac> I wonder if this is relevant. do I have to manually manage memory |
19:43:42 | FromGitter | <kennymalac> I have no control over the C code |
19:43:53 | FromDiscord | <Recruit_main707> you can, i dont think you will need |
19:44:08 | FromDiscord | <Varriount> Yes, but are you passing Nim allocated memory back into the C program? |
19:45:21 | FromGitter | <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:02 | FromDiscord | <Varriount> kennymalac: Do $results contain references? |
19:46:14 | FromDiscord | <Varriount> (reference types) |
19:46:22 | FromDiscord | <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:26 | FromGitter | <kennymalac> it's a string |
19:48:14 | FromGitter | <kennymalac> for context, I'm using https://github.com/ba0f3/ngxcmod.nim and my function is being called by nginx essentially |
19:49:45 | FromGitter | <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:01 | FromGitter | <kennymalac> the function calls in separate threads have the same memory locations |
19:50:44 | FromGitter | <kennymalac> to get some JSON* |
19:51:46 | FromDiscord | <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:44 | FromGitter | <kennymalac> not 100% sure. let me see if bug is still there when I set worker_processes to 1 |
19:53:45 | FromDiscord | <Varriount> kennymalac: Try compiling with --gc:arc |
19:53:54 | * | endragor joined #nim |
19:55:15 | FromGitter | <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:34 | FromDiscord | <Varriount> Hm, what error do you get with 1.0.2? |
19:55:39 | FromDiscord | <Varriount> *1.2 |
19:56:04 | FromGitter | <kennymalac> a symbol was missing being called in the shared library |
19:56:25 | FromDiscord | <Varriount> What symbol? |
19:56:43 | FromDiscord | <Varriount> Could you post the entire error in a gist? |
19:57:26 | FromDiscord | <Zachary Carter> are you adding `{.exportc, dynlib, cdecl.]` to the exported proc? |
19:57:37 | FromDiscord | <Zachary Carter> if you don't have `exportc` and `dynlib` it will not be exported in the shared library |
19:57:39 | FromDiscord | <Zachary Carter> just FYI |
19:58:06 | FromGitter | <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:09 | FromGitter | <kennymalac> that was the error |
19:58:33 | FromGitter | <kennymalac> in the ngxcmod code it shows only exportc, was this a recent change then? |
19:59:19 | FromDiscord | <Zachary Carter> I don't think so? |
19:59:35 | FromDiscord | <Zachary Carter> it's probably a bug |
19:59:48 | * | endragor quit (Ping timeout: 272 seconds) |
20:00:33 | * | evilkhaoskat joined #nim |
20:01:23 | FromGitter | <kennymalac> mmm. memory corruptioin still happens with 1 nginx worker process |
20:01:48 | FromDiscord | <Varriount> Are you calling setupForeignThreadGC? |
20:02:02 | FromGitter | <kennymalac> no |
20:03:04 | FromDiscord | <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:45 | FromDiscord | <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:54 | FromDiscord | <Varriount> And the same if you have an exit function, `exportc: "ngx_link_func_exit_cycle", dynlib, cdecl` |
20:06:13 | FromDiscord | <Varriount> Then try compiling with --gc:arc |
20:07:03 | FromGitter | <kennymalac> iirc arc isn't stable yet? |
20:08:22 | FromGitter | <kennymalac> setupForeignThreadGc() doesn't seem to help |
20:08:37 | * | maier quit (Ping timeout: 264 seconds) |
20:10:14 | FromGitter | <kennymalac> I can try arc but I am weirded out I am getting such memory corruption |
20:10:32 | FromDiscord | <Varriount> Arc is stable enough. And if you want to easily call Nim from C, it's either Arc or Boehm |
20:11:39 | FromDiscord | <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:42 | FromGitter | <kennymalac> I'll try boehm first |
20:12:08 | FromDiscord | <Varriount> You'll have to have the Boehm library installed. Depending on your system it might be a package |
20:12:53 | FromGitter | <kennymalac> oh lol |
20:13:00 | FromGitter | <kennymalac> in that case I'll try arc |
20:13:44 | FromDiscord | <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:22 | FromGitter | <kennymalac> yes |
20:14:25 | * | Vladar quit (Quit: Leaving) |
20:14:44 | FromDiscord | <Varriount> And don't forget to add the cdecl and dynlib pragmas. Incorrect calling conventions can cause memory corruption too |
20:18:28 | FromDiscord | <Varriount> kennymalac: Any luck? |
20:19:26 | FromGitter | <kennymalac> LOL okay it works with arc |
20:19:27 | FromGitter | <kennymalac> wtf |
20:19:35 | FromGitter | <kennymalac> wtf I love arc now |
20:21:12 | FromDiscord | <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:24 | FromGitter | <kennymalac> every damn function? |
20:21:35 | FromDiscord | <Varriount> Well, every function that Nginx calls |
20:21:51 | * | vsantana_ quit (Quit: leaving) |
20:22:39 | FromDiscord | <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:10 | FromGitter | <kennymalac> well I tried adding the setup at the beginning of the proc and teardown at the end, did not fix it |
20:23:25 | FromGitter | <kennymalac> but the proc calls another proc. so that proc has to have it too or what? |
20:24:35 | FromGitter | <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:39 | FromDiscord | <Varriount> https://gist.github.com/Varriount/37c0a0cc77982d790bb625bb83306caa |
20:24:48 | * | endragor joined #nim |
20:25:33 | FromGitter | <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:52 | FromDiscord | <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:27 | FromDiscord | <Varriount> Arc doesn't do the same kind of bookkeeping that the regular GC does. |
20:26:45 | FromDiscord | <Zachary Carter> I have a C application that calls Nim |
20:26:50 | FromDiscord | <Zachary Carter> but I'm using `--gc:arc` |
20:27:12 | FromDiscord | <Zachary Carter> if I wasn't - I probably would just not use the GC and the stdlib |
20:27:16 | FromDiscord | <Varriount> But Arc also doesn't handle reference cycles either. I don't know if Orc needs setupForeignThreadGc |
20:27:31 | FromDiscord | <Varriount> @Zachary Carter Do you know? |
20:29:10 | * | endragor quit (Ping timeout: 256 seconds) |
20:29:48 | FromDiscord | <Varriount> Araq: Does --gc:orc mode require setupForeignThreadGc? |
20:30:25 | FromGitter | <kennymalac> it should be made clear that if you are using Nim from C you should not use the default GC |
20:30:37 | FromGitter | <kennymalac> I know arc will be defualt soon. but still very frustrating |
20:36:14 | FromDiscord | <Zachary Carter> I don't know |
20:36:23 | FromDiscord | <Zachary Carter> this isn't true |
20:36:29 | FromDiscord | <Zachary Carter> you can use the default GC |
20:37:05 | FromDiscord | <Zachary Carter> I don't fully understand what your issue is tbh - but you can definitely use the default GC with C |
20:37:25 | FromDiscord | <Zachary Carter> and C calling into Nim code |
20:38:10 | FromGitter | <kennymalac> memory gets corrupted, not sure why |
20:38:13 | FromDiscord | <Zachary Carter> if you have an example project / code anywhere I can look at I will |
20:38:34 | FromDiscord | <Zachary Carter> well keep in mind every thread in Nim in the default memory model has its own local heap |
20:38:54 | FromDiscord | <Zachary Carter> I don't know if you're passing things between Nim and C or just from C to Nim |
20:39:10 | FromDiscord | <Zachary Carter> but Nim's GC will only try to collect what it has references to |
20:39:24 | FromDiscord | <Zachary Carter> it won't try to collect memory allocated by your C program |
20:39:34 | FromDiscord | <Zachary Carter> unless it has references to it |
20:40:26 | FromGitter | <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:55 | FromGitter | <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:18 | FromGitter | <kennymalac> that were assigned to a separate variable* |
20:41:39 | FromDiscord | <Zachary Carter> can you show me some code? |
20:42:02 | FromGitter | <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:09 | FromDiscord | <Zachary Carter> okay |
20:43:33 | FromDiscord | <Varriount> kennymalac: I know that frustration. "I'd like to show you, I really would. But I can't." |
20:44:16 | FromDiscord | <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:29 | FromDiscord | <Zachary Carter> this C++ class I'm binding to doesn't have a non-trivial default constructor defined |
20:44:54 | FromDiscord | <Zachary Carter> and I'm trying to create a C API (with Nim) which wraps this C++ API |
20:45:12 | FromGitter | <kennymalac> yeah. definetly motivated to put a repo together though because it could be a pretty critical bug |
20:45:18 | FromDiscord | <Zachary Carter> so that I can call it from another Nim program which I'm compiling to C |
20:47:40 | FromDiscord | <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:55 | FromDiscord | <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:40 | FromDiscord | <XxDiCaprioxX> What is a generic paramater? |
21:21:03 | FromDiscord | <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:25 | FromDiscord | <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:48 | FromDiscord | <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:56 | FromDiscord | <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:23 | FromDiscord | <Zachary Carter> would I create a union with a constructor? |
22:19:58 | FromDiscord | <XxDiCaprioxX> Nevermind my question haha I found out |
22:20:03 | FromDiscord | <XxDiCaprioxX> Thank you tho |
22:20:26 | * | Jesin joined #nim |
22:21:30 | FromDiscord | <exelotl> 👌 |
22:21:45 | FromGitter | <gogolxdong> Anyone works on IPFS? |
22:23:23 | FromDiscord | <Recruit_main707> > would I create a union with a constructor?↵@Zachary Carter i have no idea :/ |
22:25:31 | * | endragor joined #nim |
22:29:33 | FromDiscord | <Zachary Carter> me either! |
22:30:41 | FromDiscord | <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:32 | FromDiscord | <Recruit_main707> cant c2nim parse function pointers? |
22:36:06 | * | hyiltiz joined #nim |
22:46:45 | FromDiscord | <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:55 | FromDiscord | <Elegant Beef> Is there a way to get the bytes of any type? |
23:22:08 | * | abm quit (Quit: Leaving) |
23:23:42 | FromDiscord | <Recruit_main707> https://discordapp.com/channels/371759389889003530/371759389889003532/730444342002581544 like this? |
23:24:09 | FromDiscord | <Elegant Beef> Yea seems like it'd do 😄 |
23:25:09 | FromDiscord | <Recruit_main707> what does this error mean?↵https://play.nim-lang.org/#ix=2rj1 |
23:26:34 | FromDiscord | <Elegant Beef> the nim.cpp doesnt have a function that's attempting to call |
23:26:39 | * | krux02_ joined #nim |
23:27:25 | FromDiscord | <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:39 | FromDiscord | <Zachary Carter> so that I can call it from other Nim code that is compiled to C |
23:28:11 | FromDiscord | <Recruit_main707> right... |
23:28:28 | FromDiscord | <Recruit_main707> is it that crucial to use the c backend? |
23:28:59 | FromDiscord | <Zachary Carter> no - but I can't get the nimterop bindings for the main driver code to compile with the C++ backend |
23:29:14 | FromDiscord | <Zachary Carter> but that would make life easier for sure |
23:29:14 | * | krux02 quit (Ping timeout: 244 seconds) |
23:29:20 | FromDiscord | <Zachary Carter> I might just work on that problem instead |
23:35:17 | FromDiscord | <Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2rj3 |
23:36:26 | FromDiscord | <Zachary Carter> it seems the distinct int enum created by nimterop is being generated as (int) 7 |
23:39:46 | FromDiscord | <Zachary Carter> or is there some way to disable the `defineEnum` functionality? |
23:48:09 | FromDiscord | <Zachary Carter> well cOverride with a enum that's imported works for this |