<< 21-02-2021 >>

00:00:47PrestigeSeems 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:03PMunchHow big are the events?
00:01:15FromDiscord<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:35PMunch`echo mySeq`?
00:01:54FromDiscord<XxDiCaprioxX> but what if the content is a new type that inherits from object?
00:01:56PrestigePMunch: pretty big I think, if you look at the structure of an XEvent
00:01:57FromDiscord<XxDiCaprioxX> does it still work?
00:02:20PMunchAs long as the type has a `$` proc defined for it you can echo a seq of anything
00:02:40FromDiscord<XxDiCaprioxX> how do I do that
00:03:10FromDiscord<XxDiCaprioxX> do I even need to do anything for it to work?
00:03:13PMunchDefine a proc?
00:03:23Prestigehttps://github.com/nim-lang/x11/blob/master/x11/xlib.nim PMunch line 761
00:03:34FromDiscord<XxDiCaprioxX> define a $ proc
00:03:47FromDiscord<XxDiCaprioxX> wait ima come to irc
00:04:12PMunchproc `$`(x: MyType): string
00:04:28FromDiscord<XxDiCaprioxX> oh okay thanks
00:04:46PMunchPrestige, hmm, yeah those look a bit chunky..
00:04:57FromDiscord<ElegantBeef> Also pmunch the set invert name ended up being `complement` due to an issue with people not wanting the not operator
00:04:58PMunchOh wait, that's a `union` type
00:05:22PMunch@ElegantBeef, ah good to know
00:05:22*Vladar quit (Quit: Leaving)
00:06:11PMunchIt's 96 bytes
00:06:42FromDiscord<XxDiCaprioxX> In reply to @PMunch "proc `$`(x: MyType): string": ummmm vs code tells me "identifier expected but got '$'"
00:07:18PMunchCome to IRC :P
00:07:29PMunchThat's meant to be actual backticks around the $
00:07:34PrestigeIf 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:06FromDiscord<XxDiCaprioxX> In reply to @PMunch "Come to IRC :P": just a sec, small technical issue xD
00:09:00PMunchPrestige, hmm, how are PXEvents freed?
00:09:03FromDiscord<XxDiCaprioxX> it says I cannot connect to irc.freecode.net
00:09:21FromDiscord<XxDiCaprioxX> maybe I have the wrong port
00:09:42PMunchOr the wrong URL
00:09:47PMunchIt's freenode, not code
00:10:06FromDiscord<XxDiCaprioxX> i said code that was just a typo here haha
00:10:10FromDiscord<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:31PrestigeNo idea PMunch
00:10:37*asdflkj_1 joined #nim
00:10:41*XxDiCaprioxX joined #nim
00:10:48XxDiCaprioxXaight I'm here
00:11:00PMunchproc `$`(x: MyType): string
00:11:13PrestigeI 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:38FromDiscord<neow> (edit) "28'u32?" => "28'i32?"
00:11:49XxDiCaprioxXso I typed what you put there and somehow I have 12 error messages
00:11:57XxDiCaprioxXwhat do I put in the body of the proc?
00:12:19PMunch@neow, wild guess is that it isn't available on all platforms
00:12:29PMunchBut it might just have never been added
00:12:52PMunchXxDiCaprioxX, something that converts your type to a string
00:13:00FromDiscord<neow> I think I will open a gh issue, at worst someone will point out a good reason
00:13:03PMunchI mean you could do `repr(x)`
00:13:19XxDiCaprioxXis that repr(x) related to me?
00:13:25PMunchYes
00:13:55XxDiCaprioxXexpression 'proc () =' is of type 'proc ()' and has to be used (or discarded); for a function call use ()
00:13:59XxDiCaprioxXthats what it tells me
00:14:29XxDiCaprioxXas an error
00:16:00XxDiCaprioxXI think I'm going to sleep and try more tomorrow. Thank you for your help!
00:16:15PMunchWait, you have to name it
00:16:31PMunchproc `$`(x: MyProc): string = repr(x)
00:16:38PMunchThat should be all you need
00:16:54PMunchAnd then `echo mySeq`
00:17:01PMunchs/MyProc/MyType
00:17:08XxDiCaprioxXproc '$'(x: Card): string = repr(x)
00:17:30XxDiCaprioxXshould I use ` instead of ' ??
00:17:44XxDiCaprioxXappearantly yes
00:17:46XxDiCaprioxXfixed it
00:18:30XxDiCaprioxXthanks a lot, I should get it to work now!
00:19:05XxDiCaprioxXbbye
00:19:07*XxDiCaprioxX quit (Quit: Going offline, see ya! (www.adiirc.com))
00:28:01PrestigePMunch: 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:55PMunchSure, but it's pretty late so I'm not entirely sure how useful I'll be :P
00:29:22PrestigeThat's fine, I think an extra set of eyes would help in general
00:35:48PMunchHmm, this means I need to figure out Discord again
00:35:50PMunchGive me a sec
00:36:38*D_ quit (Ping timeout: 264 seconds)
00:36:43*joast joined #nim
00:37:06PMunchI think I'm calling you?
00:37:17PrestigeI had to make a new acc, you have to add me again
00:37:29Prestigediscord kept locking me out I think I'm on account #5 lol
00:38:11PrestigeI sent you my id
01:11:38FromDiscord<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:56FromDiscord<ElegantBeef> @Yjuq an example from monotimes https://github.com/nim-lang/Nim/blob/version-1-4/lib/std/monotimes.nim#L35
01:19:27FromDiscord<ElegantBeef> You should be able to put a full http link in there aswell since it's just RST styling afaik
01:19:51FromDiscord<Yjuq> But,... I want to link to something in the same document x)
01:20:43FromDiscord<ElegantBeef> Ah probably can do `#id` or `module.html#id`
01:21:46FromDiscord<flywind> see https://github.com/nim-lang/Nim/blob/540d16540b91d8245aaaf0785e47233e91f22d5d/lib/pure/strutils.nim#L174
01:22:14FromDiscord<ElegantBeef> Ah it's even smarter than i thought!
01:22:37FromDiscord<Yjuq> thanks, this is more what i was looking for
01:23:33FromDiscord<Yjuq> But yea, nim seems to fits for me. I think I can start my project in it now. I decided :D
01:23:55FromDiscord<Yjuq> played the last days with this language around
01:24:19FromDiscord<ElegantBeef> Yay!
01:24:35FromDiscord<Yjuq> yea, the planning phase already took me 2 years rofl
01:24:45FromDiscord<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:10FromDiscord<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:56FromDiscord<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:10FromDiscord<Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q9l
03:22:14FromDiscord<Yjuq> ah
03:22:15FromDiscord<Yjuq> nvm
03:22:18FromDiscord<Yjuq> i see what you mean
03:22:46FromDiscord<Yjuq> uhh - let me crawl the docu for the pcre flags
03:23:24FromDiscord<ajusa> Yeah, I want the seq lol, test, more. Sorry that wasn't super clear
03:44:45*retroedgetech[m] joined #nim
04:00:59FromDiscord<will codes stuff> sent a code paste, see https://play.nim-lang.org/#ix=2Q9x
04:01:48FromDiscord<ElegantBeef> Object variants? https://nim-lang.org/docs/manual.html#types-object-variants
04:03:10FromDiscord<ElegantBeef> I am working on a DSL atm to make it nicer
04:03:27FromDiscord<ElegantBeef> Though i think some already exist
04:03:40FromDiscord<will codes stuff> im looking for storing a value inside of a type in a enum
04:03:47FromDiscord<ElegantBeef> Yea
04:03:58FromDiscord<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:35FromDiscord<flywind> see https://nim-by-example.github.io/types/enums/
04:04:59FromDiscord<will codes stuff> that has a set value are you able to set a different value?
04:05:07FromDiscord<ElegantBeef> That has a constant
04:05:10FromDiscord<will codes stuff> I would like to have a enum with a recursive type
04:05:12FromDiscord<ElegantBeef> https://github.com/andreaferretti/patty#constructing-variant-objects
04:05:18FromDiscord<ElegantBeef> You need an object variant for that
04:05:43FromDiscord<ElegantBeef> Multiple packages make the syntax a bit nicer
04:06:15FromDiscord<ElegantBeef> I assume you're after the same sorta thing as rust enums, which are just an abstraction of object variants
04:06:34FromDiscord<will codes stuff> yeah I guess im just not used to the object variants syntax
04:06:40FromDiscord<will codes stuff> I didnt realize what it was doing
04:06:59FromDiscord<ElegantBeef> My in process DSL https://media.discordapp.net/attachments/371759389889003532/812898133960556554/unknown.png
04:07:18FromDiscord<ElegantBeef> Emits the enums for you and everything, but more clear imo
04:07:45FromDiscord<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:29FromDiscord<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:47FromDiscord<Yjuq> or i'm blind
04:09:01FromDiscord<ajusa> Well I asked here since I assumed I was blind
04:09:08FromDiscord<ElegantBeef> Isnt it apart of regex syntax to select inside a pattern?
04:09:48FromDiscord<Yjuq> He want the captured groups as sequence, not the complete global matches
04:10:09FromDiscord<ElegantBeef> I have 0 clue what that means
04:10:16FromDiscord<ElegantBeef> the range instead of the values?
04:10:21*theelous3 quit (Read error: Connection reset by peer)
04:10:28FromDiscord<ajusa> In reply to @Yjuq "Not sure what you": See this example
04:10:50FromDiscord<Yjuq> It outputs the global matches, but he want the stuff between the ones
04:11:19FromDiscord<ElegantBeef> ok so `@["lol", "test"...]`?
04:11:24FromDiscord<Yjuq> Yes
04:11:24FromDiscord<ajusa> Yes
04:11:42FromDiscord<will codes stuff> In reply to @ElegantBeef "Emits the enums for": thanks for the help
04:18:04FromDiscord<ElegantBeef> @ajusa what's the data you're parsing/regex pattern?
04:18:47FromDiscord<will codes stuff> I am getting undeclared identifier for variant
04:18:53FromDiscord<ElegantBeef> Well yea
04:19:02FromDiscord<ElegantBeef> It's not apart of the language it's my own dsl
04:19:17FromDiscord<will codes stuff> ah
04:19:29FromDiscord<ElegantBeef> And same with `patty`'s
04:19:52FromDiscord<will codes stuff> I guess I will install patty
04:20:06FromDiscord<ElegantBeef> Well you can just use Nim's normal syntax
04:20:31FromDiscord<ElegantBeef> I was just suggesting patty if you dislike nim's default
04:20:38FromDiscord<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:32FromDiscord<will codes stuff> oh you still cant have recursive types in patty
04:21:37FromDiscord<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:16FromDiscord<Yjuq> ¯\_(ツ)_/¯
04:22:22FromDiscord<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:45FromDiscord<ElegantBeef> To have recursive types you need to use `ref object`
04:22:53FromDiscord<ElegantBeef> So patty might not emit that, my planned DSL might
04:23:52FromDiscord<will codes stuff> seems to work now
04:24:01FromDiscord<will codes stuff> https://media.discordapp.net/attachments/371759389889003532/812902421390295070/Screen_Shot_2021-02-20_at_20.23.57.png
04:24:11FromDiscord<Yjuq> WOAH, this is a font size
04:24:31FromDiscord<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:49FromDiscord<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:07FromDiscord<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:51FromDiscord<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:21FromDiscord<Yjuq> yea, kind of
04:31:42FromDiscord<Yjuq> I know, a sad solution
04:31:48FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2Q9P
04:32:01FromDiscord<Yjuq> Yea, I don't like this either ^.^
04:32:55FromDiscord<Yjuq> But you can just define a nice procedure and invoke this instead. :P
04:32:56FromDiscord<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:03FromDiscord<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:55ForumUpdaterBotNew thread by Jasonfi: Custom error messages for exceptions in Jester?, see https://forum.nim-lang.org/t/7542
06:15:01FromDiscord<バロザード> uhhh
06:15:06FromDiscord<バロザード> how do i set up nim?
06:15:08FromDiscord<バロザード> i thinki fucked up
06:19:25Prestigechoosenim is usually the easiest way
06:19:45FromDiscord<Yjuq> On which platform?
06:20:04FromDiscord<バロザード> windows
06:20:15FromDiscord<バロザード> i like installed the zip and it got added to path i think?
06:20:18FromDiscord<バロザード> but it didnt work
06:20:37FromDiscord<Yjuq> did you run the finish.exe?
06:20:59FromDiscord<Yjuq> technically you can set it up manually as well
06:21:25FromDiscord<バロザード> i did?
06:21:30FromDiscord<バロザード> i dont know why it doesnt work
06:21:38FromDiscord<Yjuq> doesn't work is pretty vague
06:21:44FromDiscord<Yjuq> what doesn't work exactly?
06:21:47FromDiscord<バロザード> welli did nim in terminal and nothing happens
06:22:03FromDiscord<バロザード> sent a code paste, see https://play.nim-lang.org/#ix=2Qan
06:22:29FromDiscord<Yjuq> I see - the bin folder is in your path environment variable?
06:22:41FromDiscord<バロザード> yep
06:22:54FromDiscord<Yjuq> did you restart the terminal?
06:22:58FromDiscord<Yjuq> after setting it?
06:23:06FromDiscord<バロザード> yep
06:23:14FromDiscord<Yjuq> try to reboot your pc in this case
06:23:22FromDiscord<Yjuq> if it still not working tell me
06:23:27FromDiscord<バロザード> uh ok
06:24:42FromDiscord<ElegantBeef> Windows path variable is a magic lie 😄
06:25:37FromDiscord<Yjuq> Well ^.^
06:27:17FromDiscord<バロザード> well it worked
06:27:20FromDiscord<バロザード> i dont know why
06:27:22FromDiscord<バロザード> but it did
06:27:28FromDiscord<Yjuq> good
06:29:38FromDiscord<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:24FromDiscord<ElegantBeef> Windows path tends to need to the pc to restart to get it to reload
06:53:07FromDiscord<Yjuq> not always
07:02:48*muffindrake joined #nim
07:15:27*fosred joined #nim
07:29:35FromDiscord<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:41beeswaxHi, 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:14FromDiscord<ElegantBeef> the `times` module mixed json should work
07:40:30FromDiscord<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:32beeswaxEleganBeef: 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:44FromDiscord<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:23FromDiscord<Recruit_main707> wait, ccp uses nim?
09:42:40FromDiscord<Rika> ccp?
09:42:58FromDiscord<Recruit_main707> CCP games
09:43:46FromDiscord<Recruit_main707> i knew they used stackless python for example, but not nim
09:44:45FromDiscord<ElegantBeef> Where'd you see this?
09:48:27FromGitter<xflywind> https://stackshare.io/nim
09:50:07FromDiscord<Recruit_main707> yep there
09:58:07*krux02 quit (Remote host closed the connection)
10:03:58FromDiscord<dom96> Huh. Would be cool to hear from a CCP Games employee about what they use it for.
10:05:00FromDiscord<ElegantBeef> Dom time to flex your position and email them 😛
10:05:32FromDiscord<ElegantBeef> "Dear CCP, what the fuck do you use Nim for? And.... you do know your name... right?
10:05:34FromDiscord<ElegantBeef> (edit) "right?" => "right?""
10:36:25haxscramperHow 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:36haxscramperJust using `std/[parsecfg]` results in errors like "invalid token" and `@end` being recognized as `KeyValuePair` with empty value
10:51:06FromDiscord<dom96> @ElegantBeef hah, honestly I wouldn't be surprised if that info was false unfortunately
10:51:19FromDiscord<dom96> after all I assume just about anyone can add a company on that page
10:54:56*rinzlxr joined #nim
11:01:16dv^_^9691I just tried and you need a matching company email
11:26:27FromDiscord<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:01FromDiscord<Rika> what js minifiers do people use that doesnt completely destroy nim's js output's functionality
11:55:02FromDiscord<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:42FromDiscord<dom96> @Rika I use closure-compiler for Stardust
12:03:53FromDiscord<dom96> although I had to do some hacks to make it work lol
12:04:09FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/813018211779084309/unknown.png
12:04:22FromDiscord<dom96> that may be a bug that was fixed in latest nim though
12:04:30*rinzlxr joined #nim
12:04:44FromDiscord<Rika> i was using terser
12:04:50FromDiscord<dom96> also, I found out the hard way that running uglify on closure-compiler's output created subtly broken JS
12:05:05FromDiscord<Rika> lol js is broken itself 😛
12:07:11FromDiscord<Rika> ill look into closure compiler, see if its smaller
12:08:16FromDiscord<carpal> how can I allocate on the heap value? https://media.discordapp.net/attachments/371759389889003532/813019253379956766/unknown.png
12:08:48FromDiscord<carpal> this should throws segmentation fault if used outside the scope, and I have to use it outside
12:09:17FromDiscord<Rika> what type is result.value? make it a ref if its a ptr
12:09:23FromDiscord<carpal> Toke
12:09:24FromDiscord<carpal> (edit) "Toke" => "Token"
12:09:26FromDiscord<carpal> (edit) "Token ... " added "= object"
12:09:31FromDiscord<carpal> not heap allocated
12:09:31FromDiscord<Rika> eeh
12:09:41FromDiscord<carpal> I need it on the stack please 😂
12:09:45FromDiscord<carpal> but not in that case
12:09:56FromDiscord<Rika> then make result.value a ref Token
12:10:01FromDiscord<carpal> isn't there a way to do allocOnHeap(object).addr() ?'
12:10:02FromDiscord<carpal> (edit) "?'" => "?"
12:10:03FromDiscord<carpal> (edit) "allocOnHeap(object).addr() ?" => "allocOnHeap(object).addr()?"
12:10:10FromDiscord<Rika> eeh
12:10:11FromDiscord<carpal> In reply to @Rika "then make result.value a": no please, I need it on the stack
12:10:20FromDiscord<carpal> I prefer
12:10:21FromDiscord<Rika> what do you mean then
12:10:35FromDiscord<Rika> i dont understand which needs to be on the stack and which on the heap
12:11:25FromDiscord<carpal> okay, Token is always allocated on the stack
12:11:44FromDiscord<carpal> but in this case I need it on the heap to get a pointer and use it in Node: value: pointer
12:11:54FromDiscord<carpal> (edit) "Node:" => "Node = object"
12:14:06FromDiscord<carpal> should I ask on the forum?
12:14:10FromDiscord<Rika> is result.value heap or stack
12:14:26FromDiscord<Rika> if heap, make it ref Token
12:14:39FromDiscord<carpal> In reply to @Rika "is result.value heap or": stack
12:15:01FromDiscord<carpal> result.value is 'pointer' type
12:15:06FromDiscord<Rika> okay, then what is the heap allocation you need?
12:15:33FromDiscord<Rika> you cannot put a ptr to a stack var there, it will die after scope
12:16:06FromDiscord<carpal> it is for that I asked for help lol
12:16:20FromDiscord<carpal> I already said it up in the chat
12:16:45FromDiscord<mratsim> (ref Foo)(foo)?
12:17:38FromDiscord<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:43FromDiscord<carpal> some week ago I wrote a dynamic object, maybe
12:17:47FromDiscord<carpal> (edit) "some week ago I wrote a dynamic object, maybe ... " added "I could use it"
12:18:06FromDiscord<carpal> In reply to @Rika "and what ive been": no, it can be also other things
12:18:13FromDiscord<carpal> like BlockNode
12:18:20FromDiscord<carpal> it is an ast lol
12:18:23FromDiscord<Rika> then use alloc
12:18:41FromDiscord<Rika> one moment
12:19:10FromDiscord<Rika> https://nim-lang.org/docs/system.html#alloc.t%2CNatural
12:19:15FromDiscord<Rika> if you need it to be a void ptr
12:19:48FromDiscord<Rika> alloc is equiv. malloc, alloc0 is equiv. calloc
12:20:01FromDiscord<carpal> don't worry I'll use my dynamic object
12:20:15FromDiscord<carpal> it provides methods already written to manage a pointer
12:20:31FromDiscord<Rika> if it works it works
12:20:34FromDiscord<carpal> if I use alloc I have to rewrite all
12:20:43FromDiscord<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:05FromDiscord<carpal> I prefer allocate on the stack
12:21:32FromDiscord<mratsim> Me too
12:21:47FromDiscord<carpal> my dynamic object keeps it on the stack
12:23:42FromDiscord<Rika> or does it
12:42:48ForumUpdaterBotNew question by arctic_clerk: Nim counting over multiple threads, see https://stackoverflow.com/questions/66302396/nim-counting-over-multiple-threads
13:03:00FromDiscord<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:45FromDiscord<carpal> I found something better
13:06:47FromDiscord<carpal> https://media.discordapp.net/attachments/371759389889003532/813033978473742387/unknown.png
13:09:34FromDiscord<konsumlamm> you know that this doesn't allocate on the heap?
13:09:40FromDiscord<konsumlamm> (edit) "heap?" => "stack?"
13:11:26FromDiscord<Rika> Yeah I think that’s what he intended
13:11:46FromDiscord<Rika> Though I didn’t understand because what he said was highly conflicting
13:14:01FromDiscord<konsumlamm> why not just use `ref` though?
13:18:01FromDiscord<carpal> In reply to @konsumlamm "you know that this": ahhaha yes?
13:18:08FromDiscord<carpal> I need it on the heap
13:18:43FromDiscord<konsumlamm> but then why are you using `alloc` and not just a `ref`?
13:19:54*superbia joined #nim
13:21:03FromDiscord<carpal> do you mean ref object
13:21:07FromDiscord<carpal> (edit) "object" => "object?"
13:22:49FromDiscord<Rika> Yes
13:24:14FromDiscord<dom96> Unless you're doing something very specific (like interacting with C) it's _very_ unlikely you should be using `alloc` 🙂
13:25:09FromDiscord<flywind> http://zevv.nl/nim-memory/#_the_heap_in_practice
13:41:23Oddmongeralloc is for pointer type, if i remember well conversation two days ago
13:43:41Oddmongerstill not very confident with ptr and pointer
13:46:54FromDiscord<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:10FromDiscord<konsumlamm> (doesn't work on playground because it uses threads)
13:48:06FromDiscord<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:23FromDiscord<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:47FromDiscord<konsumlamm> that might have been me xd
13:49:55FromDiscord<flywind> works on windows
13:50:05FromDiscord<konsumlamm> oh, interesting
13:50:47FromDiscord<konsumlamm> hmm, lemme see if it works on stable
13:51:13FromDiscord<konsumlamm> after only using devel for contributing, i sometimes forget to check stable
13:51:21FromDiscord<flywind> it doesn't work on Linux
13:51:57FromDiscord<flywind> Maybe file an issue
13:57:29FromDiscord<hamidb80> sent a long message, see http://ix.io/2Qda
14:01:07FromDiscord<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:16FromDiscord<Disgusted by You> (edit) removed "like"
14:05:09FromDiscord<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:39FromDiscord<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:21FromDiscord<Tigor> Hello, how to properly interpret output from GC_getStatistics() proc?↵I need to figure out memory leak from data grabber
14:08:27FromDiscord<Tigor> sent a code paste, see https://play.nim-lang.org/#ix=2Qdg
14:11:54FromDiscord<Tigor> sent a long message, see http://ix.io/2Qdi
14:12:27FromDiscord<Tigor> same code in golang dont leak at all
14:13:48FromDiscord<Tigor> (edit) "http://ix.io/2Qdi" => "http://ix.io/2Qdk"
14:18:39FromDiscord<Tigor> i use default GC and default stdlibs for everything
14:19:09FromDiscord<Tigor> same leak in devel and release version in nim
14:20:59FromDiscord<mratsim> Are you putting your GC types in global variables?
14:21:18FromDiscord<mratsim> because global variables are alive for the whole lifetime of the program and so are never collected.
14:22:36FromDiscord<Tigor> i have two objects what hold all the data both are globals refs
14:23:04FromDiscord<mratsim> globals are never collected.
14:23:53FromDiscord<Tigor> but how to init non-tuple variable with multiple values to use?
14:24:20FromDiscord<Tigor> i made 2 objects as base struct of everything↵all code just update the data inside
14:24:31FromDiscord<Tigor> (edit) removed "the"
14:25:55FromDiscord<Tigor> In reply to @mratsim "globals are never collected.": if globals are not collected when how to make a local collectable object?
14:26:09FromDiscord<mratsim> put it in a function.
14:26:26FromDiscord<Tigor> so i need to make it just function-scope object?
14:27:02FromDiscord<mratsim> yes
14:27:20FromDiscord<Tigor> a bit weird, i need it to match between multiple primary object
14:27:25FromDiscord<mratsim> you can initialize it in your main and pass it to functions downstream.
14:28:02FromDiscord<Tigor> but its a seq[object]
14:28:08FromDiscord<Tigor> not just object
14:29:35FromDiscord<mratsim> seq can also be used within functions.
15:04:56Oddmongerdo you know how to customize the colours in gdb TUI mode ?
15:05:35Oddmongerit 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:32Oddmongerah nevermind, it's « set styles »
15:23:02*tane joined #nim
15:31:19*D_ joined #nim
15:34:17haxscramperWill 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:59saem👋 morning
16:11:07PrestigeGood morning
16:13:18FromDiscord<dom96> Good afternoon 🙂
16:23:08FromDiscord<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:18FromDiscord<haxscramper> It could work with `macro`, or multiple `iterator zip` overloads (to correctly transfer all types).
16:25:10FromDiscord<haxscramper> Best bet would be `forStmtMacro` probably that constructs tuples
16:26:11FromDiscord<ajusa> hm, guess I'll have to actually learn macros then
17:16:22*krux02 joined #nim
17:18:10FromDiscord<mratsim> In reply to @ajusa "is there any reason": https://github.com/numforge/loop-fusion#usage
17:19:50FromDiscord<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:10FromDiscord<Rika> just do a `stdin.readLine()` at the end or smth
17:23:58FromDiscord<XxDiCaprioxX> oh yeah good idea thx
17:28:27*abm joined #nim
17:39:28*Vladar joined #nim
17:42:28FromDiscord<XxDiCaprioxX> also, is there a way to access the name of a variable? prolly not right?
17:42:55FromDiscord<XxDiCaprioxX> nevermind I found a workaround
17:55:34FromDiscord<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:40ForumUpdaterBotNew thread by Mantielero: Templates - cannot evaluate at compile time: elems, see https://forum.nim-lang.org/t/7543
18:17:20FromDiscord<XxDiCaprioxX> I need some help with a 16 line proc and it may be a bit convoluted
18:17:34FromDiscord<XxDiCaprioxX> so I am doing blackjack
18:18:30FromDiscord<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:09FromDiscord<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:54FromDiscord<Hi02Hi> actually that doesnt make sence
19:27:57FromDiscord<Hi02Hi> (edit) "sence" => "sense"
19:31:01FromDiscord<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:31FromDiscord<Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2QfP
20:32:22reversem3How would you load a linker ld for nim to compile ?
20:32:45reversem3I tried --include:<path_to_linker> but that didn't work
20:40:41FromDiscord<XxDiCaprioxX> In reply to @Hi02Hi "does drawCard() update the": Thank you, that should do the trick
20:41:16FromDiscord<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:17FromDiscord<XxDiCaprioxX> @Hi02Hi actually wait, is uses a proc to determine the hand value, so it can't be the reason
20:42:46FromDiscord<XxDiCaprioxX> And the getHandValue() proc also works I have tested that as well
20:44:04FromDiscord<Hi02Hi> ok, but i was thinking how do you know which player to get the hand from? arent there multiple players?
20:44:44FromDiscord<Hi02Hi> maybe add the player as a parameter?
20:46:25FromDiscord<XxDiCaprioxX> currently there is only one player
20:46:43FromDiscord<XxDiCaprioxX> and the `player` referenced in the proc is a variable of the program
20:46:51FromDiscord<XxDiCaprioxX> (edit) removed "currently"
20:46:59*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
20:47:39FromDiscord<XxDiCaprioxX> wait a sec
20:47:49FromDiscord<XxDiCaprioxX> I think your first suggestion might've fixed it
20:47:51*pbb joined #nim
20:49:33FromDiscord<XxDiCaprioxX> nope still broken
20:50:08FromDiscord<XxDiCaprioxX> so I tried your suggestions but that doesn't work sadly
20:53:24FromDiscord<XxDiCaprioxX> actually wait I think I caught the issue
20:53:28FromDiscord<XxDiCaprioxX> I need to check something
20:53:39*Sembei joined #nim
20:54:18FromDiscord<XxDiCaprioxX> yup, totally my fault
20:54:30FromDiscord<XxDiCaprioxX> I messed up somewhere else, thank you a lot for your help tho!!!
20:55:52FromDiscord<Hi02Hi> np, im just confused it was only me
20:56:12FromDiscord<Hi02Hi> im here either way
20:56:41FromDiscord<XxDiCaprioxX> probably because my info was pretty lacking
20:56:56FromDiscord<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:07FromDiscord<queersorceress> sent a long message, see https://paste.rs/3os
21:51:13FromDiscord<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:27FromDiscord<ElegantBeef> What's your issue with constructors + variants?
22:06:01FromDiscord<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:05FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2QgE
22:07:17FromDiscord<ElegantBeef> @queersorceress ^
22:08:17FromDiscord<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:24FromDiscord<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:06FromDiscord<ElegantBeef> You cannot change the kind like that
22:43:28FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2QgR
22:43:30FromDiscord<ElegantBeef> See
22:43:41FromDiscord<queersorceress> but i'm not changing the kind after i set it the first time
22:44:22FromDiscord<ElegantBeef> The result is implictly set to `kind: red`
22:44:26federico3TIL const `this is my nice named variable` = 42
22:44:30FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2QgS
22:44:56FromDiscord<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:04FromDiscord<queersorceress> oh, so it's automagic behavior that is catching me up here,
22:46:19FromDiscord<ElegantBeef> No it's the same as any value
22:47:23FromDiscord<ElegantBeef> Here is the non proc version of what you're attempting to do https://play.nim-lang.org/#ix=2QgU
22:47:45federico3TIL https://nim-lang.github.io/Nim/prelude.html
22:48:33FromDiscord<queersorceress> right, i mean, it is implicitly resolving a specific variant type based on the initialized default of the field.
22:48:38FromDiscord<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:44FromDiscord<ElegantBeef> Well it's a struct it has a default value
22:48:48FromDiscord<ElegantBeef> (edit) "Well it's a struct it has a default value ... " added "there"
22:52:31FromDiscord<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:24FromDiscord<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:18FromDiscord<queersorceress> that also answers my other questions about it too.
22:54:52FromDiscord<ElegantBeef> Nice
22:56:59FromDiscord<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:25FromDiscord<ElegantBeef> What do you mean by that?
23:00:17FromDiscord<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:20FromDiscord<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:03FromDiscord<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:41FromDiscord<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:48FromDiscord<ElegantBeef> They are
23:04:14FromDiscord<ElegantBeef> Variants are useful for replacing single parent inheritance or boxing values into a collection
23:06:34FromDiscord<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:39FromDiscord<ElegantBeef> I dont see how it's implementation details of the compiler, it's field safety
23:08:33FromDiscord<Rika> In reply to @queersorceress "yes, that is what": if so, then why are you using variants?
23:08:47FromDiscord<Rika> two color objects being the same type == having the same exact fields
23:08:51FromDiscord<Rika> no?
23:09:04FromDiscord<ElegantBeef> Your suggested logic would be like casting a float to a string and then appending to it
23:09:06FromDiscord<ElegantBeef> It's dangerous
23:13:32FromDiscord<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:45FromDiscord<queersorceress> (edit) "i was using variants specifically because i wanted the behavior of a ... union" added "C"
23:15:11FromDiscord<Rika> behaviors prior to 1.0 are not guaranteed to get into 1.0?
23:15:26*clemens3 quit (Quit: reboot)
23:17:35FromDiscord<ElegantBeef> Well C unions are untagged unions, Nim's variants are tagged unions
23:19:05FromDiscord<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:44FromDiscord<ElegantBeef> You could implement something like a C union using an array of bytes sized to the largest part of your union
23:19:53FromDiscord<queersorceress> and i come here to ask my nim questions, not my applications-of-type-theory questions 🙂
23:20:04FromDiscord<ElegantBeef> Going to quickly write an example of it
23:28:33FromDiscord<ElegantBeef> Ah damn doesnt work
23:28:53FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Qh1 was the idea anyway 😄
23:29:53FromDiscord<ElegantBeef> Not ergonomic but could hide the logic in a macro then never worry about it 😄
23:30:45FromDiscord<ElegantBeef> Ah we do have the `union` pragma
23:30:48FromDiscord<exelotl> @queersorceress cursed solution: https://play.nim-lang.org/#ix=2Qh8
23:31:18FromDiscord<queersorceress> hahaha
23:32:02FromDiscord<ElegantBeef> Exelotl only slightly more cursed than if mine worked 😛
23:32:51FromDiscord<ElegantBeef> Wait nim playground fucked up my link?
23:33:52FromDiscord<exelotl> yeah I was gonna say, I can't see your solution 😅
23:34:40FromDiscord<Rika> sasuga ix
23:34:51FromDiscord<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:32FromDiscord<ElegantBeef> end result in that non functioning code was `var res = cast[ptr ShapeKind[kind]](result.addr)`
23:35:51FromDiscord<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:28FromDiscord<juan_carlos> `interface` is a reserved identifier in Nim... 🤔
23:58:14FromDiscord<Yardanico> yes
23:58:50FromDiscord<Yardanico> so is `as`
23:58:50FromDiscord<Rika> `end` is a reserved identifier as well \
23:58:57FromDiscord<Yardanico> @Rika `end` is used in SCFs
23:59:07FromDiscord<Rika> as if a lot of people use that xd
23:59:12FromDiscord<Yardanico> but still
23:59:18FromDiscord<exelotl> `as` is used in exceptions and imports xP
23:59:23FromDiscord<Yardanico> ah right, I forgot
23:59:27FromDiscord<Rika> lol
23:59:48FromDiscord<Yardanico> I almost never use `as`
23:59:49FromDiscord<exelotl> also stdtmpl is really useful lol