<< 20-09-2023 >>

00:12:34*jmdaemon joined #nim
00:18:42FromDiscord<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:10FromDiscord<Phil> (edit) "binaries," => "the scenarios where you compile nim to binaries instead of js,"
00:21:41FromDiscord<millymox> sent a code paste, see https://play.nim-lang.org/#ix=4GR8
00:22:26FromDiscord<Elegantbeef> `Mod1.Module((X: 1.282, Y: 2.234, Z: 1.262)`?
00:24:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GRa
00:24:42FromDiscord<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:32FromDiscord<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:34FromDiscord<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:48FromDiscord<manaravak> In reply to @Elegantbeef "You can make system": Do you have an example of what you mean?
00:32:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GRb
00:33:09FromDiscord<millymox> sent a code paste, see https://play.nim-lang.org/#ix=4GRc
00:33:09FromDiscord<Elegantbeef> The latter is how you import system libraries with Nim
00:33:09FromDiscord<Elegantbeef> This of course only works for native runtimes like Nodejs or Deno or similar
00:33:11FromDiscord<Elegantbeef> I do not use any JS runtime so I have 0 clue how to do it
00:33:31FromDiscord<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:41FromDiscord<Elegantbeef> For the web you'd have to setup wasm and use emscripten or similar
00:33:53FromDiscord<manaravak> In reply to @Elegantbeef "This of course only": Thanks! That'll at least getting me started somewhere
00:34:18FromDiscord<Elegantbeef> Or use Nim's JS backend
00:34:26FromDiscord<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:50FromDiscord<Elegantbeef> Since Nim is statically typed and has overloading this is very much required to have usable names in JS
00:35:04FromDiscord<Elegantbeef> If JS wasnt typeless abomination this would be much nicer
00:35:26FromDiscord<Elegantbeef> Well acktually JS has types
00:35:35FromDiscord<.aingel.> So for futhark what method is generated if my struct has a member which is named "type"
00:35:45FromDiscord<.aingel.> Cause i think type is a built in nim function too
00:36:00FromDiscord<.aingel.> oh maybe struct_type
00:45:55FromDiscord<.aingel.> It got named to typefield
00:57:12FromDiscord<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:55FromDiscord<huantian> that should work yeah
01:02:19FromDiscord<.aingel.> In reply to @manaravak "<@145405730571288577> Wait, I just": Ya
01:02:21FromDiscord<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:24FromDiscord<.aingel.> You have to make like a c header though
01:05:42FromDiscord<manaravak> Awesome. I've got some homework to do now I guess
01:06:10FromDiscord<manaravak> (edit) "Awesome. I've got some homework to do now I guess ... " added "😆"
01:07:40FromDiscord<.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:11FromDiscord<.aingel.> If you're doing it for the browser then there's probably not much of a benefit speedwise anyways
01:12:03FromDiscord<manaravak> Only technically the browser. It's an electron app, so embedded browser that runs as a desktop app.
01:12:22FromDiscord<manaravak> No different than running backend in this case
01:13:26FromDiscord<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:11FromDiscord<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:27FromDiscord<fenilli> oh I see that makes sense.
01:15:38FromDiscord<fenilli> simpler than I thought
01:16:12FromDiscord<fenilli> thanks
02:07:30*krux02 quit (Remote host closed the connection)
02:27:58FromDiscord<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:58FromDiscord<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:49NimEventerNew 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:17NimEventerNew 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:45PMunchI hate it when the docs does this: https://nim-lang.org/docs/times.html#second%3D%2CDateTime%2CSecondRange
06:48:51PMunchDeprecated in favour of what?!
07:00:08advesperacitYes, that is very annoying
07:01:48FromDiscord<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:58FromDiscord<Phil> (edit) "line?" => "info?"
07:05:44advesperacit@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:00FromDiscord<Elegantbeef> In this case I do not think there is an alternative and you must use `initDateTime` with the appropriate fields Pmunch
07:09:05FromDiscord<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:15FromDiscord<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:35FromDiscord<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:42FromDiscord<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:09FromDiscord<Phil> Modifying my earlier comment:↵but asking that quesiton generally implies...
07:34:21FromDiscord<Phil> As for C++ interop, I'm out there, I can barely do C nowadays
07:34:36FromDiscord<Phil> (edit) "As for C++ interop, I'm out there, I can barely do C ... nowadays" added "interop"
07:35:03FromDiscord<odexine> is nimpretty based on any papers or was it written "as one formulates" (adhoc, i guess)
07:37:24advesperacit@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:05FromDiscord<Phil> sent a long message, see https://paste.rs/9cNtQ
07:39:19FromDiscord<Phil> (edit) "http://ix.io/4GS3" => "http://ix.io/4GS2"
07:51:31FromDiscord<duskhorn> In reply to @isofruit "As for C++ interop,": Heh XD
07:53:37FromDiscord<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:02FromDiscord<demotomohiro> pragma to override virtual functions: https://nim-lang.org/docs/manual_experimental.html#virtual-pragma
07:55:27FromDiscord<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:24FromDiscord<intellij_gamer> I've used [clapfn](https://github.com/oliverdelancey/clapfn) quite a bit and found it easiest
07:57:04FromDiscord<Chronos [She/Her]> In reply to @odexine "amongst all of the": Cligen has always made stuff p easy for me
07:58:01FromDiscord<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:16FromDiscord<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:56FromDiscord<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:30FromDiscord<duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4GS8
08:04:23FromDiscord<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:29FromDiscord<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:01FromDiscord<duskhorn> Ahhh ok I see
08:05:03FromDiscord<duskhorn> Thank you! That's exactly what I was looking for
08:05:42FromDiscord<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:43FromDiscord<demotomohiro> https://nim-lang.org/docs/manual_experimental.html#virtual-pragma
08:08:23FromDiscord<duskhorn> sent a code paste, see https://play.nim-lang.org/#ix=4GS9
08:09:05FromDiscord<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:50FromDiscord<duskhorn> Or maybe I'm just forgetting C++
08:10:01FromDiscord<duskhorn> Does override apply only for virtual methods?
08:10:30FromDiscord<duskhorn> :ferrisDerp:
08:10:35FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4GSa
08:11:46FromDiscord<duskhorn> In reply to @demotomohiro "You might also": Yes ofc! \:)
08:12:47FromDiscord<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:00FromDiscord<duskhorn> Yeah so ok, override only works from virtual methods
08:13:44FromDiscord<duskhorn> Thank you! ^w^
08:16:04FromDiscord<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:44FromDiscord<Phil> Random thought, is there a way to convert a nimnode back into "normal" source code?
09:29:26FromDiscord<odexine> .repr
09:29:47FromDiscord<Phil> Hmmm
09:30:04FromDiscord<odexine> unrelated, how fun it is to wade through the compiler library where things are named strangely and have no documentation
09:56:58PMunch_ElegantBeef, well my usecase is to get the current time, but zero out the minutes and the seconds
10:00:23FromDiscord<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:07FromDiscord<odexine> what big differences are there with PNodes and NimNodes?
10:01:27FromDiscord<odexine> major differences/things to look out for mainly ig?
10:05:24FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSn
10:06:05FromDiscord<odexine> how do you make the string with the "\n"
10:06:24FromDiscord<sOkam! 🫐> `mystr.add "somethingsomething\n"`
10:06:39FromDiscord<odexine> `\n` in a regular string will be literal, if you want them as two characters `\n` then you double escape `\\n`
10:06:55FromDiscord<sOkam! 🫐> kk let me try
10:06:56FromDiscord<odexine> or make the string raw `r"\n"`
10:10:28FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSo
10:10:36FromDiscord<odexine> dont use raw strings for replace
10:10:46FromDiscord<odexine> and that's also inappropriate because it will change ALL newlines
10:11:02FromDiscord<odexine> so your code witll look like `int main (void) {\n printf...`
10:11:09FromDiscord<odexine> (edit) "so your code witll look like `int main (void) {\n printf...` ... " added "in a text editor\"
10:11:30FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4GSp
10:11:31FromDiscord<sOkam! 🫐> ty rika 🙏
10:12:18FromDiscord<sOkam! 🫐> In reply to @odexine "and that's also inappropriate": oh no, its just replacing only this argument entry, nothing else
10:39:04FromDiscord<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:28FromDiscord<odexine> ... dynamic and static?
10:39:38FromDiscord<odexine> what do you mean "name"?
10:40:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GSw
10:40:59FromDiscord<Phil> In reply to @odexine "... dynamic and static?": Hmm so based on that it would be "dynamic fields" vs "static fields"
10:41:33FromDiscord<odexine> if you want, i'd personally use "discriminated fields" and just fields for the static one
10:41:45FromDiscord<odexine> i know what you mean i ask what you mean by name\
10:41:51FromDiscord<odexine> like are you asking for a standard name?
10:41:55FromDiscord<odexine> the name nim uses?
10:43:57FromDiscord<Phil> I'm writing docs, looking for a name that will click with the largest amount of possible users
10:44:23FromDiscord<Phil> sent a long message, see http://ix.io/4GSx
10:44:24FromDiscord<odexine> good luck, people cant even agree on the name for ADT enums
10:44:31FromDiscord<Phil> (edit) "http://ix.io/4GSx" => "http://ix.io/4GSy"
10:44:43FromDiscord<odexine> if you want to be as clear as possible
10:44:50FromDiscord<odexine> "non-variant fields" and "variant fields"
10:45:01FromDiscord<odexine> completely unambiguous to anyone reading in that context
10:46:12FromDiscord<Phil> Check, I'll take that wording
11:02:03FromDiscord<odexine> sent a long message, see http://ix.io/4GSF
11:02:43FromDiscord<odexine> perhaps i should invest in a rubber ducky
11:06:49PMunch_Rubber ducks are indeed helpful
11:07:32FromDiscord<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:19FromDiscord<odexine> perhaps i should just stop worrying and get something done for now
11:16:00FromDiscord<bhunao> nim has a gui library?
11:16:35FromDiscord<toma400> In reply to @bhunao "nim has a gui": There's no official one, but plenty of community made, yeah
11:16:41FromDiscord<toma400> (edit) "one," => "one yet,"
11:16:57FromDiscord<toma400> https://github.com/ringabout/awesome-nim#gui
11:17:22FromDiscord<Phil> Elcritch working on one as well
11:17:31FromDiscord<Phil> Got owlkettle for gtk bindings
11:17:59FromDiscord<toma400> I'm also working on one, but I doubt it will be usable this year 😅
11:21:25FromDiscord<bhunao> In reply to @toma400 "There's no official one": thanks, gonna take a look
11:26:08FromDiscord<saint._._.> How are inline iterators different from regular iterators, syntax wise?↵↵https://nim-by-example.github.io/for_iterators/
11:28:35FromDiscord<Phil> Looks like it just describes unrolling the for loop to me
11:29:01FromDiscord<nnsee> as far as I know, inline iterators _are_ "regular" iterators
11:29:08FromDiscord<odexine> In reply to @saint._._. "How are inline iterators": syntactically nothing? semantically inline iterators are not "first order"
11:29:14FromDiscord<nnsee> in contrast to closure iterators, which are marked with `{ .closure. }`
11:29:19FromDiscord<odexine> that is, you cannot pass them as runtime values
11:29:47FromDiscord<nnsee> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-firstminusclass-iterators
11:30:19FromDiscord<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:22PMunch_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:23PMunch_procedure.
12:08:53PMunch_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:48FromDiscord<saint._._.> In reply to @PMunch_ "So why have both?": Gotcha, makes sense
12:43:09FromDiscord<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:29FromDiscord<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:48FromDiscord<Phil> Nim 2.0 doesn't really change that much, so I wouldn't say that Nim 2.0 particularly changes things
13:24:16PMunch_saint._._., which guide are you following?
13:24:31PMunch_Phil, well it changes quite a bit. But nothing a newcomer has to worry about :P
13:39:30PMunch_Crap..
13:39:33*PMunch_ is now known as PMunch
13:40:33PMunchSo 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:17arkanoidPMunch: really? I've been playing with fire all this time?
13:45:00arkanoidI'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:06arkanoidoh, defect is a type of exception
13:46:17PMunchYup
13:46:22PMunchBut not supposed to be caught..
13:47:13arkanoidwell, except when exceptions happens
13:47:23FromDiscord<odexine> ?
13:47:34arkanoidthis catch all condition saved my ass in the past, probably
13:47:53FromDiscord<odexine> Defects are exceptions which won’t be caught with certain compile flags
13:48:15arkanoidwait, then I'm missing something
13:48:24FromDiscord<odexine> Turning the panics flag on will make defects effectively a quit(1)
13:49:06PMuncharkanoid, by default they are caught
13:49:13arkanoidI see defects inherits from Exception, but also CatchableError inherits from Exception. what does a try .. except Exception do?
13:49:27FromDiscord<odexine> Catches everything if panics are off
13:49:29PMunchThat will catch both of them
13:49:33FromDiscord<odexine> Catches catchable errors if panics are on
13:49:37PMunchYeah, as long as `--panics:off`
13:50:01arkanoidgood defaults, good ..
13:51:13PMunchWell..
13:52:11arkanoidyeah you are right I am wrong, I know
13:52:45arkanoidbut I need my nim process to run even if the room is on fire
13:53:50arkanoida wire programmer should do try ... except CatchableError and then fix aggressive asserts
13:56:02*jmdaemon quit (Ping timeout: 260 seconds)
13:58:43FromDiscord<odexine> In reply to @arkanoid "good defaults, good ..": the defaults may change
14:00:22arkanoidodexine, in which direction? turning "exept Exception" invalid, or making panics on default, or makind Defects not ref object of Exceptions?
14:00:49FromDiscord<odexine> except exception may become invalid, and panics may be on by default
14:08:54*PMunch quit (Quit: Leaving)
14:11:29arkanoidodexine, 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:41FromDiscord<odexine> i believe so far its only been considered
14:14:08FromDiscord<odexine> i personally hope that the defect/catchable idea is reconsidered and possibly also deprecated for a more "not mixing exceptions" system
14:23:22arkanoidwhy is it convenient to make some kind of errors (defects) blow up the process?
14:23:42arkanoidis it for performances, or other reasons?
14:24:49FromDiscord<odexine> enforcing correctness
14:25:42arkanoidI don't see how making some kind of problems killing the process is enforcing correctness
14:26:43arkanoidyou already have a way to make the process blow: just don't catch the exception
14:33:24FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4GTT
14:34:55FromDiscord<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:39arkanoidmichaelb.eth: "conceptually-categorically wrong to attempt recovery" is debatable
14:42:31arkanoidI 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:59FromDiscord<odexine> divbyzero is a defect as the cpu signals the os to send a signal to the process when it happens
14:44:16FromDiscord<odexine> sigfpe is fatal
14:44:20FromDiscord<odexine> it will kill the process
14:46:23FromDiscord<leorize> defects are a perf thing, that's true
14:46:33arkanoidshould 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:52arkanoidah, ok, if it is for performance, I can understand
14:47:13arkanoidbut not the "enforcing correctness"
14:47:17FromDiscord<leorize> the idea was to reduce the amount of code generated and make raises pragma simpler
14:48:19arkanoidsure I can understand that if a defect now quits instead of bubbling up an exception, it's way leaner to address
14:48:56FromDiscord<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:17FromDiscord<michaelb.eth> when I raise `Defect` in the libs I author, that is the very thing I intend to communicate
14:49:18arkanoidbut it should not be default. A way to make the process never explode for whatever internal/external reason should exist
14:49:36FromDiscord<michaelb.eth> again, that boils down to the semantics of Defect vs. CatchableError
14:49:49FromDiscord<michaelb.eth> if I thought you should be able to catch it, I would raise `CatchableError`
14:49:53FromDiscord<leorize> we call it just run the process under a supervisor \:p↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
14:51:39arkanoidI 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:12FromDiscord<michaelb.eth> not if you interpret Defect vs. CatchableError in the way I suggested
14:52:25FromDiscord<michaelb.eth> again, different perspectives here simply don't align
14:52:28arkanoidso 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:28FromDiscord<michaelb.eth> it's a tough spot
14:52:49FromDiscord<michaelb.eth> that's one way to go, for sure, others disagree
14:53:48arkanoidthere are many reasons to not rely on supervisor to restore your business logic.
14:55:54FromDiscord<leorize> personally i subscribe to erlang's "let it crash" principal
14:56:08FromDiscord<leorize> some errors are just unrecoverable
14:57:20FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4GTZ
14:59:11arkanoidI'd personally leave Nim if panics would become on without going back, and programs would crash on DivideByZero by design
14:59:33arkanoidthe point is that you can't always rely on OS to gracefully restore your business logic
15:00:51FromDiscord<leorize> it's planned to have it turned on by default and stay that way iirc
15:01:13arkanoidthe 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:25FromDiscord<leorize> some destructors logic was gonna rely on that fact
15:01:27FromDiscord<leorize> but don't quote me cuz i might be misremembering
15:02:03FromDiscord<leorize> your listening port is never gonna be immediately available if you're using TCP, sorry
15:03:40arkanoidexactly. 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:35FromDiscord<leorize> you can have something else listen for you, then you can crash however
15:04:49FromDiscord<leorize> though admittedly nim has nothing that let you do that easily
15:05:27arkanoidso 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:50FromDiscord<leorize> while arthemitic errors are somewhat recoverable, I wouldn't bet on the same for everything else
15:06:02arkanoideven out of memory is recoverable
15:06:13FromDiscord<leorize> that's simple
15:06:14arkanoidout of power is not :P
15:06:32FromDiscord<leorize> you can't recover from accidentally closing an fd for example
15:07:12arkanoidwhy not? sure it can be recovered, if you process doesn't crash
15:09:12FromDiscord<leorize> because some other files might already took it's place
15:09:12FromDiscord<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:12FromDiscord<leorize> ask me how I figured it out
15:09:18FromDiscord<leorize> and if you combine it with an event queue, the result is even grimmer
15:09:49FromDiscord<leorize> the dead fd could still be alive in an another process, thus will still trigger events within the event queue
15:10:08arkanoidin 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:29FromDiscord<leorize> personally I think that's the most robust way
15:11:38FromDiscord<leorize> keep the memory separate and you'll be fine
15:12:18FromDiscord<leorize> if you're just listening and are on Linux, systemd's socket activation can fill the supervisor job
15:12:31FromDiscord<leorize> or xinetd, if you don't like systemd
15:12:48arkanoidsure 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:33arkanoidsorry for the bad workding
15:13:45arkanoid*wording. Argh!
15:14:27arkanoidbtw, 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:25FromDiscord<leorize> well it is equally true that some libraries do abuse defects
15:16:13arkanoidleorize, asyncnet raises defect if the destination port is not available. You think this is unrecoverable?
15:16:47arkanoidsorry, if you try to send on a closed socket
15:16:49FromDiscord<leorize> no
15:16:53FromDiscord<leorize> oh
15:17:29FromDiscord<leorize> yes, it's a data leak avenue
15:17:39FromDiscord<leorize> esp if you do multithreaded server
15:18:16FromDiscord<leorize> there's a moment where your "closed socket" have now become one of another client
15:19:29arkanoidsure, 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:35FromDiscord<leorize> personally I think you should not be able to write code that sends on dead sockets in the first place \:p
15:22:08arkanoidwell, it's an external condition
15:22:28FromDiscord<leorize> it's not external if you already closed the socket, though
15:22:43FromDiscord<leorize> the target host closing the socket does nothing to your side
15:23:18FromDiscord<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:47arkanoideither way, I think program should not crash. I'd like to read more around this discussion
15:39:44FromDiscord<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:17FromDiscord<leorize> but I also believe that you should not be able to write something wrong that easily
15:41:12FromDiscord<leorize> a fatal error that triggers easily is never productive
16:21:48*ntat joined #nim
16:25:28FromDiscord<.aingel.> Is Gitlab down?
16:26:23*junaid_ joined #nim
16:42:38*derpydoo quit (Ping timeout: 244 seconds)
16:55:50arkanoidleorize, thanks for sharing your thoughs on this topic
17:06:38*derpydoo joined #nim
17:19:29FromDiscord<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:25FromDiscord<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:31FromDiscord<nnsee> should not fatal
17:23:05FromDiscord<odexine> In reply to @leorize "we call it just": god bless erlang?
17:23:21FromDiscord<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:27FromDiscord<nnsee> I've recently been sort of into elixir
17:23:28FromDiscord<nnsee> seems interesting
17:29:40FromDiscord<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:50FromDiscord<Chronos [She/Her]> Because surely some stuff is just better to do with HTTP
17:31:10FromDiscord<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:26FromDiscord<Chronos [She/Her]> Oof C# is insane for us
17:31:29FromDiscord<nnsee> they have taken the "everything is websockets" motto to the extreme
17:31:45FromDiscord<Chronos [She/Her]> How so? Could you give a brief summary?
17:34:35FromDiscord<leorize> the OS don&#x27;t close sockets unless you told it to↵(@nnsee)
17:34:41FromDiscord<nnsee> sent a long message, see http://ix.io/4GUH
17:34:57FromDiscord<nnsee> In reply to @leorize "the OS don&#x27;t close": my experience with cgroups and ebpf tells me otherwise
17:35:37FromDiscord<leorize> sounds like a bug to me
17:35:45FromDiscord<.aingel.> In reply to @nnsee "basically, the DOM rendered": Thats super cool
17:36:22FromDiscord<.aingel.> What's the performance like?
17:36:50FromDiscord<Chronos [She/Her]> In reply to @nnsee "basically, the DOM rendered": ...wow
17:37:07FromDiscord<Chronos [She/Her]> That sounds very uh, not ideal imo? But ig it works well enough
17:37:08FromDiscord<leorize> because closing an fd willy nilly is a security issue
17:37:28FromDiscord<Chronos [She/Her]> I'd prefer to give any work the client can do, to the client imo
17:38:57FromDiscord<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:11FromDiscord<odexine> In reply to @chronos.vitaqua "...wow": it "is more responsive as the client doesnt flash a white screen while loading"
17:55:22FromDiscord<odexine> i believe is their sales pitch for those kinds of systems
17:55:35FromDiscord<odexine> also easier to program in (only need 1 language, no need to deal with js)
17:55:42FromDiscord<odexine> also their claim, not mine
17:56:22FromDiscord<bhunao> can i reinstall a package with nimble?
17:58:04FromDiscord<Chronos [She/Her]> Could uninstall and install again, what are you trying to do?
17:58:11FromDiscord<.aingel.> You don't need to uninstall
17:58:14FromDiscord<.aingel.> If you install it will reinstall
17:58:18FromDiscord<.aingel.> Afaik
17:58:24FromDiscord<Chronos [She/Her]> It just installs the newer version
17:58:48FromDiscord<.aingel.> Yeah true
17:59:03FromDiscord<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:11FromDiscord<Chronos [She/Her]> And similar
17:59:19FromDiscord<bhunao> a package i have is broken i guess i just wanna reinstall to see if fix
17:59:49FromDiscord<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:55FromDiscord<odexine> In reply to @chronos.vitaqua "WebAssembly exists though, if": webassembly is already more complex than just sending DOM through websockets
17:59:59FromDiscord<Chronos [She/Her]> In reply to @bhunao "a package i have": Yeah just uninstall and install again
18:00:13FromDiscord<Chronos [She/Her]> In reply to @odexine "webassembly is already more": True, but they are Microsoft so like...
18:00:20FromDiscord<Chronos [She/Her]> Oh well, not my design choice
18:00:37FromDiscord<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:50FromDiscord<odexine> for elixir it works pretty well as they seem to have a pretty solid/efficient implementation of it
18:01:32FromDiscord<odexine> In reply to @chronos.vitaqua "True, but they *are*": well it isnt just microsoft that does it
18:03:20FromDiscord<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:35FromDiscord<.aingel.> U dont need to uninstall
18:03:37FromDiscord<.aingel.> Afaik
18:03:41FromDiscord<leorize> you can do the tried and true method of just removing the nimble folder
18:03:42FromDiscord<.aingel.> Just install it again it will reinstall
18:03:56FromDiscord<bhunao> nimble says i already have the package
18:04:00FromDiscord<leorize> then do yourself a service next time by using `--localdeps`
18:04:04FromDiscord<.aingel.> Oh sorry then
18:04:08FromDiscord<.aingel.> I thought it reinstalls
18:04:13FromDiscord<.aingel.> Guess I am wrong
18:04:24FromDiscord<bhunao> In reply to @leorize "then do yourself a": what this does?
18:04:48FromDiscord<leorize> installs all your deps into `./nimbledeps`
18:04:55FromDiscord<leorize> lets you scope the nimble folder to a project
18:08:47FromDiscord<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:22FromDiscord<arathanis> you could also try using atlas
18:48:35FromDiscord<sOkam! 🫐> ^ +1
18:59:24FromDiscord<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:45FromDiscord<huantian> zippy is what you want
19:05:53FromDiscord<huantian> what compression format are you looking to use
19:25:52FromDiscord<requiresupport> not necessarily the format, anything works. I just want to compress a folder and all its subfolders
19:26:02FromDiscord<requiresupport> how would I do this with zippy?
19:28:21FromDiscord<okabintaro> sent a code paste, see https://play.nim-lang.org/#ix=4GVn
19:28:50FromDiscord<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:39FromDiscord<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:11FromDiscord<jmgomez> how one can run `runnableExamples` on a file?
21:42:41FromDiscord<intellij_gamer> `nim doc <theFile>`
21:43:07FromDiscord<intellij_gamer> Don't think there is a way to run the examples independently from the documentation
22:00:51FromDiscord<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:23FromDiscord<Elegantbeef> `nimble run` or `nimble build` will compile it
22:02:12FromDiscord<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:46FromDiscord<Elegantbeef> Make a task to execute it then
22:03:46FromDiscord<Elegantbeef> If it's just a library `nimble run` and `nimble build` do not make sense
22:04:24FromDiscord<jmgomez> In reply to @intellij_gamer "`nim doc <theFile>`": thats good enough, thanks!
22:09:32FromDiscord<fenilli> I see, I just assumed calling something like `nimble c package_name` would infer the `srcDir` from the `.nimble` file.
22:10:03FromDiscord<fenilli> but it seens like `nimble c` is just an alias of `nim c` correct?
22:10:19FromDiscord<juancarlospaco> In reply to @fenilli "but it seens like": Use `nim c file.nim`
22:11:30FromDiscord<Elegantbeef> https://github.com/nim-lang/nimble#nimble-c
22:11:45FromDiscord<Elegantbeef> `nimble c package_name` should work
22:12:52FromDiscord<Elegantbeef> Seems like it's completely broken
22:12:56FromDiscord<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:35FromDiscord<Elegantbeef> Yea I just tried it in my own project after reading the readme
22:13:37FromDiscord<Elegantbeef> It does not work
22:13:39FromDiscord<fenilli> its probably not looking into srcDir for the compilation, but `nimble c src/dragonfly_nim` works fine.
22:14:31FromDiscord<Elegantbeef> > compile individual modules inside their package
22:14:32FromDiscord<Elegantbeef> I mean src shouldnt be needed
22:14:46FromDiscord<Elegantbeef> If you can `nimble install pkg` then do `import yourPkg/module`, I do not see why `nimble c` needs a `src/`
22:14:52FromDiscord<Elegantbeef> Likely just another broken part of nimble
22:16:02FromDiscord<fenilli> oh I see, so just a bug, not the end of the world anyways.
22:20:10FromDiscord<Elegantbeef> https://github.com/nim-lang/nimble/blob/master/src/nimble.nim#L772 is the issue line if you care to investigate
22:23:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GW8
22:24:01FromDiscord<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:49arkanoidhow can I use a variable in the string formatter field? like &"{foo:0bar}"
22:44:25arkanoiddo I need a template/macro for that?
22:51:31*jmdaemon quit (Ping timeout: 258 seconds)
22:53:45arkanoidnevermind, 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:52FromDiscord<millymox> sent a code paste, see https://paste.rs/PUefb
23:59:19FromDiscord<millymox> (edit) "https://play.nim-lang.org/#ix=4GWi" => "https://play.nim-lang.org/#ix=4GWh"