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