<< 24-11-2020 >>

00:00:02FromDiscord<shadow.> odd
00:00:05FromDiscord<shadow.> thats what i was thinking lmfoa
00:00:08FromDiscord<shadow.> (edit) "lmfoa" => "lmfao"
00:00:50FromDiscord<shadow.> i also thought it was just compile-time if
00:00:57FromDiscord<ElegantBeef> Apparently `when false` isnt semantically checked so it seems like it's used here as an example
00:01:27FromDiscord<shadow.> ohh ok
00:02:16FromDiscord<ElegantBeef> There is a `when false` in the manual which i guess is applied to showcase that code is uncompilable...? https://media.discordapp.net/attachments/371759389889003532/780584028943155260/unknown.png
00:03:26*letto quit (Remote host closed the connection)
00:03:49*letto joined #nim
00:04:07FromDiscord<shadow.> ah
00:04:24FromDiscord<shadow.> i just thought it was odd bc they wrote a whole like 70 lines of code under it in the `openFileStream` definition lol
00:31:06FromDiscord<cabboose> hey y'all, need some help; I'm using db_mysql to insert entries to my database, the entries include special characters such as ":" which get converted into numbers that translates loosely to their html encoded counter parts
00:31:21FromDiscord<cabboose> for instance ":" gets converted into "58"
00:31:26FromDiscord<cabboose> anyone know what the deal is there?
00:31:40FromDiscord<cabboose> i've tried setEncoding to utf8 on the database connection
00:31:51FromDiscord<cabboose> the strings themselves seem to be fine when printed to stdout
00:32:15FromDiscord<cabboose> the strings are web scraped off a website but that also has utf8 encoding
00:34:00FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/780592018350538762/unknown.png
00:34:16FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/780592084058243072/unknown.png
00:34:52FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/780592237494665236/unknown.png
00:35:23FromDiscord<cabboose> this is driving me nuts
00:36:13FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/780592572640395275/unknown.png
00:38:35FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/780593161336651786/unknown.png
00:39:35FromDiscord<cabboose> The easiest solution is to just cease the use of special characters but as this database was being populated previously and includes special characters it'll make it easier if i just continue the trend
00:40:10FromDiscord<cabboose> not the WORST thing in the world if I have to stop but if anyone has any enlightenment itll be awesome
00:42:39FromDiscord<cabboose> using stable nim 1.4.0
00:46:28FromDiscord<cabboose> Ok i see the special characters are converted to UTF-8 decimal format
00:57:18FromDiscord<cabboose> Ok i need to delve into this more and make sure that my updates are at least being performed correctly
01:10:32*lritter joined #nim
01:18:15FromDiscord<nikki> @For Your Health thinking aboout it a bit more; i think the main part of what the `self` thing taps into that i did a bad job articulating was -- i think for good perf in a lot of game scenarios you want to not couple your data and code that operates on that data as individual pieces, but think of a lot of it more as batch operations, or at least even if starting simple, to allow the evolution of your code for batch operations later
01:19:11FromDiscord<nikki> like, if you have a `updateParticle` function that does all of the steps of updating one particle, it forces an architecture that does all of the steps per particle one by one, but i think structuring it more just as "ok what's the data structure that contains particles" and then separately what the processes are that are running on them helps a lot
01:19:54FromDiscord<nikki> even outside the perf stuff in particular though, i've found that for me it helps organize things to allow mixing and matching functionality later
01:21:10FromDiscord<nikki> so it's not necessarily that there is a player object that manages itself, or even a line segment object that manages itself, but more just the layout of player data and line segments and also -- an accumulation of transformations for manipulating those but that is amenable to restructuring
01:25:37*lritter quit (Quit: Leaving)
01:37:14FromDiscord<For Your Health> @nikki I'm trying to get into that line of thinking more and break away from being tied to object oriented-ness so much. Perhaps switching off of using self as an argument would help in that.
01:37:30*Tanger joined #nim
01:49:01FromDiscord<nikki> yeah that was the idea basically. like, you don't lose anything because you pretty much can still write the `line.foo()` at callsites, which i also vibe with for sure: it's useful to have the 'obj.foo(...)' syntax to clarify "on what" some operation is operating. i just think that that's a callsite perogative and not the callee perogative, and the callee is just like "hey you asked me to do something, ok i'll do it!"
01:49:25FromDiscord<nikki> the idea is to move that decision of how to organize things upstream, while having sure the encapsulated logic downstream
01:49:37FromDiscord<nikki> but the downstream isn't the owner of whether you're thinking of this piece of data as a distinct "object" or not
01:50:12FromDiscord<nikki> i think that's the strength of ufcs: organize your functionality as data and separately operations on data; but still get the benefit of "data.foo()" when that's the best way to express what you're doing to the data, at the callsite
01:55:55*abm quit (Read error: Connection reset by peer)
01:56:16FromDiscord<nikki> i feel like in your particular scenario too, especially with geometry stuff like line segments or vectors, math literature is usually written as `dot(a, b) = a.x b.x + a.y b.y + ...` and not `dot(self, b) = self.x b.x + ...` -- so it just feels like the actual normal approach to writing something
02:17:19FromDiscord<For Your Health> Also another aspect I thought of is for named arguments since nim allows them. Self isn't the best for named arguments if you use it that way.
02:18:25FromDiscord<nikki> that's a great point actually yeah
02:18:51FromDiscord<nikki> and in that case, clearly `copy(source = a, destination = b)` is nice for example
02:19:05FromDiscord<nikki> even if you could think of a copy as a method on the destination
02:20:58FromDiscord<For Your Health> I think Rust is where I was mainly getting it from. They use self in idiomatic Rust.
02:21:23FromDiscord<cabboose> ok so I've determined the issue lies in either nims encoding of strings or the mysql connection thinking the encoding of my upload is something other than what it is
02:21:25FromDiscord<For Your Health> And that was my most recent language I was using before nim
02:22:14FromDiscord<nikki> @For Your Health it makes a lot of sense in rust i think because of not having ufcs and also because trait objects are dynamically dispatched on that self arg
02:24:12*lritter joined #nim
02:24:38*mfiano quit (Quit: WeeChat 2.9)
02:24:57*jxy quit (Quit: leaving)
02:25:14*jxy joined #nim
02:25:57*mfiano joined #nim
02:26:12FromDiscord<For Your Health> Yeah, I do like Nim's approach better I think though. The idea of having calling functions with the dot syntax being a syntax sugar thing is pretty cool. Although I guess you have to manually specify when you want dynamic dispatch as a result.
02:27:51*apahl quit (Ping timeout: 272 seconds)
02:29:09*apahl joined #nim
02:47:22FromDiscord<Quibono> Is it insane to try and write an arbitrary precision floating point library as a newb? I feel like I could do it, I just expect it'll be hella slow.
02:57:15disruptekpretty much, yes.
02:57:49*lritter quit (Ping timeout: 264 seconds)
03:00:24FromDiscord<Daniel> what is "sugar" in this context you speak of?
03:00:59FromDiscord<Quibono> Pretty much insane disruptek?
03:07:02FromDiscord<For Your Health> I'm referring to method call syntax, which lets you do `foo.bar` instead of `bar(foo)`
03:18:38FromDiscord<cabboose> ok so the issue looks like db_mysql is sending the string as bytes, but converting the ":" to "58" and then turning the "58" into bytes and sending it?
03:18:46FromDiscord<cabboose> does this have something to do with dbQuoting?
03:18:58FromDiscord<cabboose> anyhalp?
03:22:30FromGitter<iffy> How do I iterate over a list of procs, calling each one? https://play.nim-lang.org/#ix=2FgB
03:22:53FromDiscord<ElegantBeef> I havent ever touched DBs but there is probably an escape sequence for special characters
03:23:51*filpAM quit (Ping timeout: 256 seconds)
03:24:13FromDiscord<ElegantBeef> iffy looks like you just need to convert https://play.nim-lang.org/#ix=2FgC
03:24:51FromGitter<iffy> ElegantBeef, oh weird; I didn't think of that. I just found `nimcall`: https://play.nim-lang.org/#ix=2FgD Is one better than the other?
03:25:09FromDiscord<ElegantBeef> Nimcall is probably cleaner
03:25:26FromDiscord<cabboose> This is aids; for speeds sake I’ll probably have to just ignore the special characters until the app is functional as this is a barrier preventing this from enterprise usage
03:25:31FromDiscord<cabboose> 😂
03:31:19disruptekquibono: yes; it has been done too many times.
03:35:04FromDiscord<nikki> @For Your Health oh yeah. yeah all other things considered equal, definitely prefer ufcs. mostly meant that -- the self thing starts to make sense specifically within the no-ufcs scenario. re: dynamic dispatch, just given the kind of stuff i tend to work on i can / want to just hold onto some procs and call 'em usually
03:35:55FromDiscord<Quibono> @disruptek Are there helpful projects for a nim beginner to work on then?
03:37:30FromDiscord<nikki> but yeah specifically without ufcs -- a method-y proc has this namespace surrounding it at the syntax level that binds what data it's about (like literally needing to nest member fns within the struct's { } in c++ for example) and also identifies the proc (the symbol is `Foo::bar` not just `bar` at the module scope) -- at that point the special-ness of `self` isn't out-of-place
03:45:54disruptekyes; tell us what sucked when you were learning nim.
03:47:15disrupteknimble has a ton of open issues. if you don't like the code, i have a lot of simple projects with open issues. i don't really write complex stuff.
03:49:32FromDiscord<Quibono> Mhmm, most of what 'sucks' has been like explanatory content, less so code.
03:53:16disruptekyou could create a PR to change occurences of `countup` in the compiler to `countUp`.
03:56:49FromDiscord<Quibono> Lol what is Dim?
03:57:11FromDiscord<Quibono> You only have "an experimental language" written down
03:57:39disrupteki was playing with different languages for a GA project.
03:57:45FromDiscord<nikki> maybe it's like https://en.wikipedia.org/wiki/Dumb_Starbucks
03:57:51disruptekjust gonna use nim for fun factor, i think.
03:58:14disruptekdim might be a stripped-down version that just runs in an accelerated vm.
03:59:36FromDiscord<Quibono> GA?
03:59:48FromDiscord<Quibono> So like a limited subset of vim that is /faster/?
04:00:02disruptekgenetic algos.
04:01:12disrupteki'm not sure i want to fuck around with actually compiling the algos. i haven't really decided. i might actually just write incremental compilation cache files directly instead of going through the vm.
04:01:39FromDiscord<Quibono> Ahh, cool. Yeah I've wanted to play around with that, but all sorts of AI/ML topics seem... kinda daunting.
04:02:00disruptekneural nets are pretty boring, ime.
04:02:38FromDiscord<Quibono> Have you tried like NEAT?
04:02:45disrupteknope.
04:04:49disruptekwell what is it?
04:05:30disruptekoh right.
04:05:51disrupteki'm not against NN, i just don't find they make fun players.
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:34*supakeen joined #nim
04:07:50FromDiscord<Quibono> So what sort of things do you like within GAs?
04:08:02FromDiscord<Quibono> It's a field I'd love to learn more about
04:09:23disrupteki dunno, i feel like development has been pretty stagnant but i don't follow it closely, so take that with a grain of salt.
04:10:10disrupteki had a lot of fun with a program called tierra a few decades ago.
04:10:34disrupteki'd like to build something at cloudscale using nim as the language.
04:12:07FromDiscord<Quibono> Tierra looks interesting, I played around a bit with Darwinbots, which had a similar idea.
04:12:15FromDiscord<Quibono> A cloudscale GA thing?
04:12:20disruptekah, yeah, i vaguely remember that.
04:13:27disruptekwhenever i play path of exile, i think about writing the program that discovers new techniques for me.
04:13:53disrupteki think it has to be a GA.
04:16:14FromDiscord<Quibono> I wish PoE was less clickspammy, that was my biggest issue with it
04:16:34disruptekwhat is clickspammy?
04:16:55FromDiscord<Quibono> It just feels like you're having to click a ton.
04:17:01FromDiscord<Quibono> Which as I get older is more annoying.
04:17:12disruptekhuh. how old are you?
04:17:29FromDiscord<Quibono> Lol 24, I've got wrists of wet noodles.
04:17:32disrupteki mostly just drag in that game.
04:17:57disrupteki've blown out both my wrists working on cars and had surgery on one of them.
04:19:14FromDiscord<Quibono> Nice, I've not had to do surgery so far, but had a few times where I was double wrist bracing it lol.
04:19:59disruptekmy wrist was immobilized for so long that i lost the wrinkles where hand turns into arm.
04:20:05disruptekit was pretty creepy looking.
04:20:23FromDiscord<Quibono> Oh damn, yeah that sounds creepy.
04:20:34FromDiscord<Quibono> Kinda freaking me out to think that the wrinkles can go away
04:20:55disruptekone of those super weird things that just looks inhuman.
04:21:05disrupteklike my 14" cock, y'know?
04:21:34FromDiscord<Quibono> Inches, milimeters...
04:22:27disruptekit was a porsche shop, so.. metric. but when you do a lot of machining work, everything is in inches. annoying.
04:24:27disruptekanyway, poe just strikes me as a very solvable set of problems.
04:24:40FromDiscord<Quibono> Like optimizing the builds?
04:24:45disruptekyeah.
04:25:08FromDiscord<Quibono> Is there an easy way to scrape the item/ability data?
04:25:11disruptekit's not like eve online where the mathematic underpinning is designed to ruin your day.
04:25:35FromDiscord<Quibono> Lol, I wish EVE was okay with botting, now that I can code some I'd love to do a trading bot.
04:25:49disruptekall the data is available either from the web-site, the raw files, or other tools.
04:26:07FromDiscord<ElegantBeef> Yea space engineers is pretty interesting in that regard, but it's just a sandbox
04:26:18disrupteki did some trade route generators for eve a few years ago.
04:26:23FromDiscord<ElegantBeef> Can program AI if you really wanted to for specific tasks
04:27:11*vicfred quit (Quit: Leaving)
04:27:16disruptekeverything's different in eve now. not that i don't want to take another crack at it.
04:28:50disruptekhmm, i'll have to look at space engineers.
04:29:50disrupteklooks super crude.
04:30:51disruptekprobably too small a playerbase, too.
04:31:11FromDiscord<ElegantBeef> Not an MMO
04:31:13disrupteki only got into PoE because i was watching their dev videos.
04:31:23FromDiscord<ElegantBeef> It's very much a small player coop sandbox
04:31:31FromDiscord<ElegantBeef> So exactly not much like Eve
04:31:49FromDiscord<ElegantBeef> Though it has programable blocks, so you can program ships to do specific things
04:32:24disruptekit doesn't look like it'll surprise me, though.
04:33:50FromDiscord<Quibono> Hrmmm, dwarf fortress?
04:34:12disruptekyeah, that's another good one. not enough visibility, though.
04:35:09FromDiscord<Quibono> visibility how?
04:35:50disruptekwell, originally i was trying to come up with a good project for streaming.
04:36:27FromDiscord<Quibono> Ahh.
04:36:29disruptekthe idea was that i'd write something like a WoW market maker and then show it working on-stream.
04:37:00disrupteklike, spend 80% of the stream building it and 20% showing it working.
04:37:40disruptekthen release it monetized with ads or something.
04:38:38disrupteki keep gravitating to poe because i wanna work for them and their mechanics are complex enough to form a tech moat that keeps the competition at bay.
04:41:39disrupteki think i can break their game. i wanna try.
04:44:19FromDiscord<SirJosh> sorry for a bit of a noobish question, but i'm going to write a unix-esque cli utility which i'll primarily test it by feeding input to it via stdin & calling it with args, and then checking the output. how should i go about testing it? im new to using testament or unittest or whatever (sorry, just don't nkow the direction i should go in for this)
04:44:51disruptekuse unittest and ignore the recommendation for testament -- it was written by a compiler author who hates unix.
04:45:40disruptekit would work for you but basically, it's too alien.
04:46:11FromDiscord<ElegantBeef> How can you hate unix
04:46:37disruptekhe hates all oses; he just hates windows less.
04:47:16FromDiscord<ElegantBeef> That's objectively the wrong way about hating oses
04:48:06FromDiscord<ElegantBeef> @dom96 @treeform one of you schmucks want to add some nim branding to the subreddit? 😛
04:48:43FromDiscord<nikki> hating on unix is pretty big in the unix sphere
04:48:58disruptekit's boring, honestly.
04:49:22FromDiscord<nikki> time to run nim on plan9 or templeos
04:49:29FromDiscord<nikki> or just nimkernel
04:49:34FromDiscord<nikki> a unikernel lib that comes with the stdlib
04:49:46disrupteki think i'd rather get work done.
04:50:06FromDiscord<ElegantBeef> then you got those musl or broke guys ;D
05:17:04*leorize joined #nim
05:19:17*NimBot joined #nim
05:19:54FromDiscord<nikki> right, what's the syntax for specifying the fields?
05:20:11disruptekit's not anonymous; it's a generic.
05:20:19disruptekenum is a typeclass.
05:20:43FromDiscord<nikki> oh i was asking if i can define an anonymous enum type in a proc tho
05:20:50disruptekyou cannot.
05:24:11leorizethere's no such thing as an anonymous enum (though I guess in a way you can count `int` as one)
05:38:17*waleee-cl quit (Quit: Connection closed for inactivity)
05:39:34FromDiscord<nikki> if you count those then `range[a..b]` seems pretty anonymous too
05:40:30leorizeI don't see the point of erasing the type of enums though :P
05:40:50disruptekchuckleheads gonna chuckle.
05:42:17FromDiscord<nikki> mostly -- had this one proc for loading scenes in a game like `load("beach")` or w/e. and it keeps track of all scene names available by reading the assets dir too. and `load(Next)` / `load(Prev)` woulda been nice with `enum[Next, Prev]` in a proc and not needing to make a `LoadDirection` enum just for this one proc
05:42:48FromDiscord<nikki> i'm going with `load(range[-1..1])` for now which also allows restarting the current scene i guess lol
05:43:13leorizeit never hurts to make enums :P
05:43:22leorizeit's not like those are even expensive
05:43:40leorizeand you can put the declaration right on top of the proc for all that matter
05:43:50FromDiscord<nikki> yeah i'd've done that if i had to
05:43:59FromDiscord<nikki> but `range[-1...1]` isn't actually bad
05:44:08FromDiscord<nikki> it maybe conveys the intent here i guess? lol
05:44:29FromDiscord<nikki> also bc. `currIndex + param` ends up being the new index (with wrap around)
05:45:00leorizeso now you gotta document this magic parameter that takes seemingly arbirtary numbers?
05:45:07leorizewhich basically is an enum :P
05:46:14FromDiscord<nikki> nah, i don't, because it documents itself
05:46:45leorizemy experience with "documents itself" is that nothing ever does
05:46:46FromDiscord<nikki> mainly idk if i'm gonna stick with this proc, just needed it for some quick scene switching ui that i may throw away soon
05:47:08FromDiscord<nikki> sure, if i had to write crappy open source libraries for other people to use then yeah
05:47:28FromDiscord<nikki> i'd do that by not documenting them
05:48:20FromDiscord<nikki> probably really need to just have a `loadPrev` and `loadNext` proc anyways xD
05:48:38leorize:p
06:06:22*narimiran joined #nim
06:12:27*vicfred joined #nim
06:18:19*bung joined #nim
06:34:32*narimiran quit (Ping timeout: 260 seconds)
06:35:35*narimiran joined #nim
06:43:37*vicfred quit (Quit: Leaving)
06:50:44FromDiscord<mratsim> @eagledot yes I'm active on Arraymancer channel, but was off for 10 days
07:01:25*Cthalupa quit (Ping timeout: 264 seconds)
07:02:38*Cthalupa joined #nim
07:24:49*habamax joined #nim
07:39:50FromDiscord<cabboose> is there anyway to edit the std library for our nim install?
07:40:14FromDiscord<Rika> just edit it
07:40:22FromDiscord<cabboose> que?
07:40:25FromDiscord<cabboose> where is it
07:40:27FromDiscord<Rika> oh
07:40:29FromDiscord<Rika> thats what yo umena
07:40:30FromDiscord<Rika> mean
07:40:40FromDiscord<cabboose> because im using choosenim im a bit lost
07:41:13FromDiscord<Rika> its in your home folder, .choosenim i think then toolchains
07:41:31FromDiscord<cabboose> found it cheers
07:44:55FromDiscord<cabboose> this seems to be the bastard line
07:44:56FromDiscord<cabboose> result.add "\\" & $ord(c)
07:48:37FromDiscord<Rika> banned
07:48:44FromDiscord<Rika> what are you trying to do?
07:49:33FromDiscord<cabboose> im updating MySql db with entries containing special characters, for instance: "78:PER"
07:49:56FromDiscord<cabboose> gets dbQuoted to "78\58PER"
07:50:06FromDiscord<cabboose> and then reflects in my db as "7858PER"
07:50:27FromDiscord<cabboose> sorry dbQuoted to "78\\58PER" if you want to take into account escapes
07:51:57FromDiscord<cabboose> the cheat sheet the block is based off says any ASCII character under 256 should just be escaped with "\c" where c is the character
07:53:12*lritter joined #nim
07:53:40FromDiscord<cabboose> but im not that well read on issues surrounding SQL injection so I'm not sure if theres a reason or a method to the madness but the current dbQuote block just converts all the special characters to UTF-8 Dec values which is just sent on through
08:07:53*PMunch joined #nim
08:19:34*haxscramper joined #nim
08:26:27haxscramperI have two template overloads - first with two `untyped` parameters, and second with `a: untyped, b: int`. https://play.nim-lang.org/#ix=2Fhx . I get `undeclared identifier` error when trying to call `test(12, it + 2)` - it seems like compiler is trying to use `<untyped, int> version of the template even though `<untyped, untyped>` qualifies perfectly fine. From my understanding all-untyped template should trigger immediately, or at
08:26:28haxscramperleast before semantic checking.
08:26:28haxscramper
08:26:28haxscramperI also tried to use `{.immediate.}` pragma but got `Error: cannot attach a custom pragma to 'test'`.
08:27:55haxscramperMy original use case has templates with different number of arguments, so I can probably make all arguments untyped, but I'd rather prefer to have less drastic solution.
08:31:21FromDiscord<lqdev> .immediate was replaced by untyped
08:32:43FromDiscord<lqdev> the compiler always tries to match the most specific overload, so `<untyped, int>` takes precedence over `<untyped, untyped>`
08:54:04FromDiscord<shad0w> i am trying to run nimlsp on emacs in windows
08:54:17FromDiscord<shad0w> it works on the same machine when i use linux
08:54:24FromDiscord<shad0w> but on windows. nada
08:54:58FromDiscord<shad0w> emacs has lsp-mode installed and working. it shows `connected`. nimlsp seems to be in path aswell
08:55:16FromDiscord<shad0w> everything seems to be working. yet no autocomplete or anything
09:01:47PMunchHave you tried enabling logging for nimlsp and see if it says anything?
09:03:59FromDiscord<shad0w> i tried removing nimlsp
09:04:08FromDiscord<shad0w> nimble says permission denied
09:04:15FromDiscord<shad0w> im looking if that'd be the issue
09:04:43haxscramperDoes nimlsp have the same issues as nimsuggest, or it somehow manages to avoid them? (I know it is built on the same code base so I suppose there is no different, but I want to confirm).
09:05:41PMunchhaxscramper, depends on which issues you are thinking about
09:05:58FromDiscord<shad0w> sent a code paste, see https://play.nim-lang.org/#ix=2FhJ
09:06:04PMunchBut in general nimlsp is by design a thin wrapper around nimsuggest
09:06:09FromDiscord<shad0w> then a bunch of same cancelling statements
09:06:10haxscramper100% cpu usage, needs to kill it repeatedly and so on. I mean stuff mentioned in #16001
09:06:11disbothttps://github.com/nim-lang/Nim/issues/16001 -- 5Nimsuggest sucks, but newcomers use it
09:06:24FromDiscord<shad0w> thats the lsp-log
09:07:07PMunch@shad0w, why is it calling it `nimls`?
09:07:22haxscramperAnd other common complaints about nimsuggest. I also want to try nimlsp with emacs sometimes later
09:07:44PMunchhaxscramper, yeah all those should be present in nimlsp, but I haven't noticed too much of them
09:07:50FromDiscord<shad0w> PMunch: i have no idea. that's what i got by default
09:08:32PMunchSeems like a type in your emacs config
09:09:13FromDiscord<shad0w> the only relevant config i did here was add hook to lsp on nim-mode
09:09:30FromDiscord<shad0w> could this be a lsp-mode error ?
09:10:54PMunchNo idea TBH, I don't know anything about Emacs system for plug-ins
09:11:56FromDiscord<shad0w> not any different from vscode plugins i guess? you install them, configure them and hope that theyr un
09:12:11FromDiscord<shad0w> which reminds me. i have no completion in vscode either
09:12:16FromDiscord<shad0w> fml
09:12:47FromDiscord<ElegantBeef> do you have nimsuggest installed?
09:13:22FromDiscord<shad0w> i saw the exe in the nimble bin folder
09:13:27FromDiscord<shad0w> so, must be ?
09:13:29FromDiscord<ElegantBeef> is nimsuggest in your path
09:13:43FromDiscord<shad0w> yeap
09:13:57FromDiscord<ElegantBeef> Then vscode Should work afaik
09:14:26FromDiscord<shad0w> i get nothing
09:14:39FromDiscord<shad0w> but vscode and emacs are installed in D:/
09:14:47FromDiscord<shad0w> while all nimble stuff is in C:/
09:15:08FromDiscord<shad0w> and i cant seem to figure if this is a stupid pemission issue
09:15:15FromDiscord<shad0w> permission
09:18:05PMunchnimlsp doesn't require nimsuggest by the way
09:21:40FromDiscord<shad0w> https://github.com/emacs-lsp/lsp-mode/blob/3a59fc1d7fd6f2635caa4ebc1dbbf154bd17a718/clients/lsp-nim.el#L35-L39
09:21:53FromDiscord<shad0w> looks like nimls is just the server-id ?
09:22:10FromDiscord<shad0w> that shouldn't screw anything up i guess
09:22:44PMunchRight
09:27:24FromDiscord<shad0w> lmao
09:27:37FromDiscord<shad0w> switched to devel on choosenim
09:27:45FromDiscord<shad0w> now vscode completion works
09:27:49FromDiscord<shad0w> emacs still nada
09:27:57FromDiscord<shad0w> but its progress lol
09:34:56*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:40:30PrestigePMunch: I thought nimlsp uses nimsuggest?
09:43:40PMunchIt uses it as a library
09:43:45PMunchSo it is compiled into nimlsp
09:44:10PMunchSo it doesn't need the nimsuggest binary to exist
09:46:30PrestigeAh I see what you mean
09:59:25Zoom[m]Is there any build-in way to reverse the iterator when it's possible (like arrays)?
09:59:38Zoom[m]It's strange that iterators like filter take arrays
09:59:49Zoom[m]and not iterators
10:09:16PMunchNo there is no built-in way to reverse an iterator
10:09:28PMunch(And it's not really something that could be implemented either
10:14:32*Vladar joined #nim
10:17:09Zoom[m]I think it could with Concepts. But I'm not sure how experimental they are still
10:19:44FromDiscord<haxscramper> To reverse iterator you need just reimplement it with different order, or collect results into intermedate sequence and traverse it from the end.
10:19:47Zoom[m]I mean, probably not the part of taking an iterator...
10:20:16FromDiscord<haxscramper> For filter on iterators there is `mapIt`, `filterIt` and so on
10:23:39planetis[m]does manually calling `=destroy`(a) need to be accompanied with wasMoved(a) nowadays?
10:27:01planetis[m]im dumb, i should have set up ci for my package, now its broken and don't know what's going on
10:37:17FromDiscord<AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=2Fi5
10:39:35FromDiscord<AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=2Fi7
10:40:08FromDiscord<AmjadHD> Why is that ?
10:42:30FromDiscord<lqdev> i think you're supposed to use `nim e` to execute nims files
10:44:03planetis[m]do you get an exec?
10:46:06FromDiscord<iWonderAboutTuatara> So I've managed to get an (apparently) bugless rubiks cube representation running
10:46:46PMunchThat is a tad weird @AmjadHD, but I'm guessing Nim reads the .nims file as the configuration file (because it does that when there is a file named <project>.nims) when it is compiling.
10:46:52FromDiscord<iWonderAboutTuatara> With all rotations, an easy way to print it, and such
10:46:58FromDiscord<iWonderAboutTuatara> How do I make this a module?
10:47:00PMunch@IWonder oh cool
10:47:08FromDiscord<iWonderAboutTuatara> Thanks lol
10:47:10PMunchAre you writing a solver?
10:47:15FromDiscord<iWonderAboutTuatara> Eventually
10:47:29FromDiscord<iWonderAboutTuatara> By eventually I mean pretty much asap so yeah
10:47:42FromDiscord<iWonderAboutTuatara> Not an original method though
10:48:08FromDiscord<iWonderAboutTuatara> I'll just use thistlewaite to avoid dealing with pruning tables
10:48:32FromDiscord<iWonderAboutTuatara> Anyway, how do I make this as a Nim module?
10:48:39FromDiscord<iWonderAboutTuatara> That can be imported by other files etc
10:48:48FromDiscord<iWonderAboutTuatara> Module is the wrong word, I meant library
10:49:19PMunchUhm, just make it a file?
10:49:30PMunchOr do you want a proper nimble module?
10:50:48FromDiscord<AmjadHD> @planetis yes
10:51:47planetis[m]so maybe it runs once in the vm and then gets compiled an the exec is run again
10:52:28planetis[m]does the same happen with nim e?
10:54:24FromDiscord<AmjadHD> No
10:54:41planetis[m]yay mystery solved
10:54:59planetis[m]good job team
10:55:48FromDiscord<AmjadHD> I thought of that but I was asking if it should behave like that ?
10:56:29planetis[m]well dont really know but I think not
10:56:48planetis[m]however nims files are run when you compile the .nim file
10:57:21planetis[m]so the compiler should try to catch you are trying to compile a nims file and prevent it
10:57:27planetis[m]or error
10:58:15FromDiscord<AmjadHD> Probably worth an issue.
10:58:53planetis[m]agreed
11:03:22FromGitter<eagledot> @mratsim hey....
11:03:38FromDiscord<mratsim> yep?
11:04:03FromGitter<eagledot> i also sent a message on arraymancer...may be not active on that right now?
11:05:35FromDiscord<mratsim> no not right now
11:05:40FromDiscord<mratsim> checking
11:17:55bung`Content-Disposition: form-data; name="field2"; filename="example.txt" `
11:18:06bungis the quote required or optional ?
11:18:47bungI've see boundary 's quote could be optional
11:24:48*luis2 joined #nim
11:34:44*luis2 quit (Quit: WeeChat 2.9)
12:02:14FromDiscord<inv> sent a code paste, see https://play.nim-lang.org/#ix=2Fiu
12:03:18FromDiscord<inv> the problem - if I add exportpy to inc proc - then I have No callable attribute: MyClass [Exception] on t.MyClass()
12:03:44FromDiscord<inv> oh, I forgot about irc<=>gate and copy-paste, sorry 😦
12:04:50PMunchDon't worry, the new bot automatically makes code pastes into links :)
12:06:01*supakeen quit (Quit: WeeChat 2.9)
12:06:20FromDiscord<inv> uff, nice. I just had idea to suggest to implement it 🙂
12:06:37*supakeen joined #nim
12:13:09*luis_ joined #nim
12:18:32*abm joined #nim
12:22:46FromDiscord<Vindaar> @inv so it works if the file exists before compilation, right?
12:25:02FromDiscord<inv> I tried it before I created the example which creates file - let me try one more time
12:25:37FromDiscord<Vindaar> ah, in my head I somehow though the `writeFile` was what caused the issues in the first place, sorry
12:26:51*koltrast quit (Quit: ZNC - http://znc.in)
12:28:29FromDiscord<Vindaar> I don't know if this can work in nimpy currently. `exportpy` is only required to handle the case when you want to compile a shared library from a Nim module to use from python iirc
12:28:38FromDiscord<inv> I would say I have two problems here:↵1) I mentioned↵2) I cannot export NimObj to python. I was trying to extend it from PyNimObjectBaseToInheritFromForAnExportedType and pyexportTypeExperimental - but did not help
12:29:41*koltrast joined #nim
12:30:02FromDiscord<Vindaar> what you want is to call python from nim, but the call a nim proc from python. Not sure if that can work. I'd search through the nimpy issues and see if something pops up. If not open one. yglukhov is really helpful 🙂
12:30:24*Vladar quit (Quit: Leaving)
12:31:16FromDiscord<inv> Thank you, I migrate from that's pyo3 and did not know that it's a special case - it worked there
12:31:29FromDiscord<inv> (edit) "that's" => "rust's"
12:31:53FromDiscord<Vindaar> oh, good to know that it worked there
12:32:02FromDiscord<Vindaar> that means it's not an inherent problem to the approach 🙂
12:32:27FromDiscord<inv> Also, I think that the implementation is not so good - probably better design would be to extend python class from nim base python-class
12:33:45FromDiscord<Vindaar> you mean the implementation of your code here?
12:35:11FromDiscord<Vindaar> The problem as I see it with your current code is that the Nim `inc` proc is not in any way attached to the `NimObj`. That means once you're on the python side there's no way for the `inc` to be visible, since it's not something attached to the pointer given to Python
12:35:31*luis_ quit (Quit: luis_)
12:35:58*luis_ joined #nim
12:36:49FromDiscord<Vindaar> When compiling a Nim module for python these things work, because each proc will be a symbol in the shared library. The problem is that `exportpy` cannot be used to register symbols from C at runtime to python as far as I know. I suppose that could work somehow though
12:59:51planetis[m]getType vs getTypeImpl how the differ? whats the recommended one?
13:27:54ZevvI always try them both and pick the one that gives the result I hope for
13:35:31*luis_ quit (Quit: luis_)
13:36:01*luis_ joined #nim
13:38:46*hmmm joined #nim
13:43:42FromDiscord<haxscramper> I also just try all possible combinations until it works, I still can't figure out how to /properly/ get implementation for `ref` type from symbol of that type. I ended up putting a lot of tests in https://github.com/haxscramper/hax-nim/blob/master/hack-test/get_type_impl.nim - can run & try to see what fits your use case
13:43:45FromDiscord<haxscramper> I usually do this
13:45:08planetis[m]thanks haxscramper
14:07:46*Torro joined #nim
14:11:15*Torro quit (Quit: Leaving)
14:11:30*Torro joined #nim
14:13:21*disruptek throbs.
14:15:46disrupteki heard a rumor that araq performs staircase traversal in log n time.
14:20:27Zoom[m]Hey chat, what do you think of Discord banning third-party clients?
14:21:40FromDiscord<Clyybber> disruptek: aka falling down?
14:24:34FromDiscord<Clyybber> eh nevermind
14:28:17PrestigeZoom[m]: they banned 3 of my accounts so I stopped using discord
14:28:39*rokups joined #nim
14:29:00Zoom[m]I'd be happy to not see that "From Discord" bridge here anymore ;)
14:29:40*hmmm quit ()
14:31:00Zoom[m]All the messages from Discord appear as sent from a single user with messages starting <ActualUser> . That's ugly. IRC bridges properly.
14:31:45Zoom[m]If you're interested why I'm talking about this: https://github.com/Bios-Marcel/cordless
14:32:14PrestigeYeah, I contributed to that project multiple times and know the developer
14:32:23PrestigeI think my accounts got locked from using it
14:32:58haxscramperHow expensive is generally (compilation and execution speed, ease of understanding for others) is to use callbacks for implementations everywhere. For example, now I'm writing tree diffing implementation. So, the problem is: it is not really possible to provide generic implementation for 'create new node', so I use callback. The same for setting value, deleting subnode etc. And In the end I have accumulated 4 callback procs. Maybe this
14:32:58haxscramperis not a lot, but still
14:33:38haxscramperAnd they will be called quite frequently too, although this is probably not that different compared to regular proc call.
14:34:53haxscramperE.g. maybe someone can suggest better alternative than passing 4+ callbacks to proc? Second alternative is to require implementation of some specific functions, but this is more restrictive requirements are not clearly stated in proc API
14:35:01FromDiscord<inv> @Vindaar Do you think the solution is possible? I compile my own base.pyd, inherit it in example.py and override some methods calling base methods. Then I call the method from nim, but the method calls base method, which calls nim function back somehow.↵↵run from nim: t.method1 => super().method1, which do something from initial "run from nim"
14:36:28haxscramperAnd implementing separate type/requiring users to derive from somethig is not an options, since I want to diff any tree type, not only specific ones.
14:36:47*waleee-cl joined #nim
14:38:21FromDiscord<lqdev> @Zoom unfortunately there isn't a better solution
14:38:41FromDiscord<lqdev> another one would be connecting a billion IRC users for each active user on IRC
14:38:45FromDiscord<lqdev> but that's just retarded
14:38:56FromDiscord<lqdev> and also what matrix-freenode bridge does
14:40:36Zoom[m]We could discourage users from using Discord for starters
14:41:12FromDiscord<lqdev> i'd rather discourage users from using matrix and gitter for starters
14:41:34FromDiscord<lqdev> look mate. i have all my contacts on discord
14:41:59FromDiscord<lqdev> i'm not gonna open a special browser tag just for this channel when there's clearly a better solution
14:42:05FromDiscord<lqdev> (edit) "tag" => "tab"
14:43:24Zoom[m]lqdev I'm not gonna try to dissuade you, I think when the critical mass of the users will be in other place, the problem will solve itself
14:44:26FromDiscord<inv> in favor of irc ? 🙂
14:44:34haxscramperIRC requries convoluted setup, doesn't adequately on mobile (i shuffled through five different clients until I found one that doesn't suck totally). Doesn't save history, no images, not multiline etc. Matrix is ... I know exactly zero people who use matrix. Gitter is better, but still. And discord is more popular, better suited for comminiti splits. I only use IRC sometimes becose emacs comes with client built-in and I have VIM keys for
14:44:35haxscramperediting messages.
14:44:55haxscramperSo if anything, discord is going to win over IRC/matrix/gitter
14:45:07haxscramper/especially/ for new users
14:45:27Zoom[m]haxscramper: there's at least leorize, planetis and me using Matrix
14:45:48haxscramperAnd 1000+ people on discord server?
14:46:00FromDiscord<inv> Why no one mentioned telegram?
14:46:45Zoom[m]inv, because it's irrelevant, I guess
14:46:48haxscramperBecause it is not bridged, and has somewhat separte community. Although I would probably advocate for bridge anyway
14:46:51FromDiscord<lqdev> telegram isn't bridged here
14:47:06FromDiscord<lqdev> the thing with discord is that everything is well-organized
14:47:12FromDiscord<lqdev> i can hop from main to gamedev without hassle
14:47:17FromDiscord<lqdev> that just doesn't apply to matrix and IRC
14:47:24FromDiscord<lqdev> and gitter doesn't have those channels at all
14:47:44haxscramperBut it has 650+ members, just dumping them here would create chaos *for some time*, but in the end it would not make any difference.
14:47:49Zoom[m]Gitter is now Matrix, right?
14:47:52FromDiscord<lqdev> no
14:47:58FromDiscord<lqdev> they have been bought by matrix
14:48:01FromDiscord<inv> Yep, it is the main reason I set the discord few days ago, with bridge to nim-channels I would not use anything except telegram on my pc and mobile
14:48:51Zoom[m]#nim:matrix.org is taken by Node.js Inspector Manager 🤦‍♂️
14:51:11*h2o2c2 joined #nim
14:51:127IZAACLGQI already did that for nim-science
14:51:127IZAACLGQalso you should point people to
14:51:127IZAACLGQ~matrix
14:51:127IZAACLGQoh no disbot is off
14:51:127IZAACLGQ+nim:asra.gr <- here then
14:51:13disbotmatrix: 11Nim channels on Matrix can be found at +nim:asra.gr (https://matrix.to/#/+nim:asra.gr)
14:51:49leorizewait what is this user name that I'm having lol
14:52:05h2o2c2hi, how can i compile nim1.2 with gcc4?
14:52:26*7IZAACLGQ is now known as leorize[m]
14:55:16leorizeh2o2c2: are you facing any errors?
14:55:28h2o2c2yeah: stdlib_system.nim.c:(.text+0x8010): undefined reference to `__builtin_smulll_overflow'
14:55:42leorizethat's during koch boot, right?
14:56:00leorizethen please add -d:nimEmulatedOverflowChecks to the command line
14:56:26h2o2c2it's when I download the nim package from the official site and run ./build.sh
14:56:27leorizeit should disable the faster integer overflow check that's only supported by gcc >= 6
14:56:36leorizeoh
14:56:48leorizethen you need the older csources
14:57:08leorizehttps://github.com/nim-lang/csources <- here it is
14:57:37leorizeclone it then run build.sh
14:57:52leorizethen copy bin/nim to the bin/ folder in the nim source you downloaded
14:58:27leorizethen cd to the nim source and run `bin/nim c koch`
14:58:38leorize./koch boot -d:release -d:nimEmulatedOverflowChecks
14:58:46leorizeshould get you a working compiler
14:58:51narimiranor don't use gcc from 2005
14:58:53*narimiran hides
14:59:22h2o2c2thanks @leorize! @narimiran we're on centos6
15:00:14leorizeh2o2c2: you'll want to add "define=nimEmulatedOverflowChecks" to config/nim.cfg so it's applied to all invocation of the compiler
15:00:37narimiranh2o2c2: centos6, which will be outdated in exactly 6 days? :P
15:00:58leorizeand I'd recommend updating gcc though, afaik centos has toolchain backports?
15:01:16h2o2c2I've no power over the platform, the migration is slow
15:06:28h2o2c2it worked, thanks again, @leorize!
15:06:54leorizeyou're welcome :)
15:07:35disruptekdiscord will never beat an open platform if i can help it.
15:08:37disruptekmaybe they will develop the market and let an open upstart take it from them overnight.
15:09:57*h2o2c2 quit (Remote host closed the connection)
15:10:49Prestigedisruptek: I'm hoping matrix and element get their shit together and take over
15:11:38leorizeelement seems to be going on the right track, they're basically cloning discord at this point :P
15:11:42disruptekyeah.
15:12:02PrestigeYeah, it's just.. very buggy, right now
15:12:08*habamax quit (Quit: leaving)
15:12:29disruptekit's hard to believe such a simple fucking thing is so hard for millenials.
15:12:41*habamax joined #nim
15:12:48*xet7 joined #nim
15:13:41Prestigecreating the application?
15:13:49disruptekreplacing irc.
15:13:56Prestigeah.
15:14:30PrestigeI feel like discord and slack are very similar. I don't like either of them though
15:14:41disrupteknah; they suck for the same reason.
15:15:25disrupteklqdev: if you weren't tethered to your browser, you might feel differently.
15:16:28FromDiscord<inv> unfortunately discord is not so good on mobile, on PC is it not perfect also
15:16:58disrupteki vibrate enough testicles; no one needs me in their pocket.
15:17:39PrestigeIt felt fine on mobile for me, as in not buggy. It seems worse on the desktop
15:20:16FromGitter<iffy> My macro is making some AST with idents, but expandMacros is showing that a suffix "_18095001" is being added to the ident. Can I prevent that? I'm using `ident("MyThing")`
15:20:29bunghow to get array of char element mutable addr ?
15:20:53disruptekiffy: don't use genSym if you don't want a unique symbol.
15:20:53leorizebung: wdym?
15:21:36bunga proc need `var ptr char`
15:21:39disruptekiffy: wait, are you using these idents in the backend?
15:21:50FromGitter<iffy> in a macro, yes
15:21:54bungI dont know how to pass my array of char to it
15:21:56leorizebung: so what are you trying to do?
15:21:57disruptekthen you have to export them.
15:22:05leorizetry getting rid of `var` :P
15:22:07disruptekelse normal mangling will take place...
15:22:14FromGitter<iffy> export them with '*'?
15:22:21disruptek.exportc
15:22:46disruptekis this android?
15:22:57bungif i get rid of var can that ptr char move ?
15:23:19bung`buf += 1` inside that proc
15:23:56FromGitter<iffy> disruptek: no, normal computers (macos)
15:24:10FromGitter<iffy> let me make a small example (exportc didn't work)
15:24:31disruptekwhen i say, "using it in the backend", i mean, via export to C.
15:27:32bungeditor hints me can't move then
15:28:47FromDiscord<flywind> Hi, what does this mean here? ↵> This implementation was extracted rom the Mongodb interface and it thus binary compatible with a Mongo OID.
15:28:49FromDiscord<flywind> https://github.com/nim-lang/Nim/blob/d306a04466b7f1129620dc3ab35443119ed4c867/lib/pure/oids.nim#L13
15:29:16disruptekit means the datatype is designed to match that of mongo's oid.
15:29:31disrupteklike, bit-for-bit, an' shit.
15:29:54FromDiscord<flywind> I see, thanks
15:30:29FromGitter<eagledot> what would be equivalent of something like ``union{ int i; char str[20];} in C code `` in nim ?
15:30:55disruptekrtfm object variants.
15:31:23disruptekbut if you don't want a discriminator, you're going to need to cast it around.
15:31:35leorizebung: assign the pointer to a var
15:31:45leorizebetter yet, cast it to `ptr UncheckedArray[char]`
15:31:52narimirandisruptek: irc-bot idea: when you type "RTFM <topic>", it gives you the link to the manual
15:31:54leorizebecause pointer math is ugly
15:32:18disrupteknarimiran: i know. i wrote a google api for it but i never bothered to put it in the bot.
15:32:28FromGitter<eagledot> i am trying to create bindings to some library, how to create something in nim ,that can be passed to C function?
15:32:35FromDiscord<flywind> sent a code paste, see https://play.nim-lang.org/#ix=2FjJ
15:33:11FromDiscord<flywind> (edit) "https://play.nim-lang.org/#ix=2FjJ" => "https://play.nim-lang.org/#ix=2FjL"
15:33:11FromGitter<eagledot> Thanks, i was looking for a union pragma ..
15:34:36disruptekholy shit, i totally missed that.
15:35:21disruptekwhy is it on the symbol? bleh.
15:35:36*luis_ quit (Quit: luis_)
15:35:44bungleorize yeah, assign to a var works
15:41:00FromDiscord<For Your Health> What's the general way of dealing with division by 0 in a proc? So say you have a function that calculates the slope of a line, you can get an infinite slope. Do you just let the caller deal with it as is?
15:41:27disruptekwhat is infinite slope?
15:42:02FromDiscord<For Your Health> A vertical line
15:42:21disruptekwhy wouldn't you want those? they are super useful.
15:42:30leorizeif it's floating point then you can always return Inf
15:42:46disruptekleorize is trolling you.
15:43:34FromGitter<iffy> disruptek: aha, it's because I put stuff in a block: https://play.nim-lang.org/#ix=2FjQ in that example the Bob type is named "Bob" but the Another type is named "Another_4855001". Can I tell it to use "Another" even though it's in a block?
15:43:52FromDiscord<For Your Health> In the calculation you end up dividing by 0 if the line is vertical. It doesn't crash though and returns inf if you don't deal with it. I was just wondering if it is customary to do that
15:44:05FromDiscord<For Your Health> And let the caller deal with the inf
15:45:09disruptekiffy: wtf.
15:46:21disruptekhealth: it's customary for the programmer to tell the computer what to do.
15:46:21*Vladar joined #nim
15:46:31disruptekiffy: hard not to see this as a bug.
15:51:32FromDiscord<For Your Health> I'm just wondering if it's normal to pass around infinity in Nim, or if you handle it when it's generated.
15:51:54disrupteki've tried to handle infinity, but i ran outta hands.
15:52:19leorizeiffy: looks like a bug to me, that symbol should not be gensymed
15:52:54leorize@Health my guess is that it's normal but you should ask the #science folks for more info
15:53:20leorizemy expectations would be to get inf
15:53:37leorizebut the people who do actual maths might think otherwise
15:55:23FromDiscord<For Your Health> I guess I'll roll with it for now and change it if I get problems
16:04:32ForumUpdaterBotNew thread by Alexiss: Compile-time import, see https://forum.nim-lang.org/t/7150
16:05:01*PMunch quit (Quit: leaving)
16:05:26disruptekwhy do you hate me so much?
16:08:24FromGitter<alehander92> disruptek
16:08:28FromGitter<alehander92> we love you
16:08:30FromGitter<alehander92> so much
16:08:33FromGitter<alehander92> why do we love you so much
16:08:36FromGitter<alehander92> is another question
16:08:39narimiranlove overflow
16:08:44narimirannow we hate you very very much
16:08:46FromGitter<alehander92> i just watched news from 90s
16:08:50disruptekdamnit.
16:08:52FromGitter<alehander92> it was a wild time
16:09:00FromGitter<alehander92> here people in strange clothes
16:09:11supakeenthe 90s were the best
16:09:20FromGitter<alehander92> coupons and eating empty bowls with "if you dont vote you shouldn't eat"
16:09:41disruptekthe world really took a turn for the worse when i was born.
16:09:57supakeenback when video was still in a proper 4:3 format
16:09:58FromGitter<alehander92> pmunch do you habe a beard still
16:10:23narimiransupakeen: and computers had TURBO button!
16:10:24*habamax quit (Quit: leaving)
16:10:29supakeenTURBO
16:10:38FromGitter<alehander92> RFC WHEN
16:10:48supakeenotherwise your games played too fast!
16:11:02disruptekyeah, great.
16:11:06supakeeni always liked that the turbo did the exact reverse
16:11:08FromGitter<alehander92> turbo pascal turbo button, ppl were very cute back then
16:11:11supakeene.g. clock down to 4.7 mhz
16:11:39FromGitter<alehander92> imagine `turbo call()` making your code aritifically sslow
16:11:41supakeenand you had a little segment display if you were lucky to show current clock speed!
16:11:50FromGitter<alehander92> inserting `sleeps` at different points
16:12:02narimiranand only the meanest cars had turbo, not like today
16:12:42disruptekError: unhandled exception: /home/adavidoff/git/Nim/compiler/modulegraphs.nim(419, 16) `false` imagine the two of us, meeting like this [AssertionDefect]
16:12:57disruptekdon't use drugs, kids.
16:12:58supakeenand seatbelts weren't mandatory on the back seat of cars :D
16:13:12disruptekin the '90s, my cars didn't have back seats.
16:13:24narimiransupakeen: and pop-up headlights were still legal!
16:13:31narimirandisruptek: do tell more!
16:13:40disruptekMK1 MR-2
16:13:48narimiranooooooooooooooh niiiiiiiiiiiiceeee
16:13:56disruptekactually, my 911 doesn't have rear seats.
16:14:20disruptekMKIV Supra TT.
16:14:34narimiranso you went from mid-engine to rear-engine? you definitely are special!
16:14:36ForumUpdaterBotNew thread by Xigoi: Custom source code filters?, see https://forum.nim-lang.org/t/7151
16:14:49disruptekthe Corrado had rear seats, basically.
16:15:07narimiranok, now i want to know ALL the cars you had/have!
16:15:59disruptekwell, i bought and sold sportscars for awhile.
16:16:41disruptekbefore focusing on porsche, i mean.
16:17:08disruptekpop-up headlights are illegal now?
16:17:19narimiranillegal for ~20 years, i think
16:17:27disruptekwhy is that?
16:17:35narimiranmiata NB (released in '99) already didn't have them
16:17:41narimiranbecause of pedestrian safety
16:18:02disruptekpeople shouldn't be walking on my headlamps.
16:18:11narimiran:D
16:18:34narimiranwhat generation of 911 do you have?
16:18:34disrupteki had a supercharged miata M.
16:19:09disrupteki've owned everything through the 997.
16:19:13narimiranspecial again! everybody is turbocharging them, you do a supercharger
16:19:38disruptekwell, the SC was just better for getting the car moving.
16:19:51narimiranopinion about water-cooled 911s?
16:19:52disrupteka turbo is cheaper and easier, though.
16:20:37disruptekthe water-cooled cars are great, honestly.
16:20:54disruptekbut the air-cooled cars are just so much more entertaining in any dimension.
16:21:08disruptekmore fun to hack, more fun to drive, more fun to play with.
16:22:04disrupteki have a '76 with a 993 engine that is getting snowed on right now. stripped out racer with r compound tires. i'm pretty well fucked.
16:22:40*narimiran is not jealous at all
16:23:10narimiranso, most fun non-porsche car?
16:23:33FromGitter<iffy> @leorize a bug worth filing?
16:23:38disruptekthat's a great question.
16:23:48disruptekiffy: yep.
16:23:55narimirandisruptek: should we switch to PM? :)
16:24:04disrupteknah, fuck them kids.
16:24:27disrupteki had a datsun 210 that was a total piece of shit.
16:24:36disrupteki bought it for $300 plus $80 for a new battery.
16:24:57narimirandisruptek: see telegram :)
16:24:59disruptekthe car had holes everywhere. you could take a leak through the floorboard while driving along.
16:25:28disruptekgreat car to really wring the nuts off with.
16:26:44disrupteki would say the MR2 might be the most fun.
16:27:14disruptekmy buddy bought one a few years ago, it was a total blast from the past to drive it.
16:28:02FromDiscord<exelotl> lmao are we really arguing about tabs vs spaces on the forums again
16:28:14disrupteknope.
16:28:59narimiran@exelotl nope, we're ignoring those posts ;)
16:29:32*Torro quit (Quit: quit)
16:34:35FromDiscord<exelotl> oh, okay, you two are off the hook
16:37:26*vicfred joined #nim
16:55:55*hnOsmium0001 joined #nim
17:07:02*junland quit (Ping timeout: 272 seconds)
17:20:26FromDiscord<haxscramper> Forgot to ask - what is considered 'more specific'. For example if I have `<untyped, untyped, typed>` and `<untyped, untyped>` the answer is clear
17:20:27FromDiscord<haxscramper> but suppose I have `<untyped, int, untyped>` and `<untyped, untyped, int>` - https://play.nim-lang.org/#ix=2Fkt in that case what is the logic behind selecting second overload (and failing as result)
17:20:55FromDiscord<haxscramper> Both templates have the same number of `untyped` arguments
17:21:33disruptekit can ultimately be a function of sem order.
17:22:03FromDiscord<haxscramper> Moving declarations around doesn't change anything, I tried
17:22:14disruptekoh, is it not ambiguous?
17:22:26disrupteki didn't look at the paste. 😉
17:22:59FromDiscord<haxscramper> Well, it /might/ be, but I have `t(12, it 2, 2)` and one of templates has `int` as third parameters
17:23:26FromDiscord<haxscramper> So it should take priority - `t(a: untyped, b: int, c: untyped)` vs `t(a: untyped, b: untyped, c: int)`
17:24:02FromDiscord<haxscramper> I wouldn't say I /expect/ it to select second one, but it would be logical choice I suppose
17:24:03disruptekit wouldn't be the first sigmatch bug.
17:25:26*luis_ joined #nim
17:35:44*luis_ quit (Quit: luis_)
17:36:14*luis_ joined #nim
17:37:13Zevvnor the last
17:48:43*Kaivo quit (Ping timeout: 246 seconds)
17:51:17*Kaivo joined #nim
17:57:29*rokups quit (Quit: Connection closed for inactivity)
18:03:34FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2FkU
18:05:16FromDiscord<Recruit_main707> doesnt \`varName.strVal` work?
18:05:35*nixfreak joined #nim
18:05:36FromDiscord<shadow.> `Error: type mismatch: got <int, string>`
18:05:40FromDiscord<shadow.> seems not
18:05:55FromDiscord<shadow.> thats why i was confused as well lmao
18:06:05nixfreakafter I connect to an address using socket , how can I retrieve information from that ip,port
18:08:02*luis_ left #nim (#nim)
18:08:24FromDiscord<shadow.> you mean receive procs?
18:08:45FromDiscord<shadow.> https://nim-lang.org/docs/net.html#recvLine%2CSocket
18:08:52FromDiscord<shadow.> this should block until a string is received terminated by a newline
18:09:15reversem3Like banner information
18:12:37leorize@shadow. https://play.nim-lang.org/#ix=2FkZ
18:13:31FromDiscord<shadow.> tysm
18:14:35*habamax joined #nim
18:16:55*luis_ joined #nim
18:24:12FromDiscord<SirJosh> can i build a self-contained nim binary that contain's nim's compiler to compile nim programs on the fly?
18:24:20FromDiscord<SirJosh> or would that require the user to have gcc installed
18:24:30FromDiscord<SirJosh> (edit) "gcc" => "a c compiler"
18:26:53FromDiscord<Recruit_main707> wut?
18:27:18FromDiscord<nikki> @SirJosh if you use nlvm then no c compiler needed
18:27:40FromDiscord<SirJosh> oh neat
18:28:03FromDiscord<SirJosh> looks like something interesting to look at, thanks !
18:28:34FromDiscord<SirJosh> @Recruit_main707 i had the idea to build some kind of transpiler, where i'll turn user code into nim and want a way to embed in a compiler so the user doesn't have to install nim, so just exploring my options
18:28:36FromDiscord<SirJosh> not anything serious just for fun
18:29:26FromDiscord<Recruit_main707> well, you can use the compiler as a library, but im not sure how well that works without having nim installed
18:29:45FromDiscord<Recruit_main707> and i really doubt it works without a c compiler
18:32:09FromDiscord<SirJosh> hence my question :D
18:35:39FromDiscord<Recruit_main707> better solution, install nim on their pc and then do whatever you need
18:35:41FromDiscord<Recruit_main707> https://tenor.com/view/feel-me-think-about-it-meme-gif-7715402
18:35:52*luis_ quit (Quit: luis_)
18:36:12*luis_ joined #nim
18:37:01leorizethere's nimscript if you don't need the performance of native code
18:54:51FromDiscord<haxscramper> !requires fusion
18:54:53disbotfusion: 11nim-lang/usion 71 total
18:58:59FromDiscord<lqdev> @shadow. have you seen sugar.dump?
18:59:05FromDiscord<zetashift> Well since fusion was mentioned, what's up with https://github.com/nim-lang/fusion/pull/33 can it be merged?
18:59:05disbotPattern matching implementation
18:59:10FromDiscord<shadow.> @lqdev i have not
18:59:30FromDiscord<lqdev> https://nim-lang.org/docs/sugar.html#dump.m%2Cuntyped
19:00:16FromDiscord<haxscramper> @zetashift AFAIC yes, but I guess nobody has time to review it, so ETA is totally unknown
19:00:28FromDiscord<shadow.> ah that seems useful but im doing this more for learning macros
19:00:35FromDiscord<shadow.> so that kind of defeats the purpose haha
19:00:53FromDiscord<zetashift> @haxscramper aww, hope someone gets to it when they have time 😄
19:07:21*letto quit (Quit: Konversation terminated!)
19:08:11FromDiscord<haxscramper> But I guess you can do `nimble install https://github.com/haxscramper/fusion.git` and try it out
19:09:43FromDiscord<haxscramper> I would appreciate feedback, suggestions etc. - I tested it, but since it is relatively complex library there are of course places where things could be documented better/bugs fixed/examples added
19:17:01FromDiscord<Clownstick Von FuckFace> Does Nim have a QUIC/HTTP3 implementation?
19:29:09FromDiscord<SirJosh> sent a code paste, see https://play.nim-lang.org/#ix=2Flw
19:29:45*habamax quit (Ping timeout: 240 seconds)
19:29:51FromDiscord<haxscramper> yes, `not cond` is a right way.
19:30:32FromDiscord<haxscramper> There is no `return` in iterators, you can just not `yield` any values
19:30:52*letto joined #nim
19:32:11*hmmm joined #nim
19:33:06hmmmheeey
19:33:33hmmmwait a moment, why echo(1, 2) and echo (1, 2) are two different things in nim?
19:33:38hmmm:o
19:34:25FromDiscord<nikki> first one is a call with two args, second is with one arg that's a tuple
19:34:32FromDiscord<nikki> i think?
19:34:39FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
19:34:42FromDiscord<haxscramper> yes
19:34:42FromDiscord<nikki> !eval echo (1, 2)
19:34:45NimBot(1, 2)
19:34:48FromDiscord<nikki> ya
19:35:03disruptekit's like a bad dream.
19:35:29hmmm!eval echo(1,2)
19:35:32NimBot12
19:35:38hmmmhmmm
19:35:46FromDiscord<Idefau> !eval echo [1][0]
19:35:48NimBot1
19:36:48hmmmand why echo(1, 2) and echo 1, 2 are the same thing?
19:37:56FromDiscord<lqdev> `someProc a, b, c` is called command call syntax
19:38:15FromDiscord<lqdev> whether a call is a regular proc call or a command call is controlled by the space immediately after the proc name
19:39:02disrupteknope.
19:39:21FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2FlC
19:39:24disruptek /i alone/ control your calls.
19:39:30haxscramperWhat is the recommendation for debugging generic instantiation issues if you have absolutely
19:39:30haxscramperI have a generic `proc`, that returns `auto`, but as soon as I specify more concrete (for return value) type I get type mismatch in *somewhere inside* `std/tables`. More specifically, - it fails becase it cannot do `<string> == <NodeId[string]` during instantiation of the `[<NodeId>]= <NodeId>`.
19:39:30haxscramperSo this is like completely unrelated to anything I know
19:39:55*tane joined #nim
19:40:02haxscramperAnd I can't even make small reproducible example, since it seems like it triggers for completely unrelated cause
19:40:21disrupteksounds like ref equality but might also be due to hashing.
19:40:24*Jesin quit (Quit: Leaving)
19:40:54disrupteki cannot make sense of your `<>` line noise.
19:41:09haxscramperThe same goes if I instantiate template type that involves `Table[NodeId[L, V], NodeId[L, V]]`. So `var tmp: Mapping[L, V]` breaks everything too
19:41:36*bung quit (Quit: Lost terminal)
19:42:10disruptekwhat does it mean to instantiate a template type?
19:42:15*letto quit (Quit: Konversation terminated!)
19:42:37disruptekalso, rule out converters.
19:42:57FromDiscord<j-james> Is there a general way to convert a JsonNode to a string?
19:43:07disruptek$ has always worked for me.
19:43:23disruptekyou are probably looking for getStr, though.
19:44:08*letto joined #nim
19:44:36FromDiscord<j-james> Oh, I am
19:44:56haxscramperdisruptek: There are not converters AFAIC. And for template instantiation - maybe I'm using wrong terminology, but I mean that if I have any variable/argument of the type `Table[NodeId[L, V], NodeId[L, V]]` with concrete `L` and `V` I get this error.
19:44:58FromDiscord<j-james> (Thanks - somehow missed that in the json docs)
19:45:12disrupteknp
19:45:56haxscramperSo I have `makeIndex` that uses `[]=` and if I add `var tmp: Table[NodeId[L, V], NodeId[L, V]]` **before** it I get this error but not after
19:46:03disruptekwell, start by ruling out ref equality.
19:46:18disruptekthen make sure your hash(NodeId[L, V]) works correctly.
19:46:48*Jesin joined #nim
19:47:46FromDiscord<lqdev> haxscramper: that's generic instantiation, not template instantiation
19:47:56FromDiscord<lqdev> nim's not c++ :)
19:48:19haxscramperoh, yeah, sorry. Yes, I meant generic instantiation of course, just have C++ brain fart
19:49:14disrupteki'll be surprised if NodeId isn't a ref.
19:49:50haxscramperdisruptek: It does - work correctly, in terms of types (until I move lines around). I suppose at least: `func hash*[L, V](id: NodeId[L, V]): Hash`. And can you elaborate what you mean by 'ref equality'.
19:49:50haxscramper`NodeId` is not a ref, but it as a ref field. Does this count?
19:52:46disrupteklook at how equality is defined for an arbitrary ref; it's used in tables and in fact performs a value comparison of a[] == b[], basically.
19:53:41disruptekpoint is, tables demands that you can measure equality correctly between keys.
19:54:30disruptekmoving lines around to change behavior is troubling, though.
19:54:56haxscramperhttps://pastebin.com/wsTVhD7d
19:55:30haxscramperplayground died when I tried to make link, so pastebin for now
19:55:39disruptekkk
19:56:16haxscramperAnd I'm working on it right now, can just push to show CI failure
19:56:25haxscramperWith the error
19:56:45haxscramperBecause I still have zero ideas how to reproduce
19:58:45disruptekneat.
19:59:10disruptekyou manage to have multiple expr in one overload miss error.
20:04:24haxscramperSo, full context - https://github.com/haxscramper/hmisc/runs/1449805846?check_suite_focus=true#step:4:46 and what I've changed: https://github.com/haxscramper/hmisc/commit/1c63e6eec89772d905c68f09e5c10d706242b944
20:04:49haxscrampers/context/error/
20:06:47disruptekleorize: how hard would it be to generate links to repo files from the test output in ci?
20:07:06disruptekseems pretty doable but i dunno if the ci itself would make it harder.
20:07:09leorizedisruptek: you'd have to elaborate a bit more
20:07:17leorizewhat exactly are you aiming to do?
20:07:34disrupteki just wanna click on /home/runner/work/hmisc/hmisc/tests/tHTreeDistance.nim(36, 24) template/generic instantiation of `simpleTreeDiff` from here
20:07:43disruptekand jump to the file and line.
20:08:12*lritter quit (Remote host closed the connection)
20:08:41disrupteki guess the easiest solution would be to just output the url and let ci render it as a link.
20:09:41leorizeah you want that?
20:09:46leorizeI already made that in setup-nim :P
20:09:52disrupteklol nice.
20:10:00leorizeit should produce annotations by the end of the run
20:10:08haxscramperI use setup-nim
20:10:21leorizeyou can look at the setup-nim ci to see how that'd look like
20:10:46leorizeit couldn't link to any real file because I tested those with files made on-the-fly
20:11:39haxscramperOh, you mean those links warning/error annotations here: https://github.com/haxscramper/hmisc/actions/runs/381810009
20:15:11disruptekhaxscramper: your scorecmpproc[v] takes strings and yields v?
20:16:28haxscramperNo, it takes `V,V` and returns integer: `type ScoreCmpProc*[T] = proc(x, y: T): int` scored comparison for two objects.
20:18:38disruptekokay, that makes sense.
20:28:51*narimiran quit (Quit: leaving)
20:35:54*luis_ quit (Quit: luis_)
20:36:17*luis_ joined #nim
20:38:00*kungtotte quit (Read error: Connection reset by peer)
20:39:00*kungtotte joined #nim
20:44:04*junland joined #nim
20:44:04*junland quit (Remote host closed the connection)
20:48:26*junland joined #nim
20:49:46*junland quit (Client Quit)
20:54:56*junland joined #nim
20:55:05*hmmm quit (Ping timeout: 240 seconds)
20:55:41*junland quit (Client Quit)
20:56:31*junland joined #nim
21:01:38*junland quit (Quit: %ZNC Disconnected%)
21:02:32*junland joined #nim
21:05:45*junland quit (Client Quit)
21:06:44*junland joined #nim
21:07:27*junland quit (Client Quit)
21:07:51*Jesin quit (Quit: Leaving)
21:08:15*junland joined #nim
21:09:18*junland quit (Client Quit)
21:10:09*junland joined #nim
21:12:46*Jesin joined #nim
21:12:46*junland quit (Client Quit)
21:14:25FromDiscord<SirJosh> sent a code paste, see https://play.nim-lang.org/#ix=2Fmb
21:15:06*junland joined #nim
21:15:37FromDiscord<haxscramper> idk what exactly do you mean by 'arc pointer', but you can have `ptr Example` and `addr <whatewher>`
21:16:13FromDiscord<haxscramper> And use `items[2][].id = 2`. `[]` is a dereference operator
21:16:54FromDiscord<SirJosh> i dont wanna use `ptr`s cuz those are unsafe, right?
21:17:12FromDiscord<haxscramper> Those are not 'unsafe' if you use them safely
21:17:15FromDiscord<SirJosh> ill write an example of code i'd write in rust
21:17:26FromDiscord<haxscramper> I mean, use a knife but don't cut your hands
21:17:50FromDiscord<haxscramper> For ref you need to use ref object, and then it is just
21:17:51FromDiscord<SirJosh> im gonna be writing a transpiler so i can't trust it to not cut my hands lol
21:18:19leorizeso you want borrowing?
21:18:22FromDiscord<haxscramper> Well, if you have ref object you can just add `items.add(<some ref[T]>)`
21:18:26FromDiscord<SirJosh> yes borrowing!
21:18:27FromDiscord<tomck> ref == Rc, afaik there is no Arc in nim - you just use channels / unsafe ptrs
21:18:45FromDiscord<SirJosh> ah if we're talking rust `Rc` is fine yeah
21:18:59leorizeNim's views are not that good yet, but you can give them a try
21:19:01leorize~views
21:19:01disbotviews: 11https://nim-lang.github.io/Nim/manual_experimental.html#view-types
21:19:05FromDiscord<tomck> if you just want Rc, use `ref`
21:19:16FromDiscord<SirJosh> how can i use `ref` here?
21:19:43leorizeyou're looking for `seq[lent T]` if you want to use views
21:19:45FromDiscord<tomck> not sure i understand your example, where's the issue
21:19:52FromDiscord<SirJosh> `items.add(# ? #)` not sure what to write here
21:20:10FromDiscord<tomck> i don't think he wants views, Arc is a specific type in rust for threadsafe refcounting, Rc is the non-threadsafe version ?
21:20:25FromDiscord<SirJosh> yeah this is gonna be single threaded so Rc is fine
21:20:26FromDiscord<haxscramper> What do you want to add to `items`
21:20:34FromDiscord<haxscramper> Single item?
21:20:37FromDiscord<tomck> he wants to add `item`
21:20:37FromDiscord<SirJosh> a reference to `item`
21:20:39leorizethey did say that they want borrowing, so I point them to views
21:21:00FromDiscord<SirJosh> Rc is close to borrowing i think, isn't it? probably not exactly
21:21:11miprino, not at all.
21:21:12FromDiscord<tomck> no, Rc isn't borrowing @SirJosh , it's refcounting
21:21:17FromDiscord<SirJosh> ah my bad then
21:21:30FromDiscord<tomck> borrowing is raw pointers with extra compiler checks
21:21:45leorize"restricted pointers" as I like to call them
21:21:50FromDiscord<haxscramper> Then AFAIK `item` must be a `ref`, otherwise you can't add it. `ref`is heap-allocated, regular `Example` is regular (non-ref) type, so you would need to take pointer
21:21:53FromDiscord<tomck> lol, very restricted
21:22:00mipriwhat I'd suggest is to write some code that works, in Nim, and show us that, and say "I don't like this for such-and-such reason. Can it be improved?"
21:22:51FromDiscord<SirJosh> will do then
21:23:36*junland quit (Quit: %ZNC Disconnected%)
21:23:42FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2Fmf
21:26:25*junland joined #nim
21:27:25*junland quit (Client Quit)
21:28:00FromDiscord<nikki> if item is not referenced again it'll be a move and not a copy, too
21:28:13FromDiscord<nikki> which is good if you have no-copy members
21:28:38*junland joined #nim
21:28:39leorizeneeds `sink` to make it a move
21:29:44FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2Fmh
21:30:01FromDiscord<nikki> leorize: or sink inference 😮
21:30:23FromDiscord<nikki> which i've turned on and take for granted now sry lol
21:31:33leorize@tomck patty
21:31:36leorize!repo patty
21:31:37disbothttps://github.com/andreaferretti/patty -- 9patty: 11A pattern matching library for Nim 15 211⭐ 11🍴
21:32:38*junland quit (Client Quit)
21:32:43leorize@nikki careful with that one, it's turned off for now due to being overzealous and causing memory corruptions in closures
21:33:00FromDiscord<nikki> oh noez
21:33:25miprisink inference is on by default now
21:33:29*junland joined #nim
21:33:43mipriit's off for now? is fullhelp lying about that?
21:34:10leorizeit's on for stdlib iirc
21:34:22leorizemight have been turned on by default, gotta query Araq for that
21:34:39FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2Fmi
21:35:09leorizesolved in patty, it generates different variant types
21:35:15FromDiscord<tomck> oh, yes it is: > A limitation of the variant macro is that field names must be unique across branches (that is, different variants cannot have two fields with the same name). This is actually a limitation of Nim.
21:35:16FromDiscord<tomck> oh
21:35:40leorizeoh wait I thought it generates separated objects?
21:35:52FromDiscord<tomck> apparently not, unless the readme is out of date
21:35:53FromDiscord<nikki> maybe i should just disable closures
21:36:15FromDiscord<tomck> that's the main problem with variant objects, means i need to create a new type for each variant branch, i think my ast type decl is like 200 lines or something silly
21:36:16*luis_ quit (Quit: luis_)
21:36:38*luis_ joined #nim
21:36:43leorize@tomck feel free to fork patty to make its variant macro generate object types :P
21:36:49leorizeit should be simple
21:36:56FromDiscord<tomck> > it should be simple
21:36:59FromDiscord<tomck> mm
21:37:10nixfreakI feel so stupid going through prologue blog example , this css is way beyond me lol
21:38:15leorize@tomck I imagine it'd have to generate the IdentDefs to put into each branches, just take them out and make a new object type instead, they use the same stuff
21:41:06FromDiscord<tomck> i will.. have a look
21:43:02*hmmm joined #nim
21:48:47hmmmhmm weird
21:49:25hmmmI installed a package with nimble, copypasted an example program and I get an error on import of the main library
21:49:40leorizeusername checks out
21:49:40mipriwhat's the error?
21:49:53hmmm6, 8) Error: cannot open file: imageIO
21:50:16mipriwhich package is that?
21:50:32hmmmhttps://github.com/dizzyliam/inumon
21:51:23FromDiscord<SirJosh> sent a code paste, see https://play.nim-lang.org/#ix=2Fmn
21:51:31FromDiscord<SirJosh> the reason i dont wanna use a `ref object` is cuz id like to avoid heap allocations if possible for performance™️
21:51:52miprithe Rcs you want are heap allocated though.
21:51:57hmmmleorize :>
21:52:24FromDiscord<SirJosh> oh didn't know that. kinda sad :(
21:52:38FromDiscord<SirJosh> an rc is smaller than an object though right
21:52:38leorizeuse the right tool for the right job :P
21:52:39miprihmmm: which is the example that fails?
21:52:43FromDiscord<SirJosh> (edit) "an rc is smaller than an ... object" added "Example"
21:52:57leorizenope
21:53:04hmmmthis one
21:53:05hmmmhttps://github.com/dizzyliam/inumon/blob/master/inumon/gui.nim
21:53:12disruptekthe rc is bigger on the outside.
21:53:58leorizehmmm: can you post the snippet you're trying to compile?
21:54:08miprihmmm: that's located in the same directory with the modules it's importing. if you're going to use that in your own code you'll want add a inumon/ prefix to them
21:54:23mipriimport inumon/[imageIO, coreTypes]
21:54:26hmmmohhh
21:54:35hmmmI knew I was failing somehow
21:54:41hmmmthanks mipri I'l try
21:55:00leorizeyou can also just `import inumon/gui` :P
21:55:05*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
21:55:13leorizethen you have access to all of the procs
21:55:23*pbb joined #nim
21:56:07hmmmthat worked beautifully except I get another kind of error :D
21:56:33hmmmbut I'll try to figure it out don't want to waste your time :> ty both
21:58:47FromDiscord<SirJosh> mipri i think in the actual usecases im going to be using this in, having heap allocated rcs will actually make more sense than having heap allocated objects (but for this example, it's not good)
21:59:28leorizeif you're using rc, then it has to be heap allocated
21:59:55leorize(because it doesn't make sense to do so if it's stack allocated)
22:00:02haxscramperdisruptek: If you are still looking into this - I found that `hashcommon.rawGet` takes `Table[NodeId[string, string], seq[NodeId[string, string]]]`, but if I do `echo typeof` on the `t.data`. I get `KeyValuePair[system.string, seq[string]]`
22:00:08haxscramperWhich is really odd.
22:00:45FromDiscord<SirJosh> right yeah heap allocated RCs will make more sense than a heap allocated object for the other usecases i have planned for this
22:01:04Zoom[m]Hey everyone, I've written a reverse iterator for narimiran's fusion/btreetables. https://play.nim-lang.org/#ix=2Fml Could anyone please review? I didn't particularly dig the experience, but it works.
22:01:42FromDiscord<SirJosh> does nim have an `rc` datatype?
22:01:45FromDiscord<SirJosh> (edit) "`rc`" => "`Rc`"
22:01:56leorizeit's called `ref`
22:02:02FromDiscord<SirJosh> or do i have to switch to `orc` gc
22:02:13FromDiscord<nikki> yeah just use `ref T`? and use with `--gc:arc` or `--gc:orc`
22:02:29FromDiscord<SirJosh> oh so `type Example = ref object`?
22:02:34leorizeyes
22:02:35FromDiscord<nikki> there's one heap allocation per object, the rc is in a header before the object
22:02:49FromDiscord<nikki> yeah or you can also just write `type Example = object` and then `ref Example` everywhere
22:02:57disrupteksirjosh: what's the application?
22:03:12FromDiscord<SirJosh> here's the example from earlier <https://discord.com/channels/371759389889003530/371759389889003532/780904166280396881>
22:03:21FromDiscord<nikki> one nice way to go about things also is to wrap the `ref` inside an object, and have more of an interface in that handle object
22:03:23FromDiscord<SirJosh> of where i want to use refs for the sake of getting to know nim
22:03:26disruptekhaxscramper: weird.
22:03:32haxscramperhttps://play.nim-lang.org/#ix=2Fmt
22:04:00haxscramperThat's what I'm getting right now
22:05:03disruptekwell, i'm not really familiar with the tables impl but that's not what i expected.
22:06:21haxscramperAnd again - this is only due to line moves, nothing else. Haven't touched other part of the code. The only thing I figured out is that I can't instantiate `Mapping[string, string]` in any way before calling `makeIndex`.
22:06:32disrupteki would expect the data to be keyval[hash, seq[valueType]]
22:07:25haxscramperAnd in 'normal' state it is - `KeyValuePairSeq[NodeId[system.int, system.string]]` to be precise
22:07:27FromDiscord<nikki> @SirJosh in the `?` part in your code you can write `(ref Example)(id: 2)` for example
22:07:34FromDiscord<nikki> that's just a constructor for a ref'd object
22:08:35disruptekhaxscramper: again, the reordering-of-stmts-changes-the-behavior is the most worrying bit.
22:08:43FromDiscord<SirJosh> and that'll construct an rc if the gc is orc/arc?
22:09:16FromDiscord<nikki> yes
22:09:18leorizeit's always an rc for most of the supported gc
22:09:21FromDiscord<SirJosh> alright cool thanks
22:09:42disruptekref == managed pointer, not necessarily rc'd.
22:10:06leorizewell I'm talking about "most of the supported gc" :P
22:10:22disruptekyou're right, of course.
22:10:28haxscramperAnd just noticed another strange thing. `KeyValuePairSeq[A, B]` has two generic parameters, but in 'normal' case it `typeof(t.data)` is has type `KeyValuePairSeq[NodeId[system.int, system.string]]`, which, AFAIC is generic specialization with single parameter
22:10:51leorizebut tbh I wouldn't use `rc` because it's `rc`
22:11:35FromDiscord<nikki> what does "use `rc`" mean?
22:11:36FromDiscord<SirJosh> the problem is though i want all of the elements of the array to be linked to the same base item, that seems like it'll just construct a new `Example` for each element?
22:11:49disruptekdon't confuse the lad.
22:12:01FromDiscord<nikki> tbh @SirJosh i don't think it's clear what you want to do
22:12:02disruptekhaxscramper: what do you mean by "normal"?
22:12:10haxscramperone that compiles
22:12:16disruptekoh.
22:12:22disrupteka reordered version.
22:12:24disruptekthis is madness.
22:12:30disruptekcan it be reduced?
22:12:53FromDiscord<nikki> if you want multiple refs pointing to the same thing, then do `let theThing = (ref Example)(id: 1); for elem in arr.mitems: elem = theThing`
22:13:05FromDiscord<nikki> where `arr` elements are `ref Example` type
22:13:14FromDiscord<nikki> it
22:13:19haxscramperI tried, but well ... reduced version works just fine. I will try just copying all related parts and cutting out things
22:13:20FromDiscord<nikki> woops. sorry. it's just regular code 😄
22:13:50leorize@SirJosh wanted safe references to the objects, when you want that you should use `ref` because that's a "managed pointer", not because it's implemented with ref-counting
22:13:58FromDiscord<SirJosh> i want to make an array of 10 elements where each element points to `item`↵- dont wanna use `ptr` because it's unsafe and i don't trust it to be used in this example↵- don't wanna turn `Example` from an `object` into a `ref object` because in the usecases i plan to have this in, i dont wanna encur a heap allocation per Example
22:14:46FromDiscord<nikki> can you clarify that first sentence more -- you want all of the elements to be a pointer to the same thing?
22:15:03FromDiscord<nikki> the rest of your sentences are about what you want to not do, but still trying to clarify what you do wnat to do
22:15:58*nixfreak quit (Ping timeout: 260 seconds)
22:16:03disruptekjust use an array of objects, then.
22:16:08disruptekno heap alloc, no pointers.
22:16:15disruptekto refer to just one, use a static index.
22:16:24FromDiscord<nikki> disruptek: it seems like they're saying they want all of the elements to refer to the same underlying instance
22:16:28FromDiscord<SirJosh> yes
22:16:29FromDiscord<nikki> but, i still can't glean if that's what they mean
22:16:32FromDiscord<SirJosh> all of them should refer to the same instance
22:16:35FromDiscord<SirJosh> via reference counting
22:16:47leorizethen just use `ref`?
22:16:48FromDiscord<nikki> reference counting is about lifetime management, not about referring
22:16:50disruptekso use a pointer to a single object on the stack.
22:16:51FromDiscord<nikki> if you want a reference to a non-heap allocated thing, you need to use views or ptrs, or eg. `{.byaddr.}` which really is a ptr anyway
22:17:25FromDiscord<nikki> `let theObj = Example(id: 3); let thePtr = theObj.addr; for elem in arr.mitems: elem = thePtr;`
22:17:50disruptekhe wants rc but he doesn't want heap alloc. 🙄
22:18:07FromDiscord<SirJosh> each rc can be heap allocated that's fine
22:18:09disruptekcount your own references, i guess.
22:18:14FromDiscord<SirJosh> but does the instance itself have to be heap alloced?
22:18:24FromDiscord<nikki> there's one rc per instance
22:18:29FromDiscord<nikki> not one rc per ref
22:18:34disruptekthat's the whole point.
22:19:00FromDiscord<nikki> so if you're not heapallocating the instance, why would you heap allocate the rc + if you're not heap allocating it, its lifetime is managed anyway, so what does the rc mean?
22:19:07FromDiscord<nikki> it seems like you might be confusing concepts a bit?
22:19:10leorizehttps://play.nim-lang.org/#ix=2FmB
22:19:15*hmmm quit (Quit: zZz)
22:19:16leorizeI believe this is what you're aiming for
22:19:36leorizeget it right first, performance later
22:19:52FromDiscord<ElegantBeef> Why not be idiomatic instead of idiotic 😄
22:20:33mipriactually I think he just wants reference semantics but is confused. https://play.nim-lang.org/#ix=2FmC
22:20:56miprian array of ten Examples that are all the same one, without incurring ten separate allocations.
22:21:19FromDiscord<nikki> all of these heap allocate the one instance, which they're saying they don't want (but you need, and i agree with the examples lol)
22:21:23disruptekwell, doing it that way will incur a couple allocs for the seq.
22:21:41miprimore recently, he said he doesn't want ten heap allocations for ten references of item
22:21:57disrupteksure.
22:22:02FromDiscord<nikki> it's funny because they said each rc can be heap allocated but the instance doesn't
22:22:09disrupteksequences start at size 4, iirc.
22:22:11FromDiscord<nikki> which is just -- there's only one rc per instance. so like what?
22:22:47FromDiscord<SirJosh> yeah i think im just confused about nim semantics and how it works and how rcs are implemented
22:22:52FromDiscord<SirJosh> one sec a bit busy
22:22:57disruptekdon't worry about it.
22:23:05FromDiscord<nikki> just use refs, get on with things 😄
22:23:09FromDiscord<ElegantBeef> Cant you see how RCs are implemented by doing `--expandarc`?
22:23:15leorizenope :P
22:23:23disruptekit doesn't matter.
22:23:30FromDiscord<nikki> arc.nim or look at gen'd C code
22:23:34miprihttp://zevv.nl/nim-memory/ is a good document for understanding how memory works in Nim.
22:24:01leorize@SirJosh if you have any questions regarding the example I sent, just comment your questions on it then share it here with us
22:24:04FromDiscord<nikki> expandarc doesn't actually show the refcount calls, only shows the =sink =copy etc. insertions
22:24:07disruptekand outside of nim.
22:24:11leorizethat might help clear things up
22:28:12*apahl quit (Ping timeout: 260 seconds)
22:29:06*apahl joined #nim
22:42:47*vicfred quit (Quit: Leaving)
22:50:11*luis_ quit (Ping timeout: 272 seconds)
22:50:30haxscramperdisruptek: https://play.nim-lang.org/#ix=2FmL - minimized version
22:50:31haxscramper
22:51:05haxscramperThomas Had Never Seen Such Bullshit Before
22:56:41*tane quit (Quit: Leaving)
22:58:43haxscramperMore mimized version: https://play.nim-lang.org/#ix=2FmO
22:59:38haxscramperI will be off until tomorrow, but so far I could only say that I still have absolutely no idea what is going on
23:00:09haxscramperAnd in last version I failed to just remove `TreeIndex` completely - no errors then.
23:00:44*haxscramper quit (Remote host closed the connection)
23:04:08*D_ quit (Remote host closed the connection)
23:05:03*D_ joined #nim
23:16:56disruptekhaxscramper: if you're still here, why are your equality and hash funcs simply discarding?
23:18:56disrupteki cannot imagine how changing the order of those two statements should cause an error.
23:23:49FromDiscord<haxscramper> Because it doesn't matter when they return as long as it compiles. Runtime behavior is of no importance at this stage
23:24:14FromDiscord<haxscramper> what they return
23:24:43disruptekfair.
23:27:54disruptekit's bananas.
23:32:46FromDiscord<Quibono> Is it possible to implement a lock that rate limits access to a resource?
23:32:57disruptekcompletely impossible.
23:34:46FromDiscord<Quibono> Gotcha, so you'd have to basically make a lock that isn't a lock, lol.
23:36:11miprihttps://nim-lang.org/docs/manual_experimental.html#guards-and-locks
23:36:51FromDiscord<Recruit_main707> wait, so disruptek was wrong?
23:36:58FromDiscord<Recruit_main707> impossible
23:39:18FromDiscord<iWonderAboutTuatara> wait can you not name a variable the name of an import?
23:39:22FromDiscord<iWonderAboutTuatara> wow
23:44:27FromDiscord<Quibono> So I make a template of a lock, that contains a counter, that keeps it locked unless the counter is in a certain state?
23:44:59disruptekof course you can. to both of you.
23:45:27disruptekquibono: you want a semaphore.
23:47:06FromDiscord<Quibono> Thank you for giving me a name for the thing, I wouldn't have known to look.
23:48:36FromDiscord<Quibono> SOO I have a variable, hidden behind a lock so it is threadsafe, which is the counter
23:49:07disruptekthere's a semaphore in stdlib but iirc it's not exported. but you can copy it.
23:49:19disrupteki wrote one for cps, too.
23:49:20disruptek!repo cps
23:49:20disbothttps://github.com/disruptek/cps -- 9cps: 11Continuation-Passing Style for Nim 🔗 15 40⭐ 2🍴
23:50:06disruptekmaybe i based it on the stdlib version, i dunno.
23:55:56FromDiscord<Quibono> Cool, I'll take a look.
23:59:33*vicfred joined #nim