00:05:12 | FromDiscord | <Arathanis> In reply to @Hourglass, When the Hour Strikes "I wish everyone a": D: |
00:06:20 | FromDiscord | <Chronos [She/Her]> :D |
00:06:30 | FromDiscord | <Arathanis> ;-; |
00:11:19 | * | oldpcuser_ joined #nim |
00:11:28 | FromDiscord | <Rika> I see no problems here though |
00:12:31 | * | oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_))) |
00:12:37 | * | oldpcuser_ is now known as oldpcuser |
00:17:56 | FromDiscord | <Chronos [She/Her]> In reply to @Rika "I see no problems": Good day privileges revoked, that is horrid |
00:20:09 | FromDiscord | <Rika> Jokes on you my day is good regardless of what you say |
00:20:33 | FromDiscord | <Chronos [She/Her]> In reply to @Rika "Jokes on you my": Perish |
00:22:12 | FromDiscord | <Arathanis> I mean I guess I understand rage at being tricked into reading Java |
00:22:23 | FromDiscord | <Rika> In reply to @Arathanis "I mean I guess": :baqua: |
00:27:25 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xqp |
00:28:04 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4xqp" => "https://play.nim-lang.org/#ix=4xqq" |
00:29:38 | * | oldpcuser_ joined #nim |
00:30:25 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xqs |
00:30:34 | FromDiscord | <sOkam!> oh makes sense. kk |
00:32:14 | * | oldpcuser quit (Ping timeout: 250 seconds) |
00:36:39 | * | derpydoo joined #nim |
00:42:02 | * | oldpcuser_ is now known as oldpcuser |
00:45:22 | * | xet7 joined #nim |
00:46:54 | FromDiscord | <Elegantbeef> `when not it.hasBinding:` |
00:46:58 | FromDiscord | <Elegantbeef> 😄 |
00:47:17 | FromDiscord | <Elegantbeef> I assume that's not a type operation so cannot be done at CT |
00:51:42 | * | jkl quit (Quit: Gone.) |
00:53:20 | * | jkl joined #nim |
01:27:08 | * | oldpcuser_ joined #nim |
01:29:37 | * | oldpcuser quit (Ping timeout: 240 seconds) |
01:36:32 | FromDiscord | <Kai.> so im a lil new with this stuff |
01:36:37 | FromDiscord | <Kai.> what is stdin |
01:36:58 | FromDiscord | <Arathanis> standard input |
01:37:14 | FromDiscord | <Arathanis> keyboard buffer basically |
01:37:27 | FromDiscord | <Kai.> In reply to @Arathanis "standard input": so whats stdout |
01:37:31 | FromDiscord | <Kai.> standard output? |
01:37:34 | FromDiscord | <Arathanis> standard output |
01:37:41 | FromDiscord | <Kai.> and what does that do |
01:37:47 | FromDiscord | <Arathanis> displays text |
01:37:54 | FromDiscord | <Kai.> i see i see |
01:38:00 | FromDiscord | <Kai.> very useful knowledge |
01:38:12 | FromDiscord | <Arathanis> when you open a terminal and you type and hit enter you are sending things through stdin |
01:38:27 | FromDiscord | <Arathanis> when output text comes out the program that was reading your stdin is writing to stdout |
01:38:36 | FromDiscord | <Kai.> i see |
01:38:44 | FromDiscord | <Arathanis> also, based pfp |
01:38:54 | FromDiscord | <Kai.> In reply to @Arathanis "also, based pfp": Amity best girl |
01:39:03 | FromDiscord | <Arathanis> 🙏 |
01:39:05 | FromDiscord | <Kai.> my pfp used to be my gf |
01:39:05 | FromDiscord | <Arathanis> owl house is great |
01:39:10 | FromDiscord | <Kai.> kinda got used to it being amity |
01:39:20 | FromDiscord | <Kai.> and forgot to change it back |
01:39:26 | FromDiscord | <Arathanis> im glad they let them wrap it up even if it was kind of a 3 episode rush job |
01:39:29 | FromDiscord | <Kai.> In reply to @Arathanis "owl house is great": teach me the ways of nim |
01:39:32 | FromDiscord | <Kai.> In reply to @Arathanis "im glad they let": yeah |
01:39:40 | FromDiscord | <Kai.> fucking missed a beach episode |
01:40:00 | FromDiscord | <Arathanis> ill take jokes about a missed beach episode though |
01:40:02 | FromDiscord | <Arathanis> lmao |
01:40:12 | FromDiscord | <Arathanis> anywho, feel free to ask questions here about Nim |
01:40:15 | FromDiscord | <Arathanis> people be helpful |
01:40:29 | FromDiscord | <Arathanis> and further owl house convo should be taken to #offtopic lest we get shamed |
01:40:38 | FromDiscord | <Kai.> lol |
01:40:38 | FromDiscord | <Kai.> uh |
01:40:45 | FromDiscord | <Elegantbeef> You'll get shamed eitherway |
01:40:51 | FromDiscord | <Kai.> idk what should I make as a first beginner friendly program |
01:41:00 | FromDiscord | <Kai.> and whats with the mass ammounts of webhooks |
01:41:03 | FromDiscord | <Kai.> can I make my own webhook |
01:41:04 | FromDiscord | <Arathanis> In reply to @Elegantbeef "You'll get shamed eitherway": shame from you doesn't count, that is inevitable |
01:41:07 | FromDiscord | <Arathanis> 😉 |
01:41:28 | FromDiscord | <Kai.> I want my own webhook |
01:41:55 | FromDiscord | <Elegantbeef> Only the one that has never been shamed can cast the first stone arath |
01:43:34 | FromDiscord | <Arathanis> In reply to @Kai. "I want my own": you want to implement a webhook system or interface with a system that provides a webhook? |
01:43:44 | FromDiscord | <Kai.> In reply to @Arathanis "you want to implement": no like |
01:43:45 | FromDiscord | <Kai.> this guy |
01:43:49 | FromDiscord | <Kai.> In reply to @Elegantbeef "Only the one that": this man |
01:43:52 | FromDiscord | <Kai.> hes a weebhook |
01:44:06 | FromDiscord | <Kai.> although learning how to make http requests in nim would be nice |
01:44:28 | * | oldpcuser_ is now known as oldpcuser |
01:44:38 | FromDiscord | <Arathanis> In reply to @Kai. "although learning how to": https://nim-lang.org/docs/httpclient.html |
01:44:58 | FromDiscord | <Kai.> In reply to @Arathanis "https://nim-lang.org/docs/httpclient.html": nice |
01:45:20 | FromDiscord | <Kai.> beyond my scopes rn |
01:45:29 | FromDiscord | <Arathanis> good to have it on your radar though. |
01:45:43 | FromDiscord | <Arathanis> its pretty straightforward and high level, Nim is very expressive |
01:46:04 | FromDiscord | <Arathanis> otherwise the "Learn Nim in 5 Minutes" is a good crash course for getting hungry for more, then you can read the manual for more in depth knowldge |
01:46:07 | FromDiscord | <Arathanis> ask questions here while doing it |
01:47:36 | FromDiscord | <Arathanis> oh and the webhooks you appear to being referring to is a lot of people are on IRC using talking over a bridge (which is all the bots) |
01:47:41 | FromDiscord | <Elegantbeef> Well t2bot's matrix bridge is open source |
01:47:48 | FromDiscord | <Elegantbeef> I'm on matrix thank you very much |
01:48:09 | FromDiscord | <Elegantbeef> It's not 1987 over here it's at least 2016 |
02:13:23 | FromDiscord | <sOkam!> In reply to @Elegantbeef "I assume that's not": yeah its rt |
02:15:49 | NimEventer | New post on r/nim by idyllic_q: Prospects of utilising Nim in scientific computation?, see https://reddit.com/r/nim/comments/13zxq5d/prospects_of_utilising_nim_in_scientific/ |
03:21:55 | * | oldpcuser quit (Quit: I use Vum - The Vi Useless not iMproved Text Editor!) |
03:29:14 | * | oldpcuser joined #nim |
04:38:39 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/63DGe |
04:44:02 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xr5 |
04:47:40 | FromDiscord | <Graveflo> have you put a sanity check in data.nim to make sure it's really being imported? I can't think of anything esle |
04:56:49 | FromDiscord | <sOkam!> Tried randomly checking for a cyclic dependency, in case the compiler was failing me again this week and not reporting it... and correct↵I'm really getting all the compiler bugs this week 😭 |
04:56:56 | FromDiscord | <sOkam!> it was a cyclic dependency not listed |
04:58:25 | FromDiscord | <Graveflo> this is a long shot |
04:58:33 | FromDiscord | <Graveflo> but try `data.isRenderData()` |
05:01:54 | FromDiscord | <Graveflo> oh so the unreported cyclical dep was the error gotcha |
06:02:27 | * | ntat joined #nim |
06:53:59 | * | ntat quit (Ping timeout: 250 seconds) |
07:06:47 | * | ntat joined #nim |
07:58:24 | * | xet7 quit (Remote host closed the connection) |
08:00:51 | FromDiscord | <rishav> How do transpilers like Nim handle run time errors? does the Nim codegen just stick the generated C code in a huge try catch to intercept & decorate the errors? |
08:02:19 | * | ntat quit (Ping timeout: 265 seconds) |
08:19:05 | FromDiscord | <leorize> the same way you'd handle it if you compile to an executable \:p |
08:20:54 | * | xet7 joined #nim |
08:22:39 | FromDiscord | <leorize> so Nim's latest implementation of exceptions is via thread-local error flags, which is set by `raise` and after a potential generator (ie. function call), the flag will be checked and then execution is passed to the handler |
08:31:38 | FromDiscord | <rishav> WOuldn't that still require try catch blocks? |
08:37:37 | FromDiscord | <Rika> C doesnt have try catch tho? |
08:38:33 | FromDiscord | <Chronos [She/Her]> I wonder how easily you'd be able to replace built-in Python data types with a Nim module for Python |
08:38:41 | FromDiscord | <Chronos [She/Her]> And if there'd be any benefit to that |
08:39:00 | FromDiscord | <Chronos [She/Her]> Python lists probably work similar to seqs |
08:39:13 | FromDiscord | <Chronos [She/Her]> Can have a table of PyObjects |
08:46:57 | FromDiscord | <Chronos [She/Her]> In reply to @Arathanis "I mean I guess": I can read and write Java, I hate the way you've indented and used braces and semicolons though |
08:47:10 | FromDiscord | <Chronos [She/Her]> Shitty language idea: Java but whitespace |
08:57:13 | FromDiscord | <Elegantbeef> Shittier language idea\: java |
09:02:11 | * | ntat joined #nim |
09:25:29 | * | ntat quit (Ping timeout: 265 seconds) |
09:38:31 | * | ntat joined #nim |
10:08:42 | FromDiscord | <demotomohiro> In reply to @rishav "How do transpilers like": You can read Nim generated C code or assembly code to see how Nim do runtime checks. |
10:16:35 | FromDiscord | <demotomohiro> In reply to @rishav "WOuldn't that still require": C doesn't have try catch block.↵Here is how an executable file compiled by Nim do runtime checks:↵https://godbolt.org/z/Gzeh515xY |
11:03:42 | FromDiscord | <Ayman El hasbi> heey , buddy m not a java lover or something but why u hate it ? |
11:04:28 | FromDiscord | <Ayman El hasbi> for me i just hate the syntax 😁, not the jvm or something (maybe because i just see the surface of the Iceberg) but i'm more interrested to know why others hate java ! |
11:07:14 | * | derpydoo quit (Quit: derpydoo) |
11:27:57 | FromDiscord | <chmod222> It belongs to Oracle now and that is enough reason for me |
11:28:46 | FromDiscord | <chmod222> Give them 10 more years and every time you invoke a class constructor, they charge your credit card for it |
13:16:48 | FromDiscord | <Ayman El hasbi> ok , what abt openjdk then ? |
13:16:59 | FromDiscord | <michaelb.eth> was about to ask the same |
13:17:33 | FromDiscord | <michaelb.eth> there's the Adoptium project/group, and also IBM offers builds of openjdk with their openj9 gc, which is pretty sweet |
13:17:35 | FromDiscord | <Ayman El hasbi> yes the big tech hatered thing , i understand and me too i dont use microsoft nor oracle thing , but this arenet really a good argument ! |
13:17:49 | FromDiscord | <Ayman El hasbi> or graalvm now !↵(@michaelb.eth) |
13:17:55 | FromDiscord | <Ayman El hasbi> i saw it's the trend |
13:18:03 | FromDiscord | <Ayman El hasbi> u can do java on top of the beam |
13:18:08 | FromDiscord | <Ayman El hasbi> but why people hate it ? |
13:18:44 | FromDiscord | <Ayman El hasbi> for me is the syntax ! too much boilerplate , too much declarations , exhaustive coding , whereas nim is pleasure ! |
13:19:58 | FromDiscord | <michaelb.eth> yes, I far prefer Nim to Java for a number of reasons; but I also really like the Clojure lanaguage and it's hosted on the JVM |
13:20:22 | FromDiscord | <Rika> most people dont like java but are indifferent with the JVM |
13:25:55 | FromDiscord | <michaelb.eth> Clojure has seamless interop with Java if you need/want to do hybrid stuff |
13:33:01 | FromDiscord | <deech> A Nim JVM backend with decent Java interop would mean that it's native on all the major architectures that matter for dev work, that plus static introspection is a pretty compelling for common code in polyglot environments. IME there's a ton of it especially at the runtime boundaries which nowadays needs to be encoded in N languages or you roll some cursed YAML IDL both of which are super fragile. |
13:33:49 | FromDiscord | <deech> sent a long message, see http://ix.io/4xsw |
13:34:58 | FromDiscord | <deech> (edit) "http://ix.io/4xsw" => "http://ix.io/4xsx" |
13:40:12 | FromDiscord | <Ayman El hasbi> go try the beam 😁, u'll fall in love with it !↵(@Rika) |
13:45:43 | FromDiscord | <Rika> In reply to @Ayman El hasbi "go try the beam": i already use elxiir |
13:45:46 | FromDiscord | <Rika> (edit) "elxiir" => "elixir" |
13:46:33 | FromDiscord | <chmod222> Hope my rendition isn't too reductive |
13:47:33 | FromDiscord | <chmod222> The short version is\: JVM is nice because it's works everywhere, Nim is nice because it it's very good at interacting with all kinds of different languages and the combination of both sounds like a good idea |
13:47:50 | FromDiscord | <Ayman El hasbi> that's great soo u knooooooow 😄↵(@Rika) |
13:48:14 | FromDiscord | <Rika> its great yeah ngl i kinda ditched nim for it since 80% of what i used nim for was webstuff so |
13:48:25 | FromDiscord | <Rika> but oh well i still use nim for other stuff ^^ |
13:48:49 | FromDiscord | <Ayman El hasbi> use it as nif i guess↵(@Rika) |
13:50:07 | FromDiscord | <Ayman El hasbi> ooh , thanks buddy ! 💪 |
13:51:29 | FromDiscord | <Ayman El hasbi> btw m writing a healthcare related we app with eli , and m thinking of writing workers in nim and use them in BEAM ports |
13:52:42 | FromDiscord | <Ayman El hasbi> those workers will only wait for 1000 ms and send a message to a GenServer , the latter will dispatch those messages and send it to a specific view |
13:53:27 | FromDiscord | <Ayman El hasbi> by view i mean chart for now ( the idea is to mimic fake heartbeats as if some health sensors were equipped ) |
13:57:01 | FromDiscord | <Rika> In reply to @Ayman El hasbi "use it as nif": hard to find a use case for it since i havent had a need to go use a nif or port yet |
13:57:11 | * | raynei joined #nim |
13:57:44 | * | raynei quit (Client Quit) |
14:11:33 | * | raynei joined #nim |
14:39:13 | FromDiscord | <willyboar> @Rika You should try Gleam. Is a BEAM language and typed. |
14:39:46 | FromDiscord | <willyboar> (edit) "Is" => "Its" |
14:47:05 | FromDiscord | <ajusa> Has anyone written a libretro core in Nim yet? I see a few forum posts and https://github.com/PMunch/libretro-nim but not sure if anyone has got it working |
14:58:19 | FromDiscord | <Rika> In reply to @willyboar "<@259277943275126785> You should try": I am aware but I dislike braces enough to not want to |
15:18:54 | FromDiscord | <willyboar> In reply to @Rika "I am aware but": Me too but I used them and I love the language 😁 |
15:19:20 | FromDiscord | <Rika> nah im fine with elixir |
15:52:55 | * | disso-peach joined #nim |
15:54:08 | * | raynei quit (Ping timeout: 248 seconds) |
16:49:28 | * | oldpcuser quit (Remote host closed the connection) |
16:50:09 | * | oldpcuser joined #nim |
16:51:56 | * | oldpcuser quit (Max SendQ exceeded) |
16:52:44 | * | oldpcuser joined #nim |
16:54:22 | * | oldpcuser quit (Max SendQ exceeded) |
16:56:14 | * | oldpcuser joined #nim |
16:57:30 | FromDiscord | <ajusa> In reply to @ajusa "Has anyone written a": got it working with pixie without too many issues, just need to figure out how to handle audio playback |
17:06:11 | * | def- quit (Quit: -) |
17:06:58 | * | def- joined #nim |
17:08:08 | * | pharonix71 quit (Ping timeout: 240 seconds) |
17:11:02 | NimEventer | New post on r/nim by Sebwazhere: How can I add graphics to my nim program?, see https://reddit.com/r/nim/comments/140jepn/how_can_i_add_graphics_to_my_nim_program/ |
18:00:37 | * | derpydoo joined #nim |
18:08:03 | * | PMunch_ joined #nim |
18:08:51 | * | beholders_eye joined #nim |
18:39:51 | * | ntat quit (Quit: Leaving) |
18:55:48 | * | krux02 joined #nim |
19:01:32 | FromDiscord | <voidwalker> Shouldn't `[]` of XmlNode support BackwardsIndex ? https://github.com/nim-lang/Nim/blob/b855404c711730c41114e86631fa19414080f999/lib/pure/xmltree.nim#L368 |
19:18:12 | FromDiscord | <voidwalker> welp, `t[1][0][ t[1][0].len-1 ]` since I can't create it myself cause the elements field is not public |
19:18:37 | FromDiscord | <Graveflo> can use `privateAccess` if you really need to |
19:19:04 | FromDiscord | <Graveflo> or just edit the source in place to setup for a PR |
19:22:57 | FromDiscord | <voidwalker> oh I didn't know of privateAccess! thanks |
19:23:12 | FromDiscord | <Graveflo> it's a life saver sometimes |
19:23:32 | FromDiscord | <voidwalker> wish I knew how to PR.. I have another improvement for httpclient in a project |
19:24:22 | FromDiscord | <voidwalker> would be nice if I could contribute a bit, even with low hanging fruit stuff : P |
19:24:39 | FromDiscord | <Graveflo> ideally "private" should be a just a friendly suggestion. I've had to make some alterations to httpclient also |
19:25:12 | FromDiscord | <Graveflo> my issue is that it is `multisync` code in there and I dont mess with async much. I don't want to regression test it |
19:26:26 | FromDiscord | <Ayy Lmao> Are there some warnings that can't be turned off locally? `{.hint[ResultShadowed]: off.}` doesn't seem to work but it works for some warnings. |
19:28:13 | FromDiscord | <Graveflo> I have no idea. Do you have to `push` that pragma? |
19:28:55 | FromDiscord | <Ayy Lmao> I believe it usually lasts for the scope. |
19:29:48 | * | PMunch_ is now known as PMunch |
19:30:32 | * | PMunch quit (Quit: leaving) |
19:37:59 | FromDiscord | <voidwalker> What's a good set-like data structure that I can use to store about ~200k different, mostly consecutive 32bit ints ? max size is about 1 million |
19:42:50 | FromDiscord | <Graveflo> if you can define the the boundaries of "mostly" its really easy to just make a primed BSA over a seq |
19:43:17 | FromDiscord | <Graveflo> or just a window actually |
19:43:24 | FromDiscord | <voidwalker> a Bovine serum albumin? : D |
19:43:45 | FromDiscord | <Graveflo> yes that precisely |
19:45:06 | FromDiscord | <Graveflo> by mostly consecutive do you mean sorted? |
19:46:56 | FromDiscord | <voidwalker> I mean there's large chunks of them that are consecutive or have just 1-2 diff between them |
19:48:21 | FromDiscord | <Graveflo> if you are doing a lot of finds you probably want to just sort it then. Timsort is good for that there are others that can be efficient with chunks of sorted data in the data |
19:49:39 | FromDiscord | <voidwalker> Actually I think I will just use the database for this purpose |
19:52:26 | FromDiscord | <mratsim> In reply to @voidwalker "What's a good set-like": Maybe a trie, not sure if there are specialized ones for ints |
19:53:28 | FromDiscord | <mratsim> In reply to @voidwalker "I mean there's large": https://en.m.wikipedia.org/wiki/Radix_tree |
19:54:09 | FromDiscord | <Chronos [She/Her]> In reply to @michaelb.eth "yes, I far prefer": Honestly Nim on the JVM would be amazing for me, JVM is alright, Java is just not the best |
19:54:26 | FromDiscord | <mratsim> In reply to @voidwalker "I mean there's large": > They find particular application in the area of IP routing,[2][3][4] where the ability to contain large ranges of values with a few exceptions is particularly suited to the hierarchical organization of IP addresses. |
19:55:13 | FromDiscord | <mratsim> Sounds like a good fit for you since you have large range of filled integer but still sparse (200K out of 4G |
19:55:29 | FromDiscord | <Chronos [She/Her]> In reply to @deech "A Nim JVM backend": WASM works for C programs for example, so Nim could be compiled to that already with the added advantage of the web, but a JVM backend would also be interesting, could possibly be done somewhat similarly to how C++ is done? Issue: C++ has a semblance of backwards compat with C, Java doesn't, so you'd need to generate a lot of OOP code |
19:56:43 | FromDiscord | <Chronos [She/Her]> In reply to @chmod222 "The short version is\:": I mean, it is possible to make a backend, I've attempted the very incomplete beginning of one on a Nim fork called Nimskull |
20:14:38 | FromDiscord | <that_dude> Do concepts have inheritance? I'm looking at this go code rn and am trying to follow the book closely where possible. https://media.discordapp.net/attachments/371759389889003532/1115010745302782052/image.png |
20:15:52 | FromDiscord | <that_dude> Also while I was messing with this, one solution I'm trying out is this one, but I get an error of `Statement is not a concrete type`. Do concepts only work for parameters or something? https://media.discordapp.net/attachments/371759389889003532/1115011056859881602/image.png |
20:16:04 | FromDiscord | <Graveflo> can you just do something like `SubType(T)` |
20:16:21 | FromDiscord | <Graveflo> or sorry that should be `ParentType(T)` |
20:19:09 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xtY |
20:21:21 | FromDiscord | <that_dude> Thanks, will take a look at that |
20:26:29 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xu1 |
20:27:34 | FromDiscord | <inv> sent a code paste, see https://play.nim-lang.org/#ix=4xu2 |
20:27:47 | FromDiscord | <inv> (edit) "https://play.nim-lang.org/#ix=4xu2" => "https://play.nim-lang.org/#ix=4xu3" |
20:28:35 | FromDiscord | <inv> 29.11 shows pretty the same rule, but for self-assignement, which is also unclear |
20:30:38 | FromDiscord | <Elegantbeef> Cause Nim's move semantics arent enforced |
20:30:45 | FromDiscord | <Elegantbeef> If a move cannot be done a copy is made |
20:31:02 | FromDiscord | <Elegantbeef> This makes it much more pleasurable to use vs. forced movement |
20:31:14 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xu5 |
20:31:23 | FromDiscord | <Elegantbeef> This just works in Nim in Rust and friends you need a `a.clone` for the `add` |
20:32:41 | FromDiscord | <inv> Yes. If I remove `echo a` and `add(..., sink x)` then copy would not happen, isn't it ? |
20:33:14 | FromDiscord | <inv> But (I hope), that all the sink/lent/move is clear for me, but rewrite rule is not so clear |
20:33:48 | FromDiscord | <Graveflo> I don't think you can sink a stack value into a heap allocated list but beef is going to have to clarify that... Not that `sink` is the problem |
20:34:18 | FromDiscord | <Elegantbeef> You can sink a stack value, since it's a semantic in the language, it doesnt move memory but it's apart of the memory |
20:34:38 | FromDiscord | <Elegantbeef> apart of the semantics |
20:35:07 | FromDiscord | <Elegantbeef> `proc doThing(i: sink int)` makes very little sense but `proc add[T](oa: openArray[T], index: int, val: sink T)` |
20:35:38 | FromDiscord | <Elegantbeef> If you do not use `a` after a place it's supposed to be moved it'll not copy of course |
20:35:53 | FromDiscord | <Elegantbeef> Nim copies where a copy is required to keep the code compiling, it trusts the programmer |
20:36:28 | FromDiscord | <inv> But, sorry that I go back. Why the rewrite rule with bitwiseCopy? |
20:36:59 | FromDiscord | <Elegantbeef> It's required if you need a copy |
20:37:08 | FromDiscord | <inv> Does it mean that I have bitwiseCopy every g(f()) function call ? |
20:37:09 | FromDiscord | <Elegantbeef> Uncertain what the hell you're showing though |
20:37:39 | FromDiscord | <inv> let me make photo from my phone |
20:41:12 | FromDiscord | <inv> But the first question is about g(f(...)) from the first page only |
20:41:28 | FromDiscord | <Elegantbeef> Sure but I don't know what that means |
20:41:32 | FromDiscord | <Elegantbeef> Nim only copies when it needs to |
20:41:46 | FromDiscord | <inv> Photo is uploading ... |
20:41:53 | FromDiscord | <inv> https://media.discordapp.net/attachments/371759389889003532/1115017598518702241/rn_image_picker_lib_temp_ab9b8743-b074-4b0a-ba47-7ed73bb205a2.jpg https://media.discordapp.net/attachments/371759389889003532/1115017599227543613/rn_image_picker_lib_temp_154d2b02-e06e-4c8c-9572-388795a48fce.jpg https://media.discordapp.net/attachments/371759389889003532/1115017600045420616/rn_image_picker_lib_temp_22014adb-f2b6-409c-b1d1-e670822f2c95.jpg |
20:42:05 | FromDiscord | <inv> (edit) "Photo is uploading ... ... " added "done" |
20:42:39 | FromDiscord | <Elegantbeef> Right the copy is due to the usage of the variable after a supposed sink |
20:43:53 | FromDiscord | <Elegantbeef> `x = select(true, x, y)` requires copying `x` since you're using x after usage `x =` is reusing it |
20:44:04 | FromDiscord | <Elegantbeef> Araq also seems to have left out a `echo x` after his `x = select` |
20:44:13 | FromDiscord | <inv> Ah, you are about self-assigment |
20:44:42 | FromDiscord | <Elegantbeef> Well also if you look at the expanded arc there is a `echo [x]` |
20:44:57 | FromDiscord | <inv> Ifwe have echo after self-assigment - then it is clear why we need copy |
20:45:08 | FromDiscord | <Elegantbeef> Well you need a copy regardless |
20:45:15 | FromDiscord | <Elegantbeef> `select` consumes the string |
20:45:22 | FromDiscord | <Elegantbeef> Which means we no longer own the memory |
20:45:32 | FromDiscord | <Elegantbeef> The only way it's safe to call `echo` after the assignment is a copy |
20:45:54 | FromDiscord | <inv> OK, I think that self-assigment is +- clear |
20:46:17 | FromDiscord | <inv> But the first page is not about self-assigment, it is g(f(...)) |
20:46:39 | FromDiscord | <Elegantbeef> Yea no clue I do not have the book 😛 |
20:47:35 | FromDiscord | <inv> I am a bit confused, because it seems to me that we do binCopy about every function call |
20:48:13 | FromDiscord | <Elegantbeef> A copy is only required for `byCopy` or `sink` that is used after move |
20:48:21 | FromDiscord | <Elegantbeef> Most things do not require copies |
20:48:43 | FromDiscord | <Elegantbeef> Since we have explicit mutability, 99% of code does not require a copy |
20:48:56 | FromDiscord | <Elegantbeef> `proc doThing(a: MyLargeObject)` passes by reference |
20:50:06 | FromDiscord | <inv> Yep, I understand it |
20:50:26 | FromDiscord | <inv> It is more question to book than how it works |
20:51:11 | FromDiscord | <inv> It is even not just copy, it is bitwiseCopy |
20:51:28 | FromDiscord | <demotomohiro> These bitwise copy might be removed by Nim or backend compiler if they think copy is not needed. |
20:52:08 | FromDiscord | <inv> Which is double complexity, but why nim needs it? |
20:52:18 | FromDiscord | <inv> (edit) "complexity," => "the complexity :)," |
20:55:15 | FromDiscord | <Elegantbeef> What? |
20:55:40 | FromDiscord | <Elegantbeef> I've never seen a bitwise copy mentioned anywhere before |
21:14:22 | FromDiscord | <demotomohiro> bitwiseCopy is mentioned here:↵https://nim-lang.github.io/Nim/destructors.html#rewrite-rules |
21:16:35 | FromDiscord | <inv> Yep, it is exactly from book |
21:32:41 | * | derpydoo quit (Read error: Connection reset by peer) |
21:43:42 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xui |
21:44:59 | FromDiscord | <Elegantbeef> `openArray` requires a conversion |
21:45:22 | FromDiscord | <Graveflo> oh right |
21:46:22 | FromDiscord | <Elegantbeef> As such it'll always be lower than the direct call |
21:46:24 | FromDiscord | <Elegantbeef> `seq[T] | ...` is an even more generic procedure so lower dispatch priority |
21:46:33 | FromDiscord | <Graveflo> Is there a premade generic for any array or sequence type or do I have to make my own concept? |
21:47:08 | FromDiscord | <Elegantbeef> There is not |
21:57:21 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4xuo |
22:08:22 | NimEventer | New thread by JeysonFlores: Measures - A library for conversion and definitions of measurement units, see https://forum.nim-lang.org/t/10244 |
22:12:36 | FromDiscord | <inv> In reply to @demotomohiro "I think bitwiseCopy is": Why copy is involved here? |
22:15:01 | FromDiscord | <inv> Maybe the rule is about "lets destroy the function's result late - we are not sure if g() sink or not - so lets copy and destroy" |
22:15:09 | FromDiscord | <inv> But I am not very sure |
22:17:59 | FromDiscord | <huantian> In reply to @Graveflo "Is there a premade": Actually that’s a good rfc, built in concepts for common types, eg sequence, dict |
22:20:27 | FromDiscord | <Graveflo> This is one of the few areas of python where I thought that maybe the logic could be tweaked but its a decent example: https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes |
22:55:24 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xuv |
23:02:00 | FromDiscord | <Elegantbeef> They do have the same head structure but the thing pointed to by an oa isnt the capacity |
23:02:41 | FromDiscord | <Graveflo> ok. I guess something weirder is going on then. Idk why the C code fails to compile. |
23:03:51 | FromDiscord | <Elegantbeef> The oa points to the first element, the seq points to the capacity technically |
23:04:16 | FromDiscord | <Graveflo> right I guess seq uses nims version of malloc for the mm |
23:04:58 | FromDiscord | <Elegantbeef> No clue why you care about the heap pointer |
23:05:07 | FromDiscord | <Elegantbeef> Plus OA doesnt always have a heap pointer |
23:05:18 | FromDiscord | <Elegantbeef> Are you after `myCollection[0].addr`? |
23:05:55 | FromDiscord | <Graveflo> oh that might explain it. I find nims copy semantics very counter intuitive. I'm trying to get a feel for every time something may be copied by printing out the heap address to confirm they are the same in a proc from what they are at the callsite |
23:05:59 | FromDiscord | <Graveflo> so far I've been suprised |
23:06:17 | FromDiscord | <Graveflo> yea basically |
23:06:30 | FromDiscord | <Elegantbeef> Copy semantics are very simple |
23:06:32 | FromDiscord | <Arathanis> pretty sure its "if it isnt explicitly ref or ptr or a var param, it is copied" |
23:06:43 | FromDiscord | <Elegantbeef> That's not right |
23:06:50 | FromDiscord | <Arathanis> enlighten me i wish to know |
23:06:56 | FromDiscord | <Graveflo> I hate that so much tho. I don't want my strings and seqs to be copied unless I explicitly say so |
23:06:57 | FromDiscord | <Elegantbeef> It's copied if marked bycopy or if the data type is smaller than 24bytes |
23:07:04 | FromDiscord | <Elegantbeef> Well you're in the minority |
23:07:16 | FromDiscord | <Elegantbeef> I want copies to be made so I do not have to manually copy |
23:07:22 | FromDiscord | <Elegantbeef> Start using `ref seq` if you want your semantics |
23:07:26 | FromDiscord | <Elegantbeef> Or implement your own copy on write |
23:07:27 | FromDiscord | <Arathanis> so seq have the .bycopy. thing going on? |
23:07:33 | FromDiscord | <Elegantbeef> Seq do not |
23:07:35 | FromDiscord | <Elegantbeef> They're value types |
23:07:43 | FromDiscord | <Arathanis> oh ok |
23:07:57 | FromDiscord | <Elegantbeef> They're also \< 24bytes |
23:08:01 | FromDiscord | <Arathanis> so if i make a giant fuckoff object that uses over 24 bytes of memory it wont copy? |
23:08:04 | FromDiscord | <Elegantbeef> They're a len + pointer |
23:08:11 | FromDiscord | <Elegantbeef> Right |
23:08:11 | FromDiscord | <Elegantbeef> It'll pass by reference always |
23:08:21 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
23:08:23 | FromDiscord | <Graveflo> well that is totally fine to copy. I expect it to copy the head by value |
23:08:38 | FromDiscord | <Graveflo> my issue is that sometimes it allocates entire new copy on the heap |
23:08:41 | FromDiscord | <Elegantbeef> It copies cause most people want their collections to have value semantics |
23:08:51 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuw |
23:09:07 | FromDiscord | <Elegantbeef> This should hold |
23:09:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/5mbHY |
23:09:16 | FromDiscord | <Elegantbeef> In your world it would not and it'd be even more counter intuitive |
23:09:29 | FromDiscord | <Elegantbeef> As soon as you stop thinking of seq/string as a reference type the world is a better palce |
23:09:31 | FromDiscord | <Elegantbeef> place even |
23:09:32 | FromDiscord | <!&luke> How can I serialize toml? I took a look at the parsetoml library but found nothing Abt serialization in the docs |
23:09:55 | FromDiscord | <Elegantbeef> https://github.com/status-im/nim-toml-serialization |
23:10:36 | FromDiscord | <!&luke> Oh thx |
23:10:43 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuy |
23:10:48 | FromDiscord | <Elegantbeef> Right |
23:10:54 | FromDiscord | <Elegantbeef> PS you `object:` is invalid |
23:11:00 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4xuy" => "https://play.nim-lang.org/#ix=4xuz" |
23:11:01 | FromDiscord | <Elegantbeef> also `a, b, c, d: int` is valid |
23:11:02 | FromDiscord | <Arathanis> oh yeah bad : |
23:11:08 | FromDiscord | <Arathanis> typo |
23:11:10 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4xuz" => "https://play.nim-lang.org/#ix=4xuA" |
23:11:22 | FromDiscord | <Arathanis> In reply to @Elegantbeef "also `a, b, c,": i know i just wanted the comments counting bytes by line |
23:11:41 | FromDiscord | <Graveflo> yea beef I am perfectly okay with that example. My issue is that sometimes I want to explicitly pass the head if a seq to proc (by value of course) but it ends up with a different heap pointer. I can get around this with `var seq` and such but sometimes I just want an immutable viewing |
23:11:45 | FromDiscord | <Elegantbeef> It's technically defined as 3 \ sizeof(float) |
23:11:56 | FromDiscord | <Elegantbeef> use `openArray` as the argument |
23:12:03 | FromDiscord | <Elegantbeef> Problem solved |
23:12:18 | FromDiscord | <Elegantbeef> Or just use `val: seq[T]` or `val: string` |
23:12:19 | FromDiscord | <Graveflo> I was in the process of testing that when my code blew up but it seems like that was the right idea 🙂 |
23:12:21 | FromDiscord | <Elegantbeef> Those also do not copy |
23:12:28 | * | beholders_eye quit (Ping timeout: 265 seconds) |
23:12:46 | FromDiscord | <Elegantbeef> Since Nim has explicit immutability it can pass strings/seqs without copying |
23:12:54 | FromDiscord | <Graveflo> wait generics don't do the heap copy? |
23:13:07 | FromDiscord | <Arathanis> proc params are immutable unless they are `var` right? so it won't perform the copy, if you try and mutate it the compiler will say "no please use var for this" |
23:13:49 | FromDiscord | <Elegantbeef> Not generics |
23:13:49 | FromDiscord | <Graveflo> thats another reason why I was kinda surprised it doesn't just pass the head.. its not like you are going to mess with the values |
23:13:58 | FromDiscord | <Elegantbeef> Nim's seq is passed by copy, but not a deep copy |
23:14:19 | FromDiscord | <Elegantbeef> I have no idea how you were getting copies |
23:15:22 | NimEventer | New post on r/nim by Toisoi: illegal storage access by using streams, see https://reddit.com/r/nim/comments/140qjyy/illegal_storage_access_by_using_streams/ |
23:15:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ztOSG |
23:15:51 | FromDiscord | <Elegantbeef> If you are not using orc/arc to check memory, stop it |
23:16:10 | FromDiscord | <Elegantbeef> They are the only sensible to use memory management that Nim has |
23:16:41 | * | derpydoo joined #nim |
23:17:01 | FromDiscord | <Graveflo> oh they are the same.. god what am I doing |
23:17:31 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuE |
23:17:56 | FromDiscord | <mrgaturus> Copy-on-write |
23:18:11 | FromDiscord | <Arathanis> so everything you are saying is under the assumption that we are either:↵1. using Nim 2.0↵2. passing --gc:orc or --gc:arc |
23:20:28 | FromDiscord | <mrgaturus> i have a quick question about macros, does the NimNode generated by genSym can be used as an ident node? |
23:20:47 | FromDiscord | <mrgaturus> (edit) "does" => "can" | removed "can" |
23:21:28 | FromDiscord | <Graveflo> but if you know the name from passing it into genSym why not just create a new ident? |
23:23:03 | FromDiscord | <mrgaturus> i want to store that symbol to use later, those symbols are procs |
23:23:14 | FromDiscord | <mrgaturus> (edit) "to" => "for" |
23:23:42 | FromDiscord | <Elegantbeef> Yes I assume people like working Nim↵(@Arathanis) |
23:24:38 | FromDiscord | <mrgaturus> (edit) "are" => "will be" |
23:24:41 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuH |
23:25:45 | FromDiscord | <mrgaturus> In reply to @Arathanis "is this expected?": yes, because s parameter is not var, but on Nim 2.0 you can just use addr |
23:25:47 | FromDiscord | <Graveflo> In reply to @mrgaturus "i want to store": a single ident is not a permanent place for a variable to live its almost like text. I would just make a new ident node |
23:26:05 | FromDiscord | <Arathanis> In reply to @mrgaturus "yes, because s parameter": gooot it |
23:26:12 | FromDiscord | <Arathanis> is #devel 2.0? |
23:26:24 | FromDiscord | <mrgaturus> unsafeAddr also works |
23:27:04 | FromDiscord | <Elegantbeef> I'm a compiler contributor, I'm only ever on #devel↵(@Arathanis) |
23:28:06 | FromDiscord | <Arathanis> cool, now so am I |
23:28:30 | FromDiscord | <Arathanis> devel is a preview of nim 2.0 right? I see it says its the same version as building nim from the 2-0 tag |
23:31:51 | FromDiscord | <Elegantbeef> No clue |
23:32:04 | FromDiscord | <Elegantbeef> I do not know if 2.0 is off devel or going to be some backport commits from 2.0 |
23:32:07 | FromDiscord | <Elegantbeef> I imagine the former |
23:33:56 | FromDiscord | <ringabout> In reply to @Arathanis "is #devel 2.0?": I think so. |
23:34:54 | FromDiscord | <ringabout> There is nobody taking care of backporting devel to version-2-0 anyway. |
23:35:40 | FromDiscord | <ringabout> So it must be the other way around, pointing 2.0 to devel |
23:39:04 | FromDiscord | <Elegantbeef> If even ring doesnt know we're lost at sea |
23:39:20 | FromDiscord | <Arathanis> ring: "I think..." |
23:39:25 | FromDiscord | <Elegantbeef> Anyone got some metal, I've got some sand in my shoe |
23:39:27 | FromDiscord | <Arathanis> Beef: "ALL HOPE IS LOST NO ONE KNOWS |
23:39:29 | FromDiscord | <Arathanis> (edit) "KNOWS" => "KNOWS"" |
23:39:55 | FromDiscord | <Elegantbeef> Hey if i'm not here for hyperbole what am i here for?! |
23:40:24 | * | def- quit (Quit: -) |
23:40:36 | * | def- joined #nim |
23:43:57 | * | krux02 quit (Remote host closed the connection) |
23:44:02 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Hey if i'm not": throwing hella shade at anyone not using arc/orc? |
23:45:32 | FromDiscord | <Arathanis> what are the ramifications of using gc:off? how do you have to adjust how you write the code? |
23:46:01 | FromDiscord | <Arathanis> just anything stack only is fine, anything that uses the heap like a seq you have to explicitly allocate? do you have to use ref/ptr? |
23:46:06 | FromDiscord | <Arathanis> (edit) "ref/ptr?" => "ref/ptr for those cases?" |
23:46:29 | FromDiscord | <chmod222> Buy more ram every so often |
23:46:45 | FromDiscord | <Arathanis> i can just DL it from the internet right? |
23:46:47 | FromDiscord | <Arathanis> ive seen that add |
23:46:50 | FromDiscord | <Arathanis> i could automate it! |
23:46:53 | FromDiscord | <Arathanis> (edit) "add" => "ad" |
23:46:54 | FromDiscord | <Graveflo> I mean it's manual deallocation right? |
23:47:08 | FromDiscord | <Arathanis> In reply to @Graveflo "I mean it's manual": im also wondering if it disables the manual allocation |
23:47:23 | FromDiscord | <Graveflo> I think you can still call destructors with nims mm theres just no gc |
23:47:52 | FromDiscord | <Graveflo> I say that based on nothing I'm just hoping that nim does what I would want LOL |
23:51:01 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xuO |
23:56:13 | FromDiscord | <mrgaturus> In reply to @Graveflo "is this accurate? I": yes, it writes on heap, also you can do another `for` printing each item and see the changes |
23:56:24 | FromDiscord | <mrgaturus> (edit) "In reply to @Graveflo "is this accurate? I": yes, it writes on heap, also you can do another `for` ... printing" added "about" |
23:56:45 | * | beholders_eye joined #nim |