<< 06-09-2021 >>

00:01:03FromDiscord<auxym> I do like the idea though, when looking at a long list of imports in either nim or python, it's not always easy to know what is stdlib, what is a 3rd party lib, and what is a "local" import
00:01:52FromDiscord<Elegantbeef> plus there is the bracket import syntax yard just showed, so it's just a nicer way of doing it
00:02:21FromDiscord<impbox [ftsf]> `import foo/[bar, baz]` does this import foo as well as foo/bar and foo/baz?
00:02:21FromDiscord<auxym> eh, I think I'll stick to 1 line per import for now
00:02:32FromDiscord<Yardanico> In reply to @impbox "`import foo/[bar, baz]` does": no
00:02:38FromDiscord<Elegantbeef> yes impbox
00:02:38FromDiscord<impbox [ftsf]> ok, good to know
00:02:42FromDiscord<Yardanico> In reply to @Elegantbeef "yes impbox": are you sure?
00:02:44FromDiscord<impbox [ftsf]> ...
00:02:45FromDiscord<Yardanico> it doesn't AFAIK
00:02:46FromDiscord<Elegantbeef> Nevermind misread
00:02:48FromDiscord<Yardanico> lol
00:03:01FromDiscord<Elegantbeef> foo is a directory it cannot import it
00:03:04FromDiscord<Yardanico> yeah, it doesn't, since `foo` in this case is just treated like a directory or a prefix
00:03:47FromDiscord<impbox [ftsf]> eg. `import nico/[vec, matrix, quat]` i'd assume this wouldn't import nico
00:03:55FromDiscord<Yardanico> yes
00:03:56FromDiscord<Elegantbeef> correct
00:04:18*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
00:04:31FromDiscord<impbox [ftsf]> `import nico{,vec,matrix,quat}`
00:04:35FromDiscord<Elegantbeef> So this i fun with a recursive dependant alternating generic the parameter look up is just borked
00:05:07FromDiscord<Elegantbeef> It's unlikely that the import statement will get changed much since macros exist \:D
00:05:33FromDiscord<impbox [ftsf]> yeah, it's fine as is
00:06:01FromDiscord<Elegantbeef> I did like the idea of being able to do `import std/math`, but met
00:06:01FromDiscord<Elegantbeef> I did like the idea of being able to do `import std/math`, but meh
00:10:33FromDiscord<Yardanico> wait, didn't the matrix bridge correctly bridge edits between matrix and discord before?
00:10:37FromDiscord<Yardanico> now it just resends the message
00:10:49*Gustavo6046 joined #nim
00:11:15FromDiscord<Elegantbeef> It may have, i do notice there are issues with editing on discord -\> matrix, large edited messages disappear
00:11:52FromDiscord<Yardanico> i mean this https://media.discordapp.net/attachments/371759389889003532/884229375548096512/unknown.png
00:12:09FromDiscord<Elegantbeef> Yea i know i can read occasionally
00:12:16FromDiscord<Yardanico> wow
00:12:21FromDiscord<Yardanico> that's quite unexpected!
00:12:27FromDiscord<Elegantbeef> Indeed
00:12:37FromDiscord<Yardanico> don't tell me you can also speak?
00:13:56FromDiscord<Elegantbeef> not well
00:13:58*auxym_ quit (Ping timeout: 252 seconds)
00:21:35FromDiscord<aleclarson> is forwarding `varargs` as easy as `otherProc(args)` or is there a helper for that?
00:22:17FromDiscord<Elegantbeef> if it's at runtime it should be since it's internally an array or seq
00:23:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3y49
00:23:38FromDiscord<aleclarson> and if i need to map the `varargs` first, what's the best approach?
00:24:05FromDiscord<aleclarson> iterating and assigning back into the `varargs` i suppose?
00:24:17FromDiscord<Elegantbeef> I dont follow
00:25:03FromDiscord<aleclarson> sent a code paste, see https://paste.rs/3jy
00:25:20FromDiscord<Elegantbeef> No varargs is not mutable
00:25:31FromDiscord<Elegantbeef> You'd make a seq then map to that
00:25:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3y4a
00:25:54FromDiscord<Elegantbeef> Or use sequtils
00:26:04FromDiscord<aleclarson> niceee
00:26:40FromDiscord<aleclarson> and i need an overload with `openArray`? or could `proc a` take a `varargs` just as well?
00:26:52FromDiscord<Elegantbeef> It can be varargs aswell
00:27:01FromDiscord<aleclarson> thx
00:27:27FromDiscord<Elegantbeef> varargs is 2 things\: comma delimited values, openarray[T]
00:27:47FromDiscord<Elegantbeef> You cannot do `10, 20, [30]` so be cognisant
00:28:31FromDiscord<aleclarson> makes sense, i would just prepend 10 and 20 into the seq and pass the seq only
00:28:54FromDiscord<aleclarson> in javascript, we have the spread operator `...` \:)
00:30:05FromDiscord<Elegantbeef> Can technically have it in nim aswell but not placed inside the proc call
00:30:52FromDiscord<aleclarson> something like `someProc(@[ 10, 20, ...args ])` ?
00:31:20FromDiscord<Elegantbeef> Still not doable afaik
00:31:21FromDiscord<aleclarson> (edit) "`someProc(@[" => "`someVarArgProc(@["
00:32:20FromDiscord<Elegantbeef> Due to the way macros work you cannot do stuff like that inside `[]` or `()`
00:32:31FromDiscord<aleclarson> oh interesting
00:32:47FromDiscord<Elegantbeef> you'd need to do something like `someVarArgProc <- (10, 20, ...args)`
00:34:25FromDiscord<Elegantbeef> Just easier and more readable to do it properly though
00:34:57FromDiscord<aleclarson> yup, i prefer to be as idiomatic as possible. only reach for macros if it removes lots of boilerplate
00:52:38FromDiscord<aleclarson> is there something like `Table` that returns nil instead of throwing an exception when a key doesn't exist? prolly a premature optimization to try avoiding `hasKey` but thought I'd ask anyway
00:53:18FromDiscord<aleclarson> ofc, speaking in context of a ref as table's value type
00:56:04FromDiscord<Elegantbeef> `getOrDefault`?
00:57:06FromDiscord<aleclarson> oh yeah whoops, forgot about that. i'm already using it in places \:P
00:57:37FromDiscord<Elegantbeef> Way to make me deprecated
01:13:22*neurocyte4 joined #nim
01:13:22*neurocyte4 quit (Changing host)
01:13:22*neurocyte4 joined #nim
01:15:34*neurocyte quit (Ping timeout: 252 seconds)
01:15:34*neurocyte4 is now known as neurocyte
01:59:02*auxym_ joined #nim
02:04:31*auxym_ quit (Ping timeout: 252 seconds)
02:10:07*arkurious quit (Quit: Leaving)
02:21:04*vicfred quit (Quit: Leaving)
02:29:13FromDiscord<Goat> sent a code paste, see https://play.nim-lang.org/#ix=3y4n
02:29:57FromDiscord<Goat> sent a code paste, see https://play.nim-lang.org/#ix=3y4p
02:31:01FromDiscord<Goat> (edit) "https://play.nim-lang.org/#ix=3y4n" => "https://play.nim-lang.org/#ix=3y4r"
02:34:28FromDiscord<impbox [ftsf]> I'm not really sure what you're trying to do...
02:34:46FromDiscord<Goat> I'm basically rolling dice on tables
02:34:59FromDiscord<impbox [ftsf]> as in computer science Tables, or physical desk tables?
02:36:28FromDiscord<impbox [ftsf]> i'm guessing you want to map "d10" to a random function that returns 1..10?
02:36:39FromDiscord<impbox [ftsf]> and "d6" -> 1..6
02:36:40FromDiscord<impbox [ftsf]> etc?
02:36:42FromDiscord<impbox [ftsf]> is that right?
02:36:59FromDiscord<Goat> It's already mapped to that.
02:37:25FromDiscord<impbox [ftsf]> ok but i don't understand the goal of your program/library
02:38:39FromDiscord<Goat> To roll digital dice on a table and return the result, as if you were rolling on a table in a tabletop rpg manual
02:38:45FromDiscord<Goat> This stuff https://media.discordapp.net/attachments/371759389889003532/884266336245678141/unknown.png
02:40:17FromDiscord<impbox [ftsf]> "table" is a very overloaded confusing term
02:41:16FromDiscord<impbox [ftsf]> DiceTable is a seq rather than a `Table`, so I'm guessing you're using "Table" to refer to a physical table here
02:41:24FromDiscord<Goat> Yes
02:41:31FromDiscord<impbox [ftsf]> I see
02:42:39FromDiscord<impbox [ftsf]> and `rollTable` isn't rolling the table, it's rolling dice on a table right? and what's do the inputs mean and what is the output you want?
02:46:16FromDiscord<Goat> `rollTable` is rolling the dice on a table, yes. The two inputs to it are a DiceTable and the dice that you want to roll on that table. The output is a tuple of the value of the roll and the matching string on the table.
02:47:10FromDiscord<impbox [ftsf]> eg `rollDiceOnTable(diceTable, "d8") -> "2: Chitlin. Waxy, no hair."`
02:47:23FromDiscord<impbox [ftsf]> that kind of thing?
02:47:47FromDiscord<Goat> Yes, exaclty.
02:48:01FromDiscord<Goat> It already does that, I'm just asking to see if I can improve on it.
02:48:44FromDiscord<impbox [ftsf]> what is the point of the diceTable? couldn't you just have hairType[rollDice("d8")] -> "Chitlin. Waxy, no hair."
02:49:46FromDiscord<impbox [ftsf]> oh... "table" isn't refering to the physical table, it's referring to a lookup table of values to strings?
02:53:55FromDiscord<Goat> Basically, yeah.
02:54:20FromDiscord<impbox [ftsf]> https://play.nim-lang.org/#ix=3y4t this is how i'd do it
02:56:39FromDiscord<impbox [ftsf]> i think you'd at least want to embed the dice range in your table, rather than having the caller specify what the range is
02:56:54FromDiscord<impbox [ftsf]> eg passing a d6 to a table that has a range of a d10
02:58:42FromDiscord<Elegantbeef> Time for the over engineered solution \:D
02:59:24FromDiscord<impbox [ftsf]> also a case statement will error if you have overlapping ranges
03:00:04FromDiscord<impbox [ftsf]> though i suspect your data might not be set at compile time, in which case if you're reading the data at runtime the case statement is less useful
03:02:22FromDiscord<Goat> In reply to @impbox "i think you'd at": I was using the case statement before, but I found it too verbose to write one for every table and have that useless else.
03:04:35FromDiscord<impbox [ftsf]> https://play.nim-lang.org/#ix=3y4y
03:05:54FromDiscord<impbox [ftsf]> would probably give it a constructor that validated that there's no gaps and the range matches to avoid errors
03:23:52FromDiscord<Elegantbeef> My overengineered version https://play.nim-lang.org/#ix=3y4C
03:24:17FromDiscord<impbox [ftsf]> aww no macros
03:25:35FromDiscord<Elegantbeef> Really could replace `seq[V]` with `array[T, V]` now that i think about it, though limits you to CT ranges
03:26:25FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3y4D
03:26:45FromDiscord<Elegantbeef> Dont need a macro for that \:D
03:27:15FromDiscord<impbox [ftsf]> template magic?
03:27:30FromDiscord<Elegantbeef> More like you can do most of that with an anonymous proc
03:27:38FromDiscord<impbox [ftsf]> i guess a lot depends on if you want to define the data in the code or have it loaded externally at runtime
03:29:57FromDiscord<aleclarson> are procs considered ref types?
03:30:06FromDiscord<impbox [ftsf]> nope
03:30:18FromDiscord<Elegantbeef> Dont think they count as `ref` but are pointers
03:30:18FromDiscord<Elegantbeef> pointer procs atleast
03:30:21FromDiscord<impbox [ftsf]> you don't want your procs getting garbage collected
03:30:30FromDiscord<Elegantbeef> doubt they count as `pointer` either
03:30:57FromDiscord<impbox [ftsf]> but they are not copied
03:31:05FromDiscord<aleclarson> so a proc argument can never be nil?
03:31:10FromDiscord<impbox [ftsf]> a proc argument can be nil
03:31:19FromDiscord<impbox [ftsf]> they are like a pointer
03:31:31FromDiscord<aleclarson> got it, thx
03:38:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3y4G
03:38:49FromDiscord<Elegantbeef> Yes it's just using a anonymous function
03:41:50FromDiscord<aleclarson> can that arrow function syntax be used anywhere in place of anonymous proc?
03:42:10FromDiscord<Elegantbeef> anywhere requires `import std/sugar`
03:42:32FromDiscord<Elegantbeef> has `->` for typedefs and `=>` for anonymous proc defs
03:42:53FromDiscord<aleclarson> cool
03:44:00FromDiscord<Elegantbeef> Guess i should note do notation is considered experimental, but works rather well imo
03:44:03FromDiscord<Goat> sent a code paste, see https://play.nim-lang.org/#ix=3y4I
03:50:52FromDiscord<aleclarson> do macro pragmas run before the `->` macro?
03:57:36FromDiscord<Elegantbeef> Well you can easily see the AST to reason this out https://play.nim-lang.org/#ix=3y4L
03:57:37FromDiscord<Elegantbeef> Notice it's an `infix ->` which means if what it takes in is `typed` the code has to be valid on both sides, which you can see in the macro definition both `->` and `=>` use `untyped` so nope the pragma doesnt change anything in before the calls
03:57:49FromDiscord<Elegantbeef> Pretty much the answer is "If a macro takes untyped code, macros internally cannot expand before this call"
03:59:15FromDiscord<aleclarson> oo `dumptree` is nice \:)
03:59:27FromDiscord<aleclarson> i've just been guessing like a lunatic
03:59:42FromDiscord<Elegantbeef> there is also `dumpAstGen`
04:00:22FromDiscord<Elegantbeef> Impbox likes dumpastgen \:P
04:00:54FromDiscord<aleclarson> oh for copy paste goodness. nice
04:01:10FromDiscord<Elegantbeef> Well not that i suggest using it, cause it's harder to read/maintain
04:06:01*supakeen quit (Quit: WeeChat 3.2.1)
04:06:30*supakeen joined #nim
04:17:37FromDiscord<impbox [ftsf]> @Goat https://play.nim-lang.org/#ix=3y4Q using an ugly macro to create that nice syntax
04:18:07FromDiscord<impbox [ftsf]> and a good example of the ugly usage of dumpAstGen =)
04:26:46nrds<Prestige99> Hey Beef, any wm progress?
04:28:08FromDiscord<impbox [ftsf]> you're making a window manager beef?
04:30:49FromDiscord<Yardanico> oops, wanted to go to beef's github page but .. https://media.discordapp.net/attachments/371759389889003532/884294541245546496/unknown.png
04:31:25nrds<Prestige99> Hahha
04:31:42FromDiscord<Elegantbeef> I have been, havent touched it in a while
04:31:49FromDiscord<Elegantbeef> No i have not prestige
04:31:58nrds<Prestige99> Ah okay
04:32:02FromDiscord<Elegantbeef> I havent done much coding as of late aside from some compiler bodges
04:33:29nrds<Prestige99> I've been working on mine a bit again, took a little break from programming on the side
04:35:59FromDiscord<impbox [ftsf]> Linerino2 coming soon
04:37:35FromDiscord<Elegantbeef> Lol impbox hardly
05:20:10FromDiscord<bolino> sent a long message, see http://ix.io/3y50
05:28:48FromDiscord<impbox [ftsf]> @bolino are you sure the error is coming from that line?
05:30:25FromDiscord<bolino> In reply to @impbox "<@!509668107665539073> are you sure": You're right, it comes from the result, where I was trying to get the first line (while there weren't any). Sorry for the silly question. Thanks!
05:30:54FromDiscord<impbox [ftsf]> not a silly question, but more helpful if you include the full error message
05:33:50FromDiscord<bolino> In reply to @impbox "not a silly question,": I was doing a `echo(len(test[0]))` to test the query, and that was actually were it failed.
05:34:16FromDiscord<impbox [ftsf]> yep, that makes sense
05:34:20FromDiscord<bolino> It does
06:16:53*max22- joined #nim
06:24:31*jjido joined #nim
06:31:31*PMunch joined #nim
06:45:40FromDiscord<cabboose> how significant is the overhead for opening and closing channels
06:45:56FromDiscord<cabboose> like is it insignificant enough to create and pass around channels specific for jobs
06:46:06FromDiscord<cabboose> or better to have a channel and unique ids on the jobs or something
06:51:06FromDiscord<Rika> In reply to @cabboose "or better to have": Why not just do the ID version? It would be simpler
06:51:33NimEventerNew Nimble package! drawim - Simple library to draw stuff on a window, see https://github.com/GabrielLasso/drawim
06:51:35nrds<R2D299> itHub: 7"A simple drawing library in Nim, inspired by p5js"
06:51:39FromDiscord<cabboose> Just trying to get an idea of their flexibility really
06:53:07FromDiscord<Elegantbeef> Oh that's a nice library
06:53:12FromDiscord<Elegantbeef> Atleast the premise
06:58:33PMunch@cabboose, shouldn't be a lot of overhead to open a channel
06:59:08FromDiscord<cabboose> Thanks PMunch
06:59:16PMunchIt's basically just initialising a lock and a condition variable
06:59:43FromDiscord<cabboose> fab
07:11:31*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:15:28FromDiscord<treeform> In reply to @Rika "<@!107140179025735680> is there a": I don't think `wh` is a good idea. I should probably remove it. It should return an IVec2 .. integer version not the float version. Its an old function before we had integer vectors.
07:16:13FromDiscord<treeform> In reply to @Rika "does treeform mind if": I don't mind.
07:23:52FromDiscord<Rika> Okay
07:24:18FromDiscord<cabboose> This is what I understood after reading some of the RFCs for nim
07:24:23FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/884338219494309898/5m0w7d.png
07:24:33FromDiscord<Rika> In reply to @treeform "I don't think `wh`": Okay, thanks, it would be nice if sizes and positions were vectors instead of separate integers
07:25:23PMunch@Rika, most people don't seem to mind being pinged. But it might be annoying if people ping you when mentioning you without having a question for you specifically
07:25:40FromDiscord<Rika> Only happens in IRC heh
07:25:51FromDiscord<impbox [ftsf]> if you ping someone when you're talking about them rather than talking to them it's pretty annoying
07:25:55PMunch@cabboose, anything in particular you wonder about async/await?
07:26:17PMunchIt's not a perfect paradigm, but it works fairly well once you're used to it
07:26:21FromDiscord<cabboose> Just that it seems to light the fire under the nim developer community
07:26:35FromDiscord<Rika> I don’t see many fires though
07:26:40FromDiscord<cabboose> Really
07:26:46PMunch@Rika, happens automatically on IRC, but some people do it explicitly on other services
07:26:48FromDiscord<cabboose> I could imagine them throwing knives at each other at some points
07:26:49FromDiscord<Rika> Just confused people
07:27:21FromDiscord<cabboose> Oh nah I think async/await is fine (granted it was a pain in the ass and still is to learn some of it when using chronos)
07:27:21PMunchWell there is the whole CPS thing going on, and the current async implementation isn't perfect (although it has gotten better)
07:27:48FromDiscord<cabboose> Yeah that's pretty much what I was referring to hahaha. Was a good 3am read last night hahahaha
07:28:31FromDiscord<cabboose> I use the chronos implementation at this point I am more comfortable with it and want to use the status libp2p impl
07:28:56FromDiscord<Rika> In reply to @cabboose "Oh nah I think": Most people don’t use chronos
07:29:08FromDiscord<Rika> Only either status people or oddballs I would assume
07:29:17FromDiscord<cabboose> Also I feel like as the current major source of sponsorship for nim their issues will probably be focused/resolved should they come up sooner than later
07:29:31FromDiscord<cabboose> Then I am odd
07:29:31FromDiscord<Rika> In reply to @cabboose "Also I feel like": They already do
07:29:43FromDiscord<Rika> Yeah what is your reason to use chronos?
07:29:51FromDiscord<cabboose> Libp2p
07:29:55FromDiscord<cabboose> shrug
07:30:52FromDiscord<Stuffe> sent a long message, see http://ix.io/3y5j
07:34:36PMunchI've used chronos in the past, when the official async/await had some weird bug
07:36:18FromDiscord<Elegantbeef> Then there's me going "People use async"? 😀
07:36:44FromDiscord<cabboose> It seems good for my usecase
07:36:46FromDiscord<Rika> Man literally makes massive macros yet doesn’t know how async works
07:36:51FromDiscord<Rika> How
07:36:57FromDiscord<Elegantbeef> I know how it works i just dont use it
07:37:00FromDiscord<Rika> Macro brain rot
07:37:11FromDiscord<Rika> Why
07:37:15FromDiscord<Rika> Why don’t you use it
07:37:18FromDiscord<cabboose> Doesn't need it probably lol
07:37:19FromDiscord<Elegantbeef> I dont think any of my code tremendously benefits from async
07:37:26FromDiscord<Rika> That’s rare
07:37:40FromDiscord<Rika> So you have never done networking or anything related?
07:37:46FromDiscord<cabboose> You're saying that from a biased perspective though Rika
07:37:53FromDiscord<Elegantbeef> You underestimate how much code i actually write
07:38:07FromDiscord<cabboose> what if he was just using it for math crunching or something
07:38:10FromDiscord<Rika> Cabboose you should know that when we talk we’re not really serious
07:38:18FromDiscord<Elegantbeef> I've done networking in a game oriented situation
07:38:20FromDiscord<cabboose> yeah
07:38:26FromDiscord<impbox [ftsf]> I don't use async
07:38:28FromDiscord<cabboose> And I overanalyse and am morbose
07:38:44FromDiscord<Rika> I’m still seriously surprised there are people who haven’t used async
07:38:44FromDiscord<Elegantbeef> Impbox and I are game devs primarily \:D
07:38:45FromDiscord<impbox [ftsf]> generally game stuff you deal with stuff synchronously/poll
07:39:00FromDiscord<Elegantbeef> Async doesnt have as many purposes aside from asset loading
07:39:00FromDiscord<Rika> Async is just a different way to do polling half the time you know
07:39:04FromDiscord<impbox [ftsf]> yeah
07:39:09FromDiscord<impbox [ftsf]> i don't like that it hides the polling
07:39:28FromDiscord<Rika> You don’t need to use the procs that hide the polling
07:39:33FromDiscord<cabboose> But I think async has its own overhead that isn't worth it if you don't have long delays in IO right?
07:39:35FromDiscord<Rika> There’s quite literally a pill proc
07:39:40FromDiscord<Rika> Poll
07:39:55FromDiscord<Rika> In reply to @cabboose "But I think async": Yes
07:40:01FromDiscord<Rika> Games prolly not optimal for it
07:40:16FromDiscord<cabboose> How much aids can I generate from spamming Futures I dont discard
07:40:28FromDiscord<impbox [ftsf]> I'm sure it's useful, but we're doing that stuff anyway in games so I haven't felt the need for it
07:40:34FromDiscord<Hamid Bluri> !eval import pathutils
07:40:35NimBotCompile failed: /usercode/in.nim(1, 8) Error: cannot open file: pathutils
07:40:48FromDiscord<Elegantbeef> !eval import std/pathutils
07:40:49NimBotCompile failed: /usercode/in.nim(1, 11) Error: cannot open file: std/pathutils
07:40:51FromDiscord<Rika> Try prefixing with std/
07:40:52FromDiscord<Rika> Ok
07:41:01FromDiscord<Hamid Bluri> 😐
07:41:02FromDiscord<Rika> Probably compiler module
07:41:07FromDiscord<Elegantbeef> Was going to say
07:41:12FromDiscord<Hamid Bluri> In reply to @Rika "Probably compiler module": ?
07:41:20FromDiscord<impbox [ftsf]> `compiler/pathutils`
07:41:26FromDiscord<Rika> Install “compiler” module via nimble
07:41:31FromDiscord<Rika> Then use import compiler
07:41:53FromDiscord<cabboose> In reply to @Stuffe "I have an unusual": Just whatever your process/application would send to stdout AFAIK
07:42:37FromDiscord<cabboose> Oh yeah what was the prefix for the nimble packages
07:42:46FromDiscord<Elegantbeef> `pkg`
07:42:50FromDiscord<cabboose> i tried pckg a while ago but didnt work
07:42:53FromDiscord<cabboose> ok that would explain it
07:42:54FromDiscord<cabboose> rip
07:43:00FromDiscord<Rika> Lol no c
07:43:39FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/884343068634005544/5m0xla.png
07:46:40FromDiscord<linux user> 🗿
07:48:21FromDiscord<cabboose> I need to find the <1% of nim users that are australian
07:48:33FromDiscord<impbox [ftsf]> o/
07:48:59FromDiscord<Elegantbeef> Quite easy just type "oi cunt" and see how many people come out of the bush
07:49:07FromDiscord<impbox [ftsf]> yeah nah ay
07:49:23FromDiscord<Elegantbeef> gday mate
07:49:34FromDiscord<cabboose> I was thinking more of putting an obscure reference to the gremlin leading melbourne
07:50:07FromDiscord<Elegantbeef> Do you mean the people may or may not have shit in a macca's bathroom?
07:50:38FromDiscord<cabboose> The people who shit in a maccas bathroom
07:50:40FromDiscord<impbox [ftsf]> wow, beef you're knowledgeable about australian politics!
07:51:34FromDiscord<Rika> What the fuck lmao
07:51:53FromDiscord<Elegantbeef> I mean it's parliamentary how couldnt i! 😛
07:53:32FromDiscord<cabboose> I'm making a pharmacy application, wanted to know who I could ask for help with it if I ever need. It might make money so might be able to make some cheeky passive profits and just sell it off if it does any good
07:53:38FromDiscord<Elegantbeef> Remember i'm Canadian our politics are equally as silly. Blackface and elbow gate so I have to ensure it's the same elsewhere.
07:53:54FromDiscord<cabboose> But the apis I use have confidentiality agreements and all that bs I had to sign
07:54:12FromDiscord<cabboose> ah ya dickhead I thought you were aussie too
07:54:28FromDiscord<Elegantbeef> Sorry i mislead you
07:54:35FromDiscord<cabboose> 'sorry'
07:54:40FromDiscord<cabboose> how could I not know you were canadian
07:55:06FromDiscord<Elegantbeef> Also you know that "sorry" was pronounced "Sorey"
07:55:27FromDiscord<cabboose> Sorey fwend
07:55:56FromDiscord<Elegantbeef> I think impbox is the only active aussie, so you dont have a great pool to pick from \:D
07:57:12FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/884346475495170078/unknown.png
07:57:31FromDiscord<impbox [ftsf]> a great pool of 1!
08:00:09FromDiscord<Rika> You’re Australian? Huh
08:00:30FromDiscord<Elegantbeef> It's odd cause i swear more than him, i dont believe it myself
08:01:29FromDiscord<impbox [ftsf]> i don't swear except for exceptional circumstances
08:01:32FromDiscord<impbox [ftsf]> gotta save it up
08:01:47FromDiscord<impbox [ftsf]> that was it shocks people when you do
08:02:16FromDiscord<impbox [ftsf]> (edit) "was" => "way"
08:02:22FromDiscord<Elegantbeef> Ah if i want to shock people i show them my darwin award
08:04:47FromDiscord<cabboose> Which glorious state do you represent impbox
08:05:57FromDiscord<Elegantbeef> I like that question cause it implies people live anywhere but NSW/Victoria 😛
08:06:26FromDiscord<cabboose> I don’t think anyone ‘lives’ there anymore 🤣
08:06:52FromDiscord<cabboose> True blue western Aussie m8
08:07:02FromDiscord<cabboose> I’ll rep this side on my own
08:08:11FromDiscord<impbox [ftsf]> i'm over in the big outbreak state
08:08:41FromDiscord<cabboose> Refer to the teeth sucking picture above then
08:09:02FromDiscord<cabboose> Hope you and your family are safe
08:17:08*flynn quit (Read error: Connection reset by peer)
08:18:19*flynn joined #nim
08:18:41NimEventerNew thread by PMunch: Article series on multitasking in Nim, first installment: async, see https://forum.nim-lang.org/t/8400
08:31:13FromDiscord<cabboose> Great article PMunch
08:31:30PMunchThanks :)
08:31:51PMunchI hope you clicked through to the actual async article as well
08:32:05FromDiscord<cabboose> Yes of course thats what I was looking for hahaha
08:32:21FromDiscord<Elegantbeef> Now if only you wrote about a subject worth using 😛
08:32:38FromDiscord<cabboose> ;_;
08:33:15PMunchHaha, what would you want me to write about ElegantBeef? :P
08:33:26FromDiscord<Elegantbeef> Nah i'm a boring subject
08:33:26PMunchI just wrote about something that people seemed to be confused by
08:35:07FromDiscord<Elegantbeef> I'm joking of course i dont have any requests
08:39:52*Vladar joined #nim
08:48:58*PMunch quit (Ping timeout: 240 seconds)
08:50:22*PMunch joined #nim
08:58:43*max22- quit (Quit: Leaving)
09:24:20FromDiscord<Stuffe> In reply to @cabboose "Just whatever your process/application": Thanks for the response!
09:34:20FromDiscord<impbox [ftsf]> @PMunch https://peterme.net/multitasking-in-nim.html i'd recommend making the links to the articles a lot more prominent, it looks like this is the article and the links just look like text
09:34:38FromDiscord<impbox [ftsf]> i'd probably just put it all on one page with big headings with anchors
09:34:44FromDiscord<fae> nimpretty does some funny things heh, like semicolon vs comma separator
09:35:42FromDiscord<fae> sent a code paste, see https://play.nim-lang.org/#ix=3y5N
09:35:53FromDiscord<fae> but not vice versa, if comma is the first detected
09:36:06FromDiscord<Rika> Because it’s recommended to use ;
09:36:26FromDiscord<Rika> Nim pretty is inflexible
09:36:44FromDiscord<Rika> I’ve been thinking of making a more flexible formatter
09:36:50FromDiscord<Rika> But that’s a lot of work
09:37:49FromDiscord<fae> I didn't know that `;` was idiomatic Nim, I feel like most code samples I've looked at so far have used `,`
09:38:53FromDiscord<Rika> Idiomatic does not mean most used
09:39:04FromDiscord<Rika> Most people use , because it’s what they’re used to
09:39:10FromDiscord<Rika> All other languages use , after all
09:39:19FromDiscord<Rika> But there’s a pitfall to it
09:39:31FromDiscord<Elegantbeef> Well `;` is safer, but yea my brain cannot move towards `;`
09:40:13FromDiscord<Rika> Kinda do want to make that linter now but I don’t know where to start lol
09:41:28FromDiscord<fae> it seems like the main purpose of supporting both is to allow things like this to read better `(x, y, width, height: int; title: string; ...)`
09:41:37FromDiscord<Rika> Yes
09:41:37FromDiscord<haxscramper> In reply to @Rika "Because it’s recommended to": Aren't they just different
09:41:44FromDiscord<fae> commas for separating variable names, semis for separating types
09:41:53FromDiscord<Rika> They’re different but by default it is recommended to use ; over ,
09:42:05FromDiscord<Rika> Recommended by NEP is what I mean of course
09:42:29FromDiscord<Elegantbeef> Well the big safety is generics and ensuring you end var lists where you want
09:42:39FromDiscord<Rika> In reply to @fae "commas for separating variable": Not really? If you have a “using” statement you’ll need to use ;
09:42:58FromDiscord<fae> what does idiomatic mean? defined by the spec? the most prevalent style by the official maintainers?
09:43:10FromDiscord<fae> who determines it i guess
09:43:14FromDiscord<Rika> Good question
09:43:23FromDiscord<haxscramper> I rearely see `;` outside of the stdlib, and stdlib doesn not use it all that often either
09:43:28FromDiscord<Elegantbeef> But it's not too big of a benefit
09:43:31FromDiscord<fae> because the official docs are littered with mixed usage
09:43:33FromDiscord<haxscramper> so i don't know where this comes from
09:43:38FromDiscord<fae> as are a lot of linked resources
09:43:42FromDiscord<Elegantbeef> Also hello hax, funny you join now cause i think i just fixed the `for x in a[2]: discard` bug 😛
09:43:42FromDiscord<Elegantbeef> using `[]` for iterators that is
09:43:46FromDiscord<impbox [ftsf]> I didn't even realise ; was a thing in arg lists
09:44:14FromDiscord<haxscramper> In reply to @Elegantbeef "Also hello hax, funny": That sounds great, thanks for workin on it
09:44:35FromDiscord<Elegantbeef> In a bug fixing mood so scrolling through the issue list looking for bugs i can feasibly fix
09:44:40FromDiscord<haxscramper> My first encounter with `;` was like 2+ years after starting the language
09:45:20FromDiscord<haxscramper> And I just subconcously read `;` in argument list as `,` because it seems like every single language in existence that separates arguments does this with comma
09:45:56FromDiscord<fae> its actually a minor detail for me, i more thought it was interesting how nimpretty will take the first occurrence and apply it to the rest of the file, but only if the first occurrence is a `;`
09:46:03FromDiscord<fae> kind of confused me for a sec
09:46:18FromDiscord<haxscramper> Because nimpretty is actually pretty dumb
09:46:22FromDiscord<haxscramper> tool
09:46:42FromDiscord<haxscramper> Does not keep track of whether argument separator was a comma or a colon, so puts `;`, since it is safer
09:46:45FromDiscord<fae> it works nicely for the most part lol
09:47:03FromDiscord<fae> and its fast
09:47:30FromDiscord<fae> that's one of the nice things about tooling for nim, its usually written in nim and very fast
09:47:33FromDiscord<haxscramper> `echo "" > yourfile.nim` is even faster, and it actually removes all bugs as well
09:47:39FromDiscord<haxscramper> the best tool ever IMO
09:48:17FromDiscord<haxscramper> In reply to @fae "that's one of the": Nim is a good language to write all sorts of CLI & language-related toolingj
09:51:05FromDiscord<fae> Yea, I think it could be a great backend for native nodejs modules too. Certain projects in the web FE community are starting to gain a lot of traction (like for example this project named esbuild for compiling/bundling es6 code) because it's written in go and just so much faster than any of the current node solutions. But Nim would be even faster, and would be easier to ship tiny precompiled binaries.
09:52:46FromDiscord<fae> That's another issue with nodejs, having to compile native modules for target architecture. So it's becoming more common for people to ship prebuilt binaries for various archs
09:52:53FromDiscord<fae> Nim seems to excel at that
09:53:19FromDiscord<Rika> Well the only reason Go binaries are large is because of them being static
09:53:34FromDiscord<Rika> I don’t know why they make static binaries but they do
09:53:52FromDiscord<fae> easier to ship? idk
10:09:03PMunch@impbox, I see what you mean. I guess I could make the link colour a bit more obvious
10:15:49FromDiscord<fae> In reply to @PMunch "@impbox, I see what": That combined with how they were kind of in the middle of the page kind of fooled me too
10:16:54FromDiscord<fae> When reading a series I've always appreciated when the authors create a block of links to all articles in the series on each article so you can easily jump between them
10:17:37FromDiscord<fae> and usually put it at the very top or bottom, prefacing it with a "this is article x of y, here are links to the other articles" or something to that effect
10:18:06FromDiscord<fae> but i know you haven't written them all yet and that requires going back and editing 🙂
10:19:59PMunchThat's a good point though, when I add the next one I'll preface them with a little TOC thing
10:29:35*auxym_ joined #nim
11:01:25FromDiscord<Varriount> In reply to @PMunch "That's a good point": Give me TOC or give me death
11:03:03FromDiscord<cabboose> I dunno give me good content first lol
11:04:10FromDiscord<Rika> Tender ove and care
11:04:48PMunchHaha, Ove is actually a name here
11:04:56PMunchBut no, Table Of Contents
11:05:46FromDiscord<Rika> I’m joking haha
11:05:54FromDiscord<Rika> It’s what I thought of second after table of contents
11:10:52PMunchIs there a fancy function somewhere that parses any kind of call?
11:10:56PMunchIn a macro
11:11:13PMunchSo that it will accept both command, call, and dot calling
11:13:43PMunchI guess they all share the same structure of name, args so just checking if the kind is in nnkCallKinds should suffice
11:16:01*jjido joined #nim
11:16:41*flynn quit (Read error: Connection reset by peer)
11:17:48*flynn joined #nim
11:25:22*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:40:48*arkurious joined #nim
11:42:50PMunchIs there a `staticWrite` equivalent to `staticRead`
11:45:52FromDiscord<Rika> Do normal file write procs not work
11:46:42PMunchAh, indeed they do
11:49:09FromDiscord<Rika> Which begs the question of why do reads need a special proc
11:49:48PMunchHmm, I can't open a file though, it appears only writeFile works
12:06:02*supakeen quit (Quit: WeeChat 3.2.1)
12:06:30*supakeen joined #nim
12:11:56*auxym_ quit (Ping timeout: 256 seconds)
12:22:58FromDiscord<fae> FFI in Nim is fun. I've never really done any FFI stuff before but Nim makes it easy
12:23:38FromDiscord<fae> I feel like it quickly got me up to speed even though I have little knowledge about how compilers and linkers work
12:25:00FromDiscord<fae> Last night I was trying to wrap Yoga, but it was bugging me how it was a cpp library, so I went searching for a pure C flexbox implementation and found one made by the Xamarin team
12:25:33FromDiscord<fae> Anyway, tonight I got that wrapped and actually rendering out some layouts
12:25:42FromDiscord<Rika> gl
12:27:46FromDiscord<fae> Sometimes I wonder though if the library is small enough like 1k lines or less if it may just be faster to try porting by hand to pure Nim. But then you forego all the test suites and future updates etc, unless you do a bunch of work to keep stuff up to date.
12:28:25FromDiscord<Rika> wrapping is almost always faster than porting
12:28:32FromDiscord<Rika> unless your library is like 100 lines long
12:28:48FromDiscord<haxscramper> And if it doesn't use any "nice" features of C/C++
12:29:10FromDiscord<fae> im noticing that a lot of libraries I encounter are doing fancy macro stuff, which makes using c2nim difficult
12:29:24FromDiscord<fae> im not good enough at tweaking the C code to get a full transpile
12:29:25FromDiscord<enthus1ast> when i port stuff, i put them block by block into c2nim
12:30:14FromDiscord<enthus1ast> https://github.com/enthus1ast/nimCToNimGui
12:30:17nrds<R2D299> itHub: 7"<No Description>"
12:30:26FromDiscord<enthus1ast> this is a big help\: https://github.com/enthus1ast/nimCToNimGui/raw/master/img.png
12:31:19FromDiscord<Rika> that is one hell of a name though
12:31:48FromDiscord<haxscramper> `echo file.c | entr -rc sh 'c2nim file.c && bat file.nim'`
12:31:58FromDiscord<enthus1ast> yeah, it was just a hack to help me porting stuff, but i though putting it to github that i do'nt loose it
12:40:18FromDiscord<fae> Is it “bad” to write a more ergonomic wrapper around a c library with Nim conventions that just calls down to your ffi functions? Like can it be a performance issue.
12:40:59FromDiscord<enthus1ast> if the ergonomic has runtime implications, yes for sure
12:41:22FromDiscord<enthus1ast> but a lot can be done already on compile time
12:41:26*auxym_ joined #nim
12:41:49FromDiscord<fae> I’m thinking things like slightly changing function names, argument defaults things like that
12:47:10FromDiscord<haxscramper> no, this does not have any performance impact
12:47:43FromDiscord<haxscramper> `proc getInt(): int {.importc: "myLIbrary_getInt".}`
12:48:13FromDiscord<haxscramper> Converting `#define MY_CONST 0` to enum also does not have any perf. impact
12:51:21FromDiscord<fae> I assumed that simply renaming wouldn’t have overhead. But having an additional proc that takes args in a different way (like for creating objects) and then calls down to that could be bad
12:51:25FromDiscord<impbox [ftsf]> Those should probably be cint though
12:51:37FromDiscord<fae> In a hot path
12:51:39FromDiscord<impbox [ftsf]> If it's a c function
12:52:16*auxym_ quit (Quit: Konversation terminated!)
12:52:22FromDiscord<impbox [ftsf]> And converting int to cint may have performance costs if they're not the same
12:52:27FromDiscord<fae> That was my next question, is it bad to have a layer that converts between traditional Nim types and C types
12:52:37*auxym_ joined #nim
12:53:26FromDiscord<fae> Like what’s the difference between float32 and cfloat
12:55:29FromDiscord<haxscramper> You can add things like `always_inline` etc↵(@fae)
12:55:41FromDiscord<haxscramper> Well, if it is really importantn
12:56:28FromDiscord<haxscramper> Make nim proc `{.inline.}`, put `cgenDecl: `attribute((alywas\_inline)) $#$#$#\`
12:56:28FromDiscord<haxscramper> I don't rememerb exact syntax
12:56:54FromDiscord<haxscramper> Also don't forget about regular inlining, for proc in form of `proc myWrapper() = actualcstuff()` it is very likely to trigger
12:57:28FromDiscord<haxscramper> Well, you probably need 10 PHDs in compiler construciton to really understand cost analysis that GCC does for inlining
12:57:47FromDiscord<haxscramper> But generally speaking single `{.inline.}` and `--opt:speed` might be more than enough
12:58:33FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma
12:58:57FromDiscord<auxym> well if you're doing type casts/conversions it's still going to add a bit of overhead. Might not be significant though unless it's a really, really hot path. At this point (instruction-level optimization) it's probably worth running the code through godbolt with optimization enabled and see what's going on.
12:59:04FromDiscord<haxscramper> `proc myinterrupt() {.codegenDecl: "attribute((always_inline)) $# $#$#".} =`
12:59:47FromDiscord<haxscramper> `always_inline` does not guarantee perfect inlining as and probably this is not neded
13:01:37FromDiscord<fae> Okay, thanks for pointing me to some resources, I will do some reading. Granted this is all premature optimization thought process, just kind of curious how some of this works since I’m stepping into the foray.
13:02:17*kayabaNerve_ joined #nim
13:04:31*kayabaNerve quit (Ping timeout: 252 seconds)
13:06:10FromDiscord<auxym> Yeah. Premature optimization is probably not a good idea. Nim and gcc are both smart about optimization, more than you/me in most cases.
13:06:22*Vladar quit (Remote host closed the connection)
13:31:45*Vladar joined #nim
13:35:31FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3y6G
13:35:43FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3y6H
13:35:52FromDiscord<cabboose> why is this shit eating a bag of balls when I throw the pointer to another thread
13:36:05FromDiscord<cabboose> when it tries to send data to the channel it just chokes and says its reading from nil
13:36:19FromDiscord<cabboose> even trying to echo a repr of the ptr makes it burn in hell fire
13:36:53FromDiscord<cabboose> and yes the constructor is ugly but I am just trying to make this work
13:44:35FromDiscord<Rika> mans mad
13:44:43FromDiscord<Rika> because youre sending a ref?
13:44:50FromDiscord<Rika> ah, its shared
13:44:58FromDiscord<Rika> but eh no its still a ref
13:45:11FromDiscord<Rika> you're making a shared pointer of a threadlocal ref
13:45:37FromDiscord<Rika> @cabboose
13:46:33FromDiscord<Rika> i'd recommend just making a ptr to the actual object... is there a reason its a ref>
13:47:06FromDiscord<Rika> also the other refs asynclock and asyncevent seem problematic
13:47:30FromDiscord<Rika> how are you passing such pointer to thread
13:49:16*auxym_ quit (Quit: Konversation terminated!)
13:49:33*auxym_ joined #nim
14:04:25*auxym_ quit (Quit: Konversation terminated!)
14:04:37*auxym_ joined #nim
14:05:23PMunch@Araq, is there a way to get passC/passL on compile-time?
14:07:54Zevveuh what?
14:08:20Zevvhow do you mean? Generating passC/passL options at compile time?
14:08:47FromDiscord<Rika> is there a way to get [the value of the] passC/passL [command line parameters] on compile-time
14:08:51FromDiscord<Rika> is what i assume it means
14:09:06PMunchNo I want to get the declared ones
14:09:15PMunchYes
14:09:19Zevvright. that makes sense.
14:14:22*Gustavo6046 quit (Ping timeout: 252 seconds)
14:15:20*Gustavo6046 joined #nim
14:19:31*auxym_ quit (Quit: Konversation terminated!)
14:19:51*auxym_ joined #nim
14:20:36*PMunch quit (Quit: Leaving)
14:23:01*jjido joined #nim
14:34:38*auxym_ quit (Quit: Konversation terminated!)
14:34:54*auxym_ joined #nim
14:47:50*flynn quit (Read error: Connection reset by peer)
14:48:56*flynn joined #nim
14:51:45*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:52:50*pro joined #nim
15:01:56*flynn quit (Ping timeout: 256 seconds)
15:03:08*flynn joined #nim
15:04:54*auxym_ quit (Quit: Konversation terminated!)
15:05:11*auxym_ joined #nim
15:19:12FromDiscord<aleclarson> can a variable declared by `for..in` be made mutable somehow?
15:19:31FromDiscord<aleclarson> without separate variable declaration
15:19:32NimEventerNew thread by Neil_H: Accessing object properties where objects are in a sequence, see https://forum.nim-lang.org/t/8401
15:20:04*auxym_ quit (Quit: Konversation terminated!)
15:20:14*auxym_ joined #nim
15:20:19FromDiscord<aleclarson> eg: `for var item in items(seq1):` does not work
15:23:37FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y7t
15:26:09FromDiscord<auxym> See also: many types have `mitems` defined, which allows mutation
15:27:16FromDiscord<aleclarson> nice, but that would mutate `seq1` in my example, i think?
15:28:21FromDiscord<Goat> @impbox [ftsf] thank you for that macro last night. I made a minor tweak and now it's just right.
15:30:42FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3y7A
15:33:07FromDiscord<aleclarson> sent a code paste, see https://paste.rs/BpS
15:34:45FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=
15:35:15FromDiscord<auxym> works for arrays, too, which can start at indices other than 0 (actually can be indexed with any Ordinal)
15:35:50FromDiscord<aleclarson> good to know, thx
15:35:56FromDiscord<aleclarson> i'm using `for i in 0 ..< s.len:`
15:36:10FromDiscord<auxym> that works too (for seqs)
15:36:57FromDiscord<pointystick> you can also use mpairs to get both the index and the value: https://play.nim-lang.org/#ix=3y7C
15:39:17*Gustavo6046 quit (Remote host closed the connection)
15:40:32*auxym_ quit (Quit: Konversation terminated!)
15:40:47*auxym_ joined #nim
15:43:37*Gustavo6046 joined #nim
15:50:39*pro quit (Quit: WeeChat 3.2)
15:51:51FromDiscord<Gumber aka Zachary Carter> well mpairs gives you mutable values
15:51:54FromDiscord<Gumber aka Zachary Carter> but...
15:51:58FromDiscord<Gumber aka Zachary Carter> not sure if you care or not
15:55:40*auxym_ quit (Quit: Konversation terminated!)
15:55:50*auxym_ joined #nim
16:01:38nrds<Prestige99> @PMunch are you around?
16:02:19Zevvargh fuck I made the key-hole-shaped hole to hang my thingy up side down
16:02:21Zevvthat's pretty stupid
16:02:40FromDiscord<Rika> ?
16:03:04Zevvi made a thingy that hangs on the wall
16:03:17Zevvit has this little opening you can put the screw through and slide it
16:03:44FromDiscord<Rika> strange thing to say in the main nim channel but ok lol
16:03:48Zevvoh sorry
16:03:56Zevvooops EWRONGCHAN
16:06:35FromDiscord<Rika> lol
16:09:04FromDiscord<aleclarson> is there a performance gain from using `func` instead of `proc` or is it just for side effect protection at compile time?
16:10:47*auxym_ quit (Quit: Konversation terminated!)
16:10:54FromDiscord<Rika> no gain
16:11:04*auxym_ joined #nim
16:11:06FromDiscord<Rika> well, maybe in terms of extra optimisations but no direct gain
16:22:47FromDiscord<treeform> I also doubt there is a gain, but always measure 🙂
16:24:30FromDiscord<aleclarson> i only bother measuring when fixing obvious bottlenecks 😆
16:25:50*auxym_ quit (Quit: Konversation terminated!)
16:26:04FromDiscord<aleclarson> although, i've had the luxury of not needing optimal performance↵(yet i still like to be cognizant of easy wins)
16:26:08*auxym_ joined #nim
16:29:07FromDiscord<dom96> kinda afraid of what the new Discord Threads will bring
16:29:16FromDiscord<dom96> in terms of our relays
16:44:00FromDiscord<aleclarson> where is `do` syntax documented?
16:46:21FromDiscord<haxscramper> https://nim-lang.org/docs/manual_experimental.html#do-notation
16:49:28FromDiscord<aleclarson> what's the `.experimental` pragma to enable it? docs don't say
16:50:38FromDiscord<haxscramper> because there is no pragma for it
16:50:43FromDiscord<haxscramper> it is just enabled
16:50:54FromDiscord<haxscramper> lf
16:52:50FromDiscord<haxscramper> In reply to @dom96 "kinda afraid of what": they have to be manually enabled, right?
16:59:30FromDiscord<Rika> yes
16:59:36FromDiscord<Rika> they are disabled by default
17:02:32*flynn quit (Read error: Connection reset by peer)
17:03:38*flynn joined #nim
17:11:59*auxym_ quit (Quit: Konversation terminated!)
17:12:10*auxym_ joined #nim
17:13:29*flynn quit (Read error: Connection reset by peer)
17:14:35*flynn joined #nim
17:20:56FromDiscord<kamy> sent a code paste, see https://play.nim-lang.org/#ix=3y88
17:21:38FromDiscord<kamy> (edit) "https://play.nim-lang.org/#ix=3y88" => "https://play.nim-lang.org/#ix=3y8a"
17:22:27FromDiscord<kamy> (edit) "https://play.nim-lang.org/#ix=3y8a" => "https://paste.rs/PBC"
17:23:41*neurocyte quit (Quit: The Lounge - https://thelounge.chat)
17:27:06*neurocyte joined #nim
17:27:06*neurocyte quit (Changing host)
17:27:06*neurocyte joined #nim
17:28:39*userj joined #nim
17:30:40FromDiscord<dom96> In reply to @haxscramper "they have to be": yes, for now. But they'll be enabled automatically for all on the 9th
17:30:44FromDiscord<dom96> so in 3 days...
17:46:27FromDiscord<Rika> You can probably disable it again
17:49:20nrds<Prestige99> damn, end is a keyword
17:51:25FromDiscord<aleclarson> can `=>` and `do` notation be combined?
17:51:48FromDiscord<aleclarson> to create a multi-line proc
17:53:09FromDiscord<haxscramper> How this is supposed to work
17:53:46FromDiscord<haxscramper> You can probably combined them somehow, it is not disallowed, but I wonder whether why not just `proc()` in-place
17:54:02FromDiscord<aleclarson> doesn't `=>` provide return type inference?
17:54:56FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y8m
17:57:17FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3y8n
17:57:22FromDiscord<haxscramper> `=>` just uses `auto`, there is no special type inference
17:59:20FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y8o
17:59:43FromDiscord<haxscramper> can you show the code
18:00:53FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y8s
18:01:15FromDiscord<konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3y8t
18:01:52FromDiscord<aleclarson> In reply to @konsumlamm "you can try to": `expression expected, but found 'keyword block'`
18:02:17FromDiscord<haxscramper> `proc (): auto = foo + 1` in a statement is parsed as regular proc declaration
18:03:16FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3y8v
18:03:45FromDiscord<aleclarson> no way around the variable name repetition?
18:04:23FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3y8w
18:04:44FromDiscord<haxscramper> also use of `auto` is discouragend
18:04:44FromDiscord<haxscramper> also use of `auto` is discouraged
18:04:52FromDiscord<haxscramper> At least in cases like this
18:05:32FromDiscord<haxscramper> You can use template that I showed
18:05:44FromDiscord<haxscramper> matrix bridge lag
18:06:01FromDiscord<haxscramper> ffs, do they really host it on potato
18:14:24*auxym_ quit (Read error: Connection reset by peer)
18:14:43*auxym_ joined #nim
18:23:02*nrds quit (Remote host closed the connection)
18:23:16*nrds joined #nim
18:25:07FromDiscord<aleclarson> how do i combine `Option` with an iterator, without getting the `escapes its stack frame` error
18:25:10FromDiscord<aleclarson> (edit) "error" => "error?"
18:26:53FromDiscord<haxscramper> Can you show the code, again? I'm pretty sure that has something to do with `some addr <local-variable>` or similar
18:27:14FromDiscord<haxscramper> But the error is weird and it is not clear what is going on from description alone
18:27:32FromDiscord<haxscramper> just `iterator arg(): Option[int] = yield some 12` should work
18:28:04FromDiscord<Elegantbeef> what do you mean?
18:29:43FromDiscord<aleclarson> here's a contrived repro:↵https://play.nim-lang.org/#ix=3y8A
18:30:16FromDiscord<aleclarson> whoops, forgot to `inc(i)` in `foo` but you get the point
18:31:42FromDiscord<aleclarson> i guess not using `lent` is one workaround \:P
18:31:51FromDiscord<aleclarson> but it prevents an extra copy, yes?
18:33:09FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3y8D
18:33:28FromDiscord<haxscramper> Now the issue itself - you are trying to `lent` a local variable
18:34:19FromDiscord<haxscramper> After `items()` is finished execution whatewher borrowed it's results will basically have a reference to a local variable that exited the scope
18:34:29FromDiscord<haxscramper> > 'data' escapes its stack frame
18:35:24FromDiscord<aleclarson> ah ok thx for the explanation!
18:35:54FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3y8H
18:36:16FromDiscord<haxscramper> `arg[0]` is external, to the proc, so ownership tracking allows you to lent data that is not local
18:37:04*flynn quit (Read error: Connection reset by peer)
18:38:10*flynn joined #nim
18:53:00nrds<Prestige99> How do you handle type name conflicts? I have a type `Line` in my project` but so does another import I'm using
18:53:03FromDiscord<TennisBowling> does `-d:danger` provide a speedup (even if extremely small) compared to `release`?
18:53:46nrds<Prestige99> oh I see
18:55:48FromDiscord<Recruit_main707> In reply to @TennisBowling "does `-d:danger` provide a": yes
18:56:00FromDiscord<TennisBowling> cooo
18:56:03FromDiscord<TennisBowling> (edit) "cooo" => "cool"
18:56:15FromDiscord<Recruit_main707> i dont remember what exactly changed, i think it had to do with checking segfaults or something
19:00:08FromDiscord<metamuffin> }n
19:10:08*flynn quit (Read error: Connection reset by peer)
19:11:14*flynn joined #nim
19:22:55*flynn quit (Read error: Connection reset by peer)
19:24:01*flynn joined #nim
19:27:21FromDiscord<Recruit_main707> c2nim changed std::string to nim normal string when wrapping functions, is that correct??
19:27:24*max22- joined #nim
19:29:22*ad-absurdum joined #nim
19:33:18*flynn quit (Read error: Connection reset by peer)
19:34:24*flynn joined #nim
19:37:03FromDiscord<aleclarson> aww man, i thought `dumpTree` would print the AST after macros were applied \:(
19:41:53*auxym_ quit (Quit: Konversation terminated!)
19:42:06*auxym_ joined #nim
19:48:10*Gustavo6046 quit (Ping timeout: 240 seconds)
20:06:25FromDiscord<Elegantbeef> Like i said @aleclarson `untyped` macros do not expand, you'd want `expandMacros`
20:08:46*auxym_ quit (Quit: Konversation terminated!)
20:09:09*auxym_ joined #nim
20:12:44FromDiscord<aleclarson> yeah that occurred to me, i'm just disappointed is all \:P
20:12:56FromDiscord<Elegantbeef> you can also compile with `--expandMacro:yourMacroName`
20:13:34FromDiscord<aleclarson> cool thx for the tip
20:23:55*auxym_ quit (Quit: Konversation terminated!)
20:24:12*auxym_ joined #nim
20:48:07FromDiscord<tandy> is there a convienient way to get the difference between two seqs?
20:52:01FromDiscord<Recruit_main707> can you give an example?
20:53:09FromDiscord<tandy> seqA = [1, 2, 3]↵seqB = [1, 2]difference = [3]
20:53:12*Vladar quit (Quit: Leaving)
20:54:17FromDiscord<Recruit_main707> what about this:↵var a = @[1, 3, 2]↵var b = @[1, 2] difference = @[3] ?
20:54:44FromDiscord<Recruit_main707> or difference = @[3, 2]
20:55:47FromDiscord<tandy> this yeah↵(@Recruit_main707)
20:55:55FromDiscord<tandy> i sort the lists first any
20:56:19FromDiscord<tandy> because i do an assert to check if they are equal
20:57:24*auxym_ quit (Quit: Konversation terminated!)
20:57:40*auxym_ joined #nim
20:58:49FromDiscord<aleclarson> is there a shorthand for converting an iterator to seq?
20:59:04FromDiscord<Recruit_main707> there is a toSeq function i think
20:59:20FromDiscord<aleclarson> sweet thx
20:59:26FromDiscord<Elegantbeef> `import std/strutils`
20:59:39FromDiscord<Elegantbeef> `toseq(yourItem.iteratorName)`
20:59:51FromDiscord<Recruit_main707> thanks beef
21:00:07FromDiscord<Elegantbeef> In stable you cannot use `toSeq` with the method call syntax so for a table it's like `toSeq(table.values)` not ideal but nor is converting an iterator to a seq 😛
21:00:57*userj quit (Ping timeout: 245 seconds)
21:03:03FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3y9q
21:03:33FromDiscord<tandy> i wrote a function that did this, but it didnt work i think↵(@Recruit_main707)
21:03:51FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3y9r
21:04:00FromDiscord<Elegantbeef> Lol i'm tired and wrote `strutils` i meant sequtils @aleclarson
21:04:33FromDiscord<aleclarson> i noticed \:P↵is `toSeq` faster, or just a macro for `for..in`?
21:04:53FromDiscord<Elegantbeef> it's just a macro
21:04:59FromDiscord<Elegantbeef> Not like you can do anything faster since iterators can be anything
21:05:39FromDiscord<Recruit_main707> tandy: i just tried that function on the playground, maybe you did something wrong, try with that and ping me if something fails
21:05:43FromDiscord<Elegantbeef> Ideally you dont convert to seq unless you really need to
21:05:53FromDiscord<aleclarson> ofc \:)
21:06:32FromDiscord<Recruit_main707> im gonna ask again since it got burried in all this: does someone know if i can make c2nim ignore errors?
21:07:16FromDiscord<Elegantbeef> recruit really making me feel bad i've never used c2nim 😛
21:11:07FromDiscord<Elegantbeef> Anyone got some nice "X should compile, but doesnt"?
21:24:22*flynn quit (Read error: Connection reset by peer)
21:25:29*flynn joined #nim
21:27:37*auxym_ quit (Quit: Konversation terminated!)
21:27:56*auxym_ joined #nim
21:42:44*auxym_ quit (Quit: Konversation terminated!)
21:43:03*auxym_ joined #nim
21:57:18FromDiscord<chicken mcnuggets> hey
21:57:31FromDiscord<chicken mcnuggets> how would i go about converting a uint16 to a big endian
22:02:34NimEventerNew thread by Argl: Behavior of {.global.} variable for assigning to const, see https://forum.nim-lang.org/t/8402
22:05:22FromDiscord<aleclarson> to convert `ptr int` to `int`, do i need to cast, or is there a safer way?
22:06:21FromDiscord<aleclarson> oh wait, it's `[]` isnt it
22:07:41FromDiscord<Recruit_main707> yep
22:07:49FromDiscord<Recruit_main707> well, it depends
22:07:57*max22- quit (Quit: Leaving)
22:08:12FromDiscord<Recruit_main707> do you want the integer representation of the pointer or the integer the pointer points to
22:08:43FromDiscord<aleclarson> the latter
22:08:51FromDiscord<Recruit_main707> then yes
22:09:44FromDiscord<aleclarson> so apparently i can't pass a `var Thing` to a proc that takes `Thing`?↵> 'cursor' is of type <var Cursor> which cannot be captured as it would violate memory safety
22:10:25FromDiscord<Recruit_main707> can you send a code snippet
22:10:34FromDiscord<Elegantbeef> Sounds like you're using a closure and attempting to closure a var parameter
22:12:12FromDiscord<aleclarson> In reply to @Elegantbeef "Sounds like you're using": oh yep ur right
22:12:31FromDiscord<aleclarson> what do?
22:12:37NimEventerNew thread by SFR0815: Destroying ref objects, see https://forum.nim-lang.org/t/8403
22:12:58*auxym_ quit (Quit: Konversation terminated!)
22:12:58FromDiscord<aleclarson> i guess cache it in a `let` first
22:13:18*auxym_ joined #nim
22:15:02FromDiscord<aleclarson> oh jeez↵> '=copy' is not available for type <Cursor>; requires a copy because it's not the last read of 'cursor'
22:16:02FromDiscord<aleclarson> here's a repro↵https://play.nim-lang.org/#ix=3y9A
22:16:14FromDiscord<aleclarson> oh wait no it's not
22:17:04FromDiscord<aleclarson> https://play.nim-lang.org/#ix=3y9B
22:17:19FromDiscord<aleclarson> ☝️ that's with the first error
22:17:20FromDiscord<Elegantbeef> well `var T` is a mutable reference, so if the closure can outlive the reference issues can occur, you can use a `ptr T` instead, but you need to know that may be unsafe
22:19:35FromDiscord<aleclarson> ah ok makes sense
22:20:54*koltrast quit (Quit: ZNC - http://znc.in)
22:21:15FromDiscord<Elegantbeef> This isnt exactly what you want but you can make your own closure like object https://play.nim-lang.org/#ix=3y9D
22:21:32FromDiscord<aleclarson> so if i use `arg: ptr T`, i can deref that into a `let` to avoid a copy?
22:21:42FromDiscord<aleclarson> (edit) "`let`" => "`var`"
22:21:54*koltrast joined #nim
22:22:27FromDiscord<Elegantbeef> Yes you can do https://play.nim-lang.org/#ix=3y9E
22:22:40FromDiscord<Elegantbeef> It's unsafe though 😀
22:22:56FromDiscord<Elegantbeef> Well probably unsafe 😀
22:22:57FromDiscord<aleclarson> right, once the var's scope exits, it's a null ptr
22:23:05FromDiscord<Elegantbeef> It's not a null ptr
22:23:09FromDiscord<Elegantbeef> It's a dangling pointer
22:23:18FromDiscord<aleclarson> tomato tomato
22:23:23FromDiscord<Elegantbeef> Those are two vastly different things
22:24:08FromDiscord<Elegantbeef> a dangling pointer points to where memory was, and dereferencing it can cause silent issues, a nil pointer points to the start of the program and derferencing just causes a crash
22:24:35FromDiscord<aleclarson> gotcha
22:27:25FromDiscord<aleclarson> no way to prevent the dangling pointer without a copy?
22:28:06*auxym_ quit (Quit: Konversation terminated!)
22:28:11FromDiscord<aleclarson> oh `GC_ref` would work, yes?
22:28:13FromDiscord<Elegantbeef> Well you're safe if you dont let the closure outlive the `t`
22:28:17FromDiscord<Elegantbeef> but that's not enforced, but with borrow checker would be
22:28:19FromDiscord<Elegantbeef> No
22:28:22*auxym_ joined #nim
22:29:06FromDiscord<Elegantbeef> `Thing` is a stack allocated object, therefore when this exists scope `t` no longer exists and a pointer to `t` is just in the stack somewhere
22:29:41FromDiscord<Elegantbeef> You can use `Thing = ref object`
22:30:02FromDiscord<Elegantbeef> This makes it safe to capture since the GC knows you're referencing the value
22:30:10FromDiscord<aleclarson> why can't the closure capture its scope?
22:30:37FromDiscord<Elegantbeef> No clue what you mean
22:30:48FromDiscord<aleclarson> ok i just got confused for a sec
22:32:28FromDiscord<Elegantbeef> Also for yet another variation, this is valid https://play.nim-lang.org/#ix=3y9G
22:32:28FromDiscord<aleclarson> how do I convert a variable of type `T` to `ref T` (where `T` is an `object`) without changing type `T`
22:32:40FromDiscord<Elegantbeef> \`var a = new T
22:33:25FromDiscord<Elegantbeef> To put it lightly there are many ways to do this all
22:33:27FromDiscord<Elegantbeef> You can also do `PThing = ref object` but that's less idiomatic
22:33:39FromDiscord<Elegantbeef> well inside a type def
22:37:09FromDiscord<aleclarson> does `ref T` imply `var ref T`?
22:37:34FromDiscord<aleclarson> (edit) "does `ref T` ... imply`ref" added "as an argument type" | "`var ref" => "`ref var"
22:37:43FromDiscord<Elegantbeef> no `var ref T` is a mutable pointer `ref T` is just mutable fields
22:40:12FromDiscord<aleclarson> i edited my message to be `ref var T` but i guess your chat client doesn't receive edits?
22:40:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3y9K
22:40:42FromDiscord<Elegantbeef> Alternatively i'm just bad at readint
22:40:43FromDiscord<Elegantbeef> Alternatively i'm just bad at reading
22:41:36FromDiscord<aleclarson> anything's possible i guess \:P
22:42:04FromDiscord<Elegantbeef> `ref var T` doesnt make any sense
22:42:48FromDiscord<Elegantbeef> `var T` is a mutable reference(which can be stack allocated), `ref var T` is a heap reference to a mutable reference...
22:43:12FromDiscord<aleclarson> i didn't mean it literally, but good to know
22:45:16FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y9L
22:45:24FromDiscord<aleclarson> rather, point to `t` and keep it alive
22:45:33FromDiscord<Elegantbeef> Nope since it's stack allocated
22:45:52FromDiscord<Elegantbeef> you cannot convert a stack allocated variable to a GC managed one
22:46:34FromDiscord<aleclarson> so basically, i can't keep a local variable alive without copying or it being a `ref object`
22:46:48FromDiscord<Elegantbeef> Well that's what a local variable means
22:46:54FromDiscord<aleclarson> in reality, the latter is still copying, but just the pointer
22:47:06FromDiscord<Elegantbeef> a local variable is only alive as long the scope exists
22:47:30FromDiscord<Elegantbeef> That's by design of a the stack, it expands per stack frame requirements then shrinks when leaving that frame
22:47:50FromDiscord<aleclarson> i think javascript does some magic where local variables referenced by a closure will be kept on the stack
22:48:24FromDiscord<Elegantbeef> I mean all of JS is references isnt it?
22:48:34FromDiscord<Elegantbeef> So it's not a stack/heap difference it's all heap
22:48:36FromDiscord<aleclarson> ah, so that's the trick \:P
22:50:07FromDiscord<aleclarson> so i guess defaulting to `ref object` (when writing new types) is the smarter choice, and then use `object` only if you know you'll never need a closure to access it
22:50:39FromDiscord<Elegantbeef> Well possibly for you
22:50:54FromDiscord<Elegantbeef> Refs are used when you need ref semantics, which this falls under
22:53:37FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y9M
22:57:33FromDiscord<Elegantbeef> The lambda lifting seems to be smart enough to copy when it makes sense
22:57:37FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3y9O
22:57:57FromDiscord<Elegantbeef> Not really
22:58:24*auxym_ quit (Quit: Konversation terminated!)
22:58:39*auxym_ joined #nim
22:59:27FromDiscord<Elegantbeef> Considering there is no way presently to ensure that the captured `i` doesnt outlive the first `i` it makes sense to error since internally `var int` is really `ptr int`
23:00:24FromDiscord<Elegantbeef> in the case where the variable is declared in a scope above the closure procedure it reasons it's safe to copy/refer to it as it's not a `var int` it's an `int` i guess, so it copies it
23:00:35FromDiscord<Elegantbeef> Unless it's a global then it refers to it seems
23:01:07FromDiscord<Elegantbeef> If you want to get into the nitty gritty of closures https://nim-lang.github.io/Nim/intern.html#code-generation-for-closures
23:09:56FromDiscord<Recruit_main707> How could i create no ordinal sets?
23:10:01FromDiscord<Recruit_main707> non
23:10:10FromDiscord<Elegantbeef> what do you mean?
23:10:30FromDiscord<Elegantbeef> `import std/sets`?
23:12:12FromDiscord<Recruit_main707> ok, but i actually need to interop with c++ sets, is there any wrapper out there?
23:13:35*auxym_ quit (Quit: Konversation terminated!)
23:13:42*auxym joined #nim
23:13:54*ad-absurdum quit (Quit: Leaving)
23:14:47FromDiscord<Recruit_main707> cppstl doesnt seem to have it :/
23:16:22FromDiscord<Recruit_main707> `CppSet[T] {.importcpp: "std::set".} = object`↵i hope this is enough to make the compiler happy lol
23:28:36*auxym quit (Quit: Konversation terminated!)
23:28:55*auxym joined #nim
23:30:07*stkrdknmibalz joined #nim
23:37:33*vicfred joined #nim
23:38:34*flynn quit (Read error: Connection reset by peer)
23:39:41*flynn joined #nim
23:43:44*auxym quit (Quit: Konversation terminated!)
23:44:00*auxym joined #nim
23:59:19*flynn quit (Read error: Connection reset by peer)