00:07:51 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
00:08:10 | FromDiscord | <graveflo> (edit) |
00:09:03 | FromDiscord | <graveflo> actually dont need to test `r` |
00:09:26 | FromDiscord | <graveflo> (edit) |
00:10:46 | FromDiscord | <Elegantbeef> Something about stack overflow here 😄 |
00:11:10 | FromDiscord | <Phil> Yeah, write a stackoverflow question about this problem and self-answer! |
00:11:14 | FromDiscord | <Phil> 😛 |
00:11:15 | FromDiscord | <Elegantbeef> No |
00:11:19 | FromDiscord | <Elegantbeef> I hate you |
00:11:22 | FromDiscord | <graveflo> thats a really gnarly json object your thinking of |
00:11:33 | FromDiscord | <Elegantbeef> Hey they said the depth is unknown |
00:11:38 | FromDiscord | <Phil> Beef is in your name after all, there never was a chance 😄 |
00:12:27 | FromDiscord | <Phil> In reply to @graveflo "thats a really gnarly": 5000 layers of depth! The most normal of JSON files ! |
00:13:13 | * | casaca quit (Remote host closed the connection) |
00:18:51 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=html> |
00:19:59 | FromDiscord | <Phil> The way to find shit on HTML is always to figure out how the languages equivalent to document.querySelector and then writing the appropriate CSS selector |
00:20:29 | FromDiscord | <Phil> Wait, how familiar are you with CSS selectors? |
00:21:12 | FromDiscord | <graveflo> wicked are you talking about storing it in an object? |
00:21:18 | FromDiscord | <wick3dr0se> I'm not very familiar. I haven't had to write a website in like 3 years at least |
00:21:26 | FromDiscord | <wick3dr0se> An object would be just fine |
00:21:33 | FromDiscord | <graveflo> or do you know know how to parse the html |
00:21:54 | FromDiscord | <Phil> Okay so you know what ids and css classes are right? |
00:22:08 | FromDiscord | <wick3dr0se> But I just want to pull the data apart ultimately. I tried with innerText() but when i split on whitespace and such I can't store it correctly |
00:22:29 | FromDiscord | <wick3dr0se> In reply to @isofruit "Okay so you know": Yes |
00:22:42 | FromDiscord | <Elegantbeef> since you have all the TRs you can just do `let (name, class, level) = (b[0].innerText, b[1].innertext, b[2].innertext)` 😄 |
00:23:29 | FromDiscord | <wick3dr0se> Ahhh that might work.. I was doing innerText first then similarly assigning but how it broke apart was an issue |
00:24:00 | FromDiscord | <Phil> `#myId` matches all HTML tags with the id `myId`↵`.myClass` matches all HTML tags with the css-class `myClass`↵`myTag` matchtes all HTML tags `<myTag></myTag>`↵... or whatever beef suggests, I was going to go query all the desired tags using a CSS selector and then defining a proc to unpack the values from one specific tag |
00:24:12 | FromDiscord | <Phil> (edit) "`#myId` matches all HTML tags with the id `myId`↵`.myClass` matches all HTML tags with the css-class `myClass`↵`myTag` matchtes all HTML tags `<myTag></myTag>`↵... or whatever beef suggests, I was going to go query all the desired tags using a CSS selector and then defining a proc to unpack the values from one specific tag ... " added "and using that to loop over the list of selected tags" |
00:24:20 | FromDiscord | <Elegantbeef> Nim's stdlib does not have selectors afaik |
00:24:30 | FromDiscord | <Elegantbeef> So they'd need another library todo such, they do exist |
00:24:43 | FromDiscord | <graveflo> yea the std lib parser should be capable of doing the parsing. You just need to use the api the right way. |
00:24:44 | FromDiscord | <Elegantbeef> Plus why use selectors if the layout is static, can just grab indices |
00:25:03 | FromDiscord | <Elegantbeef> Selectors are the regex of html |
00:25:26 | FromDiscord | <Phil> That is very unfair to selectors which are infinitely more readable |
00:25:43 | FromDiscord | <Phil> Deny me and I'll make sure one of my next projects will be some regex-based searcher over DNA sequences or sth |
00:25:53 | FromDiscord | <Phil> (edit) "me" => "this" |
00:26:10 | FromDiscord | <Elegantbeef> It's not really unfair, they're pattern matching based off hierarchy and attributes |
00:26:41 | FromDiscord | <Phil> Yes but one is completely unreadable because you need to know 20+ rules and shorthands for things |
00:26:52 | FromDiscord | <Elegantbeef> The same can be said about css selectors |
00:27:02 | FromDiscord | <Elegantbeef> The selector spec is quite large |
00:27:14 | FromDiscord | <Elegantbeef> https://www.w3schools.com/cssref/css_selectors.php |
00:27:18 | FromDiscord | <Elegantbeef> Look at all these selectors! |
00:27:23 | FromDiscord | <Elegantbeef> Thats 20+ rules |
00:27:24 | FromDiscord | <graveflo> regex is gross |
00:27:30 | FromDiscord | <Elegantbeef> I concur |
00:27:43 | FromDiscord | <Elegantbeef> Selectors are ok, and should only be used in the same ways as regex 😄 |
00:27:44 | FromDiscord | <wick3dr0se> In reply to @Elegantbeef "since you have all": Still includes the spaces in the indices but this works |
00:28:01 | FromDiscord | <Elegantbeef> Well you want to parse it of course |
00:28:01 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
00:28:07 | FromDiscord | <wick3dr0se> Well doesnt make sense really index 0 is empty but index 1 contains the name |
00:28:08 | FromDiscord | <graveflo> just `strip` |
00:28:08 | FromDiscord | <Phil> (edit) |
00:28:17 | FromDiscord | <Phil> 6 rules overall |
00:28:25 | FromDiscord | <Phil> (edit) "6 rules overall ... " added "that are needed" |
00:28:28 | FromDiscord | <Elegantbeef> Well Phil I just showed a bunch of selectors |
00:28:32 | FromDiscord | <Elegantbeef> So... that's more than 5 |
00:29:19 | FromDiscord | <Phil> I'm not talking about the 5 billion ways to do edge cases, I'm talking what's sufficient for 99.9% of cases.↵Which I can't claim for regex because regex almost always drifts into weird shit and greedy vs non-greedy etc. |
00:29:40 | FromDiscord | <Elegantbeef> Sure I'm not disputing you can read css |
00:29:42 | FromDiscord | <graveflo> k well the real distinction is that regex is a state machine |
00:29:42 | FromDiscord | <Elegantbeef> I'm saying it's often overkill |
00:29:53 | FromDiscord | <graveflo> these dont even look that comparable tbh 😛 |
00:30:11 | FromDiscord | <wick3dr0se> I see how both can be very useful 😄 |
00:30:28 | FromDiscord | <Elegantbeef> Regex is useful if you want to make your code unreadable 😄 |
00:30:50 | FromDiscord | <Phil> 🤷♂️ Personally I find the 6 rules listed above easy enough and useful enough given that you can cudgel basically any possible HTML problem with it.↵It's a one-size fits all solution that maybe has a smidgeon of overhead for really simple usecases but imo that's worth it for the universality of it |
00:30:52 | FromDiscord | <graveflo> I switch font to wing dings bc it's easier to read regex |
00:30:54 | FromDiscord | <Elegantbeef> Hyperbole aside, we solved the xml problem we can stop taking about css selector |
00:31:50 | FromDiscord | <Elegantbeef> Phil I'm just annoyed at my hamburger menu that's implemented using css 😄 |
00:33:20 | FromDiscord | <Elegantbeef> It uses funky selectors that are very unclear to the uninitiated |
00:34:08 | FromDiscord | <Elegantbeef> `#menu-button:checked + label:before` Present me has 0 clue what that actually selects 😄 |
00:34:45 | FromDiscord | <Phil> ... if people use :before and :after they are lost |
00:34:47 | FromDiscord | <Phil> And need help |
00:34:49 | FromDiscord | <graveflo> this is why you have a front end / UX friend |
00:35:13 | FromDiscord | <Phil> :checked on a menu button is also an...interesting choice |
00:35:48 | FromDiscord | <graveflo> not a bad idea though. It's annoying when context menus dont want to stay open |
00:36:08 | FromDiscord | <Phil> Sure, but I'd much rather represent an "open" state with its own CSS class |
00:36:17 | FromDiscord | <Phil> Sure that requires JS to toggle said CSS class on and off the element |
00:36:20 | FromDiscord | <Phil> But that's worth it imo |
00:37:11 | FromDiscord | <graveflo> I'm so glad that other people care about this stuff bc I actually cannot tolerate touching CSS |
00:38:10 | FromDiscord | <Phil> Eh, I'm at the point where I can see an entire design and code it down in a matter of a couple hours, including all the intended behaviour and unit tests covering them |
00:38:17 | FromDiscord | <Phil> (edit) "Eh, I'm at the point where I can see an entire design ... and" added "of a page" |
00:38:33 | FromDiscord | <Phil> CSS isn't that much of a big bad |
00:39:19 | FromDiscord | <graveflo> yea it's fine. I just don't like messing with it. There nothing fun about it for me, but dont let my bad attitude spoil your fun! |
00:39:26 | FromDiscord | <Phil> note: mobile optimized page, so that page ain't going to have a crapton of things with behaviour on it beyond 2-3 dozen or so |
00:40:06 | FromDiscord | <Elegantbeef> I mean I do not want js on my site just for a hamburger menu |
00:40:07 | FromDiscord | <Elegantbeef> I'm also not a webdev and just try to make something that 'works' |
00:41:02 | FromDiscord | <Phil> I mean you got to have complexity somewhere |
00:41:09 | FromDiscord | <Elegantbeef> It really is not |
00:41:12 | FromDiscord | <Phil> Either eat the JS or deal with complicated CSS, your choice 😛 |
00:41:12 | FromDiscord | <Elegantbeef> It's a static site it does not need dynamism 😄 |
00:41:28 | FromDiscord | <Phil> Well then just live without the dynamic burger-menu 😛 |
00:42:07 | FromDiscord | <wick3dr0se> I actually have a pretty tiny example for a hamburger menu without JS https://github.com/wick3dr0se/learn-astro |
00:42:22 | FromDiscord | <wick3dr0se> Only site I wrote anytime recently but obviously it's empty and garbage loll |
00:43:28 | FromDiscord | <wick3dr0se> I like to avoid JS at all cost lol |
01:20:59 | FromDiscord | <double_spiral> In reply to @isofruit "Just for reference: new": gotcha 👍 |
01:21:40 | FromDiscord | <double_spiral> In reply to @wick3dr0se "I like to avoid": js is absolutely the worst language i have ever coded in |
01:21:52 | FromDiscord | <double_spiral> its very illogical to me |
01:32:01 | * | rockcavera quit (Remote host closed the connection) |
01:33:35 | FromDiscord | <rubythulhu> nimble keeps complaining about both my own projects and dependencies about improper directory structure. where can i find documentation on the proper way other than nimble just telling me "ur doin it wrong" |
02:08:25 | FromDiscord | <nasuray> In reply to @rubythulhu "nimble keeps complaining about": Is this a hybrid package? Nimble v0.14.2 doesn't spit out these warnings anymore since it changed its output to append a `.out` when compiled. The suggestion should exist in past READMEs for nimble though |
02:09:27 | FromDiscord | <graveflo> In reply to @rubythulhu "nimble keeps complaining about": `nimble init` |
02:10:13 | FromDiscord | <graveflo> also this: https://github.com/nim-lang/nimble |
02:11:10 | FromDiscord | <graveflo> and you might want to read this: https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files↵and you should make sure you know where important dirs are like your nimble path |
02:12:39 | FromDiscord | <graveflo> and you can use atlas too since it was built to manage dependencies |
02:33:43 | FromDiscord | <rubythulhu> In reply to @nasuray "Is this a hybrid": yeah i've been creating hybrid packages for hobbyist stuff b/c honestly i don't understand the difference, but i find it weird that if you just choose binary it doesn't create tests |
02:34:22 | FromDiscord | <Elegantbeef> hybrid means you can import the modules but you also want to ship a binary |
02:34:30 | FromDiscord | <Elegantbeef> Binary means you want to just ship a binary |
02:34:48 | FromDiscord | <Elegantbeef> Source means you just want to provide modules to import |
02:34:53 | FromDiscord | <Elegantbeef> I guess it calls it a `library` not source |
02:36:23 | FromDiscord | <rubythulhu> In reply to @graveflo "`nimble init`": this is part of what confuses me. for my advent of code thing, it told me for a hybrid i need a single aoc.nim and anything else needs to be in an aoc/ submodule. but if i `nimble init`, i get `src/aoc.nim` and `src/aocpkg/blah.nim`, which directly contradicts the warnings i got, because the warnings say it needs to be an aoc/ subfolder, with no mention of "but you can append arbitrary strings t |
02:36:55 | FromDiscord | <Elegantbeef> you do need a `aoc.nim` or `src/aoc/....` |
02:37:29 | FromDiscord | <graveflo> there isn't a structly enforced directory structure really. the name `aocpkg` and `submodule` are not specific.. its just `foo` |
02:37:30 | FromDiscord | <Elegantbeef> Assuming you wanted to distribute your aoc code as a library you then also need to add to the `bins` or w/e the variable is called for each program |
02:37:39 | FromDiscord | <rubythulhu> but theres a lot of things i might like to do that would a library plus a handful of helper binaries. in hybrid it complains if i have more than one file in src/ |
02:38:12 | FromDiscord | <graveflo> its nice to put it in a `src` folder bc then you can put other stuff on the outside |
02:39:39 | FromDiscord | <rubythulhu> my solution to make nimble stop complaining at me has been to make src/mypkgname/bin/.nim, and add explicit rules for building them, and making `src/mypkgname.nim` a dummy file to make nimble shut up, even though its not defined in mypkgname.nimble, and putting everything else in src/mypkgname/.nim |
02:39:42 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:39:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:39:52 | FromDiscord | <rubythulhu> oh i messed up that formatting |
02:40:10 | FromDiscord | <Elegantbeef> Yes Girvo with a `{.cast(gcSafe).}: echo example` |
02:40:21 | FromDiscord | <girvo> Fair enough! |
02:40:33 | FromDiscord | <nasuray> In reply to @rubythulhu "my solution to make": Update nimble and you won't need to do anything of this |
02:40:37 | FromDiscord | <girvo> I _was_ using a reader-writer lock, but it seems so unneccesary lol |
02:40:48 | FromDiscord | <Elegantbeef> Yea you could put it in a template of course |
02:40:53 | FromDiscord | <girvo> ofc |
02:40:57 | FromDiscord | <graveflo> you can edit the config files to specify the output of the binary. I usually use a `bin` folder too. That doesnt really matter where the binary comes out though |
02:41:53 | FromDiscord | <graveflo> if you are doing a library or a bin and you want it in some path you can use a build script (I think nimble ca do this with their config file) or just write a bash script or something |
02:42:49 | FromDiscord | <Elegantbeef> Nim sadly does not have any gcsafe way of using globals like that |
02:43:06 | FromDiscord | <graveflo> In reply to @rubythulhu "my solution to make": the dummy file you are talking about is supposed to be your main module. The one you pass to nim as the entry point. If you are doing hybrid you can put multiple entry point files in that dir |
02:43:19 | FromDiscord | <rubythulhu> In reply to @nasuray "Update nimble and you": im using nimble from homebrew b/c choosenim gives me an x86 version and i want an arm64-native version and my nimble is installed that way. brew thinks its up to date. |
02:43:24 | FromDiscord | <girvo> In reply to @Elegantbeef "Nim sadly does not": yeah tbh it makes sense as to why. and requiring a guard/lock makes sense too |
02:43:44 | FromDiscord | <rubythulhu> In reply to @graveflo "the dummy file you": yeah this is a better way of phrasing my question: how to deal with multiple entry-point CLIs |
02:43:47 | FromDiscord | <girvo> Is there a type level differentiator between a `var` string and a read-only immutable let string? |
02:44:06 | FromDiscord | <nasuray> In reply to @rubythulhu "im using nimble from": Oof I would build nim from source before I'd use homebrew. Choosenim really needs a facelift or revamp... |
02:44:11 | FromDiscord | <Elegantbeef> Well as you probably know `let` does not prevent mutations at all levels |
02:44:18 | FromDiscord | <girvo> Yeah 😦 |
02:44:23 | FromDiscord | <Elegantbeef> But yes the compiler of course knows one is `var T` and the other is `T` |
02:44:45 | FromDiscord | <girvo> I guess I'm asking for a _full_ proper read-only shared mem string type to exist lol |
02:45:21 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:45:49 | FromDiscord | <Elegantbeef> Girvo just use `const` 😛 |
02:46:09 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:46:26 | FromDiscord | <girvo> In reply to @Elegantbeef "Girvo just use `const`": I can't 🥲 |
02:46:40 | FromDiscord | <girvo> (because its loaded _once_ from non-volatile storage) |
02:46:47 | FromDiscord | <Elegantbeef> You could use termer's stackstring if it's not too big |
02:46:53 | FromDiscord | <girvo> Ooooh its not big at all |
02:46:57 | FromDiscord | <girvo> I'll take a look, cheers! |
02:47:10 | FromDiscord | <graveflo> (edit) |
02:47:23 | FromDiscord | <Elegantbeef> They're even nil terminated and work on 1.6.x now |
02:47:41 | FromDiscord | <girvo> Ooooh thats awesome, we're still on 1.6.14 at the moment |
02:47:55 | FromDiscord | <Elegantbeef> You're welcome |
02:47:57 | FromDiscord | <Elegantbeef> 1 |
02:47:57 | FromDiscord | <girvo> Got a branch in play to move to 2, but just had too many things on |
02:47:59 | FromDiscord | <girvo> Thank you 😄 |
02:48:30 | FromDiscord | <Elegantbeef> I added 1.6 support to them when I was making a TOTP library more secure and faster |
02:48:47 | FromDiscord | <Elegantbeef> It was using ref objects for holding secrets, scary stuff! 😄 |
02:48:55 | FromDiscord | <girvo> 😮 |
03:01:27 | FromDiscord | <rubythulhu> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:02:50 | FromDiscord | <graveflo> I see. Well that shouldn't really hurt anything. it's just in your entry points you would import from `NAMEpkg` instead of `NAME`. You are still passing the entry point to nim and that will create your binaries and output them where they are config to drop |
03:03:26 | FromDiscord | <rubythulhu> it also complained about me having multiple entry points in src |
03:03:33 | NimEventer | New question by Nate Ackerman: How do I define a setter in a macro in Nim, see https://stackoverflow.com/questions/77657585/how-do-i-define-a-setter-in-a-macro-in-nim |
03:03:39 | FromDiscord | <rubythulhu> only way i found to shut it up was moving them into a subfolder of src/ |
03:03:46 | FromDiscord | <graveflo> you are doing `nim c src/entry1.nim` like this yes? |
03:04:08 | FromDiscord | <rubythulhu> im trying to get nimble build happy with my source folder |
03:05:43 | FromDiscord | <graveflo> so you are specifying the entry point as a file or a dir? Idk why it would be choosing the wrong one. The `build` command cn have multiple different build routines iirc. You would need to set it to the entry point you want to use. It shouldn't be guessing that |
03:06:34 | FromDiscord | <graveflo> like this: `setCommand "c", "src/myentry.nim"` in `whatever.nimble` |
03:07:12 | FromDiscord | <rubythulhu> it works if i add namedBin entries for src/pkgname/foo.nim etc, and take src/pkgname.nim out of pkgname.nimble |
03:07:38 | FromDiscord | <rubythulhu> but im not sure if it works b/c thats cool, or i just half-assed myself into a solution that works |
03:08:03 | FromDiscord | <graveflo> oh ok if its working thats all that matters for now |
03:08:38 | FromDiscord | <rubythulhu> oh yes, working isnt the problem. i just wanted to understand what nimble WANTS me to do, because its only telling me what it doesn't want me to do |
03:12:15 | FromDiscord | <rubythulhu> this kind of "your dir structure doesn't match whatever" doesn't seem to line up with nim's principles of "whatever i dont wanna argue about formatting and style" attitude, i can name identifiers however i want as long as the first character matches case, but nimble's telling me i'm naughty for not adhering to some arbitrary directory structure that i can't find the documentation for |
03:12:35 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:14:01 | FromDiscord | <rubythulhu> i mean core point is, my nimble seems to be doing old stuff |
03:14:41 | FromDiscord | <graveflo> ok I believe you. Maybe update at some point then |
03:15:05 | FromDiscord | <rubythulhu> well, thats from what this chat is told me |
03:15:11 | FromDiscord | <graveflo> nimble isn't the most stable awesome piece of software in the world but its better then nothing |
03:15:25 | FromDiscord | <rubythulhu> er s/is/has |
03:16:47 | FromDiscord | <rubythulhu> according to nimble --version tho im up to date |
03:17:38 | FromDiscord | <graveflo> idk about nibles release schedules but sometimes "up to date" is more accurately the dev build not the latest release. Depends on what your up to though |
03:17:44 | FromDiscord | <rubythulhu> and it still creates w/ `pkg` suffix, ie "src/foo.nim" and "src/foopkg/submodule.nim" |
03:17:54 | FromDiscord | <rubythulhu> i was comparing github releases vs nimble --version |
03:18:18 | FromDiscord | <graveflo> ah ok. You're probably up to date then tbh |
03:30:25 | * | edr quit (Quit: Leaving) |
03:37:27 | FromDiscord | <rubythulhu> i guess part of the problem is i want `binary` but nimble `binary` doesnt generate tests and i still want that test folder there guilting me into being a better engineer haha |
03:41:57 | FromDiscord | <rubythulhu> many parts of whichever project i could write tests for, and entry-points are lightweight wrappers around logic in other files, its library code but it's all internal / private and i may or may not intend to publish the underlying lib |
03:43:57 | FromDiscord | <Elegantbeef> This makes me think nimble needs "init templates" 😄 |
03:45:21 | FromDiscord | <rubythulhu> from what i understand hybrid/library/binary seems to be inferred by mypkg.nimble, rather than explicitly declared, and i haven't found a way to ask nimble to look at some `mypkg.nimble` and even tell you whether it thinks its a hybrid/library/binary, and it seems like theres different requirements on the package based on which of the above it is, and i can't find documentation for those |
03:45:43 | * | azimut quit (Ping timeout: 240 seconds) |
03:45:46 | FromDiscord | <Elegantbeef> I mean they're really just layouts and defaults |
03:45:59 | FromDiscord | <Elegantbeef> a hybrid is a package with `srcdir` and `bins` defined iirc |
03:46:06 | FromDiscord | <Elegantbeef> A binary is just a package with `bins` |
03:46:16 | FromDiscord | <Elegantbeef> a library is just one with no `bins` |
03:47:13 | FromDiscord | <rubythulhu> that's what i understood it as |
03:51:42 | FromDiscord | <rubythulhu> sent a long message, see <!doctype html> |
03:53:22 | FromDiscord | <rubythulhu> In reply to @Elegantbeef "This makes me think": or a separate tool to create nim starting-points outside of nimble haha |
03:55:14 | FromDiscord | <Elegantbeef> Right name it `nimitz` cause it's a launchpad for Nim projects 😄 |
03:55:37 | FromDiscord | <Elegantbeef> Then make a template file format using toml or yaml |
03:55:43 | FromDiscord | <Elegantbeef> Then profit? |
04:16:19 | FromDiscord | <rubythulhu> or just fun project to fill a gap in the nim ecosystem 🙂 |
05:13:05 | FromDiscord | <graveflo> In reply to @rubythulhu "but then nimble tells": I'm pretty sure this means that you didn't configure the nimble tasks |
05:14:12 | FromDiscord | <rubythulhu> correct i did not configure any nimble tasks |
05:14:52 | FromDiscord | <rubythulhu> well in one project i added a few custom ones, but i'm assuming you mean specific tasks |
05:15:10 | FromDiscord | <rubythulhu> nimble docs aren't super clear |
05:16:27 | FromDiscord | <graveflo> yea I bet if the task has a `setCommand` directive you can do multiple entry points. like `setCommand "c", "src/nimstoryfont.nim"` and maybe the other error will do away if you change this line? : `srcDir = "src"` to `srcDir = ["src", "foo"]` |
05:18:17 | FromDiscord | <graveflo> nimble has to know where the source dir is so that it can add it to nimble path and allow other modules to import it when it is installed |
05:46:25 | * | casaca_ joined #nim |
05:47:41 | * | casaca_ is now known as casaca |
07:13:24 | * | PMunch joined #nim |
07:43:06 | * | advesperacit joined #nim |
08:02:41 | FromDiscord | <Phil> Huh, that SO quesiton shows an interesting conundrum |
08:03:12 | FromDiscord | <Phil> How do you define an operator in a quote do block when the quote do block uses backticks to identify nodes to insert and you need backticks to surround the operator |
08:03:22 | FromDiscord | <Elegantbeef> You use genast |
08:03:31 | FromDiscord | <Elegantbeef> Or you use the second parameter and change the operator used to quote |
08:03:52 | PMunch | Or you define your identifier ahead of time as something which can be inserted at that point with backticks |
08:04:06 | PMunch | Elegantbeef, I've never been able to get that to work for some reason.. |
08:05:32 | FromDiscord | <Phil> Pre-defining the operator name seems like the simplest way |
08:06:00 | FromDiscord | <Elegantbeef> Genast or quote's second parameter? |
08:06:55 | PMunch | quote's second parameter |
08:06:59 | PMunch | I would do it like this: https://paste.rs/mxxh5.txt |
08:07:18 | PMunch | Of course I'd clean up indentation and adhere to a more royale style as well |
08:07:36 | FromDiscord | <odexine> i've also had trouble using the second parameter |
08:08:19 | PMunch | Why is genasts in a separate module? |
08:09:20 | FromDiscord | <Phil> genasts is one of those things where I try to use it once in a while and it just doesn't click and I end up falling back to just building the nodes myself or using quote do |
08:10:04 | FromDiscord | <Elegantbeef> genast is literally quote but better |
08:10:18 | PMunch | So it's like superQuote? |
08:10:30 | FromDiscord | <Elegantbeef> It's in a seperate module likely not to make `macros` larger |
08:10:37 | FromDiscord | <Elegantbeef> Not all macros need genast |
08:10:49 | PMunch | https://github.com/PMunch/macroutils#building-trees |
08:10:53 | FromDiscord | <Phil> In reply to @PMunch "I would do it": That won't work, same problem as before (YOu sure you copy pasted the right thing?) |
08:11:11 | PMunch | Ah damn it.. |
08:11:30 | PMunch | Once again bitten by the playground not supporting the Linux select to copy thing.. |
08:12:03 | PMunch | https://paste.rs/XwVxI.txt |
08:12:08 | PMunch | There, that's how I would do it |
08:13:57 | FromDiscord | <Elegantbeef> https://hatebin.com/mtnompisju |
08:14:15 | FromDiscord | <Elegantbeef> Genast is more flexible as it has the template semantics |
08:14:36 | FromDiscord | <Elegantbeef> Replace all captured symbols with their names |
08:14:46 | FromDiscord | <Elegantbeef> Plus you can inject your own ast without predeclaring a variable |
08:15:07 | FromDiscord | <Elegantbeef> `genast(someLetExpr = newLetExpr(a, b)): someLetExpr` is valid |
08:15:26 | FromDiscord | <Elegantbeef> Well guess that's `stmt` not expr |
08:16:30 | FromDiscord | <Phil> Mind if I add that to the reply to the guy or will you write him a reply with that yourself? |
08:17:05 | FromDiscord | <Elegantbeef> You can reply with it |
08:18:03 | PMunch | Holy shit, I managed to get the extra parameter of quote to work: https://paste.rs/iGWMb.txt |
08:18:19 | PMunch | It's super unintuitive though :S |
08:18:44 | FromDiscord | <Elegantbeef> you don't need `do` in most cases any more 😄 |
08:19:03 | * | sagax joined #nim |
08:19:06 | PMunch | Fair, I just do it out of habbit |
08:19:24 | PMunch | It never hurts, and in some rare cases I think it is still needed |
08:19:32 | FromDiscord | <Phil> You fine with me adding that to the SO reply as well? |
08:19:43 | PMunch | Of course |
08:20:13 | PMunch | Would be kind of a dick move to tell you a solution but not allow you to share it with the person who actually needed it :P |
08:20:57 | * | azimut joined #nim |
08:20:57 | FromDiscord | <Elegantbeef> He is talking to me afterall |
08:24:29 | PMunch | Damn, I had forgot I implemented this: https://github.com/PMunch/macroutils#extracting-nodes-from-a-tree |
08:24:40 | PMunch | That could actually be super useful |
08:25:21 | FromDiscord | <Phil> In reply to @PMunch "Would be kind of": I prefer asking ahead of time because just taking code and copy pasting it to SO feels disrespectful 😅 |
08:25:27 | FromDiscord | <Phil> code from others |
08:25:35 | FromDiscord | <Elegantbeef> Funky pattern matching |
08:26:52 | FromDiscord | <Elegantbeef> profit.svg https://media.discordapp.net/attachments/371759389889003532/1184773491191451698/profit.svg?ex=658d314c&is=657abc4c&hm=a65be2ac3439a411a33d8c8cdf5e7ac3c02651e049e741ec834278049456dacf& |
08:27:01 | FromDiscord | <Elegantbeef> Hmm my flamegraph stuff looks good now minus that text bug |
08:27:28 | FromDiscord | <Elegantbeef> If only this was not just a waste of time and a usable profiler 😄 |
08:28:04 | PMunch | Are you writing a profiler? |
08:28:14 | FromDiscord | <Elegantbeef> Sorta, kinda, not really |
08:28:39 | FromDiscord | <Elegantbeef> I hijacked the Nim profiler mechanism to sample data then output that into a svg based on the one generated from flamegraph |
08:28:52 | FromDiscord | <Elegantbeef> So technically yes, but will it actually be usuable is probably unlikely 😄 |
08:29:05 | PMunch | Huh, that's a cool idea though |
08:29:46 | PMunch | By the way, that SVG did not embed properly over the bridge :P |
08:29:59 | FromDiscord | <Phil> Added a small epilogue about ditching untyped in their case |
08:30:12 | PMunch | Ditching untyped? |
08:30:37 | PMunch | Elegantbeef, is that text rendering bug just a bunch of nodes on top of each other? |
08:30:52 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
08:31:21 | FromDiscord | <pmunch> Fair enough |
08:31:39 | FromDiscord | <Phil> Untyped is useful when you're accepting stuff that isn't at all semantically correct, though when it is useful to output untyped I'm unsure of |
08:31:40 | PMunch | I rarely use typed unless I actually need the type information |
08:31:50 | FromDiscord | <Phil> Because a macro afaik needs always to output valid code |
08:32:01 | FromDiscord | <Phil> So typed for output (and thus omitting the output type) makes sense |
08:32:02 | FromDiscord | <Elegantbeef> Bridge moment |
08:32:05 | FromDiscord | <Phil> At least since Nim2.0 |
08:32:15 | PMunch | I don't think I've written a single macro which returned `typed` :P |
08:32:18 | FromDiscord | <Elegantbeef> Yea you can hit reset view pmunch and the text fixes itself |
08:32:31 | FromDiscord | <Phil (he/him)> Wow, that bridge dropped a lot |
08:32:40 | FromDiscord | <Elegantbeef> Think it's still dropping |
08:32:49 | PMunch | Wit, it's dropping messages? |
08:32:55 | FromDiscord | <Elegantbeef> Ah we're back |
08:32:56 | FromDiscord | <Phil> Nah, it just dropped the entire bits about flamegraphs, everything else is there |
08:33:04 | FromDiscord | <Elegantbeef> Anyway you cannot make a macro that returns `typed` |
08:33:20 | FromDiscord | <Elegantbeef> The compiler always has to semantically check the macro |
08:33:26 | FromDiscord | <Elegantbeef> So `typed` and `untyped` are the same thing |
08:34:06 | FromDiscord | <Elegantbeef> I should note there is a hidden reset view in the top left(assuming you opened it in browser) |
08:34:26 | FromDiscord | <Elegantbeef> flamegraph does this nice thing of including JS inside of the svg so opening it in a browser gives you an interactive graph |
08:34:46 | PMunch | Oh right, that's a thing |
08:35:03 | PMunch | I actually used to do my presentations as SVGs with embedded JS |
08:35:25 | PMunch | Reason I stopped was that font support was always dodgy |
08:35:35 | PMunch | And converting all my text to paths made the SVG comically huge |
08:36:05 | PMunch | Besides, making presentations in LibreOffice Impress isn't actually all that bad |
08:36:32 | PMunch | Besides syntax highlighting code, that's always a bit of a pain |
08:36:36 | FromDiscord | <Elegantbeef> Imagine going to a keynote presentation and not using keynote, Apple shudders |
08:36:59 | FromDiscord | <Elegantbeef> Well acktually keynote presentations were named before the program |
08:37:05 | PMunch | Haha :P |
08:37:32 | PMunch | Have you actually tried Keynote? |
08:38:45 | PMunch | Damn it.. `withValue` in the tables module can't return stuff.. |
08:42:07 | FromDiscord | <Elegantbeef> My school had macs so it's all I've used |
08:42:54 | FromDiscord | <Elegantbeef> are you using the variation with both branches? |
08:43:44 | FromDiscord | <Elegantbeef> `table.withValue(key, name): name; do: default typeof(name)` should work |
08:52:54 | FromDiscord | <Elegantbeef> This also reminds me that there is a slightly safer way of doing `withValue` https://hatebin.com/foplqrgnfg |
08:53:03 | PMunch | Wait, your school only had Macs for students? |
08:53:09 | PMunch | What a strange choice |
08:53:10 | FromDiscord | <Elegantbeef> Yes |
08:53:16 | FromDiscord | <Elegantbeef> I'm in oil country |
08:53:27 | PMunch | And I'm not? |
08:53:40 | FromDiscord | <Elegantbeef> We had laptop carts that had like 4 macs that were shared between a few classes |
08:53:59 | FromDiscord | <Elegantbeef> I mean I'm right in the heart of the oilfields |
08:54:11 | FromDiscord | <Elegantbeef> So more money than brains is a commonality |
08:55:03 | PMunch | According to WolframAlpha Norway exports about 5 times as much oil per capita as Canada :P |
08:55:11 | FromDiscord | <Elegantbeef> We're talking about people that get new vehicles annually |
08:55:19 | FromDiscord | <Elegantbeef> Sure but I'm not talking about Canada |
08:55:23 | PMunch | Ah right |
08:55:26 | PMunch | Specific areas |
08:55:35 | FromDiscord | <Elegantbeef> Compare Alberta to Norway |
08:55:43 | FromDiscord | <Elegantbeef> The number will be vastly different |
08:55:52 | PMunch | Well, here we do this neat little trick called distribution of wealth. So it's probably not as pronounced |
08:56:25 | PMunch | And to be fair, back when I was in school we had to go to the library and use one of their two beige machines with CRT monitors running Windows 95 |
08:56:25 | FromDiscord | <Elegantbeef> Lol we only have a 5% sales tax and that's due to the federal government |
08:56:46 | PMunch | Wow |
08:56:51 | PMunch | I think ours is 25%.. |
08:57:15 | FromDiscord | <Elegantbeef> Yea I don't get it in elementary school they had the CRT macs here, such a waste of money |
08:57:23 | PMunch | WolframAlpha didn't seem to like comparing Alberta |
08:57:39 | PMunch | Probably because it can't find oil exports specifically from Alberta |
08:57:56 | PMunch | Oh the old iMac? |
08:58:02 | PMunch | With the colourful plastic backs? |
08:58:08 | FromDiscord | <Elegantbeef> Yea |
08:58:25 | FromDiscord | <nnsee> in 2014 it was around 15m bbl/day |
08:58:28 | FromDiscord | <nnsee> for alberta |
08:58:48 | FromDiscord | <nnsee> sorry what |
08:58:52 | FromDiscord | <nnsee> 2.9m |
08:59:06 | FromDiscord | <nnsee> i have no idea where i got 15 from, it's like i alt-tabbed back to the page and the number had changed |
08:59:34 | FromDiscord | <nnsee> it was 2.9 bbl/day |
08:59:38 | FromDiscord | <nnsee> m |
08:59:41 | FromDiscord | <nnsee> god i need coffee |
08:59:58 | FromDiscord | <Elegantbeef> https://economicdashboard.alberta.ca/dashboard/oil-production/ |
09:00:10 | PMunch | Got some pretty crazy numbers with 15m :P |
09:00:55 | PMunch | I'm drinking a really nice Colombian Geisha micro batch coffee right now |
09:01:06 | FromDiscord | <nnsee> In reply to @Elegantbeef "https://economicdashboard.alberta.ca/dashboard/oil-": wait what, so it was 15m!? |
09:01:09 | PMunch | Can definitely recommend! |
09:01:34 | FromDiscord | <nnsee> it isn't ever mentioned on this document i'm reading, this one says 2.9m |
09:01:35 | FromDiscord | <nnsee> https://open.alberta.ca/dataset/b8fea8da-848f-4d04-be0f-983787f88694/resource/10be9c86-9b98-43e5-b16a-904b95800612/download/11-albertas-oil-production-and-where-it-goes-formated.pdf |
09:01:47 | FromDiscord | <nnsee> so it's even crazier i somehow misread that as 15m and it's actually correct? |
09:02:00 | PMunch | Either way, that beats out Norways oil exports per capita |
09:02:04 | FromDiscord | <nnsee> oh wait |
09:02:05 | FromDiscord | <nnsee> that's m3 |
09:02:10 | FromDiscord | <nnsee> not bbl |
09:02:19 | FromDiscord | <nnsee> i need to stop trying |
09:02:29 | FromDiscord | <Elegantbeef> Nah I think it's about par Pmunch |
09:02:35 | FromDiscord | <Elegantbeef> Alberta only has 4.6mil people |
09:02:54 | FromDiscord | <Elegantbeef> In 2022 both generated around 230 million m^3 |
09:02:56 | FromDiscord | <Phil> What gets me (as I'm adding some docs to threading/channel) is that the builtin channel module has perfectly adequate docs that could just be copy pasted for large parts of it |
09:03:02 | FromDiscord | <nnsee> In reply to @PMunch "I'm drinking a really": well the thing is i stopped drinking coffee a while back |
09:03:03 | FromDiscord | <Phil> Copy paste, then adjust, boom, done |
09:03:15 | FromDiscord | <nnsee> since i wasn't really able to sleep well at night and i thought it might've been the caffeine |
09:03:29 | FromDiscord | <Elegantbeef> Just drink decaf |
09:03:30 | FromDiscord | <nnsee> it definitely helped but not as much as i would've liked it to |
09:03:48 | FromDiscord | <nnsee> In reply to @Elegantbeef "Just drink decaf": eh, cba, our machine doesn't make decaf coffee and tea is easier |
09:04:03 | FromDiscord | <nnsee> i don't like the taste of coffee _that much_ to go out of my way to deliberately get decaf |
09:04:14 | FromDiscord | <Elegantbeef> How doesn't your machine make decaf |
09:04:22 | FromDiscord | <nnsee> how do you even make decaf |
09:04:36 | FromDiscord | <Elegantbeef> You buy decaffeinated coffee and use it |
09:04:43 | FromDiscord | <nnsee> oh lol |
09:05:05 | FromDiscord | <Elegantbeef> It's generally a chemical process that removes the caffeine |
09:05:07 | FromDiscord | <nnsee> eh, both bean slots are filled and i don't think other people in the office would appreciate me silently cutting off their caffeine intake |
09:05:15 | FromDiscord | <nnsee> suddenly everyone's very groggy at the office and nobody knows why |
09:05:17 | PMunch | Haha |
09:05:23 | PMunch | Had that happen at a place I used to work |
09:05:25 | FromDiscord | <Elegantbeef> Drugs r bad |
09:05:28 | FromDiscord | <Elegantbeef> They should learn |
09:05:39 | PMunch | This was right when capsule machines where entering the market |
09:06:22 | PMunch | We had run out of caffeinated pods so only the decaf ones where left. The only way to tell was that the decaf pods where red, but it didn't say decay on them, you just had to know |
09:07:07 | PMunch | My mom had a capsule machine, so I knew, but this other unfortunate guy had been drinking 8 cups a day wondering why he had a big headache and was so tired all the time |
09:07:27 | PMunch | It wasn't until someone asked when the new non-decaf pods would arrive that he realised |
09:08:06 | PMunch | He was about a week in at that point |
09:08:33 | FromDiscord | <nnsee> lol, the hidden cold turkey |
09:08:45 | PMunch | Exactly, poor guy |
09:08:57 | PMunch | He just kept drinking more and more cups |
09:09:02 | FromDiscord | <Elegantbeef> The only way this could get worse is if the next month someone accidentally left their brownies in the break room |
09:09:13 | PMunch | Is it falling asleep, staying asleep, or waking up which is your main issue? |
09:09:41 | FromDiscord | <nnsee> combination of all of them actually, but mostly the first two |
09:09:50 | FromDiscord | <nnsee> have a hard time falling asleep and when i do, i tend to wake up very easily |
09:10:21 | FromDiscord | <nnsee> around 8am, after getting like 5 hours sleep, my sleep just disappears and i can't fall asleep again |
09:10:57 | PMunch | What worked for me in that case was light regulation. Granted I live in a place that doesn't naturally keep a proper day/night cycle, so YMMV |
09:12:11 | FromDiscord | <nnsee> yeah that's what i thought as well, since i don't have curtains, i thought i might've been that i wake up to the light |
09:12:19 | PMunch | I basically programmed all the smart bulbs in my house to dim down in the evening, and switched from staying on the computer to reading a book an hour or two before bedtime |
09:12:23 | FromDiscord | <nnsee> but during the winter, it's still dark at around 8am |
09:12:50 | PMunch | Well it could be that your body learns that 8AM is when the day starts during the summer and it just carries on into the winter |
09:13:00 | FromDiscord | <Phil> Just move closer to the north or south pole, easy |
09:13:11 | FromDiscord | <Phil> And pack a light jacket as it might get a bit nippy |
09:13:17 | FromDiscord | <nnsee> like i said before i want to move to svalbard |
09:13:23 | FromDiscord | <nnsee> well maybe not _move_ |
09:13:35 | PMunch | I keep waking up at 6:30 during weekends and holidays because that's what my body is used to. I quickly fall asleep again though |
09:14:38 | PMunch | Well the constant darkness messes with you in the opposite way. Now you'll be tired all day instead, regardless of how well you've slept. |
09:15:10 | PMunch | Cod liver oil and lights cycling an actual day/night cycle has helped a lot for me though |
09:15:29 | PMunch | Right, so I might've added a really neat feature to Futhark |
09:15:35 | PMunch | Project mode is the working title |
09:16:16 | PMunch | Basically what everyone has asked for ever since I launched it, point it at a folder, and it wraps everything in that folder into individual files with proper imports. |
09:16:44 | PMunch | As an added bonus it also adds `{.compile: "".}` statements if it finds a C file named the same as the header in the same folder |
09:17:33 | FromDiscord | <nnsee> very nice |
09:19:02 | PMunch | So code like this: https://paste.rs/IbHbu.txt, turns into code like this: https://paste.rs/fMAf4.txt |
09:21:54 | PMunch | This should allow Futhark to be useable on microcontrollers as well. Because you can now wrap the entire library for a chip, and then just import the modules you want without any extra build and link steps :) |
09:22:09 | FromDiscord | <nnsee> neat |
09:32:53 | FromDiscord | <Phil> Question regarding https://nim-lang.github.io/threading/channels.html#recvIso%2CChan%5BT%5D↵What distinguishes that from just a normal receive? |
09:33:31 | FromDiscord | <Phil> I'm trying to add docs and I don't understand that one at all |
09:33:34 | FromDiscord | <Elegantbeef> It calls isolate on the data after |
09:35:32 | FromDiscord | <Phil> Assume I don't know what that means because I don't.↵I mean, I was told (by you I believe?) that isolated just means that the data is self-containing or however you should word that.↵Meaning it is a complete package of data, not referencing anything else, no pointers anywhere |
09:35:57 | FromDiscord | <Elegantbeef> Yea I do not think that it makes sense and that code likely does not compile |
09:36:14 | FromDiscord | <Phil> That last sentence stands on very shaky grounds of my understanding. |
09:36:24 | FromDiscord | <Phil> So Isolated is just "You don't have pointers" - Does that include refs? |
09:36:32 | FromDiscord | <Elegantbeef> No that's not what isolated mean |
09:36:41 | FromDiscord | <Elegantbeef> Isolated means it's a self contained graph |
09:37:10 | FromDiscord | <Phil> I lack an understanding of seeing data as graph to analyze that statement |
09:37:24 | FromDiscord | <Elegantbeef> References |
09:37:29 | FromDiscord | <Elegantbeef> Those are nodes in a graph |
09:37:49 | FromDiscord | <Elegantbeef> An isolated graph is a graph that has no references from the outside |
09:38:03 | FromDiscord | <Elegantbeef> All nodes inside the graph are only referenced inside the graph |
09:38:10 | FromDiscord | <Phil> Ahhhh, it's not that the elements in the graph point to somewhere else, it's that the outside must not point inside |
09:38:16 | Amun-Ra | it's that the same as pony language's iso? |
09:38:52 | Amun-Ra | "This means an iso variable is the only variable anywhere in the program that can read from or write to that object. It is read and write unique." |
09:39:21 | Amun-Ra | (asking for a friend) |
09:39:24 | FromDiscord | <Phil> Can you... "un-isolate" a graph? |
09:39:26 | FromDiscord | <Elegantbeef> I think it's similar |
09:39:39 | FromDiscord | <Elegantbeef> Yes you access fields on it |
09:39:47 | FromDiscord | <Elegantbeef> I mean Nim's `isolate` is quite dumb |
09:39:48 | FromDiscord | <Phil> Ah wait, that goes further than I plan to, just need doc comments for the proc |
09:39:52 | FromDiscord | <Phil> Check |
09:40:16 | FromDiscord | <Elegantbeef> `Isolated` just wraps references in a way that disallows `copy`ing |
09:40:29 | PMunch | Phil, the idea is that if you have an isolated graph you can safely pass the pointer to it between threads. As long as no two threads can hold the root of the tree at the same time, and no threads can point into the tree without holding the root, then you can safely pass the whole tree around just by passing the root reference around. |
09:40:36 | FromDiscord | <Elegantbeef> An isolated graph is meant to be moved from one thread to another |
09:40:57 | FromDiscord | <Elegantbeef> I would not say "pass the pointer" as that sounds like sharing |
09:41:13 | FromDiscord | <Elegantbeef> Isolated is not aimed for sharing, but aimed for safely moving data from a thread to another |
09:41:29 | PMunch | Well you are sharing, just not at the same time |
09:41:34 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/RFCs/issues/244 |
09:41:43 | FromDiscord | <Phil> Doc gen question! |
09:41:44 | FromDiscord | <Elegantbeef> Shared memory implies concurrent access |
09:42:49 | FromDiscord | <Phil> The `Isolated` type is referenced a lot in those procs in the docs.↵However, it is never hyperlinked, I assume because threading is its own package and Isolated is part of the std-lib.↵Can I hyperlink to the definition of Isolted in the std-lib docs somehow? |
09:43:10 | PMunch | Compare it to passing the milk, I can take a glass of milk while having the carton (getting a reference into the tree), but the isolated rule says that I need to finish drinking my glass before I can pass on the carton. So anyone who has the carton can be sure that they know exactly how much milk is left |
09:43:17 | FromDiscord | <Phil> from within the threading package I mean |
09:43:32 | FromDiscord | <Elegantbeef> I mean you can just hard code the Nim url to ti |
09:43:35 | FromDiscord | <Elegantbeef> it\ |
09:44:13 | PMunch | Doesn't work if you decide to build the docs locally though.. |
09:46:45 | FromDiscord | <Phil> I may just go for a link to the isolated module as a whole in the module-doc-comment at the top |
09:47:02 | FromDiscord | <Elegantbeef> I like that Phil is asking you and Me, both people that do not overly document our projects 😛 |
09:50:12 | FromDiscord | <piqueiras> If I want to edit some elements of a seq[string] (not append or delete, just edit) is proc(text:var seq[string]) good enough for performance? |
09:50:20 | NimEventer | New Nimble package! happyx-native - Macro-oriented web-framework compiles to native written with ♥, see https://github.com/HapticX/happyx-native |
09:50:39 | FromDiscord | <Elegantbeef> I do not see the alternative to your question |
09:51:09 | FromDiscord | <Elegantbeef> though I'd probably suggest `var openArray[string]` over `var seq[string]` |
09:51:13 | FromDiscord | <piqueiras> something weird with cstrings idk |
09:51:15 | FromDiscord | <Elegantbeef> No performance difference just more reusable |
09:52:18 | PMunch | "HappyX web framework, but for native platforms" |
09:52:24 | PMunch | What does this even mean? |
09:52:31 | PMunch | Aren't all platforms native to themselves? |
09:53:06 | FromDiscord | <nnsee> same as react-native, I'd imagine? |
09:54:30 | FromDiscord | <Elegantbeef> I think it's a program to wrap happyx to make progressive web apps? |
09:54:33 | FromDiscord | <Elegantbeef> No clue |
09:54:49 | * | adigitoleo quit (*.net *.split) |
09:54:52 | FromDiscord | <Elegantbeef> Personally though I find the term "progressive" ironic as it's clearly regressive |
09:55:08 | FromDiscord | <Elegantbeef> Guess that's more oxymoronic |
09:56:35 | FromDiscord | <Elegantbeef> Seems that's what it's for, even supports android it seems |
09:57:05 | FromDiscord | <nnsee> so different to react-native |
09:57:38 | FromDiscord | <Elegantbeef> Well I cannot say anything for certain I'm throwing mud at the wall and seeing what stays |
09:59:31 | PMunch | Aah right |
10:00:04 | PMunch | That's.. Interesting |
10:01:03 | FromDiscord | <Elegantbeef> As much as I'd like to be able to just use gtk on android it's nice to see a path there 😄 |
10:01:28 | FromDiscord | <nnsee> 2024 is the year of the linux phone |
10:01:28 | PMunch | Elegantbeef, while I have you here, do you have the link to that wasm thing you linked me yesterday? |
10:01:45 | PMunch | When I was asking for semi-simple projects |
10:01:52 | FromDiscord | <Elegantbeef> No I lost it in my paper shreader |
10:02:02 | FromDiscord | <Elegantbeef> https://github.com/wasm3/wasm3 is the C project |
10:02:06 | PMunch | Thanks :) |
10:02:08 | FromDiscord | <Phil> I mean, typically this means "You write X and it may compile to web with HTML/CSS/JS, but we can also compile it to a single binary that runs natively as a self contained application |
10:02:10 | FromDiscord | <Phil> (edit) "application" => "application"" |
10:02:18 | FromDiscord | <Phil> Which is what react-native means by those statements |
10:02:18 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim is my wrapping of it for reference |
10:02:33 | PMunch | Does it bundle Chrome somehow when you do this? |
10:02:47 | * | adigitoleo joined #nim |
10:02:56 | PMunch | Android support is interesting though, might have to give that a go |
10:03:03 | FromDiscord | <nnsee> In reply to @PMunch "Does it bundle Chrome": no, react-native doesn't |
10:03:04 | FromDiscord | <Phil> In reply to @PMunch "Does it bundle Chrome": react native doesn't, it has different backends |
10:03:15 | PMunch | I really want a good Nim -> Android app workflow |
10:03:23 | FromDiscord | <Elegantbeef> React-native does not, but happyx hopefully uses your system webview or a portable webview library |
10:03:27 | FromDiscord | <Phil> It tries to use native widgets to represent what you input as HTML/CSS/JS.↵That also means it tries to limit what you do |
10:03:33 | FromDiscord | <Phil> (edit) "It tries to use native widgets to represent what you input as HTML/CSS/JS.↵That also means it tries to limit what you ... do" added "can" |
10:03:41 | PMunch | Hmm, right |
10:03:57 | PMunch | So React native is more like React for GUI framework X |
10:04:22 | PMunch | While happyx seems to be more like Electron in that it just builds the web-app and links to a browser |
10:04:35 | FromDiscord | <Phil> Kinda. It's similar to nim in taht sense, you have a "frontend" where you input stuff with webtech and then various backends |
10:05:33 | FromDiscord | <Phil> And yeah, it still is an electron-like app:↵> Compiles main happyx file, opens browser in appMode and starts serving at localhost with port |
10:06:00 | FromDiscord | <Phil> So not like react native |
10:06:10 | FromDiscord | <Phil> (edit) "taht" => "that" |
10:06:42 | FromDiscord | <Phil> https://hapticx.github.io/happyx-native/happyx_native/app/app.html↵For the interested |
10:07:00 | FromDiscord | <Phil> In reply to @Elegantbeef "https://github.com/beef331/wasm3/blob/master/src/wa": That's a lot of compiler flags |
10:07:26 | FromDiscord | <Phil> I am mildly scared that I'm actually starting to remotely understand some of this |
10:07:58 | FromDiscord | <Phil> I mean not what it does but the syntax for doing the binding stuff |
10:09:11 | FromDiscord | <nnsee> In reply to @isofruit "I am mildly scared": truly scary |
10:09:44 | FromDiscord | <Phil> Look, like I started the year with 0 knowledge about macros and 0 knowledge about wrapping C |
10:10:34 | FromDiscord | <Phil> I do one macro based project and suddenly I find myself contributing to GTK bindings with a macro-based, declarative interface and generating a library's worth of code for a multithreading library |
10:11:02 | FromDiscord | <Phil> (edit) "generating" => "writing" | "writinga ... library's" added "second library that generates another" |
10:11:07 | FromDiscord | <Phil> (edit) removed "a" | removed "library" |
10:11:41 | FromDiscord | <Phil> Its drugs I tell you! |
10:11:46 | FromDiscord | <nnsee> it's a steep slope |
10:11:55 | FromDiscord | <nnsee> and slippery |
10:13:19 | PMunch | Macros are like one of those slides at a water park. The climb up is long and kinda scary, but once you get to the top you just start sliding and you can't really stop! |
10:14:24 | FromDiscord | <Phil> It actually gets kinda easy, it was 2 core truths that I needed to wrap my head around and after that it became a free for all with nothing being sacred |
10:17:28 | PMunch | What where those? Just curious |
10:18:20 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
10:19:10 | FromDiscord | <Phil> The rest imo evolves out of that |
10:20:15 | PMunch | Pretty good summary :thumbsUp: |
10:20:38 | PMunch | Welp, that didn't do well with the bridge :P |
10:20:39 | FromDiscord | <Phil> Point 3 is why I wrote myself my own versions of "expectKind" and "assertKind" that I use everywhere.↵First line of a proc is basically always "nodeParam.assertKind(<nodekinds>)" |
10:21:18 | FromDiscord | <Phil> It makes debugging where I went wrong so much easier because it tells me immediately where my expectations are incorrect |
10:21:28 | PMunch | Useful for DSLs, but in general I'd say that if you need to care about your input arguments you're doing something wrong |
10:21:37 | PMunch | The exception is of course DSLs |
10:21:42 | PMunch | Where it is very important |
10:23:44 | FromDiscord | <Phil> I would disagree on that. I mean, take mapster.↵You annotate a proc with a macro.↵That does nothing but add a line `param.mapTo(result)` at the start of the proc, where `mapTo` is a generic proc that copies values from `param` over to result if the name and type match. |
10:24:26 | FromDiscord | <Phil> I provide options to validate the everliving hell out of that proc to e.g. guarantee at compiletime that all fields of the result-type get assigned to |
10:25:16 | FromDiscord | <Phil> I also provide options for mapping to variant types where I also validate that you hand me that your inputs match what I expect so I generate the correct code.↵In this case that your proc has a parameter that defines the kind of the object variant you want to create |
10:25:30 | FromDiscord | <Phil> (edit) "I also provide options for mapping to variant types where I also validate that you hand me that your inputs match what I expect so I generate the correct code.↵In this case that your proc has a parameter that defines the kind of the object variant you want to create ... " added "- that the kind-parameter matches the expect type of the kind-field on the object variant etc." |
10:26:48 | FromDiscord | <Phil> Same for my current multithreading thing.↵You have macros to register types and handler-procs with it.↵Registering a macro immediately checks if the proc that was just registered uses types that were also registered.↵And fails if the types are already being used by another registered proc |
10:28:39 | FromDiscord | <Phil> My mantra is that in order to generate code reliably I need to know what you're inputting, otherwise I'm opening my user up weird macro errors.↵It's not ironclad of course, but the direction is much more in the direction that macros may only be used in the manner described by the docs and everything else is not supported |
10:28:53 | PMunch | Wait, so with mapster you're looking at the passed in AST and replacing calls? |
10:30:05 | FromDiscord | <Phil> No, I just add one at the start of the proc-body, I leave the proc-body itself untouched |
10:30:40 | FromDiscord | <Phil> It really is just adding that single line at the start and that's it.↵The validation is separate, that just means I blow up at compiletime with decent error messages of what you did wrong |
10:30:50 | FromDiscord | <Phil> that doesn't replace anything |
10:31:44 | PMunch | Ah right |
10:31:46 | PMunch | Hmm |
10:32:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:32:36 | FromDiscord | <Phil> (edit) |
10:33:03 | FromDiscord | <Phil> That interacted poorly with the backticks I had in the doc comment |
10:57:55 | FromDiscord | <piqueiras> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:05:59 | FromDiscord | <demotomohiro> In reply to @piqueiras "Is there some way": https://nim-lang.org/docs/system.html#toOpenArray%2Cseq%5BT%5D%2Cint%2Cint↵with↵https://nim-lang.org/docs/manual_experimental.html#view-types |
11:10:40 | FromDiscord | <piqueiras> damn |
11:10:40 | FromDiscord | <piqueiras> cool |
11:10:42 | FromDiscord | <piqueiras> ty |
11:11:14 | FromDiscord | <piqueiras> would that work if I had a matrix (seq of seqs) to obtain a column? |
11:14:43 | PMunch | Elegantbeef, hmm it struggles on the WASM library. Basically in wasm3.h it references M3Environment, which is defined in m3_env.h, but that file is never imported in wasm3.h |
11:27:01 | FromDiscord | <Clonkk> Does anyone generate code coverage during unit tests execution ? All existing nim project around that seems deprecated / obsolete |
11:30:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:31:44 | FromDiscord | <ringabout> Yes, because you cannot share refs, I suppose `let msgI = isolate(LargeMessage)` should work |
11:31:54 | FromDiscord | <Phil> I mean, I get why its throwing an error, because msg is holding a ref and isolate seemingly can't change that because that could lead to nil access or sth, but I wonder what your options are there - Only to implement hooks? |
11:32:24 | FromDiscord | <Phil> hooks that move ownership on reassignment I mean |
11:33:18 | FromDiscord | <ringabout> (edit) "isolate(LargeMessage)`" => "isolate(LargeMessage())`" |
11:33:47 | FromDiscord | <ringabout> I don't think hooks work, the only option is `let msgI = isolate(LargeMessage())`; that how it was designed |
11:34:19 | FromDiscord | <Phil> I mean, I can also msg[] |
11:34:50 | FromDiscord | <Phil> That's more in the context of "what if somebody else passes me an object to isolate" |
11:35:10 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
11:36:09 | FromDiscord | <Phil> Which is the situation you'd be in if you were writing a framework/lib for easy webserver-like multithreading and need message-passing, which leads to calls to isolate on objects whose types you can't know 😄 |
11:36:30 | FromDiscord | <Phil> (edit) "Which is the situation you'd be in if you were writing a framework/lib for easy webserver-like multithreading ... and" added "(with a thread behaving like a server)" |
11:39:08 | FromDiscord | <Phil> I guess I'll just write that ref-type messages are not supported because while I could implement that, it would require me unreffing the message, then sending it, and then turning it back into a ref on the other thread |
11:40:03 | FromDiscord | <piqueiras> how do I ignore indent 🥲 https://media.discordapp.net/attachments/371759389889003532/1184822106949689414/image.png?ex=658d5e93&is=657ae993&hm=ca8a2d5574792175615fcd23c7112df610f1a7933f245f77a64e8fc4ad1abc87& |
11:41:06 | FromDiscord | <Phil> Disable nimsuggests ability to show you these things, embrace the compiler as your only true source of knowledge for whether your code works or not! |
11:41:16 | FromDiscord | <Phil> Because I certainly do! |
11:41:23 | FromDiscord | <piqueiras> Error: nestable statement requires indentation |
11:41:24 | FromDiscord | <piqueiras> rip |
11:41:51 | FromDiscord | <Phil> Well that fell flat |
11:42:00 | FromDiscord | <Phil> But not as flat as the line you tried to sneak past the compiler! |
11:42:17 | FromDiscord | <Phil> 👉 👉 |
11:42:31 | FromDiscord | <piqueiras> 😭 |
11:43:14 | FromDiscord | <Phil> TBH the amount of shit nim lets you get away with is kinda nuts |
11:44:21 | FromDiscord | <piqueiras> In reply to @piqueiras "would that work if": im trying to do this |
11:44:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:44:49 | FromDiscord | <piqueiras> get a seq that is actualy a slice of a column of a matrix |
11:45:52 | FromDiscord | <piqueiras> (and pointing to it as well) |
11:45:59 | FromDiscord | <Phil> No idea, I have not messed around with seqs enough to give you a response.↵Mainly because seqs have value semantics and how you convince nim that no, you indeed just want a mutable slice of that seq (which it looks like you want) is beyond me |
11:46:11 | FromDiscord | <piqueiras> cause this is doable https://media.discordapp.net/attachments/371759389889003532/1184823648167673946/image.png?ex=658d6002&is=657aeb02&hm=1553bf061090d409ead18f4ccbac97b38ce54226b734c060c65e55557ca83d6f& |
11:46:13 | FromDiscord | <Phil> It might be that you straight up aren't allowed to because that sounds super unsafe |
11:46:29 | FromDiscord | <piqueiras> In reply to @isofruit "It might be that": it can be done with a seq so |
11:46:31 | FromDiscord | <Phil> Having mutable slices of another seq I mean |
11:47:00 | FromDiscord | <Phil> In reply to @piqueiras "it can be done": Yeah but that's not slices of a seq, that's a 2D array with mutable rows |
11:47:03 | FromDiscord | <piqueiras> https://media.discordapp.net/attachments/371759389889003532/1184823865298403389/image.png?ex=658d6036&is=657aeb36&hm=fc560a4032b953598fc83d75c4275f2ad7e9f070f6be331c7a4b271059b93e28& |
11:47:19 | FromDiscord | <piqueiras> in columns it just seems kinda undoable |
11:50:49 | FromDiscord | <Phil> That really is a forum question |
11:50:56 | FromDiscord | <Phil> Because folks can take a longer time to reply to that more elaborately |
11:51:25 | FromDiscord | <piqueiras> might do |
11:51:31 | * | ehmry joined #nim |
11:56:16 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:56:24 | FromDiscord | <griffith1deadly> (edit) |
12:11:32 | PMunch | Welp, there we have our first major hitch: https://paste.rs/ZsnQA.txt |
12:16:28 | FromDiscord | <alwaysoutofrange> is there a way to read a short from filestream? i tried using a 2 byte array but it didnt work out for me also readInt16() does not work for me either im getting the wrong number back when i try this |
12:21:01 | PMunch | Could be a big-endian vs. little-endian issue |
12:21:18 | PMunch | Both your approaches should work fine |
12:23:08 | FromDiscord | <nnsee> In reply to @alwaysoutofrange "is there a way": what number are you getting and what number are you expecting |
12:25:17 | PMunch | Hmm, anyone knows what this error means? "Error: cannot export" |
12:25:23 | FromDiscord | <piqueiras> In reply to @griffith1deadly "i think you can": huh |
12:25:26 | PMunch | It doesn't say anything about _why_ it can't export |
12:26:37 | PMunch | Hmm, seems related to the circular import thing.. |
12:26:58 | FromDiscord | <kuroisatoridevs> is there a nice install script that will non-interactively install nim, nimble, atlas and niminst into the system? It's for my CI |
12:28:01 | PMunch | Is the curl script not good enough? |
12:28:04 | FromDiscord | <nnsee> In reply to @kuroisatoridevs "is there a nice": choosenim has a "use defaults" flag |
12:28:18 | FromDiscord | <nnsee> also if it's for your CI why not use a base image with them already installed |
12:28:22 | FromDiscord | <alwaysoutofrange> In reply to @nnsee "what number are you": im getting 8203 and i expect 163 |
12:28:23 | FromDiscord | <kuroisatoridevs> choosenim wont install atlas and it wont install niminst. |
12:29:17 | FromDiscord | <alwaysoutofrange> everything is little endian but that should not be a problem because i read a int32 and its the right value |
12:29:37 | FromDiscord | <kuroisatoridevs> my current solution is building nim from source and using koch csource -d\:danger just to tell it to build niminst |
12:29:54 | PMunch | What's niminst? |
12:29:57 | FromDiscord | <nnsee> In reply to @kuroisatoridevs "choosenim wont install atlas": it will definitely install atlas |
12:30:03 | FromDiscord | <nnsee> just not create the proxyexe |
12:30:16 | FromDiscord | <nnsee> but the actual atlas binary exists in the nim dir itself |
12:30:22 | PMunch | alwaysoutofrange, are you sure you are reading at the correct position? |
12:30:24 | FromDiscord | <nnsee> i have no idea what niminst is |
12:30:30 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "What's niminst?": Probably the compiler...? |
12:30:36 | FromDiscord | <nnsee> In reply to @alwaysoutofrange "everything is little endian": that doesn't really make any sense |
12:30:40 | FromDiscord | <Chronos [She/Her]> Not sure, probably not actually |
12:30:50 | FromDiscord | <nnsee> sorry, replied to the wrong message |
12:31:02 | FromDiscord | <nnsee> i don't see any link between 163 and 8203 |
12:31:05 | FromDiscord | <kuroisatoridevs> nim's csource thats needed for bootstrap is generated using niminst; it is actually a very good piece of software |
12:31:10 | PMunch | https://nim-lang.org/docs/niminst.html |
12:31:18 | PMunch | Apparently a package to make Nim installers |
12:32:01 | PMunch | kuroisatoridevs, what? That doesn't sound right |
12:32:16 | PMunch | csources aren't installed via an installer, it's just a repo you clone.. |
12:32:23 | FromDiscord | <alwaysoutofrange> In reply to @nnsee "that doesn't really make": i think i found the problem im skipping a value |
12:33:04 | FromDiscord | <nnsee> In reply to @kuroisatoridevs "nim's csource thats needed": niminst is provided as a .nim file in the toolchains dir even when using choosenim. you can simply run it. |
12:33:19 | * | edr joined #nim |
12:33:40 | FromDiscord | <nnsee> In reply to @PMunch "csources aren't installed via": there actually is a `csource` command in `niminst`, i think that's what they're talking about |
12:33:55 | FromDiscord | <nnsee> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:34:42 | FromDiscord | <kuroisatoridevs> https://github.com/dom96/choosenim#choosenim cant see anything about non-interactive install |
12:35:14 | FromDiscord | <alwaysoutofrange> ye now its working |
12:35:40 | FromDiscord | <nnsee> `nim r $(< ~/.choosenim/current)/tools/niminst/niminst.nim` for running niminst in a choosenim install |
12:37:50 | FromDiscord | <nnsee> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:43:19 | FromDiscord | <kuroisatoridevs> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:43:22 | FromDiscord | <kuroisatoridevs> thanks |
12:47:34 | FromDiscord | <kuroisatoridevs> and to summarize it into oneliner |
12:47:42 | FromDiscord | <kuroisatoridevs> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:56:57 | FromDiscord | <nnsee> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:58:12 | FromDiscord | <nnsee> oh wait, it doesn't show that on matrix |
12:58:16 | FromDiscord | <nnsee> maybe a bridge issue |
12:58:31 | FromDiscord | <nnsee> looks like this to me |
12:58:33 | FromDiscord | <nnsee> https://media.discordapp.net/attachments/371759389889003532/1184841859655282688/image.png?ex=658d70f8&is=657afbf8&hm=9680e5d5ba74f5b5f71a5a3ba24c9f3992e7b418b8c01f8b351e2a8da430d5c3& |
12:59:07 | FromDiscord | <kuroisatoridevs> yes, tags are not there |
12:59:21 | FromDiscord | <kuroisatoridevs> curl https://nim-lang.org/choosenim/init.sh -sSf \| CHOOSENIM\_NO\_ANALYTICS=1 bash -s -- -y; echo "" \> $HOME/.choosenim/analytics |
12:59:24 | FromDiscord | <kuroisatoridevs> oh |
12:59:46 | FromDiscord | <kuroisatoridevs> i don't know how not to send things without tags |
13:00:30 | FromDiscord | <nnsee> maybe: |
13:00:43 | FromDiscord | <nnsee> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:01:02 | FromDiscord | <nnsee> && instead of ; to short circuit early if choosenim fails for some reason |
13:01:17 | FromDiscord | <nnsee> and propagate the error code |
13:01:59 | FromDiscord | <nnsee> `bash -s -- -y` is a neat trick that seems kind of obvious in hindsight, thanks |
13:03:32 | FromDiscord | <kuroisatoridevs> such things are considered unsafe, but i like it for readability in dockerfiles |
13:04:19 | FromDiscord | <nnsee> it's only unsafe if you don't trust the origin |
13:05:08 | FromDiscord | <kuroisatoridevs> it's unsafe to trust humans |
13:10:31 | FromDiscord | <Phil> Oh hey, my benchmark for threadbutler finally returns more realistic outputs |
13:10:46 | NimEventer | New Nimble package! note - A simple pastebin, inspired by w4/bin, see https://codeberg.org/pswilde/note |
13:11:02 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:11:46 | FromDiscord | <nnsee> In reply to @NimEventer "New Nimble package! note": thought this might be a contender with what i'm writing, but...↵> notes are stored in a table within the runtime. No persistance is currently in place, nor required as far as I'm concerned. Effectively, all notes are lost when the binary is restarted. |
13:19:02 | PMunch | Hmm, anyone bored enough to want to write a cycle checker? |
13:19:48 | PMunch | I basically have a `Table[string, HashSet[string]]` of modules and their imports. And I want to check that for every key in the table that there are no paths to itself |
13:19:54 | PMunch | Not hard, just tedious :P |
13:22:05 | * | khazakar joined #nim |
14:10:18 | FromDiscord | <kuroisatoridevs> Where can I read about nim.cfg and especially about nimscript that does the same thing? I want to use pkg-config with different flags for different targets in my project |
14:12:06 | * | jmdaemon quit (Ping timeout: 260 seconds) |
14:24:06 | FromDiscord | <deadm0th> how i can configure vim or spacevim ? |
14:24:13 | FromDiscord | <deadm0th> how can i \ |
14:24:36 | FromDiscord | <Phil> PMunch, vim is your beer |
14:25:43 | FromDiscord | <Phil> In reply to @kuroisatoridevs "Where can I read": Regarding nimscript, the docs to it are actually linked in the documentation section of nim's main page 😄 |
14:25:56 | FromDiscord | <nnsee> In reply to @deadm0th "how i can configure": by editing the init file |
14:26:07 | FromDiscord | <Phil> Left center https://media.discordapp.net/attachments/371759389889003532/1184863897405112400/image.png?ex=658d857e&is=657b107e&hm=d968dd4e515ff020fcced14892221a590e93b392a998eeee960c1fab10708e8d& |
14:26:21 | FromDiscord | <Phil> https://nim-lang.org/docs/nims.html |
14:26:55 | FromDiscord | <Phil> Okay I don't get it, sometimes channels just randomly blow up on me and I don't see where and how |
14:40:47 | FromDiscord | <Phil> Is there a way to get better stacktraces out of nim? Some compiler flag or sth?↵What I get is 50% wrong for example, naming procs that I define and telling me they're in the macros module etc. |
14:42:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:05:19 | FromDiscord | <kuroisatoridevs> maybe --stackTrace\:on --lineTrace\:on --opt\:none |
15:07:27 | FromDiscord | <kuroisatoridevs> the actually useful documentation was hidden in https://github.com/nim-lang/Nim/wiki/Using-nimscript-for-configuration |
15:21:04 | FromDiscord | <Phil> Nope, still incorrect stacktraces =/ |
15:25:55 | * | PMunch quit (Quit: Leaving) |
15:31:33 | FromDiscord | <piqueiras> how can I init a seq of empty hashsets |
15:32:53 | FromDiscord | <piqueiras> does newSeqWith(100,toHashSet("")) work as intended 🤔 |
15:34:05 | FromDiscord | <piqueiras> no it doesnt |
15:35:43 | FromDiscord | <piqueiras> newSeqWith(100,initHashSet[string]()) |
15:35:46 | FromDiscord | <piqueiras> oh this does |
15:39:02 | FromDiscord | <nnsee> In reply to @piqueiras "no it doesnt": how doesn't it |
15:39:04 | FromDiscord | <nnsee> it works for me |
15:39:15 | FromDiscord | <nnsee> pretty much the exact same as initHashSet |
15:49:29 | FromDiscord | <piqueiras> i they dont seem to be string sets |
15:51:49 | * | khazakar quit (Quit: Connection closed for inactivity) |
15:55:19 | FromDiscord | <nnsee> oh, yes, `""` is a seq of chars |
15:55:24 | FromDiscord | <nnsee> i assumed that's what you wanted |
15:55:26 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:56:31 | FromDiscord | <nnsee> In reply to @piqueiras "i they dont seem": it would work with `toHashSet[string]([])` |
15:57:04 | FromDiscord | <nnsee> if you _really_ wanted to use toHashSet for whatever reason |
16:02:30 | FromDiscord | <piqueiras> no I dont need tohashset |
17:16:48 | * | khazakar joined #nim |
17:39:33 | FromDiscord | <jviega> Phil, templates often mess up location info. Can get the wrong file, and definitely the right file but wrong line number |
17:39:47 | FromDiscord | <jviega> Not clear when it will happen and when it won't, always |
17:51:48 | FromDiscord | <Phil> I figured out what killed me |
17:52:04 | FromDiscord | <Phil> It was benchy and interaction with somehow somewhere causing deallocations |
17:52:33 | FromDiscord | <Phil> I'm now investigating how else to do some nice little benchmarking just to make sure there's no performance degradation between system.Channels and threading/channels |
17:58:28 | * | jmdaemon joined #nim |
18:09:59 | FromDiscord | <Phil> Nope nevermind, that wasn't it either, oh god dangit man |
18:10:14 | FromDiscord | <jviega> 😦 |
18:20:31 | FromDiscord | <apetransaction> anyone know how to convert a sequence of bytes to a cstring? |
18:21:00 | FromDiscord | <jviega> Is there any possibility the sequence will be empty? |
18:21:05 | FromDiscord | <apetransaction> nope |
18:21:09 | FromDiscord | <apetransaction> 0 possibility |
18:21:26 | FromDiscord | <jviega> If not, then `cast[cstring](addr s[0])` should do you fine |
18:21:34 | FromDiscord | <apetransaction> thanks |
18:29:35 | FromDiscord | <Phil> I have it! A small-ish example just based on threads on what's blowing up! |
18:30:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:30:32 | FromDiscord | <Phil> (edit) "threads" => "channels" |
18:30:48 | FromDiscord | <Phil> (edit) |
18:46:20 | FromDiscord | <kuroisatoridevs> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:47:30 | FromDiscord | <kuroisatoridevs> not sure about your code, but nim 2.0 hasn't threading/channels |
19:08:18 | FromDiscord | <apetransaction> pain |
19:08:35 | FromDiscord | <apetransaction> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:11:27 | FromDiscord | <guttural666> does the default initialization fail when I guard a field with a lock? it seems to: https://media.discordapp.net/attachments/371759389889003532/1184935703163965631/image.png?ex=658dc85e&is=657b535e&hm=45cb9e05d30edd899c7115757f160841ba727a74f9a7b7de6f4bff9b438b02c8& |
19:11:46 | FromDiscord | <guttural666> seems I have to yeet all that default stuff into my init function and change those fields with the lock to the default value↵weird, because this default initialization seems to work anyway: https://media.discordapp.net/attachments/371759389889003532/1184935780808937603/image.png?ex=658dc871&is=657b5371&hm=06fb8f004aff172e20c9b4e6f4edcd0ace853821fef017ec4fb74cdc258bdd3e& |
19:12:08 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:15:30 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
19:18:32 | * | Lord_Nightmare joined #nim |
19:25:44 | FromDiscord | <guttural666> okay, seemed to be correct, that I'd have to initialize guarded things myself with a lock and initDeque doesen't seem to do a lot vs. just declaring the thing: https://media.discordapp.net/attachments/371759389889003532/1184939295996379268/image.png?ex=658dcbb7&is=657b56b7&hm=2fc37b8eecb57ebcc33aa891b4cdebaa7889b5c57620261ef76850d42cd9e411& |
19:38:57 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in) |
19:40:56 | * | xutaxkamay joined #nim |
19:47:35 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in) |
19:49:14 | * | xutaxkamay joined #nim |
19:52:07 | * | azimut quit (Ping timeout: 240 seconds) |
20:58:19 | FromDiscord | <Elegantbeef> @apetransaction you can do `result[0..^1] = data` instead of that copymem |
21:00:49 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:01:03 | FromDiscord | <Elegantbeef> No you cannot |
21:01:11 | FromDiscord | <Elegantbeef> Rather should not |
21:01:22 | FromDiscord | <apetransaction> In reply to @chronos.vitaqua "You can do `result": No, casting gave me weird ass results |
21:01:30 | FromDiscord | <Elegantbeef> you can just do `@data` on top of it |
21:01:39 | FromDiscord | <Elegantbeef> No need for the silly `toSeq` template |
21:01:57 | FromDiscord | <apetransaction> I got a string of length 0 with no content but if you echo the string it prints fine |
21:02:00 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Rather should not": Should not cast? |
21:03:04 | FromDiscord | <Elegantbeef> Of course not `seq[byte]` and `string` are different internally |
21:03:13 | FromDiscord | <Chronos [She/Her]> ...they are? |
21:03:26 | FromDiscord | <Chronos [She/Her]> I actually never knew that |
21:03:38 | FromDiscord | <Chronos [She/Her]> I know there are plans to do it, but not that they were different |
21:03:50 | FromDiscord | <Chronos [She/Her]> Casting has always worked for me, besides that weird edgecase on Windows- |
21:04:03 | FromDiscord | <Chronos [She/Her]> Though I don't think copyMem is much better |
21:04:32 | FromDiscord | <Elegantbeef> I mean they're ever so slightly different |
21:04:42 | FromDiscord | <Elegantbeef> Remember that strings are nil terminated and seqs are not |
21:04:53 | FromDiscord | <Elegantbeef> so `cast[string]` means you have a non nil terminated string |
21:05:04 | FromDiscord | <Elegantbeef> Which means if you attempt to use it for any `cstring` operations it'll explode |
21:05:44 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Remember that strings are": Nim strings aren't nil terminated, though? |
21:05:48 | FromDiscord | <Chronos [She/Her]> I thought they weren't? |
21:05:51 | FromDiscord | <Elegantbeef> Yes they are |
21:05:57 | FromDiscord | <Chronos [She/Her]> And that's why you had to do `myStr.cstring`? |
21:05:58 | FromDiscord | <Elegantbeef> They're pascal strings but also nil terminated |
21:06:01 | FromDiscord | <Elegantbeef> For 0 cost C interop |
21:06:02 | FromDiscord | <Chronos [She/Her]> ...huh |
21:06:13 | FromDiscord | <Elegantbeef> Almost all modern strings are nil terminated |
21:06:22 | FromDiscord | <Chronos [She/Her]> Purely for interop? |
21:06:36 | FromDiscord | <Elegantbeef> The reason you explicitly should do ` cstring myStr` is to clearly ensure that you do not make a cstring outlive the string |
21:06:40 | FromDiscord | <Elegantbeef> Yes purely for interop |
21:06:48 | FromDiscord | <Chronos [She/Her]> So even now, we have to deal with the curse of C 😔 |
21:06:53 | FromDiscord | <Elegantbeef> You can pass it to a procedure expecting a pascal string or a nil terminated string without any overhead |
21:06:57 | FromDiscord | <Chronos [She/Her]> But that's actually useful information :P |
21:06:59 | FromDiscord | <Elegantbeef> No we do not have to deal with the curse of C |
21:07:07 | FromDiscord | <Elegantbeef> Since the length is saved and it's O(1) |
21:07:14 | FromDiscord | <Chronos [She/Her]> Yeah makes sense |
21:07:21 | FromDiscord | <Elegantbeef> It always just adds a `\0` so you can send it to anywhere |
21:08:52 | FromDiscord | <Elegantbeef> @Phil you do realise your code almost instantly eats up 100% of memory right? |
21:09:19 | FromDiscord | <Elegantbeef> Atleast with 16gb it allocates so much so quickly I cannot reliably say how much memory it eats |
21:09:32 | FromDiscord | <Elegantbeef> But it does get to 80% by the time it crashes |
21:10:11 | FromDiscord | <Elegantbeef> I'm also uncertain why you use a `ref object` for your container |
21:11:03 | FromDiscord | <Phil> In reply to @Elegantbeef "I'm also uncertain why": Honestly just because of my mental model:↵There should only be one, ever |
21:11:30 | FromDiscord | <Phil> That gets passed around and needs to be accessible in every thread |
21:11:47 | FromDiscord | <Elegantbeef> Right but there is no reason for it to be heap allocated |
21:11:57 | FromDiscord | <Elegantbeef> You have two pointer indirection presently |
21:12:06 | FromDiscord | <Phil> In reply to @Elegantbeef "<@180601887916163073> you do realise": And no I did not, my memory tracker in the upper right corner:↵Never even registered the deallocation https://media.discordapp.net/attachments/371759389889003532/1184966062253551736/image.png?ex=658de4a4&is=657b6fa4&hm=e1d072dfa54b253e9722213866cd63b25e97fc0eed48e43a07a5534a002385b4& |
21:12:15 | FromDiscord | <Phil> (edit) "deallocation" => "memory consumption" |
21:12:39 | FromDiscord | <Phil> But how?↵I'm not even sending anything that large |
21:12:53 | FromDiscord | <Elegantbeef> For the container just disable `=copy` and `=dup` |
21:13:06 | FromDiscord | <Elegantbeef> Now you have only ever one alive |
21:13:15 | FromDiscord | <Elegantbeef> I mean on my machine it spikes up to 100% and then crashes |
21:13:55 | FromDiscord | <Phil> I mean, what, a single message is one seq of 500 numbers, that's 8 bytes per number 500 = 4000 Byte = 4 KB.↵Now I send 100 messages, that's 400KB.↵↵How many fucking copies is it doing to spike to 16GB |
21:14:16 | FromDiscord | <Phil> 500 because I adjusted the value to see how low I could go to make it run again |
21:15:48 | FromDiscord | <Elegantbeef> `routeMessage` does not take a `sink BackendMessage` |
21:15:55 | FromDiscord | <Elegantbeef> That's one copy |
21:16:22 | FromDiscord | <Elegantbeef> Fixes it |
21:17:02 | FromDiscord | <Elegantbeef> Now it only ever uses 0.6% memory |
21:17:42 | FromDiscord | <Elegantbeef> With 10000 ints |
21:18:38 | FromDiscord | <Phil> HOW?!↵I mean, I get that saves a copy, but 15 GB worth?! |
21:18:54 | FromDiscord | <Elegantbeef> Might be an arc bug 😄 |
21:18:56 | FromDiscord | <Phil> I may be overreacting because this may have cost me 8h by now |
21:19:02 | FromDiscord | <Elegantbeef> `--expandArc:routeMessage` |
21:19:20 | FromDiscord | <Phil> expandArc? |
21:19:39 | FromDiscord | <Elegantbeef> It expands the injected hooks inside of procedures |
21:20:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:20:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:20:52 | FromDiscord | <Phil> I... can't really read this well |
21:20:56 | FromDiscord | <Elegantbeef> Nope it frees `msg` so uhhh |
21:21:14 | FromDiscord | <Elegantbeef> It just shows you the IR and where the hooks are placed |
21:21:51 | FromDiscord | <Elegantbeef> In the first example it shows that it copies the `msg` then isolates it |
21:21:58 | FromDiscord | <graveflo> maybe this is just another example of how "free" and os level mem allocation are not the same thing |
21:22:01 | FromDiscord | <griffith1deadly> for objects that take up little memory space and are small in size (string + 4 bytes), is it better to use object or ref object? |
21:22:11 | FromDiscord | <Phil> object |
21:22:12 | FromDiscord | <Elegantbeef> It does not matter the size |
21:22:15 | FromDiscord | <Elegantbeef> It matters what you're doing |
21:23:00 | FromDiscord | <Phil> I mean, isn't it basically "If you got to ask, then object"?↵ref object is sth I only turn to when I really need it to match my memory model |
21:23:07 | FromDiscord | <Phil> (edit) "memory" => "mental" |
21:23:11 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "It does not matter": protocol buffer for reading data from socket's |
21:23:23 | FromDiscord | <Elegantbeef> Ok phil the issue is 100% Nim's allocator not returning resources |
21:23:36 | FromDiscord | <Elegantbeef> Running with `-d:useMalloc` it's rock solid without `sink` |
21:23:57 | FromDiscord | <Phil> Wait, so I should change my nim-issue I opened for this to be about nim's allocator? |
21:24:04 | FromDiscord | <Elegantbeef> Probably |
21:24:05 | FromDiscord | <Phil> That's the first time I found a bug this fundamental so not quite sure |
21:24:20 | FromDiscord | <Elegantbeef> Given it happens only with Nim's allocator |
21:24:20 | FromDiscord | <Phil> https://github.com/nim-lang/Nim/issues/23078↵The issue in question |
21:24:31 | FromDiscord | <graveflo> yea you should post info about this stuff for sure |
21:24:32 | FromDiscord | <Elegantbeef> At this point phil you should just wait for me to look at your code 😄 |
21:25:01 | FromDiscord | <graveflo> This really does remind me about another issue that happened though. Where memory appears to not be released to the OS in come situations |
21:25:10 | FromDiscord | <Elegantbeef> It's certainly a Nim allocator bug |
21:25:16 | FromDiscord | <griffith1deadly> In reply to @isofruit "Wait, so I should": there's already an open issue about it (allocator don't return memory to os) |
21:25:29 | FromDiscord | <graveflo> bc the OS doesn't necessarily have to take the mem back right away |
21:25:42 | FromDiscord | <Elegantbeef> > protocol buffer for reading data from socket's↵So what you're saying is that you do not have multiple views into a single value, so you do not need to use a `ref` |
21:25:44 | FromDiscord | <Elegantbeef> 😄 |
21:25:54 | FromDiscord | <Elegantbeef> Well grave this is the allocator not even reusing it's owned memory blocks |
21:26:00 | FromDiscord | <Elegantbeef> Which indicates a showstopper bug if you ask me |
21:26:01 | FromDiscord | <Phil> In reply to @griffith1deadly "there's already an open": Trying to find it, where? |
21:26:31 | FromDiscord | <Elegantbeef> Like at 16GBs of usage you're telling me the allocator cannot find a place to plop down 10000 ints |
21:26:39 | FromDiscord | <Elegantbeef> If that's the case I hate to see how fragmented the blocks are 😄 |
21:26:49 | FromDiscord | <Phil> I'm happy to link to it and more but I'd need to find the issue first |
21:26:55 | FromDiscord | <griffith1deadly> In reply to @isofruit "Trying to find it,": https://github.com/nim-lang/Nim/issues/22510 |
21:27:26 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "> protocol buffer for": thanks! |
21:28:12 | FromDiscord | <Elegantbeef> References with Nim2.0 are only beneficial for large data types you wish to be able to move(think array[1000, int]), or multiple views |
21:28:26 | FromDiscord | <Elegantbeef> Otherwise it's just an introduction of the billion dollar mistake and you should stop it |
21:28:55 | FromDiscord | <Elegantbeef> But even for large data types i'd probably do `type MyType = distinct ref array[1000, int]` so I can define my own hooks |
21:30:02 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "References with Nim2.0 are": because it storage at heap? |
21:30:30 | FromDiscord | <Elegantbeef> Right by using heap you can actually give up ownership of resources |
21:30:53 | FromDiscord | <Elegantbeef> `sink` does not work for value types for relatively obvious reasons |
21:31:31 | FromDiscord | <Elegantbeef> If they're not obvious, it's cause you cannot give up ownership of a field regardless where the memory is safely, it's apart of the parent type always |
21:33:21 | FromDiscord | <Phil> In reply to @griffith1deadly "https://github.com/nim-lang/Nim/issues/22510": Should I @ you in the issue (given you may be interested in this), if so what's your github? |
21:40:01 | FromDiscord | <Phil> Okay, that means I need to adjust some code generation to make that a sink (which I'd want just so this unversally works and I don't have to tell users that they must use -d:useMalloc) |
21:41:00 | FromDiscord | <Elegantbeef> @Phil Am I going to get mentioned by name twice in a single comment again?! 😛 |
21:41:02 | FromDiscord | <Elegantbeef> You can go for all 3 names, my github handle, my real name, my matrix name |
21:41:09 | FromDiscord | <Elegantbeef> Just keep adding names until I stop helping you |
21:41:27 | FromDiscord | <Phil> twice? I ping you once that's it |
21:41:54 | FromDiscord | <Phil> There only be one beef in that issue comment xP |
21:43:56 | FromDiscord | <Phil> In reply to @Elegantbeef "Just keep adding names": Next are nicknames |
21:43:56 | FromDiscord | <Phil> "beefy" |
21:44:00 | FromDiscord | <Phil> "bigbeef" |
21:44:03 | FromDiscord | <Phil> "beefy boy" |
21:54:27 | FromDiscord | <Phil> In reply to @Elegantbeef "For the container just": Actually, how do I do that? Just write my own and have them be empty? |
22:00:27 | FromDiscord | <Elegantbeef> @Phil write the header but add the error pragma `proc =dup(a: T): T {.error.}` |
22:00:47 | FromDiscord | <Elegantbeef> This will error whenever you call it statically so you know when a dup/copy is being desired |
22:01:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:03:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:04:11 | FromDiscord | <Phil> Ohh right, yeah the problem there is with ChannelHub for assigning stuff the hub suddenly needs to be a var every time |
22:04:21 | FromDiscord | <Elegantbeef> Oh noes |
22:04:39 | FromDiscord | <Phil> Which is... really easy, nevermind |
22:04:56 | FromDiscord | <Phil> I had to change like 2 procs |
22:05:13 | FromDiscord | <Phil> Correction, 1 proc |
22:06:14 | FromDiscord | <Elegantbeef> Damn unfathomable |
22:06:34 | FromDiscord | <Elegantbeef> One day Phil will either yell at me due to my sass, or not talk to me |
22:07:01 | FromDiscord | <Phil> Why would I? It makes my code better |
22:07:08 | FromDiscord | <bostonboston> I think |
22:07:12 | FromDiscord | <bostonboston> Unthinkable |
22:07:22 | FromDiscord | <Elegantbeef> It's sass |
22:07:42 | FromDiscord | <Phil> In reply to @bostonboston "Unthinkable*": You tried to spell it right and that's what matters |
22:07:48 | FromDiscord | <Phil> Even if attempt number 2 still is wrong |
22:08:11 | FromDiscord | <Elegantbeef> Wait what are we correcting? |
22:08:29 | FromDiscord | <bostonboston> I'm correcting myself |
22:08:30 | FromDiscord | <Phil> Nothing, I'm teasing him for the extra star at the end because I'm bored and terrified to go back to my benchmark example |
22:08:33 | FromDiscord | <bostonboston> Did I do it wrong twice |
22:08:39 | FromDiscord | <bostonboston> Ah |
22:08:54 | FromDiscord | <Elegantbeef> I'm confused |
22:08:58 | FromDiscord | <Phil> Because it will blow up on me again in strange ways |
22:09:12 | FromDiscord | <bostonboston> I stopped editing my messages in this discord cause someone told me it looks bad through the bridge |
22:09:42 | FromDiscord | <Phil> It does to irc and that is indeed correct |
22:09:47 | FromDiscord | <Phil> However, I'M a terrible person |
22:09:52 | FromDiscord | <Phil> (edit) "I'M" => "I'm" |
22:09:59 | FromDiscord | <Elegantbeef> Lol |
22:10:02 | FromDiscord | <Phil> Which is why I literally can't stop myself |
22:10:07 | FromDiscord | <Elegantbeef> I just send code blocks with nothing |
22:11:35 | FromDiscord | <Phil> Now that you mentioned it I can actually add sink to a fair amount of procs |
22:11:44 | FromDiscord | <Phil> Like my sendMessage proc etc. all of those can be sinks |
22:11:55 | FromDiscord | <Elegantbeef> Move semantics is the future |
22:12:02 | FromDiscord | <Elegantbeef> Now if `--sinkInference:on` didnt explode |
22:14:46 | * | xet7 quit (Remote host closed the connection) |
22:17:20 | FromDiscord | <Phil> ... am I a magician? Apparently I now manage to run into alloc issues even with sink everywhere |
22:17:34 | FromDiscord | <Phil> Not in the example posted, more in my own benchmark that I derived the example code from |
22:17:49 | FromDiscord | <Elegantbeef> Does it go away with `-d:useMalloc` 😄 |
22:17:55 | FromDiscord | <Phil> Yeah |
22:19:01 | FromDiscord | <Phil> Not a memory crash issue though for sure, I looked at another memory tool that measures every 500ms and that noticed no memory spike |
22:19:58 | FromDiscord | <graveflo> wait, I thought there was an issue though |
22:21:16 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:21:29 | FromDiscord | <Phil> I thought that fixing the latter would fix the former - it didn't |
22:21:39 | FromDiscord | <Phil> Turns out that -d:useMalloc fixes both though |
22:24:41 | FromDiscord | <Phil> Also yay, my documentation PR to threading/channels was accepted, it got docs now! |
22:24:53 | FromDiscord | <Elegantbeef> Congrats! |
22:32:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:41:11 | FromDiscord | <Phil> Huh I might not have a memory leak in Threadbutler |
22:41:22 | FromDiscord | <Phil> That... for me that is kind of nuts, particularly given I do some pointer magic here and there |
22:42:02 | FromDiscord | <Phil> But after sending `2_100_000` through my stress test so far and seeing no change in memory usage that's kind of inspiring |
22:43:01 | FromDiscord | <Phil> In reply to @Elegantbeef "Congrats!": Also: Thanks! |
22:52:46 | * | xet7 joined #nim |
23:13:15 | * | advesperacit quit () |
23:17:45 | * | xet7 quit (Remote host closed the connection) |
23:33:43 | * | azimut joined #nim |
23:57:41 | * | mahlon quit (Read error: Connection reset by peer) |