00:33:25 | FromDiscord | <.bobbbob> another prologue question, is there no way to get the ip address of a request? |
02:09:34 | FromDiscord | <.bobbbob> nevermind, ctx.request.hostName has the ip, I just didnt have proxy_set_header Host $host; in nginx so it was blank |
02:48:56 | * | xet7 joined #nim |
02:54:07 | * | krux02_ quit (Remote host closed the connection) |
03:13:26 | FromDiscord | <zectbumo> Sequels are always the best, Terminator 2, Aliens, Python 2, Nim 2 |
03:14:46 | FromDiscord | <Elegantbeef> C++21 |
03:17:34 | FromDiscord | <zectbumo> are you a new dog every day? and what happened to your beef? |
03:17:49 | FromDiscord | <ElegantBeef> Matrix vs. discord |
03:19:18 | FromDiscord | <zectbumo> I'm always curious about your setup |
03:19:49 | FromDiscord | <zectbumo> dual computer? That's what I'm running now. I just started about 2 weeks ago |
03:20:02 | FromDiscord | <Elegantbeef> Nah just one PC |
03:20:15 | FromDiscord | <Elegantbeef> I just have a good feeling for when the bridge eats shite |
03:20:15 | FromDiscord | <zectbumo> what made you install discord? |
03:21:17 | FromDiscord | <Elegantbeef> I've been using it since it released pretty much cause I was hosting a teamspeak server and was dual booting |
03:23:29 | FromDiscord | <zectbumo> teamspeak always amazed me of their longevity. but I had a talk with an admin once and really no good alternatives if you want to roll your own. |
03:24:16 | FromDiscord | <Elegantbeef> mumble has existed for quite some time |
03:27:09 | FromDiscord | <Elegantbeef> Now we have matrix and we can be merry(especially with the voice rooms being added) |
03:27:21 | FromDiscord | <zectbumo> v1.1 in 2009 |
03:29:44 | FromDiscord | <zectbumo> thunderbird is a matrix client?? |
03:30:20 | FromDiscord | <odexine> It is? |
03:30:34 | FromDiscord | <Elegantbeef> Yea I think it got support a while back |
03:31:07 | FromDiscord | <Elegantbeef> Only as a text client really though |
03:31:38 | FromDiscord | <Elegantbeef> Lacks space and voip support |
03:33:56 | FromDiscord | <zectbumo> spaces is the new voice rooms? |
03:34:10 | FromDiscord | <Elegantbeef> No spaces is matrix's "server" equivlent |
03:34:18 | FromDiscord | <Elegantbeef> It lets you group rooms together for easy management/joining |
03:34:56 | FromDiscord | <Elegantbeef> Though it's not like discord servers cause rooms are still disconnected, it's really 'decentralised servers' |
03:35:28 | FromDiscord | <Elegantbeef> Yardanico is annoyed by rooms cause they do not propagate bans, they're a moderation nuisance 😄 |
03:35:29 | FromDiscord | <zectbumo> is this using XMPP or did that die? |
03:35:42 | FromDiscord | <Elegantbeef> Matrix uses matrix |
03:35:47 | FromDiscord | <Elegantbeef> It's similar to XMPP but not it |
03:35:54 | FromDiscord | <zectbumo> sounds better |
03:36:07 | FromDiscord | <Elegantbeef> Depends if you ask a XMPP fan 😄 |
03:36:40 | FromDiscord | <zectbumo> XMPP was supposed to be the end all of communication protocols. I guess they should have gone JMPP instead. |
03:37:02 | FromDiscord | <Elegantbeef> Yea matrix aims to do the same, but it has terribly low adoption outside FOSS places |
03:37:10 | FromDiscord | <Elegantbeef> It's picked up a bit in governments though |
03:37:11 | * | edr quit (Quit: Leaving) |
03:37:18 | FromDiscord | <Elegantbeef> Since the EU is moving towards open tech |
03:37:46 | FromDiscord | <Elegantbeef> Germany's Military and medical communication systems are using matrix iirc |
03:37:57 | FromDiscord | <zectbumo> that's cool to hear |
06:24:35 | NimEventer | New thread by undefined: Can Nim interact with the hardware at a lower level than the C programming language?, see https://forum.nim-lang.org/t/10757 |
06:40:52 | * | rockcavera quit (Remote host closed the connection) |
07:18:04 | FromDiscord | <.bobbbob> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:18:38 | FromDiscord | <.bobbbob> (edit) |
07:19:13 | FromDiscord | <.bobbbob> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:29:20 | FromDiscord | <nnsee> In reply to @.bobbbob "does anyone know why": how big is wtvr.opus? |
07:29:38 | FromDiscord | <nnsee> chances are it's larger than the pipe buffer limit |
07:29:43 | * | PMunch joined #nim |
07:31:13 | FromDiscord | <.bobbbob> 3.5mb, how can I check and/or change that limit? |
07:32:52 | FromDiscord | <.bobbbob> hm no I dont think it's that because Im doing another command that inputs an image file to an imagemagick command, and it works fine with image file upwards of 8mbs |
07:33:52 | FromDiscord | <nnsee> In reply to @.bobbbob "3.5mb, how can I": the pipe buffer limit is around 64k on most Linux systems |
07:34:41 | FromDiscord | <nnsee> as a test, try setting the ffprobe command to read the file `/dev/stdin` or `/proc/self/fd/0` instead of a pipe |
07:35:55 | FromDiscord | <.bobbbob> nope changing it to /dev/stdin gets the same error |
07:36:20 | FromDiscord | <nnsee> it might be complaining about stdout instead for some reason |
07:36:49 | FromDiscord | <nnsee> i'm not too familiar with the osproc module to be helpful here |
07:39:08 | FromDiscord | <.bobbbob> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:39:28 | FromDiscord | <.bobbbob> (edit) |
07:41:11 | * | advesperacit joined #nim |
07:43:42 | FromDiscord | <.bobbbob> gah if I cant get this to work im gonna have to write a temporary file |
08:02:06 | FromDiscord | <niontrix (Tobias Heinlein)> sent a long message, see <!doctype html> |
08:13:32 | FromDiscord | <Elegantbeef> use `func` instead of proc |
08:18:41 | FromDiscord | <nnsee> In reply to @.bobbbob "gah if I cant": out of curiosity does it break with the pipe error if you only serve eg the first 4K bytes of the file? |
08:26:23 | * | azimut quit (Remote host closed the connection) |
08:26:51 | * | azimut joined #nim |
08:37:36 | FromDiscord | <Phil> Trying to access channels stored in a pointer-table and not triggering a copy somewhere truly is difficulty level impossibru |
08:38:27 | FromDiscord | <zectbumo> @ElegantBeef in the generated nimib writeups the little house and the github cat contain broken links |
08:38:41 | FromDiscord | <odexine> In reply to @isofruit "Trying to access channels": whatcha especially have difficulty with |
08:39:56 | FromDiscord | <odexine> In reply to @isofruit "I mean, that works,": also i realise i never responded to this; you mean the user provides handleRequest and you want routeMessage to work with any declaration of? |
08:46:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:47:09 | FromDiscord | <Phil> Not that making getChannel a proc makes things any better |
08:48:12 | FromDiscord | <zectbumo> it seems like all nimble examples are broken links |
08:48:15 | FromDiscord | <Phil> Maybe I should store ref Channels instead of straight up channels |
08:48:29 | FromDiscord | <odexine> i'd say so too |
08:49:18 | FromDiscord | <zectbumo> https://nimble.directory/pkg/pixie↵for example contains all broken images pointing to an examples folder. other projects same |
08:49:31 | FromDiscord | <Phil> Doesn't solve my problem as I still get wonky pointers though |
08:49:42 | FromDiscord | <Phil> Just that they're not nil anymore but refs to nil |
08:53:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:54:38 | FromDiscord | <odexine> thats... |
08:55:01 | FromDiscord | <odexine> okay i think the problem is in using the global pragma in that sense, at least that would be my guess |
08:56:08 | FromDiscord | <Phil> The problem is without it I open myself up to use-after-frees |
08:56:35 | FromDiscord | <Phil> And get "IllegalOperation" runtime SIGILLs which I assume is a meaner variation of Segfault |
08:57:29 | FromDiscord | <odexine> yes and thats why you use a direct pointer w/ manual alloc instead of fucking around with global xd |
08:57:55 | FromDiscord | <odexine> i'm not too familiar with the semantics of a C local-static variable (which is what {.global.} produces) |
08:58:49 | FromDiscord | <Phil> So basically I now need to figure out which of the around 50 alloc named procs to call, back to research I gues |
08:59:47 | FromDiscord | <odexine> use createShared |
09:00:13 | FromDiscord | <odexine> one moment im looking at the cgen to see what it really actually generates |
09:01:15 | NimEventer | New thread by aiac: Undeclared identifier error when using string format in template, see https://forum.nim-lang.org/t/10758 |
09:01:59 | FromDiscord | <odexine> okay i see |
09:02:09 | FromDiscord | <odexine> since its a generic it "works" |
09:02:13 | FromDiscord | <odexine> or rather should |
09:03:14 | FromDiscord | <odexine> oh of course in add channel you dont actually make any damn channels @Phil |
09:03:31 | FromDiscord | <odexine> you dont open them |
09:04:09 | FromDiscord | <odexine> yeah |
09:04:18 | FromDiscord | <odexine> literally just `channel.open()` in addchannel fixes everything |
09:04:35 | FromDiscord | <odexine> funny |
09:05:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:05:22 | FromDiscord | <odexine> no, i mean with the non-ref code |
09:05:38 | FromDiscord | <odexine> In reply to @isofruit "This doesn't reflect my": this + channel.open() |
09:06:07 | FromDiscord | <Phil> Now that just returns me nil pointers from the template there |
09:06:12 | FromDiscord | <odexine> i think the ref-in-a-pointer is a bit dangerous as i dont know if the GC would act well with it |
09:06:31 | FromDiscord | <Phil> Or at least the "got" echo's just echo out 0 |
09:06:39 | FromDiscord | <odexine> yeah weird |
09:07:15 | FromDiscord | <odexine> dont return var Channel but ptr Channel |
09:07:37 | FromDiscord | <odexine> i'm yet again unfamiliar with the semantics of returning var xd |
09:09:56 | FromDiscord | <Phil> Hmm it works if I do a dedicated assignment to a var variable |
09:10:01 | FromDiscord | <Phil> So I'll save myself the ptr there |
09:10:13 | FromDiscord | <Phil> Well, it sends correctly at least, still not reading |
09:10:39 | FromDiscord | <odexine> In reply to @isofruit "Hmm it works if": what |
09:12:06 | FromDiscord | <Phil> Oh for the.... no its making a fucking copy again |
09:12:20 | FromDiscord | <Phil> it just doesn't segfault, but the addr of the channel is different |
09:12:34 | FromDiscord | <odexine> of course it is |
09:14:08 | FromDiscord | <odexine> since you assigned it to another variable thats where the copy happens so |
09:14:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:14:32 | FromDiscord | <Phil> Just not in the setup I'm using it in somehow |
09:18:29 | FromDiscord | <Phil> Even works if getChannel is a proc so it lending out a ref here seems to work in this getup... but man I give up, new pointer approach then ugh |
09:18:48 | FromDiscord | <Phil> In reply to @odexine "dont return var Channel": Well I must have a var channel for trySend |
09:18:50 | FromDiscord | <odexine> ok stop here |
09:19:03 | FromDiscord | <odexine> its hard to start explaining when you're going way faster than i am |
09:20:03 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:21:04 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:21:12 | FromDiscord | <Phil> I was about to claim incorrectness but no, the address is different, they last 2 digits differ and I missed that >_> |
09:22:06 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:22:18 | FromDiscord | <odexine> notable change is last line of getCh |
09:22:41 | FromDiscord | <odexine> otherwise the template signature is unchanged (returns var Channel) |
09:23:34 | FromDiscord | <Phil> So nim can just "reinterpret" `ptr Channel[Msg]` as `var Channel[Msg]`? |
09:23:38 | FromDiscord | <odexine> no |
09:23:48 | FromDiscord | <odexine> see end of that line, i dereference with `[]` |
09:23:55 | FromDiscord | <Elegantbeef> Why is `getChannel` a template? 😄 |
09:24:08 | FromDiscord | <Elegantbeef> Ah nvm this is phils stuff |
09:24:11 | FromDiscord | <odexine> yes thats true, in this case you can go back to using `func` |
09:24:24 | FromDiscord | <Phil> this is like attempt number 50 and I was getting annoyed with proc approaches not working at all |
09:24:57 | FromDiscord | <odexine> ive been particularly slow with code recently xd i bet me from a few months ago would be quicker with realising this xd |
09:41:23 | PMunch | Hmm, anyone know of a small multi-header C library meant to be compiled directly into your program |
09:41:45 | PMunch | The kind of thing which would be wrapped with {.compile.} pragmas |
09:42:17 | FromDiscord | <Elegantbeef> wasm3 is pretty small and can be compiled easily |
09:42:31 | PMunch | Ooh, that might work well |
09:42:52 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim refer to my Nim file 😄 |
09:58:02 | FromDiscord | <Clonkk> With destructor based var T being moved out, howwould you implement a destructor for an object containing a socket seeing as the object cannot be modifed & close / disconnect operation would likely raise an exception (and exception in destructor is less than ideal) ? |
09:58:07 | FromDiscord | <Clonkk> I'm curious what people think |
09:59:58 | FromDiscord | <Phil> Is there a way to have a readLine() call in a while-loop and it not block? More like "feed it in a stream and if a value is there work with it"... I'm describing async or just a queue in a separate thread again aren't I... |
10:01:26 | FromDiscord | <Clonkk> You could open a Stream on stdin and use peek maybe ?↵(@Phil) |
10:02:56 | FromDiscord | <niontrix (Tobias Heinlein)> I tried that already, but unfortunately this produces the same error, because the compiler tells me that hash can have side effects. |
10:04:32 | FromDiscord | <niontrix (Tobias Heinlein)> Uh, ok. Strange. It compiles, but nimsuggest gives me the error message I wrote before |
10:04:59 | FromDiscord | <niontrix (Tobias Heinlein)> Maybe I need a newer version of nimsuggest? |
10:08:22 | FromDiscord | <nnsee> nimsuggest a shit sometimes |
10:09:12 | FromDiscord | <niontrix (Tobias Heinlein)> is there something better? |
10:11:31 | FromDiscord | <nnsee> well, nimlangserver exists, but under the hood it's still using the nimsuggest internals iirc |
10:12:14 | FromDiscord | <niontrix (Tobias Heinlein)> that's what i thought, too |
10:13:18 | FromDiscord | <niontrix (Tobias Heinlein)> but turning the procs into funcs worked. so, thanks for the help Elegantbeef ! |
10:20:35 | FromDiscord | <odexine> In reply to @Clonkk "You could open a": I believe peek still blocks on lack of data as it’s essentially a read + set position |
10:20:56 | FromDiscord | <odexine> Plus I don’t think set position works on standard input |
10:21:05 | FromDiscord | <nnsee> it doesn't |
10:21:42 | FromDiscord | <odexine> Portable non blocking standard input is only possible using threading, otherwise if you don’t care about windows I believe it’s been done before |
10:22:21 | FromDiscord | <odexine> I mean that there’s code out there that achieves async io for Unixes, I don’t know where probably that one async tools repo |
10:23:58 | FromDiscord | <nnsee> https://web.archive.org/web/20170407122137/http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/ |
10:24:01 | FromDiscord | <nnsee> C, though |
10:24:07 | FromDiscord | <nnsee> should be pretty easily portable |
10:25:11 | FromDiscord | <nnsee> oh wait, you probably aren't operating in a tty? |
10:25:47 | FromDiscord | <odexine> No clue, this is Phil’s problem |
10:26:25 | FromDiscord | <nnsee> yeah I meant Phil |
10:27:09 | FromDiscord | <Phil> In reply to @nnsee "oh wait, you probably": Just normal terminal, this is an example application.↵I'm just vexxed that I can't process messages on the side while waiting for user input, that makes me examples slightly less nice. |
10:28:19 | FromDiscord | <TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:28:54 | FromDiscord | <TӨMΛ ☠> (edit) |
10:30:39 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
10:31:27 | FromDiscord | <Phil> Which is of course not good proper code, but makes the output printed to the terminal by the example more sensible |
10:32:01 | FromDiscord | <Phil> In an actual application I'd start to go hunting for some async input stuff but for an example to show-case threadButler I won't bother |
10:35:41 | FromDiscord | <Phil> The amount of unholy stuff in this package is sth I'm not sure how to feel about.↵Like, not sure if that's just the problem domain being oof or whether the approach was bad.↵Like, maybe one with inheritance and methods would've been easier.↵Give channel the root object for sending, then you inherit from that root object, implement a method as "handler"to execute on the other thread or sth |
10:35:54 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:36:06 | FromDiscord | <Phil> (edit) "The amount of unholy stuff in this package" => "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" | "sth I'm not sure how to feel about.↵Like, not sure if that's just the problem domain being oof or whether the approach was bad.↵Like, maybe one with inherita |
10:37:41 | FromDiscord | <odexine> In reply to @isofruit "The amount of unholy": What problems did you have with macro cache again? |
10:38:54 | FromDiscord | <Phil> That there's no CacheTable[CacheSeq].↵I solve that by storing an nnkStmtList in CacheTable and using that like a list |
10:41:39 | FromDiscord | <odexine> i mean the core issue; what reason did you need a table of seqs for? |
10:43:56 | FromDiscord | <Phil> I want users to be able to register types over various separate files and group them with a static string name.↵Once I have all of them I want to generate an enum and object variant per name provided, basically each name gets an object variant that can encompass all types that were registered for that name |
10:45:05 | FromDiscord | <odexine> so this is unrelated to why you think inheritance would be better okay |
10:45:29 | FromDiscord | <odexine> i dont know how inheritance would behave over multithreading |
10:45:34 | FromDiscord | <Phil> Not quite, the (not really thought out) idea was that maybe I could replace the object variant with an object via inheritance |
10:46:05 | FromDiscord | <Phil> The only reason I need the object variant so far is because channels need a concrete type for their instantiation |
10:46:35 | FromDiscord | <Phil> I could achieve the same by doing `Channel[RootMsg]` and all messages then subclass from `RootMsg` with RootMsg being some ref type |
10:48:04 | FromDiscord | <Phil> Once transported to the other channel the channel would then call its `handleEvent()` method, possibly with extra parameters added in by the thread itself (e.g. with AppState on a thread with owlkettle running on it, or a db connection in the backend thread, depends, that's flexible) |
10:56:48 | FromDiscord | <odexine> that would probably work but what's the issue with object variants? |
10:56:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:56:57 | FromDiscord | <odexine> im not really familiar with what youre doing really |
10:57:31 | FromDiscord | <odexine> In reply to @isofruit "I may just need": yet again "why is this a template" |
10:58:29 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
10:59:13 | FromDiscord | <Phil> In reply to @odexine "yet again "why is": Because there's no way in hell procs have even a chance of achieving this since this is code-generation stuff, so I won't even bother trying.↵This is trying to treat types like sth you could put into an iterable, which is just not possible. |
10:59:39 | FromDiscord | <Phil> And it was also just to communicate what I'm roughly after, chances are I'll need to express sth like this as a macro |
10:59:51 | FromDiscord | <odexine> would a compile time proc be unable to do this? |
11:00:29 | FromDiscord | <Phil> Yes because the fundamentals of it already don't work.↵Not unless you are in macro-land and acting on NimNode, in which case this would be just a helper-proc to be called by a macro |
11:00:55 | FromDiscord | <Phil> The very definition of the proc requires you to be able to have a `varargs[typedesc]`and that's just not happening |
11:04:34 | FromDiscord | <Phil> I mean, I'll have to first implement an equivalent with inheritance but I'm starting to appreciate where the ability to have dynamic dispatch comes in quite handy.↵Not having it means you need a whole lot of code generation facilities - the question just becomes then what's easier to deal with, the code generation that will not let you compile anything if its wrong, or the inheritance that may blow up in your face at runtime |
11:05:36 | FromDiscord | <odexine> `varargs[typedesc]` in explicit form is `varargs[typedesc[T]]` where T is the type the typedesc describes, so i cant imagine it ever working period regardless of proc, template, macro, no? at least to my understanding |
11:06:58 | FromDiscord | <Phil> The idea is more that I need a list of types. In macros I could have those in the shape of the user defining a list of NimNodes which are identNodes of the type |
11:06:59 | FromDiscord | <Phil> (edit) "type" => "types" |
11:07:04 | FromDiscord | <odexine> you would need a `varargs[untyped]` so yes indeed it is limited to macros/templates in such case, or a `varargs[NimNode]` where procs would work yes but then it would be a pain to use |
11:07:57 | FromDiscord | <odexine> okay so i took you literally okay |
11:09:22 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:41:44 | FromDiscord | <Phil> Err... how do I kill a thread created via "createThread" ?↵I have the thread instance, but terminateThread is in a private package and that doesn't feel like I should be importing that |
12:42:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:42:49 | FromDiscord | <Phil> (edit) |
12:53:04 | FromDiscord | <Phil> Hmm there appear to just straight up not be any utilities for killing threads that you should be using, just joinThread.↵Seems like I may have to provide a mechanism to kill the loop a thread is in myself |
13:01:24 | advesperacit | sending a value through a channel is a common way to stop threads, tryRecv in a the main loop for example |
13:03:11 | FromDiscord | <Phil> That one I already do to listen for messages in general.↵What I'll likely do is add a "Kill"-Variant to all my object variants that I send through channels.↵When a message is of the "Kill"-Variant it raises a "KillError" which breaks the main-loop↵Just need to add that to all the code-generation pieces |
13:03:29 | FromDiscord | <Phil> (edit) "breaks" => "is caught and triggers a break of" |
13:03:40 | FromDiscord | <Phil> (edit) "main-loop↵Just" => "thread's while-loop↵Just" |
13:12:35 | * | edr joined #nim |
13:15:41 | FromDiscord | <spotlightkid> The type you send through the channel could be a tuple `(should_exit: bool, value: T)` or an `Option` or `T` could have "sentinel" value, which signals exiting the loop. |
13:17:25 | FromDiscord | <Phil> In reply to @spotlightkid "The type you send": That implies that any message can kill the loop, when imo it makes more sense to just regard "killing the loop" as its own kind of message |
13:20:26 | FromDiscord | <odexine> it depens on how you look at it |
13:20:50 | FromDiscord | <odexine> are there scenarios where you want to kill the thread without also sending a "real" message to it beforehand? |
13:21:33 | Amun-Ra | hmm, is there a way nimble/nim doc not to include "src/" in title? |
13:23:34 | FromDiscord | <Phil> In reply to @odexine "are there scenarios where": Yes, when the client gets killed all its servers also need to die |
13:23:59 | FromDiscord | <Phil> That is true for any scenario this would be used in because it's for applications, so you automatically always have a client and a server |
13:24:00 | FromDiscord | <Phil> at least one server |
13:24:24 | FromDiscord | <Phil> The client may be a CLI, or a GUI like owlkettle or whatnot, but it will exist and without it the threads are pointless |
13:24:57 | FromDiscord | <Phil> (edit) "The client may be a CLI, or a GUI like owlkettle or whatnot, but it will exist and without it the ... threadspointless," added "server" | "pointless" => "pointless, thus they need to die and trigger their shutdown events" |
13:27:31 | FromDiscord | <spotlightkid> > That implies that any message can kill the loop, when imo it makes more sense to just regard "killing the loop" as its own kind of message↵Like I said, use an `Option`. Then `some(msg)` meanss a "real" message and `empty(msg)` means "exit loop". |
13:30:30 | FromDiscord | <Phil> Note that `msg` is an object-variant that I generate on-the-fly that can be any of N kinds of messages.↵Might as well add a "killkind" to that |
13:30:46 | FromDiscord | <Phil> That's imo a more correct way to express that. |
13:31:14 | FromDiscord | <Phil> (edit) "that." => "that as it more accurately portrays what I want and how I view the shutdown process." |
13:35:01 | FromDiscord | <spotlightkid> If you have several different kinds of messages anyway, which are sent over one channel, yes, that seems a reasonable approach. |
13:36:47 | FromDiscord | <Phil> In reply to @spotlightkid "If you have several": That's pretty much what I'm building.↵You specify a bunch of types that should be sendable to a specific thread, I generate you the channel to send to that thread, the object variant necessary, a couple utility procs to convert your types into the object variant and send them and a routing proc for the thread to unpack the object variant |
13:37:32 | FromDiscord | <Phil> Given that I already generate craptons of code for type-safe, static-dispatch message sending, might as well |
13:37:39 | FromDiscord | <Phil> add kill messages |
13:52:28 | FromDiscord | <graveflo> yea that is pretty much the standard way of managing threads. Make a msg queue and when the main thread is shutting down ask each for a graceful exit and join them. There are fancier things you can put on top of that ofc but that's the idea |
13:53:13 | FromDiscord | <Phil> Now to figure out why my codegen shows me that the code gets generated, but somehow it's not available when I try to call it from a template |
13:54:40 | FromDiscord | <Phil> Oh FFS, the entire "you forgot to generate the proc in a mode that exports it" has caught me like 4 times today alone already |
13:54:55 | FromDiscord | <Phil> It's the silly little things 🤣 |
13:56:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:56:52 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:04:55 | * | azimut quit (Ping timeout: 240 seconds) |
14:07:13 | * | azimut joined #nim |
14:10:26 | FromDiscord | <graveflo> that is really weird. Is `sendKillMessage` generated with a template or macro? |
14:13:31 | FromDiscord | <graveflo> try `Msg.T` ? |
14:20:16 | FromDiscord | <Phil> It is generated via macro indeed, but it should've been generated like 50 lines or so before this runs in global scope |
14:21:51 | FromDiscord | <Phil> But yeah, `Msg.type()` did it |
14:21:57 | FromDiscord | <graveflo> well it does appear to be there. It's just saying that the second input is not a `typedesc` |
14:22:00 | FromDiscord | <Phil> T was not doable because that's not a known identifier |
14:22:32 | FromDiscord | <graveflo> ah good to know. I think `T` works with generic type variable parameters |
14:24:07 | FromDiscord | <Phil> And yep that did it |
14:24:19 | FromDiscord | <Phil> HAH! It's kinda funny to see the data-race to print to the terminal |
14:27:04 | FromDiscord | <Phil> I kinda wish I could associate a thread name with a threadId, but threadName is a construct from myself that goes away at compiletime |
14:27:20 | FromDiscord | <Phil> And I can't think of a non-hacky way to do the association properly |
15:11:18 | * | PMunch quit (Quit: Leaving) |
15:38:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:40:03 | FromDiscord | <Phil> (edit) |
15:42:57 | FromDiscord | <Phil> It's somewhat meh that you have 3 separate blocks (block to call `generateSetupCode()`, block to call `generateRouters()`, block to set-up a server and run it via `withServer`) but I think it's not in the cards to really make that simpler |
16:31:50 | FromDiscord | <crembo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:31:55 | FromDiscord | <crembo> (edit) |
16:33:16 | FromDiscord | <crembo> (edit) |
17:00:06 | FromDiscord | <graveflo> is the "wrong" answer one of the right `answer`s from the loop? |
17:21:36 | * | rockcavera joined #nim |
17:28:59 | FromDiscord | <crembo> sorry I worded the confusingly, I expect `rez` to end up with a certain value (which I know now), but it doesn't. I haven't checked if every individual `answer` is is correct (I actually don't know that - it's like 100k answers I'd need to check 😅 ) |
17:35:07 | FromDiscord | <graveflo> move the for loop out of `parallel` ? |
17:35:26 | FromDiscord | <graveflo> idk if nim automatically manages the threadpool size but that could be it |
17:36:16 | FromDiscord | <graveflo> nah that's not it |
17:36:29 | FromDiscord | <Phil> Hmm how do I link specifically to another module file in doc comments? Trying to read through the docs and I don't get it |
17:39:05 | FromDiscord | <alwaysoutofrange> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:39:39 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:40:12 | FromDiscord | <crembo> does it work if you it's 1_000_000 instead of 100? 😅 |
17:40:18 | FromDiscord | <crembo> (edit) "if" => "for" |
17:40:35 | FromDiscord | <crembo> (edit) "does it work for you it's 1_000_000 instead of 100? 😅 ... " added "and I'm using nim 2" |
17:42:35 | FromDiscord | <nasuray> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:42:38 | FromDiscord | <graveflo> In reply to @crembo "does it work for": hmm no |
17:43:55 | FromDiscord | <crembo> In reply to @graveflo "hmm no": fair enough, well no worries! I guess it's a limitation of spawn and parallel! |
17:47:36 | FromDiscord | <Phil> In reply to @alwaysoutofrange "Hello everyone, Ive got": Wait, how are you calling this?↵I'd like to play around with this and your minimal example doesn't run the read_input proc.↵If I do run it, then should I just copy paste the echo text you provide here into the terminal? |
17:48:10 | FromDiscord | <alwaysoutofrange> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:48:24 | FromDiscord | <alwaysoutofrange> i can also make a little video if is helps |
17:49:26 | FromDiscord | <alwaysoutofrange> https://media.discordapp.net/attachments/371759389889003532/1184190290760843284/simplescreenrecorder-2023-12-12_18.48.59.mp4?ex=658b1226&is=65789d26&hm=8efaf6a4c3af5e0e71568d0d84a7173d349d51b6b5ce2257b0f7f22b92c243c6& |
17:49:31 | FromDiscord | <Phil> Now tell me how exactly you enter your string into the binary.↵Do you run a bash command and pipe it in?↵Do you copy paste the line with echo? |
17:50:01 | FromDiscord | <graveflo> In reply to @alwaysoutofrange "Hello everyone, Ive got": I'm not sure what you are talking about, but if you are trying to paste a multi line string as an argument to a program in a terminal that behavior is terminal specific |
17:53:52 | FromDiscord | <graveflo> In reply to @alwaysoutofrange "": looks like the new line character is being interpreted as enter and the rest of the text is probably getting flushed from the buffer? |
17:54:15 | FromDiscord | <alwaysoutofrange> thats a good point didnt think about it |
17:54:22 | FromDiscord | <Phil> Note: Have you considered that your line ` if not line.endsWith("\\"): break` will not assign `con` to buffer and thus you lose all that input? |
17:55:16 | FromDiscord | <Phil> That break statement breaks both loops it seems |
17:56:00 | FromDiscord | <Phil> At least during my playing around with it |
18:00:43 | FromDiscord | <alwaysoutofrange> there is definitely a text loss |
18:02:05 | FromDiscord | <Phil> ... hmm, adding module links seems kind of a mystery |
18:11:52 | NimEventer | New thread by Isofruit: How to write a doc-comment-link to another module?, see https://forum.nim-lang.org/t/10760 |
18:13:24 | Amun-Ra | Isofruit: `some module name <https://mod.url/modfile.html#procname,args>`_ |
18:14:34 | FromDiscord | <Phil> That's me - That's basically just HTML hard-linking, if ever anything changes then the link breaks |
18:14:46 | Amun-Ra | right |
18:14:54 | FromDiscord | <Phil> That's why I'm not a too massive fan of that option, additionally the docgen tool can't warn me that the link is broken |
18:15:04 | Amun-Ra | well, I'd change https:// to // |
18:15:38 | FromDiscord | <Phil> Wouldn't that still try to call for the docs over a url even when local? |
18:15:49 | Amun-Ra | I have a few doc patches |
18:15:57 | Amun-Ra | yes |
18:16:10 | Amun-Ra | but he wants to link to external module |
18:16:18 | Amun-Ra | ergo - you have to know the path before |
18:16:35 | FromDiscord | <Phil> Nah I mean, I am isofruit, that's my account 😄 |
18:16:56 | Amun-Ra | oh :P |
18:17:30 | Amun-Ra | I knew isofruit was here somewhere… :P |
18:17:44 | Amun-Ra | this is what I use to generate documentation: https://dpaste.com/4GKFSKEFN |
18:17:50 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
18:19:49 | Amun-Ra | there's something wrong with discord gate, all I saw was: "Phil | sent a long message, see <!doctype html>" |
18:20:20 | FromDiscord | <Phil> https://media.discordapp.net/attachments/371759389889003532/1184198064685199561/image.png?ex=658b1963&is=6578a463&hm=3045083095a6590c56cd652bafad3667d89c36f563911b82c5bd3db31c3edd63& |
18:20:54 | Amun-Ra | use </url/file.html> |
18:21:32 | FromDiscord | <Phil> so... </threadbutler/integrations/owlbutler.html> ? |
18:21:38 | Amun-Ra | yes |
18:24:05 | FromDiscord | <Phil> iiiiiiii'm going to md links, old reliable: ` [owlCodegen](./threadButler/integrations/owlButler.html)` |
18:26:22 | Amun-Ra | owlbutler? interesting name |
18:27:24 | FromDiscord | <alwaysoutofrange> In reply to @alwaysoutofrange "Hello everyone, Ive got": fixed my code more or less i mean i cant paste the entire thing at once but this is a problem for it self |
18:27:36 | FromDiscord | <Phil> The general package is ThreadButler, I just provide utilities for easier integration with other frameworks |
18:27:46 | FromDiscord | <Phil> By which I mean exactly owlkettle and nothing else, but adding more shouldn't be too hard |
18:28:06 | Amun-Ra | ah |
18:28:09 | FromDiscord | <Phil> The package is designed to be easily extensible for whatever stuff you need |
18:28:39 | FromDiscord | <graveflo> In reply to @alwaysoutofrange "there is definitely a": piping the data seems to work for me. That is a saner way of doing it anyway |
18:28:50 | FromDiscord | <Phil> And you can use it on its own as well as shown in one of the examples |
18:31:41 | FromDiscord | <alwaysoutofrange> In reply to @graveflo "piping the data seems": i dont know if you can call it piping what im doing i think its a direct read from the stdin |
18:32:43 | FromDiscord | <graveflo> like `echo "something" | nim r something.nim` or `cat something.txt | nim r something.nim` |
18:33:23 | Amun-Ra | nim r something.nim < something.txt |
18:34:01 | FromDiscord | <graveflo> yea thats a redirect. should work too |
18:35:28 | FromDiscord | <alwaysoutofrange> In reply to @graveflo "like `echo "something" |": no im not doing something like this |
18:36:16 | FromDiscord | <alwaysoutofrange> but i think i found the problem im using readLineFromStdin i think i should use a filestream or something |
18:36:59 | FromDiscord | <graveflo> yea but what I'm saying is that you could. I'm not exactly sure why copy / paste isn't working for this but there is more at play when you do it that way. Going from the clipboard -> terminal program -> tty has more variables that are out of your control |
18:37:53 | FromDiscord | <graveflo> yea you can look at the stream closelier and find out what is actually going on in the buffer. I have a feeling that you can get it to work and if that's the case then maybe the std library could use a little patching |
18:38:31 | * | azimut quit (Ping timeout: 240 seconds) |
18:40:11 | Amun-Ra | hmm, can I have multiple licenses in nimble? |
18:44:12 | FromDiscord | <alwaysoutofrange> In reply to @graveflo "yea you can look": the buffer is right its my fault i didnt read the docs it says that readLineFromStdin reads only 1 line |
18:45:34 | FromDiscord | <graveflo> but of course it does xD. The issue is that the other information that you are supposedly pasting in should still be in the stdin buffer. There's no reason for that to disappear |
18:45:41 | * | PMunch joined #nim |
18:47:15 | PMunch | AoC day 12 stream live now! https://twitch.tv/pmunche https://www.youtube.com/watch?v=uVUtlqxwWTs |
18:48:11 | FromDiscord | <systemonia> Amun-Ra: It depends on if both licenses should apply or if the user can choose one or the other. But try adding your license + "AND" + your second license if you want both licences to apply, or try adding your license + "OR" + and your second license. |
18:48:44 | FromDiscord | <systemonia> So if you wanted to license a software under MIT or BSD-3-Clause you'd use "MIT OR BSD-3-Clause" |
18:49:01 | Amun-Ra | I was wondering whether nimble accepts SPDX-like syntax |
18:49:06 | FromDiscord | <systemonia> That is how the spdx standard specifies it, but im not sure if nimble actually detects multiple licenses. |
18:50:03 | Amun-Ra | nimble check doesn't mind license = "MIT OR NCSA" |
18:51:58 | FromDiscord | <systemonia> nimble.directory does some checking at the very least, https://nimble.directory/pkg/gmp |
18:53:00 | Amun-Ra | hmm, thanks |
18:53:08 | FromDiscord | <systemonia> no problem |
18:57:00 | FromDiscord | <nasuray> In reply to @pengwyns "nimble.directory does *some* checking": checking how? isn't it just displaying what's in the "license" field in the `packages.json`? |
18:57:37 | FromDiscord | <systemonia> If it did that only then the "or" would be capitalized. |
18:57:48 | FromDiscord | <systemonia> Wait no |
18:57:49 | NimEventer | New question by Antoine Delègue: Nim program crashes when using recursivity and openarray, see https://stackoverflow.com/questions/77648448/nim-program-crashes-when-using-recursivity-and-openarray |
18:58:37 | FromDiscord | <systemonia> Never mind, the package itself has "or" lowercase. |
18:58:51 | FromDiscord | <systemonia> You were right |
18:59:01 | FromDiscord | <alwaysoutofrange> In reply to @graveflo "but of course it": i tested for a bit and it seems the stdin is only the first line of my sample input anything after that does not exists |
19:26:38 | FromDiscord | <piqueiras> Are iterators the only way of accessing set elements? |
19:28:11 | * | PMunch quit (Quit: leaving) |
19:29:11 | FromDiscord | <graveflo> typically sets are unordered so what other way would there be? |
19:30:20 | FromDiscord | <piqueiras> What if I knew a set had a single element |
19:33:48 | FromDiscord | <graveflo> good point, I don't think there is a way unless you want to couple to nims specific set implementation and access the private fields: https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/collections/sets.nim#L64↵otherwise you can `pop` but that will remove it |
19:34:16 | FromDiscord | <piqueiras> oh that exists? |
19:34:58 | FromDiscord | <piqueiras> which one does it return if it had more tho lmao |
19:36:32 | FromDiscord | <graveflo> an "arbitrary" one |
19:36:58 | FromDiscord | <piqueiras> where is pop defined.. |
19:37:11 | FromDiscord | <graveflo> you could also hold on to the elements key and use `[]` maybe.. but that sounds really weird and prone to breakage |
19:37:26 | FromDiscord | <graveflo> https://nim-lang.org/docs/sets.html#pop%2CHashSet%5BA%5D |
19:37:39 | FromDiscord | <piqueiras> nah im using an iterator lmao |
19:37:47 | FromDiscord | <piqueiras> its a set for an enum with 5 elements |
19:38:08 | FromDiscord | <graveflo> oh so its a bitset? |
19:38:33 | FromDiscord | <piqueiras> yea |
19:39:15 | FromDiscord | <graveflo> well then if it only has one element you can math out which one it is without an iterator |
19:39:19 | * | ormiret quit (Ping timeout: 260 seconds) |
19:40:28 | FromDiscord | <piqueiras> some set to bits thing? no clue about those |
19:42:13 | FromDiscord | <graveflo> yea you can convert a singleton bitset to the right ordinal value for the enum. Don't bother. just use an iterator LOL |
19:43:05 | * | ormiret joined #nim |
19:43:52 | FromDiscord | <piqueiras> lmfao |
19:44:49 | FromDiscord | <Phil> One sec, I shall take this time to perform a small victory dance.↵Setting up a 3 thread scenario where all of them are doing their own thing and they're easily controllable, you can register routes on them effortlessly likey they were webservers and it just works.↵God damn!↵.... I feel like packages like that likely either are pointless or already exist but I'm just happy it works. |
19:45:41 | FromDiscord | <Phil> And you can literally send a message from any thread to any thread, all of it thread safe because you're using channels which take care of ownership appropriately and the code really isn't that complicated given what it does |
20:09:10 | * | nils` joined #nim |
20:17:42 | FromDiscord | <rakgew> congrats!! \:-D |
20:33:32 | FromDiscord | <zectbumo> does/did nim have an interactive mode or am I imagining things? |
20:39:52 | FromDiscord | <systemonia> there's nim secret which is somewhat close to an interactive mode but idk |
20:40:24 | FromDiscord | <jviega> Same with `inim`. There's also going to be an official repl before too long, to my understanding. |
20:43:56 | FromDiscord | <zectbumo> okay so not quite ready yet. I like secrets |
20:57:46 | * | rockcavera quit (Ping timeout: 276 seconds) |
20:59:09 | FromDiscord | <rakgew> I quite like inim for quick try-outs.↵but I am also spoilt by super-comfortable repls like ptpython (autocompletion, multiline-repeat/edits, docstrings, etc..)↵..would love something like that in nim. |
20:59:13 | FromDiscord | <Phil> In reply to @zectbumo "does/did nim have an": Look for nlvm! |
20:59:22 | FromDiscord | <Phil> nlvm e is an actual repl |
20:59:36 | FromDiscord | <Phil> https://github.com/arnetheduck/nlvm |
20:59:53 | FromDiscord | <Phil> Though it isn't entirely consistent with nim syntax my experience with it so far has been far better than just the nim vm or inim |
21:00:13 | FromDiscord | <Phil> By that I mean you can reassign `let x = 5`, likely because its interpreted line by line or sth |
21:00:45 | FromDiscord | <jviega> Eeew |
21:10:17 | FromDiscord | <rakgew> you were referring to the NIR discussion? ( https://forum.nim-lang.org/t/10594 )↵(@jviega) |
21:19:12 | FromDiscord | <jviega> Yes I remember Araq mentioning building a repl on top of it. |
21:19:29 | * | krux02_ joined #nim |
21:30:21 | FromDiscord | <Phil> In reply to @jviega "Eeew": Its close enough none the less imo and works for the minimal examples I typically write in them, I actually like it |
21:53:38 | FromDiscord | <piqueiras> if I have two positive integers but the biggest is unknown, which is the best way to define the range between them? |
21:53:47 | FromDiscord | <piqueiras> apart from min(a,b)..max(a,b) or sth |
22:01:19 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:02:13 | FromDiscord | <kcvinker5420> I used --mm:boehm, that might be the reason |
22:02:58 | FromDiscord | <kcvinker5420> Yes, that's the reason. |
22:14:05 | * | rockcavera joined #nim |
22:18:29 | FromDiscord | <bostonboston> In reply to @piqueiras "if I have two": Abs(a-b)? |
22:18:52 | FromDiscord | <bostonboston> No that's not right |
22:19:40 | * | azimut joined #nim |
22:19:49 | FromDiscord | <bostonboston> No that is right |
22:20:07 | FromDiscord | <bostonboston> abs(a-b) is my final answer m |
22:20:25 | FromDiscord | <Elegantbeef> Nah it's `abs(b-a)` 😛 |
22:20:35 | FromDiscord | <odexine> Lol |
22:20:44 | * | advesperacit quit () |
22:21:07 | FromDiscord | <Elegantbeef> `min(a, b)..max(a, b)` is useful if you want to get the right index |
22:21:26 | FromDiscord | <nnsee> `max(a-b, b-a)` |
22:21:33 | FromDiscord | <Elegantbeef> Otherwise you can do `for _ in 0..abs(a - b))` |
22:22:17 | FromDiscord | <nnsee> oh wait, range |
23:00:32 | * | azimut quit (Remote host closed the connection) |
23:00:51 | * | azimut joined #nim |
23:15:24 | FromDiscord | <Phil> For architectural drawings, are there like specific symbols for objects vs. procs? |
23:21:51 | FromDiscord | <Phil> Obviously that can be heavily improved upon, just trying to figure out how to best arrange/visualize this https://media.discordapp.net/attachments/371759389889003532/1184273940600848470/architecture.png?ex=658b600e&is=6578eb0e&hm=06a3b74b7121c379739900dcb1b7a55e9b9512a05b341e06baabf5c89be00b7a& |
23:57:14 | FromDiscord | <michaelb.eth> In reply to @isofruit "Obviously that can be": A sequence diagram might be helpful, though what you've put together is nice |
23:57:18 | FromDiscord | <michaelb.eth> https://en.wikipedia.org/wiki/Sequence_diagram |
23:58:33 | FromDiscord | <michaelb.eth> I'm not sure about fitting instantiations into a sequence diagram... |