00:00:47 | Prestige | Seems like copying all those events is the problem but I'm not sure. All I've really done is move the loop to another thread, nothing else has changed |
00:01:03 | PMunch | How big are the events? |
00:01:15 | FromDiscord | <XxDiCaprioxX> In reply to @PMunch "<@376323735747035148> no worries, Nim": while we're at it actually, i have an issue where there could be 2 points of failure but I reckon only one of the is the culprit. is there a way to print out the content of a seq? |
00:01:35 | PMunch | `echo mySeq`? |
00:01:54 | FromDiscord | <XxDiCaprioxX> but what if the content is a new type that inherits from object? |
00:01:56 | Prestige | PMunch: pretty big I think, if you look at the structure of an XEvent |
00:01:57 | FromDiscord | <XxDiCaprioxX> does it still work? |
00:02:20 | PMunch | As long as the type has a `$` proc defined for it you can echo a seq of anything |
00:02:40 | FromDiscord | <XxDiCaprioxX> how do I do that |
00:03:10 | FromDiscord | <XxDiCaprioxX> do I even need to do anything for it to work? |
00:03:13 | PMunch | Define a proc? |
00:03:23 | Prestige | https://github.com/nim-lang/x11/blob/master/x11/xlib.nim PMunch line 761 |
00:03:34 | FromDiscord | <XxDiCaprioxX> define a $ proc |
00:03:47 | FromDiscord | <XxDiCaprioxX> wait ima come to irc |
00:04:12 | PMunch | proc `$`(x: MyType): string |
00:04:28 | FromDiscord | <XxDiCaprioxX> oh okay thanks |
00:04:46 | PMunch | Prestige, hmm, yeah those look a bit chunky.. |
00:04:57 | FromDiscord | <ElegantBeef> Also pmunch the set invert name ended up being `complement` due to an issue with people not wanting the not operator |
00:04:58 | PMunch | Oh wait, that's a `union` type |
00:05:22 | PMunch | @ElegantBeef, ah good to know |
00:05:22 | * | Vladar quit (Quit: Leaving) |
00:06:11 | PMunch | It's 96 bytes |
00:06:42 | FromDiscord | <XxDiCaprioxX> In reply to @PMunch "proc `$`(x: MyType): string": ummmm vs code tells me "identifier expected but got '$'" |
00:07:18 | PMunch | Come to IRC :P |
00:07:29 | PMunch | That's meant to be actual backticks around the $ |
00:07:34 | Prestige | If I could just use a PXEvent, I think it would solve the issue. But for some reason nothing works when I do that. I'll look into debugging it |
00:08:06 | FromDiscord | <XxDiCaprioxX> In reply to @PMunch "Come to IRC :P": just a sec, small technical issue xD |
00:09:00 | PMunch | Prestige, hmm, how are PXEvents freed? |
00:09:03 | FromDiscord | <XxDiCaprioxX> it says I cannot connect to irc.freecode.net |
00:09:21 | FromDiscord | <XxDiCaprioxX> maybe I have the wrong port |
00:09:42 | PMunch | Or the wrong URL |
00:09:47 | PMunch | It's freenode, not code |
00:10:06 | FromDiscord | <XxDiCaprioxX> i said code that was just a typo here haha |
00:10:10 | FromDiscord | <neow> (sorry to interrupt the ongoing convo) does anyone know if there is any reason why the nim's posix library does not include const SIGWINCH = 28'u32? |
00:10:31 | Prestige | No idea PMunch |
00:10:37 | * | asdflkj_1 joined #nim |
00:10:41 | * | XxDiCaprioxX joined #nim |
00:10:48 | XxDiCaprioxX | aight I'm here |
00:11:00 | PMunch | proc `$`(x: MyType): string |
00:11:13 | Prestige | I can share the code with you when I'm back in like 20 mins, I stepped out of the house a bit ago |
00:11:38 | FromDiscord | <neow> (edit) "28'u32?" => "28'i32?" |
00:11:49 | XxDiCaprioxX | so I typed what you put there and somehow I have 12 error messages |
00:11:57 | XxDiCaprioxX | what do I put in the body of the proc? |
00:12:19 | PMunch | @neow, wild guess is that it isn't available on all platforms |
00:12:29 | PMunch | But it might just have never been added |
00:12:52 | PMunch | XxDiCaprioxX, something that converts your type to a string |
00:13:00 | FromDiscord | <neow> I think I will open a gh issue, at worst someone will point out a good reason |
00:13:03 | PMunch | I mean you could do `repr(x)` |
00:13:19 | XxDiCaprioxX | is that repr(x) related to me? |
00:13:25 | PMunch | Yes |
00:13:55 | XxDiCaprioxX | expression 'proc () =' is of type 'proc ()' and has to be used (or discarded); for a function call use () |
00:13:59 | XxDiCaprioxX | thats what it tells me |
00:14:29 | XxDiCaprioxX | as an error |
00:16:00 | XxDiCaprioxX | I think I'm going to sleep and try more tomorrow. Thank you for your help! |
00:16:15 | PMunch | Wait, you have to name it |
00:16:31 | PMunch | proc `$`(x: MyProc): string = repr(x) |
00:16:38 | PMunch | That should be all you need |
00:16:54 | PMunch | And then `echo mySeq` |
00:17:01 | PMunch | s/MyProc/MyType |
00:17:08 | XxDiCaprioxX | proc '$'(x: Card): string = repr(x) |
00:17:30 | XxDiCaprioxX | should I use ` instead of ' ?? |
00:17:44 | XxDiCaprioxX | appearantly yes |
00:17:46 | XxDiCaprioxX | fixed it |
00:18:30 | XxDiCaprioxX | thanks a lot, I should get it to work now! |
00:19:05 | XxDiCaprioxX | bbye |
00:19:07 | * | XxDiCaprioxX quit (Quit: Going offline, see ya! (www.adiirc.com)) |
00:28:01 | Prestige | PMunch: you willing to take a look in a few mins? Would be easiest to voice chat this, even though it's not much code |
00:28:09 | * | joast quit (Quit: Leaving.) |
00:28:55 | PMunch | Sure, but it's pretty late so I'm not entirely sure how useful I'll be :P |
00:29:22 | Prestige | That's fine, I think an extra set of eyes would help in general |
00:35:48 | PMunch | Hmm, this means I need to figure out Discord again |
00:35:50 | PMunch | Give me a sec |
00:36:38 | * | D_ quit (Ping timeout: 264 seconds) |
00:36:43 | * | joast joined #nim |
00:37:06 | PMunch | I think I'm calling you? |
00:37:17 | Prestige | I had to make a new acc, you have to add me again |
00:37:29 | Prestige | discord kept locking me out I think I'm on account #5 lol |
00:38:11 | Prestige | I sent you my id |
01:11:38 | FromDiscord | <Yjuq> Does someone know how I create a hyperlink with docgen? You can document your code with doc comments right? And `nim doc` creates you the html files. How do I link from one description to another procedure / function? |
01:17:56 | FromDiscord | <ElegantBeef> @Yjuq an example from monotimes https://github.com/nim-lang/Nim/blob/version-1-4/lib/std/monotimes.nim#L35 |
01:19:27 | FromDiscord | <ElegantBeef> You should be able to put a full http link in there aswell since it's just RST styling afaik |
01:19:51 | FromDiscord | <Yjuq> But,... I want to link to something in the same document x) |
01:20:43 | FromDiscord | <ElegantBeef> Ah probably can do `#id` or `module.html#id` |
01:21:46 | FromDiscord | <flywind> see https://github.com/nim-lang/Nim/blob/540d16540b91d8245aaaf0785e47233e91f22d5d/lib/pure/strutils.nim#L174 |
01:22:14 | FromDiscord | <ElegantBeef> Ah it's even smarter than i thought! |
01:22:37 | FromDiscord | <Yjuq> thanks, this is more what i was looking for |
01:23:33 | FromDiscord | <Yjuq> But yea, nim seems to fits for me. I think I can start my project in it now. I decided :D |
01:23:55 | FromDiscord | <Yjuq> played the last days with this language around |
01:24:19 | FromDiscord | <ElegantBeef> Yay! |
01:24:35 | FromDiscord | <Yjuq> yea, the planning phase already took me 2 years rofl |
01:24:45 | FromDiscord | <Yjuq> x) |
01:26:16 | * | lritter quit (Ping timeout: 240 seconds) |
01:29:21 | * | asdflkj_1 quit (Ping timeout: 264 seconds) |
01:52:17 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:52:41 | * | njoseph joined #nim |
02:30:10 | FromDiscord | <ajusa> Is there a less awkward way of getting all of the group matches for a regex in Nim? (I learned regex 30 minutes ago, not an expert). For example, if I have a regex with one capture group, and I want to get a `seq[string]` that contains only the stuff in the capture group, not the entire match. |
02:31:56 | FromDiscord | <ajusa> (edit) "match." => "match (`findAll` seems to return the entire match)." |
02:57:10 | * | matthew_RetroEdg joined #nim |
03:03:06 | * | PMunch quit (Remote host closed the connection) |
03:22:10 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q9l |
03:22:14 | FromDiscord | <Yjuq> ah |
03:22:15 | FromDiscord | <Yjuq> nvm |
03:22:18 | FromDiscord | <Yjuq> i see what you mean |
03:22:46 | FromDiscord | <Yjuq> uhh - let me crawl the docu for the pcre flags |
03:23:24 | FromDiscord | <ajusa> Yeah, I want the seq lol, test, more. Sorry that wasn't super clear |
03:44:45 | * | retroedgetech[m] joined #nim |
04:00:59 | FromDiscord | <will codes stuff> sent a code paste, see https://play.nim-lang.org/#ix=2Q9x |
04:01:48 | FromDiscord | <ElegantBeef> Object variants? https://nim-lang.org/docs/manual.html#types-object-variants |
04:03:10 | FromDiscord | <ElegantBeef> I am working on a DSL atm to make it nicer |
04:03:27 | FromDiscord | <ElegantBeef> Though i think some already exist |
04:03:40 | FromDiscord | <will codes stuff> im looking for storing a value inside of a type in a enum |
04:03:47 | FromDiscord | <ElegantBeef> Yea |
04:03:58 | FromDiscord | <Yjuq> In reply to @ajusa "Is there a less": Can't find anything in the system modules for this. Either you write your own procedure to do this or look online if there is another library around what does it easily. Otherwise you need to strip your findings more down until you are satisfied. :/ |
04:04:17 | * | matthew_RetroEdg quit (Quit: Leaving) |
04:04:35 | FromDiscord | <flywind> see https://nim-by-example.github.io/types/enums/ |
04:04:59 | FromDiscord | <will codes stuff> that has a set value are you able to set a different value? |
04:05:07 | FromDiscord | <ElegantBeef> That has a constant |
04:05:10 | FromDiscord | <will codes stuff> I would like to have a enum with a recursive type |
04:05:12 | FromDiscord | <ElegantBeef> https://github.com/andreaferretti/patty#constructing-variant-objects |
04:05:18 | FromDiscord | <ElegantBeef> You need an object variant for that |
04:05:43 | FromDiscord | <ElegantBeef> Multiple packages make the syntax a bit nicer |
04:06:15 | FromDiscord | <ElegantBeef> I assume you're after the same sorta thing as rust enums, which are just an abstraction of object variants |
04:06:34 | FromDiscord | <will codes stuff> yeah I guess im just not used to the object variants syntax |
04:06:40 | FromDiscord | <will codes stuff> I didnt realize what it was doing |
04:06:59 | FromDiscord | <ElegantBeef> My in process DSL https://media.discordapp.net/attachments/371759389889003532/812898133960556554/unknown.png |
04:07:18 | FromDiscord | <ElegantBeef> Emits the enums for you and everything, but more clear imo |
04:07:45 | FromDiscord | <ajusa> In reply to @Yjuq "Can't find anything in": Thanks for taking a look! I found a regex library called "regex" written in nim, that seems to have a better API than the standard library |
04:08:29 | FromDiscord | <Yjuq> In reply to @ajusa "Thanks for taking a": I didn't use regex in in nim yet. I'm actually surprised that nim doesn't offer this since this is something common |
04:08:47 | FromDiscord | <Yjuq> or i'm blind |
04:09:01 | FromDiscord | <ajusa> Well I asked here since I assumed I was blind |
04:09:08 | FromDiscord | <ElegantBeef> Isnt it apart of regex syntax to select inside a pattern? |
04:09:48 | FromDiscord | <Yjuq> He want the captured groups as sequence, not the complete global matches |
04:10:09 | FromDiscord | <ElegantBeef> I have 0 clue what that means |
04:10:16 | FromDiscord | <ElegantBeef> the range instead of the values? |
04:10:21 | * | theelous3 quit (Read error: Connection reset by peer) |
04:10:28 | FromDiscord | <ajusa> In reply to @Yjuq "Not sure what you": See this example |
04:10:50 | FromDiscord | <Yjuq> It outputs the global matches, but he want the stuff between the ones |
04:11:19 | FromDiscord | <ElegantBeef> ok so `@["lol", "test"...]`? |
04:11:24 | FromDiscord | <Yjuq> Yes |
04:11:24 | FromDiscord | <ajusa> Yes |
04:11:42 | FromDiscord | <will codes stuff> In reply to @ElegantBeef "Emits the enums for": thanks for the help |
04:18:04 | FromDiscord | <ElegantBeef> @ajusa what's the data you're parsing/regex pattern? |
04:18:47 | FromDiscord | <will codes stuff> I am getting undeclared identifier for variant |
04:18:53 | FromDiscord | <ElegantBeef> Well yea |
04:19:02 | FromDiscord | <ElegantBeef> It's not apart of the language it's my own dsl |
04:19:17 | FromDiscord | <will codes stuff> ah |
04:19:29 | FromDiscord | <ElegantBeef> And same with `patty`'s |
04:19:52 | FromDiscord | <will codes stuff> I guess I will install patty |
04:20:06 | FromDiscord | <ElegantBeef> Well you can just use Nim's normal syntax |
04:20:31 | FromDiscord | <ElegantBeef> I was just suggesting patty if you dislike nim's default |
04:20:38 | FromDiscord | <Yjuq> In reply to @ElegantBeef "<@!102899813149855744> what's the data": This shouldn't matter - the question was about regex. That you can get the results otherwise with other string procedures should be clear. He asked for a nice way of doing it without invoking other stuff. The standard libraries doesn't offer this for regex or I'm blind. :x |
04:21:32 | FromDiscord | <will codes stuff> oh you still cant have recursive types in patty |
04:21:37 | FromDiscord | <ElegantBeef> I mean depending on the data and what they're parsing there might be better ways, but atm the best seems to be using regex then doing `res[i][1..^1]` assuming it's like your s |
04:22:16 | FromDiscord | <Yjuq> ¯\_(ツ)_/¯ |
04:22:22 | FromDiscord | <ajusa> In reply to @ElegantBeef "<@!102899813149855744> what's the data": It's technically HTML, but I'm looking for a regex solution for the data in the html |
04:22:45 | FromDiscord | <ElegantBeef> To have recursive types you need to use `ref object` |
04:22:53 | FromDiscord | <ElegantBeef> So patty might not emit that, my planned DSL might |
04:23:52 | FromDiscord | <will codes stuff> seems to work now |
04:24:01 | FromDiscord | <will codes stuff> https://media.discordapp.net/attachments/371759389889003532/812902421390295070/Screen_Shot_2021-02-20_at_20.23.57.png |
04:24:11 | FromDiscord | <Yjuq> WOAH, this is a font size |
04:24:31 | FromDiscord | <will codes stuff> I normally am on a ultrawide but im just on my laptop right now so the font size seems big |
04:24:49 | FromDiscord | <ajusa> Pattern is `(\d+)\/(\d+)`, example input might be something like `stuff 5, 6 garbage string 7, 10 more stuff`. My desired output is something like group 1: `[5, 7]` and group 2: `[6, 10]`. |
04:26:07 | FromDiscord | <Yjuq> @ajusa - the simplest workaround would be to capture full regex first and then just again with just the group definition. In the most cases this will do the trick |
04:28:51 | FromDiscord | <ajusa> so I do a findAll, for each over that, pass it into another `match`, check the option using `get`, and then finally do `captures[0]`? |
04:31:21 | FromDiscord | <Yjuq> yea, kind of |
04:31:42 | FromDiscord | <Yjuq> I know, a sad solution |
04:31:48 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2Q9P |
04:32:01 | FromDiscord | <Yjuq> Yea, I don't like this either ^.^ |
04:32:55 | FromDiscord | <Yjuq> But you can just define a nice procedure and invoke this instead. :P |
04:32:56 | FromDiscord | <ajusa> yeah doing the match twice isn't performant, and having to repeat the pattern isn't great either but I'll take it. I do wish that the stdlib had a better version of this built in, you'd think this would be a common enough use case to warrant it |
04:33:03 | FromDiscord | <ajusa> In reply to @Yjuq "But you can just": true |
04:35:07 | * | spiderstew_ joined #nim |
04:37:51 | * | spiderstew quit (Ping timeout: 272 seconds) |
05:44:55 | ForumUpdaterBot | New thread by Jasonfi: Custom error messages for exceptions in Jester?, see https://forum.nim-lang.org/t/7542 |
06:15:01 | FromDiscord | <バロザード> uhhh |
06:15:06 | FromDiscord | <バロザード> how do i set up nim? |
06:15:08 | FromDiscord | <バロザード> i thinki fucked up |
06:19:25 | Prestige | choosenim is usually the easiest way |
06:19:45 | FromDiscord | <Yjuq> On which platform? |
06:20:04 | FromDiscord | <バロザード> windows |
06:20:15 | FromDiscord | <バロザード> i like installed the zip and it got added to path i think? |
06:20:18 | FromDiscord | <バロザード> but it didnt work |
06:20:37 | FromDiscord | <Yjuq> did you run the finish.exe? |
06:20:59 | FromDiscord | <Yjuq> technically you can set it up manually as well |
06:21:25 | FromDiscord | <バロザード> i did? |
06:21:30 | FromDiscord | <バロザード> i dont know why it doesnt work |
06:21:38 | FromDiscord | <Yjuq> doesn't work is pretty vague |
06:21:44 | FromDiscord | <Yjuq> what doesn't work exactly? |
06:21:47 | FromDiscord | <バロザード> welli did nim in terminal and nothing happens |
06:22:03 | FromDiscord | <バロザード> sent a code paste, see https://play.nim-lang.org/#ix=2Qan |
06:22:29 | FromDiscord | <Yjuq> I see - the bin folder is in your path environment variable? |
06:22:41 | FromDiscord | <バロザード> yep |
06:22:54 | FromDiscord | <Yjuq> did you restart the terminal? |
06:22:58 | FromDiscord | <Yjuq> after setting it? |
06:23:06 | FromDiscord | <バロザード> yep |
06:23:14 | FromDiscord | <Yjuq> try to reboot your pc in this case |
06:23:22 | FromDiscord | <Yjuq> if it still not working tell me |
06:23:27 | FromDiscord | <バロザード> uh ok |
06:24:42 | FromDiscord | <ElegantBeef> Windows path variable is a magic lie 😄 |
06:25:37 | FromDiscord | <Yjuq> Well ^.^ |
06:27:17 | FromDiscord | <バロザード> well it worked |
06:27:20 | FromDiscord | <バロザード> i dont know why |
06:27:22 | FromDiscord | <バロザード> but it did |
06:27:28 | FromDiscord | <Yjuq> good |
06:29:38 | FromDiscord | <Yjuq> Man, I used to work in tech support for a long time... Most issues could be solved with just restarting the system >.> |
06:48:24 | FromDiscord | <ElegantBeef> Windows path tends to need to the pc to restart to get it to reload |
06:53:07 | FromDiscord | <Yjuq> not always |
07:02:48 | * | muffindrake joined #nim |
07:15:27 | * | fosred joined #nim |
07:29:35 | FromDiscord | <Yardanico> I don't know if this was posted here yet - https://blogs.gentoo.org/mgorny/2021/02/19/the-modern-packagers-security-nightmare/ |
07:33:26 | * | beeswax joined #nim |
07:34:41 | beeswax | Hi, just checking out nim for the first time. Is there an easy way to parse an ISO8601 timestamp as part of a nim object using the json stdlib functions? |
07:37:14 | FromDiscord | <ElegantBeef> the `times` module mixed json should work |
07:40:30 | FromDiscord | <ElegantBeef> If you get the node, you should be able to just use https://nim-lang.org/docs/times.html#parsing-and-formatting-dates to do it, though i'm uncertain the proper method to implement it with the json aside from manually navigating the nodes for that object |
07:51:28 | * | narimiran joined #nim |
07:52:47 | * | narimiran quit (Client Quit) |
08:01:32 | beeswax | EleganBeef: thanks, that is what I thought. I hoped there would be an easy way to deserialize it using jsons `to` proc |
08:36:29 | * | zedeus joined #nim |
08:43:50 | * | fosred quit (Ping timeout: 260 seconds) |
08:57:09 | * | vicfred quit (Quit: Leaving) |
09:16:22 | * | haxscramper joined #nim |
09:16:44 | FromDiscord | <Ruggila> In reply to @Yardanico "I don't know if": sent a long message, see http://ix.io/2Qbd |
09:18:30 | * | krux02 joined #nim |
09:42:23 | FromDiscord | <Recruit_main707> wait, ccp uses nim? |
09:42:40 | FromDiscord | <Rika> ccp? |
09:42:58 | FromDiscord | <Recruit_main707> CCP games |
09:43:46 | FromDiscord | <Recruit_main707> i knew they used stackless python for example, but not nim |
09:44:45 | FromDiscord | <ElegantBeef> Where'd you see this? |
09:48:27 | FromGitter | <xflywind> https://stackshare.io/nim |
09:50:07 | FromDiscord | <Recruit_main707> yep there |
09:58:07 | * | krux02 quit (Remote host closed the connection) |
10:03:58 | FromDiscord | <dom96> Huh. Would be cool to hear from a CCP Games employee about what they use it for. |
10:05:00 | FromDiscord | <ElegantBeef> Dom time to flex your position and email them 😛 |
10:05:32 | FromDiscord | <ElegantBeef> "Dear CCP, what the fuck do you use Nim for? And.... you do know your name... right? |
10:05:34 | FromDiscord | <ElegantBeef> (edit) "right?" => "right?"" |
10:36:25 | haxscramper | How to parse conditionals in `.cfg` files (`@if openmp or mkl:`) using `std/[parsecfg]`? Do I need to reimplement parser logic from from compiler (along with almost all of the parsecfg), or there is an existing solution? |
10:41:36 | haxscramper | Just using `std/[parsecfg]` results in errors like "invalid token" and `@end` being recognized as `KeyValuePair` with empty value |
10:51:06 | FromDiscord | <dom96> @ElegantBeef hah, honestly I wouldn't be surprised if that info was false unfortunately |
10:51:19 | FromDiscord | <dom96> after all I assume just about anyone can add a company on that page |
10:54:56 | * | rinzlxr joined #nim |
11:01:16 | dv^_^9691 | I just tried and you need a matching company email |
11:26:27 | FromDiscord | <konsumlamm> In reply to @will codes stuff "I guess I will": note that there also is fusion/matching (<https://nim-lang.github.io/fusion/src/fusion/matching.html>) which also provides a pattern matching DSL, but supports most of the things patty doesn't, like matching constants/variables, nested matching, matching on seqs, ... (the fusion package is more or less an official extension to the stdlib) |
11:31:35 | * | oprypin_ is now known as oprypin |
11:38:45 | * | fosred joined #nim |
11:39:06 | * | fosred quit (Remote host closed the connection) |
11:43:01 | FromDiscord | <Rika> what js minifiers do people use that doesnt completely destroy nim's js output's functionality |
11:55:02 | FromDiscord | <Rika> nvm, i miswrote something |
12:02:26 | * | letto quit (Ping timeout: 240 seconds) |
12:02:34 | * | letto_ joined #nim |
12:03:05 | * | rinzlxr quit (Ping timeout: 240 seconds) |
12:03:42 | FromDiscord | <dom96> @Rika I use closure-compiler for Stardust |
12:03:53 | FromDiscord | <dom96> although I had to do some hacks to make it work lol |
12:04:09 | FromDiscord | <dom96> https://media.discordapp.net/attachments/371759389889003532/813018211779084309/unknown.png |
12:04:22 | FromDiscord | <dom96> that may be a bug that was fixed in latest nim though |
12:04:30 | * | rinzlxr joined #nim |
12:04:44 | FromDiscord | <Rika> i was using terser |
12:04:50 | FromDiscord | <dom96> also, I found out the hard way that running uglify on closure-compiler's output created subtly broken JS |
12:05:05 | FromDiscord | <Rika> lol js is broken itself 😛 |
12:07:11 | FromDiscord | <Rika> ill look into closure compiler, see if its smaller |
12:08:16 | FromDiscord | <carpal> how can I allocate on the heap value? https://media.discordapp.net/attachments/371759389889003532/813019253379956766/unknown.png |
12:08:48 | FromDiscord | <carpal> this should throws segmentation fault if used outside the scope, and I have to use it outside |
12:09:17 | FromDiscord | <Rika> what type is result.value? make it a ref if its a ptr |
12:09:23 | FromDiscord | <carpal> Toke |
12:09:24 | FromDiscord | <carpal> (edit) "Toke" => "Token" |
12:09:26 | FromDiscord | <carpal> (edit) "Token ... " added "= object" |
12:09:31 | FromDiscord | <carpal> not heap allocated |
12:09:31 | FromDiscord | <Rika> eeh |
12:09:41 | FromDiscord | <carpal> I need it on the stack please 😂 |
12:09:45 | FromDiscord | <carpal> but not in that case |
12:09:56 | FromDiscord | <Rika> then make result.value a ref Token |
12:10:01 | FromDiscord | <carpal> isn't there a way to do allocOnHeap(object).addr() ?' |
12:10:02 | FromDiscord | <carpal> (edit) "?'" => "?" |
12:10:03 | FromDiscord | <carpal> (edit) "allocOnHeap(object).addr() ?" => "allocOnHeap(object).addr()?" |
12:10:10 | FromDiscord | <Rika> eeh |
12:10:11 | FromDiscord | <carpal> In reply to @Rika "then make result.value a": no please, I need it on the stack |
12:10:20 | FromDiscord | <carpal> I prefer |
12:10:21 | FromDiscord | <Rika> what do you mean then |
12:10:35 | FromDiscord | <Rika> i dont understand which needs to be on the stack and which on the heap |
12:11:25 | FromDiscord | <carpal> okay, Token is always allocated on the stack |
12:11:44 | FromDiscord | <carpal> but in this case I need it on the heap to get a pointer and use it in Node: value: pointer |
12:11:54 | FromDiscord | <carpal> (edit) "Node:" => "Node = object" |
12:14:06 | FromDiscord | <carpal> should I ask on the forum? |
12:14:10 | FromDiscord | <Rika> is result.value heap or stack |
12:14:26 | FromDiscord | <Rika> if heap, make it ref Token |
12:14:39 | FromDiscord | <carpal> In reply to @Rika "is result.value heap or": stack |
12:15:01 | FromDiscord | <carpal> result.value is 'pointer' type |
12:15:06 | FromDiscord | <Rika> okay, then what is the heap allocation you need? |
12:15:33 | FromDiscord | <Rika> you cannot put a ptr to a stack var there, it will die after scope |
12:16:06 | FromDiscord | <carpal> it is for that I asked for help lol |
12:16:20 | FromDiscord | <carpal> I already said it up in the chat |
12:16:45 | FromDiscord | <mratsim> (ref Foo)(foo)? |
12:17:38 | FromDiscord | <Rika> In reply to @carpal "result.value is 'pointer' type": and what ive been saying is to make that a ref Token isntead of a pointer |
12:17:43 | FromDiscord | <carpal> some week ago I wrote a dynamic object, maybe |
12:17:47 | FromDiscord | <carpal> (edit) "some week ago I wrote a dynamic object, maybe ... " added "I could use it" |
12:18:06 | FromDiscord | <carpal> In reply to @Rika "and what ive been": no, it can be also other things |
12:18:13 | FromDiscord | <carpal> like BlockNode |
12:18:20 | FromDiscord | <carpal> it is an ast lol |
12:18:23 | FromDiscord | <Rika> then use alloc |
12:18:41 | FromDiscord | <Rika> one moment |
12:19:10 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#alloc.t%2CNatural |
12:19:15 | FromDiscord | <Rika> if you need it to be a void ptr |
12:19:48 | FromDiscord | <Rika> alloc is equiv. malloc, alloc0 is equiv. calloc |
12:20:01 | FromDiscord | <carpal> don't worry I'll use my dynamic object |
12:20:15 | FromDiscord | <carpal> it provides methods already written to manage a pointer |
12:20:31 | FromDiscord | <Rika> if it works it works |
12:20:34 | FromDiscord | <carpal> if I use alloc I have to rewrite all |
12:20:43 | FromDiscord | <mratsim> For an AST I think everything should be ref no? As much as I prefer plain values, value semantics just fail as soon as you need unique symbols. |
12:21:05 | FromDiscord | <carpal> I prefer allocate on the stack |
12:21:32 | FromDiscord | <mratsim> Me too |
12:21:47 | FromDiscord | <carpal> my dynamic object keeps it on the stack |
12:23:42 | FromDiscord | <Rika> or does it |
12:42:48 | ForumUpdaterBot | New question by arctic_clerk: Nim counting over multiple threads, see https://stackoverflow.com/questions/66302396/nim-counting-over-multiple-threads |
13:03:00 | FromDiscord | <Clyybber> @carpal If your object is already on the stack and you want a pointer to it use `addr`.↵If you want to create a new one on the heap use `new Token` |
13:04:23 | * | beeswax quit (Quit: leaving) |
13:06:45 | FromDiscord | <carpal> I found something better |
13:06:47 | FromDiscord | <carpal> https://media.discordapp.net/attachments/371759389889003532/813033978473742387/unknown.png |
13:09:34 | FromDiscord | <konsumlamm> you know that this doesn't allocate on the heap? |
13:09:40 | FromDiscord | <konsumlamm> (edit) "heap?" => "stack?" |
13:11:26 | FromDiscord | <Rika> Yeah I think that’s what he intended |
13:11:46 | FromDiscord | <Rika> Though I didn’t understand because what he said was highly conflicting |
13:14:01 | FromDiscord | <konsumlamm> why not just use `ref` though? |
13:18:01 | FromDiscord | <carpal> In reply to @konsumlamm "you know that this": ahhaha yes? |
13:18:08 | FromDiscord | <carpal> I need it on the heap |
13:18:43 | FromDiscord | <konsumlamm> but then why are you using `alloc` and not just a `ref`? |
13:19:54 | * | superbia joined #nim |
13:21:03 | FromDiscord | <carpal> do you mean ref object |
13:21:07 | FromDiscord | <carpal> (edit) "object" => "object?" |
13:22:49 | FromDiscord | <Rika> Yes |
13:24:14 | FromDiscord | <dom96> Unless you're doing something very specific (like interacting with C) it's _very_ unlikely you should be using `alloc` 🙂 |
13:25:09 | FromDiscord | <flywind> http://zevv.nl/nim-memory/#_the_heap_in_practice |
13:41:23 | Oddmonger | alloc is for pointer type, if i remember well conversation two days ago |
13:43:41 | Oddmonger | still not very confident with ptr and pointer |
13:46:54 | FromDiscord | <konsumlamm> <https://play.nim-lang.org/#ix=2Qd5> something i wondered for a while now, why does this give a segentation fault? is it a bug or intended behaviour? the problem seems to be returning a thread from a proc |
13:47:10 | FromDiscord | <konsumlamm> (doesn't work on playground because it uses threads) |
13:48:06 | FromDiscord | <mratsim> In reply to @Oddmonger "still not very confident": ptr and pointer are the same underneath, but pointer is untyped while ptr is typed. |
13:49:23 | FromDiscord | <mratsim> In reply to @konsumlamm "<https://play.nim-lang.org/#ix=2Qd5> something i wo": no idea. But someone asked a couple weeks ago here as well. And I have also wondered about that while developing Weave |
13:49:47 | FromDiscord | <konsumlamm> that might have been me xd |
13:49:55 | FromDiscord | <flywind> works on windows |
13:50:05 | FromDiscord | <konsumlamm> oh, interesting |
13:50:47 | FromDiscord | <konsumlamm> hmm, lemme see if it works on stable |
13:51:13 | FromDiscord | <konsumlamm> after only using devel for contributing, i sometimes forget to check stable |
13:51:21 | FromDiscord | <flywind> it doesn't work on Linux |
13:51:57 | FromDiscord | <flywind> Maybe file an issue |
13:57:29 | FromDiscord | <hamidb80> sent a long message, see http://ix.io/2Qda |
14:01:07 | FromDiscord | <Disgusted by You> A lock is like a wrapper around a value. One thread claims it, mutates the wrapped value, then releases it. It stops a bunch of threads reading and writing to it at once which can lead to bugs. |
14:01:16 | FromDiscord | <Disgusted by You> (edit) removed "like" |
14:05:09 | FromDiscord | <mratsim> In reply to @hamidb80 "Hey, i am reading": It's a synchronization primitive provided by the OS. It allows 1 thread to take it, and no other thread can take it at the same time. |
14:05:39 | FromDiscord | <mratsim> This allows safe serialization of access on shared resources so no 2 threads access something at the same time borking each other. |
14:07:21 | FromDiscord | <Tigor> Hello, how to properly interpret output from GC_getStatistics() proc?↵I need to figure out memory leak from data grabber |
14:08:27 | FromDiscord | <Tigor> sent a code paste, see https://play.nim-lang.org/#ix=2Qdg |
14:11:54 | FromDiscord | <Tigor> sent a long message, see http://ix.io/2Qdi |
14:12:27 | FromDiscord | <Tigor> same code in golang dont leak at all |
14:13:48 | FromDiscord | <Tigor> (edit) "http://ix.io/2Qdi" => "http://ix.io/2Qdk" |
14:18:39 | FromDiscord | <Tigor> i use default GC and default stdlibs for everything |
14:19:09 | FromDiscord | <Tigor> same leak in devel and release version in nim |
14:20:59 | FromDiscord | <mratsim> Are you putting your GC types in global variables? |
14:21:18 | FromDiscord | <mratsim> because global variables are alive for the whole lifetime of the program and so are never collected. |
14:22:36 | FromDiscord | <Tigor> i have two objects what hold all the data both are globals refs |
14:23:04 | FromDiscord | <mratsim> globals are never collected. |
14:23:53 | FromDiscord | <Tigor> but how to init non-tuple variable with multiple values to use? |
14:24:20 | FromDiscord | <Tigor> i made 2 objects as base struct of everything↵all code just update the data inside |
14:24:31 | FromDiscord | <Tigor> (edit) removed "the" |
14:25:55 | FromDiscord | <Tigor> In reply to @mratsim "globals are never collected.": if globals are not collected when how to make a local collectable object? |
14:26:09 | FromDiscord | <mratsim> put it in a function. |
14:26:26 | FromDiscord | <Tigor> so i need to make it just function-scope object? |
14:27:02 | FromDiscord | <mratsim> yes |
14:27:20 | FromDiscord | <Tigor> a bit weird, i need it to match between multiple primary object |
14:27:25 | FromDiscord | <mratsim> you can initialize it in your main and pass it to functions downstream. |
14:28:02 | FromDiscord | <Tigor> but its a seq[object] |
14:28:08 | FromDiscord | <Tigor> not just object |
14:29:35 | FromDiscord | <mratsim> seq can also be used within functions. |
15:04:56 | Oddmonger | do you know how to customize the colours in gdb TUI mode ? |
15:05:35 | Oddmonger | it seems there is a predefined set for nim (never seen that with C, it was monochromic), but i don't even know how it's possible |
15:06:32 | Oddmonger | ah nevermind, it's « set styles » |
15:23:02 | * | tane joined #nim |
15:31:19 | * | D_ joined #nim |
15:34:17 | haxscramper | Will IC change name mangling scheme, or it will remain as it is now (with signature digest)? |
15:55:54 | * | superbia quit (Quit: WeeChat 3.0) |
15:56:59 | saem | 👋 morning |
16:11:07 | Prestige | Good morning |
16:13:18 | FromDiscord | <dom96> Good afternoon 🙂 |
16:23:08 | FromDiscord | <ajusa> is there any reason that `zip` in sequtils only takes two lists? Is is possible to use varargs to make a `zip` function that could create an arbitrary sized tuple at compile time? |
16:24:18 | FromDiscord | <haxscramper> It could work with `macro`, or multiple `iterator zip` overloads (to correctly transfer all types). |
16:25:10 | FromDiscord | <haxscramper> Best bet would be `forStmtMacro` probably that constructs tuples |
16:26:11 | FromDiscord | <ajusa> hm, guess I'll have to actually learn macros then |
17:16:22 | * | krux02 joined #nim |
17:18:10 | FromDiscord | <mratsim> In reply to @ajusa "is there any reason": https://github.com/numforge/loop-fusion#usage |
17:19:50 | FromDiscord | <XxDiCaprioxX> hey y'all, does someone know a way to make my program wait for me to close the console after it ends? |
17:22:10 | FromDiscord | <Rika> just do a `stdin.readLine()` at the end or smth |
17:23:58 | FromDiscord | <XxDiCaprioxX> oh yeah good idea thx |
17:28:27 | * | abm joined #nim |
17:39:28 | * | Vladar joined #nim |
17:42:28 | FromDiscord | <XxDiCaprioxX> also, is there a way to access the name of a variable? prolly not right? |
17:42:55 | FromDiscord | <XxDiCaprioxX> nevermind I found a workaround |
17:55:34 | FromDiscord | <ajusa> In reply to @mratsim "https://github.com/numforge/loop-fusion#usage": thanks, this fits my use case! |
18:07:22 | * | NimBot joined #nim |
18:10:40 | ForumUpdaterBot | New thread by Mantielero: Templates - cannot evaluate at compile time: elems, see https://forum.nim-lang.org/t/7543 |
18:17:20 | FromDiscord | <XxDiCaprioxX> I need some help with a 16 line proc and it may be a bit convoluted |
18:17:34 | FromDiscord | <XxDiCaprioxX> so I am doing blackjack |
18:18:30 | FromDiscord | <XxDiCaprioxX> sent a code paste, see https://play.nim-lang.org/#ix=2Qf3 |
18:20:49 | * | d10n-work quit (Read error: Connection reset by peer) |
18:21:26 | * | d10n-work joined #nim |
18:36:09 | FromDiscord | <Hi02Hi> does drawCard() update the player's hand value? b/c if it doesnt, then the turn would continue until they say no.↵↵also if playerLoop is the only block in the func, then i would get rid of it and instead of breaking out of the block, i would return |
18:48:47 | * | lritter joined #nim |
18:56:53 | * | nekits07 quit (Quit: The Lounge - https://thelounge.chat) |
19:09:16 | * | rinzlxr quit (Remote host closed the connection) |
19:09:42 | * | rinzlxr joined #nim |
19:23:20 | * | vicfred joined #nim |
19:27:54 | FromDiscord | <Hi02Hi> actually that doesnt make sence |
19:27:57 | FromDiscord | <Hi02Hi> (edit) "sence" => "sense" |
19:31:01 | FromDiscord | <Hi02Hi> which player are you getting the hand value from? i think if you are getting the wrong hand, it will malfunction |
19:32:44 | * | nekits07 joined #nim |
19:41:35 | * | haxscramper quit (Remote host closed the connection) |
19:46:33 | * | Vladar quit (Quit: Leaving) |
19:54:31 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2QfP |
20:32:22 | reversem3 | How would you load a linker ld for nim to compile ? |
20:32:45 | reversem3 | I tried --include:<path_to_linker> but that didn't work |
20:40:41 | FromDiscord | <XxDiCaprioxX> In reply to @Hi02Hi "does drawCard() update the": Thank you, that should do the trick |
20:41:16 | FromDiscord | <XxDiCaprioxX> In reply to @Hi02Hi "does drawCard() update the": Would that work and not break anything else? Then I'll gladly do that |
20:42:17 | FromDiscord | <XxDiCaprioxX> @Hi02Hi actually wait, is uses a proc to determine the hand value, so it can't be the reason |
20:42:46 | FromDiscord | <XxDiCaprioxX> And the getHandValue() proc also works I have tested that as well |
20:44:04 | FromDiscord | <Hi02Hi> ok, but i was thinking how do you know which player to get the hand from? arent there multiple players? |
20:44:44 | FromDiscord | <Hi02Hi> maybe add the player as a parameter? |
20:46:25 | FromDiscord | <XxDiCaprioxX> currently there is only one player |
20:46:43 | FromDiscord | <XxDiCaprioxX> and the `player` referenced in the proc is a variable of the program |
20:46:51 | FromDiscord | <XxDiCaprioxX> (edit) removed "currently" |
20:46:59 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
20:47:39 | FromDiscord | <XxDiCaprioxX> wait a sec |
20:47:49 | FromDiscord | <XxDiCaprioxX> I think your first suggestion might've fixed it |
20:47:51 | * | pbb joined #nim |
20:49:33 | FromDiscord | <XxDiCaprioxX> nope still broken |
20:50:08 | FromDiscord | <XxDiCaprioxX> so I tried your suggestions but that doesn't work sadly |
20:53:24 | FromDiscord | <XxDiCaprioxX> actually wait I think I caught the issue |
20:53:28 | FromDiscord | <XxDiCaprioxX> I need to check something |
20:53:39 | * | Sembei joined #nim |
20:54:18 | FromDiscord | <XxDiCaprioxX> yup, totally my fault |
20:54:30 | FromDiscord | <XxDiCaprioxX> I messed up somewhere else, thank you a lot for your help tho!!! |
20:55:52 | FromDiscord | <Hi02Hi> np, im just confused it was only me |
20:56:12 | FromDiscord | <Hi02Hi> im here either way |
20:56:41 | FromDiscord | <XxDiCaprioxX> probably because my info was pretty lacking |
20:56:56 | FromDiscord | <XxDiCaprioxX> I thought the fault was inside the proc but it was in how i handled it |
21:02:58 | * | astronavt quit (Quit: ...) |
21:03:43 | * | astronavt joined #nim |
21:48:07 | FromDiscord | <queersorceress> sent a long message, see https://paste.rs/3os |
21:51:13 | FromDiscord | <queersorceress> In reply to @reversem3 "How would you load": sorry, but i don't understand your question, do you mean the nim compiler cannot find a linker on your system to use? are you trying to link an external library as a dependency to your program? |
22:04:29 | * | actuallybatman left #nim (#nim) |
22:05:27 | FromDiscord | <ElegantBeef> What's your issue with constructors + variants? |
22:06:01 | FromDiscord | <ElegantBeef> The first enum value is the starting value for the discriminator of variants so you can only assign subfields of that kind |
22:06:05 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2QgE |
22:07:17 | FromDiscord | <ElegantBeef> @queersorceress ^ |
22:08:17 | FromDiscord | <queersorceress> sorry, give me a sec, i'll make a playground link to show you more precisely what i want. |
22:42:15 | * | rockcavera joined #nim |
22:42:24 | FromDiscord | <queersorceress> In reply to @ElegantBeef "<@!352997242531086338> ^": ugh, this is complicated to explain. here: https://play.nim-lang.org/#ix=2QgQ does this error mean that i'd have to rewrite my initializer to behave like the one listed in the comment block instead? if so, why cannot i modify the `result` variable after making one of those `Color(...)` calls where i list all the fields? the `result` variable seems immutable at that point -- why |
22:43:06 | FromDiscord | <ElegantBeef> You cannot change the kind like that |
22:43:28 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2QgR |
22:43:30 | FromDiscord | <ElegantBeef> See |
22:43:41 | FromDiscord | <queersorceress> but i'm not changing the kind after i set it the first time |
22:44:22 | FromDiscord | <ElegantBeef> The result is implictly set to `kind: red` |
22:44:26 | federico3 | TIL const `this is my nice named variable` = 42 |
22:44:30 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2QgS |
22:44:56 | FromDiscord | <ElegantBeef> Remember the result value isnt anything special it's inited to defaults, which means you have to make a new object with the discriminator you want |
22:46:04 | FromDiscord | <queersorceress> oh, so it's automagic behavior that is catching me up here, |
22:46:19 | FromDiscord | <ElegantBeef> No it's the same as any value |
22:47:23 | FromDiscord | <ElegantBeef> Here is the non proc version of what you're attempting to do https://play.nim-lang.org/#ix=2QgU |
22:47:45 | federico3 | TIL https://nim-lang.github.io/Nim/prelude.html |
22:48:33 | FromDiscord | <queersorceress> right, i mean, it is implicitly resolving a specific variant type based on the initialized default of the field. |
22:48:38 | FromDiscord | <ElegantBeef> the default value of `Color` is `Color(kind: red)` and you cannot change the kind without a new initialized object since that'd break type safety |
22:48:44 | FromDiscord | <ElegantBeef> Well it's a struct it has a default value |
22:48:48 | FromDiscord | <ElegantBeef> (edit) "Well it's a struct it has a default value ... " added "there" |
22:52:31 | FromDiscord | <ElegantBeef> Like i showed the easiest solution is to change the first line to `result = Color(kind: color)` or have init's for each variant |
22:53:24 | FromDiscord | <queersorceress> yes, i see now, i was using the wrong conceptual model for it. i was thinking it was treated as an abstract class until some property defining the type was set, but the initialized default counts as a valid type on it's own. |
22:54:18 | FromDiscord | <queersorceress> that also answers my other questions about it too. |
22:54:52 | FromDiscord | <ElegantBeef> Nice |
22:56:59 | FromDiscord | <queersorceress> though, i don't like it because of the discrepancy between the representation of the implementation and the source code, but that is something that cannot be helped. |
22:57:25 | FromDiscord | <ElegantBeef> What do you mean by that? |
23:00:17 | FromDiscord | <queersorceress> i mean, conceptually, having an object with variants is different than having an object definition for each individual color, yes? or have i gravely misunderstood the purpose of object variants? |
23:01:20 | FromDiscord | <ElegantBeef> Afaik object variants use a union underneath so if you could change the kind willy nilly what will happen is you get an unsafe value |
23:02:03 | FromDiscord | <ElegantBeef> Imagine you had a `float64` in one variant and a `string` in another, if you swap it from the float to the string one and attempt to access it you'll get a big old seg fault |
23:03:41 | FromDiscord | <queersorceress> yes, that is what i would hope would happen, but the way the code is written, theoretically two `Color` objects should be seen as the same type. |
23:03:48 | FromDiscord | <ElegantBeef> They are |
23:04:14 | FromDiscord | <ElegantBeef> Variants are useful for replacing single parent inheritance or boxing values into a collection |
23:06:34 | FromDiscord | <queersorceress> all i was saying was i don't like the implementation of the variant types because it inconveniences my coding style due to implementation details of the compiler. i get it, it makes sense and i wouldn't change it, but i still don't like it -- that's all. |
23:06:37 | * | tane quit (Quit: Leaving) |
23:07:39 | FromDiscord | <ElegantBeef> I dont see how it's implementation details of the compiler, it's field safety |
23:08:33 | FromDiscord | <Rika> In reply to @queersorceress "yes, that is what": if so, then why are you using variants? |
23:08:47 | FromDiscord | <Rika> two color objects being the same type == having the same exact fields |
23:08:51 | FromDiscord | <Rika> no? |
23:09:04 | FromDiscord | <ElegantBeef> Your suggested logic would be like casting a float to a string and then appending to it |
23:09:06 | FromDiscord | <ElegantBeef> It's dangerous |
23:13:32 | FromDiscord | <queersorceress> i was using variants specifically because i wanted the behavior of a union but handled for me, and previously (prior to 0.20.0) that was the designed behavior in this language, regardless of the safety or lack thereof. |
23:13:45 | FromDiscord | <queersorceress> (edit) "i was using variants specifically because i wanted the behavior of a ... union" added "C" |
23:15:11 | FromDiscord | <Rika> behaviors prior to 1.0 are not guaranteed to get into 1.0? |
23:15:26 | * | clemens3 quit (Quit: reboot) |
23:17:35 | FromDiscord | <ElegantBeef> Well C unions are untagged unions, Nim's variants are tagged unions |
23:19:05 | FromDiscord | <queersorceress> considering i've been using the language since version 0.16 or so, and i haven't needed this kind of behavior in quite a while. granted if i had another option for treating two different things, each with different properties, as a same type so they can exist in collections together then i wouldn't need to use variants, but here we are. |
23:19:44 | FromDiscord | <ElegantBeef> You could implement something like a C union using an array of bytes sized to the largest part of your union |
23:19:53 | FromDiscord | <queersorceress> and i come here to ask my nim questions, not my applications-of-type-theory questions 🙂 |
23:20:04 | FromDiscord | <ElegantBeef> Going to quickly write an example of it |
23:28:33 | FromDiscord | <ElegantBeef> Ah damn doesnt work |
23:28:53 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Qh1 was the idea anyway 😄 |
23:29:53 | FromDiscord | <ElegantBeef> Not ergonomic but could hide the logic in a macro then never worry about it 😄 |
23:30:45 | FromDiscord | <ElegantBeef> Ah we do have the `union` pragma |
23:30:48 | FromDiscord | <exelotl> @queersorceress cursed solution: https://play.nim-lang.org/#ix=2Qh8 |
23:31:18 | FromDiscord | <queersorceress> hahaha |
23:32:02 | FromDiscord | <ElegantBeef> Exelotl only slightly more cursed than if mine worked 😛 |
23:32:51 | FromDiscord | <ElegantBeef> Wait nim playground fucked up my link? |
23:33:52 | FromDiscord | <exelotl> yeah I was gonna say, I can't see your solution 😅 |
23:34:40 | FromDiscord | <Rika> sasuga ix |
23:34:51 | FromDiscord | <ElegantBeef> Well basically i just defined an array of the largest size of all the "union types" then tried to store the enum -> typedesc in an array, which is how the constructor would cast the object to the right union |
23:35:32 | FromDiscord | <ElegantBeef> end result in that non functioning code was `var res = cast[ptr ShapeKind[kind]](result.addr)` |
23:35:51 | FromDiscord | <ElegantBeef> Then you just access the fields you want inside a case statement and cross your fingers |
23:52:02 | * | abm quit (Quit: Leaving) |
23:57:28 | FromDiscord | <juan_carlos> `interface` is a reserved identifier in Nim... 🤔 |
23:58:14 | FromDiscord | <Yardanico> yes |
23:58:50 | FromDiscord | <Yardanico> so is `as` |
23:58:50 | FromDiscord | <Rika> `end` is a reserved identifier as well \ |
23:58:57 | FromDiscord | <Yardanico> @Rika `end` is used in SCFs |
23:59:07 | FromDiscord | <Rika> as if a lot of people use that xd |
23:59:12 | FromDiscord | <Yardanico> but still |
23:59:18 | FromDiscord | <exelotl> `as` is used in exceptions and imports xP |
23:59:23 | FromDiscord | <Yardanico> ah right, I forgot |
23:59:27 | FromDiscord | <Rika> lol |
23:59:48 | FromDiscord | <Yardanico> I almost never use `as` |
23:59:49 | FromDiscord | <exelotl> also stdtmpl is really useful lol |