00:00:13 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:37 | * | tk joined #nim |
00:03:37 | FromDiscord | <Elegantbeef> I'd say so |
00:03:48 | FromDiscord | <Elegantbeef> error doesnt break compilation, so you can bubble more errors |
00:03:57 | FromDiscord | <Elegantbeef> So you need to handle what happens if it errors |
00:06:39 | FromDiscord | <TryAngle> where was the compile cache directory again? |
00:06:56 | FromDiscord | <Elegantbeef> `~/.cache/nim` on \nix |
00:07:49 | FromDiscord | <TryAngle> thanks |
00:11:02 | arkanoid | how do you handle errors with nim? |
00:11:23 | FromDiscord | <Elegantbeef> try except |
00:11:37 | arkanoid | I mean, do you use return codes, or just exceptions, or other patterns? |
00:12:00 | FromDiscord | <Elegantbeef> You can use any, Nim has exceptions though so it's more idiomatic |
00:12:11 | FromDiscord | <Elegantbeef> There are libraries which give you Rust style result |
00:12:25 | FromDiscord | <Elegantbeef> https://github.com/arnetheduck/nim-result |
00:12:36 | arkanoid | I've never used Result object pattern before, but I was thinking about it |
00:12:40 | FromDiscord | <Elegantbeef> I'd say whatever works for you |
00:13:04 | FromDiscord | <Elegantbeef> You can do the Go pattern of a tuple, the C pattern of a global error value, Rust's or exception handling |
00:13:22 | FromDiscord | <Elegantbeef> Though the first 2 suuuuuck |
00:14:09 | arkanoid | it seems to me that the best option would be using exceptions for exceptional (unrecoverable or unknown errors) and result object for all the others |
00:14:46 | arkanoid | but actually unsure, I come from try/except world for everything (java like) |
00:15:00 | arkanoid | of just mess around (python like) |
00:15:39 | arkanoid | the point agains result object in Nim is that you're not forced to handle both happy and bad result paths |
00:16:11 | arkanoid | while Rust with pattern matching makes this seamless |
00:18:08 | FromDiscord | <Elegantbeef> something something Hax's pattern matching 😀 |
00:18:48 | arkanoid | yes but still you're not forced. I want nim compiler to raise error if path is not handled properly |
00:19:45 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KJQ |
00:19:47 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/uMn |
00:20:12 | FromDiscord | <Elegantbeef> https://github.com/beef331/aoc2021/blob/master/day5/day5.nim 😀 |
00:20:27 | FromDiscord | <kaddkaka> (edit) "https://play.nim-lang.org/#ix=3KJS" => "https://play.nim-lang.org/#ix=3KJR" |
00:21:38 | FromDiscord | <kaddkaka> 1. oh, `scantuple`! |
00:21:57 | FromDiscord | <Elegantbeef> 2. you can make a constructor |
00:22:03 | FromDiscord | <Elegantbeef> 3 no |
00:22:29 | FromDiscord | <Elegantbeef> 4 in nim user types start with capitals |
00:23:38 | FromDiscord | <kaddkaka> 4. not mine, yet 😛 |
00:24:18 | FromDiscord | <Elegantbeef> My solution was relatively performant if you like racing time |
00:24:19 | FromDiscord | <kaddkaka> Also, how come my `var line` doesn't shadow the `lines` used in `for line in lines "day05.input": ` |
00:24:21 | FromDiscord | <kaddkaka> (edit) "`" => "`>" |
00:24:35 | FromDiscord | <kaddkaka> (edit) ""day05.input": `>" => ""day05.input":`?" |
00:25:13 | FromDiscord | <kaddkaka> @ElegantBeef That's also interesting, was not really going for that here/yet |
00:25:35 | FromDiscord | <Elegantbeef> Are you talking about `var lines` and `for x in lines "path"`? |
00:25:47 | FromDiscord | <kaddkaka> @ElegantBeef how did you emasure? just time? |
00:25:49 | FromDiscord | <kaddkaka> In reply to @Elegantbeef "Are you talking about": yes |
00:25:50 | FromDiscord | <Elegantbeef> if so the reason is `iterator`s are preferred inside for loops |
00:25:59 | FromDiscord | <kaddkaka> ah ok |
00:26:09 | FromDiscord | <Elegantbeef> I used flywind's timeit package |
00:26:16 | FromDiscord | <kaddkaka> feels a bit scary to overload the name though |
00:26:22 | FromDiscord | <Elegantbeef> Eh |
00:26:27 | FromDiscord | <Elegantbeef> Overloading makes sense for iterators |
00:26:28 | FromDiscord | <kaddkaka> at least iffy |
00:26:32 | FromDiscord | <Elegantbeef> take `[]` for slices |
00:26:44 | FromDiscord | <Elegantbeef> `for x in a[1..^1]` without overloading is a copy |
00:26:52 | FromDiscord | <Elegantbeef> With overloading it's a 0cost iteration |
00:27:28 | FromDiscord | <Elegantbeef> You arent overloading in this case imo |
00:27:31 | FromDiscord | <kaddkaka> ok, good reason 👍 |
00:27:52 | FromDiscord | <kaddkaka> well the name/identifier is overloaded, no? |
00:28:05 | FromDiscord | <Elegantbeef> Not ambiguous |
00:28:07 | FromDiscord | <Elegantbeef> So i'd say no |
00:28:33 | FromDiscord | <kaddkaka> overloads are usually not ambiguous, right? If they were, they would not eb usable? |
00:28:37 | FromDiscord | <kaddkaka> (edit) "eb" => "be" |
00:28:37 | FromDiscord | <Elegantbeef> I guess technically it's an overloaded symbol, but it's not ambiguous so there is no issue |
00:28:42 | FromDiscord | <kaddkaka> sure |
00:28:48 | FromDiscord | <kaddkaka> Agreed |
00:28:55 | FromDiscord | <Elegantbeef> `lines x` is a command call, so it's not that iffy |
00:29:07 | FromDiscord | <Elegantbeef> Atleast to me |
00:30:44 | FromDiscord | <kaddkaka> sNo I guess not. It's just uncommon (to me) wiht things other than functions that are overloaded. So it's unfamiliar I guess 🙂 |
00:30:51 | FromDiscord | <kaddkaka> (edit) "sNo" => "No" |
00:30:57 | FromDiscord | <kaddkaka> (edit) "wiht" => "with" |
00:31:22 | FromDiscord | <Elegantbeef> Now shadowing variables is an iffy territory |
00:31:53 | FromDiscord | <kaddkaka> I was thinking if I was going to add the last point after the `while` loop, like you did, or mixture with the end condition (as I ended up doing). |
00:43:35 | FromDiscord | <kaddkaka> Is it ok to use `_` to discard a value in a tuple assignment?↵`let (_, x1, y1, x2, y2) = line.scanTuple("$i,$i$s->$s$i,$i")` |
00:43:56 | FromDiscord | <kaddkaka> The code passes, but I couldn't find anything in the manual. |
00:44:29 | FromDiscord | <geekrelief> That's valid. |
00:47:16 | FromDiscord | <kaddkaka> Yes I noticed. first I tried `let (discard, x1, y1, x2, y2) = line.scanTuple("$i,$i$s->$s$i,$i")` which was not valid. Is `_` mentioned in the manual somwhere? |
00:47:29 | FromDiscord | <geekrelief> It's under tuple unpacking in the manual |
00:47:47 | FromDiscord | <kaddkaka> I must be blind, thanks |
00:48:05 | FromDiscord | <geekrelief> no worries, I was searching for it for a few minutes |
00:48:13 | FromDiscord | <geekrelief> I swore I read it in the manual |
00:48:22 | FromDiscord | <geekrelief> https://nim-lang.github.io/Nim/manual.html#statements-and-expressions-tuple-unpacking |
00:49:09 | FromDiscord | <Elegantbeef> `_` is just a unaccessible identifier in Nim |
00:50:17 | FromDiscord | <Elegantbeef> You can also use it in a proc def for instance `proc init(_: typedesc[Point])` |
00:51:40 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KK8 |
00:56:02 | FromDiscord | <kaddkaka> Getting similar redefinition error if I user `iterator`, so I was probably to hasty in my previous conclusion. |
01:38:18 | * | drewr quit (Quit: ERC (IRC client for Emacs 27.2)) |
01:51:00 | FromDiscord | <Elegantbeef> They come from the same module so in this case it's ambiguous |
01:51:10 | FromDiscord | <Elegantbeef> You cannot do `myModule.line` to diferentiate |
02:05:14 | * | arkurious quit (Quit: Leaving) |
02:34:33 | * | neurocyte6 joined #nim |
02:36:46 | * | neurocyte quit (Ping timeout: 260 seconds) |
02:36:46 | * | neurocyte6 is now known as neurocyte |
02:50:38 | * | noeontheend joined #nim |
02:59:02 | FromDiscord | <evoalg> I would argue that even though `var line` and `for line in` works, it's not as clear as using a different variable name, and even if the coder is comfortable with it, others may not be, so it's good practice to be as clear as possible (just my opinion) |
02:59:35 | FromDiscord | <Elegantbeef> Yea shadowing should only be used where it makes sense |
03:00:15 | FromDiscord | <Elegantbeef> For example |
03:00:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/2Gl |
03:00:47 | FromDiscord | <evoalg> what is Option? |
03:01:17 | FromDiscord | <Elegantbeef> `std/options` it adds a boolean flag to whether the value is "set" |
03:01:19 | FromDiscord | <Rika> Simulates None in Python (kinda) |
03:01:35 | FromDiscord | <evoalg> ohhhh ok |
03:03:35 | FromDiscord | <sOkam!> what's the consensus of when to use func instead of proc? (aka having side-effects or not by default)↵Is there a general rule of what's expected from Nim by standard? |
03:03:37 | FromDiscord | <huantian> more like the `Optional[T]` type hint which is `T | None` |
03:05:30 | FromDiscord | <Rika> In reply to @sOkam! "what's the consensus of": No |
03:05:38 | FromDiscord | <Rika> Use it as much as you want |
03:06:11 | FromDiscord | <evoalg> I thought it was generally nim's best practice to use the most restrictive way if you can? |
03:06:17 | FromDiscord | <Elegantbeef> Indeed |
03:06:20 | FromDiscord | <Rika> …. If you want |
03:06:23 | FromDiscord | <Elegantbeef> func -\> proc |
03:08:14 | FromDiscord | <Elegantbeef> Though i'm generally daft and go for proc |
03:09:51 | FromDiscord | <Rika> I personally literally don’t care |
03:10:34 | FromDiscord | <evoalg> so if I use a func and then if the compiler complains then I might say "oh that shouldn't have had a side-effect, let me see, oh it's because I was unintentionally accessing a global var which I didn't mean to do - nice one nim, you spotted a bug for me" ... same with `let` vs `var` right? |
03:10:38 | FromDiscord | <Rika> I’d rather a system that warns me of side effects (off by default) |
03:11:16 | FromDiscord | <Rika> In reply to @evoalg "so if I use": Much rarer than the “dammit Nim I’m debugging stfu” |
03:11:34 | FromDiscord | <evoalg> true |
03:11:51 | FromDiscord | <Elegantbeef> Yea my biggest nuisance with `func` is i write "echo" and get told to fuck off |
03:12:01 | FromDiscord | <Rika> In reply to @Rika "I’d rather a system": That’s why I say this |
03:12:27 | FromDiscord | <evoalg> but you both think `let` is better over `var`? |
03:12:39 | FromDiscord | <evoalg> I mean you both use let where you can? |
03:13:31 | FromDiscord | <evoalg> ...come on, fess up 😉 |
03:13:34 | FromDiscord | <Elegantbeef> Indeed |
03:13:46 | FromDiscord | <Elegantbeef> I default to `const` then move to `let` then finally use `var` |
03:14:15 | FromDiscord | <sOkam!> In reply to @Elegantbeef "I default to `const`": this is what I understood to be preferred in the language |
03:14:31 | FromDiscord | <Rika> I default to let |
03:14:49 | FromDiscord | <Rika> I don’t go to const unless it is global |
03:14:58 | FromDiscord | <Rika> And that I explicitly want it to be const |
03:16:26 | FromDiscord | <evoalg> both `const`'s and `let`'s have to be known at compile time right? ... what's the difference then? |
03:16:31 | FromDiscord | <Rika> Nope |
03:16:35 | FromDiscord | <Rika> Let is runtime |
03:16:43 | FromDiscord | <evoalg> ohhhh ok! |
03:16:51 | FromDiscord | <sOkam!> im learning cpp, after practicing nim for a few weeks, and im already missing nim man. so many nice things 😦 |
03:17:14 | FromDiscord | <Rika> What are you missing? From my usage of C++ I didn’t really miss much from Nim |
03:17:27 | FromDiscord | <sOkam!> uhh, cleaness? |
03:17:35 | FromDiscord | <Elegantbeef> Shun rilka! |
03:17:36 | FromDiscord | <huantian> In reply to @Elegantbeef "Yea my biggest nuisance": I usually write echo, scroll somewhere when running my program and have to scroll back to change it to debugEcho |
03:17:37 | FromDiscord | <Rika> Ah that |
03:17:40 | FromDiscord | <Rika> Eh |
03:18:10 | FromDiscord | <Rika> In reply to @huantian "I usually write echo,": “Debug echo” is awful I would say |
03:18:22 | FromDiscord | <sOkam!> In reply to @huantian "I usually write echo,": debugEcho works inside func? |
03:18:26 | FromDiscord | <Rika> Yes |
03:18:34 | FromDiscord | <Elegantbeef> just give me `-d:nimPureEcho` and call it a day 😛 |
03:18:36 | FromDiscord | <sOkam!> whats diff about them? |
03:18:52 | FromDiscord | <huantian> it's echo but you lie to the compiler and say it's pure |
03:18:54 | FromDiscord | <Rika> One is “lying about being pure” |
03:18:57 | FromDiscord | <Elegantbeef> debug echo is an explicitly pure procedure |
03:19:00 | FromDiscord | <Elegantbeef> Meant only for debugging |
03:19:22 | FromDiscord | <sOkam!> how is echo not pure? 🤔 |
03:19:34 | FromDiscord | <Rika> You write to a global called stdout |
03:19:37 | FromDiscord | <Elegantbeef> It writes to stdout |
03:19:40 | FromDiscord | <Elegantbeef> Changing global state |
03:19:40 | FromDiscord | <sOkam!> ohh |
03:20:11 | FromDiscord | <huantian> really doing anything should be an effect↵since you increase the temperature of the room of the user |
03:20:21 | FromDiscord | <Elegantbeef> lol |
03:20:24 | FromDiscord | <sOkam!> :Kappa: |
03:20:53 | FromDiscord | <Elegantbeef> I mean you can have a pure function that relies on the cpu temperature assuming it's a parameter |
03:20:55 | FromDiscord | <Rika> Why don’t you write APL if you need absolute cleanliness in code xd |
03:21:33 | FromDiscord | <sOkam!> In reply to @Rika "“Debug echo” is awful": why? 🤔 |
03:21:40 | FromDiscord | <Rika> It is a joke |
03:22:03 | FromDiscord | <sOkam!> ah k, me dummy. nvm me :_) |
03:22:03 | FromDiscord | <Rika> Oh |
03:22:08 | FromDiscord | <Rika> You replied to the other message |
03:22:12 | FromDiscord | <Rika> I didn’t see |
03:22:13 | FromDiscord | <sOkam!> ye |
03:22:26 | FromDiscord | <Rika> I just think it looks like a jack |
03:22:33 | FromDiscord | <Rika> Hack |
03:22:37 | FromDiscord | <sOkam!> like the word? |
03:22:38 | FromDiscord | <Rika> I hit j instead |
03:23:09 | FromDiscord | <Elegantbeef> jackerman |
03:23:35 | FromDiscord | <Rika> Whatever, I just think it’s a hack |
03:24:00 | FromDiscord | <Rika> Why introduce a keyword to check for side effects when it could have just been a warning or so I don’t know |
03:24:57 | FromDiscord | <dizzyliam> what's the best way to include resources (e.g. text files) in a nimble package so that they can be read by the library? |
04:29:15 | NimEventer | New Nimble package! windy - Windowing library for Nim using OS native APIs., see https://github.com/treeform/windy |
04:53:35 | * | nac5 joined #nim |
04:55:50 | * | nac quit (Ping timeout: 260 seconds) |
04:55:50 | * | nac5 is now known as nac |
04:55:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
05:43:46 | FromDiscord | <creikey> In reply to @NimEventer "New Nimble package! windy": awesome |
06:28:54 | * | Gustavo6046 joined #nim |
06:31:07 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
06:51:57 | FromDiscord | <Zonifer> can I dm someone about using the asynchttpserver and how to post form data? |
06:53:15 | FromDiscord | <Elegantbeef> You can ask your questions and someone will probably help |
06:56:33 | FromDiscord | <Zonifer> sent a code paste, see https://play.nim-lang.org/#ix=3KNc |
06:58:13 | FromDiscord | <Yardanico> @Zonifer no need to delete messages as they're bridged to IRC anyway |
06:58:31 | FromDiscord | <Zonifer> @Yardanico Ok cool good to know |
07:00:54 | FromDiscord | <Yardanico> basically you just find the file in the `body` of the request and parse it |
07:01:18 | FromDiscord | <Yardanico> asynchttpserver is quite limited, maybe you should consider prologue or jester as they offer more abstractions |
07:01:27 | FromDiscord | <Yardanico> for example in prologue - https://planety.github.io/prologue/uploadfile/ |
07:02:03 | FromDiscord | <Yardanico> be aware that currently all of those http servers will read the whole file into memory, so it's not good to use it for big files |
07:02:14 | FromDiscord | <Yardanico> https://github.com/planety/prologue/blob/devel/tests/local/uploadFile/local_uploadFile_test.nim |
07:02:33 | * | Vladar joined #nim |
07:02:35 | FromDiscord | <Yardanico> (this is a prologue test, so you need to change the imports to just be prologue, and modify to your liking) |
07:02:50 | FromDiscord | <Shiba> Where did nim get echo? Bash? |
07:03:03 | FromDiscord | <Shiba> (edit) "echo?" => "echo?from" |
07:03:09 | FromDiscord | <Elegantbeef> Perhaps |
07:03:28 | FromDiscord | <Shiba> (edit) "echo?from" => "echo? from" |
07:03:53 | FromDiscord | <Zonifer> sent a code paste, see https://play.nim-lang.org/#ix=3KNj |
07:04:05 | FromDiscord | <Yardanico> req.body is the body |
07:04:17 | FromDiscord | <Yardanico> also why are you doing http manually? |
07:04:30 | FromDiscord | <Yardanico> i mean if you want, sure, but there's https://nim-lang.org/docs/httpclient.html in stdlib |
07:06:34 | FromDiscord | <Zonifer> Well my project started small but ended up getting bigger hahaha I wanted to add more features to this app and learn more under the hood |
07:27:09 | * | Gustavo6046 joined #nim |
07:59:27 | * | PMunch joined #nim |
08:04:37 | * | Gustavo6046 quit (Ping timeout: 240 seconds) |
08:51:13 | NimEventer | New post on r/nim by TheDarkMode: Current Goals for Nim?, see https://reddit.com/r/nim/comments/rux893/current_goals_for_nim/ |
09:07:22 | * | Vladar quit (Remote host closed the connection) |
09:12:21 | FromDiscord | <smartlyweird> hi guys |
09:12:52 | FromDiscord | <evoalg> hiya |
09:13:50 | FromDiscord | <smartlyweird> how are you? |
09:14:28 | FromDiscord | <evoalg> as I normally am, how are you? |
09:16:56 | FromDiscord | <smartlyweird> ahh it was normal until i struck with a problem lol |
09:18:01 | FromDiscord | <evoalg> what problem? |
09:18:33 | FromDiscord | <smartlyweird> i've been trying to make a utility with nim to read evtx files and there's this API EvtNext |
09:18:52 | FromDiscord | <smartlyweird> there's its 3rd param PEVT_HANDLE |
09:19:11 | FromDiscord | <smartlyweird> according to documentation `A pointer to an array of handles that will be set to the handles to the events from the result set.` |
09:19:27 | FromDiscord | <smartlyweird> but idk how to implement it in nim |
09:20:31 | FromDiscord | <smartlyweird> sorry im new to nim. i've done this in cpp before but in nim its becoming a bit tricky for me |
09:22:03 | FromDiscord | <evoalg> wow ok, then hopefully one of the guru's will answer, as I'm also new to nim. There are some people who used to (or still do) program ing cpp etc, and from what I've seen here they think nim is easier (unless I've misunderstood) |
09:22:33 | FromDiscord | <Elegantbeef> What's the proc? |
09:26:07 | FromDiscord | <smartlyweird> sent a code paste, see https://play.nim-lang.org/#ix=3KNV |
09:26:37 | FromDiscord | <smartlyweird> i've ported almost all required enums from winevt.h |
09:26:56 | FromDiscord | <smartlyweird> its just that this PEVT_HANDLE im dealing with |
09:29:03 | FromDiscord | <smartlyweird> sent a code paste, see https://paste.rs/tXx |
09:29:11 | FromDiscord | <Elegantbeef> It's just a pointer to event handle so does it expect a nil terminated array? |
09:29:34 | FromDiscord | <Rika> Or a pointer to memory then a length integer? |
09:29:52 | FromDiscord | <Elegantbeef> There is no length integer as a parameter that i can tell |
09:30:30 | FromDiscord | <Rika> Do you have the definition in C(++) |
09:30:35 | FromDiscord | <smartlyweird> i've no clue tbh |
09:30:47 | FromDiscord | <smartlyweird> In reply to @Rika "Do you have the": yes msdn provided a example |
09:30:49 | FromDiscord | <Elegantbeef> I mean do you have the C++ code you're attempting to rewrite? |
09:30:51 | FromDiscord | <smartlyweird> wait lemme share |
09:31:34 | FromDiscord | <smartlyweird> In reply to @Elegantbeef "I mean do you": yes. i cannot share that since guy im working for as a freelancer doesn't allow me to do that |
09:31:41 | FromDiscord | <smartlyweird> but i can share msdn link |
09:31:54 | FromDiscord | <Elegantbeef> What do you pass in C++ land? |
09:32:31 | FromDiscord | <smartlyweird> https://gist.github.com/Mandar-Shinde/6468275f9cbaecf61807a8ca3ad78c10 |
09:32:45 | FromDiscord | <smartlyweird> its not msdn but i too this reference to make the cpp build |
09:33:35 | FromDiscord | <smartlyweird> (edit) "too" => "used" |
09:35:02 | FromDiscord | <krisppurg> Found an issue related to my problem, guess I'll have to just wait until treeform merges the pr https://github.com/treeform/jsony/pull/40↵https://discord.com/channels/371759389889003530/371759389889003532/927325295642546246 |
09:41:23 | FromDiscord | <smartlyweird> In reply to @Elegantbeef "What do you pass": trying to dm you |
09:41:39 | FromDiscord | <smartlyweird> i can share my cpp code in dm |
09:42:01 | FromDiscord | <Rika> He is not on discord |
09:42:05 | FromDiscord | <smartlyweird> oh |
09:42:06 | FromDiscord | <Rika> Technically he is |
09:42:10 | FromDiscord | <Rika> But not right now |
09:42:16 | FromDiscord | <smartlyweird> okay |
09:42:23 | FromDiscord | <smartlyweird> can i dm you? |
09:42:39 | FromDiscord | <Rika> DM is generally not accepted as well, it would be difficult for everyone to help if only one of us have info |
09:43:38 | FromDiscord | <smartlyweird> okay |
09:43:53 | FromDiscord | <smartlyweird> sent a code paste, see https://play.nim-lang.org/#ix=3KNY |
09:43:54 | FromDiscord | <Rika> I think it would be better if you could tell us the type definition (in C++?) of handle |
09:43:56 | FromDiscord | <smartlyweird> this was my cpp implementation |
09:44:20 | FromDiscord | <Elegantbeef> It's a pointer handle |
09:44:20 | FromDiscord | <smartlyweird> (edit) "cpp" => "c" |
09:44:23 | FromDiscord | <Elegantbeef> So seems you just use a nill |
09:44:24 | FromDiscord | <smartlyweird> yes |
09:44:33 | FromDiscord | <smartlyweird> i did that |
09:44:34 | FromDiscord | <smartlyweird> wait |
09:44:37 | FromDiscord | <Rika> The PEVT_HANDLE definition, do you know exactly what it is |
09:44:43 | FromDiscord | <Elegantbeef> Well i mean↵`var a: PevtHandle = nil` |
09:44:58 | FromDiscord | <smartlyweird> ohh |
09:45:29 | FromDiscord | <smartlyweird> In reply to @Rika "The PEVT_HANDLE definition, do": yes, according to msdn `A pointer to an array of handles that will be set to the handles to the events from the result set.` |
09:45:39 | FromDiscord | <smartlyweird> In reply to @Elegantbeef "Well i mean `var": lemme try that |
09:46:00 | FromDiscord | <Rika> As you described it seems like it is a ptr UncheckedArray[whatever should be in here, the array value type] |
09:46:00 | FromDiscord | <Rika> Nice timing for the train I’m on to go into a tunnel |
09:46:23 | FromDiscord | <Rika> Okay so I’m having trouble understanding where you’re having trouble lol |
09:51:50 | NimEventer | New thread by Severak: Good real life apps, see https://forum.nim-lang.org/t/8764 |
10:04:59 | FromDiscord | <smartlyweird> In reply to @Rika "Okay so I’m having": i just want to know how to make array of handles |
10:05:06 | FromDiscord | <smartlyweird> because im following msdn |
10:06:04 | FromDiscord | <smartlyweird> In reply to @Elegantbeef "Well i mean `var": i dont suppose it could be implemented since i cannot see any nim support for winevt.h yet |
10:06:12 | FromDiscord | <smartlyweird> but ill check that too |
10:06:14 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#create%2Ctypedesc |
10:06:27 | FromDiscord | <Rika> Close to “calloc” |
10:07:03 | FromDiscord | <Rika> Then you have to convert to “ptr UncheckedArray[T]” |
10:07:08 | FromDiscord | <Elegantbeef> I mean i dont see how it knows where the last element is so i really dont know how |
10:07:10 | FromDiscord | <Rika> Where T is the type of the value |
10:07:22 | FromDiscord | <Rika> In reply to @Elegantbeef "I mean i dont": I don’t either really |
10:07:58 | FromDiscord | <Rika> I guess it might be null terminating, so your size should be 1 more than the amount of items you want to place into the array |
10:09:53 | FromDiscord | <Elegantbeef> You'd think the docs would mention that |
10:10:05 | FromDiscord | <Elegantbeef> But no we're supposed to intuit the way the array is |
10:10:21 | FromDiscord | <Rika> Lol |
10:16:11 | FromDiscord | <smartlyweird> Ikr msdn sometimes misguide lol |
10:19:53 | NimEventer | New thread by Axben: Status - how would I program a GUI-based Nim-application on Windows?, see https://forum.nim-lang.org/t/8765 |
10:33:56 | * | flynn quit (Read error: Connection reset by peer) |
10:35:17 | * | flynn joined #nim |
10:46:32 | FromDiscord | <kaddkaka> In reply to @Rika "Much rarer than the": There is `debugEcho` if that's the kind of side-effect you want in a `func` |
10:47:02 | FromDiscord | <kaddkaka> In reply to @Elegantbeef "Yea my biggest nuisance": I guess you know about it, ^ |
10:48:37 | FromDiscord | <kaddkaka> Ok I shouldn't answer 8h old posts -.- |
10:49:25 | FromDiscord | <smartlyweird> In reply to @Rika "https://nim-lang.org/docs/system.html#create%2Ctype": so this one should behave as typedef right? |
10:52:16 | FromDiscord | <smartlyweird> In reply to @Rika "https://nim-lang.org/docs/system.html#create%2Ctype": any example you have? would be easier for me to understand the implementation |
11:00:25 | * | jjido joined #nim |
11:00:46 | FromDiscord | <Rika> Sorry, not now |
11:18:22 | * | oddish joined #nim |
11:36:05 | FromDiscord | <Clonkk> Is there a way to construct a `seq[string]` at compile (through `{.compileTime.}` proc) and use the result at run-time without using macros ? |
11:37:01 | PMunch | Should be |
11:38:01 | FromDiscord | <Hamid_Bluri> yes |
11:38:13 | FromDiscord | <Hamid_Bluri> hey pmuch |
11:38:45 | PMunch | @Clonkk: https://play.nim-lang.org/#ix=3KOy |
11:38:48 | PMunch | @Hamid_Bluri, hello |
11:39:28 | Amun-Ra | Clonkk: https://play.nim-lang.org/#ix=3KOz |
11:39:36 | Amun-Ra | ah, you beat me up to it |
11:41:27 | FromDiscord | <Clonkk> Will take a look at it when my internet connection decides to stop suckling thanks |
11:48:28 | FromDiscord | <Yardanico> if nim playground is a bit too heavy for you, you can just go to the ix.io direct link |
11:48:46 | FromDiscord | <Yardanico> since playground uses it for hosting code - http://ix.io/3KOy and http://ix.io/3KOz |
11:49:19 | FromDiscord | <Yardanico> there's also some syntax highlighting support on ix.io - http://ix.io/3KOz/nim |
11:50:05 | FromDiscord | <Clonkk> Ah yeah okay I should have specified.What I'm trying to do is static Read a list of file that the user provide through "static string" at compile Time and use the result at run time.↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
11:52:50 | FromDiscord | <Yardanico> yes that's easily possible |
11:53:16 | FromDiscord | <Yardanico> if you just want lines in a seq, you can quite literally just do `const myseq = staticRead("file.txt").splitLines()` assuming you imported std/sequtils |
11:53:37 | FromDiscord | <Yardanico> how does the user provide the file name to you code though? |
11:55:35 | FromDiscord | <evoalg> Yards you know that collection scope issue you fixed, would it already be in dev release or something? |
11:55:50 | FromDiscord | <evoalg> (I just don't know the process) |
11:56:46 | FromDiscord | <Yardanico> it's not merged as it might be intended behaviour |
11:56:49 | FromDiscord | <Yardanico> there was some discussion in the PR |
11:57:00 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/pull/19288 |
11:57:42 | FromDiscord | <evoalg> oh ok thx you! |
12:23:54 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KOT |
12:29:27 | FromDiscord | <Yardanico> newSeq can also create a new seq as you have in your first example |
12:36:18 | FromDiscord | <kaddkaka> right, so `newseq` has (at least) 2 variants, and 1 of them is analogue to the `newSeqWith`. Thanks |
12:42:23 | NimEventer | New thread by Clavismax: nimsuggest Issue processing ``runnableExamples``, see https://forum.nim-lang.org/t/8766 |
13:01:39 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KP4 |
13:03:04 | FromDiscord | <kaddkaka> I guess https://nim-lang.org/docs/sequtils.html#countIt.t%2Cuntyped%2Cuntyped would be nice |
13:04:13 | FromDiscord | <Solitude> ||for loops are more readable than fold|| |
13:04:15 | FromDiscord | <kaddkaka> (I'm starting to like the ability to write an expression directly as an argument to a template!) 🙂 |
13:05:00 | FromDiscord | <kaddkaka> @Solitude In this case `let total = countIt(grid, it>1)` is very readable if I could flatten the `grid` in a simple way. |
13:05:54 | FromDiscord | <kaddkaka> In reply to @Solitude "||for loops are more": I'm not sure haskeller would agree 😛 |
13:05:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:06:06 | FromDiscord | <Solitude> im not sure i would listen to a haskeller |
13:06:19 | FromDiscord | <Rika> im not sure if you should argue about somehting thats highly subjective |
13:06:42 | FromDiscord | <Solitude> cope |
13:06:49 | FromDiscord | <Rika> good to know |
13:07:34 | FromDiscord | <kaddkaka> ?_? |
13:07:39 | FromDiscord | <Rika> nothing |
13:08:07 | FromDiscord | <Rika> sorry, i mean nothing of importance |
13:09:26 | FromDiscord | <kaddkaka> Anyway, my current question is how to transform a "2d sequence" to supply it to [countIt](https://nim-lang.org/docs/sequtils.html#countIt.t%2Cuntyped%2Cuntyped). Should I be looking for iterators? |
13:10:58 | FromDiscord | <Solitude> that means you would be back to for-loops |
13:11:54 | FromDiscord | <Solitude> either write your countIt for seqs of seqs, or write the procedure that does what you need here. not everything should be solved by means of stdlib or fancy oneliner. |
13:12:00 | PMunch | @kaddkaka, you can pass a 2D sequence to countIt just fine |
13:12:47 | FromDiscord | <Solitude> that would do completely different thing |
13:13:37 | FromDiscord | <kaddkaka> In reply to @Solitude "either write your countIt": Of course not, I'm not looking for fancy, I'm looking for readable. |
13:13:51 | PMunch | I guess something like foldl(countIt(my2Dseq, it > 100)) should do what you need |
13:14:39 | PMunch | Well, not quite, but you get the point |
13:14:57 | FromDiscord | <kaddkaka> yeah, not sure I want to mix `foldl` and `countIt` though |
13:15:01 | FromDiscord | <kaddkaka> thanks |
13:15:06 | PMunch | Why not? |
13:15:23 | FromDiscord | <kaddkaka> it's 2 concepts to think about |
13:16:30 | PMunch | Well they're both functional in nature |
13:18:42 | PMunch | First the countIt counts every element that fulfils the predicate by x or y, and then add them all together |
13:19:05 | FromDiscord | <Rika> doesnt foldl take two argd |
13:19:07 | FromDiscord | <Rika> argsd |
13:19:08 | FromDiscord | <Rika> (edit) "argsd" => "args" |
13:19:20 | PMunch | Yeah I messed it up a bit |
13:19:49 | PMunch | I guess it should be mapIt(my2Dseq, it.countIt(it > 42)).foldl(a + b) or something like that |
13:21:02 | FromDiscord | <kaddkaka> `grid.foldl(a + b.countIt(it>1), 0)` works fine too |
13:23:15 | PMunch | Oh yeah, that should also work fine |
13:25:06 | FromDiscord | <kaddkaka> `grid.countIt(it>1)` would of course be even more to the point (count all elements in this container that are `>1`), like @Solitude said. I have to read about iterators. |
13:26:15 | FromDiscord | <kaddkaka> although, that form would be ambiguous I guess |
13:27:14 | FromDiscord | <kaddkaka> I think `let s = grid.flatten.countIt(it>1)` shows intent in a better way. |
13:27:16 | PMunch | I meant you could do `template countIt[T](s: seq[seq[T], x: untyped): int = foldl(s, let it = b; a + x, 0)` or something like that |
13:27:25 | FromDiscord | <kaddkaka> (edit) "`let s = grid.flatten.countIt(it>1)`" => "`grid.flatten.countIt(it>1)`" |
13:27:40 | PMunch | Flatten is probably more expensive than foldl though |
13:27:54 | PMunch | Because you then need to allocate a 1D seq that contains your 2D seq |
13:28:16 | FromDiscord | <kaddkaka> Really? can't flatten be implemented as an iterator that doesn't allocate anything? |
13:29:09 | FromDiscord | <Solitude> it can, but then you need a for loop or another countIt that works on iterators |
13:29:28 | FromDiscord | <kaddkaka> In reply to @PMunch "I meant you could": The problem is that this hides the original meaning of `countIt` in this case. |
13:30:40 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KPh |
13:31:11 | FromDiscord | <Solitude> s: iterable[T] or something |
13:31:49 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KPi |
13:32:18 | FromDiscord | <kaddkaka> (edit) "https://play.nim-lang.org/#ix=3KPi" => "https://play.nim-lang.org/#ix=3KPj" |
13:35:00 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3KPk |
13:35:06 | FromDiscord | <kaddkaka> 😄 |
13:36:07 | FromDiscord | <Solitude> zamn |
13:37:18 | FromDiscord | <kaddkaka> So `countIt` just works 👍 |
13:53:18 | FromDiscord | <valerga> gotta like the It functions |
13:55:48 | FromDiscord | <kaddkaka> Are there other languages that allows the expression syntax like Nim does for? (`foreach` in systemverilog is similar, with the exception that it's more of a super ugly hack, https://www.chipverify.com/systemverilog/systemverilog-foreach-loop) |
13:56:35 | FromDiscord | <Rika> Which syntax are we talking about |
13:56:54 | FromDiscord | <Rika> Parentheses omission? |
13:57:30 | FromDiscord | <kaddkaka> The `it>1` part in `s.countIt(it>1)` |
13:58:09 | FromDiscord | <Rika> Lisp |
13:58:17 | FromDiscord | <Rika> Probably rust |
13:58:24 | FromDiscord | <Rika> Anything with macros (probably) |
13:58:28 | FromDiscord | <Rika> Yes that includes C |
13:59:46 | FromDiscord | <kaddkaka> Is it called anything specific? Or is it just too ordinary to merit it's own name |
14:02:04 | FromDiscord | <kaddkaka> (seen as just a (trivial) cosequence of macros) |
14:03:20 | * | sagax joined #nim |
14:05:21 | * | rockcavera joined #nim |
14:05:21 | * | rockcavera quit (Changing host) |
14:05:21 | * | rockcavera joined #nim |
14:07:02 | FromDiscord | <Rika> untyped macros? |
14:07:03 | FromDiscord | <Rika> idk |
14:07:09 | FromDiscord | <Rika> theres prolly no single name for it |
14:10:09 | * | arkurious joined #nim |
14:10:20 | * | jjido joined #nim |
14:20:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:30:06 | * | lumo_e joined #nim |
14:59:11 | * | noeontheend joined #nim |
15:09:37 | * | neurocyte quit (Ping timeout: 240 seconds) |
15:11:33 | * | neurocyte joined #nim |
15:26:08 | * | Vladar joined #nim |
15:26:16 | * | Vladar quit (Client Quit) |
15:37:38 | FromDiscord | <Clonkk> is there a compile time equivalenty of `walkPattern` or do I have to call bash through `staticExec` ? |
15:38:15 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3KRF |
15:39:18 | FromDiscord | <Rika> w-what |
15:39:19 | FromDiscord | <Rika> no |
15:39:25 | FromDiscord | <Rika> you want goto? |
15:39:49 | * | noeontheend quit (Ping timeout: 240 seconds) |
15:39:49 | FromDiscord | <Rika> split the proc into two and run only the first half |
15:39:59 | FromDiscord | <el__maco> in the intercal language you could specify a probability for each instruction to execute. You could sometimes print "b" depending on luck |
15:40:06 | FromDiscord | <Rika> thats terrifying |
15:40:14 | FromDiscord | <hmmm> lol |
15:41:52 | FromDiscord | <el__maco> they also had a way better mechanism since gotos are bad, they had "come from" instead. You could split a block by specifying a come from instruction somewhere else |
15:42:43 | FromDiscord | <Rika> thats incrementally less terrifying |
15:42:58 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3KRL |
15:43:23 | FromDiscord | <hmmm> like some sort of switch lol |
15:43:44 | FromDiscord | <Solitude> how do you affect the switch |
15:44:01 | FromDiscord | <hmmm> I have no idea lol |
15:44:05 | FromDiscord | <Solitude> ????? |
15:44:08 | FromDiscord | <Solitude> what are you doing? |
15:44:12 | FromDiscord | <el__maco> its not clear to me in which situation the second statement should run and not run |
15:45:08 | FromDiscord | <hmmm> nah what I wanted to do is already solved now changing the proc and using an if, but still I had the curiousity it could be done without changing the proc if I set the machinery beforehand |
15:45:21 | FromDiscord | <Rika> no |
15:45:28 | FromDiscord | <el__maco> maybe a "when" statement? |
15:45:41 | FromDiscord | <Rika> he said "without changing the proc" |
15:45:49 | FromDiscord | <Rika> so no code can be added to the proc |
15:45:55 | FromDiscord | <Rika> is what i assume |
15:45:59 | FromDiscord | <Rika> so goto |
15:46:10 | FromDiscord | <Rika> (?) |
15:46:31 | FromDiscord | <Rika> i cant see too well how a goto would help |
15:46:42 | FromDiscord | <Rika> el maco is right, the come from thing would work best |
15:46:44 | FromDiscord | <hmmm> yea, I wanted some way that detected that the statement was in some way special and used {magic} machinery to decide to run or not lol |
15:46:46 | FromDiscord | <Rika> 👀 |
15:46:50 | FromDiscord | <el__maco> but adding a goto also would change the proc. I see Intercal has the superiority here, because "come from" would solve this |
15:46:56 | FromDiscord | <Rika> In reply to @hmmm "yea, I wanted some": that is legitimately scary |
15:47:17 | FromDiscord | <Rika> In reply to @el__maco "but adding a goto": its not a good problem-solution pair |
15:47:29 | FromDiscord | <Rika> need to reframe the issue in a better problem |
15:48:00 | FromDiscord | <el__maco> I feel like its perfect problem-solution pair, but maybe I don't understand the motivation deeply enough |
15:48:32 | FromDiscord | <Rika> ah |
15:48:43 | FromDiscord | <Rika> you could probably abuse term rewriting macros in a way |
15:48:59 | FromDiscord | <hmmm> well the motivation was kind of A E S T H E T I C since I felt the proc was perfect and special casing the if was ugly lol |
15:49:01 | FromDiscord | <Rika> good luck figuring that out |
15:49:28 | FromDiscord | <Rika> In reply to @hmmm "well the motivation was": if you think its ugly, find another way that isnt the if and isnt the "do some fuckery without changing the code" |
15:49:34 | FromDiscord | <hmmm> especially introducing a parameter just to check the if felt very ugly |
15:49:35 | FromDiscord | <Rika> like maybe refactor the function |
15:49:39 | FromDiscord | <Rika> it might be doing too much |
15:50:02 | FromDiscord | <Rika> if you have too many parameters then you might want to reconsider what they do |
15:50:13 | FromDiscord | <Rika> and again your function might be doing too much if so |
15:51:17 | FromDiscord | <Solitude> write another function |
15:51:17 | * | lumo_e quit (Ping timeout: 240 seconds) |
15:51:29 | FromDiscord | <Rika> sent a long message, see http://ix.io/3KRO |
15:51:43 | FromDiscord | <hmmm> like the if checking was done just to check an edge case and I wanted my pretty pure proc to stay pretty |
15:51:44 | FromDiscord | <Clonkk> So basically you want to use a very complex solution to a very simple problem because "it looks good" ?↵(@hmmm) |
15:51:56 | FromDiscord | <Rika> i generally think around six is too many parameters |
15:52:12 | FromDiscord | <hmmm> In reply to @Clonkk "So basically you want": exactly! the question is dumb lol, but I thought maybe nim had machinery I didn't know of |
15:52:32 | FromDiscord | <el__maco> you can join the anti if movement if you haven't already <https://francescocirillo.com/pages/anti-if-campaign> |
15:52:42 | FromDiscord | <Solitude> In reply to @hmmm "exactly! the question is": write a macro that gets procedure implementation and modifies its body |
15:53:51 | FromDiscord | <Clonkk> It's called "if statement" lol↵(@hmmm) |
15:55:28 | FromDiscord | <hmmm> In reply to @Clonkk "It's called "if statement"": haha ok ok, I got the message lol, it was just curiosity. Now I'll just lurk in the shadows waiting for ElegantBeef to produce a 20 lines monstrosity to elegantly solve my problem with macros or other weird constructs just for kicks 😃 |
15:55:32 | FromDiscord | <Clonkk> Design your own iinterpreted language so you can change code executed at run-time and re-implement your application with the interpreted language.↵(@Solitude) |
15:55:46 | FromDiscord | <0000> In reply to @hmmm "like the if checking": use haskell |
15:56:59 | FromDiscord | <0000> sent a code paste, see https://play.nim-lang.org/#ix=3KRS |
15:57:23 | FromDiscord | <0000> is there some magic macro on nimble that enables pattern matching over procedure parameters? |
15:57:25 | FromDiscord | <0000> that could be fun |
15:57:47 | FromDiscord | <Solitude> there was one for object variants |
15:58:01 | * | neurocyte quit (Quit: The Lounge - https://thelounge.chat) |
15:58:11 | FromDiscord | <0000> neat |
16:01:48 | FromDiscord | <Rika> In reply to @hmmm "haha ok ok, I": it wont be elegant i can tell |
16:02:31 | FromDiscord | <Rika> In reply to @Clonkk "Design your own iinterpreted": i feel like such a thing exists already |
16:08:12 | * | neurocyte joined #nim |
16:16:00 | FromDiscord | <zetashift> @treeform\: heyho, treeform, I'm working on my Pixie backend for ginger again, and I'm getting an error, using `context.strokeCircle` \: https://nimdocs.com/treeform/pixie/pixie/context.html#strokeCircle%2CContext%2CVec2%2Cfloat32 I also can't find it in the source anymore? Am I doing something wrong? |
16:17:04 | FromDiscord | <zetashift> it seems the only proc it can find is the one where a `Circle` is given but not a `center: Vec2, radius: Float` |
16:19:06 | FromDiscord | <Forest> Nim is mentioned quite often in the Python Discord 👀 |
16:21:32 | FromDiscord | <Recruit_main707> nice |
16:22:10 | FromDiscord | <hmmm> the question is what took them so long 😃 |
16:43:34 | PMunch | Hmm, maybe I should join the Python Discord and set up keyword notifications on the word Nim |
16:43:45 | PMunch | Would be interesting to see what they say about us :) |
17:10:00 | * | lumo_e joined #nim |
17:17:12 | * | Gustavo6046 joined #nim |
17:17:25 | FromDiscord | <Rika> keyword notifications do not exist on discord unless you use client modifications or a 3rd party client |
17:17:54 | FromDiscord | <kevin> Is there a recommended way to list out processes from Nim? C# has `Process.GetProcesses()` but i couldn't find something like that in Nim. |
17:19:08 | FromDiscord | <TryAngle> In reply to @Rika "keyword notifications do not": I mean self bots are a thing and using them like this surely won't be against the TOS no? |
17:19:14 | FromDiscord | <kevin> closest I could find is `GetCurrentProcessId()` : https://nim-lang.org/docs/os.html#getCurrentProcessId which only shows the current process, not all |
17:19:24 | FromDiscord | <Rika> In reply to @TryAngle "I mean self bots": guess |
17:21:44 | FromDiscord | <treeform> In reply to @zetashift "<@107140179025735680>\: heyho, treeform, I'm": We changed the API a bit. Just create a circle and pass that in? |
17:22:44 | FromDiscord | <zetashift> Ah I see, I will, thank you! \:D |
17:23:26 | FromDiscord | <IsaacPaul> In reply to @kevin "closest I could find": Searching `[Process]` in the nim repo doesn't reveal much. I'm assuming you might have to implement that functionality yourself. |
17:24:01 | FromDiscord | <kevin> darn i was hoping that wasn;t gonna be the answer 😦 |
17:26:24 | * | rockcavera quit (Remote host closed the connection) |
17:27:08 | * | oprypin quit (Ping timeout: 252 seconds) |
17:28:46 | * | oprypin joined #nim |
17:35:58 | FromDiscord | <eyecon> In reply to @kevin "Is there a recommended": Should be this: https://github.com/khchen/winim/search?q=EnumProcessModulesEx |
17:36:58 | FromDiscord | <eyecon> https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumprocessmodulesex |
17:38:54 | * | jjido joined #nim |
17:40:01 | FromDiscord | <treeform> In reply to @zetashift "Ah I see, I": strokeCirlce is not part of the Canvas context spec so we are free to do what we want. We initially had the strokeCirlce(vec2, float) and strokeCirlce(cirlce) but decided it was redundant. Its so easy to create a circle obj) |
17:48:17 | * | lumo_e quit (Ping timeout: 240 seconds) |
17:48:42 | * | lumo_e joined #nim |
17:58:33 | * | Gustavo6046 quit (Quit: Leaving) |
18:04:02 | * | kayabaNerve_ quit (Ping timeout: 260 seconds) |
18:16:28 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:21:21 | * | rockcavera joined #nim |
18:21:21 | * | rockcavera quit (Changing host) |
18:21:21 | * | rockcavera joined #nim |
18:24:07 | * | jjido joined #nim |
18:26:43 | * | Gustavo6046 joined #nim |
18:31:06 | PMunch | @kevin, this is really not something that's easy to do from a program. C# is only able to do it because it does a lot of stuff behind the scenes, including keeping track of the processes it starts |
18:33:57 | * | lumo_e quit (Ping timeout: 240 seconds) |
18:39:08 | FromDiscord | <kevin> Every OS has it's own version of ps/tasklist so it should be doable. From a little reading it looks like every OS enumerates currently running processes differently. |
18:39:35 | PMunch | Oh it's definitely possible, but it's an OS dependent thing |
18:39:42 | PMunch | Probably easier to just keep track yourself |
18:39:47 | FromDiscord | <kevin> It's definitely over my head to write that kind of code, but would be cool in the future to have a library function in `os` to get all processes |
18:40:11 | PMunch | Not sure what you'd use it for |
18:40:26 | FromDiscord | <kevin> listing processes of course! 😄 |
18:40:44 | FromDiscord | <kevin> same reason windows has tasklist and linux has ps |
18:41:22 | FromDiscord | <IsaacPaul> https://github.com/warmchang/procps/blob/master/proc/readproc.c↵seems like a pain, but this code fetches everything it seems. |
18:41:39 | FromDiscord | <IsaacPaul> It's probably a good reference |
18:47:06 | FromDiscord | <zetashift> I get it, I was just confused because I still saw it in the docs haha, I've changed it to making a circle first!↵(@treeform) |
18:51:17 | FromDiscord | <ache of head> In reply to @el__maco "you can join the": wait, is this fr or a joke? |
18:51:19 | FromDiscord | <ache of head> i can't tell |
18:56:06 | FromDiscord | <IsaacPaul> Seems like a joke since they only provide a bad example instead of both a good and bad. Though the example code is _bad_. Horizontal complexity (early exit) costs less mentally than vertical (depth; nested). |
18:58:05 | FromDiscord | <IsaacPaul> Most of the time you're always just rearranging things rather than removing ifs unless you have duplicate code/behavior. |
19:00:39 | * | lumo_e joined #nim |
19:06:34 | FromDiscord | <creikey> In reply to @IsaacPaul "Seems like a joke": ever indentation I see while reading a program raises my blood pressure a little bi |
19:06:37 | FromDiscord | <creikey> (edit) "ever" => "every" |
19:06:40 | FromDiscord | <creikey> (edit) "bi" => "bit" |
19:08:24 | FromDiscord | <zetashift> @treeform\: context.font is a string now, what is the way to change the size of fonts being drawn onto the context now? |
19:10:01 | FromDiscord | <treeform> In reply to @zetashift "<@107140179025735680>\: context.font is a": yes `ctx.fontSize` |
19:10:32 | FromDiscord | <treeform> https://github.com/treeform/pixie/blob/master/src/pixie/contexts.nim#L19 |
19:10:37 | * | Gustavo6046 quit (Ping timeout: 240 seconds) |
19:11:43 | FromDiscord | <zetashift> ah I missed that, thank you! |
19:12:15 | * | Gustavo6046 joined #nim |
19:21:31 | * | Guest8731 joined #nim |
19:38:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:41:23 | * | jjido joined #nim |
19:50:50 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3KTy |
19:54:13 | FromDiscord | <Solitude> `type t = typeof(0)` |
19:54:20 | FromDiscord | <geekrelief> Also, I'm trying to pass a type to a macro and call `getTypeImpl` on it, but it doesn't return anything like `getImpl` which is what I want after it's been transformed. |
19:54:40 | FromDiscord | <geekrelief> In reply to @Solitude "`type t = typeof(0)`": thanx! I was trying `var t:type ...` |
19:54:44 | FromDiscord | <geekrelief> (edit) "thanx!" => "thanks!" |
19:56:08 | FromDiscord | <geekrelief> In reply to @Solitude "`type t = typeof(0)`": if I `echo t.repr` that doens't compile |
19:56:14 | FromDiscord | <geekrelief> (edit) "doens't" => "doesn't" |
19:57:08 | FromDiscord | <Solitude> !eval type t = typeof 0; echo t |
19:57:11 | NimBot | t |
19:57:22 | FromDiscord | <geekrelief> yeah it gives t |
19:57:50 | FromDiscord | <geekrelief> it should be int right? |
19:58:02 | FromDiscord | <Solitude> no? |
19:58:27 | FromDiscord | <geekrelief> ok that's not what I want.. I don't want to define a new type t of int |
19:58:51 | FromDiscord | <geekrelief> I want to store the typedesc |
19:59:18 | FromDiscord | <Solitude> thats how you "store" typedesc |
19:59:46 | FromDiscord | <Solitude> in macro you can extract whatever info you need |
20:00:27 | FromDiscord | <geekrelief> yeah that's ultimately what I'm working with. Inside a macro I'm trying to call `getTypeImpl`, but it's not returning the transformed type. |
20:04:47 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3KTH |
20:04:49 | FromDiscord | <Solitude> kinda cringe |
20:04:54 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3KTI |
20:05:58 | FromDiscord | <geekrelief> Is there a way for me to pass in the type `Vec4f` and get transformed into `object...`? |
20:06:45 | FromDiscord | <Solitude> yes |
20:06:49 | FromDiscord | <Solitude> snippet i posted |
20:06:57 | FromDiscord | <Solitude> gets you resolved type |
20:07:06 | FromDiscord | <Solitude> you call getImpl on that and do whatever |
20:07:40 | FromDiscord | <geekrelief> In your sample `t` has to be `typedesc` and not typed? |
20:07:56 | FromDiscord | <Solitude> it doesnt matter |
20:09:37 | * | noeontheend joined #nim |
20:09:39 | FromDiscord | <geekrelief> In reply to @Solitude "it doesnt matter": hmm doesn't work for me |
20:10:09 | FromDiscord | <geekrelief> https://play.nim-lang.org/#ix=3KTL |
20:10:36 | FromDiscord | <Solitude> man, i just posted the code |
20:10:55 | FromDiscord | <Solitude> https://play.nim-lang.org/#ix=3KTM |
20:11:00 | FromDiscord | <geekrelief> yeah I just put it in playground, it's not giving me what I need |
20:12:36 | FromDiscord | <geekrelief> In reply to @Solitude "https://play.nim-lang.org/#ix=3KTM": Thanks for the clarification. Sorry to bother. |
20:12:56 | FromDiscord | <michaelb> nim does some auto-magic where if e.g. you have an array of `cchar` and you print it, then a member with value equiv to `27.cchar` is printed as `'\e'` (and similar for tab char etc.)↵↵is there a way to do that manually, e.g. a proc I can call with a `string` and it would replace control characters with the `\` equiv? |
20:12:58 | FromDiscord | <yallxe> hi, is there something like args or kwargs from python in nim? |
20:13:41 | FromDiscord | <Solitude> In reply to @yallxe "hi, is there something": varargs. no substitute for kwargs. |
20:14:28 | FromDiscord | <yallxe> In reply to @Solitude "varargs. no substitute for": thanks |
20:14:56 | FromDiscord | <Solitude> In reply to @brainproxy "nim does some auto-magic": https://nim-lang.org/docs/strutils.html#escape%2Cstring%2Cstring%2Cstring but it does more than that, so you might need to steal part of it |
20:31:48 | FromDiscord | <Casey.McMahon> sent a code paste, see https://paste.rs/Coe |
20:32:39 | FromDiscord | <geekrelief> In reply to @Casey.McMahon "hello, I would like": use `ptr PwmConfig` as the type for the argument |
20:34:37 | FromDiscord | <Casey.McMahon> In reply to @geekrelief "use `ptr PwmConfig` as": thanks! I'll give that a go. |
20:35:37 | FromDiscord | <geekrelief> This is so weird. I don't understand why I need to call `getTypeImpl` twice here: https://play.nim-lang.org/#ix=3KTU |
20:37:48 | * | Guest8731 left #nim (#nim) |
20:40:32 | FromDiscord | <Casey.McMahon> sent a code paste, see https://play.nim-lang.org/#ix=3KTY |
20:40:52 | FromDiscord | <geekrelief> `config.addr` |
20:41:13 | FromDiscord | <geekrelief> https://nim-lang.github.io/Nim/system.html#addr%2CT |
20:41:47 | FromDiscord | <geekrelief> There's also `unsafeAddr` which you may need to use depending on how config is defined. |
20:43:00 | FromDiscord | <Casey.McMahon> In reply to @geekrelief "There's also `unsafeAddr` which": you had to use `unsafeAddr`. |
20:43:06 | FromDiscord | <Casey.McMahon> (edit) "you" => "yeah," |
20:50:24 | NimEventer | New thread by Geekrelief: `getTypeImpl` bug?, see https://forum.nim-lang.org/t/8767 |
21:05:21 | FromDiscord | <yallxe> how do I write `byte` to string buffer (from `std/streams`)? so the string will be like `"\x00"` if byte is 0 |
21:18:45 | FromDiscord | <geekrelief> In reply to @yallxe "how do I write": not sure what you're asking for. |
21:19:49 | FromDiscord | <Elegantbeef> They want to escape non printable charas |
21:19:52 | FromDiscord | <geekrelief> you want to `strm.write('\x00')` and have it return what? |
21:21:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KU6 |
21:21:58 | FromDiscord | <treeform> In reply to @yallxe "how do I write": You can see how I do that in my print library: https://github.com/treeform/print/blob/master/src/print.nim#L70-L85 |
21:22:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
21:38:25 | FromDiscord | <Hamid_Bluri> Hey treeform |
21:38:42 | FromDiscord | <Hamid_Bluri> any news about fidget? |
21:41:44 | FromDiscord | <yallxe> In reply to @geekrelief "you want to `strm.write('\x00')`": yes but i have a byte type |
21:42:17 | FromDiscord | <yallxe> i converted byte to int and made stream.write($chr(n)) |
21:42:27 | FromDiscord | <yallxe> seems to work pretty good |
21:43:00 | * | drewr joined #nim |
21:43:17 | FromDiscord | <hmmm> also will fidget2 follow the venerable pokemon naming standards and be called fidgeotto? |
21:43:28 | FromDiscord | <hmmm> naming matters in nim-land 🧐 |
21:43:33 | FromDiscord | <yallxe> In reply to @yallxe "i converted byte to": https://media.discordapp.net/attachments/371759389889003532/927678596632444958/IMG_20220103_224258_395.jpg |
21:43:37 | FromDiscord | <yallxe> like this |
21:43:59 | FromDiscord | <yallxe> and no stream actually |
21:45:12 | FromDiscord | <Solitude> you dont need to `$` chars to add them to string |
21:51:45 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:52:12 | FromDiscord | <yallxe> In reply to @Solitude "you dont need to": strange cuz my vscode plugin was telling me that this is incorrect |
21:52:35 | FromDiscord | <Solitude> never trust vscode plugin |
22:01:02 | FromDiscord | <krisppurg> @treeform thought id ping you this because this is a bit more important↵https://discord.com/channels/371759389889003530/371759389889003532/927495259062140928 |
22:01:45 | FromDiscord | <evoalg> In reply to @kevin "Is there a recommended": Does https://github.com/juancarlospaco/psutil-nim help? |
22:06:34 | FromDiscord | <yallxe> In reply to @kevin "Is there a recommended": you may use EnumProcesses from c++ |
22:06:39 | FromDiscord | <yallxe> import it or use winim |
22:07:02 | FromDiscord | <yallxe> or use the easier option if you do not care about dependencies |
22:07:06 | FromDiscord | <yallxe> above one |
22:07:38 | FromDiscord | <treeform> In reply to @krisppurg "<@!107140179025735680> thought id ping": It's strange my tests did not catch that. |
22:12:32 | FromDiscord | <krisppurg> jsony to me is acting weird sometimes for me |
22:13:41 | FromDiscord | <kevin> In reply to @evoalg "Does https://github.com/juancarlospaco/psutil-nim h": Yeah, this looks promising. I will try to make this work. Thank you for the suggestion! 😄 |
22:27:32 | FromDiscord | <hmmm> [Finished in 425.5s] 🤔 |
22:41:37 | * | drewr quit (Ping timeout: 240 seconds) |
22:41:50 | FromDiscord | <treeform> In reply to @krisppurg "jsony to me is": I pushes some bug fixes |
22:42:14 | FromDiscord | <Smarc> If anyone has some spare time and is willing to help an amateur, I would really appreciate someone reviewing my code and give me some advice on how to optimize it :)↵https://github.com/Smarcy/connect_the_dotfiles |
23:00:37 | FromDiscord | <Solitude> Please, for the love of god, dont commit binaries to git... |
23:06:51 | nrds | <Prestige99> Why not |
23:10:02 | FromDiscord | <hmmm> u r not my supevisor |
23:10:04 | FromDiscord | <hmmm> I have the photo of my lover on git |
23:14:14 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3KUL |
23:15:46 | FromDiscord | <IsaacPaul> If this was production code. I'd say it needs more error handling. `open` and `readFile` probably can crash... |
23:18:12 | FromDiscord | <IsaacPaul> Also don't have sections of commented code if they're already in your git history |
23:20:31 | FromDiscord | <congusbongus> binary dependencies are ok if the language doesn't have a good package manager↵otherwise use the build system for distributing binaries, they don't belong in source control |
23:43:32 | * | noeontheend joined #nim |
23:51:49 | * | krux02 joined #nim |