<< 07-03-2024 >>

01:46:29arkanoidis there a proper way to convert an array[2, Meter] to array[2, Float] where type Meter = distinct float, without copying/duplicating the array?
01:51:17arkanoidI mean, converting a distinct to its base type is trivial when base type is ... base
01:51:35arkanoidbut when base type is array or something more seem not working
01:54:40*rockcavera joined #nim
02:02:11FromDiscord<Elegantbeef> `cast` is there
02:02:25FromDiscord<Elegantbeef> But otherwise they're "invariant" i believe is the term
02:02:50FromDiscord<Elegantbeef> Might be "covariant" I don't recall the fancy term
02:03:05FromDiscord<Elegantbeef> Just cause generic parameters are convertible does not mean generic instantiations are
02:04:48FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=mixUtqPeHVkj is a case where `cast` does not work for obvious reasons
02:06:57arkanoidthis is the cast based solution I've found, but I'd guess there's a safe alternative for that https://play.nim-lang.org/#pasty=RfjQKOBGcJgL
02:07:20FromDiscord<Elegantbeef> There isnt cause this is isn't an operation that is safe to do
02:07:56arkanoidI don't understand why. Let me remove imports and write a self-contained example
02:08:00FromDiscord<Elegantbeef> To convert between generic instantiations creating an L-value you have to know the trees are identical so whilst possible it's not a fun thing to do
02:08:15FromDiscord<Elegantbeef> I just showed an example of why it's not
02:08:25FromDiscord<Elegantbeef> In the case of an array it's fine but there is not a general solution
02:08:55FromDiscord<Elegantbeef> I should say there is a general solution but it's quite elaborate so probably why it's not implemented
02:09:14FromDiscord<Elegantbeef> We can make this safe using a proc
02:11:57arkanoidhere the self contained example. Please forgive me I've been typing Nim, I'm going to read your example now https://play.nim-lang.org/#pasty=cuLsxWovMtbR
02:17:23FromDiscord<girvo> In reply to @Elegantbeef "https://play.nim-lang.org/#pasty=fqPpUSTJYCBs I of ": Does this play nice with a =destroy as well?
02:17:35FromDiscord<Elegantbeef> Indeed
02:17:40FromDiscord<girvo> Clean
02:17:46FromDiscord<Elegantbeef> Implement a `=destroy` only for `Uart[Init]`
02:17:59FromDiscord<Elegantbeef> `Uart[Uninit]` owns nothing
02:18:12FromDiscord<girvo> Yeah makes sense
02:18:47FromDiscord<girvo> This actually fits the way it's configured/setup too
02:22:17FromDiscord<Elegantbeef> Type states are great
02:22:46FromDiscord<girvo> Yeah esp for this one-to-one object to hardware mapping
02:24:10FromDiscord<Elegantbeef> Arkanoid https://play.nim-lang.org/#pasty=TLgZiGlRjAwO here is a simple proc based implementation that makes it a tinge safer
02:24:25FromDiscord<Elegantbeef> This also works for distinct of distinct
02:24:43FromDiscord<Elegantbeef> Atleast in theory
02:25:57arkanoidneat use of typetraits!
02:26:56FromDiscord<Elegantbeef> Lol
02:27:01FromDiscord<Elegantbeef> I was trying to use it but the compiler did not like it
02:27:04arkanoidthanks, I got it now. It's just a matter that two real types generates from same metaclass may have very different fields
02:27:09FromDiscord<Elegantbeef> So it stayed there
02:27:22arkanoid*generated
02:27:49FromDiscord<Elegantbeef> It is of course fully possible to have the compiler check if they're convertible but that does require walking down each instantiation and checking the fields are convertible
02:41:56arkanoidElegantbeef, do you see if more or less safe if I turn your example from procs to templates? https://play.nim-lang.org/#pasty=yGRxdoGsQziL
02:42:05arkanoid*do you see it
02:43:31arkanoidalso, why is std/typetraits imported? you seems not using it
02:44:25FromDiscord<Elegantbeef> I said why
02:44:39arkanoiduh? sorry again, let me re-read
02:45:32FromDiscord<Elegantbeef> > I was trying to use it but the compiler did not like it
02:45:37arkanoidoh, ok
02:46:17arkanoidmh, I wonder which improvement you were looking for with std/typetraits
02:51:58*krux02 quit (Remote host closed the connection)
02:54:00FromDiscord<Elegantbeef> `Y: typedesc = distinctBase(T)`
03:00:06arkanoiduhm, I don't understand why your proposed solution works when used with types copied from vmath, but it doesn't when imported real vmath https://play.nim-lang.org/#pasty=uLPUZNsuaBkt
03:07:47arkanoidwait, I might have found the reason
03:08:33arkanoidhttps://github.com/treeform/vmath?tab=readme-ov-file#vector-and-matrix-representation-and-benchmarks -> https://github.com/treeform/vmath/blob/7282ae1247f2f384ebeaec3826d7fa38fd0e1df1/src/vmath.nim#L249
03:10:21arkanoidI can confirm that it compiles and run with -d:vmathArrayBased
03:27:42FromDiscord<Elegantbeef> Right replace the array with `GVec...`
03:35:11*rockcavera quit (Remote host closed the connection)
03:49:07*rockcavera joined #nim
03:57:33arkanoidone more step and I get an elegant solution: how to get the underlying (generic?) typeclass from a proc foo[T](bar: GVec234[T]): GVec234[Y] = cast[???](bar) <-- https://github.com/treeform/vmath/blob/7282ae1247f2f384ebeaec3826d7fa38fd0e1df1/src/vmath.nim#L46
03:59:08arkanoidGVec234[T] = GVec2[T] | GVec3[T] | GVec4[T], I want to know when a proc with argument GVec234[T] is called with GVec2[T] or GVec3[T] or GVec4[T]. Do I need a when/else cascade?
03:59:28FromDiscord<Elegantbeef> `typetraits` has `GenericHead`
04:02:11FromDiscord<user2m> how do I append text to a file? writeFile seems to overwrite
04:02:24FromDiscord<Elegantbeef> `open(..., fmWriteExisting)`
04:04:38arkanoidElegantbeef, in your original solution, you used `when not compiles(T(arr[Idx.low]))`. Did you mean to write `when not compiles(Y(arr[Idx.low]))` instead?
04:04:47FromDiscord<Elegantbeef> Yes
04:04:56FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=gaYKZUWrmNsD
04:05:06arkanoidthanks
04:07:40arkanoidThis is the most complete solution I've found so far https://play.nim-lang.org/#pasty=ybCJHVKfTlIc but I didn't get how to use GenericHead to replace the when/elif/else chain
04:09:09FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=KiQyCwWDZkWs
04:11:38arkanoiddoesn't compile Error: invalid type: 'typeof(typeof(p1).genericHead)' for let
04:11:56FromDiscord<Elegantbeef> Forgot the `[Y]`
04:12:09FromDiscord<Elegantbeef> You win some you lose more
04:15:08arkanoidmh, I'm trying adding [Y] in every possible posible position, but compiled doesn't get satisfaction. It's Y kamasutra here
04:15:27arkanoid*compiler. Damn, can't type today
04:17:09FromDiscord<Elegantbeef> We'll do it another way πŸ˜„
04:19:30arkanoidthe long chain of when/else is ugly but works: https://play.nim-lang.org/#pasty=nnaKLnqUKSQA
04:21:27FromDiscord<Elegantbeef> Yea typetraits macros are silly
04:21:35FromDiscord<Elegantbeef> Actually they're not even macros
04:22:03FromDiscord<Elegantbeef> I do despise that you're using templates but you do you
04:23:13arkanoidlol! compiler internal error
04:23:25arkanoidjust by replacing template with proc
04:26:51arkanoidwhat's the idea of genericHead? typeof(arr) would return like GVec2[float], genericHead would return GVec2, then we're trying to add [Y] to get GVec2[Y] right?
04:27:10FromDiscord<Elegantbeef> That was the idea yes
04:27:27arkanoidmmm ok
04:28:05arkanoidbut somehow it doesn't like it
04:29:45arkanoidcast[(genericHead(typeof(arr)))[Y]](arr) -> Error: identifier expected
04:30:16FromDiscord<girvo> Dumb question, is there way to get the `nim` binary to output/dump it's compile time defines?
04:31:09FromDiscord<Elegantbeef> Sadly not
04:31:25FromDiscord<Elegantbeef> Atleast not that I know of
04:31:35FromDiscord<Elegantbeef> Could probably abuse `--importFile` and Term rewriting macros
04:31:51FromDiscord<girvo> damn
04:31:59FromDiscord<girvo> Oh well, CMake parsing `nim.cfg` it is!
04:33:27FromDiscord<Elegantbeef> Oh you meant like that
04:35:52FromDiscord<girvo> πŸ˜„
04:36:02arkanoidthanks for all the hints beef, as usual
04:36:17FromDiscord<girvo> It's all good, `file(READ nim.cfg NIM_CONFG)` and `string(REGEX MATCH ...)` will be enough
04:36:21arkanoidneeds some sleep! bye
04:36:28FromDiscord<Elegantbeef> `dump`
04:36:44FromDiscord<Elegantbeef> Wait that's not write
04:36:45FromDiscord<Elegantbeef> right\
04:52:41FromDiscord<girvo> Is there any other way =destroy can be called other than via =sink or going out of scope? Oh I guess being called explicitly by a dev?
04:53:09FromDiscord<Elegantbeef> Yep
04:53:40FromDiscord<Elegantbeef> All hooks are supposed to destroy the dest
05:10:12FromDiscord<girvo> hm. Alright I'm going to have to test this a heap
06:07:30FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=DYcVLzmzmhWT
06:07:41FromDiscord<girvo> Which I've bound in a higher level manner
06:09:08FromDiscord<girvo> Is there an equivalent of this #define newFunction oldFunction(withSomeStuff)? ↡↡I can obviously just define them as procs doing the same thing and calling the other procs... I guess marked with {.inline.}?
06:09:14FromDiscord<Elegantbeef> @bung8954 you got me too deep into actually making that cleaner so now rdldd exists πŸ˜„
06:13:05FromDiscord<Elegantbeef> Templates or inline procs girvo
06:14:48FromDiscord<Elegantbeef> https://github.com/beef331/rdldd/blob/master/rdldd.nim whoops meant to place that there
06:17:58*advesperacit joined #nim
06:18:33*advesperacit quit (Client Quit)
06:18:51*advesperacit joined #nim
06:28:17*ntat joined #nim
06:45:55*rockcavera quit (Remote host closed the connection)
07:11:14FromDiscord<bung8954> interesting, I found appimage provide tools do the task
07:12:57*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
07:13:41*SchweinDeBurg joined #nim
07:24:50FromDiscord<girvo> I wonder what's preferable here, inline or a template
07:25:20FromDiscord<girvo> probably inline because templates seem to break nimsuggest/lsp/error outputs sometimes lol
07:40:28FromDiscord<morgan> sent a long message, see https://pasty.ee/twuiHerPgehv
08:06:24FromDiscord<Elegantbeef> Use an untagged union inside of a union and you can place them wherever you want
08:07:58FromDiscord<Elegantbeef> inside of an object\
08:08:03FromDiscord<Elegantbeef> @morgan
08:12:46*azimut quit (Ping timeout: 260 seconds)
08:47:18*ntat quit (Quit: Leaving)
11:44:41*xet7 joined #nim
11:58:54*krux02 joined #nim
13:45:30*rockcavera joined #nim
13:49:18FromDiscord<A2> sent a code paste, see https://play.nim-lang.org/#pasty=jWrQaGYQrytV
13:49:31FromDiscord<A2> it compiles fine, but behaves differently from what I expect at runtime
13:50:28FromDiscord<A2> I expect that the `parse_json` function might throw an exception, which might be caught by the `except Exception` block.What actually happens is that `parse_json` throws an exception, which is only caught many scopes above (inside the caller of the caller of the caller of this function)
13:51:12FromDiscord<Robyn [She/Her]> Is https://codeberg.org/pswilde/threadlogging a real solution for using a logger across multiple threads? I just wanna ask to see if I'm better off writing my own logging library or not
13:52:19FromDiscord<A2> ...it's just super weird to me that a proc tagged with `{.raises [].}` can throw exceptions at all.↡↡Is this a compiler bug, or am I misunderstanding something here?
13:52:50*ntat joined #nim
13:56:48FromDiscord<arnetheduck> In reply to @A2 "...it's just super weird": `raises` does not track `Defect` so YMMV when it's that kind of exception.. the code generally looks like it should do what you expect it to, so potentially what could be happening is that it's a different exception being caught than what you think
13:57:35FromDiscord<arnetheduck> ie if you try to access `value` of the Result when it has an error set, `Defect` will be raised which is not considered by `raises`
13:57:47FromDiscord<Robyn [She/Her]> That's the intended behaviour because `panics:on` exists, right?
13:58:08FromDiscord<arnetheduck> when panics:on is on, the application will terminate on first defect
13:58:33FromDiscord<arnetheduck> (edit) "defect" => "Defect"
13:59:19FromDiscord<Robyn [She/Her]> Makes sense yeah
14:01:50FromDiscord<arnetheduck> generally, for this reason, we've stopped using `except:` and `except Exception` - instead, we use `except CatchableError` (if we use exceptions at all)
14:04:12FromDiscord<Robyn [She/Her]> Understandable
14:11:59FromDiscord<odexine> it would be nice to encode that a defect cannot happen, though
14:24:33FromDiscord<A2> yeah that would be awesome
14:25:26FromDiscord<A2> I had written a bunch of code that relies on catching Exceptions and turning those into `Result`s - but now that some libraries are using Defects instead, I can't catch them, and I can't annotate that they shouldn't happen?
14:25:51FromDiscord<A2> I don't really understand these regressions.. it seems like a clear downgrade from the stuff that was doable with exceptiosn before
14:26:05FromDiscord<A2> Β―\\\_(ツ)\_/Β― anyway I got some pointers on what to look out for now. hopefully I can figure out my problem
14:27:18FromDiscord<griffith1deadly> In reply to @A2 "I don't really understand": any code even without raising can raise exceptions
14:27:28FromDiscord<griffith1deadly> for example - outofmem defect
15:12:00FromDiscord<A2> yeah OOM seems unavoidable. it's just that this same code was catching my exception/defect earlier, and now it is no longer
15:12:03FromDiscord<A2> and I don't really understand why, because it bypasses the first `try: ... except Exception: ...` but is caught by a `try: ... except: ...` a few scopes further up the callstack
15:16:29FromDiscord<A2> Is it correct that a `Defect` can never be caught? If one occurs in my program, it will crash?
15:17:15FromDiscord<odexine> it "should not be caught"
15:17:25FromDiscord<odexine> it can be caught when compiled with `--panics:off`
15:17:29FromDiscord<odexine> otherwise it will crash
15:17:44FromDiscord<A2> ahh interesting-
15:17:50FromDiscord<A2> this explains the behavior of my program
15:17:55FromDiscord<A2> now i understand
15:18:05NimEventerNew Nimble package! nimcso - nim Composition Space Optimization: A high-performance tool leveraging metaprogramming to implement several methods for selecting components (data dimensions) in compositional datasets, as to optimize the data availability and density for applications such as machine learning., see https://github.com/amkrajewski/nimcso
15:18:43*azimut joined #nim
15:19:13FromDiscord<A2> what types of errors should I expect to cause a Defect, rather than an Exception?↡↡When parsing json into some custom types of mine, I'm running into some Defects now, but I feel like I should be able to define what happens if the user input is bad?
15:20:10FromDiscord<odexine> defects are meant to represent irrecoverable errors, much like the idea of exceptions in elixir/erlang, if you're familiar
15:21:16FromDiscord<A2> elixir is still an unchecked item on my bucketlist \:)
15:21:24FromDiscord<A2> but that makes sense
15:21:45FromDiscord<A2> re\: Defects anyway
15:21:58FromDiscord<A2> I still think it's a bit weird that json parsing is considered an "irrecoverable error"
15:22:28FromDiscord<A2> I might just need to compile my program with `--panics:off` always and catch defects with `try: ... except: ...` blocks then?
15:22:55FromDiscord<A2> haha thanks for indulging me with so many newbie questions
15:27:51FromDiscord<odexine> it would be nice to know what defect you seem to have caught
15:28:28FromDiscord<odexine> In reply to @A2 "I still think it's": and its not rigorously defined what an irrecoverable error is, so some of us have different ideas of what is or isnt
15:30:31FromDiscord<A2> let me try and find the specific name of it.↡`echo $(get_current_exception().name` should do it, right?
15:30:36FromDiscord<A2> let me try and find the specific name of it.↡`echo $(get_current_exception().name)` should do it, right?
15:32:10*krux02_ joined #nim
15:32:46*krux02 quit (Ping timeout: 268 seconds)
15:35:11FromDiscord<arnetheduck> In reply to @A2 "I still think it's": indeed - nothing that processes user input should raise defect in a well-written program - with --linetrace:on you should get an exact location of where the defect was raised, in particular when you use --panics:on - using `except:` or `except Exception` to catch defects is a good way to introduce bugs because after a defect, the program is typically in an inconsistent state
15:36:00FromDiscord<arnetheduck> (edit) "--linetrace:on" => "`--linetrace:on --stacktrace:on`"
15:36:12FromDiscord<A2> ..which is also why I try to convert `Exceptions` to something formulated in your wonderful results library as close to the exception as I possibly can
15:36:20FromDiscord<A2> (thanks for your lib btw)
15:37:11FromDiscord<A2> I guess there is probably something else going wrong... It also seems to only happen when I invoke my compiled library from C++, and not when I run my nim-only unit tests
15:37:34FromDiscord<arnetheduck> yeah, so use the stacktrace options and --panics:on to find exactly where the exception is being raised - I don't know about parseJson - we don't use the std lib for json, but if it indeed raises a Defect that would be a bug to raise in the issue tracker
15:37:49FromDiscord<arnetheduck> (edit) "exception" => "Defect"
15:38:47FromDiscord<A2> I get a "ObjectConversionDefect" when I try to call `parse_json` on what I belive is a valid json `string`
15:38:55FromDiscord<A2> I get a "ObjectConversionDefect" when I try to call `parseJson` on what I belive is a valid json `string`
15:39:02FromDiscord<odexine> doesnt the results library have an autowrapper for exceptionable functions to result monad functions?
15:39:05FromDiscord<A2> I get a "ObjectConversionDefect" when I try to call `parseJson` on what I believe is a valid json `string`
15:39:25FromDiscord<A2> oh that sounds like a beautiful thing I didn't know about
15:41:46FromDiscord<odexine> seems like its under the template `catch`
15:52:32FromDiscord<A2> sent a code paste, see https://play.nim-lang.org/#pasty=hVmZYIffBoEH
15:57:39FromDiscord<A2> There is also something about the `json` module being backend-dependant, right? I guess switching to a pure-nim json parser might help me, when my bug seems to be backend-dependant, righ?
15:57:41FromDiscord<A2> There is also something about the `json` module being backend-dependant, right? I guess switching to a pure-nim json parser might help me, when my bug seems to be backend-dependant, right?
15:57:44FromDiscord<A2> There is also something about the `json` module being backend-dependant, right? I guess switching to a pure-nim json parser might help me, when my bug seems to be backend-dependant, maybe?
16:07:06FromDiscord<odexine> that probably means that the contents is invalid json? but thats so weird to make it a defect...
16:08:04FromDiscord<odexine> hm i dont think im right
16:13:01FromDiscord<A2> I don't understand this problem still... now I am considering just switching to treeform/jsony in the hopes that it doesn't have this bug
16:21:50*azimut quit (Ping timeout: 260 seconds)
16:24:01*azimut joined #nim
16:24:46FromDiscord<A2> yup - that's the plan. Thanks for all your help! [Robyn [She/Her]](https://matrix.to/#/%40_discord_524288464422830095%3At2bot.io) [odexine](https://matrix.to/#/%40_discord_259277943275126785%3At2bot.io) [arnetheduck](https://matrix.to/#/%40_discord_449019668296892420%3At2bot.io) πŸ’—
16:24:48FromDiscord<A2> I really appreciate it.
16:26:46FromDiscord<Robyn [She/Her]> Ah I didn't really help but no worries!
16:36:23FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#pasty=QscJVxpBHUJq
16:36:51FromDiscord<m4ul3r> (edit) "https://play.nim-lang.org/#pasty=aXdDKxJYCGPi" => "https://play.nim-lang.org/#pasty=zrSrarHovatI"
16:37:22FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=CKSZquNtzzYZ
16:37:28FromDiscord<odexine> templates need return types too
16:37:45FromDiscord<odexine> sorry i highlighted it because i thought it wouldnt be obvious but its more obvious than i thought
16:38:13FromDiscord<odexine> obvious as in visible
16:38:53FromDiscord<m4ul3r> oh yeah, im dumb
16:39:03FromDiscord<m4ul3r> I had been using some other templates that don't return anything
16:39:17FromDiscord<odexine> common error, dw about it
16:39:33FromDiscord<m4ul3r> https://tenor.com/view/cat-smooth-brain-silly-cute-gif-12951836389394006733
16:39:53FromDiscord<odexine> yeah this channel doesnt embed links
16:39:58FromDiscord<m4ul3r> i am creature of habit i guess
16:39:58FromDiscord<odexine> i dont remember why it was set this way
16:40:32FromDiscord<m4ul3r> It must have happened after someone spamed some really NSFL stuff really late at night (US time)...
16:41:31*advesperacit quit ()
16:43:27FromDiscord<Robyn [She/Her]> No it's been like this forever
16:43:36FromDiscord<Robyn [She/Her]> (edit) "No it's been like this ... forever" added "since"
16:48:46FromDiscord<m4ul3r> Maybe that was in offtopic or something
16:49:50FromDiscord<warcrime> i found a bug
16:49:54FromDiscord<warcrime> not sure if it's with linux or with nim
16:50:11FromDiscord<warcrime> but when i write the `cat` command in front of executing a cli program
16:50:30FromDiscord<warcrime> the entire CLI starts printing out random crazy characters
16:51:12FromDiscord<m4ul3r> it's expected, you're sending the actual bytes of a program to std out
16:51:28FromDiscord<m4ul3r> https://media.discordapp.net/attachments/371759389889003532/1215341057466957874/image.png?ex=65fc6590&is=65e9f090&hm=2b6a5ba27f7616632489802d329f05738a2c1418f3f86875f4ce55e305ee03f9&
16:52:50FromDiscord<warcrime> https://media.discordapp.net/attachments/371759389889003532/1215341400598511677/image.png?ex=65fc65e1&is=65e9f0e1&hm=4c49c06a429a7b0d754334c54cb59dbdee03602f150136758fe99f87901ead8e&
16:52:55FromDiscord<warcrime> i see
16:53:30FromDiscord<m4ul3r> yeah, looks normal if you do that
16:53:37FromDiscord<warcrime> i found this out when trying to grep my stdout
16:54:48FromDiscord<Robyn [She/Her]> How would a borrow checker in Nim work? Curious now
16:56:24FromDiscord<odexine> i dont even understand the question
16:57:59FromDiscord<Robyn [She/Her]> I vaguely remember something about a borrow checker in Nim being needed to do something accurately but I can't remember what
17:28:06NimEventerNew thread by isaiah: A chat app please recommend necessary libraries, see https://forum.nim-lang.org/t/11175
17:55:18*def- quit (Quit: -)
17:56:39*def- joined #nim
18:07:00*def- quit (Quit: -)
18:10:14FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "How would a borrow": No God please no!
18:26:35*advesperacit joined #nim
18:32:54FromDiscord<Robyn [She/Her]> In reply to @sys64 "No God please no!": The borrow checker just checks safety and mutability rules aren't violated, imo it'd be good to have in Nim
18:33:06FromDiscord<Robyn [She/Her]> Might help prevent a segfault before it happens in prod
18:45:35*def- joined #nim
18:46:16FromDiscord<leorize> it does need to get a little smarter, though
18:48:49NimEventerNew thread by isaiah: What is the nim equivalent to the python None type, see https://forum.nim-lang.org/t/11176
18:53:13*xet7 quit (Ping timeout: 264 seconds)
18:53:32*def- quit (Read error: Connection timed out)
18:54:38FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "The borrow checker just": Rust's Borrow Checker is ANNOYING
19:02:59*ntat quit (Quit: Leaving)
19:05:11FromDiscord<Robyn [She/Her]> In reply to @leorize "it does need to": Rust or Nim?
19:05:26FromDiscord<Robyn [She/Her]> In reply to @sys64 "Rust's Borrow Checker is": I mean, Nim is a lot less strict with everything so
19:09:24FromDiscord<morgan> if it's automatic, i think that would be nice
19:09:30*def- joined #nim
19:14:36*xet7 joined #nim
19:15:48*def- quit (Quit: -)
19:22:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "I mean, Nim is": Which is a good thing
19:43:02*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
19:46:29*Lord_Nightmare joined #nim
19:51:01*def- joined #nim
19:59:45*jmdaemon joined #nim
20:03:42FromDiscord<0rigami_> bro what is going on
20:03:43FromDiscord<0rigami_> https://media.discordapp.net/attachments/371759389889003532/1215389439929352272/image.png?ex=65fc929f&is=65ea1d9f&hm=107c4ed5db878c22dc41f0ab52f4720258d10801b0ec20e4a50bb5e45a7b6444&
20:04:36FromDiscord<cineration> Apparently nimble thinks I have a package installed that isn't installed, and insists on trying to find the version that's missing even though that version isn't required by anything.. How can I fix it?
20:08:46FromDiscord<0rigami_> In reply to @0rigami_ "": to be specific that happens in `config.nims`
20:09:14FromDiscord<0rigami_> sent a code paste, see https://play.nim-lang.org/#pasty=ErsghrYZdJtJ
20:09:20FromDiscord<0rigami_> (edit) "https://play.nim-lang.org/#pasty=peCBvlrEqFoA" => "https://play.nim-lang.org/#pasty=VjSWeBmqryIx"
20:09:27FromDiscord<0rigami_> (edit) "https://play.nim-lang.org/#pasty=YanUuMKfXMqe" => "https://play.nim-lang.org/#pasty=IJvZPmcjBOiu"
20:09:42FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=OjSOBvRpQSzl
20:10:32*def- quit (Quit: -)
20:10:56FromDiscord<bosinski2023> (edit) "https://play.nim-lang.org/#pasty=FnepfKAvhgpL" => "https://play.nim-lang.org/#pasty=fAdmJgcTLlHC"
20:24:00*jmdaemon quit (Ping timeout: 255 seconds)
20:33:32*def- joined #nim
21:13:05FromDiscord<guttural666> sent a code paste, see https://play.nim-lang.org/#pasty=PGkSayKfrPWG
21:14:16FromDiscord<morgan> it would be nice if there was a github wiki page comparing nim and rust like there is for c, python, java, and even d
21:34:36systemdsucksi can make one just saying nim rocks, rust sucks in no time
21:43:03FromDiscord<Elegantbeef> Just write Nim code?
21:44:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=GImhkjrdFoFo
22:18:57FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=aPnxrlRnXajW
22:20:55FromDiscord<Elegantbeef> `except CatchableError`
22:21:12FromDiscord<Elegantbeef> \`{.cast({.raises\: [CatchableError].})\: ... code here
22:26:18FromDiscord<Tomz_plug> sent a long message, see https://pasty.ee/brUWeMVylHUA
22:30:15FromDiscord<ezquerra> Sorry beef, I don't understand where to put that cast?
22:30:33FromDiscord<Elegantbeef> Where you have the warning
22:40:45*advesperacit quit ()
22:45:49FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=zACsEUeEoJQd
22:47:29FromDiscord<Elegantbeef> \`{.cast({.raises\: [CatchableError]).}\:
22:51:57FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=fPFQjOQwLFJF
22:52:11FromDiscord<ezquerra> Is there somewhere in the manual that explains this?
22:52:25FromDiscord<Elegantbeef> I'm making typos like crazy but this is driving me toward wanting to take your keyboard from you
22:52:30FromDiscord<Elegantbeef> `{.cast({.raises: [CatchableError]).}:`
22:52:31FromDiscord<ezquerra> LOL
22:52:54FromDiscord<Elegantbeef> Cmon you can reason what is valid Nim syntax!
22:53:00FromDiscord<ezquerra> I don't know that you'd be able to type on my kinesis πŸ˜›
22:53:28FromDiscord<Elegantbeef> There are a few `{.cast....` references in here https://nim-lang.org/docs/manual.html
22:57:16FromDiscord<ezquerra> That's one of the most obscure nim syntaxes I've seen so far...
22:57:39FromDiscord<Elegantbeef> It's just pragma syntaX
22:57:39FromDiscord<Elegantbeef> x\
22:57:54FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=xSQvrMBPNoob
22:58:11FromDiscord<Elegantbeef> No it shouldnt
22:58:17FromDiscord<Elegantbeef> Cause you have an inane `{.`
22:58:33FromDiscord<Elegantbeef> Oh god I was dumb
22:58:43FromDiscord<Elegantbeef> Why the hell did i write the `{.` there and then completely miss it
22:58:47FromDiscord<Elegantbeef> I'm going to jump in a river
22:59:13FromDiscord<Elegantbeef> `{.cast(raises: [CatchableError]).}: ...` is it
22:59:28FromDiscord<Elegantbeef> Sorry for all the confusion I will send 3 snarky comments to my own brain
23:01:49FromDiscord<ezquerra> LOL, _that_ compiles _and_ removes the warning, thank you! πŸ˜„
23:02:18FromDiscord<ezquerra> So is that the right way to fix the original problem, then?
23:02:30FromDiscord<Elegantbeef> "right way" is a stretch it's a way
23:02:45FromDiscord<Elegantbeef> the write way would be to make `=destroy` annotated `{.raise: [].}`
23:02:45FromDiscord<ezquerra> πŸ™‚
23:02:55FromDiscord<Elegantbeef> But also your `=destryo` does nothing if that's a `ptr`
23:03:03FromDiscord<Elegantbeef> cause `=destroy` does nothing
23:03:10FromDiscord<Elegantbeef> on pointers
23:03:17FromDiscord<Elegantbeef> You need to iterate the collection calling destroy on each element
23:04:30FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=owpjVqFYzObI
23:04:48FromDiscord<Elegantbeef> I'm saying `=destroy` should not raise
23:04:56FromDiscord<ezquerra> (edit) "https://play.nim-lang.org/#pasty=GUAOdFkGeBvn" => "https://play.nim-lang.org/#pasty=IIaszXespoGM"
23:05:04FromDiscord<Elegantbeef> All destroy's should be `{.raises: [].}`
23:05:31FromDiscord<ezquerra> I thought destroy was implicitly {.raise: [].} (according to the manual)?
23:05:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=kpmsajYwZOBN
23:05:46FromDiscord<Elegantbeef> Unless you know these are some types that have no need for destructors
23:06:15FromDiscord<Elegantbeef> Leo are you actually here or did you just open your matrix client? πŸ˜„
23:06:20FromDiscord<ezquerra> My understanding is that this is what's storing the data of a Tensor, which is just numeric data
23:06:30FromDiscord<Elegantbeef> Playing around with mkfifo and `open` is causing a lovely Os error πŸ˜„
23:07:42FromDiscord<ezquerra> I actually do not know why nim assumes that `=destroy`(storage.raw_buffer) can raise a bare Exception
23:08:05FromDiscord<Elegantbeef> Cause `=destroy` was not implemented with `{.raises: [].}` so it is inferred it can raise
23:08:11FromDiscord<Elegantbeef> Generic funky stuff is fun
23:09:06FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=prsJulieZBGP
23:09:30FromDiscord<Elegantbeef> Right
23:09:32FromDiscord<ezquerra> And (I think!) leaves the code I don't really understand basically untouched. I guess that's something πŸ™‚
23:09:36FromDiscord<Elegantbeef> It also does not emit a exception handler
23:11:02FromDiscord<ezquerra> I'm surprised that as you said `=destroy`(storage.raw_buffer) does nothing on a ptr UncheckedArray[T]. I would have expected it to do a free...
23:15:00FromDiscord<Elegantbeef> Nim does not know how it was allocated
23:15:36FromDiscord<ezquerra> OK
23:17:23FromDiscord<ezquerra> Is it true that in nim 2.0 `=destroy` will automatically set the values of the fields of the input object to their default values (which in the case of a pointer is nil)?
23:17:55FromDiscord<Elegantbeef> You say that like it's a rumour
23:17:55FromDiscord<Elegantbeef> Nope you need to use `=wasMoved`
23:24:15*def- quit (Quit: -)
23:25:39FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=pxdGFVhYDDFt
23:26:07FromDiscord<ezquerra> (edit) "https://play.nim-lang.org/#pasty=sIeTCmJqdnDu" => "https://play.nim-lang.org/#pasty=PIHhjzklFWTD"
23:26:39FromDiscord<jovial_lamb_38837> hi friends, trying to extend the Dollar example for distinct types ...
23:26:45FromDiscord<Elegantbeef> `=wasMoved`
23:26:45FromDiscord<Elegantbeef> `wasMoved` zeros data
23:27:02FromDiscord<jovial_lamb_38837> sent a long message, see https://pasty.ee/jBPtaurRvOtx
23:27:55FromDiscord<jovial_lamb_38837> division works as expected, but $ is ... janky? works, but there must be a simpler elegant solution i cant find?
23:28:19FromDiscord<Elegantbeef> Why are you echoing inside `$`?
23:29:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=fFDUKkhDlEJu
23:29:05FromDiscord<takemichihanagaki3129> In reply to @jovial_lamb_38837 "'''type Dollar = distinct": $ should return a string instead, I guess.
23:29:13FromDiscord<takemichihanagaki3129> sent a code paste, see https://play.nim-lang.org/#pasty=HzpZmsdWBpbo
23:29:51FromDiscord<ezquerra> So =destroy should call wasMoved(storage) at the end?
23:29:56FromDiscord<jovial_lamb_38837> lol, fair point ... I never noticed bc it works just the same with the echo in there
23:29:58FromDiscord<Elegantbeef> No
23:30:13FromDiscord<Elegantbeef> `=wasMoved` zeros memory and is called in appropriate places
23:30:20FromDiscord<Elegantbeef> All you need in `=destroy` is a `isNil` check
23:30:26FromDiscord<ezquerra> Ah, so nim calls it
23:30:40FromDiscord<Elegantbeef> It should be `=destroy` `=wasMoved` by Nim wherever needed
23:30:49FromDiscord<Elegantbeef> Or `=wasMoved` to disarm the destructor
23:30:57FromDiscord<ezquerra> OK, that makes sense
23:31:10FromDiscord<ezquerra> Thank you
23:34:12NimEventerNew thread by iffy1: Subset of enum values, see https://forum.nim-lang.org/t/11177
23:39:49FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=QSopRSmzxyzE
23:40:11FromDiscord<Elegantbeef> The builtin nim `=destroy` is not annotated `{.raises: [].}` and is magic
23:40:37FromDiscord<ezquerra> But is the built-in `=destroy` defined as taking a var??
23:41:56FromDiscord<Elegantbeef> Not in 2.0
23:42:44FromDiscord<ezquerra> Then I don't understand why nim generates that warning here (since I'm using nim 2.0)
23:42:55*def- joined #nim
23:43:41FromDiscord<Elegantbeef> Actually it might be reverted I don't recall
23:43:48FromDiscord<Elegantbeef> Just don't worry about the warning for now
23:50:16FromDiscord<ezquerra> 😯
23:51:31FromDiscord<that_dude.> In reply to @Tomz_plug "Hello sorry for bothering": <@&371760044473319454> This is still here btw
23:51:49FromDiscord<that_dude.> Thanks :)
23:52:11FromDiscord<ezquerra> OK, thank you beef!