00:12:34 | * | jmdaemon joined #nim |
00:18:42 | FromDiscord | <Phil> In reply to @manaravak "Just discovered nim. Was": Given that nim can compile to JS (But at that point the benefits of being faster due to memory manipulation etc. go away), you can definitely interact with that.↵As for binaries, should be possible given that the node ecosystem interacts with binaries as well, how easy that is depends on the node ecosystem.↵Haven't done that so can't provide an answer there sadly. |
00:19:10 | FromDiscord | <Phil> (edit) "binaries," => "the scenarios where you compile nim to binaries instead of js," |
00:21:41 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4GR8 |
00:22:26 | FromDiscord | <Elegantbeef> `Mod1.Module((X: 1.282, Y: 2.234, Z: 1.262)`? |
00:24:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GRa |
00:24:42 | FromDiscord | <manaravak> @Phil Ya, compiling was my initial thought. But like you said no performance benefit and might as well keep writing ja/ts at that point.↵↵I suppose I can try running via cli. Not a pretty solution but I suppose it gets the job done haha |
00:25:32 | FromDiscord | <Elegantbeef> You can make system libraries with Nim, so you can just make a system library and import how ever your JS runtime does that |
00:25:34 | FromDiscord | <Phil> In reply to @manaravak "<@180601887916163073> Ya, compiling was": Note there's still a benefit due to stricter typing and the ability to share types between FE and BE in webdev, but that's assuming you wanna do webdev |
00:30:48 | FromDiscord | <manaravak> In reply to @Elegantbeef "You can make system": Do you have an example of what you mean? |
00:32:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GRb |
00:33:09 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4GRc |
00:33:09 | FromDiscord | <Elegantbeef> The latter is how you import system libraries with Nim |
00:33:09 | FromDiscord | <Elegantbeef> This of course only works for native runtimes like Nodejs or Deno or similar |
00:33:11 | FromDiscord | <Elegantbeef> I do not use any JS runtime so I have 0 clue how to do it |
00:33:31 | FromDiscord | <manaravak> In reply to @isofruit "Note there's still a": Ya, one of the reasons I enjoy working with Blazor and asp.net. but of course, nim would have the added benefit of much faster client side due to skipping the WASM layer. It's one of the things I'm interested in with nim. My fulltime is full stack webdev. |
00:33:41 | FromDiscord | <Elegantbeef> For the web you'd have to setup wasm and use emscripten or similar |
00:33:53 | FromDiscord | <manaravak> In reply to @Elegantbeef "This of course only": Thanks! That'll at least getting me started somewhere |
00:34:18 | FromDiscord | <Elegantbeef> Or use Nim's JS backend |
00:34:26 | FromDiscord | <Elegantbeef> Nim's JS backend has the same sort of thing where you can use `exportC: "myName"` to expose procedures in a ES3 file |
00:34:50 | FromDiscord | <Elegantbeef> Since Nim is statically typed and has overloading this is very much required to have usable names in JS |
00:35:04 | FromDiscord | <Elegantbeef> If JS wasnt typeless abomination this would be much nicer |
00:35:26 | FromDiscord | <Elegantbeef> Well acktually JS has types |
00:35:35 | FromDiscord | <.aingel.> So for futhark what method is generated if my struct has a member which is named "type" |
00:35:45 | FromDiscord | <.aingel.> Cause i think type is a built in nim function too |
00:36:00 | FromDiscord | <.aingel.> oh maybe struct_type |
00:45:55 | FromDiscord | <.aingel.> It got named to typefield |
00:57:12 | FromDiscord | <manaravak> @ElegantBeouf Wait, I just realized. Nim compiles to c/c++ so wouldn't I be able to consume a nim library in the same way I would comsume a c/c++ library in whatever framework I'm using, be it node.js, .net, etc.? So as long as there is some interoperability with c/c++ with the language I'm using, then I can interop with nim? Do I have a misunderstanding of how that works? |
00:58:55 | FromDiscord | <huantian> that should work yeah |
01:02:19 | FromDiscord | <.aingel.> In reply to @manaravak "<@145405730571288577> Wait, I just": Ya |
01:02:21 | FromDiscord | <fenilli> Question, how to create a Singleton? for example if I want to have a logger available that keeps a file open during the application, how do I get that instance? |
01:02:24 | FromDiscord | <.aingel.> You have to make like a c header though |
01:05:42 | FromDiscord | <manaravak> Awesome. I've got some homework to do now I guess |
01:06:10 | FromDiscord | <manaravak> (edit) "Awesome. I've got some homework to do now I guess ... " added "😆" |
01:07:40 | FromDiscord | <.aingel.> In reply to @manaravak "Awesome. I've got some": Yeah if you're doing this for the backend then definitely you can make it like how node or whatever backend thing calls a c library |
01:08:11 | FromDiscord | <.aingel.> If you're doing it for the browser then there's probably not much of a benefit speedwise anyways |
01:12:03 | FromDiscord | <manaravak> Only technically the browser. It's an electron app, so embedded browser that runs as a desktop app. |
01:12:22 | FromDiscord | <manaravak> No different than running backend in this case |
01:13:26 | FromDiscord | <sOkam! 🫐> In reply to @fenilli "Question, how to create": create a new file with a private variable at root of that file↵create procs to do something to that variable and expose -those- only from the module↵use the procs to do whatever |
01:15:11 | FromDiscord | <fowl.mouth> In reply to @fenilli "Question, how to create": your logger module can expose a public API of functions that operate on the private logging variables (file, log format, etc.) the alternative interface is more like OOP where you can get an instance of a Logger and functions act on that instance |
01:15:27 | FromDiscord | <fenilli> oh I see that makes sense. |
01:15:38 | FromDiscord | <fenilli> simpler than I thought |
01:16:12 | FromDiscord | <fenilli> thanks |
02:07:30 | * | krux02 quit (Remote host closed the connection) |
02:27:58 | FromDiscord | <Elegantbeef> @manaravak "consume a C/C++ library" is a bit of a misnomer, that's just foreign function interface(FFI). We sadly use C to document this application binary interfaces(ABI). In reality ABI is not a C thing it's just how data types are laid out and procedure signatures. |
02:28:58 | FromDiscord | <Elegantbeef> Yes I abbreviated them wholly so if this conversation continues I do not feel the need to say the entire name |
02:49:37 | * | blop_ quit (Remote host closed the connection) |
02:50:06 | * | blop_ joined #nim |
03:00:49 | NimEventer | New post on r/nim by Verbunk: CLI 'chat' app, see https://reddit.com/r/nim/comments/16naa8a/cli_chat_app/ |
03:39:21 | * | blop_ quit (*.net *.split) |
04:00:48 | * | blop_ joined #nim |
04:40:18 | * | ntat joined #nim |
05:22:14 | * | rockcavera quit (Remote host closed the connection) |
05:55:17 | * | disso-peach joined #nim |
06:01:17 | NimEventer | New thread by sls1005: How to use `--nimBasePattern`, see https://forum.nim-lang.org/t/10501 |
06:02:05 | * | blop_ quit (Remote host closed the connection) |
06:02:38 | * | blop_ joined #nim |
06:04:19 | * | PMunch joined #nim |
06:30:23 | * | advesperacit joined #nim |
06:48:13 | * | ntat quit (Quit: leaving) |
06:48:45 | PMunch | I hate it when the docs does this: https://nim-lang.org/docs/times.html#second%3D%2CDateTime%2CSecondRange |
06:48:51 | PMunch | Deprecated in favour of what?! |
07:00:08 | advesperacit | Yes, that is very annoying |
07:01:48 | FromDiscord | <Phil> In reply to @PMunch "I hate it when": Open a forum thread, get an answer from araq, make a 1 line PR that adds the line? |
07:01:58 | FromDiscord | <Phil> (edit) "line?" => "info?" |
07:05:44 | advesperacit | @Phil while that is a good way to solve the immediate problem, there is the bigger issue of why is it like this in the first place? |
07:08:00 | FromDiscord | <Elegantbeef> In this case I do not think there is an alternative and you must use `initDateTime` with the appropriate fields Pmunch |
07:09:05 | FromDiscord | <Elegantbeef> Rather `dateTime` I guess \:d |
07:26:53 | * | redj quit (Quit: No Ping reply in 180 seconds.) |
07:29:47 | * | redj joined #nim |
07:31:15 | FromDiscord | <Phil> In reply to @advesperacit "<@180601887916163073> while that is": I agree with you there, but it generally implies that you need to be willing to plan out and establish process changes in an open source "organization" (in the widest sense) like nim.↵I tend to not be interested in that because I am not willing to sacrifice that amount of time and effort myself and don't immediately know of somebody that would. |
07:31:35 | FromDiscord | <duskhorn> Hello people, I was wondering if something worked with C++ interop which I can't test right now.↵↵Does inheriting a C++ object in Nim work?↵How would overrides work? |
07:31:42 | FromDiscord | <duskhorn> (edit) "Hello people, I was wondering if something worked with C++ interop which I can't test right now.↵↵Does inheriting a C++ object in Nim work?↵How would ... overrides" added "method" |
07:34:09 | FromDiscord | <Phil> Modifying my earlier comment:↵but asking that quesiton generally implies... |
07:34:21 | FromDiscord | <Phil> As for C++ interop, I'm out there, I can barely do C nowadays |
07:34:36 | FromDiscord | <Phil> (edit) "As for C++ interop, I'm out there, I can barely do C ... nowadays" added "interop" |
07:35:03 | FromDiscord | <odexine> is nimpretty based on any papers or was it written "as one formulates" (adhoc, i guess) |
07:37:24 | advesperacit | @Phil that's understandable. I should have explained what I meant, which is that whoever slaps a deprecation message on something should take a few minutes extra to put in what to do instead. |
07:39:05 | FromDiscord | <Phil> sent a long message, see https://paste.rs/9cNtQ |
07:39:19 | FromDiscord | <Phil> (edit) "http://ix.io/4GS3" => "http://ix.io/4GS2" |
07:51:31 | FromDiscord | <duskhorn> In reply to @isofruit "As for C++ interop,": Heh XD |
07:53:37 | FromDiscord | <demotomohiro> In reply to @duskhorn "Hello people, I was": https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma↵You can define an object type that inherits C++ type.↵Import C++ class/struct with `importcpp` and `inheritable` pragma. |
07:55:02 | FromDiscord | <demotomohiro> pragma to override virtual functions: https://nim-lang.org/docs/manual_experimental.html#virtual-pragma |
07:55:27 | FromDiscord | <odexine> amongst all of the nim cli argument parsing libraries, which do you guys prefer? (not really a support question just a curiosity) |
07:56:18 | * | PMunch_ joined #nim |
07:56:24 | FromDiscord | <intellij_gamer> I've used [clapfn](https://github.com/oliverdelancey/clapfn) quite a bit and found it easiest |
07:57:04 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "amongst all of the": Cligen has always made stuff p easy for me |
07:58:01 | FromDiscord | <duskhorn> In reply to @demotomohiro "https://nim-lang.org/docs/manual.html#implementatio": Ohh! I didn't know about the `inheritable` pragma. What does it exactly do? Is it the same as making something "`of RootObj`"? |
07:59:07 | * | PMunch quit (Ping timeout: 258 seconds) |
08:00:16 | FromDiscord | <demotomohiro> In reply to @duskhorn "Ohh! I didn't know": `inheritable` pragma just allows you to inherit from the type.↵iirc, it doesn't add runtime type info like `of RootObj`. |
08:00:56 | FromDiscord | <duskhorn> In reply to @demotomohiro "`inheritable` pragma just allows": That's extremely interesting↵Why would someone have one instead of the other, then? |
08:02:27 | * | azimut joined #nim |
08:02:30 | FromDiscord | <duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4GS8 |
08:04:23 | FromDiscord | <duskhorn> Ok, I found an use of the pragma, it looks correct lol↵... unless you can use `inheritable` just with objects imported from c++ |
08:04:29 | FromDiscord | <demotomohiro> `of RootObj` is Nim's native way to make objects inheritable.↵It seems `inheritable` pragma allows you to inherit imported C++ class in the same way as C++.↵So Nim generates C++ code like `class MyObjInNim: public ClassInCpp {` |
08:04:31 | * | FromDiscord quit (Remote host closed the connection) |
08:04:44 | * | FromDiscord joined #nim |
08:05:01 | FromDiscord | <duskhorn> Ahhh ok I see |
08:05:03 | FromDiscord | <duskhorn> Thank you! That's exactly what I was looking for |
08:05:42 | FromDiscord | <duskhorn> But now I have another question↵↵Let's say you import a C++ class and you make it inheritable. How do you override methods? |
08:06:43 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual_experimental.html#virtual-pragma |
08:08:23 | FromDiscord | <duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4GS9 |
08:09:05 | FromDiscord | <duskhorn> In reply to @demotomohiro "https://nim-lang.org/docs/manual_experimental.html#": Ok but this is to have inheritance from a virtual class, how does it work for a concrete class? |
08:09:50 | FromDiscord | <duskhorn> Or maybe I'm just forgetting C++ |
08:10:01 | FromDiscord | <duskhorn> Does override apply only for virtual methods? |
08:10:30 | FromDiscord | <duskhorn> :ferrisDerp: |
08:10:35 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4GSa |
08:11:46 | FromDiscord | <duskhorn> In reply to @demotomohiro "You might also": Yes ofc! \:) |
08:12:47 | FromDiscord | <demotomohiro> In reply to @duskhorn "Does override apply only": If you want to override non-virtual member function: https://nim-lang.github.io/Nim/manual_experimental.html#member-pragma↵But member pragma is new feature and not in stable version yet. |
08:13:00 | FromDiscord | <duskhorn> Yeah so ok, override only works from virtual methods |
08:13:44 | FromDiscord | <duskhorn> Thank you! ^w^ |
08:16:04 | FromDiscord | <demotomohiro> iirc, you can override member functions that are not virtual. But that doesnt work when you call it using pointer to base typd. |
08:58:50 | * | krux02 joined #nim |
09:28:44 | FromDiscord | <Phil> Random thought, is there a way to convert a nimnode back into "normal" source code? |
09:29:26 | FromDiscord | <odexine> .repr |
09:29:47 | FromDiscord | <Phil> Hmmm |
09:30:04 | FromDiscord | <odexine> unrelated, how fun it is to wade through the compiler library where things are named strangely and have no documentation |
09:56:58 | PMunch_ | ElegantBeef, well my usecase is to get the current time, but zero out the minutes and the seconds |
10:00:23 | FromDiscord | <odexine> In reply to @odexine "unrelated, how fun it": ngl what a mess, the parser is doing double duty on prettifying hahaha↵at least thats what im getting from reading the code so far |
10:01:07 | FromDiscord | <odexine> what big differences are there with PNodes and NimNodes? |
10:01:27 | FromDiscord | <odexine> major differences/things to look out for mainly ig? |
10:05:24 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSn |
10:06:05 | FromDiscord | <odexine> how do you make the string with the "\n" |
10:06:24 | FromDiscord | <sOkam! 🫐> `mystr.add "somethingsomething\n"` |
10:06:39 | FromDiscord | <odexine> `\n` in a regular string will be literal, if you want them as two characters `\n` then you double escape `\\n` |
10:06:55 | FromDiscord | <sOkam! 🫐> kk let me try |
10:06:56 | FromDiscord | <odexine> or make the string raw `r"\n"` |
10:10:28 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSo |
10:10:36 | FromDiscord | <odexine> dont use raw strings for replace |
10:10:46 | FromDiscord | <odexine> and that's also inappropriate because it will change ALL newlines |
10:11:02 | FromDiscord | <odexine> so your code witll look like `int main (void) {\n printf...` |
10:11:09 | FromDiscord | <odexine> (edit) "so your code witll look like `int main (void) {\n printf...` ... " added "in a text editor\" |
10:11:30 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSp |
10:11:31 | FromDiscord | <sOkam! 🫐> ty rika 🙏 |
10:12:18 | FromDiscord | <sOkam! 🫐> In reply to @odexine "and that's also inappropriate": oh no, its just replacing only this argument entry, nothing else |
10:39:04 | FromDiscord | <Phil> Is there a name for the fields on an object variant that are "flexible" vs. the fields that are "stable" on it? |
10:39:28 | FromDiscord | <odexine> ... dynamic and static? |
10:39:38 | FromDiscord | <odexine> what do you mean "name"? |
10:40:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GSw |
10:40:59 | FromDiscord | <Phil> In reply to @odexine "... dynamic and static?": Hmm so based on that it would be "dynamic fields" vs "static fields" |
10:41:33 | FromDiscord | <odexine> if you want, i'd personally use "discriminated fields" and just fields for the static one |
10:41:45 | FromDiscord | <odexine> i know what you mean i ask what you mean by name\ |
10:41:51 | FromDiscord | <odexine> like are you asking for a standard name? |
10:41:55 | FromDiscord | <odexine> the name nim uses? |
10:43:57 | FromDiscord | <Phil> I'm writing docs, looking for a name that will click with the largest amount of possible users |
10:44:23 | FromDiscord | <Phil> sent a long message, see http://ix.io/4GSx |
10:44:24 | FromDiscord | <odexine> good luck, people cant even agree on the name for ADT enums |
10:44:31 | FromDiscord | <Phil> (edit) "http://ix.io/4GSx" => "http://ix.io/4GSy" |
10:44:43 | FromDiscord | <odexine> if you want to be as clear as possible |
10:44:50 | FromDiscord | <odexine> "non-variant fields" and "variant fields" |
10:45:01 | FromDiscord | <odexine> completely unambiguous to anyone reading in that context |
10:46:12 | FromDiscord | <Phil> Check, I'll take that wording |
11:02:03 | FromDiscord | <odexine> sent a long message, see http://ix.io/4GSF |
11:02:43 | FromDiscord | <odexine> perhaps i should invest in a rubber ducky |
11:06:49 | PMunch_ | Rubber ducks are indeed helpful |
11:07:32 | FromDiscord | <odexine> i usually am able to just hold a conversation in my head but i guess this time i need feedback from another brain |
11:13:19 | FromDiscord | <odexine> perhaps i should just stop worrying and get something done for now |
11:16:00 | FromDiscord | <bhunao> nim has a gui library? |
11:16:35 | FromDiscord | <toma400> In reply to @bhunao "nim has a gui": There's no official one, but plenty of community made, yeah |
11:16:41 | FromDiscord | <toma400> (edit) "one," => "one yet," |
11:16:57 | FromDiscord | <toma400> https://github.com/ringabout/awesome-nim#gui |
11:17:22 | FromDiscord | <Phil> Elcritch working on one as well |
11:17:31 | FromDiscord | <Phil> Got owlkettle for gtk bindings |
11:17:59 | FromDiscord | <toma400> I'm also working on one, but I doubt it will be usable this year 😅 |
11:21:25 | FromDiscord | <bhunao> In reply to @toma400 "There's no official one": thanks, gonna take a look |
11:26:08 | FromDiscord | <saint._._.> How are inline iterators different from regular iterators, syntax wise?↵↵https://nim-by-example.github.io/for_iterators/ |
11:28:35 | FromDiscord | <Phil> Looks like it just describes unrolling the for loop to me |
11:29:01 | FromDiscord | <nnsee> as far as I know, inline iterators _are_ "regular" iterators |
11:29:08 | FromDiscord | <odexine> In reply to @saint._._. "How are inline iterators": syntactically nothing? semantically inline iterators are not "first order" |
11:29:14 | FromDiscord | <nnsee> in contrast to closure iterators, which are marked with `{ .closure. }` |
11:29:19 | FromDiscord | <odexine> that is, you cannot pass them as runtime values |
11:29:47 | FromDiscord | <nnsee> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-firstminusclass-iterators |
11:30:19 | FromDiscord | <nnsee> > Iterators that are neither marked `{.closure.}` nor `{.inline.}` explicitly default to being inline, but this may change in future versions of the implementation. |
12:07:22 | PMunch_ | saint._._., in layman terms the normal in-line iterators simply expand into a loop during compile-time. So you can't store them in a variable or pass them to a procedure, they have to be executed right away. Closure iterators on the other hand are iterators which have a scope object stored on the stack and a procedure you can call over and over which updates the state. This state object and associated procedure can be stored in a variable or passed to a |
12:07:23 | PMunch_ | procedure. |
12:08:53 | PMunch_ | So why have both? If you only want to use your iterator as `for x in myCoolIterator:` then you don't have to worry about allocating a state object on the heap and an inline iterator would be faster. But if you want to do certain things like passing iterators around like variables then you need the closure kind. |
12:24:59 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
12:41:21 | * | derpydoo joined #nim |
12:42:48 | FromDiscord | <saint._._.> In reply to @PMunch_ "So why have both?": Gotcha, makes sense |
12:43:09 | FromDiscord | <saint._._.> I think I read this explanation in the forum in a thread too. It would be cool if the guide was somewhat updated cause it's not really clear in that |
12:43:29 | FromDiscord | <saint._._.> Although I think that guide might be just old in general, especially with nim 2.0 maybe? |
12:54:07 | * | rockcavera joined #nim |
12:59:42 | * | ntat joined #nim |
13:19:48 | FromDiscord | <Phil> Nim 2.0 doesn't really change that much, so I wouldn't say that Nim 2.0 particularly changes things |
13:24:16 | PMunch_ | saint._._., which guide are you following? |
13:24:31 | PMunch_ | Phil, well it changes quite a bit. But nothing a newcomer has to worry about :P |
13:39:30 | PMunch_ | Crap.. |
13:39:33 | * | PMunch_ is now known as PMunch |
13:40:33 | PMunch | So asyncnet has an assert in it which raises an AssertionDefect when you try to send on a closed socket. This happens for some reason in my code, and means that my server crashes.. |
13:43:17 | arkanoid | PMunch: really? I've been playing with fire all this time? |
13:45:00 | arkanoid | I'm quite sure I've already faced a condition where my asyncnet code tried to tcp connect and fail, and it was catched |
13:46:06 | arkanoid | oh, defect is a type of exception |
13:46:17 | PMunch | Yup |
13:46:22 | PMunch | But not supposed to be caught.. |
13:47:13 | arkanoid | well, except when exceptions happens |
13:47:23 | FromDiscord | <odexine> ? |
13:47:34 | arkanoid | this catch all condition saved my ass in the past, probably |
13:47:53 | FromDiscord | <odexine> Defects are exceptions which won’t be caught with certain compile flags |
13:48:15 | arkanoid | wait, then I'm missing something |
13:48:24 | FromDiscord | <odexine> Turning the panics flag on will make defects effectively a quit(1) |
13:49:06 | PMunch | arkanoid, by default they are caught |
13:49:13 | arkanoid | I see defects inherits from Exception, but also CatchableError inherits from Exception. what does a try .. except Exception do? |
13:49:27 | FromDiscord | <odexine> Catches everything if panics are off |
13:49:29 | PMunch | That will catch both of them |
13:49:33 | FromDiscord | <odexine> Catches catchable errors if panics are on |
13:49:37 | PMunch | Yeah, as long as `--panics:off` |
13:50:01 | arkanoid | good defaults, good .. |
13:51:13 | PMunch | Well.. |
13:52:11 | arkanoid | yeah you are right I am wrong, I know |
13:52:45 | arkanoid | but I need my nim process to run even if the room is on fire |
13:53:50 | arkanoid | a wire programmer should do try ... except CatchableError and then fix aggressive asserts |
13:56:02 | * | jmdaemon quit (Ping timeout: 260 seconds) |
13:58:43 | FromDiscord | <odexine> In reply to @arkanoid "good defaults, good ..": the defaults may change |
14:00:22 | arkanoid | odexine, in which direction? turning "exept Exception" invalid, or making panics on default, or makind Defects not ref object of Exceptions? |
14:00:49 | FromDiscord | <odexine> except exception may become invalid, and panics may be on by default |
14:08:54 | * | PMunch quit (Quit: Leaving) |
14:11:29 | arkanoid | odexine, thanks for the info. I'm not quite sure I'd be happy about this direction, but if it is possible for user to turn panics on is ok |
14:13:41 | FromDiscord | <odexine> i believe so far its only been considered |
14:14:08 | FromDiscord | <odexine> i personally hope that the defect/catchable idea is reconsidered and possibly also deprecated for a more "not mixing exceptions" system |
14:23:22 | arkanoid | why is it convenient to make some kind of errors (defects) blow up the process? |
14:23:42 | arkanoid | is it for performances, or other reasons? |
14:24:49 | FromDiscord | <odexine> enforcing correctness |
14:25:42 | arkanoid | I don't see how making some kind of problems killing the process is enforcing correctness |
14:26:43 | arkanoid | you already have a way to make the process blow: just don't catch the exception |
14:33:24 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4GTT |
14:34:55 | FromDiscord | <michaelb.eth> Now, folks in the Nim community had and do have disagreements about interpreting "Defect vs. CatchableError" in that way, but it is one valid way to approach it. |
14:38:55 | * | ntat quit (Quit: leaving) |
14:40:39 | arkanoid | michaelb.eth: "conceptually-categorically wrong to attempt recovery" is debatable |
14:42:31 | arkanoid | I receive input from user, I attempt operation, it goes div by zero, I catch exception and go on. Why should that kill the process, or why should I validate it beforehand if I don't care about the rest of the temporary data related to that error |
14:43:59 | FromDiscord | <odexine> divbyzero is a defect as the cpu signals the os to send a signal to the process when it happens |
14:44:16 | FromDiscord | <odexine> sigfpe is fatal |
14:44:20 | FromDiscord | <odexine> it will kill the process |
14:46:23 | FromDiscord | <leorize> defects are a perf thing, that's true |
14:46:33 | arkanoid | should be possible for my business logic to not care if the error comes from cpu, os, universal god ar spaghetti monster, and just keep go the bad route |
14:46:52 | arkanoid | ah, ok, if it is for performance, I can understand |
14:47:13 | arkanoid | but not the "enforcing correctness" |
14:47:17 | FromDiscord | <leorize> the idea was to reduce the amount of code generated and make raises pragma simpler |
14:48:19 | arkanoid | sure I can understand that if a defect now quits instead of bubbling up an exception, it's way leaner to address |
14:48:56 | FromDiscord | <michaelb.eth> In reply to @arkanoid "I receive input from": you can think of it more from the perspective of an author who is saying, effectively, "this code may raise a Defect, and in that case no error-state recovery should be attempted, the only reasonable outcome is for your-program-using-my-code to exit with error" |
14:49:17 | FromDiscord | <michaelb.eth> when I raise `Defect` in the libs I author, that is the very thing I intend to communicate |
14:49:18 | arkanoid | but it should not be default. A way to make the process never explode for whatever internal/external reason should exist |
14:49:36 | FromDiscord | <michaelb.eth> again, that boils down to the semantics of Defect vs. CatchableError |
14:49:49 | FromDiscord | <michaelb.eth> if I thought you should be able to catch it, I would raise `CatchableError` |
14:49:53 | FromDiscord | <leorize> we call it just run the process under a supervisor \:p↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
14:51:39 | arkanoid | I agree that the coder should have a way to express better if that error is recoverable or not from their perspective, but from the user of that lib perspective, the importance of that error could be completely different |
14:52:12 | FromDiscord | <michaelb.eth> not if you interpret Defect vs. CatchableError in the way I suggested |
14:52:25 | FromDiscord | <michaelb.eth> again, different perspectives here simply don't align |
14:52:28 | arkanoid | so I vote for panics always off, unless explicitly stated, and "except Exception" catching all possible errors and making process never quit unless killed from outside |
14:52:28 | FromDiscord | <michaelb.eth> it's a tough spot |
14:52:49 | FromDiscord | <michaelb.eth> that's one way to go, for sure, others disagree |
14:53:48 | arkanoid | there are many reasons to not rely on supervisor to restore your business logic. |
14:55:54 | FromDiscord | <leorize> personally i subscribe to erlang's "let it crash" principal |
14:56:08 | FromDiscord | <leorize> some errors are just unrecoverable |
14:57:20 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4GTZ |
14:59:11 | arkanoid | I'd personally leave Nim if panics would become on without going back, and programs would crash on DivideByZero by design |
14:59:33 | arkanoid | the point is that you can't always rely on OS to gracefully restore your business logic |
15:00:51 | FromDiscord | <leorize> it's planned to have it turned on by default and stay that way iirc |
15:01:13 | arkanoid | the process may run on a machine that you don't own, with policies you don't like, with a stupid supervisor that would not restart process immediately, or stupid socket policies that would make your listening ports not immediately available on restart, and many more |
15:01:25 | FromDiscord | <leorize> some destructors logic was gonna rely on that fact |
15:01:27 | FromDiscord | <leorize> but don't quote me cuz i might be misremembering |
15:02:03 | FromDiscord | <leorize> your listening port is never gonna be immediately available if you're using TCP, sorry |
15:03:40 | arkanoid | exactly. So yout business logic handling a client makes your server crash, and your supervisor won't be able to restart for a while |
15:04:35 | FromDiscord | <leorize> you can have something else listen for you, then you can crash however |
15:04:49 | FromDiscord | <leorize> though admittedly nim has nothing that let you do that easily |
15:05:27 | arkanoid | so having a second process doing the server and passing the client down to a crashable process? this is erlang in the worst way |
15:05:50 | FromDiscord | <leorize> while arthemitic errors are somewhat recoverable, I wouldn't bet on the same for everything else |
15:06:02 | arkanoid | even out of memory is recoverable |
15:06:13 | FromDiscord | <leorize> that's simple |
15:06:14 | arkanoid | out of power is not :P |
15:06:32 | FromDiscord | <leorize> you can't recover from accidentally closing an fd for example |
15:07:12 | arkanoid | why not? sure it can be recovered, if you process doesn't crash |
15:09:12 | FromDiscord | <leorize> because some other files might already took it's place |
15:09:12 | FromDiscord | <leorize> and depending on what you were doing, that new file could take fd 0/1/2, leaking your data to the outside if you print or read from stdin |
15:09:12 | FromDiscord | <leorize> ask me how I figured it out |
15:09:18 | FromDiscord | <leorize> and if you combine it with an event queue, the result is even grimmer |
15:09:49 | FromDiscord | <leorize> the dead fd could still be alive in an another process, thus will still trigger events within the event queue |
15:10:08 | arkanoid | in erlang if there are any errors, the process is automatically terminated, and this is reported to any processes that were monitoring the crashed process. It means that your business logic (main process) would never die if you don't want it to do |
15:11:29 | FromDiscord | <leorize> personally I think that's the most robust way |
15:11:38 | FromDiscord | <leorize> keep the memory separate and you'll be fine |
15:12:18 | FromDiscord | <leorize> if you're just listening and are on Linux, systemd's socket activation can fill the supervisor job |
15:12:31 | FromDiscord | <leorize> or xinetd, if you don't like systemd |
15:12:48 | arkanoid | sure erlang way is the right way, from OS perspective. But from Nim business logic I don't think that not having a way to preserve process from running if something bad happens is correct, nowadays |
15:13:33 | arkanoid | sorry for the bad workding |
15:13:45 | arkanoid | *wording. Argh! |
15:14:27 | arkanoid | btw, it's an interesting topic. Maybe it's just me that fails to find the ultimate advantage of having a process crash on error even if you consider it recoverable |
15:15:25 | FromDiscord | <leorize> well it is equally true that some libraries do abuse defects |
15:16:13 | arkanoid | leorize, asyncnet raises defect if the destination port is not available. You think this is unrecoverable? |
15:16:47 | arkanoid | sorry, if you try to send on a closed socket |
15:16:49 | FromDiscord | <leorize> no |
15:16:53 | FromDiscord | <leorize> oh |
15:17:29 | FromDiscord | <leorize> yes, it's a data leak avenue |
15:17:39 | FromDiscord | <leorize> esp if you do multithreaded server |
15:18:16 | FromDiscord | <leorize> there's a moment where your "closed socket" have now become one of another client |
15:19:29 | arkanoid | sure, it's an error condition, and you get notified about it. It is required to kill the whole process? I don't think so |
15:20:35 | FromDiscord | <leorize> personally I think you should not be able to write code that sends on dead sockets in the first place \:p |
15:22:08 | arkanoid | well, it's an external condition |
15:22:28 | FromDiscord | <leorize> it's not external if you already closed the socket, though |
15:22:43 | FromDiscord | <leorize> the target host closing the socket does nothing to your side |
15:23:18 | FromDiscord | <leorize> if you meant that you didn't close the socket and is still owning the fd, then sure, it should not crash |
15:35:47 | arkanoid | either way, I think program should not crash. I'd like to read more around this discussion |
15:39:44 | FromDiscord | <leorize> personally i think the attack vectors such a programming bug could expose you to is too dangerous, especially on a network-facing server |
15:40:17 | FromDiscord | <leorize> but I also believe that you should not be able to write something wrong that easily |
15:41:12 | FromDiscord | <leorize> a fatal error that triggers easily is never productive |
16:21:48 | * | ntat joined #nim |
16:25:28 | FromDiscord | <.aingel.> Is Gitlab down? |
16:26:23 | * | junaid_ joined #nim |
16:42:38 | * | derpydoo quit (Ping timeout: 244 seconds) |
16:55:50 | arkanoid | leorize, thanks for sharing your thoughs on this topic |
17:06:38 | * | derpydoo joined #nim |
17:19:29 | FromDiscord | <Chronos [She/Her]> What project to do... website for making words in a conlang, chat platform research, game format, Minecraft server impl (again) or Java with Nim syntax hm |
17:21:25 | FromDiscord | <nnsee> I agree with arkanoid. The OS can decide to close sockets too, not just the program itself. Checking whether the socket is closed every time you send or recv data is very unrealistic. |
17:21:31 | FromDiscord | <nnsee> should not fatal |
17:23:05 | FromDiscord | <odexine> In reply to @leorize "we call it just": god bless erlang? |
17:23:21 | FromDiscord | <Phil> In reply to @chronos.vitaqua "What project to do...": Honestly chat platform research will lead you to websockets and websockets have some interesting architecture implications if you want to replace your http layer with it |
17:23:27 | FromDiscord | <nnsee> I've recently been sort of into elixir |
17:23:28 | FromDiscord | <nnsee> seems interesting |
17:29:40 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Honestly chat platform research": How would we replace all of the HTTP stuff with a websocket tho, curious |
17:29:50 | FromDiscord | <Chronos [She/Her]> Because surely some stuff is just better to do with HTTP |
17:31:10 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "How would we replace": that's the neat part, you don't. but if you want to see how far websockets can be taken, take a look at Microsoft's Blazor |
17:31:26 | FromDiscord | <Chronos [She/Her]> Oof C# is insane for us |
17:31:29 | FromDiscord | <nnsee> they have taken the "everything is websockets" motto to the extreme |
17:31:45 | FromDiscord | <Chronos [She/Her]> How so? Could you give a brief summary? |
17:34:35 | FromDiscord | <leorize> the OS don't close sockets unless you told it to↵(@nnsee) |
17:34:41 | FromDiscord | <nnsee> sent a long message, see http://ix.io/4GUH |
17:34:57 | FromDiscord | <nnsee> In reply to @leorize "the OS don't close": my experience with cgroups and ebpf tells me otherwise |
17:35:37 | FromDiscord | <leorize> sounds like a bug to me |
17:35:45 | FromDiscord | <.aingel.> In reply to @nnsee "basically, the DOM rendered": Thats super cool |
17:36:22 | FromDiscord | <.aingel.> What's the performance like? |
17:36:50 | FromDiscord | <Chronos [She/Her]> In reply to @nnsee "basically, the DOM rendered": ...wow |
17:37:07 | FromDiscord | <Chronos [She/Her]> That sounds very uh, not ideal imo? But ig it works well enough |
17:37:08 | FromDiscord | <leorize> because closing an fd willy nilly is a security issue |
17:37:28 | FromDiscord | <Chronos [She/Her]> I'd prefer to give any work the client can do, to the client imo |
17:38:57 | FromDiscord | <leorize> you got a repro? or at least a kind of scenario where that could happen?↵(@nnsee) |
17:54:39 | * | disso-peach quit (Quit: Leaving) |
17:55:11 | FromDiscord | <odexine> In reply to @chronos.vitaqua "...wow": it "is more responsive as the client doesnt flash a white screen while loading" |
17:55:22 | FromDiscord | <odexine> i believe is their sales pitch for those kinds of systems |
17:55:35 | FromDiscord | <odexine> also easier to program in (only need 1 language, no need to deal with js) |
17:55:42 | FromDiscord | <odexine> also their claim, not mine |
17:56:22 | FromDiscord | <bhunao> can i reinstall a package with nimble? |
17:58:04 | FromDiscord | <Chronos [She/Her]> Could uninstall and install again, what are you trying to do? |
17:58:11 | FromDiscord | <.aingel.> You don't need to uninstall |
17:58:14 | FromDiscord | <.aingel.> If you install it will reinstall |
17:58:18 | FromDiscord | <.aingel.> Afaik |
17:58:24 | FromDiscord | <Chronos [She/Her]> It just installs the newer version |
17:58:48 | FromDiscord | <.aingel.> Yeah true |
17:59:03 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "also easier to program": WebAssembly exists though, if they didn't pack the entire CLR runtime, it'd probably be fairly easy to make a JS library to fill in things needed for DOM interaction |
17:59:11 | FromDiscord | <Chronos [She/Her]> And similar |
17:59:19 | FromDiscord | <bhunao> a package i have is broken i guess i just wanna reinstall to see if fix |
17:59:49 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "it "is more responsive": Wouldn't it also mean you have to scale up the server earlier than if you put the work for the client to do? |
17:59:55 | FromDiscord | <odexine> In reply to @chronos.vitaqua "WebAssembly exists though, if": webassembly is already more complex than just sending DOM through websockets |
17:59:59 | FromDiscord | <Chronos [She/Her]> In reply to @bhunao "a package i have": Yeah just uninstall and install again |
18:00:13 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "webassembly is already more": True, but they are Microsoft so like... |
18:00:20 | FromDiscord | <Chronos [She/Her]> Oh well, not my design choice |
18:00:37 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Wouldn't it also mean": depends? most of the time people do not hit those limits for their servers |
18:00:50 | FromDiscord | <odexine> for elixir it works pretty well as they seem to have a pretty solid/efficient implementation of it |
18:01:32 | FromDiscord | <odexine> In reply to @chronos.vitaqua "True, but they *are*": well it isnt just microsoft that does it |
18:03:20 | FromDiscord | <bhunao> In reply to @chronos.vitaqua "Yeah just uninstall and": is there a way to force the uninstall? nimble says i have projects with this as dependancy |
18:03:35 | FromDiscord | <.aingel.> U dont need to uninstall |
18:03:37 | FromDiscord | <.aingel.> Afaik |
18:03:41 | FromDiscord | <leorize> you can do the tried and true method of just removing the nimble folder |
18:03:42 | FromDiscord | <.aingel.> Just install it again it will reinstall |
18:03:56 | FromDiscord | <bhunao> nimble says i already have the package |
18:04:00 | FromDiscord | <leorize> then do yourself a service next time by using `--localdeps` |
18:04:04 | FromDiscord | <.aingel.> Oh sorry then |
18:04:08 | FromDiscord | <.aingel.> I thought it reinstalls |
18:04:13 | FromDiscord | <.aingel.> Guess I am wrong |
18:04:24 | FromDiscord | <bhunao> In reply to @leorize "then do yourself a": what this does? |
18:04:48 | FromDiscord | <leorize> installs all your deps into `./nimbledeps` |
18:04:55 | FromDiscord | <leorize> lets you scope the nimble folder to a project |
18:08:47 | FromDiscord | <bhunao> gonna do it from now on |
18:22:29 | * | azimut quit (Ping timeout: 252 seconds) |
18:34:09 | * | azimut joined #nim |
18:43:23 | * | goober joined #nim |
18:45:05 | * | ntat quit (Quit: leaving) |
18:46:22 | FromDiscord | <arathanis> you could also try using atlas |
18:48:35 | FromDiscord | <sOkam! 🫐> ^ +1 |
18:59:24 | FromDiscord | <requiresupport> would like to compress a directory using nim without any c wrapper/dependency stuff if some has a working lib.. checked out zippy by guzba but couldnt find a quick way to that :/ |
19:02:27 | * | gooba joined #nim |
19:02:34 | * | goober quit (Quit: Leaving) |
19:05:45 | FromDiscord | <huantian> zippy is what you want |
19:05:53 | FromDiscord | <huantian> what compression format are you looking to use |
19:25:52 | FromDiscord | <requiresupport> not necessarily the format, anything works. I just want to compress a folder and all its subfolders |
19:26:02 | FromDiscord | <requiresupport> how would I do this with zippy? |
19:28:21 | FromDiscord | <okabintaro> sent a code paste, see https://play.nim-lang.org/#ix=4GVn |
19:28:50 | FromDiscord | <okabintaro> In reply to @requiresupport "how would I do": Seems like there is no support for writing in the current version yet, but you could try the old version: https://github.com/guzba/zippy/blob/master/src/zippy/ziparchives_v1.nim#L6-L9 |
19:29:39 | FromDiscord | <requiresupport> In reply to @okabintaro "Seems like there is": wow... many thanks , I'll check it out |
19:33:50 | * | junaid_ quit (Remote host closed the connection) |
20:01:07 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
20:05:44 | * | jmdaemon joined #nim |
20:20:17 | * | computerquip joined #nim |
21:24:11 | FromDiscord | <jmgomez> how one can run `runnableExamples` on a file? |
21:42:41 | FromDiscord | <intellij_gamer> `nim doc <theFile>` |
21:43:07 | FromDiscord | <intellij_gamer> Don't think there is a way to run the examples independently from the documentation |
22:00:51 | FromDiscord | <fenilli> really newb question here, when compiling using nim/nimble, I still need to specify the full path, is that correct? even tho the nimble file has srcDir? |
22:01:23 | FromDiscord | <Elegantbeef> `nimble run` or `nimble build` will compile it |
22:02:12 | FromDiscord | <fenilli> `nimble run` asks for a binary, and `nimble build` needs a `bin` file, I meant I just want to execute the main file. |
22:03:46 | FromDiscord | <Elegantbeef> Make a task to execute it then |
22:03:46 | FromDiscord | <Elegantbeef> If it's just a library `nimble run` and `nimble build` do not make sense |
22:04:24 | FromDiscord | <jmgomez> In reply to @intellij_gamer "`nim doc <theFile>`": thats good enough, thanks! |
22:09:32 | FromDiscord | <fenilli> I see, I just assumed calling something like `nimble c package_name` would infer the `srcDir` from the `.nimble` file. |
22:10:03 | FromDiscord | <fenilli> but it seens like `nimble c` is just an alias of `nim c` correct? |
22:10:19 | FromDiscord | <juancarlospaco> In reply to @fenilli "but it seens like": Use `nim c file.nim` |
22:11:30 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/nimble#nimble-c |
22:11:45 | FromDiscord | <Elegantbeef> `nimble c package_name` should work |
22:12:52 | FromDiscord | <Elegantbeef> Seems like it's completely broken |
22:12:56 | FromDiscord | <fenilli> in this specified structure, it required the fullpath/package_name so `nimble c dragonly_nim` fails with `Error: Specified file, dragonfly_nim or dragonfly_nim.nim, does not exist.` https://media.discordapp.net/attachments/371759389889003532/1154178404581642240/image.png |
22:13:35 | FromDiscord | <Elegantbeef> Yea I just tried it in my own project after reading the readme |
22:13:37 | FromDiscord | <Elegantbeef> It does not work |
22:13:39 | FromDiscord | <fenilli> its probably not looking into srcDir for the compilation, but `nimble c src/dragonfly_nim` works fine. |
22:14:31 | FromDiscord | <Elegantbeef> > compile individual modules inside their package |
22:14:32 | FromDiscord | <Elegantbeef> I mean src shouldnt be needed |
22:14:46 | FromDiscord | <Elegantbeef> If you can `nimble install pkg` then do `import yourPkg/module`, I do not see why `nimble c` needs a `src/` |
22:14:52 | FromDiscord | <Elegantbeef> Likely just another broken part of nimble |
22:16:02 | FromDiscord | <fenilli> oh I see, so just a bug, not the end of the world anyways. |
22:20:10 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/nimble/blob/master/src/nimble.nim#L772 is the issue line if you care to investigate |
22:23:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GW8 |
22:24:01 | FromDiscord | <Elegantbeef> This allows `nimble c nimble` or `nimble c nimblepkg/options` to work |
22:28:53 | * | rockcavera quit (Read error: Connection reset by peer) |
22:29:16 | * | advesperacit quit () |
22:30:32 | * | rockcavera joined #nim |
22:43:49 | arkanoid | how can I use a variable in the string formatter field? like &"{foo:0bar}" |
22:44:25 | arkanoid | do I need a template/macro for that? |
22:51:31 | * | jmdaemon quit (Ping timeout: 258 seconds) |
22:53:45 | arkanoid | nevermind, found align function |
23:06:08 | * | rockcavera quit (Read error: Connection reset by peer) |
23:06:28 | * | rockcavera joined #nim |
23:06:28 | * | rockcavera quit (Changing host) |
23:06:28 | * | rockcavera joined #nim |
23:27:37 | * | gooba quit (Remote host closed the connection) |
23:37:37 | * | jmdaemon joined #nim |
23:39:27 | * | lumo_e joined #nim |
23:58:52 | FromDiscord | <millymox> sent a code paste, see https://paste.rs/PUefb |
23:59:19 | FromDiscord | <millymox> (edit) "https://play.nim-lang.org/#ix=4GWi" => "https://play.nim-lang.org/#ix=4GWh" |