<< 07-12-2022 >>

00:03:39*dtomato4 quit (Quit: Ping timeout (120 seconds))
00:03:56*dtomato4 joined #nim
00:57:01FromDiscord<exelotl> I guess it's about preserving the good ergonomics of having 1 string type that everyone agrees on
00:57:08*neceve joined #nim
00:58:24FromDiscord<Elegantbeef> Think it was more that "no one needs strutils to be fast"
00:58:36FromDiscord<Elegantbeef> But i dont know
01:00:57FromDiscord<Elegantbeef> I dont see how it impedes though↵(@exelotl)
01:01:04FromDiscord<Elegantbeef> `openarray[char]` accepts `string`
01:02:44FromDiscord<Elegantbeef> The simple fact is that `openarray[char]` works on `array[char]` `seq[char]` `cstring` and `string` means it's just the best
01:03:12FromDiscord<Yepoleb> is string something different than just a renamed seq[char] internally?
01:03:47FromDiscord<Elegantbeef> Yes
01:03:51FromDiscord<Elegantbeef> It's a null terminated `seq[char]`
01:24:53FromDiscord<Goat> I completely forgot NimScript was a standalone thing that I could use instead of compiling these very small programs
01:28:10FromDiscord<Goat> sent a code paste, see https://play.nim-lang.org/#ix=4hVU
01:34:30FromDiscord<Elegantbeef> The compile times arent much for these small one-offs in my experience
01:37:47FromDiscord<exelotl> yeah nim is generally preferable to nimscript even for quick and dirty scripts (just as easy to use, and you don't have to worry about nimscript's limitations)
01:43:02FromDiscord<exelotl> I use nimscript as a task runner for my library, to read user config, set compiler options, and run certain tools pre-and-post build, all in a single invocation of the compiler (well actually I guess there's 2 invocations because `selfExec` works like that...)
01:43:24FromDiscord<exelotl> but even for this purpose it's kind of annoying because it has no facilities to check when a file was last modified
01:49:08FromDiscord<Elegantbeef> Maybe one day all the wanted procedures will be properly interoped 😄
01:49:37FromDiscord<Elegantbeef> Or we just use libffi
01:55:19FromDiscord<Yepoleb> is it hard to implement?
01:59:58*sagax joined #nim
02:04:04FromDiscord<Girvo> Are there any good references/libraries/implementations for high-perf vectorisation instruction usage in Nim?
02:08:06FromDiscord<auxym> simd stuff? mratsim is probably the local expert, you can have a look at his libs. also treeform shared this recently, looks like they are using SIMD in the latest pixie version: https://www.youtube.com/watch?v=Did21OYIrGI
02:08:33FromDiscord<auxym> not aware of good references though, I still have no idea how this black magic works
02:08:35FromDiscord<Girvo> Yeah 🙂 Though in this case its the weird Tensilica Instruction Extension SIMD instructions, but they're pretty similar
02:09:23FromDiscord<Girvo> The LX6/LX7 GCC fork doesn't really do auto-vectorisation very well, and the ESP32-S3 has a tonne of useful instructions I want to take advantage of. I'll check out their stuff, cheers!
02:54:32FromDiscord<Girvo> https://github.com/guzba/nimsimd is what Treeform seems to use in Pixie, interesting
02:54:57FromDiscord<Girvo> I could add support for the TIE set to it, neat
03:11:05FromDiscord<Yepoleb> In reply to @Girvo "https://github.com/guzba/nimsimd is what Treeform": Guzba is also a pixie dev
03:20:41*arkurious quit (Quit: Leaving)
03:28:58FromDiscord<voidwalker> https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint
03:31:58FromDiscord<voidwalker> calling withTimeout will get you a Future[bool] (owned, not sure what that is). How would I get the value of the Future then ? Like this ? https://github.com/waku-org/nwaku/blob/6811af328cfae8b23755faaf3a30dae5df15880e/tests/v1/test_waku_mail.nim#L49
03:32:11*ensyde joined #nim
03:33:14FromDiscord<voidwalker> Wouldn't be nicer if `withTimeout` wrapped the called Future's return value as well ?
03:45:24FromDiscord<Yepoleb> Just get the value from the future you wrapped
03:45:55FromDiscord<Yepoleb> At least i assume that's how it's intended to be used
03:46:45FromDiscord<voidwalker> yeah well I first have to assign it to another variable so that I can later read its value
04:25:55FromDiscord<Elegantbeef> It's for erroring
04:36:55FromDiscord<demotomohiro> @Girvo If there are no Nim libraries for simd instructions you want to use, I think you can import intrinsic functions in the same way as C functions if your C compiler provides intrinsic functions for simd.
04:39:38FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hWs
04:55:43FromDiscord<Girvo> In reply to @demotomohiro "<@823468778704076810> If there are": Yeah that's basically what I'm digging in to, it seems thats mostly what nimsimd does
04:57:27FromDiscord<Girvo> Though it seems the PIE instructions don't use intrinsics, more-so just straight assembly instructions!
05:00:01FromDiscord<Girvo> Whats the easiest way to find what intrinsics exist in a given GCC install?
05:01:41FromDiscord<Girvo> https://gcc.gnu.org/onlinedocs/gcc/Target-Builtins.html annoyingly the Xtensa stuff dosen't appear to be in here lol
05:03:34FromDiscord<Girvo> Oooh `-mdensity` will be useful. Unrelated to what I'm searching for, but useful
05:03:52FromDiscord<Girvo> To adjust my question then: are there any existing resources for handling assembly in Nim I should look at?
05:48:38*rockcavera quit (Remote host closed the connection)
05:54:09FromDiscord<Cheeseinator> i just found a really weird bug in nimpretty, every time it saves it doubles every indent, like it goes from 2 spaces to 4 and so on
05:55:39FromDiscord<ringabout> In reply to @Cheeseinator "i just found a": You mean like https://github.com/nim-lang/Nim/issues/21018
05:56:14FromDiscord<Cheeseinator> yeah
05:57:05FromDiscord<ringabout> You can add you case to the issue,
05:57:09FromDiscord<ringabout> (edit) "you" => "your"
06:04:03FromDiscord<Gumbercules> I don't think nimsimd uses the correct calling conventions in certain situations
06:04:24*ltriant quit (Ping timeout: 264 seconds)
06:04:34FromDiscord<Gumbercules> This is why I'm rolling my own simd linear algebra libt
06:04:42FromDiscord<Gumbercules> (edit) "libt" => "lib"
06:05:28FromDiscord<Gumbercules> Well, that among other reasons
06:19:08FromDiscord<Gumbercules> I guess `vmath` doesn't use `simd` which is another reason...
06:42:57*kenran joined #nim
06:44:35*kenran quit (Remote host closed the connection)
07:18:09FromDiscord<Gumbercules> seems that we're being increasingly forced into relying on exceptions
07:18:30FromDiscord<Gumbercules> looking at `std/json` there isn't a `parseJson` proc that doesn't raise....
07:20:30FromDiscord<Gumbercules> I guess I have to add another dependency to my project now...
07:24:21FromDiscord<voidwalker> speaking of exceptions, I haver never used them before. What is a good read about this subject ? I need to handle socket timeout in my code and no idea how to design it
07:25:51FromDiscord<Gumbercules> I only use exceptions when I am trying to deal with exceptional situations
07:26:03FromDiscord<Gumbercules> something I can expect to happen in my code that I am in control of - is not exceptional
07:26:11FromDiscord<voidwalker> I have this code to initialize connection `var (socket, connection_id) = await udpTrackerHello(tracker) ` - returns the connected socket with protocol initalization sent, and the connection_id
07:26:27FromDiscord<Gumbercules> if I'm dealing with an external service - like making HTTP requests to a server - I can't predict how the server will behave
07:26:33FromDiscord<Gumbercules> so in these situations exceptions make sense
07:26:42FromDiscord<Gumbercules> I don't need to use exceptions to handle errors from parsing JSON though....
07:27:10FromDiscord<voidwalker> Do I need to add a 3rd var to the tuple to handle the timeout ? Or do I use a magic value ? Or what kind of socket var to message it's not valid, as this is udp, so no .connected ?
07:27:44FromDiscord<voidwalker> Do I use the Option type (which I also never used) ? Or is there some special mehcanism to send exceptions between procs ?
07:27:56FromDiscord<Gumbercules> you can re-raise an exception
07:28:14FromDiscord<Gumbercules> maybe check out the tagged union library
07:28:19FromDiscord<Gumbercules> I find this a very nice way to deal with errors
07:28:26FromDiscord<Gumbercules> sorry the anonymous union lib I mean
07:28:36FromDiscord<Gumbercules> https://github.com/alaviss/union
07:30:19FromDiscord<voidwalker> but unions are already in nim, no ?
07:31:44FromDiscord<Gumbercules> tagged / discriminated unions / object variants are, and C-style unions are
07:32:00FromDiscord<voidwalker> welp, no idea about unions, never touched them
07:32:24FromDiscord<Gumbercules> anonymous unions are not and they can serve well for acting as an easy way to represent an error or lack of one
07:33:05FromDiscord<voidwalker> ok, so with exceptions, I have to do try: some code.. if bad condition: raise newException("blah blah"), and then except it ?
07:33:21FromDiscord<voidwalker> if I don't do except for it, I get a crash, right ?
07:35:19FromDiscord<Gumbercules> generally you will wrap some code that raises in a `try / except`
07:35:29FromDiscord<Gumbercules> in the `try` block you invoke whatever code potentially raises
07:35:41FromDiscord<Gumbercules> in the `except` block you deal with any exceptions which were raised
07:36:03FromDiscord<Gumbercules> there's an option `finally` block where you can do whatever else you might need to (closing file handles, etc...)
07:37:49FromDiscord<voidwalker> well the code I have does not raise anything. I use `withTimeout` proc to set a timeout to network event, and I want to "do something" when it times out
07:38:06FromDiscord<Gumbercules> sure you could raise there
07:38:39FromDiscord<voidwalker> simplest thing I could do, is just return an empty seq as result. Ideally I'd want the timeout signal to be passed along, for precision's sake, even though atm I have no use for this info
07:39:08FromDiscord<voidwalker> so I manually raise, and catch my raise.. that's funny
07:41:02FromDiscord<voidwalker> uhm, so then I do a `try myHelloProc` and `except` , in the proc that calls the timeout-able connection ?
07:41:27FromDiscord<Gumbercules> have you checked to see if the network call you're making doesn't already raise in the case of a timeout?
07:41:47FromDiscord<voidwalker> of course I did, sync sockets have built in timeout, async ones don't
07:42:06FromDiscord<voidwalker> withTimeout merely returns a bool
07:43:09FromDiscord<voidwalker> ok, let me give it a try and see what happens
07:43:51FromDiscord<voidwalker> I hope there's maybe a shorter solution with this.. otherwise all of my code will be full of try raise except:/
07:45:01FromDiscord<Gumbercules> don't use exceptions 🙂
07:45:15FromDiscord<voidwalker> use what then ?
07:46:06FromDiscord<Gumbercules> I'd have to see some code
07:46:07FromDiscord<voidwalker> maybe a macro can handle this timeout case in an uniform and shortened manner
07:46:33FromDiscord<Gumbercules> or at least have a better understanding of what procedures you're invoking and when
07:46:39FromDiscord<voidwalker> https://github.com/sgmihai/torrentim/blob/main/udp_tracker2.nim#L47
07:46:58FromDiscord<voidwalker> this is the state of the code now, no withTimeout, no error handling
07:48:01FromDiscord<Gumbercules> `withTimeout` says it returns a `Future[bool]` indicating whether it timed out or not
07:48:03FromDiscord<Gumbercules> isn't that enough?
07:52:37FromDiscord<voidwalker> well, I need to: 1. stop executing the rest of the proc as it's pointless. 2. return something to the caller proc to let it know we failed, and it should stop executing the rest of the code, and at least return @[] if not the fail itself
07:53:51FromDiscord<Gumbercules> so use an option type or anonymous union
07:54:04FromDiscord<Gumbercules> and then have an error enum or something
07:54:09FromDiscord<voidwalker> what would jesus (Araq) do ? : D
07:54:22FromDiscord<Gumbercules> Araq would probably use exceptions
07:54:51FromDiscord<voidwalker> I've no idea about the exception vs union consequences down the road
07:56:05FromDiscord<Gumbercules> https://flylib.com/books/en/2.254.1/stack_unwinding.html#:~:text=When%20an%20exception%20is%20thrown%20but%20not%20caught,to%20the%20statement%20that%20originally%20invoked%20that%20method.
07:57:05FromDiscord<Gumbercules> https://mattwarren.org/2016/12/20/Why-Exceptions-should-be-Exceptional/#:~:text=So%20we%20clearly%20see%20there%20is%20an%20extra,stack%2C%20the%20more%20work%20it%20has%20to%20do.
07:57:13FromDiscord<voidwalker> When an exception is thrown but not caught in a particular scope, the method-call stack is "unwound," and an attempt is made to catch the exception in the next outer try block. This
07:57:14FromDiscord<voidwalker> Ohhhhh
07:57:16FromDiscord<Gumbercules> Nim doesn't follow this advice - it uses exceptions everywhere
07:57:27FromDiscord<voidwalker> So I don't need to catch in the innermost proc.. otherwise it would not go further up
07:57:30FromDiscord<Gumbercules> well, in the stdlib anyawy
07:57:34FromDiscord<Gumbercules> (edit) "anyawy" => "anway"
07:57:38FromDiscord<Gumbercules> (edit) "anway" => "anyway"
07:57:50FromDiscord<Gumbercules> yeah but I mean - this doesn't always happen
07:58:43FromDiscord<voidwalker> so I guess a tracker has like a ~10+% chance of timeout or so, considering many torrents have trackers that have died, but their url is kept in the metadata for eternity
07:58:52FromDiscord<voidwalker> so not very exceptional
07:59:15FromDiscord<Gumbercules> it's more about the unpredictability of a certain error
07:59:20FromDiscord<Gumbercules> and how much control you have over what you're calling into
07:59:28FromDiscord<Gumbercules> timeouts are a good case for exceptions
07:59:46FromDiscord<Gumbercules> when it comes to something like calling out to a web server that you don't own
07:59:55FromDiscord<Gumbercules> or making a socket request to a server you don't control
08:00:11FromDiscord<Gumbercules> you have no idea how that external service is going to behave or what it will do, so the behavior you encounter may indeed be excpetional
08:00:24FromDiscord<Gumbercules> opening a file on your local filesystem - well you can pretty much guess every single error you might run into here
08:00:41FromDiscord<Gumbercules> these are not exceptional errors but instead very predictable ones and using exceptions is probably overkill
08:02:12FromDiscord<Gumbercules> same with parsing JSON which is what I originally made the comment about - I'd much prefer a `parseJson` overload that returns `nil` to being forced into exceptions (even though there are much better ways than to return `nil`)
08:02:31FromDiscord<voidwalker> timeout for torrent peers and torrent trackers is pretty common. I'd guess that at least 20%
08:03:26FromDiscord<Gumbercules> if you're already planning on blocking till the request times out or completes, I'd just inspect the returned future and then reuturn a value or an error
08:03:27FromDiscord<voidwalker> So if that article you linked has good advice, maybe exception is not the best idea
08:04:05FromDiscord<voidwalker> I wonder why "error" is not a built in return type for any proc
08:04:38FromDiscord<voidwalker> not sure how other languages do it.. as I don't have experience
08:04:57FromDiscord<Gumbercules> C lacks exceptions all together
08:05:29FromDiscord<Gumbercules> languages don't really dictate error handling patterns - they leave it up to the user
08:05:41FromDiscord<Gumbercules> most languages higher level than C feature exceptions
08:05:54FromDiscord<Gumbercules> but there's no reason you have to use them - it's not like it's forced on the programmer
08:06:10FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hX3
08:06:17FromDiscord<Gumbercules> `error` is not a built-in return type because not every call will produce an error
08:06:28FromDiscord<Gumbercules> pure functions cannot produce an error by definition
08:06:55FromDiscord<Gumbercules> I honestly don't think this is a bad place for exceptions
08:07:13FromDiscord<Gumbercules> even if the timeouts occur 20% of the time - you're still making a network request to a server you don't own
08:07:32FromDiscord<Gumbercules> the request might timeout - but you don't know why it timed out or the true reason for the failure, you just know your request timed out
08:08:54FromDiscord<Gumbercules> you shouldn't even need `withTimeout`
08:09:05FromDiscord<Gumbercules> according to async socket.sendTo - `If an error occurs an OSError exception will be raised.`
08:10:23FromDiscord<voidwalker> well, for sendTo udp, it's hard to get an error, maybe an OS error if there is no network at all or something
08:10:33FromDiscord<voidwalker> maybe fail to resolve
08:10:54FromDiscord<voidwalker> you get no error just sending data to a dead host
08:11:25FromDiscord<voidwalker> I think failing to resolve host will block it forever if I don't put timeout
08:11:58FromDiscord<Gumbercules> yeah - I've never used Nim's socket modules in the stdlib because tmk they're lacking
08:12:00FromDiscord<albassort> alright im back and asking for some assistance
08:12:10FromDiscord<albassort> how do i iterate over a carray
08:12:26FromDiscord<voidwalker> @Gumbercules what socket modules did you use then ?
08:12:31FromDiscord<albassort> ie a pointer to a single type which is actually an unchecked array of an unknown amount
08:12:34FromDiscord<Gumbercules> Enet
08:12:57FromDiscord<voidwalker> https://github.com/fowlmouth/nimrod-enet/ ?
08:13:10FromDiscord<Gumbercules> I wrapped it myself most likely but yeah
08:13:26FromDiscord<Gumbercules> I think treeform wrote a reliable upd socket lib but I can't speak to its correctness
08:13:50FromDiscord<voidwalker> yeah but with this "reliable" over udp, you expect both hots to use it, otherwise it's meaningless
08:13:59FromDiscord<albassort> because i have a ptr to an array of culong
08:14:00FromDiscord<Gumbercules> In reply to @albassort "ie a pointer to": cast it to a `ptr UncheckedAray[T]`?
08:14:02FromDiscord<voidwalker> so good for game server/client, useless otherwise
08:14:29FromDiscord<albassort> like that?
08:14:31FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hX4
08:15:40FromDiscord<Gumbercules> if it's a C array of unsigned longs then yes
08:16:10FromDiscord<albassort> alright so how do i convert it to a seq
08:16:16FromDiscord<albassort> i know the size
08:16:25FromDiscord<albassort> therapeutically... it is c
08:16:32FromDiscord<Gumbercules> @voidwalker pretty sure ENet's reliability feature is optional
08:16:39FromDiscord<albassort> (edit) "therapeutically..." => "theoretically c..."
08:16:51FromDiscord<albassort> beef said i need to alloc the size of the type
08:17:03FromDiscord<albassort> unless i misunderstood him
08:17:06FromDiscord<Gumbercules> `toOpenArray`
08:17:12FromDiscord<Gumbercules> then `toSeq`
08:17:28FromDiscord<Gumbercules> unless `toSeq` will accept a `ptr UncheckedArray[T]` but I dobut it
08:17:33FromDiscord<Gumbercules> (edit) "dobut" => "doubt"
08:18:05FromDiscord<albassort> ah
08:18:10FromDiscord<albassort> yep
08:18:14FromDiscord<albassort> thank you@!
08:18:16FromDiscord<albassort> (edit) "you@!" => "you!"
08:18:17FromDiscord<Gumbercules> np
08:18:23FromDiscord<Gumbercules> @voidwalker asyncnet doesn't work on windows either
08:18:29FromDiscord<voidwalker> what ? :\
08:18:44FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hX5
08:19:09FromDiscord<Gumbercules> pretty sure on windows they're blocking
08:20:41FromDiscord<voidwalker> I understood that on windows you can't work with all the "layers" of the asyncnet lib on windows
08:20:49FromDiscord<voidwalker> meaning you only get the higher level one ?
08:20:57FromDiscord<Gumbercules> no
08:21:05FromDiscord<EchoPouet> In reply to @starch "how do i use": The sunset of Atom is very closed, use VSCode -> https://github.blog/2022-06-08-sunsetting-atom/
08:21:12FromDiscord<Gumbercules> Nim has no non-blocking sockets for Windows
08:21:15FromDiscord<Gumbercules> it's been like this for quite some time
08:22:00FromDiscord<voidwalker> oh :\
08:22:16FromDiscord<voidwalker> That is quite unfortunate... they gonna fix, no ?
08:22:37*pro joined #nim
08:22:44FromDiscord<voidwalker> hm actually, I don't believe this
08:22:47FromDiscord<Gumbercules> I believe you could get away with using - https://nim-lang.org/docs/nativesockets.html
08:22:49FromDiscord<voidwalker> proof : P
08:23:02FromDiscord<Gumbercules> but you're not going to be able to use anything in the net / async net packages
08:23:45FromDiscord<Gumbercules> fine if you don't want to believe me
08:23:46*pro left #nim (#nim)
08:23:51FromDiscord<Gumbercules> (edit)
08:23:56FromDiscord<voidwalker> I am pretty sure I would have read it somewhere by now, it's a pretty big thing
08:24:11FromDiscord<Gumbercules> well you didn't know about unions so...
08:24:24FromDiscord<Gumbercules> and you didn't know about stack unwinding and exceptions
08:24:34FromDiscord<Gumbercules> I've been using Nim since 2015
08:24:46FromDiscord<Gumbercules> I might know a thing or two about the stdlib...
08:24:49FromDiscord<voidwalker> i just googled and there is nothing about this :\
08:24:52FromDiscord<Rika> gumberbacca is right
08:25:08FromDiscord<Rika> at least from my own memory, i believe it is right
08:25:21FromDiscord<Gumbercules> In reply to @voidwalker "i just googled and": yeah well google doesn't hold all the answers all of the time
08:25:31FromDiscord<Rika> especially with nim stuff lol
08:25:43FromDiscord<Rika> most of the stuff is here in this discord server and that doesnt get indexed by google
08:25:47FromDiscord<voidwalker> I mean, araq uses windows afaik, surely he'd not allow such an important feature to not work on windows
08:25:52FromDiscord<Rika> and discord search is ass
08:26:14FromDiscord<Gumbercules> maybe stop comparing him to Jesus and you'll be less surprised when things don't work 🙂
08:26:35FromDiscord<Gumbercules> I believe core devs have been fine with - go out and roll your own socket solution / bind to some C lib
08:26:42FromDiscord<Gumbercules> which is what most folks have done
08:27:39FromDiscord<Gumbercules> https://gitter.im/nim-lang/Nim?at=5b8e432cf5402f32aad6233e
08:27:44FromDiscord<Gumbercules> I was able to find an old gitter convo pretty quick
08:30:55FromDiscord<Elegantbeef> Also araq uses mac
08:33:03FromDiscord<voidwalker> why didn't anyone help him install linux ? :\
08:33:14FromDiscord<Elegantbeef> It's an m1 mac
08:33:34FromDiscord<voidwalker> asahi linux
08:35:29FromDiscord<Elegantbeef> Until recently you had 0 gpu acceleration
08:37:40FromDiscord<Gumbercules> If I remember, fowl wrote some pretty nice macros for working with enet
08:38:27FromDiscord<Elegantbeef> \I just wish we could get optionals with semantics of exceptions
08:38:30FromDiscord<Gumbercules> https://github.com/fowlmouth/nimrod-enet/blob/master/pkt_tools.nim
08:39:28FromDiscord<Gumbercules> gd that repo has a `.babel` file
08:39:31FromDiscord<Gumbercules> I forgot about that shit....
08:39:59FromDiscord<Gumbercules> back when nim was all biblican
08:40:03FromDiscord<Gumbercules> (edit) "biblican" => "biblical"
08:40:14FromDiscord<Gumbercules> (edit) "biblical" => "biblican"
08:40:16FromDiscord<Gumbercules> (edit) "biblican" => "biblical"
08:40:27FromDiscord<Gumbercules> alright I can't type anymore, type for bed 😄
08:40:40FromDiscord<Elegantbeef> type for bed?
08:40:48FromDiscord<Gumbercules> see???
08:40:51FromDiscord<Elegantbeef> What is this a shitty text adventure game
08:40:53FromDiscord<Gumbercules> ugh
08:41:06FromDiscord<Gumbercules> pretty much describes my life
08:41:08FromDiscord<Gumbercules> shitty text adventure game
08:41:21FromDiscord<Rika> luk 0
08:53:29FromDiscord<voidwalker> so what is your opinion Elegantbeef, on handling socket timeouts ? Use exceptions ?
08:53:58FromDiscord<Elegantbeef> I personally like exceptions but it's likely not the 'correct' way of handling it
08:54:47FromDiscord<voidwalker> ah wait, status has an articole on it, ima read it first https://status-im.github.io/nim-style-guide/errors.html
08:56:14FromDiscord<albassort> whats the best way of taking someones code, chopping it up, and putting it in your code
08:56:17FromDiscord<albassort> on a git level
08:56:20FromDiscord<albassort> do i fork it?
08:56:23FromDiscord<albassort> do i just copy it and credit?
08:56:40FromDiscord<albassort> i usually copy it and credit
08:57:07FromDiscord<Elegantbeef> I generally say fork
09:04:27FromDiscord<voidwalker> status seems to like using this lib : https://github.com/arnetheduck/nim-result
09:04:57FromDiscord<Gumbercules> that's because `arnetheduck` works at status
09:05:13FromDiscord<Gumbercules> but I mean - it's probably good
09:05:23FromDiscord<Gumbercules> just have no experience using it
09:05:25FromDiscord<Elegantbeef> I still dislike results, so invasive
09:07:43FromDiscord<albassort> actually
09:07:59FromDiscord<albassort> im just gonna extract the guts and leave
09:08:09FromDiscord<albassort> HORIZON
09:08:10FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "back when nim was": Biblical? How so?
09:08:13FromDiscord<albassort> HOW
09:08:15FromDiscord<albassort> HEWO
09:08:23FromDiscord<Gumbercules> the language was named Nimrod
09:08:23FromDiscord<albassort> they means it was old (?)
09:08:26FromDiscord<Elegantbeef> The name of the language was named nimrod the packagemanger babel
09:08:30FromDiscord<Gumbercules> the package manager was named babel
09:08:41FromDiscord<Elegantbeef> nimrod is the name of the 'first' king in the bible
09:08:42FromDiscord<albassort> i thought nimrod was a different thing
09:08:46FromDiscord<Horizon [She/Her]> In reply to @albassort "HEWO": Hi xD
09:08:50FromDiscord<albassort> HI XD
09:09:12FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "the language was named": Aah i remember hearing that ages ago, didn't it need to ge tchanged cuz people got angry?
09:09:19FromDiscord<voidwalker> they should have kept it nimrom.. nim is so hard to search for on youtube
09:09:21FromDiscord<Horizon [She/Her]> get changed
09:09:22FromDiscord<Gumbercules> no
09:09:26FromDiscord<voidwalker> (edit) "nimrom.." => "nimrod.."
09:09:42FromDiscord<Gumbercules> well maybe - I don't know, if people were offended by the name of a biblical king I think they have bigger issues than the naming of a programming language
09:10:02FromDiscord<Gumbercules> I believe it was probably the connotation that nimrod means stupid person in the West
09:10:16FromDiscord<Horizon [She/Her]> Ah
09:10:37FromDiscord<Gumbercules> not because people were offended about the biblical references
09:10:41FromDiscord<Elegantbeef> I'm relatively anti-religion, and I just find it inane 😄
09:10:45FromDiscord<voidwalker> what's wrong with stupid ?
09:11:00FromDiscord<Gumbercules> well the old testament predates religion
09:11:08FromDiscord<Horizon [She/Her]> I don't really follow religion, keep it away from me and y'all are gucci 👍
09:11:10FromDiscord<Gumbercules> but it's neither here nor there really
09:11:21*disso_peach quit (Quit: Leaving)
09:11:27FromDiscord<Elegantbeef> "predates religion"
09:11:31FromDiscord<Gumbercules> I mean - it works both ways
09:11:32FromDiscord<Elegantbeef> Yea we're going to leave that there
09:11:51FromDiscord<Gumbercules> I mean there were no organized religions when the old testament was authored, there were cults
09:12:05FromDiscord<Gumbercules> but the concept of religion emerged later
09:12:18FromDiscord<Gumbercules> or at least organized religions
09:12:43FromDiscord<Gumbercules> what one thinks of when they think of modern day Christianity / Judaism / Islam etc
09:13:32FromDiscord<Gumbercules> tower of babel dates back to Mesopotamia
09:13:46FromDiscord<Horizon [She/Her]> I wonder how hard it'll be to implement a basic python interpreter in Nim ngl
09:14:12FromDiscord<Horizon [She/Her]> Shouldn't be too hard in theory? (Famous last words)
09:14:18FromDiscord<Gumbercules> and the Babylonian kings so yeah - very much a different thing
09:14:59FromDiscord<Gumbercules> probably as hard as it would be in any other language
09:15:00FromDiscord<Elegantbeef> Sure but i consider many thousands of people believing in a belief system a religious organisation
09:15:09FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "probably as hard as": True
09:15:23FromDiscord<Elegantbeef> The old testament was only written in around 1000bce which isnt that far ago
09:15:23FromDiscord<Gumbercules> well it wasn't really a belief system then
09:15:46FromDiscord<Gumbercules> at least not according to theologians and historians
09:16:06FromDiscord<Gumbercules> Christianity had so many sects / cults back then
09:16:29FromDiscord<Elegantbeef> So many given it didnt even exist yet
09:16:32FromDiscord<Gumbercules> take the Gnostics for instance which is what I would classify my beliefs as being most closely aligned with
09:16:48FromDiscord<Gumbercules> well no one was running around calling it Christianity
09:17:17FromDiscord<Gumbercules> and many of the sects were persecuted by other sects that wanted their dogma to prevail
09:18:36FromDiscord<Gumbercules> the Gnostics were essentially snuffed out by the Christians who rose to power and founded the church
09:19:08FromDiscord<Gumbercules> and take the movie The Matrix for instance - it's steeped in Gnosticism but most wouldn't associate Christianity and religion with The Matrix
09:20:46*ltriant joined #nim
09:20:50FromDiscord<Elegantbeef> Sure but Ancient Greeks, Egyptians and Hinduism were established before or around the time Hebrews were also writing their book
09:20:58FromDiscord<Elegantbeef> So there was establish organised religion
09:21:02FromDiscord<Elegantbeef> But anyway this isnt Nim
09:21:05FromDiscord<Gumbercules> yeah
09:21:34FromDiscord<arkanoid> Nim is not religion? Sounds new to me
09:21:40FromDiscord<Gumbercules> I was a religious studies minor so I enjoy talking about it
09:22:07FromDiscord<Elegantbeef> It clearly is a religion a bunch of diluted individuals follow it's teachings and use it.
09:22:22FromDiscord<Gumbercules> when's the next crusade again?
09:22:35FromDiscord<Elegantbeef> I misplaced my chainmail you go on without me
09:22:55FromDiscord<Gumbercules> bout to burn some heathens
09:23:10FromDiscord<Elegantbeef> Nah keep them alive, can turn them into contributors
09:23:13FromDiscord<arkanoid> Writing AST in the heavens
09:28:45FromDiscord<Horizon [She/Her]> Used GitHub Actions to compile my Nim code for my website
09:29:48FromDiscord<Rika> wtf gumberbacca why tf you still awake
09:29:53FromDiscord<Rika> didnt you say it was type for bed
09:29:57FromDiscord<Gumbercules> yeah this is a good question
09:30:02FromDiscord<Gumbercules> it was and then it wasn't 😦
09:30:10FromDiscord<Rika> story of everyone's life
09:30:15FromDiscord<Rika> "im gonna sleep in a bit"
09:30:19FromDiscord<Rika> "just one more"
09:30:28FromDiscord<Rika> "itll be quick i promise"
09:30:37FromDiscord<Rika> and other lies we tell ourselves
09:30:41FromDiscord<Gumbercules> seriously closing the laptop now though, baby is probably going to wake up any minute and I am woefully unprepared
09:30:46FromDiscord<Gumbercules> cya all later
09:30:56FromDiscord<Rika> yes the baby will force you to know when to sleep
09:31:00FromDiscord<Rika> because otherwise you will never sleep
09:31:04FromDiscord<voidwalker> eek, added `try: ` block to handle shitty timeouts.. variables declared there are not visible outside the block :\
09:31:08FromDiscord<voidwalker> this is going to totally ruin my linecount
09:31:13FromDiscord<Rika> actually what am i saying you're never gonna sleep even if you wanted to
09:32:55FromDiscord<Horizon [She/Her]> In reply to @voidwalker "eek, added `try: `": Can't you just define them before the try block?
09:33:04FromDiscord<voidwalker> yeah +1 lines of code 😦
09:33:15FromDiscord<Horizon [She/Her]> Do they need to be visible outside the block?
09:33:21FromDiscord<Horizon [She/Her]> In reply to @voidwalker "yeah +1 lines of": Not that bad
09:33:31*ltriant quit (Ping timeout: 248 seconds)
09:33:38FromDiscord<Horizon [She/Her]> Could be worse
09:33:43FromDiscord<Horizon [She/Her]> ~~Like being JS~~
09:33:54FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hXm
09:33:58FromDiscord<voidwalker> yeah but it totally defeats the purpose of using nim : P
09:34:20FromDiscord<voidwalker> could they not make a try variant that did not create a new scope ?
09:35:25FromDiscord<Horizon [She/Her]> In reply to @voidwalker "could they not make": Iirc i think defer did that? But is being removed because of the issues it causes
09:36:43FromDiscord<voidwalker> ok so I raise the exception in the `updTrackerHello` proce. I thought I did not need to catch it there, so that it gets pushed up the stack to the caller proc
09:36:57FromDiscord<voidwalker> where I have the try except.. but program just closes with the exception ?
09:37:16FromDiscord<voidwalker> Do I need to use that pragma for exceptions , raises?
09:37:16FromDiscord<Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4hXn
09:37:18FromDiscord<Horizon [She/Her]> Looks more readable imo
09:37:31FromDiscord<Horizon [She/Her]> In reply to @voidwalker "Do I need to": Nope but it's good for documentation
09:37:42FromDiscord<voidwalker> then what am I doing wrong ? :\
09:37:46FromDiscord<Horizon [She/Her]> I think so, at least (but it isn't needed)
09:38:02FromDiscord<voidwalker> do I need to catch it in all places so it does not crash the program?
09:38:05FromDiscord<Horizon [She/Her]> In reply to @voidwalker "where I have the": Maybe because the connection isn't handled properly?
09:38:35*anddam quit (Quit: WeeChat 3.7.1)
09:38:38FromDiscord<Horizon [She/Her]> In reply to @voidwalker "do I need to": Any places it may raise an error probably, but shouldn't be needed if it should be running without issue
09:38:42FromDiscord<voidwalker> well yeah, that's the whole idea, I am using an unresponsive host to test the timeout case
09:38:50FromDiscord<Horizon [She/Her]> Ah
09:39:21FromDiscord<voidwalker> which will happen a lot in a p2p program..
09:41:48FromDiscord<voidwalker> well, what do you know.. if I catch inside the inner/called proc, then there is no exception when it returns
09:42:45FromDiscord<voidwalker> ah nvm, I was writing the code in the wrong proc ;\
09:57:19FromDiscord<voidwalker> uhm, it seems that if I do `return` in the except block, the exception is not passed up. without return, it is. But if I don't return, the proc continues executing, encountering a real exception this time.
09:58:16*GreaseMonkey quit (Remote host closed the connection)
09:59:54*greaser|q joined #nim
10:00:21FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=
10:04:07FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hXu
10:06:55FromDiscord<voidwalker> I shortened it to this, since I don't really need an except block if I'm only going to raise it again ?
10:07:02FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hXv
10:07:43FromDiscord<voidwalker> but like this, it doesn't trigger the except in the calling proc. Unless I add a `raise` before return. But I have no except here, what is consuming it ? :\
10:23:26FromDiscord<Rika> thats fucked
10:23:27FromDiscord<Rika> lmao
10:37:47*disso_peach joined #nim
10:41:36*ltriant joined #nim
10:44:04NimEventerNew thread by drkameleon: Get time at compile-time, see https://forum.nim-lang.org/t/9698
10:47:08FromDiscord<voidwalker> well, code works, I am getting empty result all the way to the top. I certainly do not like the number of lines needed. certainly I am doing something wrong.
10:53:36FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hXC
10:56:53FromDiscord<voidwalker> before having to add timeout, I had just `let resp = await socket.recvFrom(UDP_MAX_SIZE)`
11:04:40*jmdaemon quit (Ping timeout: 256 seconds)
11:14:31*neceve quit (Ping timeout: 268 seconds)
12:04:55FromDiscord<ghkdgfs> can you enumerate a openArray without using a for loop?
12:24:10FromDiscord<planetis> std/enumerate only works in loops
12:24:37FromDiscord<planetis> write your own, the way sequtils works
12:49:24*rockcavera joined #nim
12:51:17FromDiscord<juelix> I currently have an older version of nim installed and would like to install a newer version of nim. Is there any way to remove the old version of nim and install the new version of nim I am using windows 11.
12:55:51FromDiscord<fbpyr> @juelix\: I like chocolatey for keeping nim up to date on win
13:01:34FromDiscord<juelix> In reply to @fbpyr "<@996411185933066301>\: I like": I don't understand your reply to ...... Do you mean that chocolatey is a clue to my question? Or is it just a bunch of bot nonsense?
13:09:37FromDiscord<Rika> chocolatey is a package manager for windows
13:09:59FromDiscord<Rika> how did you first install nim
13:12:21FromDiscord<locria> Is there a `echo` that puts space in between?
13:13:27FromDiscord<juelix> In reply to @Rika "how did you first": Not an exact recollection, but maybe I installed from choosnim.
13:14:17FromDiscord<locria> In reply to @ghkdgfs "can you enumerate a": zero_functional
13:16:03FromDiscord<fbpyr> sorry, I should have typed the whole url\: https://chocolatey.org↵@Rika thx for hinting↵(@juelix)
13:18:55FromDiscord<fbpyr> @juelix\: so with that package manager one can install nim via powershell\:↵`choco install nim`↵listed here\: https://community.chocolatey.org/packages?q=nim↵to update all choco installed packages\: `choco upgrade all` - quite convenient. 😌
13:19:49FromDiscord<fbpyr> but I guess the official answer is `choosenim`↵(which funnily enough is also available via choco 😉 )
13:21:20FromDiscord<fbpyr> on a win-machine,↵● where I always want the latest I go choco -\> nim↵● if I want to be able to switch nim versions I woulg use choco -\> choosenim -\> nim
13:21:49FromDiscord<pmunch> If you first installed from choosenim then you simply run \`choosenim update stable\`
13:28:59FromDiscord<Require Support> for threading: is it still fine to use `spawn` or is there a newer/better way of doing things?
13:30:24*pro joined #nim
13:33:06*pro left #nim (#nim)
13:45:14NimEventerNew question by Andrea T.: Nim/Nimble: How to enable --threads:on only for files using it?, see https://stackoverflow.com/questions/74717623/nim-nimble-how-to-enable-threadson-only-for-files-using-it
14:09:40*anddam joined #nim
14:11:55FromDiscord<jtv> @locria I would assume the print macro from https://github.com/Yardanico/nimpylib would add in the space. Would be easy to do if not
14:17:28*derpydoo joined #nim
14:25:13FromDiscord<juelix> In reply to @fbpyr "sorry, I should have": Thanks to you and Rika for your kind and prompt replies! I was able to fix that problem!
14:25:29FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hYt
14:25:43FromDiscord<Gumbercules> Not sure why you have it wrapped in one to begin with....
14:26:35FromDiscord<Gumbercules> In reply to @NimEventer "New question by Andrea": That's not how it works...
14:30:28FromDiscord<Gumbercules> The question should have been how do I build multiple binaries using nimble and only have one utilize threading.
14:31:53FromDiscord<Gumbercules> And the answer is - you probably can't unless your source resides in different directories. This is a nimble issue though....
14:40:48FromDiscord<Zoom> How can you overload `system.echo`? If I use `a: varargs[untyped]` for the args the overload is unused.
14:46:46FromDiscord<jtv> Per the docs, its signature is `proc echo(x: varargs[typed, `$`]) `
14:48:58FromDiscord<Zoom> Yeah, but if I use it somehow styledWrite writes an arg seq out
14:52:10FromDiscord<starch> In reply to @auxym "`subprocess.run("yourNimExec.exe")`": my nim is a nim file
14:52:13FromDiscord<Rika> i dont understand your question
15:01:08FromDiscord<auxym> (if it's a nim source file, you have to compile it before running it)
15:01:09FromDiscord<auxym> sent a code paste, see https://paste.rs/dbH
15:05:12FromDiscord<juelix> What are some examples of programs that would benefit greatly from using nim over other languages (e.g. DB related, web app creation, etc...)? What are some examples?
15:07:02FromDiscord<juelix> I can't imagine what I could make from them, even looking at nim's tutorials.
15:09:51FromDiscord<Gumbercules> I mean, you can ask that question about any language I guess
15:10:00FromDiscord<Gumbercules> it's kind of an odd one....
15:10:07FromDiscord<jtv> Yeah, Nim's documentation could be more inspiring, but it's got most of the flexibility of a Python, while being about as fast as C. So most things would benefit greatly. If you value readability in particular, then unless you are okay with Python, you're going to be hard pressed to find better options
15:11:05*kenran joined #nim
15:11:43FromDiscord<juelix> In reply to @Gumbercules "I mean, you can": I definitely continue to think so when I see tutorials in any language.
15:12:37FromDiscord<Gumbercules> A better question is what are Nim's strengths / weaknesses and how does it compare to a language you're familiar with the features and semantics of
15:12:49FromDiscord<Gumbercules> or how does Nim compare to language X
15:12:58*kenran quit (Remote host closed the connection)
15:13:07FromDiscord<Gumbercules> programs don't benefit greatly from using one language or another generally
15:13:09FromDiscord<Gumbercules> languages are designed to fit well into certain problem domains
15:13:59FromDiscord<Gumbercules> Nim is pretty flexible - while it is intended to be a systems programming language many people perform application and web development using it
15:14:26FromDiscord<Gumbercules> it can compile to C/C++, Objective-C and JavaScript
15:14:46FromDiscord<auxym> In reply to @jtv "Yeah, Nim's documentation could": Other advantage compared to python: compiles compiles to a single, standalone executable file. So when distributing a nim program, you don't depend on the user having a complicated environment setup (python version, tons of 3rd party libs with different versions, etc). Python distribution is a real pain.
15:16:47FromDiscord<jmgomez> In reply to @juelix "What are some examples": FullStack apps or Games too
15:16:56FromDiscord<jtv> IDK, I have long found that language choice can make a huge difference. Otherwise, there wouldn't be so much diversity in languages. For instance, Python is often very, very fast for getting something working, but tough for real production code due to how few errors get identified statically, and the fact that it is super slow
15:17:52FromDiscord<jtv> Whereas C not only has security issues, but the ecosystem sucks, people often rewrite a lot of their basic tools from the ground up every time.
15:18:03FromDiscord<jtv> 🤷
15:25:02FromDiscord<Rika> In reply to @jtv "Whereas C not only": :kannakms:
15:27:56FromDiscord<jtv> It's funny, despite always knowing all that, they've been my two goto languages for more than 25 years, even though I tried to like Go. I wish I hadn't just last month found out about Nim :/
15:32:08FromDiscord<juelix> Due to my lack of knowledge and imagination, I can basically only use libraries and such to create something, but if libraries and Websites with information are not as plentiful as nim currently is, how do you create something?(Please forgive my rudeness to the developers and others involved.)
15:33:22FromDiscord<juelix> In reply to @jtv "It's funny, despite always": I am amazed and respectful that you have been able to continue for 25 years!
15:33:38FromDiscord<jtv> Well, the standard library documentation is okay, and it's easy to find packages available through the nimble package manager, and you can search the package directory here: https://nimble.directory/
15:33:49FromDiscord<jtv> Yes, I am old.
15:34:10FromDiscord<jtv> 🧓
15:35:11FromDiscord<juelix> In reply to @jtv "Well, the standard library": I've never heard of this search feature before! I appreciate it very much!
15:54:35FromDiscord<exelotl> I've only just recently been getting into Python. The dynamic typing sucks but the ecosystem (flask, sqlalchemy, jinja, sphinx, pygments, pelican, etc.) is just fantastic
15:55:20FromDiscord<jtv> Yup, it's got such a big community, there's a lot to be said for it.
15:58:10FromDiscord<exelotl> it's basically become my fallback for when I can't find something that suits my needs in Nim (where rolling my own would be too much work). I've ended up using it for documentation, slideshows, static sites, and hosting a forum
16:00:45FromDiscord<jtv> I've long used it as a calculator, essentially. I could almost live with it as my login shell 🙂
16:01:27FromDiscord<Rika> fish shell has `math` command lol
16:01:41FromDiscord<Rika> In reply to @jtv "I've long used it": there is actually a shell with that ideology
16:01:53FromDiscord<leetnewb> xonsh?
16:01:56FromDiscord<Rika> yes
16:03:05FromDiscord<leetnewb> I usually install fish and forget it's there.
16:35:57FromDiscord<rakgew> yep xonsh is pretty cool.↵my `.xonshrc` reads much nicer than my `.bashrc`
16:40:05FromDiscord<rakgew> for nim docs, is there a way to not only show the local offline html documentation from `nim_install_dir/doc/html` , but to access docs from packages installed with nimble?
16:43:01FromDiscord<Phil> In reply to @juelix "Due to my lack": Boy do I got a package idea for your
16:45:40FromDiscord<Phil> sent a long message, see http://ix.io/4hZC
16:45:57FromDiscord<Phil> (edit) "http://ix.io/4hZC" => "http://ix.io/4hZD"
16:49:00FromDiscord<Phil> The currently best approach I've seen is basically compiling the project as part of the test, running the binary, waiting until the server itself reacts to anything and the using httpclient to try out all sorts of different scenarios
16:49:17FromDiscord<Phil> (edit) "the" => "then"
16:50:43FromDiscord<Phil> Which is fine, just annoying to code yourself when e.g. the entire compile thing, running and waiting for a response could be in a package, as well as maybe some utilitie templates for asserting contents or other properties of the response
16:53:55FromDiscord<Phil> Nimja could actually also use some tooling for testing
16:54:48FromDiscord<Phil> Something that simplifies the entire process of "given this template and this input data, it should render this html"
16:55:31FromDiscord<jtv> Phil, why haven't you done it yet then? 🙂
16:56:28FromDiscord<Phil> Because I'm working on an admin area package for prologue called snorlogue that basically replicates the admin area from Django without the authentication
16:56:55FromDiscord<Phil> Those ideas are basically on my "do next" list when I get to it
16:57:06FromDiscord<Phil> Days just don't have enough hours!
16:57:36FromDiscord<jtv> Sounds cool, tho I am not even a little bit a UI person
16:57:57FromDiscord<Phil> I mostly responded because op sounded like he couldn't think of a package that could be useful
16:58:20FromDiscord<Phil> And those two ideas for example would have a fair bit of practical benefits
16:58:37FromDiscord<Phil> Since e.g. nimja is used a fair bit
17:00:10FromDiscord<jtv> Oh, I took it more to mean they only build programs that are typing together pretty mature components
17:02:56FromDiscord<Phil> Not too unlikely I read it wrong, I'm on the go and on the phone and I read terribly on this thing since the environment demand some attention at least
17:37:01FromDiscord<guttural666> does Nim do stack unwinding with try and except?
17:39:15FromDiscord<jtv> Do you mean, does it deal with proper clean-up? Yes.
17:41:05FromDiscord<guttural666> yeah, something like c++ does, like deleting the constructed objects, the manual says nothing about it
17:41:08FromDiscord<ShalokShalom> In reply to @exelotl "I've only just recently": It's gradually typed and you can actually infer types
17:41:25FromDiscord<ShalokShalom> https://github.com/google/pytype
17:43:12FromDiscord<exelotl> yeah that's good until you find yourself in a situation where the tools can't infer the types anymore
17:44:27FromDiscord<guttural666> because my result here still seems to retain previously entered correct entries, e.g. with an input of 0, pls in answer, I still get a returned value of @[0] https://media.discordapp.net/attachments/371759389889003532/1050105521757233322/image.png
17:46:24FromDiscord<guttural666> maybe because the result is not constructed in the try block? anyway, just gonna delete the entries myself 😛
17:52:32FromDiscord<guttural666> how can I enforce i to be a Natural in this loop so the compiler does not complain (seq.del(i) expects a Natural) https://media.discordapp.net/attachments/371759389889003532/1050107552945414244/image.png
17:55:28FromDiscord<Michal Maršálek> When did `[]` on Tables using a nonexistant key changed to throwing an error? And why?
17:57:55*Phytolizer joined #nim
17:58:15Phytolizeranyone know of a tool/macro i can use to trace all function calls with their arg values and return values in nim?
18:03:21FromDiscord<guttural666> tough questions all around an no good samaritan to answer them
18:04:00FromDiscord<exelotl> In reply to @guttural666 "how can I enforce": you are looping over an array which contains 1 element, the slice "0 .. result.len-1"
18:04:55FromDiscord<exelotl> if you get rid of the [] it should loop over the slice instead, which looks like what you want?
18:05:21Phytolizer@michal, probably because `[]=` will construct the value if it doesn't exist, so `[]` could be promoted to an error. i'm assuming that before it would construct the element?
18:06:06FromDiscord<guttural666> In reply to @exelotl "you are looping over": i'm actually constructing an array here, am I n ot?
18:06:37Phytolizerit's an array of 1 element, the slice
18:06:59Phytolizere.g. `[1..2]` is `[1 .. 2]: array[0..0, HSlice[system.int, system.int]]`
18:07:51FromDiscord<guttural666> have to read up on slices
18:08:07FromDiscord<guttural666> it did compile, so mille grazie
18:08:13FromDiscord<jtv> Guttural, the result variable doesn't get cleaned up, its in scope for the whole function
18:08:29FromDiscord<jtv> So if stuff gets added to it before your exception gets thrown, it will be there
18:09:04FromDiscord<scruz> In reply to @guttural666 "have to read up": Are you looking for `range()`
18:09:13FromDiscord<jtv> Even in C++ it would do that; exceptions only clean up things going out of scope
18:09:52FromDiscord<guttural666> In reply to @jtv "Even in C++ it": yeah, I'm not the biggest expert in exceptions in c++ as well, never used them really, just trying to piece this together
18:10:24FromDiscord<scruz> In reply to @scruz "Are you looking for": https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#Ranges
18:11:38FromDiscord<guttural666> In reply to @scruz "https://github.com/nim-lang/Nim/wiki/Nim-for-Python": I've written 3 functions in Python in my life haha
18:11:52FromDiscord<Michal Maršálek> In reply to @Phytolizer "@michal, probably because `[]=`": I like the change but at the same time, I'd like to see another type that would be the variation of Python's defaultdict (maybe making the default value static? `DefaultTable[K, V; Default: static V]`)
18:12:20FromDiscord<Gumbercules> In reply to @guttural666 "yeah, I'm not the": stack unwinding only happens if you allow the exception to bubble up
18:12:45FromDiscord<guttural666> In reply to @Gumbercules "stack unwinding only happens": yeah, and I think that seems to be similar to c++ then? if I read up on that correctly
18:12:54Phytolizermichal, you mean like getOrDefault? https://nim-lang.org/docs/tables.html#getOrDefault%2CTable%5BA%2CB%5D%2CA%2CB
18:12:55FromDiscord<Gumbercules> pretty much in any language that features exceptions
18:12:58FromDiscord<guttural666> if I handle shit locally, it doesn't unwind
18:13:03FromDiscord<Gumbercules> right
18:13:11FromDiscord<guttural666> In reply to @Gumbercules "pretty much in any": thanks for the insight
18:13:16*Phytolizer quit (Remote host closed the connection)
18:13:37*Phytolizer joined #nim
18:13:48FromDiscord<guttural666> how good / bad are exceptions in Nim? people get butthurt over c++'s regularly
18:14:03FromDiscord<guttural666> they are interoperable to them I learned
18:14:20FromDiscord<Gumbercules> I think the problem with exceptions is they're easily abused and misused
18:14:36FromDiscord<Gumbercules> exceptions should be reserved for exceptional scenarios - situations in your code where you cannot predict the outcome
18:14:37Phytolizerthis isn't quite defaultdict because you can't provide what the default should be except at each call, (you can omit it but it'll just be "zeroed"), but it's close
18:14:47FromDiscord<guttural666> expesive to trigger as well I would assume
18:15:18FromDiscord<Gumbercules> so like - making a request to an external web service - good idea to wrap that in an `try/except` block and have your http client raise if it fails to make the request successfuly
18:15:38FromDiscord<guttural666> would there be a better way to handle this, if the user inputs bs in my case? i can't really tell https://media.discordapp.net/attachments/371759389889003532/1050113371460083782/image.png
18:15:40FromDiscord<Gumbercules> opening a file on a local filesystem - you can easily predict what might go wrong here and it's not going to be an exceptional scenario ever
18:15:46FromDiscord<guttural666> answer is readLine(stind)
18:16:03FromDiscord<Michal Maršálek> In reply to @Phytolizer "michal, you mean like": No, I mean like Python's defaultdict, where you don't need to specify the default each time.
18:16:09FromDiscord<guttural666> I want a list of ints
18:16:18FromDiscord<Gumbercules> if any of that code potentially raises - it's a good idea to wrap it in a try/catch like you are doing
18:16:32Phytolizermichal, yes i hear you. read my previous message, it's close but not exactly the same
18:16:32FromDiscord<Gumbercules> if it doesn't raise, there's no need
18:17:03FromDiscord<Gumbercules> I wish Nim treated errors as values and allowed users alternatives to stdlib procs that raise but this isn't the case
18:17:06Phytolizerif you say `someTable.getOrDefault("some key")`, you'll get a default constructed value if none exists in the map
18:17:06FromDiscord<Gumbercules> at least not everywhere
18:17:06FromDiscord<guttural666> In reply to @Gumbercules "if it doesn't raise,": I mistype, so I guess it's valid here haha 🙂 thanks for the guidance
18:17:28FromDiscord<Gumbercules> status.im has a pretty decent write up on exceptions that someone shared yesterday, let me find it
18:17:38FromDiscord<Gumbercules> https://status-im.github.io/nim-style-guide/errors.html
18:17:45FromDiscord<Michal Maršálek> In reply to @Phytolizer "if you say `someTable.getOrDefault("some": yes, but you cannot configure the value
18:17:48FromDiscord<guttural666> In reply to @Gumbercules "status.im has a pretty": always eager to learn, thanks!
18:18:00FromDiscord<Gumbercules> anytime!
18:18:45Phytolizermichal, right, but by that logic the old `[]` behavior couldn't have been configured either, no?
18:18:59FromDiscord<Gumbercules> you can actually
18:19:04FromDiscord<IsaacPaul> Imo, If it's not every frame it's exceptional.
18:19:09FromDiscord<Gumbercules> `table.getOrDefault(table, key, defaultVal)
18:19:14FromDiscord<Gumbercules> (edit) "defaultVal)" => "defaultVal)`"
18:19:16Phytolizeryes, we are discussing that function
18:19:36FromDiscord<Gumbercules> yeah I'm saying you can provide a default there
18:19:52FromDiscord<Michal Maršálek> In reply to @Gumbercules "yeah I'm saying you": I must be really bad at expresing myself 😄
18:19:55Phytolizeras did i, but michal is asking about a type where you need not provide a default more than once
18:19:55FromDiscord<Gumbercules> maybe I'm misunderstanding the convo, if I am I apologize
18:20:02FromDiscord<Gumbercules> no it's probably just me
18:20:05FromDiscord<Gumbercules> ah I see
18:20:16FromDiscord<Michal Maršálek> I'm writing an impl of what I mean
18:20:18FromDiscord<Michal Maršálek> rn
18:20:20FromDiscord<Michal Maršálek> thold on
18:20:57Phytolizerit is probably not *too* difficult to handroll a default dict around a Table
18:21:15FromDiscord<Gumbercules> In reply to @IsaacPaul "Imo, If it's not": I don't get this - it has less to do with how often an error occurs an more about your ability to predict it
18:21:25FromDiscord<guttural666> In reply to @Gumbercules "https://status-im.github.io/nim-style-guide/errors.": it's crazy how something so seemingly trivial can result in decades long discussions
18:21:32FromDiscord<Gumbercules> I don't control an external service and I can't realistically predict what it might do
18:21:51FromDiscord<Gumbercules> if I open a file - nothing there that could happen is really exceptional
18:22:06FromDiscord<IsaacPaul> In reply to @Gumbercules "I don't control an": I can't realistically predict what my code will do on another machine.
18:22:31FromDiscord<IsaacPaul> > if I open a file↵Permission error for example
18:22:38FromDiscord<Gumbercules> that's predictable
18:23:16FromDiscord<Gumbercules> as opposed to - this person could return some crazy status code I've never heard of, break all sorts of common convention and do something really strange with their handling of this web request
18:23:30FromDiscord<IsaacPaul> That's also predictable
18:23:32FromDiscord<Gumbercules> they might not even serve the request
18:23:33FromDiscord<Gumbercules> not really
18:23:42FromDiscord<Gumbercules> not if the person is inventing things on the other end
18:23:55FromDiscord<Gumbercules> you know what potential errors might arise from a syscall
18:23:57FromDiscord<IsaacPaul> You can't parse or understand the request. That can be predicted.
18:24:18FromDiscord<IsaacPaul> Some guy breaks the server by mistyping 404. You can still handle it
18:24:20FromDiscord<Gumbercules> I'd still be able to parse a response with a bad HTTP code - what that bad HTTP status code indicates though and what I'm supposed to do about it....
18:24:32Phytolizergumbercules, that is like saying the user typing 35 control characters at the prompt is unpredictable. of course it is predictable
18:24:45Phytolizerthe question is, do you want to be that careful
18:26:21FromDiscord<Gumbercules> the difference is you control the syscall to open the file
18:26:31FromDiscord<Gumbercules> you don't control what happens to the web request once it leaves your client and another server handles it
18:26:40FromDiscord<Gumbercules> you know exactly what errors the syscall might raise
18:26:40Phytolizeryou do control how you handle the response, though
18:26:43FromDiscord<Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=4i00
18:27:11FromDiscord<Gumbercules> right - but you cannot reasonably predict all of the outcomes from a web request and what they might mean
18:27:18FromDiscord<Gumbercules> or infer
18:27:30FromDiscord<Gumbercules> just like you can't do this with a database call
18:27:45FromDiscord<Gumbercules> which is why in these contexts exceptions make sense - because the other end of the call is unpredictable
18:28:15FromDiscord<Gumbercules> it's very different from invoking a function where it's specifically and explicitly going to potentially result in this set of errors
18:28:51FromDiscord<Gumbercules> and errors should be values anyway
18:28:55Phytolizerthe only difference is between that of a parse error and a kernel error code.
18:29:14FromDiscord<jtv> Generally I'd parse and deal with the error on the parsing seprately from the dict insertion / removal. Much more obvious code, and then doesn't need an exception
18:29:24Phytolizeryou could use that as justification for a JSON parser throwing an exception on invalid input, but should you?
18:29:44FromDiscord<Gumbercules> no because that's easily predictable
18:29:49FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1050116939449634836/boromir_software_error_handling.jpg
18:30:01FromDiscord<Gumbercules> you're writing a JSON parser you should assume your parser is going to encounter bad input
18:30:11Phytolizerin the same was as a server sending back gibberish is predictable
18:30:15Phytolizerwhy trust a server so much?
18:30:40Phytolizerwhat if the connection encounters a hiccup? should your program crash?
18:30:42FromDiscord<IsaacPaul> In reply to @IsaacPaul "Imo, If it's not": My point is you don't know what issues your users experience if you simply ignore errors and pretend as if everything is fine.↵↵So either use exceptions or a result type. A malformed http request can fit into either of those. But imo exceptions or result accomplish the same function. Communicating failure.
18:31:08FromDiscord<Gumbercules> In reply to @Phytolizer "what if the connection": well this is why you'd leverage exceptions in that scenario, because it's an exceptional outcome
18:31:29FromDiscord<Gumbercules> so no your program shouldn't crash
18:31:38Phytolizerand the user unplugging their hard drive resulting in a bunch of file open errors isn't?
18:31:44FromDiscord<Gumbercules> you'd have a tough time fitting all of the various errors that COULD occur into a result type for a web request
18:31:56FromDiscord<IsaacPaul> Most things that don't follow the 'happy path' really couldn't care less about how heavy an exception is.
18:32:28FromDiscord<Gumbercules> In reply to @Phytolizer "and the user unplugging": no because file open operations can only result in a small set of predictable errors
18:32:38FromDiscord<Gumbercules> file doesn't exist
18:32:40FromDiscord<Gumbercules> permissions are bad
18:32:58Phytolizerok and an HTTP response only has a few errors: read failure, invalid response, a few others im sure
18:33:04FromDiscord<Gumbercules> no....
18:33:27FromDiscord<Gumbercules> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
18:33:41FromDiscord<IsaacPaul> Http has a load of stuff. For example the ssl could fail somewhere in the socket connection depending on the implementation
18:34:07FromDiscord<IsaacPaul> (edit) "in" => "above"
18:34:11Phytolizersure but there are a few generic categories that all errors fall into. a valid-but-error status code is different from an invalid status code
18:34:24Phytolizerbut an ssl error and a connection drop are in a similar category
18:34:38FromDiscord<Gumbercules> but should probably be handled differently
18:34:45FromDiscord<Gumbercules> if you can't open a file - you can't open a file
18:35:10FromDiscord<Gumbercules> if the request fails (not due to SSL issues) you might want to retry it
18:35:23Phytolizerbut i thought that was exceptional according to your rules
18:35:24FromDiscord<Gumbercules> if it's an SSL error you might just give up
18:36:19FromDiscord<Gumbercules> what the external service might do is unpredictable and therefore could cause an exceptional error in your program yes
18:36:38FromDiscord<Gumbercules> I never said that every error was unpredictable
18:36:52FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4i03
18:37:11FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4i03" => "https://play.nim-lang.org/#ix=4i04"
18:37:45FromDiscord<Gumbercules> https://medium.com/continuousdelivery/exceptional-exceptions-5110671b3028
18:38:02FromDiscord<Gumbercules> this has been written to death about - if I was the only person advocating this stance I might feel like continuing the debate
18:38:27FromDiscord<voidwalker> oh yeah, I wanted to ask. now I get a stack trace every time there's an exception. Does that happen on --release compile as well ?
18:38:31FromDiscord<Gumbercules> https://www.gingerbill.org/article/2018/09/05/exceptions-and-why-odin-will-never-have-them/
18:39:10FromDiscord<voidwalker> I read there is some compute overhead in generating the stack trace, that's why I ask
18:39:10FromDiscord<Gumbercules> https://medium.com/geekculture/effective-java-use-exceptions-for-only-exceptional-circumstances-6e4762b5ebc2#:~:text=All%20this%20being%20the%20case%2C%20exceptions%20should%20be,to%20determine%20if%20it%E2%80%99s%20in%20that%20correct%20state.
18:39:17Phytolizeri don't like exceptions. but there is what seems to be an arbitrary line in the sand drawn of what can and can't be handled. please stop linking articles
18:39:31FromDiscord<Gumbercules> please stop telling me what to do 🙂
18:39:49FromDiscord<voidwalker> please be nice to each other. articles are good, we are noobs : P
18:40:11Phytolizer1 was enough
18:40:20FromDiscord<Gumbercules> I was making a point
18:40:30FromDiscord<Yardanico> In reply to @voidwalker "oh yeah, I wanted": -d:release disables stack traces by default, yes
18:40:39FromDiscord<Yardanico> you can still enable them if you want
18:40:43FromDiscord<Yardanico> `--stackTrace:on --lineTrace:on`
18:40:57Phytolizeri agree with those articles. but many things can be handled and treated as non-exceptional. it is completely a judgment call
18:41:07FromDiscord<voidwalker> Oh I see, interesting. So there is no significant compute overhead to handling many exceptions at runtime
18:41:33FromDiscord<IsaacPaul> In nim I would probably use a result type of exceptions since you aren't forced to handle it or ignore it
18:41:39FromDiscord<IsaacPaul> (edit) "In nim I would probably use a result type ... of" added "instead"
18:42:02FromDiscord<IsaacPaul> Right? its been a while lol
18:42:04FromDiscord<Gumbercules> In reply to @Phytolizer "i agree with those": well you are forced if you don't want to allow it to go uncaught
18:42:06Phytolizeryes, the default behavior of exceptions being to propagate is the main problem i have :P
18:42:11FromDiscord<Gumbercules> sorry wrong comment to reply to
18:42:38FromDiscord<Gumbercules> if you don't `try/except` an exception in Nim it will bubble up and you will experience stack unwinding eventually
18:42:51FromDiscord<Gumbercules> procedures aren't required to be documented with `raises: []`
18:42:59Phytolizeryes, that is the problem. you have to be very cautious when exceptions are possible
18:43:16FromDiscord<Gumbercules> a big issue is one can't even really tell when they are possible
18:43:27FromDiscord<Gumbercules> and if one wants to avoid them entirely they can't use the stdlib
18:44:29FromDiscord<guttural666> can I somehow manually throw this bad boy? https://media.discordapp.net/attachments/371759389889003532/1050120630428774470/image.png
18:44:29FromDiscord<IsaacPaul> Thats my biggest problem with nim tbh
18:44:48FromDiscord<Yardanico> In reply to @guttural666 "can I somehow manually": you just `raise` a new value error
18:45:03Phytolizer`raise newException(ValueError, "message")` is the syntax i think
18:45:08FromDiscord<guttural666> In reply to @Yardanico "you just `raise` a": perfect! works and thank you
18:45:14FromDiscord<Yardanico> also what's this https://media.discordapp.net/attachments/371759389889003532/1050120821798088826/image.png
18:45:23FromDiscord<Yardanico> if you want to clean a seq just do `result.setLen(0)`
18:45:25FromDiscord<Yardanico> or a string
18:45:50FromDiscord<guttural666> In reply to @Yardanico "if you want to": that's also what I was searching for, something like .clear() or something
18:45:56FromDiscord<guttural666> so thanks again! haha
18:47:28FromDiscord<Gumbercules> In reply to @IsaacPaul "Thats my biggest problem": is this being addressed in 2.0? I haven't been in the loop for quite some time. Pulled a stint with Odin but it's no panacea there either....
18:48:22FromDiscord<.tochka> does {.global.} works in template for making single static?
18:49:16FromDiscord<Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4i07
18:49:30FromDiscord<Horizon [She/Her]> https://github.com/Mythical-Forest-Collective/Code-Bricks/blob/master/bricky.nim#L84-L90 is one relevant part
18:49:52FromDiscord<Horizon [She/Her]> And then here: https://github.com/Mythical-Forest-Collective/Code-Bricks/blob/master/bricky.nim#L57-L72
18:50:03FromDiscord<Horizon [She/Her]> I don't get why I get this error at all...
18:50:11FromDiscord<Yardanico> is that specific to Nim though? I feel like it's some JS-related DOM error
18:50:15FromDiscord<Yardanico> https://stackoverflow.com/questions/56906853/failed-to-execute-appendchild-on-node-the-new-child-element-contains-the-pa e.g. this
18:51:03FromDiscord<Horizon [She/Her]> Hm i'll check
18:52:51FromDiscord<Horizon [She/Her]> I don't think that's relevant? I don't see where I'm appending the wall (or brick) to itself at all
18:53:17FromDiscord<sOkam!> Are cpp vectors `seq` and maps `Table` in nim? 🤔
18:53:26FromDiscord<Gumbercules> sounds like `brick` has a reference to `wall`
18:53:40FromDiscord<Gumbercules> the error says `The new child element contains the parent.`
18:53:43FromDiscord<Michal Maršálek> playground is down? 😦
18:53:54FromDiscord<Gumbercules> not the child has a reference to itself
18:54:38FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "sounds like `brick` has": It shouldn't have a direct reference, I'm using the `TrackingId` to track the walls and bricks... Maybe changing it to a ref object will fix it?
18:54:58FromDiscord<Gumbercules> let me look at the code and see if I can find out what's wrong
18:55:39FromDiscord<Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4i08
18:55:42FromDiscord<Horizon [She/Her]> L64 and L65
18:56:07PhytolizersOkam!, generally yes, Table is like c++ unordered_map
18:56:36FromDiscord<sOkam!> ah map is ordered? i didn't know
18:56:41PhytolizerOrderedTable is like map
18:56:46Phytolizeryeah it's silly
18:57:04FromDiscord<sOkam!> kk, tysm
18:57:26FromDiscord<Gumbercules> In reply to @Event Horizon "It may be these": yeah that's what's causing it but the question is why does the brick node have the wall node added as a child
18:58:35FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "yeah that's what's causing": As a child? I'm keeping the reference to the parent so when the user drags a brick, I can see where it is position-wise in the parent, and then snap off bricks below it to be dragged along
18:58:53FromDiscord<Gumbercules> I'm talking about the dom
18:58:55FromDiscord<Gumbercules> not about the Nim code
18:59:10FromDiscord<Horizon [She/Her]> Wait it has the wall node as a child? Where?
18:59:33FromDiscord<Gumbercules> well that's what the error says
18:59:45FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=
18:59:54FromDiscord<Gumbercules> meaning `brick` contains `wall`
18:59:57FromDiscord<Horizon [She/Her]> Yeah, I don't get how that's happening at all 😓
19:00:05FromDiscord<Gumbercules> I think the problem might be you using `children` in your JS objects
19:00:17FromDiscord<guttural666> In reply to @Phytolizer "`raise newException(ValueError, "message")` is": I can add my custom message to that, that's cool
19:00:21FromDiscord<Gumbercules> HTML dom nodes already have a member named `children`
19:00:55FromDiscord<Horizon [She/Her]> Ah
19:01:48FromDiscord<Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4i0c
19:01:58FromDiscord<Horizon [She/Her]> Plus, i'd think it'd be unrelated considering they're different objects
19:02:39FromDiscord<Gumbercules> hmm
19:02:50FromDiscord<Gumbercules> this is a runtime error right? not a compile time error?
19:02:59FromDiscord<Horizon [She/Her]> Yup, runtime
19:03:20FromDiscord<Gumbercules> I'd just open up the dev console and put a breakpoint at ` wallElem.appendChild(brick.elem)`
19:03:38FromDiscord<Gumbercules> and then inspect `brick` to see if it has a reference to `wall`
19:04:43FromDiscord<Horizon [She/Her]> I set the breakpoint and ran the function, breakpoint stopped the execution, how would I see the contents?
19:04:44FromDiscord<Yardanico> yeah, there's `--sourceMap:on` but idk how well it works on latest nim
19:04:53FromDiscord<Yardanico> In reply to @Event Horizon "I set the breakpoint": the browser debugger will show you
19:04:57FromDiscord<Yardanico> all variables that are in the context
19:05:04FromDiscord<Horizon [She/Her]> Oh sourcemaps are probably useful, how do i use those? 😅
19:13:29FromDiscord<Gumbercules> assuming they get generated in the correct place, I believe the browser should detect them and use them as long as feature is enabled
19:13:37FromDiscord<Gumbercules> it's been a while since I've done any FE web dev
19:13:44FromDiscord<Gumbercules> thankfully
19:13:54FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "assuming they get generated": Hm nope, sourcemaps aren't showing up
19:14:00FromDiscord<Horizon [She/Her]> Still digging through the generated JS code
19:16:35FromDiscord<Horizon [She/Her]> Also, it's probably worth noting that the first time i run the method, it runs with no errors
19:16:42FromDiscord<Horizon [She/Her]> It's the second time that causes issues
19:16:46FromDiscord<Horizon [She/Her]> And any other tries
19:18:31FromDiscord<Horizon [She/Her]> I just managed to run it 3 times, without any issues...?
19:18:43FromDiscord<Horizon [She/Her]> And the 4th time it started spitting errors
19:18:49FromDiscord<Horizon [She/Her]> What the hell is this...
19:19:25FromDiscord<Horizon [She/Her]> Okay this is weirder than i thought
19:19:39FromDiscord<Horizon [She/Her]> Sometimes i can run it, a lot of the time it throws that same error as before
19:20:11FromDiscord<Horizon [She/Her]> Though only when the breakpoint is there??
19:24:20FromDiscord<Horizon [She/Her]> I genuinely hate JS
19:31:52FromDiscord<Phil> All I want from a language
19:32:07FromDiscord<Gumbercules> is love?
19:32:31FromDiscord<Phil> Is static typing, enforcing optionals over null, first class functions/procs and default immutability
19:32:48FromDiscord<Phil> Also love but that takes a second step behind default immutability
19:33:53FromDiscord<Gumbercules> Odin may have those things
19:33:57FromDiscord<Phil> Given that js only delivers on one of those, I can only agree with the sentiment (directed at horizon)
19:34:32FromDiscord<Phil> (edit) "(directed" => "(this message is directed" | "horizon)" => "horizon stating they hate js)"
19:34:44FromDiscord<Gumbercules> static typing - check, enforcing optionals over null I'm not 100% on, first class functions - check, default immutability - check
19:35:05FromDiscord<Gumbercules> Odin doesn't have exceptions so...
19:35:16FromDiscord<Phil> Works for me, result types then?
19:38:11FromDiscord<Gumbercules> yeah essentially - https://www.gingerbill.org/article/2018/09/05/exceptions-and-why-odin-will-never-have-them/
19:39:14FromDiscord<Gumbercules> this was written by the author of Odin - just FYI I don't program in Odin anymore, I ported a large portion of my engine to it and then threw my hands up for a couple of reasons, mostly because I felt like I was losing out on something by abandoning my efforts in Nim, but also because Odin lacks any sort of metaprogramming and also because of the dependency on LLVM
19:40:11*dnh joined #nim
19:41:37FromDiscord<Phil> I support the reasoning
19:41:48FromDiscord<Phil> If there is one thing I find to be true everywhere always
19:41:57FromDiscord<Phil> It's that explicit is better than implicit
19:42:14FromDiscord<Phil> It's why imo result types are always superior
19:44:09*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
19:44:43FromDiscord<Phil> Write code expressing your exact intent rather then code that happens to do what you want.↵Don't have things in your code you just "have to know".↵Nim provides something for that in the form of the raises pragma... But that becomes a massive pain when your libraries aren't using it
19:45:34FromDiscord<Phil> Because how can you know what exceptions your libraries might throw unless you read through the entire code which is insane workloads
20:01:51FromDiscord<Require Support> for threading: is it still fine to use spawn or is there a newer/better way of doing things?
20:02:21*derpydoo quit (Remote host closed the connection)
20:03:25FromDiscord<Gumbercules> In reply to @Isofruit "Because how can you": appears there's an ongoing RFC about this - https://github.com/nim-lang/RFCs/issues/493#issuecomment-1321540909
20:04:48FromDiscord<Gumbercules> https://sr.ht/~duangle/scopes/ is another interesting language
20:04:53FromDiscord<Gumbercules> I played with it several years ago but haven't been back since
20:09:18*jmdaemon joined #nim
20:12:20FromDiscord<IsaacPaul> In reply to @Require Support "for threading: is it": https://github.com/mratsim/weave seems pretty neat
20:13:28NimEventerNew thread by prestosilver: Making a upside-down card game: Flipcards, see https://forum.nim-lang.org/t/9700
20:17:38FromDiscord<ieltan> Interesting↵https://www.hpcwire.com/2022/12/05/new-c-sender-library-enables-portable-asynchrony/
20:26:32*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
20:27:06*kenran joined #nim
20:31:25*derpydoo joined #nim
20:40:11*kenran quit (Remote host closed the connection)
20:44:47*arkurious joined #nim
21:18:04FromDiscord<Horizon [She/Her]> Question: How are you supposed to construct an AST tree? Like, representing it internally?
21:18:15FromDiscord<Horizon [She/Her]> I already have the necessary types to hold the data
21:18:34FromDiscord<Horizon [She/Her]> I just don't know what the best way to organise tokens into a tree
21:18:59*andrewrk joined #nim
21:19:37andrewrkwhat is nim's strategy for building from source? do you use a previous build of nim?
21:20:06andrewrkoops I should have checked the README more carefully before asking
21:20:27FromDiscord<Horizon [She/Her]> There's csources haha
21:20:37FromDiscord<amadan> In reply to @Event Horizon "Question: How are you": Variant objects would work. This is a good example of how `NimNode` for macros is represented https://nim-lang.org/docs/macros.html#the-ast-in-nim
21:24:25*dtomato4 joined #nim
21:25:02FromDiscord<bren> sent a code paste, see https://play.nim-lang.org/#ix=4i0L
21:32:52FromDiscord<QuiteQuietQ> sent a code paste, see https://play.nim-lang.org/#ix=4i0R
21:36:12FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4i0T
21:37:08FromDiscord<amadan> Without the ref the size of the object would be infinite
21:39:43FromDiscord<QuiteQuietQ> yep, I am getting illegal recursion in the type and the `ref` is clear to me now
21:39:55FromDiscord<QuiteQuietQ> i think it should throw some compilation error then
21:41:24*greaser|q quit (Changing host)
21:41:24*greaser|q joined #nim
21:41:28*greaser|q is now known as GreaseMonkey
21:41:47FromDiscord<planetis> Pretty sure this had an error message.
21:42:14FromDiscord<planetis> Does it still crash the complier if you remove the generics?
21:42:22FromDiscord<Gumbercules> does the compiler even crash?
21:42:23FromDiscord<amadan> Has error message when you remove the generic
21:42:31FromDiscord<Gumbercules> mine produces an exe
21:42:39FromDiscord<amadan> Get exit code 139 which is SIGSEV iirc
21:42:46FromDiscord<Gumbercules> mmm
21:43:03FromDiscord<amadan> (edit) "SIGSEV" => "SIGSEGV"
21:43:31*andrewrk left #nim (Leaving)
21:44:35*ltriant quit (Ping timeout: 264 seconds)
21:46:07FromDiscord<amadan> Hits call depth limit when debugging with compiler↵Guess it should error instead of expanding if it's seen `T` before↵Think I might be able to fix
21:54:50NimEventerNew post on r/nim by Connect-Ad3976: Ideas for begginer projects, see https://reddit.com/r/nim/comments/zff7s0/ideas_for_begginer_projects/
21:57:26*Guest35 joined #nim
21:57:37*Guest35 quit (Client Quit)
22:07:18*pbottle joined #nim
22:12:56*ltriant joined #nim
22:17:57*Guest63 joined #nim
22:22:36*Guest63 quit (Quit: Client closed)
22:22:43FromDiscord<Andreas> In reply to @IsaacPaul "https://github.com/mratsim/weave seems pretty neat": maybe a little bit off-topic here, but this https://katalog.ub.uni-freiburg.de/opac/RDSIndex/Search?lookfor=kid%3A1800973624 came along today.. so yes, weave is neat stuff..
22:33:50*Phytolizer quit (Remote host closed the connection)
22:40:07pbottleI think I know the answer to this but I want to make sure: if I'm calling 6 a C function that isn't CPU bound but takes a long time to execute, async/await won't help me reduce the total run time of the program and I need to use Weave or a threadpool
22:42:32FromDiscord<amadan> In reply to @amadan "Hits call depth limit": nvm, bung seems to already be working on a fix that is less hacky than my approach
22:45:43arkanoidI've developed the very same number crunching algorithm (random-walk based) both in recursive and iterative mode. They return the very same result, but the different approaches open for some different optimization techniques. Which of the two would you choose as a target for further optimization?
22:51:09FromDiscord<Yepoleb> pbottle: async only helps when the main blocking prodecure is io bound and is written to support the async runner, that's currently only the case for network stuff afaik. For everything else you need a thread based executor.
23:12:50*jmdaemon joined #nim
23:21:26pbottleThank you
23:23:10NimEventerNew thread by guzba: Type aliases not quite working like I expected. Ideas for alternative approach?, see https://forum.nim-lang.org/t/9701