00:01:51 | FromDiscord | <Elegantbeef> Right now instead of saying "Hey X variable doesnt exist you wrote it here" it goes "Cannot find identifier X" |
00:03:08 | FromDiscord | <Elegantbeef> Since fmt takes a static string |
00:05:01 | FromDiscord | <flywind> In reply to @Isofruit "I wonder what Araq": Not only a new book though. |
00:18:07 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Right now instead of": isnt that the same? :p |
00:54:03 | * | wallabra_ joined #nim |
00:56:23 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47wW |
00:56:26 | * | wallabra quit (Ping timeout: 255 seconds) |
00:56:26 | * | wallabra_ is now known as wallabra |
00:56:27 | FromDiscord | <Bubblie> is it possible, to add an if statement inside of this |
00:56:35 | FromDiscord | <Bubblie> because some of these args require a condition |
00:56:40 | FromDiscord | <!Patitotective> yes, use parenthesis |
00:56:40 | FromDiscord | <Bubblie> if not thats okay I can just reassign |
00:56:44 | FromDiscord | <huantian> In reply to @Patitotective "isnt that the same?": no |
00:56:51 | FromDiscord | <Bubblie> In reply to @Patitotective "yes, use parenthesis": 👀 |
00:56:59 | FromDiscord | <Bubblie> where would I use the paranthesis? |
00:57:13 | FromDiscord | <!Patitotective> `a: (if something: otherThing else: otherElseThing)` |
00:57:26 | FromDiscord | <huantian> the main place you can see it is in an ide, where instead of squiggly lines under the actual code that's wrong, there's just nothing |
00:57:54 | FromDiscord | <!Patitotective> In reply to @huantian "the main place you": ooo i get it↵i dont use an ide :pppp |
00:59:09 | FromDiscord | <Bubblie> In reply to @Patitotective "`a: (if something: otherThing": awesome |
00:59:10 | FromDiscord | <Bubblie> thank you |
01:04:53 | FromDiscord | <Elegantbeef> Ideally the macro expands to a bunch of `when` checks that call a macro that reports the proper line |
01:05:52 | FromDiscord | <Bubblie> what would be the equivalent of .data() in nim |
01:06:08 | FromDiscord | <Elegantbeef> what is `.data` elsewhere? |
01:06:41 | FromDiscord | <Bubblie> Wait nvm! |
01:06:42 | FromDiscord | <Bubblie> got it |
01:06:45 | FromDiscord | <Bubblie> sorry 😭 |
01:08:05 | FromDiscord | <Elegantbeef> `s[0].addr`? |
01:09:28 | FromDiscord | <Bubblie> yeah I think so |
01:09:34 | FromDiscord | <Bubblie> nvm that should be the case but |
01:10:05 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
01:10:26 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47x3 |
01:10:32 | FromDiscord | <Bubblie> and extensions is just a var that is assigned to this function |
01:10:42 | FromDiscord | <Bubblie> basically holding the returned variable |
01:11:04 | FromDiscord | <Bubblie> usually .data indicates the start of the array but in this case its asking for this? |
01:11:06 | FromDiscord | <Bubblie> whatever this means |
01:11:57 | FromDiscord | <Bubblie> should this not return a sequence? |
01:12:05 | FromDiscord | <Bubblie> it makes the most sense that it would... |
01:12:21 | FromDiscord | <Elegantbeef> Welcome to C confuckery |
01:12:31 | FromDiscord | <Bubblie> this is pain |
01:12:52 | FromDiscord | <Bubblie> any ideas? |
01:14:18 | FromDiscord | <Bubblie> should I cast or something |
01:14:21 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[cstring]](mySeq[0].addr)` might be it |
01:14:27 | FromDiscord | <Bubblie> okay! |
01:14:29 | FromDiscord | <Bubblie> let me try that |
01:14:32 | FromDiscord | <Elegantbeef> char\\ is a fucking tedious type |
01:14:39 | FromDiscord | <Bubblie> 😭 it is |
01:14:42 | FromDiscord | <Bubblie> C is such a mess jesus christ |
01:19:05 | FromDiscord | <morgan> so im thinking about doing usb communication (or bluetooth) between my computer and a mcu, anyone know of existing info for simulating a usb connection with debugging for it? i don't want to prototype on hardware until i have a protocol worked out |
01:19:37 | FromDiscord | <Bubblie> to get a length of a sequence its .len right |
01:21:39 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47x4 |
01:21:52 | FromDiscord | <Elegantbeef> yes↵(@Bubblie) |
01:22:23 | FromDiscord | <Elegantbeef> dont cast do `uint32` |
01:22:52 | FromDiscord | <Bubblie> ? |
01:22:54 | FromDiscord | <Bubblie> lik |
01:22:55 | FromDiscord | <Bubblie> like |
01:23:00 | FromDiscord | <Bubblie> uin32 extensions.len |
01:23:04 | FromDiscord | <Bubblie> (edit) "uin32" => "uint32" |
01:23:05 | FromDiscord | <Elegantbeef> yes |
01:23:14 | FromDiscord | <Bubblie> weirdly the same issue happens |
01:23:21 | FromDiscord | <Bubblie> its still illegal storage access |
01:23:24 | FromDiscord | <Bubblie> and im unsure as to why this is |
01:23:58 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
01:24:02 | FromDiscord | <Bubblie> is what pops up |
01:24:13 | FromDiscord | <Bubblie> changing this to nil makes it run but I kinda need to have these values in here 💀 |
01:24:33 | FromDiscord | <Elegantbeef> your array isnt right then |
01:26:06 | FromDiscord | <Bubblie> ? |
01:26:17 | FromDiscord | <Bubblie> I could send my exact code if that would help |
01:26:23 | FromDiscord | <Bubblie> I used a sequence as the return type |
01:26:28 | FromDiscord | <Bubblie> Should I have used an array? |
01:30:14 | FromDiscord | <Elegantbeef> wait `seq[ptr cstring]` is wrong |
01:30:15 | FromDiscord | <Elegantbeef> Might be best to nim's alloccstringarray and dealloc |
01:30:16 | FromDiscord | <Elegantbeef> that's more like a `char` |
01:30:42 | FromDiscord | <Elegantbeef> you shouldnt use cstrings anywhere 😄 |
01:31:03 | FromDiscord | <Elegantbeef> Joke aside |
01:31:20 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#allocCStringArray%2CopenArray%5Bstring%5D |
01:31:32 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#deallocCStringArray%2CcstringArray |
01:32:43 | FromDiscord | <Bubblie> LOL |
01:32:46 | FromDiscord | <Bubblie> Okay ill use that |
01:33:26 | FromDiscord | <Bubblie> Im getting close to that triangle |
01:33:40 | FromDiscord | <Bubblie> That 800 line triangle rendered in nim vulkan 💀 |
01:33:57 | FromDiscord | <Bubblie> Well |
01:34:00 | FromDiscord | <Bubblie> Its more than that but |
01:36:45 | FromDiscord | <Elegantbeef> cstringarray is such a ugh implementation |
01:36:52 | FromDiscord | <Bubblie> Seems like it |
01:37:23 | FromDiscord | <Bubblie> I really want to add a vulkan backend to boxy |
01:43:04 | FromDiscord | <Bubblie> wait so beef should I have it return cstringarray and just use the alloc and dealloc |
01:45:29 | FromDiscord | <Elegantbeef> No clue i avoid using Cstringarrays anywhere but where required |
01:46:11 | FromDiscord | <Bubblie> pain |
01:46:18 | FromDiscord | <Bubblie> well time to figure this out |
01:46:28 | FromDiscord | <Elegantbeef> So i'd use the procedures i gave you then convert to Nim strings/seq if needed |
01:46:37 | FromDiscord | <Bubblie> alright :) thank you |
02:10:48 | FromDiscord | <Bubblie> how would I turn a seq into an openarray? |
02:11:03 | FromDiscord | <kentuckybtc> https://t.me/+sj30hB-ZyA03Nzg0I'll 20 people on how to earn $10,000 or more in just 3day's from the crypto market.but you will pay me 10% commission when you receive your profit. if interested send me a direct message, for more information... Contact via📩📩📩📩📩📩📩📩TELEGRAM💬@@FLORAGORDONhttps://t.me/+sj30hB-ZyA03Nzg0 |
02:11:21 | FromDiscord | <Bubblie> <@&371760044473319454> |
02:11:43 | FromDiscord | <Elegantbeef> It already is one↵(@Bubblie) |
02:11:47 | FromDiscord | <Bubblie> oh |
02:12:13 | FromDiscord | <Elegantbeef> openarray[T] allows `seq[T]` or `array[any, T]` |
02:13:26 | FromDiscord | <ohiobtc> sent a long message, see http://ix.io/47xc |
02:13:37 | FromDiscord | <Bubblie> sigh |
02:13:43 | FromDiscord | <Bubblie> <@&371760044473319454> sorry for the other ping |
02:16:38 | FromDiscord | <Bubblie> so i made the procedure return a cstringArray but I have no idea how to get or use its length etc. |
02:17:31 | FromDiscord | <Bubblie> oh |
02:17:32 | FromDiscord | <Bubblie> right |
02:17:37 | FromDiscord | <Bubblie> you can turn it into a sequence |
02:18:21 | FromDiscord | <Bubblie> well at least now I got a new error |
02:18:25 | FromDiscord | <Bubblie> which is out of memory 💀 |
02:18:29 | FromDiscord | <Bubblie> pretty sure im supposed to dealloc |
02:18:57 | FromDiscord | <Elegantbeef> you'd iterate until nil doing `result.add $myCsarr[i]` |
02:24:31 | FromDiscord | <Bubblie> would that solve the out of memory issue? |
02:25:09 | FromDiscord | <Elegantbeef> Perhaps, no clue how you're converting it |
02:25:43 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
02:26:28 | FromDiscord | <Elegantbeef> Sounds like your array is null terminated or you're accessing bad memory |
02:26:38 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xe |
02:26:46 | FromDiscord | <Elegantbeef> result = temp\` 😄 |
02:26:52 | FromDiscord | <Bubblie> its called temp because I was experimenting before 💀 |
02:26:56 | FromDiscord | <Bubblie> ill change the name |
02:27:05 | FromDiscord | <Elegantbeef> you mean you wont use temp 😛 |
02:27:08 | FromDiscord | <Elegantbeef> Anyway yea that seems fine |
02:27:30 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
02:27:31 | FromDiscord | <Bubblie> I then do this |
02:27:48 | FromDiscord | <Bubblie> however, it crashes immediately due to it being out of memory so im assuming I have to dealloc the cstring somehow |
02:27:52 | FromDiscord | <Bubblie> to freeup the memory right |
02:27:57 | FromDiscord | <Elegantbeef> No |
02:28:02 | FromDiscord | <Elegantbeef> I mean you do have to dealloc it |
02:28:09 | FromDiscord | <Elegantbeef> but i think you're capturing strings unsafely |
02:28:19 | FromDiscord | <Bubblie> oh |
02:28:34 | FromDiscord | <Bubblie> oh wait maybe |
02:28:40 | FromDiscord | <Bubblie> glfwExtensions is a ptr cstring |
02:29:13 | FromDiscord | <Bubblie> is that maybe the issue? |
02:29:35 | FromDiscord | <Elegantbeef> Also i guess i was wrong `seq[cstring]` is equivlent to `char` aslong as you add a `nil` after |
02:29:49 | FromDiscord | <Elegantbeef> But yea if you're taking `string` you need to ensure they outlive the `cstring` usage |
02:30:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xf |
02:31:04 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Also i guess i": a nil after? |
02:31:23 | FromDiscord | <Elegantbeef> yes `@[a.cstring, b.cstring, c.cstring, nul]` |
02:31:27 | FromDiscord | <Elegantbeef> nil\ |
02:31:29 | FromDiscord | <Bubblie> oh! |
02:31:37 | FromDiscord | <Elegantbeef> cstring array is a null terminated collection |
02:31:47 | FromDiscord | <Bubblie> maybe thats why it said attempt to read from nil previously |
02:32:05 | FromDiscord | <Bubblie> should I try using what I had before and then just making sure there is a nil? |
02:32:16 | FromDiscord | <Elegantbeef> sure |
02:34:30 | FromDiscord | <Bubblie> wait should it be ptr cstring or just seq[cstring] |
02:35:33 | FromDiscord | <Elegantbeef> `cstring` is a `char` equivlent |
02:35:51 | FromDiscord | <Elegantbeef> So if you ensure the last entry of the seq is nil you can do `seq[cstring]` |
02:36:22 | FromDiscord | <Bubblie> alright |
02:36:38 | FromDiscord | <Bubblie> glfwextensions is ptr cstring so how would I make sure its just cstring so I can add it to the sequence? |
02:37:08 | FromDiscord | <Elegantbeef> `addr mySeq[0]` |
02:40:25 | FromDiscord | <Elegantbeef> This is why i despise C's typesystem |
02:40:33 | FromDiscord | <Elegantbeef> So many details are lost |
02:41:22 | FromDiscord | <Bubblie> Alright |
02:41:24 | FromDiscord | <Bubblie> Thank you! |
02:41:45 | FromDiscord | <Bubblie> Wait |
02:42:00 | FromDiscord | <Bubblie> But glfwextensions isn’t a sequence its just a ptr cstring |
02:42:10 | FromDiscord | <Elegantbeef> That doesnt matter |
02:42:22 | FromDiscord | <Elegantbeef> ptr cstring is a ptr to the first element of the collection |
02:42:48 | FromDiscord | <Bubblie> Oh |
02:44:11 | FromDiscord | <Bubblie> so doing extensions.add(nil) didn't do much |
02:44:27 | FromDiscord | <Bubblie> unless I was supposed to add nil a different way? |
02:44:30 | FromDiscord | <Elegantbeef> I mean you still need to ensure your strings outlive your collectiion |
02:44:59 | FromDiscord | <Elegantbeef> if the last element of your seq is nil you're doing it right |
02:45:06 | FromDiscord | <Bubblie> Ah okay |
02:49:58 | FromDiscord | <Bubblie> so uh |
02:50:00 | FromDiscord | <Bubblie> it prints out |
02:50:02 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
02:50:05 | FromDiscord | <Bubblie> does not print out nil |
02:50:16 | FromDiscord | <Bubblie> so nil is still not in there |
02:50:32 | NimEventer | New thread by Zekereth: Can't Get Length of Returned Table, see https://forum.nim-lang.org/t/9369 |
02:50:37 | FromDiscord | <Elegantbeef> !eval echo cstring(nil) |
02:50:40 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <cstring> |
02:51:47 | FromDiscord | <Elegantbeef> !eval var a\: cstring; echo a |
02:51:50 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: ':' or '=' expected, but got 'cstring' |
02:52:44 | FromDiscord | <flywind> !eval echo cstring"" == nil |
02:52:48 | NimBot | false |
02:53:18 | FromDiscord | <Bubblie> ok so it does now have nil but same issue and im severely distressed with unsafety 😭 |
02:54:29 | FromDiscord | <Bubblie> OH |
02:54:31 | FromDiscord | <Bubblie> YOOOOOOOO |
02:54:33 | FromDiscord | <Bubblie> WAIT A SECOND |
02:54:34 | FromDiscord | <Bubblie> oh nvm |
02:54:43 | FromDiscord | <Bubblie> suffering again |
02:55:51 | FromDiscord | <Bubblie> so atleast now running the function doesn't crash it, its literally only when I do uint32 extensions.len |
02:58:04 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
03:03:31 | FromDiscord | <Bubblie> Oh |
03:03:32 | FromDiscord | <Bubblie> okay |
03:03:40 | FromDiscord | <Bubblie> so changing it to a string to be more safe did something... |
03:03:47 | FromDiscord | <Bubblie> out of memory |
03:03:50 | FromDiscord | <Bubblie> instead of the nil error |
03:03:54 | FromDiscord | <Bubblie> so uh what the fuck |
03:04:07 | FromDiscord | <Elegantbeef> cstring sucks |
03:04:09 | FromDiscord | <Elegantbeef> 😄 |
03:04:46 | madprops | i was learning a bit of c++ ... apparently you can initialize with { } instead of = , weird |
03:05:05 | madprops | like int number { 2 } |
03:05:40 | madprops | it had some benefit though, like it enables some warnings |
03:06:41 | FromDiscord | <Elegantbeef> C++s intialisers are things of nightmares |
03:06:56 | FromDiscord | <Elegantbeef> `MyType a(10)` is valid code |
03:08:02 | FromDiscord | <Elegantbeef> In C++ `=` is really copy not assignment, so it's a wacky world |
03:09:37 | FromDiscord | <Elegantbeef> As such `MyType a = MyType(10);` is not equal to the above |
03:11:39 | FromDiscord | <Bubblie> Hmmmm I simply cannot figure out what could be wrong |
03:12:05 | FromDiscord | <Bubblie> so I have this now |
03:12:06 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xq |
03:12:20 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
03:12:31 | FromDiscord | <Bubblie> sigh |
03:12:43 | FromDiscord | <Elegantbeef> string is not equivlent to cstring |
03:13:07 | FromDiscord | <Bubblie> so I cant cast string to cstring |
03:13:40 | FromDiscord | <Elegantbeef> You really need to grasp low level ideas |
03:13:44 | FromDiscord | <Elegantbeef> Nim strings are pascal strings |
03:13:54 | FromDiscord | <Elegantbeef> Cstrings are null terminated |
03:14:19 | FromDiscord | <Bubblie> right 💀 I keep forgetting |
03:14:25 | FromDiscord | <Bubblie> so I cant do this that wouldn't work obviously |
03:14:25 | * | arkurious quit (Quit: Leaving) |
03:17:25 | FromDiscord | <Elegantbeef> What you had before was correctish |
03:17:43 | FromDiscord | <Bubblie> ah okay |
03:17:54 | FromDiscord | <Elegantbeef> you're doing `newSeq[cstring](glfwExtensionCount)`? |
03:18:07 | FromDiscord | <Bubblie> yes |
03:18:08 | FromDiscord | <Elegantbeef> That allocates and sets the length to count |
03:18:14 | FromDiscord | <Elegantbeef> You then `.add` after |
03:18:20 | FromDiscord | <Elegantbeef> Which adds more elemtns |
03:18:35 | FromDiscord | <Bubblie> ah wait so its a permanent length? |
03:18:36 | FromDiscord | <Bubblie> 0? |
03:18:42 | FromDiscord | <Elegantbeef> No |
03:18:45 | FromDiscord | <Bubblie> well 0 in this case with glfwExtensionCount |
03:18:49 | FromDiscord | <Bubblie> In reply to @Elegantbeef "No": ah okay |
03:18:56 | FromDiscord | <Elegantbeef> `newSeq[int](3)` == `@[0, 0, 0]` |
03:19:31 | FromDiscord | <Bubblie> huh |
03:19:45 | FromDiscord | <Bubblie> isn't that assigning all three elements of an array to that seq |
03:20:05 | FromDiscord | <Elegantbeef> you get `count` default elements then add more elements |
03:20:20 | FromDiscord | <Elegantbeef> You want `newSeqOfCap` |
03:20:56 | FromDiscord | <Bubblie> Ohhhh |
03:23:15 | FromDiscord | <Bubblie> so like this |
03:23:18 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xs |
03:23:45 | FromDiscord | <Elegantbeef> No |
03:23:50 | FromDiscord | <Elegantbeef> Jesus the hell are you doing |
03:24:16 | FromDiscord | <Bubblie> well you told me newSeqOfCap instead of newSeq right? Must have misinterpreted my bad |
03:24:29 | FromDiscord | <Elegantbeef> No that's right but what are you trying to do |
03:24:40 | FromDiscord | <Bubblie> oh like in general? |
03:24:43 | FromDiscord | <Elegantbeef> You're attempting to query extensions then add their names to a seq of strings |
03:24:56 | FromDiscord | <Forest> In reply to @Elegantbeef "Jesus the hell are": you sound like you're gonna rip your hair out lmao |
03:25:02 | FromDiscord | <Elegantbeef> I'm about to |
03:25:26 | FromDiscord | <Bubblie> In reply to @Elegantbeef "You're attempting to query": yes, you want the original C++ code? |
03:25:31 | FromDiscord | <Bubblie> might be easier to understand what im trying to do |
03:25:33 | FromDiscord | <Elegantbeef> No this is fine |
03:25:36 | FromDiscord | <Elegantbeef> I cannot read C++ |
03:25:40 | FromDiscord | <Bubblie> oh |
03:26:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xt |
03:27:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xu |
03:28:08 | FromDiscord | <Elegantbeef> Probably need a `cast[ptr UncheckedArray[cstring]](glfwExtensions)` |
03:28:20 | FromDiscord | <Elegantbeef> and probably need a count \> 0 check |
03:31:45 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
03:31:53 | FromDiscord | <Elegantbeef> You can |
03:33:42 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xv |
03:34:02 | FromDiscord | <Elegantbeef> "It's not letting me" isnt an error message |
03:34:16 | FromDiscord | <Elegantbeef> And not dont send it here |
03:34:19 | FromDiscord | <Elegantbeef> Read it and solve it yourself |
03:34:23 | FromDiscord | <huantian> In reply to @Elegantbeef "I'm about to": Wait I though you were a bot how do you have hair |
03:34:36 | FromDiscord | <Elegantbeef> My programmers were dicks↵(@huantian) |
03:35:14 | FromDiscord | <Bubblie> oh wait |
03:35:23 | FromDiscord | <Bubblie> btw I meant to send the error message after but |
03:35:24 | FromDiscord | <Elegantbeef> Connectting dots with the error message |
03:35:25 | FromDiscord | <Bubblie> give me one sec |
03:35:30 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Connectting dots with the": yes |
03:35:30 | FromDiscord | <Elegantbeef> "Oh shit it's supposed to be X" |
03:35:48 | FromDiscord | <Elegantbeef> The fix is really really simple if i'm right |
03:36:04 | FromDiscord | <Elegantbeef> type mismathc at position 3 |
03:36:10 | FromDiscord | <Elegantbeef> got cuint but expected int |
03:36:13 | FromDiscord | <Bubblie> yes |
03:36:28 | FromDiscord | <Elegantbeef> Read the error messages please 😛 |
03:36:33 | FromDiscord | <Bubblie> oh sure |
03:37:15 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xw |
03:37:31 | FromDiscord | <Bubblie> im going to get my glasses thats probably also why im unable to read shit at times |
03:39:09 | FromDiscord | <Forest> Isn't cuint deprecated? |
03:40:30 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xy |
03:40:53 | FromDiscord | <Bubblie> hold on |
03:41:21 | FromDiscord | <Bubblie> I made it print out the length and its three |
03:41:30 | FromDiscord | <Bubblie> making enabledExtensionCount: 0 literally makes it run smoothly |
03:41:45 | FromDiscord | <Bubblie> so the minute I put extensions.len with a uint32 it just |
03:41:45 | FromDiscord | <Bubblie> dies |
03:43:11 | FromDiscord | <Bubblie> is this a binding issue? |
03:43:14 | FromDiscord | <Bubblie> is it possible? |
03:45:02 | FromDiscord | <SaAnd> the type signature expects an int to be passed where you passed the glfwCount thing. Since the glfw thing is an cuint, it errors |
03:45:10 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xA |
03:45:51 | FromDiscord | <Bubblie> In reply to @SaAnd "the type signature expects": oh I didn't see this |
03:45:53 | FromDiscord | <Elegantbeef> you need to convert it to an int in \`toOpenArray |
03:45:58 | FromDiscord | <Elegantbeef> Jesus |
03:46:22 | FromDiscord | <Bubblie> oh that? |
03:46:29 | FromDiscord | <Bubblie> In reply to @Bubblie "well I fixed it": I already fixed this |
03:46:56 | FromDiscord | <Elegantbeef> Ok |
03:49:06 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47xD |
03:49:18 | FromDiscord | <Bubblie> (edit) "https://play.nim-lang.org/#ix=47xD" => "https://play.nim-lang.org/#ix=47xE" |
03:49:30 | FromDiscord | <Bubblie> OH |
03:49:34 | FromDiscord | <Bubblie> OKAY WAIT A SECOND |
03:49:44 | FromDiscord | <Bubblie> when enabledLayerCount is ANYTHING above 0 it dies |
03:49:48 | FromDiscord | <Bubblie> WTF |
03:50:32 | FromDiscord | <Bubblie> so this completely works, its just this part of the object not taking any integer above 0 thats the issue |
03:50:40 | FromDiscord | <Bubblie> which is, what... |
03:51:40 | FromDiscord | <Bubblie> wait a second |
04:10:50 | FromDiscord | <SrMordred> Q: its safe to return a struct from a proc? |
04:11:00 | FromDiscord | <Elegantbeef> Yes |
04:11:12 | FromDiscord | <Elegantbeef> they objects in Nim |
04:11:15 | FromDiscord | <Elegantbeef> they're\ |
04:12:24 | FromDiscord | <SrMordred> sent a code paste, see https://play.nim-lang.org/#ix=47xL |
04:14:21 | FromDiscord | <Elegantbeef> nim -v? |
04:14:43 | FromDiscord | <SrMordred> Nim Compiler Version 1.6.6 [Windows: amd64]↵Compiled at 2022-05-05 |
04:15:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xM |
04:17:27 | FromDiscord | <Funky Egg> how do i remove all dependencies of a package that im uninstalling |
04:20:15 | FromDiscord | <Elegantbeef> remove the requires from your nimble registry |
04:22:18 | FromDiscord | <Funky Egg> is that to me |
04:22:28 | FromDiscord | <Elegantbeef> Yes |
04:22:45 | FromDiscord | <Funky Egg> i accidently installed globally, im new to nim |
04:22:59 | FromDiscord | <Elegantbeef> Nim doesnt have a local package registry |
04:23:03 | FromDiscord | <Elegantbeef> You install packages globally |
04:23:15 | FromDiscord | <Funky Egg> ? |
04:23:25 | FromDiscord | <Funky Egg> where do i go to remove them |
04:23:37 | FromDiscord | <Elegantbeef> `nimble uninstall package` |
04:24:35 | FromDiscord | <Funky Egg> that doesnt uninstall all its dependencies |
04:24:47 | FromDiscord | <Funky Egg> all its dependencies are still there |
04:24:50 | FromDiscord | <Elegantbeef> Oh that's what you mean |
04:24:59 | FromDiscord | <Rika> I assume manually |
04:24:59 | FromDiscord | <Elegantbeef> Dont know if nimble supports that |
04:25:18 | FromDiscord | <Funky Egg> ah ok |
04:26:07 | FromDiscord | <Bubblie> so beef, for now im gonna leave it at 0 and then figure it out as I go, just wanted to thank you for your help |
04:27:03 | FromDiscord | <SaAnd> nimble uninstall -i package↵(@Funky Egg) |
04:27:44 | FromDiscord | <SaAnd> short for nimble uninstall --inclDeps package |
04:27:49 | FromDiscord | <Funky Egg> ty |
04:28:05 | FromDiscord | <SaAnd> wait it might be -i before uninstall |
04:28:36 | FromDiscord | <SaAnd> yeah i think it is |
04:32:45 | FromDiscord | <Elegantbeef> @SrMordred\: i did do a min repro and i couldnt reproduce it outside of using raylibnow |
04:36:19 | FromDiscord | <SrMordred> sent a code paste, see https://play.nim-lang.org/#ix=47xO |
04:36:36 | FromDiscord | <Elegantbeef> I think it might be a NVRO bug, might be wrong |
04:36:41 | FromDiscord | <Funky Egg> one last quick thing how do i import a specific version of a package in a .nimble file |
04:37:01 | FromDiscord | <Elegantbeef> `requires "package == semver"` |
04:37:11 | FromDiscord | <Elegantbeef> Or commit or whatever other versioning works |
04:37:21 | FromDiscord | <Funky Egg> tysm |
04:39:38 | FromDiscord | <Elegantbeef> It's a bug with refc it seems |
04:39:48 | FromDiscord | <Elegantbeef> with `--mm:orc` or `--mm:arc` it doesnt appear |
04:39:54 | FromDiscord | <Elegantbeef> Such an od behaviour |
04:40:21 | FromDiscord | <Rainbow Asteroids> time to be a cool guy and use `--gc:orc` ig |
04:40:39 | FromDiscord | <Elegantbeef> Well a compiler bug needs to be made but i cannot find how to minrepro it |
04:40:44 | FromDiscord | <Elegantbeef> Guess it's time to look at the C code 😄 |
04:41:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xP |
04:45:31 | FromDiscord | <SrMordred> lol, its NVRO but also c bind related somehow, since its a simple struct. ↵but hey --mm:orc solves it, so my project its saved xD |
04:48:36 | FromDiscord | <Elegantbeef> Still certainly needs an issue, but it's a very ugh... what bug 😄 |
04:51:45 | FromDiscord | <SrMordred> i tried nim a lot a years ago. ↵i'm translating a half-baked rust project to nim to see how its goes, and in the first day i hit a compiler bug. ↵this kind of thing happens way too often with me xD |
04:52:27 | FromDiscord | <Elegantbeef> It seems to be a bug with nim's `genericAssign` for refc |
04:53:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47xR |
04:54:38 | FromDiscord | <Elegantbeef> It's a bit odd that raylib imports that struct anyway |
04:54:51 | FromDiscord | <Elegantbeef> Mark it by copy and C's structural typing handles it i thought |
05:50:16 | * | xcodz-dot joined #nim |
05:50:47 | xcodz-dot | I am using js backend for nim, could someone please tell me how to use cookies |
05:51:02 | xcodz-dot | I am really desperate now |
05:53:08 | FromDiscord | <Elegantbeef> You'd use them the same way you use them in JS, the code might not be wrapped though |
05:53:23 | xcodz-dot | That |
05:53:49 | xcodz-dot | That's the problem, I am unable to find any standard API for using cookies |
05:54:06 | xcodz-dot | no such thing as the word `cookie` in the js standard lib |
05:54:31 | FromDiscord | <Elegantbeef> Yea i dont know anything about webdev so hopefully someone that does speaks |
05:54:40 | FromDiscord | <huantian> https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie well google gives me this |
05:54:55 | xcodz-dot | thanks, I have already been there. |
05:55:12 | xcodz-dot | no such API is exposed in js backend for whatever reason |
05:55:34 | FromDiscord | <huantian> I think you can importc `document` as a JsObject |
05:55:36 | FromDiscord | <Prestige> Is there no way to do css hover with Karax? |
05:55:44 | FromDiscord | <huantian> https://nim-lang.org/docs/jsffi.html |
05:56:02 | xcodz-dot | Will try that |
05:56:03 | FromDiscord | <huantian> I don’t know why Document isn’t wrapped anywhere in the std |
05:56:14 | xcodz-dot | oh, document is there under dom |
05:56:18 | FromDiscord | <Elegantbeef> Prestige you should be able to add any attribute |
05:56:19 | xcodz-dot | but are cookies under document? |
05:56:38 | FromDiscord | <Prestige> In reply to @Elegantbeef "Prestige you should be": I'm not sure how, with karax |
05:57:04 | xcodz-dot | noop, cookies aren't there |
05:57:16 | xcodz-dot | looks like, I will have to write some emit pragmas |
05:57:33 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=47xX |
05:57:39 | FromDiscord | <PyryTheBurger> how do i overwrite an object constructor |
05:57:45 | FromDiscord | <Elegantbeef> You dont |
05:58:21 | FromDiscord | <Elegantbeef> I mean you dont need to do anything in the html for that afaik, you just do `a: "Hello"` or w/e |
05:58:41 | FromDiscord | <Prestige> What? |
05:58:49 | FromDiscord | <Prestige> How does that apply with `hover` |
05:58:55 | FromDiscord | <Elegantbeef> Are you trying to embed CSS into a Nim object? |
05:59:07 | FromDiscord | <Elegantbeef> Fuck i havent touched karax or webdev in forever i forget how any of it works |
05:59:55 | FromDiscord | <Elegantbeef> What are you trying to do?↵(@PyryTheBurger) |
06:00:11 | FromDiscord | <Prestige> I can do stuff like `let blueTextCSS = toCss("color: blue")` then `tdiv(style = blueTextCSS)` |
06:00:15 | FromDiscord | <huantian> It’s probably be better to use your own document declared with JsObject↵(<@709044657232936960_xcodz-dot=5b=49=52=43=5d>) |
06:00:28 | FromDiscord | <Prestige> I wish I could just use a css file with karax tbh |
06:00:37 | xcodz-dot | thx huantian |
06:00:39 | FromDiscord | <Elegantbeef> You cant use css with karax? |
06:01:08 | FromDiscord | <PyryTheBurger> sent a code paste, see https://play.nim-lang.org/#ix=47xZ |
06:01:08 | FromDiscord | <huantian> I’d give an example but I’m on mobile 😞 |
06:01:27 | FromDiscord | <PyryTheBurger> and then i want to make a custom constructor that also puts the instance into an array |
06:01:29 | FromDiscord | <Prestige> In reply to @Elegantbeef "You cant use css": Not that I'm aware of (a standalone css file) |
06:02:27 | FromDiscord | <Elegantbeef> You can with `link(rel = "stylesheet", type = "text/css", href = "main.css")` methinks |
06:02:49 | FromDiscord | <Elegantbeef> I thought i used a stylesheet for my site |
06:02:49 | FromDiscord | <Prestige> Hm I'll try it |
06:02:54 | FromDiscord | <huantian> Maybe you should just use tailwind ex |
06:03:00 | FromDiscord | <huantian> \ez |
06:04:02 | FromDiscord | <Prestige> I'd still have to have karax use that css file |
06:04:13 | FromDiscord | <Elegantbeef> Is that an issue? |
06:04:17 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=47y0 |
06:04:42 | FromDiscord | <Elegantbeef> so make a `proc init(_: typdesc[Lol], lol: string)` or something similar↵(@PyryTheBurger) |
06:05:05 | FromDiscord | <Elegantbeef> I dont know what the issue is with just having karax link your `.css` init it |
06:05:09 | FromDiscord | <Elegantbeef> in it\ |
06:05:18 | FromDiscord | <Prestige> In reply to @Elegantbeef "I dont know what": Figuring out how to do that |
06:05:26 | FromDiscord | <Elegantbeef> What i gave you will do that |
06:05:29 | FromDiscord | <Elegantbeef> Put that in your header |
06:05:31 | FromDiscord | <Elegantbeef> Or w/e |
06:05:36 | FromDiscord | <Prestige> I'm trying it out |
06:05:48 | FromDiscord | <Elegantbeef> Ah ok i thought you tried it out and were complaining |
06:05:49 | FromDiscord | <Elegantbeef> My bad |
06:06:08 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=47y1 |
06:06:30 | FromDiscord | <Prestige> Yay it worked |
06:06:32 | FromDiscord | <Prestige> thanks beef |
06:06:36 | FromDiscord | <Elegantbeef> Look at the `withLock` template in `locks` |
06:06:38 | FromDiscord | <Elegantbeef> No problem |
06:07:18 | FromDiscord | <untoreh> can withlock be used on func defs? |
06:07:22 | FromDiscord | <Elegantbeef> Your locked template isnt proper i think cause it doesnt lock in the proc |
06:07:36 | FromDiscord | <Elegantbeef> You'll need a macro for that i assume |
06:08:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47y2 |
06:08:39 | FromDiscord | <untoreh> I see |
06:11:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47y3 |
06:12:41 | FromDiscord | <Elegantbeef> Damn this is actually smart |
06:13:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47y5 |
06:14:19 | FromDiscord | <Elegantbeef> Not that it's really much better than the pragma as a first line |
06:14:59 | FromDiscord | <huantian> Yeah you just lose the indent |
06:15:39 | FromDiscord | <Elegantbeef> Wonder if you can lock on parameters |
06:16:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47y6 |
06:16:42 | FromDiscord | <Elegantbeef> Probably not but meh i closed the file |
06:45:53 | FromDiscord | <Bubblie> Im gonna have to write some C++ vulkan tommorow to see if this is a binding issue with nimious vulkan and then fix it |
06:46:11 | FromDiscord | <Bubblie> Cause if it doesn’t work on C++ either it means I clearly did something wrong and am missing something |
06:50:14 | FromDiscord | <Bubblie> I hate c++ |
06:50:16 | FromDiscord | <Bubblie> 😭 |
06:52:01 | * | deadmarshal joined #nim |
06:55:08 | * | kenran joined #nim |
06:55:52 | * | kenran quit (Client Quit) |
06:56:37 | FromDiscord | <victory> im sort of new to nim, what is `Option`? |
06:56:55 | FromDiscord | <victory> and if i was specifying a value for something of type `Option[bool]`, how would it look? |
06:58:02 | FromDiscord | <Elegantbeef> `some(true)` |
06:58:09 | FromDiscord | <Elegantbeef> Option adds n + 1 possible states to a type |
06:59:09 | FromDiscord | <4zv4l> I was wondering since Nim is really similar to C with the function declaration, is it ok to include a nim file that contains all the functions and struct declaration like a `.h` file for but Nim ? |
07:04:49 | FromDiscord | <untoreh> why do you copy the tree? In what places would edit the proc def in place be bad? |
07:05:39 | FromDiscord | <untoreh> (edit) "places" => "cases" |
07:06:28 | FromDiscord | <Elegantbeef> It's not bad to mutate it if it's untyped |
07:06:29 | FromDiscord | <Elegantbeef> It was typed in my previous version so it needed it↵(@untoreh) |
07:07:20 | * | krux02 joined #nim |
07:08:53 | FromDiscord | <Bung> anyone know how to undervolt cpu in c on windows, I bought new pc with small case and i7 12700f . xtu does not works. |
07:10:51 | xcodz-dot | I do not think that windows provides any API to do such kernal level critical tasks |
07:11:09 | FromDiscord | <Elegantbeef> Normally you do it through uefi no? |
07:11:16 | xcodz-dot | true |
07:11:25 | xcodz-dot | bios or uefi, whatever you have |
07:11:39 | FromDiscord | <Bung> bios has no option to set |
07:11:59 | FromDiscord | <Elegantbeef> Overclock settings? |
07:12:17 | xcodz-dot | Then you are out of luck |
07:12:48 | FromDiscord | <Bung> my pc is hp brand, does not have much custom options |
07:12:56 | xcodz-dot | I also got a new laptop recently with shitty uefi that has locked even the settings to Virtualization Technologies. Can not even use the features advertised by Intel |
07:13:24 | FromDiscord | <Bung> but xtu old version does support for non-k suffix cpu |
07:13:29 | FromDiscord | <Elegantbeef> I love that modern CPUs are so inefficient that people undervolt them instead of the companies providing ample cooling |
07:14:15 | xcodz-dot | It is probabbly bad decisions of adding tons of complex instructions into the ISA earlier by intel for marketing purposes. |
07:14:21 | FromDiscord | <Bung> yeah , when you enable Virtualization Technologies which wsl needed, xtu does not work |
07:14:28 | FromDiscord | <Phil> In reply to @Elegantbeef "Oh is it `{.gcsafe.}:`": I squint at this because I'm pretty sure I tried that before, but that memory is at least half a year old so I could be misremembering |
07:14:52 | FromDiscord | <Elegantbeef> With 300W+ cpu and CPUs we're finally actually needing 600w PSUs on low spec PCs 😄↵(<@709044657232936960_xcodz-dot=5b=49=52=43=5d>) |
07:15:09 | FromDiscord | <Elegantbeef> cpus and gpus\ |
07:15:17 | FromDiscord | <Elegantbeef> Yea i dont know phil |
07:15:17 | xcodz-dot | WTF? 300W CPU !!??? |
07:16:14 | FromDiscord | <Elegantbeef> The 12900k pulls 241 W ad max turbo |
07:16:14 | FromDiscord | <Elegantbeef> at max\ |
07:16:58 | xcodz-dot | that is worst than what I though. I beleived that a really heavy CPU couldnt take more than 50-60 W. But that is on a whole another level. |
07:17:59 | xcodz-dot | anyways, remember the question I asked about cookies? I implemented it using emit pragma and importing using importjs pragma. |
07:18:08 | FromDiscord | <Elegantbeef> Nice |
07:18:35 | FromDiscord | <Phil> In reply to @xcodz-dot "that is worst than": May I introduce you to the assumed new Nvidia 4000 series specs? |
07:18:39 | FromDiscord | <Phil> They will blow your mind |
07:18:44 | FromDiscord | <Phil> Literally, the fans will need to be insane |
07:18:45 | FromDiscord | <Elegantbeef> I mean those are gpus |
07:18:53 | FromDiscord | <Elegantbeef> Cpus were generally low wattage for a long time |
07:19:05 | xcodz-dot | Oh no no no |
07:20:58 | xcodz-dot | Well, wanted to share this: https://xcodz-dot.github.io/ .Dont mind the content. Just look at the animations. All implemented in 99% pure nim. (1% of JS using emit pragma) |
07:21:56 | FromDiscord | <Elegantbeef> Why is it .exe,, i'm scared is it running wine in a window, help! 😛 |
07:22:35 | xcodz-dot | lol, wanted that old DOS look to it. But really, I am young so idk about that Time. I am not even an adult rn. |
07:26:53 | FromDiscord | <victory> how could I get the latency of a shard on dimscord? |
07:34:47 | * | xcodz-dot quit (Quit: Leaving) |
07:35:14 | FromDiscord | <!&luke> Can I compile nimja at runtime instead of compile time? |
07:35:30 | FromDiscord | <!&luke> In reply to @victory "how could I get": s.latency I think |
07:35:39 | FromDiscord | <!&luke> S is the shard |
07:35:42 | FromDiscord | <victory> i figured it out |
07:35:43 | FromDiscord | <victory> thx tho! |
07:35:44 | FromDiscord | <!&luke> (edit) "S" => "s" |
07:35:49 | FromDiscord | <!&luke> In reply to @victory "thx tho!": Np |
07:40:15 | FromDiscord | <4zv4l> how can I quickly get the number of line in a file ? |
07:40:46 | * | krux02 quit (Remote host closed the connection) |
07:41:25 | FromDiscord | <Rika> Scan the whole file |
07:41:36 | FromDiscord | <4zv4l> so read line by line ? |
07:41:42 | FromDiscord | <Rika> Pretty much |
07:41:48 | FromDiscord | <4zv4l> doesn't sound super optimized |
07:41:51 | FromDiscord | <4zv4l> wc doesn't do like that |
07:41:53 | FromDiscord | <Rika> No other way |
07:41:58 | FromDiscord | <Rika> Does it now |
07:42:08 | FromDiscord | <Rika> I don’t recall another way to do it other than to read the whole file |
07:42:29 | FromDiscord | <Rika> Are you sure it’s not just scanning really quickly |
07:42:44 | FromDiscord | <4zv4l> well if it does that then that's really really quick |
07:43:05 | FromDiscord | <4zv4l> I had a 30gb file↵and I tried a c program that scan each newline to increment |
07:43:20 | FromDiscord | <4zv4l> it tooks like 15 seconds more than wc |
07:43:26 | FromDiscord | <4zv4l> but alright, I'll do that |
07:43:28 | FromDiscord | <newlibarian> what is the difference between let and var? |
07:43:30 | FromDiscord | <4zv4l> just doesn't sound super nice |
07:43:35 | FromDiscord | <newlibarian> when and if ? |
07:43:37 | FromDiscord | <4zv4l> In reply to @newlibarian "what is the difference": let are immutable |
07:43:41 | FromDiscord | <4zv4l> var are mutable |
07:43:49 | FromDiscord | <4zv4l> In reply to @newlibarian "when and if ?": swicth case/ if else |
07:44:12 | FromDiscord | <4zv4l> In reply to @4zv4l "swicth case/ if else": not the best explanation |
07:44:43 | FromDiscord | <newlibarian> difference between const and let? |
07:44:49 | FromDiscord | <Rika> When is compile time |
07:44:51 | FromDiscord | <Rika> If is run time |
07:44:58 | FromDiscord | <Rika> In reply to @newlibarian "difference between const and": Const is immutable compile time |
07:45:03 | FromDiscord | <Rika> Let is immutable run time |
07:45:15 | FromDiscord | <newlibarian> what's the difference between run time and compile time? |
07:45:44 | FromDiscord | <Rika> Compile time happens when you compile the program, before it runs |
07:45:48 | FromDiscord | <Rika> Run time is when it runs |
07:45:59 | FromDiscord | <newlibarian> but won't the binary be the same? |
07:46:11 | FromDiscord | <Rika> What do you mean? |
07:46:26 | FromDiscord | <newlibarian> they both compile to binary ? |
07:46:51 | FromDiscord | <Rika> With compile time code execution, you can calculate stuff before you create the binary, and put only the final result into the binary |
07:47:05 | FromDiscord | <Elegantbeef> `let` can rely on runtime values where as `const` cannot |
07:47:17 | FromDiscord | <Rika> In reply to @Elegantbeef "`let` can rely on": That’s what he’s asking |
07:47:22 | FromDiscord | <Rika> What does it mean to be compile time and run time |
07:47:52 | FromDiscord | <newlibarian> my favorite languages are c , pascal and python, this is new to me. |
07:47:59 | FromDiscord | <Elegantbeef> A compiled language like Nim runs over your code before it's executed to generate a binary, this includes type checking, macro evaluation, static block evaluation, and anything else that can be evaluated statically. |
07:48:36 | FromDiscord | <Elegantbeef> This enables catching errors earlier and also saving performance |
07:48:49 | FromDiscord | <Elegantbeef> const in nim is a lot like C's `#define` |
07:49:04 | FromDiscord | <Elegantbeef> It's a cached constant expression that has a symbol |
07:49:18 | FromDiscord | <newlibarian> pascal use const too. i know if it value doesn't change i use const to improve performance. |
07:49:18 | FromDiscord | <Elegantbeef> The difference is that the expression is cached once and repetitive usage does not cause it to revaluate |
07:51:03 | FromDiscord | <newlibarian> i'm using vscode for editor. what's the best editor for nim? |
07:51:29 | FromDiscord | <Rika> That works, yes |
07:51:33 | FromDiscord | <Elegantbeef> All tooling for nim but jetbrains' uses nimsuggest so it's all about equal |
07:51:44 | FromDiscord | <Elegantbeef> If you're using vscode ensure you're using saem's extension |
07:54:11 | FromDiscord | <newlibarian> i pretty much know how to use nim even though i just installed it.. i just need to get the terminology right. |
07:54:43 | FromDiscord | <Elegantbeef> Wellyea you know pascal and it's pretty much fancier pascal |
07:55:32 | FromDiscord | <newlibarian> nim is like my 3 favorite languages into one. |
08:11:08 | FromDiscord | <4zv4l> is there a way to get the return from split to multiple variables ? |
08:11:22 | FromDiscord | <4zv4l> like↵`name, age, adr = str.split(",")` |
08:11:36 | FromDiscord | <4zv4l> split the result array to multiple variable |
08:12:02 | FromDiscord | <Elegantbeef> Are you sure you dont want `let (success, name, age, adr) = str.scanTuple("$+,$i,$+")`? |
08:12:35 | FromDiscord | <4zv4l> looks a bit fancier but why not yeah |
08:12:43 | FromDiscord | <Elegantbeef> `import std/strscans` |
08:13:37 | FromDiscord | <4zv4l> do I need the success one ? |
08:13:47 | FromDiscord | <4zv4l> why it doesn't throw an error instead ? |
08:13:53 | FromDiscord | <Elegantbeef> You can make i `_` if you dont care that it succeeded |
08:14:13 | FromDiscord | <Elegantbeef> Cause success makes more sense than a exception here as scanf doesnt raise an exception either |
08:14:28 | FromDiscord | <Elegantbeef> scanf you're supposed to use `if line.scanf(..., a, b, c)` |
08:15:29 | FromDiscord | <Rika> I don’t know but it feels like people forget what “exception” means xd |
08:15:30 | FromDiscord | <!&luke> In reply to @ripluke "Can I compile nimja": Anyone know? |
08:16:04 | FromDiscord | <4zv4l> In reply to @Rika "I don’t know but": well you expect the scanTuple to get the arguments you ask for |
08:16:18 | FromDiscord | <4zv4l> if there isn't all the one you asked then handle with `except` |
08:16:45 | FromDiscord | <Elegantbeef> That's not exceptional |
08:16:59 | FromDiscord | <Elegantbeef> Exceptions should be used in exceptional cases |
08:17:02 | FromDiscord | <Elegantbeef> Atleast in my view |
08:17:56 | FromDiscord | <Elegantbeef> If your parse failed would it cause something exceptional inside the procedure you called |
08:17:58 | FromDiscord | <Elegantbeef> No |
08:17:58 | FromDiscord | <4zv4l> so for basic error why not making an enum {value, error} and check all the time if the error is nul or not ? |
08:18:05 | FromDiscord | <4zv4l> yes right |
08:18:10 | FromDiscord | <4zv4l> then it will raise |
08:18:12 | FromDiscord | <Elegantbeef> Cause optionals are better |
08:18:29 | FromDiscord | <Elegantbeef> Sentinels and Optionals are lovely |
08:18:33 | FromDiscord | <Elegantbeef> But not for errors |
08:18:40 | FromDiscord | <Elegantbeef> Exceptions are pristine for errors |
08:19:09 | FromDiscord | <Elegantbeef> These are my views atleast others disagree |
08:19:28 | FromDiscord | <4zv4l> so, instead of using try/except, what should I use ? |
08:19:43 | FromDiscord | <Elegantbeef> You should use try except in the case there are exceptions/errors |
08:20:02 | FromDiscord | <Elegantbeef> You should use better methods to indicate when a procedure may fail at doing a task |
08:20:09 | FromDiscord | <4zv4l> alright |
08:20:11 | FromDiscord | <Elegantbeef> Be it a sentinel value or an optional |
08:20:17 | FromDiscord | <Elegantbeef> `std/options` for the latter |
08:20:31 | FromDiscord | <Elegantbeef> for the former you can either use dumb C sentinels or a static typed one like https://github.com/beef331/nimtrest/blob/master/sentinels.nim |
08:21:29 | FromDiscord | <4zv4l> In reply to @Elegantbeef "Are you sure you": how do I get unsigned with that ? I don't find the letter for unsigned if there is any |
08:21:51 | FromDiscord | <Elegantbeef> Nim says default to signed integers |
08:21:56 | FromDiscord | <4zv4l> wait, why are you talking about sentinel ? |
08:22:16 | FromDiscord | <Elegantbeef> Cause you asked how does one propagate an error failed and there are 3 methods |
08:22:23 | FromDiscord | <Elegantbeef> A procedure failed\ |
08:23:11 | FromDiscord | <Elegantbeef> There are exceptions which are for when you something exceptional, optionals, and sentinels |
08:23:26 | FromDiscord | <Elegantbeef> Sentinels are optionals but do not take any more memory |
08:23:29 | FromDiscord | <4zv4l> sentinel are for the end of string aren't they ? |
08:23:33 | FromDiscord | <Elegantbeef> No |
08:23:44 | FromDiscord | <Elegantbeef> Those are sentinel terminated C arrays |
08:24:03 | FromDiscord | <Elegantbeef> Sentinels values are designating a value meaningless |
08:24:20 | FromDiscord | <Elegantbeef> So if you have an API that returns -1 on failure that's a sentinel |
08:24:39 | FromDiscord | <4zv4l> alright |
08:24:41 | FromDiscord | <4zv4l> get it |
08:29:28 | FromDiscord | <newlibarian> {.global.} is this the only way to declare global variables? |
08:29:40 | FromDiscord | <Elegantbeef> Nim supports top level variables |
08:29:49 | FromDiscord | <newlibarian> what does that mean? |
08:29:55 | FromDiscord | <Elegantbeef> The global pragma is for declaring a variable inside a procedure globally |
08:30:06 | FromDiscord | <Elegantbeef> That's valid |
08:30:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47yn |
08:30:53 | FromDiscord | <newlibarian> how do you delcare global variables? |
08:31:04 | FromDiscord | <Elegantbeef> I just showed you |
08:31:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47yo |
08:31:10 | FromDiscord | <Elegantbeef> A global variable is a top level variable |
08:31:29 | FromDiscord | <Elegantbeef> The global pragma on a variable in a procedure makes it outlast it's stack frame |
08:33:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47yp |
08:33:09 | FromDiscord | <Phil> Wait, beef already wrote an example |
08:33:14 | FromDiscord | <Phil> I should focus on eating breakfast |
08:33:54 | FromDiscord | <Elegantbeef> Dont worry phil sometimes i dont think even the interested parties read my messages |
08:34:25 | FromDiscord | <Elegantbeef> I should start rendering my messages in wordart to keep the attention |
08:34:32 | FromDiscord | <Phil> My order of operation is what screwed me here:↵Read message, reply to it if desired, read next message, reply to it if desired |
08:34:47 | FromDiscord | <Phil> etc. |
08:37:25 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=47yr |
08:37:38 | FromDiscord | <untoreh> (edit) "https://play.nim-lang.org/#ix=47yr" => "https://play.nim-lang.org/#ix=47ys" |
08:38:10 | FromDiscord | <Elegantbeef> Lock doesnt work with indirection |
08:38:20 | FromDiscord | <untoreh> 😦 |
08:38:38 | FromDiscord | <Elegantbeef> I mean think about it you'd have to walk down every procedure call and check if any was guarded |
08:38:46 | FromDiscord | <Elegantbeef> It's a mess to be fair |
08:38:55 | FromDiscord | <Elegantbeef> It'd be nice if it did work but it's understandable it doesnt imo |
08:39:04 | FromDiscord | <untoreh> like regex lookbehinds 😛 |
08:39:11 | FromDiscord | <Elegantbeef> Not to mention generics, and other complex |
08:39:18 | FromDiscord | <Elegantbeef> complex statements |
08:39:25 | FromDiscord | <Elegantbeef> Regex is a mistake |
08:39:29 | FromDiscord | <Elegantbeef> So who cares if it works |
08:40:48 | FromDiscord | <Prestige> Will Nim 2.0 do away with needing forward declarations? 🤔 |
08:40:57 | FromDiscord | <Elegantbeef> It's in the roadmap |
08:41:01 | FromDiscord | <Prestige> Sweet |
08:41:11 | FromDiscord | <Elegantbeef> might not be 2.0 but after it |
08:41:19 | FromDiscord | <Elegantbeef> 2.0 isnt really that fancy to be fair |
08:41:22 | FromDiscord | <Prestige> My gf keeps complaining about it, lol |
08:41:30 | FromDiscord | <Elegantbeef> Everyone is acting like it will make 90000 different things |
08:41:34 | FromDiscord | <Prestige> Yeah |
08:42:54 | FromDiscord | <Prestige> Gah I should make my own terminal |
08:44:01 | madprops | how do you measure nim usage worldwide? |
08:44:18 | FromDiscord | <Elegantbeef> You put a cup in the lake and if you catch a fish nim is popular |
08:44:43 | madprops | a cup in the c |
08:45:40 | * | kenran joined #nim |
08:45:57 | * | kenran quit (Client Quit) |
08:46:20 | FromDiscord | <Elegantbeef> Generally people look at github activity |
08:46:51 | FromDiscord | <Elegantbeef> But given this live chat it seems nim is losing more than it's gaining, so who knows |
08:48:09 | FromDiscord | <Prestige> Tbh it's hard to gain new people with poor editor support |
08:49:47 | * | dnh joined #nim |
08:50:06 | FromDiscord | <flywind> In reply to @Elegantbeef "2.0 isnt really that": Nim v2 is gonna to be conservative, but the next gen compiler is going to be fancy |
08:50:19 | FromDiscord | <Elegantbeef> Assuming it ever comes 😄 |
08:50:26 | FromDiscord | <flywind> (edit) "gonna" => "going" |
08:50:48 | FromDiscord | <flywind> Probably the same time when v2 is released. |
08:51:04 | FromDiscord | <Elegantbeef> What is there a hidden rewrite of Nim going on somewhere |
08:51:19 | FromDiscord | <flywind> In reply to @Avahe "Will Nim 2.0 do": It is in the 2.x roadmap. |
08:51:43 | FromDiscord | <flywind> In reply to @Elegantbeef "What is there a": A secret, I don't know much. |
08:52:50 | FromDiscord | <Prestige> Weird, never heard about that |
08:55:11 | FromDiscord | <flywind> Otherwise how can the GitHub activity of the Nim repo is so inactive. |
08:55:44 | FromDiscord | <Elegantbeef> Oh nice fly i see you've got defaults in a PR |
08:56:31 | FromDiscord | <Elegantbeef> Does it work with `a = 100`? |
08:56:45 | FromDiscord | <flywind> Yeah, It is green before, after I merge the upstream changes, some nimsuggest tests are broken on Linux and Macos. |
08:57:03 | FromDiscord | <Elegantbeef> Also does it work distincts? |
08:57:17 | FromDiscord | <flywind> In reply to @Elegantbeef "Does it work with": Yes, it works for const values. |
08:57:36 | FromDiscord | <flywind> with/without type |
08:57:38 | FromDiscord | <Elegantbeef> Ah so it's literally my defaults without a macro 😄 |
08:57:59 | FromDiscord | <flywind> In reply to @Elegantbeef "Also does it work": I haven't tested distincts. |
08:58:29 | FromDiscord | <flywind> In reply to @Elegantbeef "Ah so it's literally": Yeah |
08:58:35 | FromDiscord | <untoreh> are lock levels still a thing? since TLock was deprecated? |
08:58:53 | FromDiscord | <Elegantbeef> Lock are being deprecated |
08:58:57 | FromDiscord | <Elegantbeef> Lock levels rather |
08:59:31 | FromDiscord | <Elegantbeef> Completely removed as they're pretty much useless |
08:59:33 | FromDiscord | <flywind> Lock levels is scheduled to be removed on the roadmap. I had a PR for ut. |
08:59:36 | FromDiscord | <Elegantbeef> I still dont know what the hell they indicate |
08:59:46 | FromDiscord | <flywind> (edit) "ut." => "it." |
09:00:09 | FromDiscord | <Elegantbeef> It was an under documented bitch of a feature |
09:06:14 | FromDiscord | <enthus1ast> FROM linux it was no big issue, but FROM windows TO linux .... |
09:08:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47yB |
09:08:10 | FromDiscord | <Elegantbeef> Remember that `newX` is conventionally a heap allocation |
09:29:17 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:36:09 | * | dnh joined #nim |
09:53:39 | * | xet7 joined #nim |
10:40:20 | FromDiscord | <Prestige> I'm trying to do some stuff with karax - anyone know how to get the string value from an `input` after it's been changed? |
10:40:46 | FromDiscord | <Prestige> I've added an event `onInput` listener to it, but haven't been able to pull a string value from the `Event` object |
10:47:57 | FromDiscord | <Prestige> ah, it's `n.value` - guess the data isn't inside the event |
11:05:34 | FromDiscord | <hotdog> In reply to @Avahe "I'm trying to do": If you did want to pull it from the event it would be event.target.value |
11:05:56 | FromDiscord | <Prestige> I was getting a nil error when trying that |
11:06:04 | FromDiscord | <hotdog> Though you’d need to convert it to InputEvent |
11:06:13 | FromDiscord | <hotdog> Or ChangeEvent maybe |
11:06:34 | FromDiscord | <hotdog> https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event |
11:06:55 | FromDiscord | <hotdog> Either |
11:07:12 | FromDiscord | <hotdog> https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event |
11:07:28 | FromDiscord | <hotdog> In reply to @Avahe "I was getting a": What was nil? The target or the value? |
11:07:57 | FromDiscord | <Prestige> The value, was throwing some error about the string in js being null when it was being converted over or something, I don't remember exactly |
11:08:19 | FromDiscord | <Prestige> I'm very familiar with how the js side of things works, but it's been a pain figuring out what karax is doing, exactly |
11:15:56 | * | pro joined #nim |
11:20:03 | FromDiscord | <Ras> yet another dumb question: is there a good way to combine those last two for loops? https://media.discordapp.net/attachments/371759389889003532/1008334184135262279/unknown.png |
11:20:17 | FromDiscord | <Ras> `nodes` and `floating_nodes` are both the same type |
11:20:18 | FromDiscord | <hotdog> @Prestige this seems to work fine for me - http://ix.io/47z0 |
11:24:54 | FromDiscord | <hotdog> In reply to @Ras "yet another dumb question:": `for node in parent.nodes & parent.floatingNodes` or make a template |
11:25:24 | FromDiscord | <Ras> In reply to @hotdog "`for node in parent.nodes": does that allocate a new sequence? |
11:25:33 | FromDiscord | <hotdog> In reply to @Ras "does that allocate a": Ye |
11:25:38 | FromDiscord | <Ras> alright |
11:25:42 | FromDiscord | <hotdog> I would do the latter and template it |
11:25:47 | FromDiscord | <Ras> alright, thanks |
11:26:21 | FromDiscord | <Prestige> Weird |
11:33:15 | * | xcodz-dot joined #nim |
11:35:54 | xcodz-dot | Why doesn't this work and shows an error of string being unused. I am trying to port my python written compiler to nim. https://play.nim-lang.org/#ix=47z3 |
11:36:02 | * | krux02 joined #nim |
11:37:18 | FromDiscord | <flywind> In reply to @xcodz-dot "Why doesn't this work": You need to specify the return of macros, it should be string. |
11:37:27 | FromDiscord | <flywind> (edit) "In reply to @xcodz-dot "Why doesn't this work": You need to specify the return ... of" added "type" |
11:37:34 | FromDiscord | <flywind> return type |
11:38:07 | FromDiscord | <flywind> `macro defIns(statement: static[string]): string` |
11:38:35 | xcodz-dot | Thanks, I am dumb. Shouldn't nim compiler give out a better error message? |
11:39:02 | pro | nim compiler let's say unique |
11:39:17 | pro | is! |
11:39:26 | xcodz-dot | hmm |
11:43:47 | * | krux02 quit (Remote host closed the connection) |
11:44:31 | * | krux02 joined #nim |
11:54:55 | * | krux02 quit (Remote host closed the connection) |
11:55:24 | FromDiscord | <tandy> based nim gf↵(@Prestige) |
11:55:45 | * | krux02 joined #nim |
11:57:25 | * | pro quit (Quit: pro) |
12:00:51 | FromDiscord | <haxscramper> In reply to @flywind "Nim v2 is going": Just "fancy" or are there some details about that? |
12:01:46 | FromDiscord | <haxscramper> In reply to @flywind "A secret, I don't": You've been told this is a secret or there is just no info available? |
12:02:02 | FromDiscord | <haxscramper> In reply to @flywind "Otherwise how can the": And you guessed based on the GH activity |
12:06:06 | FromDiscord | <Phil> In reply to @flywind "Yes, it works for": Wait, does that generate a `new(T)` constructor proc for me? |
12:06:24 | FromDiscord | <Phil> Just now scrolled down enough to see hax' messages, everybody wants flywind it seems |
12:22:59 | FromDiscord | <tandy> does anyone know why my jsony rename hooks dont work for incoming json?↵https://gitlab.com/tandy1000/listenbrainz-nim/-/blob/master/src/listenbrainz/utils/tools.nim#L59 |
12:24:41 | FromDiscord | <Phil> Just so I can be sure of what I'm reading |
12:24:50 | FromDiscord | <Phil> Could you give me an example string of the json you're expecting? |
12:26:54 | FromDiscord | <Phil> Because from what I'm seeing you're expecting something like this:↵` {"https://musicbrainz.org/doc/jspf#playlist": "some value or another"}` |
12:27:33 | FromDiscord | <kentuckybtc> https://t.me/+sj30hB-ZyA03Nzg0I'll 20 people on how to earn $10,000 or more in just 3day's from the crypto market.but you will pay me 10% commission when you receive your profit. if interested send me a direct message, for more information... Contact via📩📩📩📩📩📩📩📩TELEGRAM💬@@FLORAGORDONhttps://t.me/+sj30hB-ZyA03Nzg0 |
12:27:42 | FromDiscord | <Phil> <@&371760044473319454> We have scum in the chat |
12:27:58 | FromDiscord | <Phil> Unrelated to that guy, tandy you there? |
12:28:07 | FromDiscord | <tandy> nvm, it was working, just ref object comparison failing \:L↵(@Phil) |
12:28:09 | FromDiscord | <tandy> im a knob |
12:28:26 | FromDiscord | <Phil> It's fine, we all ar |
12:28:31 | FromDiscord | <Phil> (edit) "ar" => "are 😄" |
12:29:08 | FromDiscord | <tandy> why would one want to use ref objects over objects? |
12:30:09 | FromDiscord | <Phil> Easy, normal objects are sometimes really painful to properly parse when you have nested ones and you may have a hidden copy somewhere |
12:31:18 | FromDiscord | <Phil> For example, I recently ran into this where I wanted to parse the `Row` datatype (which is seq[string] basically) that databases give you into objects.↵I had the scenario where I could have nested objects. With value type objects that suddenly becomes a massive pain because in the naive approach somewhere you have the object getting copied and the copy you parse the data into is not the one your proc eventually returns etc. etc. |
12:32:10 | FromDiscord | <Phil> Further, a normal object copies way more data around than a ref-type does.↵If your object is large, copying that around a lot is expensive when you can just have a single object and instead of the entire object you just copy the pointer to it |
12:32:51 | FromDiscord | <tandy> ahh |
12:33:30 | FromDiscord | <tandy> but why doesnt the nim compiler automatically generate equality checks for ref objects? |
12:33:59 | FromDiscord | <Phil> Hm? What do you mean? |
12:34:16 | FromDiscord | <Phil> I need some context here |
12:34:39 | FromDiscord | <dom96> ugh, matrix is too annoying to moderate |
12:35:36 | FromDiscord | <Phil> quick question, what was the proc again that showed me the amount of memory an object takes up? |
12:36:00 | FromDiscord | <Phil> I know there was one but I can't remember the name of it for the life of me, I know Rika told it to me once |
12:37:15 | FromDiscord | <Phil> It's flipping `sizeof` |
12:37:17 | FromDiscord | <Phil> damn |
12:37:34 | FromDiscord | <Phil> Okay I'm writing myself an SO question for this when I can't even remember that |
12:39:34 | * | jmdaemon quit (Ping timeout: 244 seconds) |
12:41:46 | FromDiscord | <Phil> But do we have a proc that gives me the size of a ref object! |
12:41:52 | FromDiscord | <Phil> (edit) "object!" => "object?" |
12:42:56 | FromDiscord | <Phil> Because I can't properly get the size of a seq of ints.↵That'll just throw out the size of the pointers |
12:42:56 | FromDiscord | <dom96> `sizeof(refObj[])` maybe |
12:43:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47zh |
12:44:00 | FromDiscord | <Phil> That gives you a compile-error for seqs sadly |
12:44:11 | FromDiscord | <dom96> well for seq you'd need to get the size of the element the number of elements |
12:45:13 | FromDiscord | <Phil> Fair. It feels like that's fairly doable to do and just nobody did it yet to have sizeof(obj) that gives you the entire memory-space taken up |
12:45:28 | FromDiscord | <Phil> Though the big question becomes who even needs that info |
12:47:36 | FromDiscord | <flywind> In reply to @Isofruit "Wait, does that generate": yes |
12:48:13 | FromDiscord | <Phil> Hell yeah |
12:48:19 | FromDiscord | <flywind> new T will initialize the variable with the default value. |
12:48:21 | FromDiscord | <Phil> Literally one of the day 1 features I'd have loved for nim to have |
12:48:38 | FromDiscord | <Phil> Which is why I loved beef's constructor/defaults module so much |
12:50:03 | FromDiscord | <Phil> If I can get moigagoo to agree this could literally be the basis for a more convenient norm API where you don't have to pass an instance of an object, but just the type that you want.↵It's what I use internally for my own webapplication already and why I wrote a wrapper module around everything I do with norm so that I don't have to deal with object instantiation |
13:00:58 | FromDiscord | <dom96> In reply to @Isofruit "Fair. It feels like": `sizeof` is modeled after how it works in C |
13:01:32 | FromDiscord | <dom96> so if it returned a large value for a pointer that would confuse a lot of people |
13:02:15 | FromDiscord | <Rika> In reply to @tandy "but why doesnt the": Because whether the user wants pointer equality or field equality is ambiguous |
13:02:40 | FromDiscord | <Rika> Or did I miss something |
13:02:41 | FromDiscord | <flywind> In reply to @Isofruit "That gives you a": seq is a value type, not a ref type though. |
13:02:44 | FromDiscord | <Rika> I probably did |
13:02:54 | FromDiscord | <Phil> In reply to @flywind "seq is a value": squint I'm not convinced of that, one sec |
13:03:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47zn |
13:03:59 | FromDiscord | <flywind> !eval var x = @[1]; var y = x; x[0] = 777; echo y |
13:04:03 | NimBot | @[1] |
13:04:57 | FromDiscord | <Phil> So is a seq something with the copy behaviour of value types but allocated on the heap instead of the stack? |
13:05:18 | FromDiscord | <flywind> Yes |
13:05:23 | * | xcodz-dot quit (Ping timeout: 244 seconds) |
13:05:42 | FromDiscord | <flywind> Are you using ORC btw? |
13:05:42 | FromDiscord | <Phil> And i assume the same is true for strings? |
13:06:10 | FromDiscord | <flywind> True |
13:06:17 | * | xcodz-dot joined #nim |
13:06:22 | FromDiscord | <Phil> In my playground project where I'm compiling the lines above? Yeah, but not always↵In my webapplication? Yeah |
13:06:55 | FromDiscord | <flywind> They don't copy string literals in ARC/ORC It copies on write. |
13:07:13 | FromDiscord | <flywind> (edit) "ARC/ORC" => "ARC/ORC." |
13:07:47 | FromDiscord | <flywind> (edit) "They don't" => "Nim doesn't" | "copies" => "uses "copy" | "write." => "write" for string literals" |
13:08:03 | FromDiscord | <Phil> As someone who tends to not think about these kinds of things and only if it's really necessary, do people deeper into low level stuff actually keep that in their head everytime they read code?↵Or do they start contemplating this also only when necessary? |
13:09:12 | FromDiscord | <Phil> "These kinds of things" being "When does a copy happen" and "Who owns what memory" |
13:09:20 | FromDiscord | <leorize> pretty much, if you ever found a weird hotspot that said `prepareMutation`, that's the problem |
13:09:41 | FromDiscord | <leorize> "who owns that memory" is pretty important, though |
13:10:46 | FromDiscord | <Phil> In reply to @leorize "pretty much, if you": What is `prepareMutation` is that an internal nim proc of sorts? |
13:11:15 | FromDiscord | <leorize> it's the CoW part flywind mentioned |
13:14:56 | FromDiscord | <Rika> If you deal with this kind of shit a few tens of times you tend to remember how it works xddd |
13:16:16 | FromDiscord | <leorize> a nice thing is that it's not usually an issue when CoW is applied only to literals |
13:18:47 | FromDiscord | <leorize> back when I was using pascal a common complaint on the mailing list was that if you happen to have an array of string, you might end up with hidden overhead when you process that array in a hot loop due to hidden copies from CoW (Free Pascal strings are fully CoW, which means free slices, but edits incur copying if never done before) |
13:39:22 | FromDiscord | <dom96> In reply to @Isofruit "As someone who tends": mostly only if I know a piece of code will be in the hot path or I'm explicitly looking to optimise a piece of code |
13:48:24 | * | xet7 quit (Remote host closed the connection) |
13:54:07 | FromDiscord | <mratsim> In reply to @Isofruit "As someone who tends": It depends if:↵↵- potential bottleneck↵- multithreading is involved and so we need to understand ownership |
13:54:32 | FromDiscord | <mratsim> but usually it's only when you benchmark that it surfaces. |
14:00:23 | xcodz-dot | exit |
14:00:38 | xcodz-dot | lol, sorry, I meant `/exit` in IRC |
14:00:43 | * | xcodz-dot quit (Quit: Leaving) |
14:16:40 | FromDiscord | <Adamillo> I feel like there's a bug in Nim where it doesn't install properly when using a non ASCII local username |
14:20:30 | FromDiscord | <mratsim> In reply to @Adamillo "I feel like there's": How do you install it? |
14:20:45 | FromDiscord | <Adamillo> https://nim-lang.org/install_windows.html |
14:20:58 | FromDiscord | <Adamillo> By downloading the x64 binary from there and running finish.exe |
14:22:12 | FromDiscord | <dom96> what issues are you seeing? |
14:25:37 | FromDiscord | <Adamillo> For example this happens and when using y it doesn't do anything https://media.discordapp.net/attachments/371759389889003532/1008380879036502096/unknown.png |
14:29:05 | FromDiscord | <dom96> yeah, looks like a bug |
14:29:11 | FromDiscord | <dom96> report it on the Nim repo |
14:29:18 | FromDiscord | <dom96> you can add that dir to your PATH manually |
14:33:33 | FromDiscord | <aruZeta> Is there a way to know if a proc's paramater with a default value was specified, like in common lisp `(defun foo (&optional (bar 0 barp))` where barp is a bool, if false bar is not specified, else it was |
14:33:53 | FromDiscord | <aruZeta> (edit) "barp))`" => "barp)))`" |
14:34:26 | * | arkurious joined #nim |
14:39:50 | FromDiscord | <Adamillo> In reply to @dom96 "you can add that": How do I manually put it in path? |
14:40:08 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47zI |
14:40:11 | FromDiscord | <aruZeta> (edit) |
14:40:40 | FromDiscord | <dom96> In reply to @Adamillo "How do I manually": https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ |
14:41:17 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=47zJ |
14:41:35 | FromDiscord | <aruZeta> Can't be helped then, thanks |
14:41:49 | FromDiscord | <aruZeta> That feature is something i rly like from lisp |
14:43:07 | FromDiscord | <dom96> What's your use case for it? |
14:45:37 | FromDiscord | <aruZeta> For example, you have a range type like `type FooRange = range[0..10]` which is used as a parameter of a proc. If the proc receives no value, you calculate it with some algorithm or whatever, else use what was provided |
14:46:10 | FromDiscord | <Rika> You can calculate values directly in the default value expression |
14:46:14 | FromDiscord | <Rika> It’s just a bit cursed |
14:46:25 | FromDiscord | <dom96> You can use Option[FooRange] for that |
14:46:40 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47zK |
14:46:42 | FromDiscord | <Rika> Options |
14:46:46 | FromDiscord | <Rika> As mentioned |
14:46:50 | FromDiscord | <aruZeta> In reply to @dom96 "You can use Option[FooRange]": never heard of it, sounds good |
14:47:00 | FromDiscord | <aruZeta> lemme check the docs |
14:47:44 | FromDiscord | <aruZeta> std/options, just what i needed, thanks |
14:47:48 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=47zL |
14:50:40 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:59:15 | FromDiscord | <leorize> alternatively you can provide an empty overload |
14:59:57 | FromDiscord | <leorize> I'm not sure if it's even possible to pass an `Option[int]` as `Option[FooRange]`, though, so that might be a potential issue |
15:06:29 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47A7 |
15:07:21 | FromDiscord | <Rika> You’ll have to emit the printf too |
15:07:49 | FromDiscord | <4zv4l> because I don't get why he did that https://media.discordapp.net/attachments/371759389889003532/1008391498552856666/unknown.png |
15:07:49 | FromDiscord | <Rika> Nim is not really aware of anything you do in emit, so you can’t call things you include in Nim |
15:08:02 | FromDiscord | <4zv4l> why he just put an include in the emit ? |
15:08:03 | FromDiscord | <Rika> He then importc's it right there |
15:08:29 | FromDiscord | <Rika> For the importc, though im not really sure why either |
15:08:38 | FromDiscord | <4zv4l> and so when you emit the lib, then you don't need to precise which file in importc ? |
15:08:53 | FromDiscord | <Rika> Pretty much I guess |
15:11:33 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1008392439729487882/unknown.png |
15:11:45 | FromDiscord | <4zv4l> I missed a type or something ? |
15:13:15 | FromDiscord | <Rika> Return type |
15:13:35 | FromDiscord | <4zv4l> I tried cint |
15:13:39 | FromDiscord | <4zv4l> didn't work |
15:13:53 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1008393028752375849/unknown.png |
15:13:58 | FromDiscord | <4zv4l> and it's from the manual |
15:16:54 | FromDiscord | <4zv4l> with `cint` is seems that the issue remaining is the cstring not being `const` |
15:16:58 | FromDiscord | <4zv4l> can I change that ? |
15:19:12 | FromDiscord | <4zv4l> alright |
15:19:23 | FromDiscord | <4zv4l> without the `emit` it works if I add the `header` |
15:19:25 | FromDiscord | <4zv4l> super weird |
15:26:55 | FromDiscord | <4zv4l> the chat is saying it too xD https://media.discordapp.net/attachments/371759389889003532/1008396309641842754/unknown.png |
15:26:58 | FromDiscord | <leorize> you need to add `{.noDecl.}` if you want to use the emit |
15:27:12 | FromDiscord | <4zv4l> emit is to directly put C code right ? |
15:27:19 | FromDiscord | <leorize> or the prototype will not match between Nim and C, which is always bad news |
15:27:39 | FromDiscord | <4zv4l> alright, thank you so much↵I understand better now |
15:27:44 | FromDiscord | <4zv4l> (edit) "alright, thank you so much↵I ... understand" added "better" | removed "better" |
15:27:52 | FromDiscord | <leorize> yea, `{.header.}` is preferred for including headers |
15:28:15 | FromDiscord | <4zv4l> can I insert the header in top of the file or I need to precise for each thing I import ? |
15:28:59 | FromDiscord | <leorize> it is preferred to put `{.header.}` on stuff you import |
15:29:39 | FromDiscord | <4zv4l> alright |
15:29:42 | FromDiscord | <4zv4l> thank you ^^ |
15:30:55 | FromDiscord | <Rika> You’re strewmingc |
15:31:00 | FromDiscord | <Rika> (edit) "strewmingc" => "streaming?" |
15:32:18 | FromDiscord | <4zv4l> I am not, just looking at this video↵https://www.youtube.com/watch?v=XoOp3UfKXQY&t=2132s |
15:32:27 | FromDiscord | <4zv4l> writing a keyboard software in Nim |
15:59:14 | * | dnh joined #nim |
16:13:36 | NimEventer | New post on r/nim by zxyzyxz: erg: A Python-compatible statically typed language, see https://reddit.com/r/nim/comments/woa144/erg_a_pythoncompatible_statically_typed_language/ |
16:20:53 | FromDiscord | <Rika> this does not look like python |
16:21:21 | * | Guest56 joined #nim |
16:21:28 | FromDiscord | <Rika> oh so its not supposed to look like it |
16:21:34 | FromDiscord | <Rika> but its supposed to interop well with it |
16:23:03 | FromDiscord | <Phil> ... but we have nimpy |
16:23:53 | FromDiscord | <Rika> oh damn mf main committer left us for rust |
16:24:47 | FromDiscord | <Rika> also that icon..... |
16:25:17 | Guest56 | a simple question: how do I get a reference to an existing sequence? |
16:26:56 | FromDiscord | <Rika> i believe you dont; you either make it a reference from the start or you go unsafe |
16:28:07 | Guest56 | I see... thanks |
16:31:32 | * | vicecea quit (Remote host closed the connection) |
16:32:01 | * | vicecea joined #nim |
16:48:39 | * | Guest56 quit (Quit: Client closed) |
16:48:48 | FromDiscord | <huantian> Can’t you just take the addr of the sequence? |
16:51:10 | FromDiscord | <Phil> You can |
16:51:50 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47AG |
16:54:02 | FromDiscord | <Phil> Huh, fascinating, you can get the addr of a `const` , you can even try to manipulate it, that will compile, but it will give you also a segfault at runtime |
16:57:15 | * | xcodz-dot joined #nim |
16:59:56 | FromDiscord | <Rika> addr is unsafe 🙂 |
17:00:55 | FromDiscord | <Rika> a few keywords to remember to know if smth is unsafe is `ptr addr cast` |
17:01:01 | FromDiscord | <Rika> thats maybe 60 or 80 % |
17:01:25 | FromDiscord | <Rika> oh, add `pointer` too of course |
17:01:45 | FromDiscord | <SaAnd> `asm` |
17:02:22 | FromDiscord | <Rika> that's a rare keyword anyway |
17:02:32 | FromDiscord | <SaAnd> yes |
17:02:38 | FromDiscord | <domosokrat> and `addr some_seq` is not a pointer to the first element |
17:03:44 | FromDiscord | <domosokrat> it's a pointer to base structure of a seq. So the `y[2]=5` is poking somewhere it shouldn't |
17:04:25 | FromDiscord | <Rika> no, that wouldnt work because `[]=(ptr seq, int)` doesnt exist i believe |
17:04:31 | FromDiscord | <Rika> it would need to be `y[][2] = 5` |
17:04:42 | FromDiscord | <Rika> and then i dont even know if that would work |
17:13:55 | FromDiscord | <Phil> I mean, the code above works both with and without de-referencing the pointer |
17:14:52 | FromDiscord | <Phil> So maybe somebody thought ahead or through some unintended magics this is possible |
17:16:03 | FromDiscord | <Rika> you addr a let? |
17:17:44 | FromDiscord | <Rika> idk, i'm unsure why indexing a ptr seq works, i dont remmeber any coinverters |
17:17:48 | FromDiscord | <Phil> I was just as surprised as you that this worked |
17:18:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47AP |
17:18:55 | FromDiscord | <Rika> `var x` |
17:19:06 | FromDiscord | <Rika> if that works as is then you're on devel perhaps |
17:19:14 | FromDiscord | <Phil> Oh, right, yeah might be |
17:19:21 | FromDiscord | <Phil> yeh 171 |
17:19:23 | FromDiscord | <Phil> (edit) "171" => "1.71" |
17:20:02 | FromDiscord | <Phil> (edit) "1.71" => "1.7..1" |
17:20:37 | FromDiscord | <Phil> Yeh, gets blocked on 1.6.6, x must be a var or it'll stop you at compiletime |
17:23:58 | FromDiscord | <Rika> hm |
17:23:59 | FromDiscord | <Rika> i dont know |
17:25:55 | * | Amun-Ra quit (Quit: Gdyby mi się chciało tak jak mi się nie chce...) |
17:26:44 | * | Amun-Ra joined #nim |
17:28:08 | FromDiscord | <EyeCon> I'm on devel, how do I see which commit I have? `nim -v` doesn't seem to include the commit hash |
17:38:38 | * | derpydoo quit (Quit: derpydoo) |
17:48:08 | FromDiscord | <Phil> Tried to compile my project, immediately noticed why I'm on devel: ↵1.6.6 didn't allow for enum-values to be compile-time strings |
17:49:01 | xcodz-dot | How am I supposed to convert a table generated by a macro at compile time to ast for injection in the output code? |
17:52:41 | xcodz-dot | If I wasn't clear. I have a Table[string, int] object generated statically inside macro, And I want to return that table back via macro as a `let mytable*: Table[string, int] = # Generated compile time table content goes here`. |
17:54:58 | xcodz-dot | please leave a answer here, I will be back by tomorrow and shall check the IRC logs. Thanks! |
17:55:04 | * | xcodz-dot quit (Quit: Leaving) |
17:58:31 | FromDiscord | <aruZeta> In reply to @leorize "I'm not sure if": that's right, I'm getting some errors with range types, but why is it like that? |
18:01:43 | FromDiscord | <aruZeta> no, that's not it, I need to pass the params using `some()` |
18:02:13 | FromDiscord | <aruZeta> (edit) "`some()`" => "`some()`, which is not very convenient" |
18:04:34 | FromDiscord | <domosokrat> How complex are the calculations for the case of a missing optional? Because you can set optional arguments based on other arguments. e.g. `proc f(a: seq[int]; b=a.len)` |
18:05:41 | FromDiscord | <aruZeta> it's not so much about complexity, but just wanted to know if there was an easy way to know if optional params were specified or not |
18:06:36 | FromDiscord | <aruZeta> (edit) "complexity," => "the calculations being complex," |
18:07:46 | FromDiscord | <domosokrat> Ok. It was just that the use case 'calculate if not given' can be done with the default value declaration |
18:08:34 | FromDiscord | <Phil> What is a calculation of a missing optional?↵Is this about calculating whether an optional is none? Or using optionals `map` operation? |
18:09:47 | FromDiscord | <Phil> Or given the line "calculate if not given" is this about extracting a value out of an optional, but getting a different value should the first one not be present? |
18:10:33 | FromDiscord | <domosokrat> It's about optional function parameters. Not about the type Option[T]. |
18:10:35 | FromDiscord | <aruZeta> I was asking if there was a way, like in LISP, to know if an optional param of a proc has been provided or not |
18:11:16 | FromDiscord | <Phil> OHHH that makes so much more sense. I was so confused |
18:11:36 | FromDiscord | <Phil> Particularly because leorize mentioned Optionals I was fully trying to parse that in that context |
18:11:49 | FromDiscord | <aruZeta> Thing is, to use Option[T] I need to pass the params using `some()` |
18:12:01 | FromDiscord | <Phil> Which is painful, aye |
18:12:07 | FromDiscord | <aruZeta> that's it |
18:12:09 | FromDiscord | <Phil> You can get around this with helper procs surrounding your original proc |
18:12:27 | FromDiscord | <Phil> One with the parameter, one without the parameter, both calling your proc with the optional, one with none, the other with some |
18:12:49 | FromDiscord | <aruZeta> too much helper procs lol |
18:12:54 | FromDiscord | <Phil> And then you keep the one with the optional parameter private |
18:13:00 | FromDiscord | <Phil> (edit) "optional" => "Option" |
18:13:15 | FromDiscord | <leorize> I wonder if you can get away with `t: T | void` |
18:13:57 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47CI |
18:14:06 | FromDiscord | <leorize> unless you really want caller to dynamically pass in a `None`, `Option[T]` is a pain to use |
18:14:06 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47CJ |
18:14:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47CK |
18:14:15 | FromDiscord | <aruZeta> oops |
18:14:29 | FromDiscord | <aruZeta> (edit) "oops ... " added "(wrong error code)" |
18:14:30 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=47CJ" => "https://play.nim-lang.org/#ix=47CL" |
18:15:09 | FromDiscord | <huantian> You probably should just use overloading |
18:15:38 | FromDiscord | <Phil> I use overloading a fair amount so that's also the route I'd go |
18:15:52 | FromDiscord | <aruZeta> ik, its just a pain tho |
18:15:54 | FromDiscord | <Phil> overloading + default parameters covered all my needs so far |
18:16:24 | FromDiscord | <aruZeta> the proc has, 1 parameter, 2 optional and 1 with default value |
18:17:46 | FromDiscord | <Phil> Without having seen any code my first thought would be that that's a hint to go for overloads and multiple procs rather than single procs that have "flag" values that change behaviour |
18:18:25 | FromDiscord | <aruZeta> yh, I will try some stuff and see how it goes |
18:18:31 | FromDiscord | <Phil> Check |
18:20:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47CN |
18:20:38 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47CO |
18:20:50 | FromDiscord | <aruZeta> just curiosity |
18:21:39 | FromDiscord | <Phil> You give the compiler a proc where you say "bar can be int or of type Nothing, but my output must be int" |
18:21:57 | FromDiscord | <aruZeta> yep |
18:21:58 | FromDiscord | <Phil> The compiler then sees that you have result = bar, which can be int OR NOTHING.↵And that's not allowed |
18:22:31 | FromDiscord | <aruZeta> i guessed that, but since i'm discarding it being Nothing with the if, i thought it might work |
18:22:45 | FromDiscord | <Phil> Your trail of thought works if you do this at compile time with when |
18:22:52 | FromDiscord | <aruZeta> yh |
18:23:07 | FromDiscord | <Phil> When will lead to that piece of code getting actually removed |
18:23:38 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=47CP |
18:23:43 | FromDiscord | <huantian> Oh phil already said they |
18:23:45 | FromDiscord | <Phil> ~~Which may lead to you having completely invalid nonsense in a where clause and you'll never know unless some piece of code triggers that right when clause so that that code appears one time to get compiled |
18:23:46 | FromDiscord | <huantian> (edit) "they" => "that" |
18:23:48 | FromDiscord | <Phil> (edit) "compiled" => "compiled~~" |
18:24:01 | FromDiscord | <Phil> (edit) "where" => "when" |
18:24:25 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=47CP" => "https://play.nim-lang.org/#ix=47CQ" |
18:27:16 | FromDiscord | <aruZeta> welp, for the moment I will use the when |
18:27:46 | FromDiscord | <aruZeta> and when the code explodes or whatever I will think of another way lol |
18:28:29 | FromDiscord | <Phil> If your code explodes that's most likely not an issue with the when statement (as long as your check is with values you know at compile-time), and more likely that you have bogus code within a when statement and just never noticed because it never got compiled 😛 |
18:29:34 | FromDiscord | <aruZeta> the code used in the when can be perfectly run at compiletime, so it should not be a problem |
18:30:05 | FromDiscord | <aruZeta> and the tests show all [OK] so, no problem |
18:30:10 | FromDiscord | <aruZeta> (edit) "[OK] so," => "[OK], so" |
18:33:36 | * | kenran joined #nim |
19:25:45 | FromDiscord | <fwsgonzo> Does anyone know the status of incremental builds in Nim? |
19:26:04 | FromDiscord | <fwsgonzo> (edit) "Does anyone know the status of incremental builds in Nim? ... " added "And what will it look like?" |
19:27:12 | FromDiscord | <huantian> I think it is currently broken 😛 iirc it was planned for 1.6 but I’m not sure if it’ll even be ready for 2.0↵But I haven’t been keeping up with it myself |
19:27:44 | FromDiscord | <fwsgonzo> Currently I'm having some issues with ninja-ifying Nim builds because the nimcache of each program is always just a tiny bit different between programs. So far I have managed to parallelize the call to Nim itself as well as the building of the C sources (obviously). |
19:28:35 | FromDiscord | <fwsgonzo> Honestly, the best change would be if several programs could share nimcache in a way where tiny changes are appended, combined with linker GC to remove unused functions |
19:41:40 | FromDiscord | <victory> whats a good mongo package for nim? |
19:42:03 | FromDiscord | <Phil> Can't say I've used one, have you looked in the nimble directory yet? |
19:42:19 | FromDiscord | <victory> i have but nimongo seems to be 2 yrs old |
19:42:23 | FromDiscord | <victory> (last update) |
19:42:33 | FromDiscord | <victory> ill check out another pkg i saw |
20:09:44 | FromDiscord | <haxscramper> burndown of the `.nim` files in the repository https://media.discordapp.net/attachments/371759389889003532/1008467483864342708/unknown.png |
20:09:55 | FromDiscord | <haxscramper> compiler |
20:11:49 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47Db |
20:13:09 | FromDiscord | <aruZeta> can easily be solved by adding a `result = low(SomeRangeType)` |
20:13:19 | FromDiscord | <aruZeta> (edit) |
20:14:49 | FromDiscord | <aruZeta> (edit) "tho it can easily be solved by adding a `result = low(SomeRangeType)` ... " added "before the raise" |
20:15:51 | FromDiscord | <Elegantbeef> What's the point of nothing here why isnt `proc foo(bar = 0): int` sufficient?↵(@aruZeta) |
20:16:41 | FromDiscord | <huantian> I’d assume they just used 0 in this example and have some runtime value instead of it there |
20:17:01 | FromDiscord | <aruZeta> In reply to @Elegantbeef "What's the point of": that was from when I was trying to have optional params and know if the user specified them or not |
20:17:19 | FromDiscord | <Elegantbeef> Ranges are 0 init'd so that warning is beneficial |
20:17:33 | FromDiscord | <Elegantbeef> !eval var a\: 1..1; echo a |
20:17:35 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: ':' or '=' expected, but got '1' |
20:17:49 | FromDiscord | <Elegantbeef> The hell |
20:18:08 | FromDiscord | <aruZeta> !eval var a = 1..1; echo a |
20:18:10 | NimBot | 1 .. 1 |
20:18:11 | FromDiscord | <huantian> It should be probable that the result default isn’t used |
20:18:21 | FromDiscord | <Elegantbeef> No `=` makes it a slice |
20:19:06 | FromDiscord | <Elegantbeef> !eval (var a\: 1..1; echo a) |
20:19:08 | NimBot | Compile failed: /usercode/in.nim(1, 10) Error: ':' or '=' expected, but got '1' |
20:19:10 | FromDiscord | <Elegantbeef> If that doesnt work i give up |
20:19:12 | FromDiscord | <aruZeta> !eval var a: range[1..1]; echo a |
20:19:15 | NimBot | 0 |
20:19:19 | FromDiscord | <aruZeta> that? |
20:19:31 | FromDiscord | <Elegantbeef> No what i had is right it's the bot being dumb |
20:19:35 | FromDiscord | <aruZeta> lol |
20:19:48 | FromDiscord | <Elegantbeef> But yes |
20:19:55 | FromDiscord | <Elegantbeef> That warning is to prevent that |
20:19:56 | FromDiscord | <aruZeta> seems to be the same tho |
20:20:25 | FromDiscord | <aruZeta> yh, what I meant is that I am raising an exception anyways, so no result will be passed from the proc |
20:20:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47Dd |
20:21:08 | FromDiscord | <aruZeta> (edit) "passed" => "returned" |
20:21:30 | FromDiscord | <fwsgonzo> Is the `attribute((retain))` available in Nim? |
20:21:58 | FromDiscord | <aruZeta> is that from python maybe? |
20:22:36 | FromDiscord | <fwsgonzo> it's fairly new in binutils 2.36 and later |
20:22:49 | FromDiscord | <fwsgonzo> https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html >> retain |
20:23:10 | FromDiscord | <aruZeta> ahh, my bad |
20:23:27 | FromDiscord | <aruZeta> (edit) "bad" => "bad, idk sry" |
20:24:32 | FromDiscord | <Elegantbeef> The reason the warning exists is purely to say "This range value may not be assigned which may result in a incorrect value |
20:24:33 | FromDiscord | <Elegantbeef> Atleast i think that's the reason |
20:24:33 | FromDiscord | <Elegantbeef> Anyway you can always make an issue if you think it is a bug |
20:26:19 | FromDiscord | <Elegantbeef> You can usue codegendecl to get any attribute applied |
20:30:20 | FromDiscord | <fwsgonzo> how can I add the `used` and `retain` attribute to Nim codebase? |
20:30:30 | FromDiscord | <fwsgonzo> (edit) "attribute" => "attributes" | "attributesto ... Nim" added "functions in the" |
20:30:37 | FromDiscord | <Elegantbeef> I told you how |
20:30:42 | FromDiscord | <Elegantbeef> You use `codegendecl` |
20:31:04 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma |
20:31:15 | FromDiscord | <Elegantbeef> Make me do all your searching for you aswell |
20:31:58 | FromDiscord | <fwsgonzo> I'm looking to add these as function attributes in the Nim codebase |
20:32:04 | NimEventer | New thread by Polarian: Nimble decentralisation?, see https://forum.nim-lang.org/t/9370 |
20:33:06 | FromDiscord | <fwsgonzo> I see something called `procPragmas` in pragmas.nim |
20:33:55 | FromDiscord | <Elegantbeef> Ok so we're just going to ignore me |
20:34:04 | NimEventer | New thread by Polarian: Alternative to gravatar for the forums?, see https://forum.nim-lang.org/t/9371 |
20:34:37 | * | kenran quit (Quit: WeeChat info:version) |
20:34:46 | FromDiscord | <fwsgonzo> hardly, I just don't think it's as nice as having those in the language |
20:34:52 | FromDiscord | <Elegantbeef> What? |
20:35:13 | FromDiscord | <Elegantbeef> You can use a macro to annotate custom attributes using codegendecl |
20:35:33 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge/exporter.nim for instance |
20:36:00 | FromDiscord | <Elegantbeef> It adds `EMSCRIPTEN_KEEPALIVE` to procedures when you annotate them with `{.wasmExport.}` |
20:36:19 | FromDiscord | <fwsgonzo> ok, it is nice 🙂 |
20:36:56 | FromDiscord | <Elegantbeef> You reasonable could make a macro which takes an array of strings to add attributes |
20:47:43 | FromDiscord | <Bubblie> hi beef! I think I got it working now! |
20:47:46 | FromDiscord | <Bubblie> Im not sure what I did but it works |
20:48:53 | FromDiscord | <Elegantbeef> Ok |
20:48:53 | FromDiscord | <Elegantbeef> Scary |
20:50:33 | FromDiscord | <Bubblie> cstring and cstringarrays are the absolute bane of my existence |
20:50:40 | FromDiscord | <Elegantbeef> Welcome to why C sucks |
20:51:18 | FromDiscord | <Bubblie> yes 😭 |
20:53:16 | FromDiscord | <Bubblie> this isn't even the beginning, it gets way more unsafe from here |
20:54:54 | FromDiscord | <Elegantbeef> I know opengl uses cstring arrays but they're not nil terminated ones |
20:55:01 | FromDiscord | <Elegantbeef> So it's much much nicer to use |
20:55:31 | FromDiscord | <Elegantbeef> Only assholes use nil terminated arrays |
20:57:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47Di |
20:58:29 | FromDiscord | <mratsim> In reply to @Elegantbeef "It's literally the exact": I remember seeing the reason in a fun old stuff trivia about 16-bit machines |
20:58:46 | FromDiscord | <Elegantbeef> Yea it probably made sense in the past but not much to me now |
20:58:58 | FromDiscord | <mratsim> it was cheaper to check for the character than having the length take up a register or something |
20:59:18 | FromDiscord | <Elegantbeef> This isnt for null terminated strings though |
20:59:35 | FromDiscord | <Elegantbeef> This is null terminated arrays, where you have `ptr T` contiguously |
20:59:41 | FromDiscord | <Elegantbeef> Then the last element of it is a `nil` |
21:00:27 | FromDiscord | <Rainbow Asteroids> what if i have an array of bytes? then your len takes up four of my precious bytes. you're eating away my 16GB of ram! |
21:00:34 | FromDiscord | <Elegantbeef> sorry that should've been `T: ptr` |
21:01:04 | FromDiscord | <Elegantbeef> Yea rainbow except like i forgot to mention that's `T: ptr` |
21:01:10 | FromDiscord | <Elegantbeef> So it's identical memory consumption |
21:01:17 | FromDiscord | <Rainbow Asteroids> yeah i just realized that |
21:01:21 | FromDiscord | <Elegantbeef> Also you wouldnt use a nil terminated array for bytes unless you were a sadist |
21:01:40 | FromDiscord | <Elegantbeef> Maybe another sentinel value but `0` is relatively common |
21:01:41 | FromDiscord | <Rainbow Asteroids> two zeros = 1 zero. 1 zero = end |
21:02:40 | FromDiscord | <Elegantbeef> I'll just blame C for this existing and carry on |
21:11:35 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:41:50 | FromDiscord | <Bubblie> In reply to @Elegantbeef "So it's much much": vulkan is a pain in the ass to setup but once its setup its actually incredibly easy |
21:42:13 | FromDiscord | <Bubblie> its why I like it, its just a painful process to setup since vulkan is a such a lowlevel API and is more of a DIY rather than it already being done for you |
21:42:14 | FromDiscord | <Bubblie> like opengl |
21:44:55 | FromDiscord | <Tuatarian> how would I write a custom destructor for this proc? |
21:45:05 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47Du |
21:45:05 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
21:46:31 | FromDiscord | <Tuatarian> (edit) "proc?" => "type?" |
21:56:16 | FromDiscord | <Elegantbeef> `stderr.writeLine "validation layer: " & pcallbackData.pMessage` |
21:56:26 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=47Dx |
21:56:46 | FromDiscord | <Bubblie> In reply to @Elegantbeef "`stderr.writeLine "validation layer: "": Thanks! |
21:56:52 | FromDiscord | <Bubblie> I didnt know nim had stderr |
21:56:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47Dy |
21:56:54 | FromDiscord | <Bubblie> Thats cool |
21:57:14 | FromDiscord | <Elegantbeef> Probably want to follow with a flushfile |
21:57:28 | FromDiscord | <exelotl> In reply to @exelotl "<@284835054633353226> you'd have to": it's not clear to me why you'd want to though, unless there's something fancy in `Board` thar requires manual acknowledgement when the node is destroyed... |
21:59:11 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47Dz |
21:59:16 | FromDiscord | <Elegantbeef> Where would it |
21:59:26 | FromDiscord | <Elegantbeef> types in nim are static |
22:01:02 | FromDiscord | <Elegantbeef> It'ssemantically identiical to exelotl's |
22:01:17 | FromDiscord | <Elegantbeef> The only difference is I didnt introduce a name for the ref internal type |
22:06:19 | FromDiscord | <exelotl> ref types are automatically deallocated when there are zero references to them |
22:06:34 | FromDiscord | <Elegantbeef> I misread dealloc for deref |
22:07:06 | FromDiscord | <Elegantbeef> You should call `=destroy` on all of the objects fields though |
22:07:40 | FromDiscord | <Tuatarian> what is `mcNode()[]` doing? |
22:07:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47DC |
22:07:51 | FromDiscord | <Elegantbeef> Getting the type of the internal object |
22:08:00 | FromDiscord | <Tuatarian> it wouldn't just be McNode? |
22:08:00 | FromDiscord | <Elegantbeef> `ref object` is syntax sugar for what exelotl posted |
22:08:11 | FromDiscord | <Elegantbeef> No cause we're instantiation a `McNode` then dereferencing it |
22:08:22 | FromDiscord | <Elegantbeef> The type of that is actualy data and not a reference |
22:08:33 | FromDiscord | <Elegantbeef> `McNode` is a reference so if you dereference it you get it's internal type, a struct |
22:08:48 | FromDiscord | <Tuatarian> oh I see |
22:15:46 | FromDiscord | <Elegantbeef> It'd be nice if that dereference wasn needed but alas |
22:48:01 | * | derpydoo joined #nim |
22:55:56 | FromDiscord | <Vivek> how would I do proc overloading in nim? I've been trying to make a `sigmoid` function that can take in either floats or seq[floats] to use in python and it only detects the function that uses seq[float]. For reference, I made two different sigmoid functions: one for floats and the other for seq[floats] |
22:57:02 | FromDiscord | <Vivek> I also tried doing something along the lines of `sigmoid[T: float | seq[float]](z: T) ...` to no avail |
22:57:40 | FromDiscord | <SaAnd> what was the error? |
23:02:48 | FromDiscord | <Rainbow Asteroids> why can't you use a varadic function? |
23:43:57 | * | jmdaemon joined #nim |
23:58:39 | FromDiscord | <victory> how can i check if something doesnt exist? |
23:58:45 | FromDiscord | <victory> like if a string is nil and not an actual string |
23:58:50 | FromDiscord | <victory> how can i check that in an `if` statement? |
23:58:54 | FromDiscord | <Elegantbeef> Strings are not nilable |
23:59:02 | FromDiscord | <Elegantbeef> `myStr.len == 0` |
23:59:13 | FromDiscord | <victory> so if its an Option[string] then |
23:59:17 | FromDiscord | <victory> and theres no value |
23:59:19 | FromDiscord | <victory> itll be length 0? |
23:59:23 | FromDiscord | <Elegantbeef> `str.isSome` |
23:59:35 | FromDiscord | <victory> thanks! |