00:00:01 | * | marcus quit (Remote host closed the connection) |
00:00:40 | * | marcus joined #nim |
00:02:01 | FromDiscord | <Phil> Hapyp new year! |
01:16:35 | * | Mister_Magister quit (Quit: bye) |
01:40:01 | FromDiscord | <demotomohiro> Happy Nim year! |
02:00:21 | * | Mister_Magister joined #nim |
02:17:02 | * | derpydoo quit (Ping timeout: 256 seconds) |
03:31:43 | FromDiscord | <ajusa> Huh just read through the rfc/roadmap for 2024 and saw case objects are getting deprecated for variants, neat |
03:41:38 | FromDiscord | <Robyn [She/Her]> Case objects? |
04:33:57 | NimEventer | New thread by aiac: Is there a more elegant approach, see https://forum.nim-lang.org/t/10822 |
04:55:11 | FromDiscord | <ajusa> In reply to @chronos.vitaqua "Case objects?": Sorry object variants |
04:55:36 | FromDiscord | <ajusa> https://github.com/nim-lang/RFCs/issues/543 if you haven't read it |
04:55:42 | FromDiscord | <ajusa> (edit) "https://github.com/nim-lang/RFCs/issues/543 if you haven't read it ... " added "yet" |
05:03:49 | FromDiscord | <Robyn [She/Her]> Not sure how sum types work tbh |
05:28:36 | * | silverhikari joined #nim |
05:36:30 | silverhikari | Hello, i am building a nim project using localdeps but some of the dependencies are in separated project specific git repos, and i am wondering if there is a way for the separate project parts to share the same .deps folder as the main project |
05:38:46 | FromDiscord | <takemichihanagaki3129> In reply to @ajusa "Huh just read through": This roadmap is fire! I loved that.↵Sum types is something I wanted so much. This is the feature that I was missing in Nim. |
05:44:49 | FromDiscord | <Langosta> In reply to @silverhikari "Hello, i am building": maybe using atlas? |
06:34:26 | silverhikari | well tried atlas though i am having trouble getting it to detect the project folder to add it to the workspace nimble as iam using "atlas use file:./dependency" but it say it can not find the .nimble of the project even though there is a .nimble in the folder |
06:40:36 | silverhikari | nvm figured out you have to give it a full path and not a relative |
06:40:44 | FromDiscord | <graveflo> did you do `atlas init --deps=deps_folder` |
06:50:07 | silverhikari | no did not notice that part, so i git clone the dependant_project inside of the deps folder and then use file: it for the main project to see it? |
06:53:07 | FromDiscord | <graveflo> I don't think so. I think I misunderstood your initial message. I do that to separate the dependency-only deps from the working projects |
06:58:41 | FromDiscord | <graveflo> yea I'm not sure how to use atlas to add a project in the current workspace to another project in the workspace. I usually just add them to the `nim.cfg` manually since it's just an easy copy / paste. The `--cfgHere` might help if you need to drop the file first |
06:59:45 | silverhikari | well fixed that problem as it no longer reports that it cant find the .nimble and appears in the src.nimble though trying do build the main project just says it can not find the dependeny |
07:02:15 | FromDiscord | <graveflo> so when you try and compile project A that depends on project B the output says that it cannot import B? Are you using `nim c` or a nimble task or something else? |
07:03:16 | silverhikari | nvm i think i figured out where i messed up |
07:58:00 | FromDiscord | <gyatsoyt> Why does py2nim doesn't work in my pc |
07:58:13 | FromDiscord | <gyatsoyt> I downloaded it through nimble install py2nim |
07:58:45 | FromDiscord | <gyatsoyt> And then did `py2nim main.py` it says py2nim isn't recognised as a command |
09:12:06 | FromDiscord | <spacelucy> hi, new to nim. is there a better way to color strings other than ANSI escape codes? |
09:13:09 | FromDiscord | <spacelucy> like, i can write `echo "\x1b[31mhi"`, and it works, but its not very nice to actually code with |
09:13:19 | FromDiscord | <spacelucy> image.png https://media.discordapp.net/attachments/371759389889003532/1191308160904986734/image.png?ex=65a4f72e&is=6592822e&hm=2da7e34517a3bdf75625cfd4dc587a84010a143a95ad34e4bb757343fd197776& |
09:13:26 | FromDiscord | <Elegantbeef> `std/[terminal, colors]` |
09:13:56 | FromDiscord | <spacelucy> thanks |
09:18:05 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:18:19 | FromDiscord | <spacelucy> ah, thats simpler |
09:18:21 | FromDiscord | <spacelucy> thanks |
09:18:59 | FromDiscord | <rakgew> you are welcome. yes I quite like it for its readybility. (-\: |
09:29:46 | FromDiscord | <spacelucy> "readability" |
09:29:49 | FromDiscord | <spacelucy> image.png https://media.discordapp.net/attachments/371759389889003532/1191312313739915325/image.png?ex=65a4fb0d&is=6592860d&hm=76d4d03d3a756e13ec69447a52a2ae2d51a371be063f1c35d9221df198559efe& |
09:30:16 | FromDiscord | <spacelucy> i love making readable code |
09:53:29 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:54:15 | FromDiscord | <Phil> Have you used functional programming stuff like "map", "filter" etc. before? |
09:54:53 | FromDiscord | <Phil> Actually, nevermind, that would be inefficient.↵Just use nim's version of list comprehensions, which is defining a for-loop in a collect macro: |
09:55:10 | FromDiscord | <Phil> https://nim-lang.org/↵See here the example when you select Comprehensions |
09:55:36 | FromDiscord | <Phil> on the drop down on the right-hand side |
09:59:16 | FromDiscord | <scipio_nl> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:03:17 | FromDiscord | <scipio_nl> (Maybe using macros? But I have yet to wrestle my way through the language to get there) |
10:13:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:13:39 | FromDiscord | <Phil> You can turn any iterator and range into a seq using this |
10:13:52 | * | Mister_Magister quit (Excess Flood) |
10:14:44 | * | Mister_Magister joined #nim |
10:17:23 | FromDiscord | <scipio_nl> hmm, indeed.↵But regarding my question, would there be a way to utilize metaprogramming to actually make the exact syntax `assert @[1..10] == (1..10.toSeq()`↵↵? |
10:17:49 | FromDiscord | <scipio_nl> (edit) "hmm, indeed.↵But regarding my question, would there be" => "sent" | "way to utilize metaprogramming to actually make the exact syntax `assert @[1..10] == (1..10.toSeq()`↵↵?" => "code paste, see https://play.nim-lang.org/#ix=html>" |
10:18:44 | FromDiscord | <Phil> Not entirely certain here if you could use `@`, the problem here is that `@` is already covered with meaning (it transforms an array into a seq), You definitely can do it, but that likely would require a different symbol |
10:19:04 | FromDiscord | <Phil> So more like `&[1..10]` or sth |
10:19:38 | FromDiscord | <Phil> Though maybe it's possible, I'd need to check how specific `@` is defined |
10:23:34 | FromDiscord | <Elegantbeef> `@` is a proc that takes in `openArray` so no you cannot overload it for a untyped macro |
10:23:58 | FromDiscord | <scipio_nl> No need to go through the trouble to look stuff up @Phil . At the moment I'm reading Dom96's book and with every new language construct my brain wants to try out stuff and I'm flooded with ideas, questions. |
10:24:55 | FromDiscord | <scipio_nl> I mean, my original question contained a solution (with `proc seqInt()`) which also worked in a oneliner, so it's not really an issue, just being curious "how could I do this and that as well? 🤔 ") |
10:26:15 | FromDiscord | <Phil> If you ever want to try out macros, just keep the following in mind:↵Everything is a fixed pattern of NimNodes. If you reconstruct that pattern, you can generate that piece of code.↵To observer what pattern a piece of code has, use "dumpTree/dumpAstGen" from std/macros.↵That's basically it for starters |
10:26:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:26:51 | FromDiscord | <Phil> You can branch out from there into nicer tools like "genAst" |
10:34:29 | FromDiscord | <rakgew> completely agree, `dumpTree` and `dumpAstGen` are a big helpers to better understand things over in macro land.↵another thing I found out way too late, was the fact that it sometimes it can be helpful to create something with `quote do` but then add onto it with logic constructed from nodes like nnkCall and the like.↵(@Phil) |
10:36:34 | FromDiscord | <rakgew> ^^ although in the end I like to make them either use `quote do` \_or\_ nodes building. |
10:37:17 | FromDiscord | <scipio_nl> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:37:48 | FromDiscord | <scipio_nl> In reply to @isofruit "If you ever want": Definitely I do want to learn macros. |
10:40:05 | FromDiscord | <Phil> In reply to @rakgew "completely agree, `dumpTree` and": I tend to either use quote do in the sense that a pre-construct all the needed nodes and have a single quote do at the end, or (in the case of procs) I use quote do to generate a "first static part" of a proc and add further NimNodes to the proc-body based on more complex logic |
10:42:26 | NimEventer | New thread by sls1005: Are generic procedures default to `mixin`?, see https://forum.nim-lang.org/t/10823 |
10:46:43 | FromDiscord | <scipio_nl> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:01:48 | FromDiscord | <scipio_nl> No I think "operator overloading" actually 🤔 |
11:12:24 | FromDiscord | <Phil> ... I am going full time chronicles now, holy shit not randomly needing to deal that a proc might raise an Exception is nice |
11:16:03 | FromDiscord | <bung8954> @albassort |
11:23:44 | FromDiscord | <Phil> It occurred to me that you can kinda style "multi-threading tasks with message passing" as "multi-threaded form of async" |
11:29:04 | FromDiscord | <scipio_nl> would that be useful for my intended (Owlkettle) GUI app in Nim? |
11:29:16 | FromDiscord | <scipio_nl> https://media.discordapp.net/attachments/371759389889003532/1191342375394615398/Screenshot_2021-04-27_at_10.png?ex=65a5170c&is=6592a20c&hm=3a63a6af80c47bd5b32f1f8e9769da2e3c040c5d11f284704824e4686b6ff062& |
11:30:13 | FromDiscord | <Phil> Depends on how much computation you really need.↵If your stuff isn't that computationally intensive you can do it all in a single thread.↵If it is intensive, then yes |
11:30:16 | FromDiscord | <scipio_nl> i.e. here I am displaying over websockets the current price (at the time I screenshotted this) of Bitcoin over websockets, and that value is then used nonstop to offset orders based on the valued in the stepper inputs below |
11:30:48 | FromDiscord | <Phil> The goal is mostly outsourcing stuff that would block your GUI thread to make sure it stays responsive |
11:31:19 | FromDiscord | <scipio_nl> well as there have to be (multiple) long running websocket connections that nonstop monitor and visually update price: yes |
11:31:35 | FromDiscord | <scipio_nl> definitely cannot be blocking |
11:32:09 | FromDiscord | <Phil> Would it be? Are you awaiting/waitForing anywhere?↵Receiving a message, pushing that into your AppState and then triggering a redraw seems easy enough |
11:32:26 | FromDiscord | <scipio_nl> In reply to @isofruit "Would it be? Are": it doesnt yet exist in Nim, so no idea |
11:33:00 | FromDiscord | <scipio_nl> In reply to @isofruit "Would it be? Are": you mean the default Nim features would suffice for this and no ThreadButler needed (for this) ? |
11:33:22 | FromDiscord | <Phil> In reply to @scipio_nl "it doesnt yet exist": More like owlkettle itself has all you need ^^ |
11:34:49 | FromDiscord | <scipio_nl> This is a simple example tho, the idea is to subscribe to multiple websocket price streams concurrently, process the values (for Bitcoin, Solana, whatever is in the screen viewport) live and utuilize the current price via offsets defined in the steppers to process orders over REST |
11:35:15 | FromDiscord | <scipio_nl> (edit) "utuilize" => "utilize" |
11:38:30 | FromDiscord | <scipio_nl> I also want this in Owlkettle |
11:38:31 | FromDiscord | <scipio_nl> https://media.discordapp.net/attachments/371759389889003532/1191344702985863208/image.png?ex=65a51937&is=6592a437&hm=bf11140b6df9491efa6408de1a83c1a10c4802472251e71657ae624ad6d5f811& |
11:38:53 | FromDiscord | <scipio_nl> this is the orderbook, which is nonstop changing, at the bottom is the current balance between bids and asks |
11:40:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:41:08 | * | lucasta joined #nim |
11:41:14 | FromDiscord | <Phil> (edit) |
11:43:20 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
11:43:50 | FromDiscord | <Phil> (edit) |
11:44:23 | FromDiscord | <scipio_nl> right, I think I understand where you're going with this |
11:44:30 | FromDiscord | <Phil> And this all runs in a single thread |
11:44:48 | FromDiscord | <Phil> threadButler is mostly for when e.g. you get a message back and you need to do some calculus so intensive that it takes half a second |
11:44:53 | FromDiscord | <Phil> Or even 100ms |
11:45:14 | FromDiscord | <scipio_nl> well, the processing of orders does trigger a waiting time for output I need |
11:45:34 | FromDiscord | <Phil> Because then you can say "Yo, Threadpool, here's the message, here's the proc to execute, Sayonara, send me a message when you're done" |
11:46:42 | FromDiscord | <scipio_nl> for example the "amend bids" button / routine: that basically pushes a request over ReST "tell me which .unfilled active limit buy orders I have placed already", it awaits the response over JSON and then when the data comes in processes it, per orderID and then passes back another order "move up every order 3 usd higher" |
11:47:36 | FromDiscord | <scipio_nl> in the interim the price websockets need to keep on updating |
11:48:29 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
11:49:00 | FromDiscord | <Phil> (edit) |
11:49:49 | FromDiscord | <Phil> (edit) |
11:50:55 | FromDiscord | <Phil> Both are fair.↵IIRC jtv likely would prefer option 2 as you don't have to deal with the really bad stacktraces that async provides (in every language under the sun)↵Most folks would prefer option 1 because they're familiar with async syntax |
11:51:17 | FromDiscord | <Phil> (edit) "Both are fair.↵IIRC jtv ... likely" added "(pretty experienced dev that knows a lot more about multithreading than I do)" |
11:52:04 | FromDiscord | <scipio_nl> I think I'd also prefer option 2 with ThreadButler |
11:53:29 | FromDiscord | <Phil> Theeeen you need to give me a fair amount of time since basically leorize's insight into multithreading entirely crashed and burned my prior attempt so I'm refactoring into something far simpler that still does the job but more robust |
11:53:39 | FromDiscord | <Phil> (edit) "attempt" => "approach" |
11:54:08 | FromDiscord | <scipio_nl> I already had a feeling your discussion with him was relevant for me 😉 |
11:54:10 | FromDiscord | <Phil> If you want to read up on that, it was a somewhat lengthy discussion that happened around 14 hours ago or so |
11:54:16 | FromDiscord | <scipio_nl> I have already |
11:54:48 | FromDiscord | <scipio_nl> same time when I was engaging with folks in here about making Nim more mainstream and organized |
11:54:49 | FromDiscord | <Phil> You can already write your own, it's not incredibly difficult, threadButler will simply be more convenient |
11:55:18 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
11:55:31 | FromDiscord | <Phil> The difficulty for threadButler mostly stems from wanting to provide some generic utilities that are a tad hard to write when you need to have certain things registered by the user |
11:55:37 | * | jmdaemon joined #nim |
11:56:34 | FromDiscord | <scipio_nl> ThreadButler would solve some concerns @alex.boisvert raised too about "toy language" |
11:56:56 | FromDiscord | <odexine> Not really, that requires a lot more than one library |
11:57:21 | FromDiscord | <Phil> Ehhhhh I don't entirely think so. The actually hard part is solved by nim-taskpools, and yeah as Rika stated that is a lot more than that |
11:57:29 | FromDiscord | <scipio_nl> In reply to @odexine "Not really, that requires": mind the word "some" 😉 |
11:57:49 | FromDiscord | <odexine> You can argue that any library alleviates “some” issues raised |
11:59:17 | FromDiscord | <scipio_nl> I still can't put my finger on why exactly I tend to search for ways to utilize Nim instead of "just use Rust" |
11:59:47 | FromDiscord | <scipio_nl> fast compile times is one thing, but there's something about the flexible composability of the Nim syntax to get things done |
12:01:13 | FromDiscord | <odexine> I’d probably say that the syntax of Rust creates a lot of friction? |
12:01:15 | FromDiscord | <scipio_nl> ps, I wouldn;t call myself a Rust expert either but I absolutely love how incredibly fast and stable some Rust apps are, but when trying to implement it myself the dev speed is incredibly slow for some reason and in Nim it requires considerably less energy to do things, in multiple ways even |
12:05:02 | FromDiscord | <Phil> My experience as well, though I only tried it for 3 months back when I was considerably less knowledgeable |
12:05:34 | FromDiscord | <Phil> I guess at this point I could give it a try again and see if I can break through since the concepts it can throw at me I should be familiar with by now, but I'm really not feeling the desire |
12:05:43 | FromDiscord | <odexine> Well that’s one common criticism of rust |
12:05:49 | FromDiscord | <odexine> It’s hard to develop with |
12:06:25 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:06:44 | * | jmdaemon joined #nim |
12:07:07 | NimEventer | New thread by mantielero: Std/htmlgen first paragraph, see https://forum.nim-lang.org/t/10825 |
12:08:27 | FromDiscord | <scipio_nl> My friend Rik Arends I think is an absolute Rust guru and he agrees it's extremely hard for people and disagrees with most practises of repo devs to keep on stacking dependencies. Instead, he tends to rewrite his own routines to the point it can be considered crazy |
12:08:48 | FromDiscord | <scipio_nl> -- the MakePad founder I mentioned |
12:09:05 | FromDiscord | <scipio_nl> he went viral with his MakePad talk at RustNL on reddit |
12:10:16 | FromDiscord | <scipio_nl> if you check his talk on Youtube, it really is mindboggling how fast his presentation runs |
12:13:13 | FromDiscord | <scipio_nl> But what I know on the other hand is the extreme efforts he puts into making it work. I mean, he's at it for _years on end_ nonstop. At what point does someone consider it good enough? |
12:15:24 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:16:37 | FromDiscord | <Phil> Wording is hard, so is finding good metaphors to base your wording on =/ |
12:17:51 | FromDiscord | <scipio_nl> I am pretty good at that usually, but I still need to grok what it is exactly you're trying to rewrite / solve |
12:18:36 | FromDiscord | <scipio_nl> Good at wording. But what you have here doesn't seem to contain anything poorly worded? |
12:20:18 | FromDiscord | <Phil> I feel like "client" is not a perfect word because it's not fully the client.↵What client does is it generates the necessary code for "butlerPoll".↵One sec I'll make a drawio diagram |
12:30:02 | FromDiscord | <Phil> There, the newer approach https://media.discordapp.net/attachments/371759389889003532/1191357666744877136/app_architecture.png?ex=65a5254a&is=6592b04a&hm=d39e795410f4e9f16c9ef8205fe9087a3e43c3b4ecb93f8fd03a972b8c4a3e44& |
12:30:39 | FromDiscord | <Phil> Butlerpoll is essentially the entirety of the things happening between the two "Your While Loop" blocks |
12:33:27 | FromDiscord | <scipio_nl> At the moment I have no alternative suggestions to refactor the word "client", Phil |
12:34:29 | FromDiscord | <scipio_nl> Something with "`gen_`" as a prefix for a verb perhaps? |
12:35:57 | FromDiscord | <scipio_nl> I like the word "Butler" btw, it explains well what I can expect what it's supposed to do |
12:36:19 | FromDiscord | <Phil> Essentially it defines (for the most part) how to handle responses, so I'm playing around with words in that area |
12:36:37 | FromDiscord | <scipio_nl> offtopic, you'd be surprised how well-paid butlers are, most butlers are multi millionaires |
12:36:41 | FromDiscord | <Phil> Or not really responses, just messages sent by task, TaskMessages, but that's a bad word because it could also be interpreted as "message sent to a task" |
12:36:53 | FromDiscord | <Phil> (edit) "Or not really responses, just messages sent by task, TaskMessages, but that's a bad word because it could also be interpreted as "message sent to a ... task"" added "task", not "message sent from a" |
12:37:44 | FromDiscord | <scipio_nl> In reply to @isofruit "Essentially it defines (for": `master` ? |
12:38:04 | FromDiscord | <scipio_nl> Would resonate with Araq probably 😁 |
12:38:25 | FromDiscord | <Phil> The question there arises what common mental image of a master has to do with receiving messages.↵Like sure, they can, but that is unlikely what you'll be thinking of when you hear that word |
12:38:26 | FromDiscord | <scipio_nl> Gels well with the crown logo |
12:39:02 | FromDiscord | <Phil> That's what I mean by finding metaphors, I'm trying to figure out which one would describe this scenario well so I can use its verbiage |
12:39:32 | FromDiscord | <scipio_nl> `sire` |
12:39:53 | FromDiscord | <scipio_nl> `overlord` |
12:40:47 | FromDiscord | <scipio_nl> `commander` |
12:41:21 | FromDiscord | <Phil> I mean, those all share the same thing. They use a metaphor where one big guy tells other guys what to do and... they report back... hmmmm |
12:41:52 | FromDiscord | <scipio_nl> the "other guy" is the butler] |
12:42:56 | FromDiscord | <Phil> The suggestions chatGPT gives are kinda hilarious |
12:44:09 | FromDiscord | <Phil> https://media.discordapp.net/attachments/371759389889003532/1191361220394090627/message.txt?ex=65a52899&is=6592b399&hm=115619759386114c0397a578ada78f7b6893d4ee9019c1c6b9ab92d532cd44a3& |
12:45:32 | FromDiscord | <Phil> In reply to @scipio_nl "`master` ?": ~~I could make it a git-joke and call that "main"~~ |
12:46:13 | FromDiscord | <scipio_nl> `maestro` |
12:46:54 | FromDiscord | <Phil> I like commander I think, because command is an already well-used word in programming with a specific meaning and I think this is captured here |
12:51:18 | FromDiscord | <Phil> So you have a commander.↵A commander that is only willing to listen to specific kinds of messages (messageTypes), can react (to messages) and give commands |
12:51:35 | FromDiscord | <scipio_nl> Sounds like a plan 🙂 |
12:52:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:52:54 | FromDiscord | <Phil> (edit) |
12:53:02 | FromDiscord | <Phil> (edit) |
12:53:51 | FromDiscord | <scipio_nl> So what you're saying is 2024 will begin with honorable mentions of me in _both_ ThreadButler and Owlettle? 😉↵↵That is quite the accomplishment for somebody still working his way through the intro course 🤣 |
12:54:19 | FromDiscord | <Phil> I swear wording is the one thing that just refuses to get easier even once you know more and more |
12:54:47 | FromDiscord | <Phil> In reply to @scipio_nl "So what you're saying": Off to a good start 😛 |
12:59:57 | FromDiscord | <Phil> In reply to @scipio_nl "So what you're saying": Sidenote, since I assume you'll be logging a ton for your application as is so often the case, do yourself a favour and use chronicles |
13:01:06 | FromDiscord | <scipio_nl> I have no clue what a chronicle is |
13:01:08 | FromDiscord | <Phil> While std/logging seems more standard, chronicles just imo has a superior featureset.↵By which I mean logging with chroncles is guaranteed to not raise exceptions, which is useful for e.g. logging in tasks since it saves you try-catch blocks |
13:01:18 | FromDiscord | <Phil> In reply to @scipio_nl "I have no clue": A logging library from status |
13:01:40 | FromDiscord | <Phil> Its also useful in that it by default shows you the id of the thread that logged a message |
13:02:24 | FromDiscord | <Phil> And the entire model of "static log message followed by the dynamic values/assignments" makes imo for nice logmessages |
13:02:34 | FromDiscord | <Phil> (edit) "values/assignments"" => "values/assignments you want to look at"" |
13:02:45 | FromDiscord | <Phil> (status the company) |
13:02:50 | FromDiscord | <Phil> (edit) "the" => "is a" |
13:04:24 | FromDiscord | <scipio_nl> https://media.discordapp.net/attachments/371759389889003532/1191366315416506398/image.png?ex=65a52d58&is=6592b858&hm=ee5a9b0fb1fabb3bebb9b743815140f9ab9e0d4f2f393cba57e156ab6482dfef& |
13:05:20 | FromDiscord | <scipio_nl> I want my app to do this, and be able to render different timeframes (interval resampling) extremely fast |
13:06:08 | FromDiscord | <scipio_nl> So there will be a lot of number crunching involved, as new data flows in. So it absolutely cannot be blocking |
13:06:53 | FromDiscord | <scipio_nl> It's sad "CryptoWatch" was sacked; probably it worked so great that it was a big cost sink without providing income streams |
13:07:27 | FromDiscord | <scipio_nl> There exist a plethora of JS based alternatives but none come close of the speed / responsiveness. |
13:08:32 | FromDiscord | <scipio_nl> right? |
13:08:34 | FromDiscord | <scipio_nl> https://media.discordapp.net/attachments/371759389889003532/1191367364944597073/image.png?ex=65a52e52&is=6592b952&hm=8c44d171981ae59d3505ad321eaad171968b96c04d7690a6399080d9764228a0& |
13:09:13 | FromDiscord | <scipio_nl> this is now showing the 15min interval, but what if I want to see a 17 minute interval where the start is offsetted at UTC+1 |
13:10:05 | FromDiscord | <scipio_nl> https://media.discordapp.net/attachments/371759389889003532/1191367743321153586/image.png?ex=65a52eac&is=6592b9ac&hm=90204e3cce1f3e4addcf146d2c3e43560b7736c78ff0ad5ab9a2e971fc7abb40& |
13:10:31 | FromDiscord | <scipio_nl> each candle consists of 4 data points (open, low, high, close) which of course is dependent of the interval |
13:10:59 | FromDiscord | <scipio_nl> the speed at which that numbercrunching / visualisation rendering happens, is crucial |
13:48:37 | FromDiscord | <Phil> In reply to @scipio_nl "the speed at which": Hmmm I mean, I personally don't know how to build that sort of thing in Owlkettle, or rather I only have vague ideas, but then again there's a lot of stuff in owlkettle that I haven't used |
14:01:34 | FromDiscord | <bung8954> I also think of this kind of app, btw. where you get free market data? |
14:08:33 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
14:09:38 | FromDiscord | <Phil> The blogpost you mentioned does provide a better framing but basically this just means I'm now stuck |
14:09:40 | FromDiscord | <rakgew> when I see the charts, I would assume ggplotnim might be a nice fit (I quite enjoyed using it). but I only used it for static data viz, whereas in the description above it would be a stream of stead updates.↵idk if ggplonim is a good fit there as well (for steady redraws or partioal updates). |
14:09:52 | FromDiscord | <Phil> (edit) "The blogpost you mentioned does provide a better framing ... but" added "and understanding of the problem domain," |
14:17:34 | * | xet7 quit (Remote host closed the connection) |
14:42:03 | FromDiscord | <bigcatnova> `someArr[1..someArr.high]` is there a better/recommended way to index the rest of the list instead of this? like python has `list[1:]` |
14:59:17 | FromDiscord | <goldenlion5648> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:06:30 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:06:31 | FromDiscord | <Phil> In reply to @goldenlion5648 "is it possible to": Sure, use `template gridIteration(body: untyped)`↵Body is the code block inside of the template |
15:07:53 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:07:54 | FromDiscord | <goldenlion5648> In reply to @rakgew "<@322781433569607681> \: in the": I'm using a table |
15:08:08 | FromDiscord | <Phil> And use it as you described |
15:08:24 | FromDiscord | <Phil> Though more `gridIteration(grid):` |
15:08:28 | FromDiscord | <goldenlion5648> In reply to @isofruit "So you could do": but does that let me access the x and y variables where I use the template? |
15:11:05 | FromDiscord | <goldenlion5648> this complains about x not being defined https://media.discordapp.net/attachments/371759389889003532/1191398196681912420/image.png?ex=65a54b09&is=6592d609&hm=ed1612a62de43593bde6e2cd69f72d64b00bbf8dcff72e39ee9741ce4cb5e58c& |
15:15:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:16:51 | FromDiscord | <Phil> (edit) |
15:17:25 | FromDiscord | <Phil> In this case you feed the template the symbol "myRow" which is put into the compile-Time container "rowVar".↵You do the same for myCol and colVar.↵Then an assignment to that symbol is made using the for-loops inside, this is code-generation in action.↵Lastly the body which is basically the under block indented in loopMe (in this case the echo statement) is placed inside the for loop |
15:19:13 | FromDiscord | <goldenlion5648> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:19:18 | FromDiscord | <Phil> (edit) removed "block" |
15:19:44 | FromDiscord | <Phil> In reply to @goldenlion5648 "thanks! Modified what you": Yes-ish, I would still suggest handing the template the grid to iterate over.↵Right now this is rather fragile and not reuseable for other grids of varying sizes |
15:20:00 | FromDiscord | <Phil> Though if that suffices I guess it's fine |
15:20:12 | FromDiscord | <goldenlion5648> In reply to @isofruit "Yes-ish, I would still": right, this was just a test example |
15:20:30 | FromDiscord | <odexine> In their case the grid is not a nested sequence |
15:21:00 | FromDiscord | <odexine> They’d need to convey the dimensions in some way |
15:21:17 | FromDiscord | <Phil> If it's static, arraygrid! |
15:21:32 | FromDiscord | <Phil> I guess I just don't like magic numbers |
15:40:07 | FromDiscord | <ambient3332> Doesn't seq[seq[int]] kind of fragment memory horribly? I'm personally using seq[int] and then handling indexing with internal strides. Or am I doing pointless work here? As a general rule for things that process a ton of memory. |
15:43:01 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:43:05 | FromDiscord | <ambient3332> Is this a smart thing to do? |
15:43:39 | * | wheatengineer joined #nim |
15:44:23 | * | wheatengineer quit (Remote host closed the connection) |
15:45:34 | * | lucasta quit (Quit: Leaving) |
15:52:32 | FromDiscord | <Phil> Beats me, I'd suggest using readable over smart if it's not performance critical |
15:53:16 | FromDiscord | <Phil> Or outsource the smartness to be a problem to deal with for others by using their packages.↵I prefer my own code to be as dumb as humanly possible and only start being smart when I have to |
15:53:31 | FromDiscord | <levovix> Is there a way to specify backend for certain nim files in Visual Studio Code (for correct autocompletion/errors)? |
15:54:25 | FromDiscord | <Phil> Personally, don't trust nimsuggest errors, the compiler is the only one telling the truth and nimsuggest is only annoying. |
15:54:57 | FromDiscord | <ambient3332> I always ctrl-click from the compiler output to jump into line in the vscode editor. Seems to work |
15:55:48 | FromDiscord | <ambient3332> Also running automatic error messages per line seems to grind to halt when printing long lines, as the regex engine seems to really choke on that |
15:56:30 | FromDiscord | <ambient3332> (problemMatcher": ["$nim"]) in .vscode/tasks.json |
15:56:40 | FromDiscord | <ambient3332> If you want to kill vscode |
15:59:44 | FromDiscord | <ygorko> I have a bit of a theoretical question: why exactly this is not allowed? https://media.discordapp.net/attachments/371759389889003532/1191410436944449696/image.png?ex=65a5566f&is=6592e16f&hm=c5736bd1fcf8547581478370f03fefbf73f1252af5cedacf1432d17626e5cdfd& |
16:00:25 | FromDiscord | <ygorko> Compiler says that "overloaded 'getThing' leads to ambiguous calls", but I don't see why you couldn't infer which "getThing" should be used at the call site. |
16:00:29 | FromDiscord | <ambient3332> Is str reserved word? |
16:01:20 | FromDiscord | <ygorko> it says "type mismatch: got 'string' for 'x.str' but expected 'int'" at the x.str, but I don't think this is relevant |
16:01:49 | FromDiscord | <ygorko> rearranging procs causes x.num to get highlighted https://media.discordapp.net/attachments/371759389889003532/1191410963061149746/image.png?ex=65a556ec&is=6592e1ec&hm=c6790ee5458c07e26074b9a9c4ca893b7c522850771d2ceca24ad323e451d611& |
16:02:14 | FromDiscord | <ambient3332> Both num and str are private but not sure if that's relevant here |
16:02:37 | FromDiscord | <ygorko> it isnt https://media.discordapp.net/attachments/371759389889003532/1191411164584886302/image.png?ex=65a5571c&is=6592e21c&hm=392f526f181e503ca2e16ceb0133f1a17ed35f66df3809f26f3a9a447414745d& |
16:03:19 | FromDiscord | <ambient3332> Maybe the dispatcher can't decide which function to choose |
16:04:16 | FromDiscord | <ygorko> Yeah, and I want to know why 🙂 |
16:04:30 | FromDiscord | <ambient3332> I assume the return type is not part of the function signature |
16:05:06 | FromDiscord | <Phil> In reply to @ambient3332 "I assume the return": Was about to write exactly that.↵Well it is part of the function signature, but not considered during dispatch.↵↵Why that is the case is a matter of implementation of the dispatcher and a question for internals. |
16:05:27 | FromDiscord | <Phil> Reasons I could bring up would be that it's easier to reason if you don't need to take return types into account |
16:05:44 | FromDiscord | <Phil> That kind of dispatch also likely would have rather insanely complex interactions with the various forms of generics there are |
16:06:01 | FromDiscord | <ambient3332> Yeah it becomes recursive it seems |
16:06:24 | FromDiscord | <ygorko> Hmm, can you provide any examples of such complexities? 🤔 |
16:06:26 | FromDiscord | <Phil> So it may make sense to just reduce complexity here and ignore return types, it saves you problems and complexity and is consistent with other languages, making debugging easier |
16:09:23 | * | koltrast quit (Quit: ZNC - http://znc.in) |
16:11:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:12:24 | FromDiscord | <Phil> Keep in mind that the compiler is single pass and that generic are copy-paste blueprints.↵So you need to make sure that the proc gets generated from the generic before you do your logic, yet I wouldn't want to bet my ass that this won't interfere with other types of evaluation |
16:13:48 | FromDiscord | <ygorko> Hmm |
16:13:55 | FromDiscord | <Phil> So the benefit of something that makes code even harder to reason about and is costly to implement seems dubious |
16:14:43 | FromDiscord | <Phil> Given that the nim core team is already not terribly numerous, it seems more sensible to focus on things that provide more obvious benefits and keeping this "normal", aka similar to other languages that also have these limitations |
16:15:06 | FromDiscord | <Phil> That's my own, non-core-dev perspective on the issue that the economy and cost-benefit analysis of such a feature just doesn't make sense |
16:17:52 | FromDiscord | <leorize> it's more or less just not a desirable language feature |
16:18:07 | FromDiscord | <ygorko> Okay, can you explain the difference between generic procs and converters in this case? https://media.discordapp.net/attachments/371759389889003532/1191415065711222815/image.png?ex=65a55abf&is=6592e5bf&hm=e323c3ba0de31d08d50c4097afcd83b5d77e87c02ba5fa1f5c4a7b1200b83521& |
16:18:18 | FromDiscord | <leorize> because nim can dispatch via return type, that mechanism is used by converters |
16:19:05 | * | koltrast joined #nim |
16:29:19 | * | koltrast quit (Quit: ZNC - http://znc.in) |
16:32:19 | * | koltrast joined #nim |
16:34:04 | FromDiscord | <Phil> Sidenote, leorize I'm back at 0 |
16:35:57 | FromDiscord | <Phil> Got a double whammy from mratsim sugegsting pretty much the opposite.↵Instead of ripping out the long-running thread mechanism and having a taskpool that can send messages that the main-thread reads, they were suggesting much rather to rip out the taskpool and keeping the long-running "microservice"-threads, letting the user decide whether they even want one or not.↵↵Meanwhile I'm standing there and going, "... so which part of my proj |
16:36:29 | FromDiscord | <Phil> (edit) "Got" => "sent" | "double whammy from mratsim sugegsting pretty much the opposite.↵Instead of ripping out the long-running thread mechanism and having" => "long message, see <!doctype html> <html lang=en> <head> <meta charset=utf-8> <title> </title> </head> <style> body { font-family: monospace; margin: 2em; } </style> <body> <p>ix.io is taking" | "taskpool that can send messages that the main-thr |
16:36:35 | FromDiscord | <Phil> (edit) |
16:38:06 | FromDiscord | <ygorko> sent a long message, see <!doctype html> |
16:38:19 | * | rockcavera quit (Remote host closed the connection) |
16:38:41 | * | rockcavera joined #nim |
16:38:55 | FromDiscord | <ygorko> Sorry, I don't want to come off as agressive. I'm just really curious as to why. Limiting function signature to just its arguments and not return type seems so arbitrary... 🥴 |
16:41:32 | FromDiscord | <leorize> the answer is to write an app \:p↵(@Phil) |
16:42:13 | FromDiscord | <ambient3332> In reply to @ygorko "Sorry, I don't want": var = getThing(foo).ambiguousA.ambiguousB.warpGate.finallySomethingThatIsAType |
16:42:15 | FromDiscord | <Phil> In reply to @leorize "the answer is to": I can write an app with either. The point was having utility to make a design easier. |
16:43:06 | FromDiscord | <ambient3332> (edit) "In reply to @ygorko "Sorry, I don't want": var ... =" added "bar" |
16:43:58 | FromDiscord | <ambient3332> You can create a horrible job for the parser if you have complex chaing of ambiguous types and the compiler has to play a detective just to dispatch a function |
16:44:05 | FromDiscord | <leorize> actually, I'm not sure what is mratsim suggesting |
16:44:45 | FromDiscord | <leorize> because it seems like the same thing in two different style |
16:47:31 | FromDiscord | <ygorko> In reply to @ambient3332 "var bar = getThing(foo).ambiguousA.ambiguousB.warpG": But how is this different from replacing getThing with a value of convertible type? |
16:47:37 | FromDiscord | <ygorko> Like, this just works https://media.discordapp.net/attachments/371759389889003532/1191422488345841734/image.png?ex=65a561a8&is=6592eca8&hm=5e383bc097be60066485c824f0a4d832b21bf5783b3d8c2086822bcd915c1db9& |
16:48:45 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
16:48:48 | * | FromDiscord quit (Excess Flood) |
16:49:16 | * | FromDiscord joined #nim |
16:52:48 | * | koltrast quit (Quit: ZNC - http://znc.in) |
16:56:48 | * | koltrast joined #nim |
17:03:15 | FromDiscord | <leorize> sent a long message, see <!doctype html> |
17:04:24 | FromDiscord | <leorize> the split they use for DB and networking thread is weird, because there isn't a need to actually run a "thread" to keep track of states needed for a DB connection pool |
17:05:15 | FromDiscord | <leorize> if you view function call as a message, then calling a function on object X is basically sending a message there, no threads required |
17:06:17 | * | silverhikari quit (Quit: Leaving) |
17:06:19 | FromDiscord | <Phil> In reply to @leorize "yep, it's exactly the": But I mean, that is a significant difference.↵One can have an event loop with async support that can take care of a huge bunch of IO simply by virtue of having the async support in a pinned thread. In exchange, that thread can only do whatever you send it in a rather narrow space.↵↵A threadpool is more flexible. Whatever you spawn it can work through, in exchange I don't think threadpools |
17:06:29 | FromDiscord | <Phil> (edit) "In reply to @leorize "yep, it's exactly the": But I mean, that" => "sent a long message, see <!doctype html> <html lang=en> <head> <meta charset=utf-8> <title> </title> </head> <style> body { font-family: monospace; margin: 2em; } </style> <body> <p>ix.io" | "sent a long message, see <!doctype html> <html lang=en> <head> <meta charset=utf-8> <title> </title> </head> <style> bod |
17:07:03 | FromDiscord | <Phil> (edit) |
17:07:43 | FromDiscord | <ygorko> In reply to @leorize "it's subjective, yes. The": It does play well with parameter overloads though! The compiler did exactly what I expected it to do and told me to be more explicit when I tried to do something ambiguous! As for generics... |
17:07:46 | FromDiscord | <ygorko> https://media.discordapp.net/attachments/371759389889003532/1191427558294700043/image.png?ex=65a56661&is=6592f161&hm=8a413aead91fbc39f965df61ea6cc781ee8aeede5d367a69707f57ba9f2e06c5& |
17:08:05 | FromDiscord | <ygorko> https://media.discordapp.net/attachments/371759389889003532/1191427639995551755/image.png?ex=65a56675&is=6592f175&hm=62e357c121733d6e2816362cbcc2e78790236939f8a4c1b59d80f48eed4a8369& |
17:08:13 | FromDiscord | <ygorko> well, that's interesting 🥴 |
17:10:23 | FromDiscord | <leorize> that's because there's no default to fallback into, and the compiler just picked the first one |
17:11:18 | FromDiscord | <leorize> like I said, it's subjective. There's nothing preventing the feature from working from a technical standpoint, it's just that 1\:N mapping of functions to return type is not perceived as very user-friendly |
17:12:28 | FromDiscord | <leorize> typically you see this problem solved by a sum type, because now you keep 1\:1 mapping of one type per expression while having the same features that you would want like automatic narrowing |
17:15:18 | FromDiscord | <leorize> you can also just spawn a thread instead of via a threadpool↵(@Phil) |
17:16:01 | FromDiscord | <leorize> the difference between a thread and using a threadpool is that it's infinitely easier to spawn things using a threadpool |
17:16:09 | FromDiscord | <leorize> and that's a language problem |
17:17:50 | FromDiscord | <leorize> my mantra for this is to do things concurrently when you want to do them concurrently, and model my problem in the "just spawn a thread" sense |
17:20:51 | FromDiscord | <Phil> In reply to @leorize "my mantra for this": basically async for IO and threadpools for concurrent computation? |
17:22:08 | FromDiscord | <leorize> that's how you'd implement it, I suppose |
17:24:50 | FromDiscord | <leorize> looking at mratsim design, it doesn't make much sense to me why there were these services threads\: you're working on a single object, you spawn "threads" to handle your concurrent work. But I don't see why you'd need to do a roundabout with IPC instead of just calling the function |
17:29:40 | FromDiscord | <leorize> or to think of it in simpler terms, you need to justify why `chan.send(DoX)` is better than `x.doX()` or `await x.doX()` for a split to make sense, IMO |
17:33:32 | FromDiscord | <Phil> I mean I agree entirely, that's why "send" stuff requires specific types and you need to define specific handlers for those types etc.↵The overhead is intended so you consciously make the decision to have these takes that they're worth the hassle |
17:34:32 | FromDiscord | <leorize> and I think it's a bad design from the user perspective |
17:34:57 | FromDiscord | <leorize> it's more hassle for you, the programmer, but is it the same for the computer? |
17:37:28 | FromDiscord | <leorize> and even if it is, is it the API maker job to prematurely decide how an user should optimize their code? easy on the programmer but hard on the computer is no less valid, and it opens up a lot more possibilities on the virtue of being simple to use |
17:39:38 | FromDiscord | <ygorko> In reply to @ygorko "": Ok, I have another question: what is the current state of converters? Should I avoid using them in my codebase since they are "already known to not work in many real applications"? |
17:40:23 | FromDiscord | <ygorko> In reply to @ygorko "": And would it make sense to report this as a bug? Because compiler cherry-picking which covnerter to use here doesn't seem user friendly either... |
17:42:14 | FromDiscord | <leorize> just make sure you only use them for trivial conversions so you can rip them out when they become a problem↵(@ygorko) |
17:43:00 | FromDiscord | <leorize> sure but make sure that you searched the issue tracker first since that bug might have already been reported↵(@ygorko) |
17:47:51 | FromDiscord | <leorize> I'll plug the solution I made for "return T or V" here\: https://github.com/alaviss/union |
17:48:40 | FromDiscord | <leorize> i'm pretty sure that it won't be the same to the proposed sum types, though |
17:51:44 | FromDiscord | <ygorko> Thanks. This looks interesting, but its not really what I'm looking for... 😅 |
17:52:57 | FromDiscord | <ygorko> Baz in my example is not a type that represents a union between ints and strings. "num" and "str" are more of a components there. |
17:54:49 | FromDiscord | <ygorko> You see, I'm yet another soul that tries to shoehorn interfaces into Nim. In case of Baz - "num" and "str" are "interface objects" that have their own fields and methods relevant to them. I just thought it would be nice to be able to extract those objects at call sites without knowing their names, or the name of a proc that would return them |
17:55:45 | FromDiscord | <leorize> that sounds like trouble if you have more than one str fields |
17:55:49 | FromDiscord | <Phil> In reply to @leorize "and I think it's": You mean the microservice approach or in general spawning tasks and forcing the user to register message types including procs to handle messages of that kind if they want to send the results back? |
17:55:56 | FromDiscord | <ygorko> I just found this return-type peculiarity when doing this https://media.discordapp.net/attachments/371759389889003532/1191439677794824202/image.png?ex=65a571ab&is=6592fcab&hm=a318563c0a83d4ac65a5689936f41a2f078be6b9b5808c697bb6e713058b9ead& |
17:56:31 | FromDiscord | <leorize> the latter↵(@Phil) |
17:56:42 | FromDiscord | <Phil> I mean then threadButler fundamentally can not provide value |
17:56:48 | FromDiscord | <Phil> Which means basically I drop the package |
17:56:56 | FromDiscord | <ygorko> In reply to @leorize "that sounds like trouble": Yeah, but in case of interfaces I don't think it is. People don't usually implement a certain interface twice in languages that support them, so I don't intend to either |
17:57:25 | FromDiscord | <Phil> Or at least I can not see how it can provide value. Because I don't think there is a decent way to "generalize" this kind of crap with flowvars |
17:58:02 | FromDiscord | <ygorko> In reply to @ygorko "I just found this": I guess I'll have to explicitly name my converters from now on 🤷♂️ |
17:58:22 | FromDiscord | <leorize> I'd say that if it doesn't provide value to you, then you should drop it |
17:59:05 | FromDiscord | <huantian> In reply to @ygorko "I just found this": Huh I thought you could have converters with same name different return |
17:59:15 | FromDiscord | <leorize> suggestions I made are just suggestions. I can be horribly wrong and not see a good usage of your software |
17:59:24 | FromDiscord | <ygorko> In reply to @huantian "Huh I thought you": well, surprise \:D |
17:59:54 | FromDiscord | <Phil (he/him)> No it does most definitely because it enables outsourcing in a way not possible before, but the question is more if I'm developing towards a dead-end or not. |
18:00:20 | FromDiscord | <Phil (he/him)> That is what's so hard to decipher |
18:00:31 | FromDiscord | <leorize> it never hurts to try anyway |
18:01:21 | FromDiscord | <leorize> what's the worst thing that could happen? you learnt valuable lessons on concurrency and get a better appreciation on the design and implementation of these things? |
18:01:41 | FromDiscord | <leorize> idk about you but I see it as an absolute win \:P |
18:02:35 | FromDiscord | <Phil (he/him)> ~~What I get is a foot in the door, no deeper understanding and frustration that nobody provided easy to use implementations~~ |
18:03:12 | FromDiscord | <leorize> you are just missing cps in your design xd |
18:04:43 | FromDiscord | <ieltan> In reply to @leorize "just make sure you": Maybe Nim approach should be like Rust's `From/Into` traits, because I keep hearing `converter` is "bad" (i dont use it so I dunno) |
18:05:11 | FromDiscord | <leorize> it's just that the compiler is bad |
18:05:24 | FromDiscord | <Phil (he/him)> The only reason that converters are bad is because imo implicit code calling is bad |
18:06:04 | FromDiscord | <ieltan> Benefits of the Rust approach would be that converting one type from another would be explicit rather than implicit |
18:06:18 | * | lucasta joined #nim |
18:06:33 | FromDiscord | <leorize> it can still be implicit in many cases, though |
18:06:43 | FromDiscord | <leorize> like for result conversions |
18:07:08 | FromDiscord | <ieltan> In reply to @ieltan "Benefits of the Rust": this would require the standard library to finally embrace `concept` tho |
18:07:41 | FromDiscord | <leorize> concept must work first \:p |
18:08:53 | FromDiscord | <ieltan> In reply to @leorize "like for result conversions": I think you'd still have to call `into`, yes ? |
18:09:13 | FromDiscord | <ieltan> It would indicate that something is going on, at least |
18:09:31 | FromDiscord | <leorize> nope, it's made so that you could `?` your way through |
18:09:51 | FromDiscord | <ieltan> Ah, yeah... forgot `?` could do that too |
18:10:15 | FromDiscord | <ieltan> It's sugar tho |
18:11:51 | FromDiscord | <ieltan> One can choose to not use it if they so desire, in Nim the story is complicated because there is no proper interface to convert types so you use the dreaded converter |
18:12:43 | FromDiscord | <ieltan> or make your own `convert` and call them (which is a valid option imo too) |
18:12:56 | FromDiscord | <ieltan> it's just a shame that it's the story we got |
18:13:21 | FromDiscord | <ygorko> In reply to @ieltan "or make your own": wouldn't that just be a `proc`? |
18:13:26 | FromDiscord | <ieltan> yes |
18:14:59 | FromDiscord | <ieltan> you could also use Nim "normal" type conversions |
18:15:16 | FromDiscord | <ygorko> what are those? |
18:15:52 | FromDiscord | <ieltan> `let myInt: int = 2; echo float(myInt)` |
18:17:14 | FromDiscord | <ieltan> for complex types this doesn't work tmk so you need to call a proper `proc` to convert types: `proc convert(x: ComplexType, y: typedesc[IntoType]): IntoType = ...` |
18:17:33 | FromDiscord | <ygorko> oh, okay |
18:17:58 | FromDiscord | <ygorko> was about to ask "what about complex types" 😄 |
18:18:07 | FromDiscord | <ieltan> yes yes.. lol |
18:25:05 | FromDiscord | <ieltan> In reply to @leorize "you are just missing": By the way, it seems like Araq will adopt CPS for his NIR project, do you know what this means for the cps library or does that change nothing ? |
18:29:47 | FromDiscord | <scipio_nl> @rakgew @Phil well there is https://github.com/can-lehmann/Graphing https://media.discordapp.net/attachments/371759389889003532/1191448198598897764/image.png?ex=65a5799a&is=6593049a&hm=c0f2348508ae06bce5e66c85369d62436fe641b702956a347288616cd28a7729& |
18:32:55 | FromDiscord | <albassort> no desmos in main i dont wnna look at it anymore :( |
18:45:44 | FromDiscord | <leorize> I'll believe it when I see it. Moving CPS into the compiler was the final goal of the team, with the external library used as the testing grounds, so I won't mind if he managed to bring it in.↵(@ieltan) |
18:47:16 | FromDiscord | <leorize> but given that he did not participate in anything CPS for a long time and never directly worked with the dev team, I don't have a lot of hope in the final version |
18:48:24 | * | krux02 joined #nim |
19:06:10 | FromDiscord | <mratsim> In reply to @isofruit "https://forum.nim-lang.org/t/10805 I'm not sure": There is no IO-threadpool in Nim. It's not too hard to upgrade one for it as we have the tasks, flowvars and runtime and closure abstraction done |
19:07:09 | FromDiscord | <Phil> In reply to @mratsim "There is no IO-threadpool": Well, you can still use a "normal" threadpool for IO tasks, it's just bad resource utilization but not impossible, that's what I was getting at |
19:08:31 | FromDiscord | <Phil> And by IO I am really not thinking any deeper than async-IO (in the architecture one thread with many IO operations going on) vs. sync-IO (one thread per IO operation that it waits for synchronously and then sends a channel message back) |
19:10:11 | FromDiscord | <mratsim> sent a long message, see <!doctype html> |
19:11:15 | FromDiscord | <mratsim> In reply to @isofruit "Well, you can still": The issue with CPU vs IO threadpools is fairness |
19:12:17 | FromDiscord | <mratsim> if you want to optimize for latency, first in first out, you need to queue tasks in FIFO at the very least, and add time budget/quota if you want to go farther. That's what you want for a webserver or anything handling users |
19:13:15 | FromDiscord | <Phil> The situation is solely having the goal of dead-simple multithreading with owlkettle in situations where you need state. |
19:13:23 | FromDiscord | <Phil> So desktop GUI multithreading |
19:13:38 | FromDiscord | <mratsim> For compute you want to optimize for latency and memory, meaning you want to work on data hot in cache and also make sure that you process your compute graph (say your tree of spawns) before starting another and have too many tasks pending in parallel. this needs LIFO ordering. |
19:13:50 | FromDiscord | <scipio_nl> In reply to @isofruit "The situation is *solely*": I support this goal |
19:14:12 | FromDiscord | <Phil> (edit) "state." => "stateful threads." |
19:14:15 | FromDiscord | <mratsim> In reply to @isofruit "The situation is *solely*": for this you run a UI thread and a background thread on long-running createThread |
19:14:43 | FromDiscord | <Phil> I mean that's pretty much what I wrote, but with the option of a taskpool for that thread which I can rip out |
19:14:50 | FromDiscord | <Phil> (edit) "wrote," => "implemented," |
19:14:56 | FromDiscord | <mratsim> and you might want a simple threadpool with just locks for blocking on stdin |
19:15:24 | FromDiscord | <mratsim> In reply to @isofruit "I mean that's pretty": I would say, provide it as an example, but give option to users |
19:15:53 | FromDiscord | <mratsim> let's say you make a GUI for LLMs, the threadpool might be mandated by the LLMs runtime |
19:16:06 | FromDiscord | <Phil> In reply to @mratsim "I would say, provide": I would, the main and only reason I went with status/nim-taskpools was that communication of tasks with the thread seamlessly integrated with the communication of long-running thread to long-running thread |
19:16:37 | FromDiscord | <Phil> By which I mean imagine having 2 threads, GUI and backend, these 2 communicate via Channels and only via channels |
19:16:42 | FromDiscord | <mratsim> In reply to @isofruit "I would, the main": I'll have to check how you did that because the tasks are inspired by Weave tasks |
19:17:11 | FromDiscord | <mratsim> and Weave is channel-based, all communication is channel-based |
19:17:28 | FromDiscord | <mratsim> though it's not the correct backend anyway |
19:17:41 | FromDiscord | <Phil> With status nim-taskpools I can basically just hand the task the ChannelHub (a table containing pointers to all channels in the application and each Thread has a Channel) and at the end of the proc that runs on the worker thread say "channelHub.sendMessage(bla)" |
19:18:06 | FromDiscord | <mratsim> Also you might want to check how chronos integrated async with nim-taskpools |
19:18:10 | FromDiscord | <Phil> I failed to get anything like it to work in a manner that didn't require me to await somewhere on my mainthread |
19:18:20 | FromDiscord | <Phil> (edit) "await" => "block" |
19:19:35 | FromDiscord | <mratsim> In reply to @isofruit "I failed to get": it's fine. It's not the proper threadpool for your use-case anyway, but both follow the RFC on task parallelism almost 1-1 (taskpools need a threadpool parameter while Weave is global) |
19:19:48 | FromDiscord | <Phil> hmmmmmmmmm |
19:20:31 | FromDiscord | <mratsim> if you're interested in implementing a high performance fair threadpool for IO I can mentor on that. |
19:20:57 | FromDiscord | <Phil> I mean your advice was solid. It might make sense to not provide support out of the box for spawning taskpools with a thread-microservice.↵Each of these threads come with a "startupEvent" and "shutdownEvent" seq that gets executed before/after the eventloop, so if a user wants a taskpool they can just provide their own in there |
19:21:12 | FromDiscord | <mratsim> yes |
19:21:35 | FromDiscord | <Phil> Basically init one in the startupevents, destroy in the shutdownevents and then do whatever they want in the handler procs of the microservice that gets called when the client-thread sends it a certain message |
19:21:53 | FromDiscord | <mratsim> (have to go) |
19:21:59 | FromDiscord | <Phil> See ya later! |
19:24:51 | FromDiscord | <Phil> In reply to @mratsim "(have to go)": Unrelated sidenote, dear lord is it nicer to work with chronicles on multithreaded stuff rather than std/logging |
19:29:38 | FromDiscord | <ieltan> In reply to @leorize "but given that he": I see 🙂 |
19:45:25 | * | kristjansson joined #nim |
19:56:01 | * | kristjansson quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:58:49 | * | kristjansson joined #nim |
20:08:42 | * | kristjansson quit (Ping timeout: 260 seconds) |
20:16:02 | * | xet7 joined #nim |
20:18:28 | FromDiscord | <pengwyns> It's weird that only x64 bit zip folders of nim for windows get flagged as viruses. |
20:19:05 | FromDiscord | <pengwyns> Actually, all 1.16.x builds have some detections, whilst x32 2.x.x builds don't. |
20:19:52 | FromDiscord | <␀ Array 🇵🇸 🍉> i think its because some malware thats been flagged was written in nim |
20:20:10 | FromDiscord | <␀ Array 🇵🇸 🍉> and win defender just assumes all nim binaries are malware |
20:20:17 | FromDiscord | <␀ Array 🇵🇸 🍉> or something like that idk |
20:22:06 | FromDiscord | <pengwyns> Yeah, maybe. |
20:22:28 | FromDiscord | <demotomohiro> I heard that Antiviruse software flags executable files if their bit patten is similar to known malware.↵Probably Nim malwares are 64bit executables and there are few 32bit executable malwares. |
20:22:36 | Amun-Ra | lucky me, never used window in my entire life |
20:22:52 | FromDiscord | <pengwyns> Could it be flagging nimmain? |
20:22:58 | FromDiscord | <␀ Array 🇵🇸 🍉> yea↵(@demotomohiro) |
20:23:16 | Amun-Ra | as in entry point? if it triggers stripped binaries - no |
20:29:06 | FromDiscord | <demotomohiro> I searched "Nim malware" on twitter and it seems a number of malwares written in Nim is increasing.↵Maybe that caused Nim compiler get flagged. |
20:30:05 | Amun-Ra | there has to be a part of the code that triggers that |
20:33:36 | FromDiscord | <pengwyns> I think they are flagging NimMain in some way, since that is present in nearly all Nim binaries (especially malware, which is shipped quickly and probably not even stripped), either way, I am currently trying to get Nim unblocked by sending Mail. |
20:33:45 | Amun-Ra | how much is ms cert a year again? ;) |
20:35:35 | NimEventer | New thread by VanDerNim: State of fidget, see https://forum.nim-lang.org/t/10829 |
20:38:58 | * | koltrast quit (Ping timeout: 264 seconds) |
20:45:41 | FromDiscord | <pengwyns> roughly 500$ per year |
20:47:56 | FromDiscord | <pengwyns> but sending mail might also convince these AV companies to not block the bit pattern that nearly every Nim program has. And it also free. |
20:48:00 | FromDiscord | <pengwyns> its |
21:06:15 | * | def- quit (Quit: -) |
21:09:16 | * | def- joined #nim |
21:53:45 | FromDiscord | <Langosta> Do yall think nim is a good "beginner" language to learn? Not first language, but for somebody that doesnt have much experience writing code, beyond the basics of computer science? |
21:54:47 | FromDiscord | <graveflo> it's situational, but generally yes |
21:55:00 | FromDiscord | <Phil> Personally yes.↵I learned it when I knew only a bit of webdev in python and some Angular in JS/TS |
21:55:28 | FromDiscord | <Phil> The value you can pull out of nim the way it makes even complex topics accessible is imo immense and something you'll carry with you for every language going forward |
21:55:56 | FromDiscord | <Phil> But all of that is optional. You can engage with those topics. You do not have to |
22:01:19 | FromDiscord | <sOkam! 🫐> In reply to @alendrik "Do yall think nim": +1 to all of the above |
22:11:22 | * | redj joined #nim |
22:30:38 | FromDiscord | <albassort> we're blessed with arraymancer |
22:31:05 | FromDiscord | <albassort> after trying to use tensors in other languages, arraymancer just feels so natural and native |
22:31:29 | FromDiscord | <albassort> to be fair i just tried to implement tensors into LUA |
22:32:14 | FromDiscord | <albassort> but im just so happy to be home whenever i get to use arraymancer over Torch or Numpy |
22:50:29 | FromDiscord | <Phil> Er... leorize? Fundamentally, what is the difference between a Channel and loony? |
22:51:21 | FromDiscord | <Phil> I mean, yeah loony likely is more performant and better at the job, but in the end... both are locked queues? |
22:51:44 | FromDiscord | <Elegantbeef> > MPMC lock-free queue |
22:52:19 | FromDiscord | <Phil> ... both are queues you use for message passing |
22:52:23 | FromDiscord | <Phil> (edit) "passing" => "passing, then" |
22:53:16 | FromDiscord | <leorize> loony is meant for ref movement, where stdlib deep copies |
22:53:42 | FromDiscord | <leorize> though it has been awhile since I looked at stdlib channels |
22:53:50 | FromDiscord | <Phil> Yeah but threading doesn't deep copy either |
22:54:02 | FromDiscord | <Phil> threading/channels Chan |
22:54:53 | FromDiscord | <leorize> one thing for sure though, we run valgrind on loony to hell and back |
22:54:59 | FromDiscord | <leorize> can't say the same for stdlib |
22:56:05 | FromDiscord | <Phil> https://nim-lang.github.io/threading/channels.html#send%2CChan%5BT%5D%2CsinkIsolated%5BT%5D↵Essentially.↵So basically doing an option that provides the same procs for loony-"channels" that I have for threading/channels & co seems easy-ish |
22:56:20 | FromDiscord | <leorize> threading/channels seem to depends on isolate working for safe moves, which from experience it has never worked |
22:56:21 | FromDiscord | <Phil> The explicit exclusion of ORC is a bit of a bummer |
22:57:33 | FromDiscord | <ieltan> > Spawn (Nims threadpool module) is not supported. It won't ever be; don't use spawn unless you are a masochist in general.↵Laughed a little bit 😄 |
22:57:59 | FromDiscord | <leorize> no matter what solution you use, make sure DRD and helgrind passes |
22:58:01 | FromDiscord | <Elegantbeef> Orc does not work with sharing refs across threads 😄 |
22:58:30 | FromDiscord | <leorize> and https://github.com/disruptek/balls will run valgrind on your code automatically, as long as you have it installed |
22:59:07 | * | lucasta quit (Quit: Leaving) |
22:59:26 | FromDiscord | <Phil> ~~It does if you unsafeIsolate~~ |
23:00:29 | FromDiscord | <leorize> nim threading situation right now is what I call\: if it's not verified, it doesn't work |
23:07:53 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
23:08:45 | FromDiscord | <Elegantbeef> Welcome to the Nim parser! |
23:09:19 | FromDiscord | <Phil> Don't want to do this with a macro thouuuuuugh |
23:09:36 | FromDiscord | <Phil> In reply to @Elegantbeef "Welcome to the Nim": Don't welcome me to an area when I haven't even left the last 2 |
23:10:02 | FromDiscord | <Elegantbeef> `(var Channel)` might work |
23:10:22 | FromDiscord | <leorize> or you know, just add a variant that adds `var` \:p |
23:12:24 | FromDiscord | <Phil> ... I'll just force all the procs to return var, including those for Chan which don't need it |
23:12:56 | FromDiscord | <Phil> Luckily that works |
23:17:15 | FromDiscord | <albassort> i wish i had more time |
23:29:11 | FromDiscord | <scipio_nl> Why is this threding situation so hard to solve in Nim? |
23:29:23 | FromDiscord | <scipio_nl> (edit) "threding" => "threading" |
23:29:55 | FromDiscord | <Elegantbeef> Cyclical data types are hard |
23:30:20 | FromDiscord | <exelotl> lol that's a coincidence, I was just about to ask this: |
23:30:24 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:30:25 | FromDiscord | <leorize> nim also resisted threading for quite a long time |
23:30:37 | FromDiscord | <Elegantbeef> `{.cast(gcSafe).}:` |
23:30:46 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:31:20 | FromDiscord | <exelotl> right, I was wondering if that was it - it seems kinda jank that I should have to do use a cast for it though |
23:31:31 | FromDiscord | <exelotl> the compiler should have all the information it needs to see that the access is safe right? |
23:31:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:31:51 | FromDiscord | <leorize> I think guard is barely implemented and haven't been iterated since |
23:32:24 | FromDiscord | <exelotl> hmm, well the actual `foo` does take userdata so I guess I can do it that way... |
23:32:28 | FromDiscord | <Elegantbeef> It should be relatively simple to make it so access of any variables that are locked by the lock are `{.gcsafe.}` but why the hell are you using global stuff to begin with |
23:32:58 | FromDiscord | <Elegantbeef> `MyState` of course should be passed as a `ptr T` |
23:33:10 | FromDiscord | <exelotl> yeh, that'll do it |
23:34:37 | FromDiscord | <Elegantbeef> Back to the other talk, Orc needs to work with reference sharing and ref counts need to use atomics to make it safe to do |
23:35:08 | FromDiscord | <Elegantbeef> Orc presently cannot work across threads and there is `--mm:atomicArc` for Arc |
23:36:04 | FromDiscord | <Elegantbeef> Atomic arc is not default as it can cause massive performance issue on some hardware |
23:38:10 | FromDiscord | <leorize> you can always try nimskull to see how atomic acts with your software |
23:38:17 | FromDiscord | <leorize> nimskull is using atomic everywhere \:p |
23:41:45 | FromDiscord | <Elegantbeef> Even for `bool`?! |
23:45:36 | FromDiscord | <leorize> just put a ref on it |
23:50:31 | FromDiscord | <Phil> TIL we don't have proper equality checks for object variants (?) |
23:51:02 | FromDiscord | <Elegantbeef> Yep |
23:52:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:53:11 | FromDiscord | <Elegantbeef> Should obviously be a `true` at the end |