<< 14-01-2023 >>

00:00:04*oprypin joined #nim
00:00:04FromDiscord<Elegantbeef> But yea horizon↵> Note\: var parameters are never necessary for efficient parameter passing. Since non-var parameters cannot be modified the compiler is always free to pass arguments by reference if it considers it can speed up execution.
00:01:00FromDiscord<Elegantbeef> At some time it used to explicitly state what the condition was but it's since been removed
00:01:51FromDiscord<<She>Horizon</Her>> In reply to @Elegantbeef "Bigger or equal to": Ah
00:02:50FromDiscord<Elegantbeef> For the most part Nim doesnt make the programmer think about optimisations or internals
00:02:53FromDiscord<<She>Horizon</Her>> In reply to @Elegantbeef "But yea horizon >": Ah alright then, must've missed that
00:03:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l8z
00:03:52FromDiscord<Elegantbeef> For instance `b` and `a` use the same data
00:04:53FromDiscord<<She>Horizon</Her>> What happens when a is changed later on? b stays the same? a is copied and modified there?
00:09:42FromDiscord<MadScientistCarl> How does the do notation actually work? Is it just like a regular expression?
00:14:24FromDiscord<Elegantbeef> If you mutate a after the `b = a` it copies
00:14:30FromDiscord<Elegantbeef> But it only copies if needed
00:14:57FromDiscord<<She>Horizon</Her>> Makes sense
00:16:34FromDiscord<Elegantbeef> This is also how `sink T` works
00:16:36FromDiscord<Elegantbeef> Resources are only given if it is safe to do so otherwise a copy is made
00:18:08FromDiscord<MadScientistCarl> How do I turn an iterator into a sequence? I am trying to sort the values of a table and return a sequence, but can't get the types right
00:19:22FromDiscord<MadScientistCarl> Well, I `.collect()` then do the sorting and it works. Not sure if it is the best idea.
00:19:23FromDiscord<auxym> toSeq in sequtils
00:21:10FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4l8H
00:21:16FromDiscord<auxym> so... if `nim check` segfaults, that's a compiler bug, right? Not an issue with my code?
00:21:46FromDiscord<pyolyokh> if nim's segfaulting it's a bug in nim, yeah
00:23:01FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4l8I
00:23:18FromDiscord<MadScientistCarl> I just notice, do declarations must be in order?
00:23:25FromDiscord<<She>Horizon</Her>> In reply to @auxym "so... if `nim check`": Nah your code is so bad, Nim just crashes when gazing upon it (joking)
00:23:49FromDiscord<<She>Horizon</Her>> In reply to @MadScientistCarl "I just notice, do": For procs you can forward declare
00:23:53FromDiscord<pyolyokh> In reply to @MadScientistCarl "I just notice, do": you mean, does a proc have to come before procs that use it? yes.
00:24:02FromDiscord<MadScientistCarl> So no mutual recursion
00:24:18FromDiscord<<She>Horizon</Her>> In reply to @MadScientistCarl "So no mutual recursion": Forward declaration would be your friend, hold on
00:24:50FromDiscord<<She>Horizon</Her>> sent a code paste, see https://play.nim-lang.org/#ix=4l8K
00:25:02FromDiscord<MadScientistCarl> I see
00:25:02FromDiscord<<She>Horizon</Her>> You'll quickly hit the recursion limit with that example but it works lol
00:25:50FromDiscord<auxym> https://nim-lang.org/docs/tut1.html#procedures-forward-declarations
00:25:56FromDiscord<pyolyokh> In reply to @MadScientistCarl "So no mutual recursion": none of the these kinds of limitations are hard limits on the kinds of code you can write. They're just Araq not wanting to complicate the compiler or slow it down for something he thinks isn't wise. Part of the post-2.0 vision is lightening up on that.
00:27:13FromDiscord<auxym> If I use the latest nightly devel build, overloadable enums should be working right?
00:27:45FromDiscord<Elegantbeef> Yea
00:27:53FromDiscord<auxym> because they're a) not working and b) apparently causing a segfault in nim. I'll try to create a minimal repro
00:34:30FromDiscord<auxym> ah well apparently `{.pure.}` with overloaded enums (pointless but I forgot to remove it) causes nim to segfault
00:34:37FromDiscord<auxym> should I report that as an issue?
00:34:56FromDiscord<pyolyokh> it's a bug, yes. nim's not supposed to segfault
00:38:37FromDiscord<auxym> here's the repro: https://play.nim-lang.org/#ix=4l8S I'll write up an issue
00:44:46FromDiscord<auxym> https://github.com/nim-lang/Nim/issues/21257
00:46:47FromDiscord<@thatrandomperson5-6310e3b26da03> how do i import compiler/ things? I installed using choosenim
00:47:48FromDiscord<Elegantbeef> Auxym remove `pure`
00:47:56FromDiscord<Elegantbeef> Oh lol you did
00:48:23FromDiscord<Elegantbeef> compile your program with `--path:"$nim"`
00:48:23FromDiscord<@thatrandomperson5-6310e3b26da03> > how do i import compiler/ things? I installed using choosenim↵Any ideas, i don’t think it kept the lib
00:48:37FromDiscord<auxym> In reply to @Elegantbeef "Oh lol you did": yeah, fixes the segfault
00:48:45FromDiscord<auxym> In reply to @Elegantbeef "compile your program with": why?
00:48:53FromDiscord<Elegantbeef> Cause it adds the compiler path
00:48:59FromDiscord<Elegantbeef> That message wasnt to you
00:49:12FromDiscord<auxym> oh
00:51:27FromDiscord<MadScientistCarl> Is there a `zipWith` function?
00:52:14FromDiscord<Elegantbeef> not that i know of
00:52:38FromDiscord<Elegantbeef> Worth noting that Nim is not rust so doing pure FP style code will generally be much much slower due to nested allocations
00:52:59FromDiscord<Elegantbeef> https://github.com/zero-functional/zero-functional is better in that regard
00:53:05FromDiscord<auxym> or use zero-functional if you really want to do it
00:53:11FromDiscord<auxym> yeah that
00:53:20FromDiscord<Elegantbeef> Too slow here
00:53:25FromDiscord<auxym> D:
00:53:31FromDiscord<Elegantbeef> Ah too slow on discord aswell 😄
00:53:38FromDiscord<MadScientistCarl> That's cool
00:54:00FromDiscord<ShalokShalom> Can anybody explain me in stupid language, what an event store database is?
00:54:09FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4l8X
00:54:35FromDiscord<Elegantbeef> Yea collect is likely the best since it doesnt hide imperative code in procedure calls
00:55:04FromDiscord<Elegantbeef> But then again i just avoid FP style Nim code as i find it not very efficient or readable
00:59:25FromDiscord<huantian> In reply to @ShalokShalom "Can anybody explain me": I think it’s when you have a database that doesn’t store its current state, but the operations performed to get to its current state
01:15:30FromDiscord<MadScientistCarl> What are some good command line prompt libraries?
01:15:56FromDiscord<MadScientistCarl> Like menus, prompts, etc
01:16:29FromDiscord<Elegantbeef> Depends what you're after, nimwave exists. Cligen and other argparsers exist aswell
01:16:42FromDiscord<MadScientistCarl> Not those. Think `nimble init`
01:17:19FromDiscord<Arathanis> doesn't nimble roll its own with std/terminal?
01:17:46FromDiscord<Elegantbeef> Yea
01:17:59FromDiscord<Elegantbeef> Nimwave or using illwill directly would be the best
01:18:06FromDiscord<Elegantbeef> I dont know if there are prerolled versions
01:19:25FromDiscord<Arathanis> im not aware of any either, so maybe use cligen to create your command line then rol your own presentation layer using std/terminal?
01:19:32FromDiscord<Arathanis> nimble is open source so you can see how they are doing it
01:19:54FromDiscord<Elegantbeef> really though a generic variation of "ChooseX" isnt too complicated
01:20:04FromDiscord<Arathanis> very true
01:20:21FromDiscord<Arathanis> Sounds like they want someone to port `rich` to nim
01:20:53FromDiscord<Elegantbeef> No clue what that is
01:21:09FromDiscord<Arathanis> its a python library for generating... basically exactly what they want.
01:21:12FromDiscord<Arathanis> its very nice
01:21:15FromDiscord<Arathanis> i like it a lot
01:21:15FromDiscord<Elegantbeef> Ah
01:21:26FromDiscord<Elegantbeef> It's like one procedure really though 😄
01:22:03FromDiscord<Arathanis> true, though i sort of got the feeling they were looking for a library that could be used to build nimble's prompts and more
01:22:18FromDiscord<Elegantbeef> Well time to author it 😛
01:22:23FromDiscord<Elegantbeef> Not me, them
01:24:32FromDiscord<Elegantbeef> I guess nimble init also does the whole keyboard select thing
01:24:43FromDiscord<Elegantbeef> Nimwave would be a good base for that
01:34:35FromDiscord<ambient> People talking about functional style in Nim, could I basically write a Forth like style instead of iterators? 🤔
01:34:44FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4l9i cause i cannot help myself i wrote a simple version of the query
01:34:45FromDiscord<ambient> I mean wouldn't stack based chained calls work better here
01:35:27FromDiscord<Elegantbeef> I dont know what you mean
01:35:54FromDiscord<Mustache Man> i don't either, but I do have a question related to iterators. I'm struggling to think of a way to pause/continue iterating over a hash table from a particular index.
01:36:28FromDiscord<ambient> instead of stuff.map(x=>x+1).filter(x=>x<3) you could do stuff +1 ❤️ filter
01:36:35FromDiscord<Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=4l9j
01:36:43FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=4l9j" => "https://play.nim-lang.org/#ix=4l9k"
01:36:44FromDiscord<ambient> (edit) "❤️" => "< 3" | "< 3filter ... " added "(goddamn discord)"
01:37:04FromDiscord<Elegantbeef> Ambient how does that resolve iterating twice and or allocating sequences
01:37:41FromDiscord<ambient> stuff+1 and < 3 is inplace. filter is setLen(whatever)
01:37:52FromDiscord<Elegantbeef> And i mean there are macro libraries zerofunctional and iterutils
01:38:32FromDiscord<Elegantbeef> I dont understand how changing the syntax changes the problem
01:39:10FromDiscord<Elegantbeef> you need to iterate over a sequence for instance adding 1, then you need to iterate over the sequence removing all elements that \>= 3
01:39:35FromDiscord<ambient> you need to sort in place and setlen, no new memory alloc or anything
01:39:47FromDiscord<Elegantbeef> Well then make a macro that does that
01:40:32FromDiscord<Elegantbeef> But how does it work for `myThing.map(parseInt).filter(x => x > 30)`
01:41:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9m
01:42:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9n
01:42:50FromDiscord<Elegantbeef> Mustache you really need to clarify what you're after
01:43:31FromDiscord<pyolyokh> In reply to @Mustache Man "i don't either, but": put the keys in a seq and pop keys off of it. Or find a way to do your work during a .keys loop
01:44:01FromDiscord<Mustache Man> it's a simulation with a processing "limit"
01:45:20*nick2 joined #nim
01:46:34FromDiscord<huantian> Maybe uae beef’s thing to convert the inline itertator to a closure iterator?
01:47:09FromDiscord<Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=4l9o
01:47:47FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=4l9o" => "https://play.nim-lang.org/#ix=4l9p"
01:49:01FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=4l9p" => "https://paste.rs/1jo"
01:49:16FromDiscord<Mustache Man> it goes 'round and 'round the items, processing forever
01:49:17FromDiscord<Elegantbeef> Today is an iterator day↵(@huantian)
01:50:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9u
01:50:35FromDiscord<Elegantbeef> Actually that probably needs to be `i (key, val)`
01:50:42FromDiscord<Elegantbeef> whoops `i, (key, val)`
01:53:22FromDiscord<Mustache Man> huh it doesn't like that, too many variables?
01:54:44FromDiscord<Elegantbeef> Works fine
01:54:48FromDiscord<Mustache Man> Elegantbeef I don't know how you're always helping out. You're a saint
01:54:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9w
01:55:02FromDiscord<Mustache Man> oooh enumerate, i was missing that
01:55:38FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/1E9
01:55:44FromDiscord<pyolyokh> eh, that's what you wanted? How are you going to resume the loop after you break it?
01:56:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9y
01:56:36FromDiscord<Elegantbeef> Instead of making 2 collections
01:56:39FromDiscord<Mustache Man> In reply to @pyolyokh "eh, that's what you": i think i'll have to use a closure
01:56:43FromDiscord<Mustache Man> as you suggested
01:57:00FromDiscord<Elegantbeef> @ambient\: no clue if you cared but yea the solution is just for loop macros imo 😛
01:57:51FromDiscord<Elegantbeef> The dumb closureless way is to just store the last index and skip until you get it again
01:58:01FromDiscord<Elegantbeef> Since Nim hides the low level details of tables
01:58:36FromDiscord<Elegantbeef> It does make iteration a massive O notation
01:58:56FromDiscord<Elegantbeef> But then again iterating tables is bad for your health
01:59:01FromDiscord<Mustache Man> yeah >_<
01:59:47FromDiscord<Elegantbeef> What's your key and your value in your table?
01:59:59FromDiscord<Mustache Man> key is a distinct int16
02:00:20FromDiscord<Elegantbeef> This sounds a lot like just an enum that you've made 65k size
02:00:49FromDiscord<Elegantbeef> Do you actually need 0..65k values
02:02:00FromDiscord<Mustache Man> value is a ref object with 5 ints, a bool, a set of distinct int16s, and another distinct int16
02:02:42FromDiscord<Elegantbeef> Yea value doesnt matter as much, but yea do you really need the 65k range?
02:02:58FromDiscord<Mustache Man> it's not really an enum, it's a random ID, a "fingerprint" if you will
02:03:19FromDiscord<Elegantbeef> Ok so you promise it's not a subrange of that value that is an ordinal 😄
02:03:56FromDiscord<Mustache Man> well it is generated in an ascending fashion lol
02:04:04FromDiscord<Mustache Man> 1, 2, 3 ...
02:04:10FromDiscord<Elegantbeef> Up to?
02:04:16FromDiscord<Mustache Man> as much as needed
02:04:16FromDiscord<Elegantbeef> 32k
02:04:40FromDiscord<Elegantbeef> \I'm just trying to figure if an `array[MyVal, T]` is an option
02:04:48FromDiscord<Elegantbeef> Or if that's too much memory to allocate
02:05:28FromDiscord<Mustache Man> well T isn't known ahead of time
02:06:14FromDiscord<Mustache Man> i'll say this: i was previously using a seq with no issue, i was just hoping to speed it up
02:06:39FromDiscord<Elegantbeef> Yea dont get me wrong, i was just trying to figure if an array would be valid here
02:06:50FromDiscord<Elegantbeef> If you need the sparseness that a table gets then likely not
02:07:12FromDiscord<Elegantbeef> Fully allocated the most you'd allocate assuming you only use natural values of int16 is 32k
02:07:19FromDiscord<Elegantbeef> So that's 262kb total
02:08:08FromDiscord<Mustache Man> oh i see what you're getting at, yeah that's pretty small
02:08:40FromDiscord<Mustache Man> i'm not a systems/game dev so i don't think about options like that 😅
02:09:04FromDiscord<Elegantbeef> You still get the whole `O(1)` look up you get slightly faster iterations, but you lose the sparseness of a table and use a flat amount of memory
02:10:06FromDiscord<Elegantbeef> Yea I just avoid tables generally, unless they're the only option
02:10:12FromDiscord<Mustache Man> i'll look into trying that for awhile. thanks!
02:10:17FromDiscord<Elegantbeef> Enum indexed arrays go a long way
02:10:27FromDiscord<Mustache Man> unless you're interviewing for a job, then the answer is always "use a hashtable"
02:10:46FromDiscord<Elegantbeef> Bleh i like cache coherency and fast O(1) lookups
02:11:41FromDiscord<Elegantbeef> \I will never not refer to the person here that was using a `Table[OpCode, T]` for their powerPC VM that was sped up tremendously by diffing `{...}.toTable` to `[...]`
02:12:02FromDiscord<Elegantbeef> With that minor change they got like 20 times the performance
02:12:24FromDiscord<Elegantbeef> O(1)s are not all equal kids!
02:13:03*nick2 quit (Quit: WeeChat 3.8)
02:15:30FromDiscord<ambient> Or you could O(0.000001) with a GPU
02:16:17FromDiscord<Elegantbeef> That's ... not how any of this works
02:17:36FromDiscord<ambient> Writing a solver for equations dealing with 2D arrays is a completely different experience on CPU vs GPU even when technically they are the same complexity
02:19:30FromDiscord<Elegantbeef> Still have to account for the IO
02:19:39FromDiscord<Rika> In reply to @ambient "Or you could O(0.000001)": O notation dictates the shape and not the value
02:19:42FromDiscord<Elegantbeef> Though in many cases depending on the data set that's nothing
02:19:58FromDiscord<Elegantbeef> I'm sure ambient was joking
02:19:59FromDiscord<Elegantbeef> I hope ambient was joking
02:21:00FromDiscord<MadScientistCarl> Can I return a mutable reference?
02:21:10FromDiscord<MadScientistCarl> Of a `object`, not `ref` type
02:21:17FromDiscord<Elegantbeef> Yes
02:21:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4l9G
02:21:46FromDiscord<MadScientistCarl> I get "expression has no address"
02:21:57FromDiscord<Elegantbeef> Code
02:22:19FromDiscord<MadScientistCarl> Oh, I forgot to put `var` in self
02:22:44FromDiscord<Elegantbeef> But it has to be consumed cause nim does not have a borrow checker
02:22:59FromDiscord<Elegantbeef> So `var a = myObj.doThing(); a = 300` doesnt do the same as `(myObj.doThing()) = 300`
02:23:19FromDiscord<MadScientistCarl> What do you mean by consumed
02:23:30FromDiscord<Elegantbeef> It needs to be used as an L-value
02:23:56FromDiscord<Elegantbeef> It cannot be stored, it has to go into a callable that operates on a `var T` if you want to keep it as a mutable refernece
02:23:57FromDiscord<MadScientistCarl> So it can't be stored in a variable and used later?
02:24:00FromDiscord<Elegantbeef> reference even
02:24:14FromDiscord<MadScientistCarl> What about `obj.getSomeTable()[i] = x`
02:24:22*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
02:24:23FromDiscord<MadScientistCarl> Does that do what I think it does?
02:24:49FromDiscord<Elegantbeef> Yes it cannot be stored in a variable
02:24:52FromDiscord<Elegantbeef> Yes that does do what you want
02:24:55FromDiscord<Elegantbeef> since `[]` consumes
02:25:02FromDiscord<MadScientistCarl> OK, that is good enough, I think
02:25:17FromDiscord<MadScientistCarl> Maybe Nim 3.0 can get a borrow checker 🙂
02:25:18FromDiscord<Elegantbeef> I say consume but i dont know if it's the most apt verb
02:25:24FromDiscord<Elegantbeef> Nim 2.x will have one
02:25:33FromDiscord<Elegantbeef> It already has a broken one
02:25:49FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#view-types
02:25:53FromDiscord<ambient> Do we have to start worrying about lifetimes?
02:25:59FromDiscord<Elegantbeef> Nope
02:26:52FromDiscord<Elegantbeef> Atleast not like rust's
02:27:17FromDiscord<Elegantbeef> Nim's lifetimes are much simpler of "Making a view closes a variable from making a view until the most recently made view's last usage"
02:28:12FromDiscord<Elegantbeef> It's quite simple
02:29:00FromDiscord<Elegantbeef> This is likely to change a bit as views get worked on more, but from what i've seen it's not going to get that complex
02:29:31FromDiscord<ambient> So if I have a seq, I can't have multiple views, even when they do not overlap?
02:30:07FromDiscord<Elegantbeef> Openarray could be special cased
02:31:46FromDiscord<Elegantbeef> Either way it's not like you cannot just do `myProc(a.toOpenArray(0, 5), a.toOpenArray(6, 10))`
02:31:52FromDiscord<Elegantbeef> Since that's currently valid
02:33:00FromDiscord<ambient> Nim looks so simple and innocent on the surface...
02:33:53FromDiscord<MadScientistCarl> Does Nim's object initialization have shorthands?
02:34:15FromDiscord<Elegantbeef> Nope you either make a constructor proc or use `MyThing(a: 100, b: 300)`
02:34:16FromDiscord<MadScientistCarl> Like making `A(field1: field1)` `A(field1)`
02:34:21FromDiscord<ambient> I recently saw this https://github.com/beef331/constructor
02:34:33FromDiscord<Elegantbeef> \Or i guess you could use macros)
02:35:41FromDiscord<Elegantbeef> Hmph this does give me yet another constructor idea
02:51:14FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4l9O
02:51:17FromDiscord<Elegantbeef> There that seems nice
02:51:22FromDiscord<Elegantbeef> Might even throw it in constructor
02:51:32FromDiscord<Elegantbeef> @Phil\: My 'legacy' code grows
02:52:17FromDiscord<MadScientistCarl> How would I append a sequence to another sequence in place?
02:52:28FromDiscord<Elegantbeef> `.add`
02:52:44FromDiscord<MadScientistCarl> That adds one element
02:52:52FromDiscord<Elegantbeef> It's overloaded
02:53:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#add%2Cseq%5BT%5D%2CopenArray%5BT%5D
02:53:11FromDiscord<MadScientistCarl> Ah OK, the error was not using `var`
02:53:34FromDiscord<MadScientistCarl> The message says it is method not found
02:53:44FromDiscord<MadScientistCarl> I guess it makes sense under Nim's dispatch rules
03:19:03FromDiscord<Elegantbeef> Well there we go more code for the legacy code machine! 😛 https://github.com/beef331/constructor#struct-intialisers
03:21:50FromDiscord<MadScientistCarl> What's the best way to habdle errors? Does Nim have something like the ? operator?
03:22:21FromDiscord<ambient> The use of [] in your code is not really obvious what it does
03:22:27FromDiscord<Elegantbeef> Nim has try except
03:23:01FromDiscord<Elegantbeef> I mean it's the dereference operator
03:23:04FromDiscord<Elegantbeef> I'm not teaching Nim basics inside of a constructor library
03:23:48FromDiscord<ambient> Just saying that I hadn't seen it before and reading through the docs I'm not a fan of that language construct
03:24:05FromDiscord<Elegantbeef> I think it's very nice
03:24:47FromDiscord<Elegantbeef> It's the same as array, and seq access
03:24:51FromDiscord<ambient> It's both an array constructor and a deref apparently
03:25:20FromDiscord<MadScientistCarl> Are exceptions more used or Result?
03:26:18FromDiscord<MadScientistCarl> Wait, is there even a result type?
03:26:42FromDiscord<Elegantbeef> not in the stdlib, there is a `option` type
03:26:52FromDiscord<Elegantbeef> Nim uses exception error handling
03:27:22FromDiscord<Elegantbeef> Which is ideal imo, minus performance implications
03:30:35FromDiscord<MadScientistCarl> I like Result type with sugar better, but exceptions are ok
03:31:55FromDiscord<Elegantbeef> Bleh results load the code with forced handling
03:32:02FromDiscord<Elegantbeef> If i'm writing code that i dont care if it raise an exception I dont like that one is forced to `?` it all away
03:32:22FromDiscord<Elegantbeef> I much prefer the Nim semantic of "If you dont want code to raise an exception, you can annotate it with `raises: []`
03:32:26FromDiscord<Elegantbeef> It's way less invasive imo
03:32:49FromDiscord<MadScientistCarl> ? Passes the error above like exceptions
03:33:02FromDiscord<Elegantbeef> I know how it works
03:33:04FromDiscord<Elegantbeef> It's an explicit behaviour required to be called
03:33:21FromDiscord<Elegantbeef> It's just wrong imo
03:33:38FromDiscord<MadScientistCarl> I like it more because I know what to expect just by looking at the types
03:33:54FromDiscord<Elegantbeef> I mean i can say the same with Nim's effect tracking
03:34:03FromDiscord<Elegantbeef> I know what a proc will raise by looking at it's type
03:34:08FromDiscord<MadScientistCarl> I am not there yet
03:34:24FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1063662339951440003/image.png
03:34:31FromDiscord<Elegantbeef> Click 3 dots in docs
03:34:35FromDiscord<Elegantbeef> You see `raises: [...]`
03:34:46FromDiscord<Elegantbeef> That's the compiler telling you that this proc raises those exceptions
03:34:49FromDiscord<ambient> Is there something like Rust question mark for Options? https://doc.rust-lang.org/rust-by-example/std/result/question_mark.html 🤔
03:34:53FromDiscord<Elegantbeef> Nim tracks what procedures rais what
03:34:58FromDiscord<MadScientistCarl> Ok, if the compiler helps, then great
03:35:15FromDiscord<Elegantbeef> https://github.com/arnetheduck/nim-result
03:35:26FromDiscord<MadScientistCarl> Time to add Monads
03:36:38FromDiscord<ambient> Now I don't know which to use nim-result or options
03:36:39FromDiscord<Elegantbeef> I just really think that the semantics of exceptions are nice, would be nifty if the compiler optimised heap allocated exceptions when it can
03:36:47FromDiscord<Elegantbeef> Neither use exceptions
03:36:48FromDiscord<Elegantbeef> 😛
03:37:52FromDiscord<Rika> In reply to @ambient "Now I don't know": Options are not meant to indicate an error response
03:38:27FromDiscord<ambient> Ok, so there is no ? lang construct for options
03:38:44FromDiscord<Elegantbeef> You can implement a `?` operator all day long
03:38:49FromDiscord<Elegantbeef> Nim is one of the most extensible language
03:38:58FromDiscord<Elegantbeef> s
03:38:58FromDiscord<ambient> I probably will
03:39:41FromDiscord<Rika> You cannot make it similar to rust
03:39:53FromDiscord<Rika> https://github.com/PMunch/nim-optionsutils
03:43:14FromDiscord<Gumbercules> https://github.com/alaviss/union
03:44:56FromDiscord<Gumbercules> If you're looking for an alternative to Nim's options
03:45:19FromDiscord<Elegantbeef> That's more like an alternative to results
03:45:26FromDiscord<Elegantbeef> Not really either way though
03:45:32FromDiscord<Elegantbeef> It's just sumtypes 😄
03:46:07FromDiscord<Gumbercules> Well it can work for both
03:49:26FromDiscord<Elegantbeef> Yea but it loses some intent, unless you do `type Option[T] = union(bool or T)`
03:51:58FromDiscord<Gumbercules> Yeah I was just pointing it out since results and options were being discussed and conceptually you can model both with ^
03:54:02FromDiscord<Elegantbeef> This is where i jokingly say "Why do we even have `Option[T]`, `ref T` works just fine?!"
03:57:44FromDiscord<ambient> So you suggest I would do something like this and just catch the exceptions? https://nim-lang.org/docs/manual.html#types-nil
03:58:13FromDiscord<Elegantbeef> No you cannot catch nil ref exceptions, and do not use `ref T` as a optional
03:58:14FromDiscord<ambient> Can an "an unrecoverable fatal runtime error" be caught?
03:58:34FromDiscord<Elegantbeef> Do people not get what "jokingly say" means?
03:58:50FromDiscord<ambient> You have to consider that I'm a noob
04:23:31*tiorock joined #nim
04:23:31*tiorock quit (Changing host)
04:23:31*tiorock joined #nim
04:23:31*rockcavera quit (Killed (calcium.libera.chat (Nickname regained by services)))
04:23:31*tiorock is now known as rockcavera
04:23:59*rockcavera quit (Remote host closed the connection)
04:29:08*rockcavera joined #nim
04:45:47*azimut quit (Ping timeout: 255 seconds)
05:48:02*arkurious quit (Quit: Leaving)
06:08:11FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4lal
06:53:44FromDiscord<fabricio> https://github.com/markspanbroek/questionable
06:54:23FromDiscord<Rika> I was trying to remember that
07:07:54FromDiscord<Gumbercules> so many options
07:08:28FromDiscord<Gumbercules> (edit) "options" => "options!"
07:12:18FromDiscord<Rika> What will result from this
07:12:27FromDiscord<Elegantbeef> Exceptional code
07:12:50FromDiscord<Rika> That’s something
08:33:28*rockcavera quit (Remote host closed the connection)
09:04:39FromDiscord<sealmove> `osproc.hasData` hangs when used on a process with the `poParentStreams` option enabled.
09:30:32*azimut joined #nim
09:31:11FromDiscord<sealmove> `stream access not allowed when you use poParentStreams`
09:38:01*azimut quit (Remote host closed the connection)
09:38:26*azimut joined #nim
09:39:50FromDiscord<pyryrin> how do i check in nim code if it's a release build
09:40:19FromDiscord<Elegantbeef> `when defined(release)`
09:40:42FromDiscord<pyryrin> its not working
09:43:40FromDiscord<Rika> In what way is it not working
09:44:28FromDiscord<pyryrin> sent a code paste, see https://play.nim-lang.org/#ix=4laW
09:46:07FromDiscord<Rika> Parentheses
09:46:13FromDiscord<Rika> Though I guess those shouldn’t matter
09:46:27FromDiscord<Rika> Where did you write the define
09:46:28FromDiscord<pyryrin> nope its the same with parenthesis
09:46:35FromDiscord<Rika> What’s the command you ram
09:46:41FromDiscord<Rika> Ran
09:47:45FromDiscord<pyryrin> i tried `nimble run -d:release --gc:orc` and `nim c -r src/temp.nim -d:release --gc:orc` both same output
09:49:53FromDiscord<pyryrin> and for some reason the nim c command says im building a debug build
09:50:46FromDiscord<pyryrin> ohhhhh you're supposed to put -d:release before the filename
09:54:08FromDiscord<Rika> Release goes before the file name in the second command
09:54:20FromDiscord<Rika> Nimble run does not pass arguments
09:54:57FromDiscord<pyryrin> someone said it does
09:55:05FromDiscord<Rika> I don’t remember it doing so
09:56:25FromDiscord<pyryrin> i didnt know all the options have to go before the filename
09:57:00FromDiscord<pyryrin> i've been building all my nim projects with gc:refc instead of orc by accident
09:57:59FromDiscord<Rika> After the file name the options are passed to the program itself
09:58:44FromDiscord<pyryrin> In reply to @pyryrin "i didnt know all": and as debug builds
10:10:50*ltriant joined #nim
10:15:38*ltriant quit (Ping timeout: 265 seconds)
10:38:11FromDiscord<badmachine> Hey all
10:38:21FromDiscord<badmachine> Does nim have something like python's fsspec?
10:38:50FromDiscord<badmachine> I was thinking of writing something but I wanted to make sure it wasn't already done
10:41:03FromDiscord<ringabout> In reply to @badmachine "Does nim have something": I don't think there is one
10:45:07FromDiscord<badmachine> Cool then I'll go ahead. `fsspec` has been super useful for libraries that work with data in "the cloud". I should call it something different though, maybe `abstract_fs`.
10:53:37FromDiscord<badmachine> So python's implementation uses inheritance. There is an abstractFS object and a bunch of methods have to be implemented. Given that procs are separate from object definitions in nim, how does one implement such a thing?
10:56:21FromDiscord<ringabout> You can use `methods` to implement dynamic dispatch.
10:56:44FromDiscord<badmachine> I guess I've found this: https://nim-by-example.github.io/oop/↵But I was wondering if there is a way to do this without using dynamic dispatch
11:07:03FromDiscord<badmachine> Is there a way to do this with generics maybe?
11:07:50FromDiscord<Rika> Probably?
11:07:59FromDiscord<Rika> I haven’t seen the Python implementation
11:19:48FromDiscord<planetis> Concepts ofc.
11:25:39FromDiscord<badmachine> Thanks bot
11:26:03FromDiscord<Phil> That's a new one, typically beef is hit with that line
11:28:38FromDiscord<badmachine> Is there a way to specify type in concepts?
11:29:01FromDiscord<badmachine> (edit) "type" => "types"
11:30:15*xet7 joined #nim
11:31:47FromDiscord<Rika> Concepts are more for narrowing down types in a generic, kinda
11:31:58FromDiscord<Rika> People compare it with interfaces
11:32:05FromDiscord<Rika> The difference is that concepts are compile time only
11:32:20FromDiscord<badmachine> sent a code paste, see https://play.nim-lang.org/#ix=4lbg
11:33:29FromDiscord<badmachine> ahhh maybe I could do
11:36:05FromDiscord<badmachine> sent a code paste, see https://play.nim-lang.org/#ix=4lbh
11:36:47FromDiscord<Rika> That’s kinda wrong iirc
11:37:19FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4lbi
11:37:32FromDiscord<Rika> (edit) "https://play.nim-lang.org/#ix=4lbi" => "https://play.nim-lang.org/#ix=4lbj"
11:38:22FromDiscord<badmachine> Gotcha. Let me try to implement this with local filesystem.
11:38:24FromDiscord<badmachine> Thanks 🙂
11:38:27FromDiscord<Rika> These are old style concepts too by the way, there’s a newer syntax for them (but I don’t recall how to use them)
11:42:00FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4lbm
11:42:27FromDiscord<ringabout> (edit) "https://play.nim-lang.org/#ix=4lbm" => "https://play.nim-lang.org/#ix=4lbn"
11:42:52FromDiscord<badmachine> Thanks! this looks much neater. Is it supported on 1.6? That's the version I'm running
11:43:47FromDiscord<ringabout> Yes
11:44:16FromDiscord<badmachine> Just confirmed, my VS Code is not yelling at me when I pasted it in. Just had to change `Self` to `Filesystem`
11:53:24FromDiscord<badmachine> sent a code paste, see https://play.nim-lang.org/#ix=4lbt
11:54:09*ltriant joined #nim
11:59:57FromDiscord<badmachine> sent a code paste, see https://play.nim-lang.org/#ix=4lbu
12:00:19FromDiscord<badmachine> I don't really understand what that means - and I wasn't able to find examples of how concepts are used online
12:00:26FromDiscord<Rika> That’s not how to use concepts
12:01:11FromDiscord<Rika> I’d write more but I don’t really want to program on a phone so maybe in a few hours or so or wait for someone else to answer
12:01:21FromDiscord<Rika> It’s also hard to explain in words
12:06:51FromDiscord<badmachine> Fair enough, thanks again to everyone for being so helpful
12:08:04FromDiscord<Rika> Let me try words anyway
12:08:38FromDiscord<Rika> Basically you have a concept and a type right? The type doesn’t “inherit” the concept just like how a type wouldn’t inherit an interface either
12:09:26FromDiscord<Rika> You implement them, in other languages using interfaces you do it explicitly by saying “I implement this interface by having these functions” but in Nim for concepts you just make a procedure that matches all procedures in the concept
12:09:35FromDiscord<Rika> No need to declare you implement the concept
12:10:38FromDiscord<Rika> Then in other functions where you would want to use all types that are compatible with that concept you write this: `proc useFs(fs: FilesystemConcept, ...)`↵And then you can pass any type that matches the concept to that function
12:10:52FromDiscord<Rika> If it doesn’t match it will error out
12:11:48FromDiscord<Rika> @badmachine
12:12:08FromDiscord<Rika> If you don’t understand then wait one and a half hours lol
12:13:51FromDiscord<badmachine> I think it makes sense. Let me try to code it to see if I can wrap my head around it
12:25:02FromDiscord<badmachine> sent a code paste, see https://play.nim-lang.org/#ix=4lbC
12:25:29FromDiscord<badmachine> and it outputs exactly what we want: `elif ru em sti yeh`
12:25:34FromDiscord<Rika> Exactly, but be careful as reverse isn’t checked there
12:25:38FromDiscord<Rika> Wait
12:25:40FromDiscord<Rika> Dumb
12:25:46FromDiscord<Rika> Reverse is for string okay that’s all good then
12:28:32FromDiscord<badmachine> There are about 50 methods that exist for AbstractFileSystem in fsspec, let's see how many I can implement 😄
12:34:23FromDiscord<badmachine> sent a long message, see http://ix.io/4lbF
12:40:43FromDiscord<hotdog> In reply to @badmachine "I sorta get that": I haven’t used concepts in a while, but one thing I remember doing that helped: break your concept up into smaller units, then put a bunch of `assert LocalFS is FileSystemCat` etc
12:40:52FromDiscord<hotdog> You can template it to make it less verbose
13:19:37FromDiscord<scipio> sent a long message, see http://ix.io/4lbM
13:20:47FromDiscord<scipio> @sOkam! is you reply with :?: you were MiA the last days, scroll up...
13:21:04FromDiscord<scipio> (edit) "is" => "if"
13:21:23*koltrast quit (Ping timeout: 255 seconds)
13:21:41FromDiscord<sOkam!> In reply to @scipio "<@186489007247589376> if you reply": because i don't get why you would call nim a glue or chameleon lang. the fact that it passes through C doesn't mean its not unique 🤷‍♂️
13:22:16FromDiscord<MadScientistCarl> If Nim can call C without an FFI then I woulf say it is really a glue language
13:22:31FromDiscord<MadScientistCarl> (edit) "woulf" => "would"
13:22:46FromDiscord<scipio> In reply to @sOkam! "because i don't get": Did I say Nim is not unique? That's your interpretation and it's wrong
13:23:09FromDiscord<sOkam!> In reply to @scipio "Did I say Nim": i was refering to the "not having an identity" part of the message
13:23:31FromDiscord<Rika> In reply to @scipio "I have the solution,": I see and somewhat agree with what you said, not sure if I would fully agree because I need time to think about it lol
13:23:38FromDiscord<sOkam!> In reply to @MadScientistCarl "If Nim can call": so cpp is a glue lang too?
13:23:41FromDiscord<scipio> In reply to @sOkam! "i was refering to": I also didn't say it doesn't have an identity
13:23:55FromDiscord<sOkam!> In reply to @scipio "I also didn't say": https://media.discordapp.net/attachments/371759389889003532/1063810698834092052/image.png
13:24:17FromDiscord<scipio> An identity problem is a branding issue....↵🤦‍♀️
13:24:23FromDiscord<MadScientistCarl> Cpp not quite. Cpp is a monster of a language that is probably as big as Rust now
13:24:49FromDiscord<scipio> It's not what you think about it, it's how its criticasters not using it would label it
13:24:56FromDiscord<ringabout> In reply to @MadScientistCarl "If Nim can call": You can use https://github.com/PMunch/futhark to import c headers automatically without ffi.
13:25:08FromDiscord<MadScientistCarl> Nim is smaller. It is actually not quite C compatible (ergonomic wise)
13:25:09FromDiscord<sOkam!> alright, im dumb and not understand a single word. i'll exit myself out of this discussion, since i clearly don't know what im talking about
13:25:30FromDiscord<cow> wait
13:25:35FromDiscord<cow> futhark is not bindings to futhark?
13:25:43FromDiscord<MadScientistCarl> I am aware of Futhark. But if it is not in stdlib, it is not "in the language"
13:25:58FromDiscord<cow> https://futhark-lang.org/
13:26:03FromDiscord<scipio> @sOkam! regarding branding and communication I think that is the correct assumption indeed. I have no idea about your programming skills. You're probably l33t in that, no pun intended.
13:26:11FromDiscord<Rika> No it’s not
13:26:25FromDiscord<Rika> The two things are independent and unrelated
13:27:33FromDiscord<MadScientistCarl> Nim's C compat is probably on Rust level, where you can declare stuff like "extern C" before using a function
13:27:43FromDiscord<scipio> @sOkam! also I am not here for a pissing contest; I am a very open minded person and I am not conflict seeking.
13:27:48FromDiscord<MadScientistCarl> But you still have to declare it
13:28:00FromDiscord<Rika> In reply to @scipio "<@186489007247589376> also I am": Damn I wish I were like that
13:28:02FromDiscord<scipio> ☮️ @sOkam!
13:28:11FromDiscord<Rika> In reply to @MadScientistCarl "But you still have": Pretty much yes
13:29:43FromDiscord<MadScientistCarl> So that led to my point: if Nim can just call C by including, with support of language or std, then it is a much better glue language
13:29:43FromDiscord<scipio> In reply to @MadScientistCarl "Nim's C compat is": What do you think has a more positive connotation to it?↵-a- Master of None↵or↵-b- Glue
13:30:03FromDiscord<scipio> That's what I meant with branding problem
13:30:07FromDiscord<MadScientistCarl> I would not use either
13:30:31FromDiscord<Rika> Neither have that much of a positive connotation, both are neutral skewed to negative imo
13:31:12FromDiscord<MadScientistCarl> If only Nim can "script easily with all the C library" 🙂
13:31:27FromDiscord<scipio> In reply to @MadScientistCarl "I would not use": Then what would you suggest would be a better "label" to define what Nim is?
13:31:41FromDiscord<MadScientistCarl> I am too new to say that
13:31:43FromDiscord<scipio> What does it excel at? What is Nim's absolute unique USP ?
13:32:06FromDiscord<MadScientistCarl> I started using it three days ago
13:32:26FromDiscord<scipio> We both have the green leave icon 😉
13:32:34FromDiscord<scipio> I beat you by one day tho
13:32:47FromDiscord<scipio> (edit) "leave" => "leaf"
13:32:58FromDiscord<MadScientistCarl> Right now I see it as a fast compile, small binary, lightweight quick language
13:33:30FromDiscord<cow> Nim seems to me like a better Go, with better FFI
13:33:30FromDiscord<scipio> And I've been researching about 40 ways to build a GUI application with Nim
13:33:39FromDiscord<MadScientistCarl> But its C interop is what I am really after
13:33:44FromDiscord<cow> being able to glue, doesn't make it a glue language
13:33:44FromDiscord<Rika> Most people would probably say it’s an easy prototyping language that’s much faster than Python
13:33:45FromDiscord<Rika> Maybe
13:34:08FromDiscord<scipio> In reply to @cow "Nim seems to me": That would be V
13:34:14FromDiscord<scipio> In terms of branding
13:34:18FromDiscord<MadScientistCarl> Nim's FFI is better than Go
13:34:19FromDiscord<scipio> Its syntax is near identical
13:34:27FromDiscord<cow> syntax is irrelevant
13:34:48FromDiscord<cow> unless it's as annoying as COBOL's syntax or something
13:35:55FromDiscord<cow> In reply to @scipio "That would be V": let's also not consider languages that haven't passed 1.0
13:36:20FromDiscord<MadScientistCarl> Well, seamless C FFI would reauire a C compiler inside Nim. Maybe that is hard.
13:36:24FromDiscord<scipio> sent a long message, see http://ix.io/4lbQ
13:36:42FromDiscord<scipio> In the case of "glue", it's definitely a feature
13:37:28FromDiscord<MadScientistCarl> I actually don't like indentation based syntax
13:38:02FromDiscord<cow> me neither, but I got used to it
13:38:04FromDiscord<scipio> That's not something to laugh at, it's something to _identify as a core feature_↵↵A spoon isn't better or worse as a knife, but I prefer eating my soup with a spoon when I want to eat soup.
13:38:05FromDiscord<MadScientistCarl> It is really problematic when code gets long or if you paste stuff
13:38:39FromDiscord<cow> In reply to @scipio "Syntax is only irrelevant": those features might make nim better at gluing, but they don't make it worse at the tasks Go is used for
13:39:07FromDiscord<MadScientistCarl> I would still be using Go if not because Nim's binary is 100 times smaller
13:39:43FromDiscord<scipio> Indentation is also a feature @MadScientistCarl , as it forces you to write human readable code for example. ↵nodeJS' "callback hell" after Ryan Dahl created it wasn't meant as a compliment
13:39:46FromDiscord<MadScientistCarl> So yeah, a great advantage of Nim is actually C~sized binary and compile time
13:40:36FromDiscord<MadScientistCarl> No, you don't need indentation sybtax to be readable. Enforcing indentation gives a lot of possibilities of mistakes
13:40:44FromDiscord<scipio> In reply to @cow "those features might make": But it does make Nim a better candidate for that as a language which deliberately does not support meta programming
13:40:53FromDiscord<cow> also, Nim has an official identity, as a systems programming language
13:41:03FromDiscord<MadScientistCarl> If you paste code and it is one level off? Good luck finding that one out
13:41:50FromDiscord<cow> In reply to @MadScientistCarl "If you paste code": you shouldn't be nesting more than 3-4 levels anyways
13:42:02FromDiscord<cow> it's bad practice
13:42:05FromDiscord<MadScientistCarl> If you really need 4 nested for loops and can' avoid it, and the next statements are on level 3, then 1, skipping 2? Well be careful
13:42:48FromDiscord<MadScientistCarl> Sure, but you can't always avoid 4 nested for loops
13:42:57FromDiscord<scipio> In reply to @cow "also, Nim has an": Arguably the person who created that "official identity" isn't the world's best PR strategist in computer science. ↵Jonathan Blow uses a slightly different approach for Jai. There's a lesson in there somewhere...
13:43:01FromDiscord<cow> if those for loops iterate, write a function that does it and use sequtils
13:43:49FromDiscord<MadScientistCarl> As I said, not always. Perhaps there is an algorithm that really calls for it
13:44:00FromDiscord<cow> yeah not always
13:44:13FromDiscord<cow> sometimes nesting is the easiest way
13:44:42FromDiscord<MadScientistCarl> Or maybe every statement use all variables that if you make functions, their argument list goes on for half a page
13:44:57FromDiscord<cow> that's what ref objects are good for
13:45:15FromDiscord<cow> to encapsulate related state variables
13:45:26FromDiscord<MadScientistCarl> Thdn each function have a different subset, so you have three pges of object type definition
13:45:43FromDiscord<MadScientistCarl> Of course that's contrived
13:46:15FromDiscord<cow> big objects is the least big problem of the three, I would say
13:46:18FromDiscord<MadScientistCarl> So the only practical problem I regularly see, are code pasting and long code
13:46:18FromDiscord<cow> if it's ref objects
13:46:57FromDiscord<MadScientistCarl> Your editor needs to be really smart, and it will never be sure
13:47:33FromDiscord<MadScientistCarl> Because when you copy code, the first line can be hanging, or your cursor just didn't include the indentation
13:47:54FromDiscord<cow> yeah but that's something you should fix anyways, when using brackets
13:48:03FromDiscord<MadScientistCarl> Your editor, even if ot understands Nim, is never sure if you mean to paste with or without indwntation
13:48:11FromDiscord<cow> i don't tolerate misindented lines in non-indentation sensitive langauges either
13:48:22FromDiscord<MadScientistCarl> If using brackets, there is no ambiguitiy
13:48:32FromDiscord<cow> but it's the same effort on the human's part
13:48:35FromDiscord<MadScientistCarl> Misindented lines are ugly, but correct
13:48:53FromDiscord<MadScientistCarl> You can have it misindent for one second, then auto indent it immediately
13:49:19FromDiscord<cow> i get what you mean, but in my experience, on the problems i was working on, it was never a problem
13:49:25FromDiscord<MadScientistCarl> In an indentation based language, you get incorrect code, and a formatter cannot fix it. Because, it is correct syntactically
13:49:28FromDiscord<cow> editors can be smarter with brackets indeed
13:50:48FromDiscord<cow> I also rarely copy-paste
13:51:12FromDiscord<cow> (edit) "I also rarely copy-paste ... " added "into more nested places"
13:51:19FromDiscord<MadScientistCarl> On the broght side, indentation based language don't need closing brackets, so it's shorter on page
13:51:29FromDiscord<cow> you can move everything out of nested places with templates
13:51:39FromDiscord<cow> the end result might or might not be more readable though
13:52:25FromDiscord<cow> In reply to @MadScientistCarl "On the broght side,": now it's just time to convince languages that () are evil too
13:52:49FromDiscord<MadScientistCarl> No, I use Lisp too
13:53:16FromDiscord<cow> they shouldn't be removed, but it's ugly to nest ()
13:53:23FromDiscord<MadScientistCarl> But lisp convention is to put closing stuff on same line
13:54:18FromDiscord<scipio> Jai brands itself as a high level language for game development. That is choosing which problem you want to solve. That's identity management, a clear mission.
13:55:40FromDiscord<scipio> And I predict that the minute it releases as stable it'll have a job market and a cult following.
13:56:41FromDiscord<scipio> Nim can achieve the same choosing a problem to solve. I', thinking Glue / Cement
13:56:50FromDiscord<scipio> (edit) "I'," => "I'm"
13:57:00FromDiscord<MadScientistCarl> Maybe call it Soldering because it is compiled
13:57:44FromDiscord<MadScientistCarl> Or Welding because it is statically compiled
13:58:36*jjido joined #nim
13:58:57FromDiscord<scipio> Many languages are compiled.
13:59:13FromDiscord<scipio> Branding isn't about choosing a name
14:00:13FromDiscord<scipio> Jai is probably called like so because its founder is named Jon(athan) and it also has "ai" in it.
14:01:08FromDiscord<scipio> I don't see an issue with the "name Nim"
14:02:02FromDiscord<Rika> Until you discover it’s old name? Lol
14:02:03FromDiscord<scipio> I'm asking myself why after 15 years of existing it has 50 GUI repos and no job market.
14:02:16FromDiscord<scipio> In reply to @Rika "Until you discover it’s": Nimrod is a biblical figure
14:02:27FromDiscord<Rika> Not to most people it ain’t
14:02:40FromDiscord<scipio> That's something else that's also true
14:03:06FromDiscord<scipio> Like I said, there are better PR strategists in the world
14:03:53FromDiscord<scipio> But if you like Nim and would like a fuckton of companies/clients throwing suitcases filled with money at you to write it for them, I suggest you listen to me.
14:04:44FromDiscord<cow> the cartoon bunny used the word in the biblical sense
14:04:54FromDiscord<cow> people just didn't get it
14:05:12FromDiscord<MadScientistCarl> Well, sometimes _not_ having a backing company is a feature...
14:05:40FromDiscord<MadScientistCarl> Though I am in no place to declare it because I am just getting started
14:06:43FromDiscord<cow> In reply to @scipio "But if you like": it's possible that you can improve the PR of a language, sure
14:07:21FromDiscord<cow> but "glue/cement" feels like a deviation from nim's current identity i think
14:07:29FromDiscord<cow> (edit) "but "glue/cement" feels like a ... deviation" added "large"
14:10:16FromDiscord<sealmove> does nim support process piping?
14:10:53FromDiscord<pyolyokh> it has <https://nim-lang.org/docs/osproc.html>
14:12:09FromDiscord<sealmove> yes i am looking at this and trying to figure out how to run a posix pipeline and manipulate its output within nim
14:12:43FromDiscord<scipio> @pyolyokh if you'd have to pick one feature Nim excels at, either currently or could excel it, which one? I do trust your technical assessment on Nim.
14:12:48FromDiscord<pyolyokh> Despite knowing all of those words, and even having a pretty good idea of them, I don't know what you're asking.
14:13:29FromDiscord<pyolyokh> if you want to spawn multiple processes and manage I/O between them, you're going to have to do much of that yourself.
14:13:52FromDiscord<pyolyokh> if you want to spawn a shell command containing pipes, just do that, and how much trouble the result is depends on what precisely you want to do with the shell command
14:14:36FromDiscord<pyolyokh> for example, the procs there that don't take an array of strings for the arguments, like the `execCmd("blah")`, those work by giving a shell the string
14:14:56FromDiscord<pyolyokh> but you could also use the array-of-strings ones and just pass the array to "/bin/bash"
14:17:30FromDiscord<MadScientistCarl> Can I not inherit a specialized generic type?
14:18:10FromDiscord<sealmove> I have the following issue. I want to run `A | B` and parse the output of `A` to know the progress.
14:18:12FromDiscord<MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lc5
14:18:35FromDiscord<pyolyokh> In reply to @รєคɭ๓๏שє "I have the following": just run the command "A | B", then, implicitly or explicitly to a shell
14:19:09FromDiscord<pyolyokh> execCmdEx is the simplest way to do that
14:19:40FromDiscord<sealmove> But the process takes minutes to complete. I am trying to spawn it with `startProcess` and monitor its progress.
14:20:13FromDiscord<pyolyokh> execCmdEx gives you the same set[processOptions] that you're trying to use with startProcess
14:20:26FromDiscord<pyolyokh> you can also used startProcess though
14:20:41FromDiscord<pyolyokh> just pass "A", "|", "B" to "/bin/bash"
14:20:51FromDiscord<sealmove> isn't execCmdEx blocking?
14:21:32FromDiscord<pyolyokh> oh yeah, it returns output as a string.
14:21:47FromDiscord<sealmove> I think only `startProcess` is non-blocking
14:27:08FromDiscord<scipio> In reply to @pyolyokh "oh yeah, it returns": Thanks for your reply.
14:28:57FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lca
14:29:11FromDiscord<sealmove> oh smart let me try
14:29:34FromDiscord<pyolyokh> input to a command that only does something when input's exhausted is a pretty annoying use of osproc that I ran into recently
14:31:58FromDiscord<pyolyokh> particularly as the document says you're not supposed to close the handles
14:32:17FromDiscord<pyolyokh> (edit) "document" => "documention"
14:32:19FromDiscord<MadScientistCarl> Is it generally true that I have to put everything related in the same file? I can't find a good way to split up files without causing cyclic imports
14:33:02FromDiscord<pyolyokh> In reply to @MadScientistCarl "Is it generally true": yes. modules = files and being generally order-dependent has that consequence
14:34:39FromDiscord<pyolyokh> there are languages where it's very noticeably less of an issue, but it's easier to cut with the grain of Nim than fight it
14:35:35FromDiscord<MadScientistCarl> I am putting all my types into one `types` module now
14:35:35FromDiscord<cow> In reply to @รєคɭ๓๏שє "I have the following": osproc is what you wanna use, just beware that if you don't read the output of pipes, they can fill up and pause the program that's writing to it
14:35:59FromDiscord<cow> there's an OS limit on pipe buffer size
14:36:00FromDiscord<MadScientistCarl> Then hopefully everything is in a tree now
14:36:12FromDiscord<cow> (edit) "there's an OS limit on pipe buffer size ... " added "(a few KBs)"
14:36:25FromDiscord<sealmove> In reply to @MadScientistCarl "I am putting all": yes this is the method i always use as well
14:37:56*koltrast joined #nim
14:38:43FromDiscord<cow> also, with osproc you can have the option of either giving the stdin/stdout of the nim process implicitly, or to provide your own
14:39:21FromDiscord<sealmove> with `env` parameter
14:39:26FromDiscord<sealmove> (edit) "parameter" => "parameter?"
14:39:58FromDiscord<sealmove> how do I specify the output stream of the command?
14:40:03FromDiscord<sealmove> (edit) "command?" => "process?"
14:40:42FromDiscord<pyolyokh> you don't. You either specify all parent streams or you get the output stream from the process after starting it
14:41:58FromDiscord<sealmove> yes, and if you use parent streams then you can't read output ( :
14:42:09FromDiscord<sealmove> `poParentStreams notin p.options API usage error: stream access not allowed when you use poParentStreams [AssertionDefect]`
14:43:15FromDiscord<cow> let me look at how i did it 2 years ago
14:44:09FromDiscord<pyolyokh> depending on what you're doing it might be simpler to fork osproc and ship that with your program. It's less flexible than the underlying API
14:45:10FromDiscord<pyolyokh> or, use <https://github.com/cheatfate/asynctools/tree/master/asynctools>
14:46:11FromDiscord<cow> yeah I just did osproc startProcess, and then wrote to the input stream and read from the output stream
14:46:35FromDiscord<cow> no parent streams
14:46:43FromDiscord<cow> (edit) "no parent streams ... " added "option"
14:46:45FromDiscord<sealmove> so no pipe basically?
14:47:04FromDiscord<cow> I did not need pipe
14:47:24FromDiscord<sealmove> ok i see. i didn't expect stdlib to not support this
14:47:28FromDiscord<cow> so maybe checking how osproc implements startProcess is the way?
14:47:51FromDiscord<cow> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/osproc.nim#L662
14:48:24FromDiscord<sealmove> okay thanks
14:53:49*arkurious joined #nim
14:55:22FromDiscord<MadScientistCarl> Any ETA for Nim 2.0?
14:58:30FromDiscord<pyolyokh> sent a long message, see http://ix.io/4lcc
15:01:05FromDiscord<Phil> TIL that nimble will refuse to work properly unless your project is a git repo and you have a first commit going... huh
15:01:17FromDiscord<pyolyokh> OTOH one-word salespitches are always lies, or charitably "fake it til you make it"
15:01:40FromDiscord<pyolyokh> In reply to @Isofruit "TIL that nimble will": I'm using nimble right now in a fossil repo with no git presence.
15:02:36FromDiscord<Phil> In reply to @pyolyokh "I'm using nimble right": I kept getting shell errors in my qml-play-around project where I hadn't run git init and done a commit because it wasn't finding a HEAD
15:02:53FromDiscord<Phil> Based on that I can only assume that git is mandatory shrugs
15:03:46FromDiscord<pyolyokh> there might be some feature I haven't used yet in this one that expects it, like nimble develop, or nimble install. But fetching other stuff, building the app, running tests, that works without git
15:04:04FromDiscord<Phil> My typical workflow is using nimble tasks for basically everything
15:04:20FromDiscord<Phil> My custom build task was the one that bombed
15:04:32FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lci
15:05:42FromDiscord<pyolyokh> shrug, that exact command works for me without git
15:05:49FromDiscord<Phil> Though I guess I got ahead of myself in stating nimble refuses to work. For me nimble tasks are roughly 80% of my nimble useage, the other 20% being install, so that bombing was annoying
15:06:02FromDiscord<Phil> Nim version 1.9.1
15:06:43FromDiscord<pyolyokh> even with that version.
15:07:10FromDiscord<pyolyokh> well, it doesn't need a git repo, but it still uses CLI git to pull source.
15:07:30FromDiscord<pyolyokh> if you have other local dependencies that you're pulling, it probably expects those to be git repos
15:08:35FromDiscord<Phil> The only ones I had were ones that worked fine under nim 1.6.10, namely nimqml which is a gitrepo and hosted on github
15:24:20FromDiscord<MadScientistCarl> If something is not a ref object and not `var`, is it safe to assume that it is immutable?
15:24:49FromDiscord<MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lcp
15:31:15FromDiscord<eyes> hm i am new and here to ask questions
15:31:30FromDiscord<eyes> there appears to be no help channel so i guess i am raw dogging this general chat 😳
15:32:21FromDiscord<eyes> I am trying to figure out the correct return type for functions which return json objects defined by pmunch's ``jsonschema`` package
15:32:54FromDiscord<eyes> oh i cant make threads
15:34:15FromDiscord<Phil> In reply to @MadScientistCarl "If something is not": Yes. Even if its a ref object, often times you'll find that nim copies stuff in the heap, so chances of you passing an object somewhere, that place modifying the object and that change affecting you from the outside are low.↵As in, I couldn't construct a scenario off the top of my head where that'd be doable in any manner, you'll just get copies
15:34:23FromDiscord<pyolyokh> In reply to @MadScientistCarl "If something is not": apart from interior mutability. And object can have ref/ptr fields
15:34:49FromDiscord<Phil> In reply to @eyes "there appears to be": The "main" chat is what questions are there for
15:35:12FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4lcq
15:35:17FromDiscord<jtv> The reference itself is immutable but the object it points to can be mutable
15:35:21FromDiscord<Phil> And you might want to avoid using threads, as I'm not sure how well those works for the folks using matrix/irc that are communicating to these channels via bridges
15:35:32FromDiscord<eyes> ah fair point
15:35:36FromDiscord<scipio> @eyes this is an extremely friendly community
15:35:44FromDiscord<scipio> Ask away
15:36:02FromDiscord<EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=4lcs
15:36:07FromDiscord<EyeCon> Sorry for the wall of text
15:36:15FromDiscord<jtv> Oh, eyes, the error messages are poor, but usually that means you used 'let' and then tried to change it
15:36:24FromDiscord<jtv> 'Change the variable declaration to 'var'
15:36:42FromDiscord<eyes> oh if the types are the same?
15:36:52FromDiscord<eyes> why does the return type need to be mutable?
15:37:33FromDiscord<pyolyokh> In reply to @jtv "Oh, eyes, the error": the parameter in this case isn't a `var something`, it doesn't need to be mutable
15:37:50FromDiscord<eyes> yeah unfortunately changing to var did not fix it
15:38:05FromDiscord<eyes> here is the function
15:38:05FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4lcu
15:38:38FromDiscord<eyes> it returns a ``JsonNode`` type defined by the ``jsonschema`` package found here https://github.com/PMunch/jsonschema
15:39:02FromDiscord<eyes> ive already tried defining the return type as JsonNode
15:39:12FromDiscord<eyes> and argument
15:39:19FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lcv
15:39:37FromDiscord<eyes> hm okay i saw that too but im new to nim
15:39:43FromDiscord<Phil> Wouldn't it complain about ambiguous types then?
15:39:52FromDiscord<eyes> can you explain what a module is and how to be explicit about using them
15:41:10FromDiscord<eyes> In my mind, nim would have defaulted to the type definition which is actually included in that file
15:41:10FromDiscord<Phil> 1 module = 1 nim file
15:41:18FromDiscord<eyes> ah okay
15:41:25FromDiscord<pyolyokh> In reply to @eyes "can you explain what": well, `include` copies and pastes code into the current source, so types in that file are defined in the current module
15:41:42FromDiscord<pyolyokh> misusing include is how ran into this myself
15:41:42FromDiscord<eyes> yes i believe thats the intended method of using the types
15:41:52FromDiscord<eyes> here wait let me show you
15:41:53FromDiscord<pyolyokh> you're not importing the same type that other users are importing
15:41:58FromDiscord<pyolyokh> you are copy and pasting that code into the module
15:42:11FromDiscord<pyolyokh> and that code creates `differentmodule.Type` types
15:42:19FromDiscord<eyes> https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim
15:42:33FromDiscord<eyes> this is the nimlsp code, and im also writing an lsp implementation in nim
15:42:40FromDiscord<Phil> Generally you will want to use import over include, include is for some specific edgecases on how you want to set up your code
15:43:02FromDiscord<eyes> okay hm
15:43:17FromDiscord<eyes> could you help me decipher why pmunch is using include in that link i sent?
15:43:18FromDiscord<Phil> Like when you have one massive module that must be in one file for some reason (e.g. because of private object fields) and still want to split it into smaller "sub"-modules that then comprise the full module
15:44:25FromDiscord<Phil> I can't, I don't have an understanding of the nimlsppkg that would allow me to quickly see what his technical reason for using include is
15:44:36FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lcw
15:44:52FromDiscord<Phil> It's just useful to know that typically include can be the source of a fair bit of weird behaviour if you don't have a very exact idea of why you want it and how you want to make use of it
15:45:13FromDiscord<pyolyokh> the names in this code are a.A, b.f ... and c.A, which is a different A
15:45:26FromDiscord<Phil> Because it's not a "normal" way of importing and thus has behaviour like suddenly the same procs existing in 2 places: Your original module and the module that you just included the code in
15:45:27FromDiscord<pyolyokh> because include is just copy and pasting, not importing
15:46:01FromDiscord<eyes> okay i think i understand the implications of include better then
15:46:17FromDiscord<eyes> so if you both imported and included a module, the symbols would be defined twice and conflict
15:46:26FromDiscord<pyolyokh> they wouldn't conflict.
15:46:30FromDiscord<eyes> oh thats nice
15:46:33FromDiscord<pyolyokh> but they wouldn't be the same
15:46:37FromDiscord<eyes> wha
15:46:43FromDiscord<eyes> okay so thats the namespaces thing then
15:46:47FromDiscord<Phil> When you want to dive deeper into information hiding and private fields is imo where includes become more useful
15:46:49FromDiscord<eyes> modulename.symbol
15:47:19FromDiscord<eyes> okay so uh im going to switch to import and see if that just magically makes things work
15:48:10FromDiscord<sealmove> `re` vs `nre` ?
15:48:45FromDiscord<eyes> uh oh
15:48:47FromDiscord<eyes> ``Error: undeclared identifier: 'RequestMessage'``
15:49:29FromDiscord<eyes> i dont think jsonscheme can be configured to export the symbols it creates
15:49:46FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4lcy
15:50:04FromDiscord<eyes> here is where the types are defined and jsonschema does its magic
15:50:04FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcz
15:50:36FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4lcz" => "https://play.nim-lang.org/#ix=4lcA"
15:50:53FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4lcA" => "https://play.nim-lang.org/#ix=4lcB"
15:51:06FromDiscord<eyes> okayyy
15:52:30FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4lcC
15:52:52FromDiscord<Phil> Now the key thing to figure out is "Where does the RequestMessage type come from", skimming over it I'm not quite finding it quickly
15:53:14FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lcD
15:53:34FromDiscord<eyes> ahh
15:54:09FromDiscord<MadScientistCarl> If I pass a `table[key]` into a `var` argument of a mutating function, will the original element be mutated?
15:54:38FromDiscord<Phil> Should be
15:54:49FromDiscord<MadScientistCarl> OK
15:55:00FromDiscord<Phil> Assuming the table is itself also a var
15:55:29FromDiscord<MadScientistCarl> is `let x, y = tuple` invalid syntax?
15:55:49FromDiscord<pyolyokh> it's not valid, but it's probably not what you want
15:55:55FromDiscord<pyolyokh> (edit) "valid," => "invalid,"
15:56:35FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lcE
15:56:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcF
15:57:54FromDiscord<MadScientistCarl> Hmm, `for` loop doesn't seem to require a pair of parentheses
15:58:05FromDiscord<pyolyokh> `let (x, y) = (1, 2)` will do what you want. In general the other syntax is the same thing as `let x = thing; let y = thing`, with thing copied-and-pasted, not the same object. Analogous to `var x, y: int`
15:58:20FromDiscord<pyolyokh> yeah it doesn't.
15:58:28FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcG
15:59:40FromDiscord<Phil> Fascinatingly, without the paranthesis, x will be the index in the seq and y will be the entire tuple entry
16:00:30FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcI
16:01:04FromDiscord<Rika> personally i think that feature is a mistake
16:01:26FromDiscord<Phil> Yeah I was mildly confused, I thought that was precisely the reason why we have `enumerate`
16:01:42FromDiscord<Rika> enumerate came MUCH much later than pairs
16:02:18FromDiscord<Phil> Either way, I don't think I'd make much of a fuss about it, I think it's still within the realm of what's a reasonable expectation
16:02:22FromDiscord<Phil> To implicitly get an index
16:02:53FromDiscord<Phil> I'd likely prefer the enumerate version myself to be more explicit that I want to have an index, but eh
16:03:16FromDiscord<pyolyokh> go has it, odin has it. It's just Python that's too old and stodgy to have a reasonable syntax like that.
16:03:18FromDiscord<MadScientistCarl> The Nim By Example page should probably demonstrate some more advanced patterns
16:06:38FromDiscord<Phil> Something that can actually be also a nice learning experience is either making SO questions out of the stuff learned here, or making small PRs to add to the examples provided by "nim by example"
16:07:41FromDiscord<Phil> https://github.com/flaviut/nim-by-example↵This is the repo in case you're interested
16:10:02FromDiscord<eyes> this sucks
16:10:31FromDiscord<eyes> anyways i solved my problem, ``jsonschema`` doesnt support exporting, so im just using more includes so now my shit is all one big module
16:10:56FromDiscord<eyes> i could created exported aliases for everything but code duplication makes me bleh
16:11:19FromDiscord<eyes> (edit) "created" => "create"
16:11:24FromDiscord<pyolyokh> put it all in one file. the includes'll just get you later
16:11:39FromDiscord<eyes> this is possible
16:11:44FromDiscord<eyes> i live on the edge
16:11:58FromDiscord<Phil> PMunch , when you're there how were people intended to make use of `RequestMessage`? (See discussion with eyes)
16:14:25Amun-Ra(not strictly Nim related) I fixed leak in my nim code - it appears one has not to call dlclose at the end of the code ;>
16:30:29*xet7 quit (Ping timeout: 260 seconds)
16:30:44FromDiscord<MadScientistCarl> Can I reexport symbols of another module?
16:30:54Amun-Rayes
16:31:23Amun-Rayou can export any symbols visible in the module you export from
16:31:39FromDiscord<Phil> You can also export an entire module
16:31:40FromDiscord<MadScientistCarl> Can I export every symbol?
16:31:43FromDiscord<Phil> `export <modulename>`
16:31:52FromDiscord<Phil> After importing it of course
16:32:04FromDiscord<MadScientistCarl> Does that export all symbols?
16:32:07Amun-Rayes
16:32:11FromDiscord<auxym> all visible ones
16:32:14FromDiscord<auxym> ``
16:32:15FromDiscord<MadScientistCarl> That's great
16:32:17Amun-Raany symbols marked with `*`
16:32:30FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcP
16:34:32FromDiscord<Saint> What does {1: "one", 2: "two"} produce if you don't do toTable
16:34:56FromDiscord<auxym> an array of tuples
16:35:09FromDiscord<auxym> https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor
16:35:23FromDiscord<Phil> So basically [(1, "one"), (2, "two")]
16:35:29Amun-Ranim secret: let s = {1: "ab"}; s → [(1, "ab")]: array[0..0, (int, string)]
16:35:37FromDiscord<auxym> I didn't feel like typing it out 😛
16:36:18FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lcQ
16:36:39FromDiscord<auxym> !eval [(1, "one"), (2, "two")].type
16:36:43NimBotCompile failed: /usercode/in.nim(1, 25) Error: expression 'typeof([(1, "one"), (2, "two")])' is of type 'typedesc[array[0..1, (int, string)]]' and has to be used (or discarded)
16:36:56FromDiscord<auxym> (edit) "!eval ... [(1," added "echo"
16:37:03FromDiscord<auxym> !eval echo [(1, "one"), (2, "two")].type
16:37:08NimBotarray[0..1, (int, string)]
16:37:37FromDiscord<Saint> In reply to @auxym "an array of tuples": Oh thank you!
16:37:53FromDiscord<Saint> In reply to @Isofruit "You can figure that": Do you use a nim REPL at all? I saw one but didn't seem like it was being maintained
16:38:07FromDiscord<Phil> For quick stuff I use inim
16:38:17Amun-Ra"nim secret" is poor man's repl
16:38:27FromDiscord<Phil> It's not a "true" repl, the closest thing is nim secret, but that only works with a subset of nim
16:38:33FromDiscord<Phil> Basically the part of nim that can work at compiletime
16:39:08FromDiscord<rakgew> I like inim
16:39:29FromDiscord<rakgew> I would love it it was closer to what ptpython offers
16:41:35FromDiscord<rakgew> like multi line repeats and edits, doc strings, colored syntax highlighting, saving repl sessions into files..
16:42:38FromDiscord<rakgew> using inim with tcc I found to be a nice upgrade, though.
16:43:21*xet7 joined #nim
16:43:42FromDiscord<Saint> In reply to @rakgew "I like inim": I'l check it out thanks!
17:11:34FromDiscord<Yasuke> sent a code paste, see https://play.nim-lang.org/#ix=4ld2
17:11:55FromDiscord<Yasuke> (edit) "https://play.nim-lang.org/#ix=4ld2" => "https://play.nim-lang.org/#ix=4ld3"
17:17:39*rockcavera joined #nim
17:37:14FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4lda
17:41:03FromDiscord<Saint> Is there a way to concat two tables?
17:43:52FromDiscord<Rika> In reply to @hmmm "broskis shouldn't be possible": Not functions with no arguments
17:44:11FromDiscord<Rika> Otherwise it would be indistinguishable from functions you want to pass as values
17:45:53FromDiscord<hmmm> ah I see
17:45:54FromDiscord<hmmm> ty rika
17:47:31FromDiscord<MadScientistCarl> Hmm, does `cligen` not support positional arguments?
17:51:41FromDiscord<MadScientistCarl> Also, where's argv? I see paramStr, but that is returning the i-th parameter
17:52:04FromDiscord<⚶ Zeno> make ur own `sys.argv`
17:52:07FromDiscord<⚶ Zeno> theres paramCount iirc
17:52:25FromDiscord<pyryrin> why isn't `cdecl` nim default calling convention? whats wrong with iit?
17:52:30FromDiscord<MadScientistCarl> Yeah, but I am trying to use `std/parseopt` here. The doc never explains how to get the arguments in the first place
17:52:36FromDiscord<⚶ Zeno> oh
17:52:40FromDiscord<⚶ Zeno> idk about that
17:56:39FromDiscord<MadScientistCarl> OK, `initOptParser` gets it if no cmdline is specified.
17:57:22FromDiscord<kots> see also os.commandLineParams: https://nim-lang.org/docs/os.html#commandLineParams
18:03:46FromDiscord<kots> sent a code paste, see https://play.nim-lang.org/#ix=4ldl
18:04:46FromDiscord<Saint> How do I add/merge to a Json obj/node?
18:05:02FromDiscord<Saint> This doesn't seem to be working
18:05:04FromDiscord<Saint> sent a code paste, see https://play.nim-lang.org/#ix=4ldm
18:05:06FromDiscord<Saint> payload is a json object
18:05:19FromDiscord<Saint> sent a code paste, see https://play.nim-lang.org/#ix=4ldn
18:11:36*SinfulSorrow joined #nim
18:18:48FromDiscord<Saint> Or rather is there a shortcut for a newJstring?
18:28:19FromDiscord<ShalokShalom> @Phil What do you think of Nextcloud?
18:28:45FromDiscord<badmachine> I know nim is snake and underscore insensitive - but is there a clear majority for either `snake_case` or `pascalCase` in the community?
18:28:56FromDiscord<badmachine> (edit) "snake" => "case"
18:35:29FromDiscord<ShalokShalom> we all want kebab-case
18:35:39FromDiscord<ShalokShalom> absolute majority, its not even close 😄
18:35:51FromDiscord<leetnewb> In reply to @ShalokShalom "<@180601887916163073> What do": Not phil obviously, but that's a very broad question!
18:36:09FromDiscord<ShalokShalom> yep
18:36:28FromDiscord<ShalokShalom> I am broad today 😋
18:37:05FromDiscord<Saint> In reply to @ShalokShalom "we all want kebab-case": whats the advantage of kebab-case?
18:37:20FromDiscord<Saint> Is it word boundaries in vim for example?
18:37:54FromDiscord<badmachine> I think it's a joke, a hyphen would be parsed and the minus operator
18:38:00FromDiscord<badmachine> (edit) "and" => "as"
18:38:22FromDiscord<ShalokShalom> i just think it looks good
18:38:26FromDiscord<ShalokShalom> personal preference
18:38:29FromDiscord<Saint> I don't think it's ajoke
18:38:30FromDiscord<ShalokShalom> readable
18:38:46FromDiscord<ShalokShalom> yeah, I imagine it could fail in Nim
18:38:54FromDiscord<ShalokShalom> I dont write Nim code, only hang out here 😄
18:39:48FromDiscord<ShalokShalom> not so case insensitive, what? 🤪
18:39:53FromDiscord<badmachine> In reply to @badmachine "I know nim is": Well if someone has a real answer that would be nice
18:40:16FromDiscord<ShalokShalom> I see a lot of camelCase
18:40:20FromDiscord<ShalokShalom> PascalCase is like taht
18:40:25FromDiscord<ShalokShalom> (edit) "taht" => "that"
18:40:54FromDiscord<ShalokShalom> But I guess its different, considered what it is
18:41:10FromDiscord<ShalokShalom> types are usually single words and capitalised
18:44:50FromDiscord<exelotl> @badmachine the recommended style is https://nim-lang.org/docs/nep1.html
18:45:47FromDiscord<Yasuke> Anyone know how to read from a file without getting an error that it cant open the text file? would love assistance
18:46:44FromDiscord<exelotl> does the file exist, the path correct, and the program has permission to read it?
18:47:37FromDiscord<MadScientistCarl> How do I specify types in `@[]`?
18:50:01FromDiscord<Yasuke> In reply to @exelotl "does the file exist,": yeah its a readable file. same location. even just a↵ var book = open("book.txt") ↵with a text file in that location causes that "cannot open" error. is there some special way I have to compile it when reading from a file?
18:50:22FromDiscord<exelotl> sent a long message, see http://ix.io/4ldC
18:50:45FromDiscord<MadScientistCarl> What about empty sequence?
18:54:33FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=4ldD
18:54:44*SinfulSorrow quit (Quit: Leaving)
18:56:09FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=4ldE
18:56:32FromDiscord<badmachine> In reply to @exelotl "<@147474779627192320> the recommended style": thanks, looks like it's psscal case
18:57:23FromDiscord<Yasuke> In reply to @exelotl "you shouldn't have to": https://media.discordapp.net/attachments/371759389889003532/1063894614106447922/image.png
18:58:59FromDiscord<exelotl> well, PascalCase for types, unprefixed enums, and constants if you feel like it. camelCase for everything else
18:59:21FromDiscord<exelotl> (edit) "enums," => "enum values,"
19:00:59FromDiscord<exelotl> In reply to @Yasuke "": what is the location of test.txt ?
19:02:08*xet7 quit (Ping timeout: 246 seconds)
19:02:08FromDiscord<Yasuke> its the same location as the nim file
19:02:41FromDiscord<Yasuke> oh my mother goose. wait a minute
19:03:08FromDiscord<Saint> Isn't there a way to do the tostring after the variable name?
19:03:11FromDiscord<Yasuke> wait so my....cmd has to be in the same location as the file???
19:03:23FromDiscord<Yasuke> and not just the nim file itself?
19:03:24FromDiscord<Lord Hellgrim The Infinite> sent a long message, see http://ix.io/4ldG
19:03:41FromDiscord<exelotl> yes, you have to `cd Documents`
19:03:48FromDiscord<Lord Hellgrim The Infinite> In reply to @Lord Hellgrim The Infinite "When I follow the": Shouldn't the version be 2.0.0, not 1.9.1?
19:03:50FromDiscord<Yasuke> https://tenor.com/view/key-and-peele-son-of-abitch-upset-gif-4276606
19:04:00FromDiscord<Yasuke> oof
19:04:30FromDiscord<Phil> In reply to @ShalokShalom "<@180601887916163073> What do": Nothing really, I don't use cloud services wherever I can avoid it.
19:04:42FromDiscord<exelotl> once your current working directory is correct, you don't even need to pass the full path of the nim file, you can just `nim c -r testStuff.nim`
19:04:46FromDiscord<ShalokShalom> Self setup
19:04:54FromDiscord<ShalokShalom> Also this?
19:05:11FromDiscord<ShalokShalom> Like, you only deploy static websites?
19:05:38FromDiscord<Yasuke> In reply to @exelotl "once your current working": thanks.... i guess since its gotta compile that makes since. im so used to python. never had this problem. literallly have had it the last few hours
19:05:39FromDiscord<exelotl> In reply to @Lord Hellgrim The Infinite "Shouldn't the version be": the convention is that odd numbers is for development versions, even numbers is for release versions↵so 1.9.x is correct since 2.0 isn't released yet
19:05:50FromDiscord<Phil> In reply to @Lord Hellgrim The Infinite "Shouldn't the version be": I haven't looked into the install instructions there, but that seems like it's just the devel branch of the compiler
19:06:01FromDiscord<Phil> Which is what nim 2.0 will be very soon
19:06:08FromDiscord<Lord Hellgrim The Infinite> In reply to @exelotl "the convention is that": Thank you!
19:06:44FromDiscord<Phil> In reply to @ShalokShalom "Like, you only deploy": I have a Linode server and don't really need more... and don't really deploy any static websites other than docs, which go on github pages
19:07:18FromDiscord<Saint> how to I use a method on a toString of an object?
19:07:22FromDiscord<ShalokShalom> you sounded like a full fledged web dev
19:07:31FromDiscord<Saint> Like on the string value of it, I thought there was some way to call $ after the var name
19:07:40FromDiscord<Phil> In reply to @Saint "how to I use": ($obj).method
19:07:54FromDiscord<Phil> In reply to @ShalokShalom "you sounded like a": and?
19:08:04FromDiscord<Saint> Is that the only way @Phil ?
19:08:16FromDiscord<exelotl> In reply to @Yasuke "thanks.... i guess since": you'd probably have the same issue in Python if you did `python ./foo/bar/myscript.py` and `myscript.py` was trying to read some file that existed in the same directory as the script.
19:08:17FromDiscord<Phil> In reply to @Saint "Is that the only": myproc($obj)
19:08:40FromDiscord<Phil> due to method call syntax these two ways are equivalent.↵Also myproc $obj
19:09:08FromDiscord<Saint> Oh okay
19:09:17FromDiscord<Saint> Theres no like obj.$().myproc
19:09:17FromDiscord<Yasuke> In reply to @exelotl "you'd probably have the": well I do that all the time. as long as I can call the python script from wherever I am, it grabs the file as long as its in the same location. which is why i was stumped
19:09:24FromDiscord<Saint> I thought I remembered something like that
19:09:53FromDiscord<exelotl> In reply to @Yasuke "well I do that": oh, that's surprising to me haha
19:09:56FromDiscord<Phil> That coooouuuuld work as well, actual symbols like `$`may behave weirdly though
19:10:10FromDiscord<ShalokShalom> In reply to @Isofruit "and?": web devs deploy to the web 😅
19:10:20FromDiscord<Saint> Btw also is there a difference between tuples made with () vs {}
19:10:28FromDiscord<Phil> In reply to @ShalokShalom "web devs deploy to": I do, just don't need more than one side project
19:10:30FromDiscord<ShalokShalom> sorry, I did get that
19:10:40FromDiscord<ShalokShalom> In reply to @Isofruit "I do, just don't": ah, I see
19:10:53FromDiscord<ShalokShalom> I thought you are working for a company too?
19:10:59FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=4ldJ
19:11:03FromDiscord<ShalokShalom> Or did you understand, I mean only your opinion as a hobbist?
19:11:08FromDiscord<Phil> In reply to @ShalokShalom "I thought you are": I am, we deploy on premise there
19:11:34FromDiscord<ShalokShalom> Aaaah
19:11:40FromDiscord<ShalokShalom> That makes a whole lot more sense
19:11:40FromDiscord<Phil> In reply to @ShalokShalom "Or did you understand,": I was under the assumption you just wanted to have my personal opinion on nextcloud
19:11:41FromDiscord<ShalokShalom> thy
19:11:53FromDiscord<ShalokShalom> In reply to @Isofruit "I was under the": Ah, I see. No, your general 😄
19:11:58FromDiscord<ShalokShalom> As a web expert 😛
19:12:34FromDiscord<Phil> My general one is that I've only used Linode and have a rough idea of AWS since we use them for image hosting and caching images
19:12:52FromDiscord<Phil> So can't really speak from experience
19:12:57FromDiscord<ShalokShalom> i see i see
19:13:06FromDiscord<ShalokShalom> I often overlook, how huge this space is
19:13:10FromDiscord<Phil> Generally at this point I just want any cloud provider to give me a vm I can easily manage and add volumes to on demand, ideally with a backup plan
19:13:11*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
19:13:24FromDiscord<ShalokShalom> one can literally work several years in it, and dont touch certain subjects
19:13:43FromDiscord<ShalokShalom> In reply to @Isofruit "Generally at this point": isnt that already standard?
19:14:02FromDiscord<ShalokShalom> and I meant more about the PHP codebase, and general architecture 😄
19:14:24FromDiscord<Phil> In reply to @ShalokShalom "isnt that already standard?": Yeh, that was my way of expressing that I don't want any pre-built stuff because that means I have to learn whatever custom stuff they built
19:14:43FromDiscord<Phil> Which would bring me no benefit for other providers
19:15:01FromDiscord<Phil> Which is particularly why I like the Linode server - it's just vanilla
19:15:30FromDiscord<Phil> I can do a whole lot more with it if I want to, but I can also just have it as a Debian machine that I configure my own docker images to run on
19:15:40*xet7 joined #nim
19:15:41*xet7 quit (Remote host closed the connection)
19:15:54FromDiscord<sealmove> how well does nim support mongodb?
19:15:54FromDiscord<Phil> In reply to @ShalokShalom "I often overlook, how": In terms of the amount of technologies to do the jobs its somewhat insane
19:16:08FromDiscord<Phil> Couldn't tell you, haven't used the drivers. There are packages though
19:16:17*xet7 joined #nim
19:16:39FromDiscord<Phil> And even if all they do is give you the document as a json string, with jsony together it should be fairly smooth sailing
19:16:41FromDiscord<sealmove> i am looking at nimongo, it has 100 stars... if someone has experience please comment :)
19:18:37FromDiscord<Phil> I kinda want to summon the desire to code since I have a couple spare hours finally, but I'm just really not feeling it. QML luckily isn't that hard to get into, but it would require like a concentrated week or so to dive into and I kinda can't summon the passion for anything that big right now
19:19:43FromDiscord<ShalokShalom> In reply to @รєคɭ๓๏שє "i am looking at": something with such a name.. can it even be a failure? 😄
19:20:20FromDiscord<ShalokShalom> In reply to @Isofruit "I kinda want to": Yeah, I can see that. The QT Widget bindings do look good actually
19:20:29FromDiscord<ShalokShalom> I never considered that, cause it looks horrible in C++
19:20:45FromDiscord<ShalokShalom> And GPU acceleration, mobile compability goes out of the window
19:20:53FromDiscord<ShalokShalom> I just really like this API
19:21:02FromDiscord<Phil> Which one? QT Widget? Or QML?
19:22:39FromDiscord<ShalokShalom> Nim Widget
19:22:44FromDiscord<ShalokShalom> QML anyway
19:23:02FromDiscord<ShalokShalom> But the connection between logic and UI seems tedious with QML
19:46:00FromDiscord<MadScientistCarl> Does anyone with experience compare Nim and Zig?
19:48:59FromDiscord<ShalokShalom> Zig is more lower level
19:49:23FromDiscord<auxym> I don't know zig in detail. Zig seems to require manual memory management, while nim, though it allows manual MM, is mostly built around automatic MM. They are both statically typed, and both have an AST-based macro system
19:49:39FromDiscord<ShalokShalom> You do a lot of stuff by hand
19:49:40FromDiscord<ShalokShalom> Also, you can use the Zig compiler to cross compile Nim code
19:49:57FromDiscord<ShalokShalom> (edit) "level" => "level↵You do a lot of stuff by hand"
19:50:26FromDiscord<MadScientistCarl> Seems like it can use C directly
19:50:35FromDiscord<ShalokShalom> https://github.com/enthus1ast/zigcc
19:50:55FromDiscord<ShalokShalom> Yeah, I think it also compiles to C?
19:51:06FromDiscord<ShalokShalom> Ah, no
19:51:14FromDiscord<ShalokShalom> I think Zigcc is just a linker
19:51:20FromDiscord<ShalokShalom> Whatever
19:57:24FromDiscord<MadScientistCarl> So in Nim, is it not possible to extend a specialized generic type?
19:57:54FromDiscord<huantian> what does that mean
19:58:43FromDiscord<MadScientistCarl> Say I have a base class A[T]. I want B to extend A[int]
19:59:17FromDiscord<MadScientistCarl> My real question, though, is to find a way to make interfaces with associated types
20:01:22FromDiscord<huantian> uhh like
20:02:39FromDiscord<ShalokShalom> @MadScientistCarl I did thought about object variants?
20:02:54FromDiscord<MadScientistCarl> Like I want an interface with function f. However, different types have a compile time decided signature
20:03:09FromDiscord<ShalokShalom> I assume they are a bit different, and still might fit your use case
20:03:51FromDiscord<huantian> In reply to @huantian "uhh like": https://play.nim-lang.org/#ix=4ldW maybe?
20:04:12FromDiscord<MadScientistCarl> sent a code paste, see https://paste.rs/E1v
20:05:07FromDiscord<MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4ldY
20:05:44FromDiscord<MadScientistCarl> I don't know if Nim has anything like that
20:08:03FromDiscord<ted__> In reply to @MadScientistCarl "I don't know if": A combination of what huantian posted in that nim play snippet above and object variants (https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants) which are nim's way of doing sum types, have solved most of my design cases in this area
20:08:11*jjido joined #nim
20:11:20FromDiscord<eyes> https://media.discordapp.net/attachments/371759389889003532/1063913224438829157/IMG_5893.png
20:11:31FromDiscord<MadScientistCarl> I am not looking for sum type, though an absence of those is also a bit problematic for me
20:11:32FromDiscord<eyes> is anyone else annoyed by the pure pragma
20:12:12madpropssounds like some hindu philosophy thing
20:12:20FromDiscord<eyes> clutters up the scope with a ton of variables, i’ve been using nim for like five minutes and i’ve been bitten in the ass 2/3 of the times i used pure
20:12:32FromDiscord<eyes> lol yeah
20:13:00FromDiscord<eyes> In reply to @eyes "": Also i hate variable abbreviations in names
20:13:08FromDiscord<eyes> like bro do you not have autocomplete
20:13:23FromDiscord<eyes> raw vi user?
20:13:46FromDiscord<ted__> then don't use `{.pure.}` and don't use hungarian prefixes. you'll just have to deal with possible collisions in your code then
20:14:02FromDiscord<huantian> in 2.0 with overloadableEnums, we'll get the best of both worlds
20:14:15FromDiscord<eyes> overloadableEnums?
20:14:17FromDiscord<MadScientistCarl> I guess I can give the generic a try
20:14:43FromDiscord<MadScientistCarl> Wait, I don't think it does what I'd like
20:14:46FromDiscord<eyes> In reply to @ted__ "then don't use `{.pure.}`": why would not using pure cause collisions?
20:15:00FromDiscord<MadScientistCarl> What if type `A` and `B` both use the same `T`?
20:15:57FromDiscord<Saint> what does regex study do?
20:17:43FromDiscord<ted__> sent a code paste, see https://play.nim-lang.org/#ix=4le3
20:17:44FromDiscord<MadScientistCarl> Not sure if it is a good idea to have a method with generic `T` and specialize on that
20:19:03FromDiscord<MadScientistCarl> I guess I will need to see if I can do it just with Nim's dispatching rules
20:20:57FromDiscord<ShalokShalom> In reply to @MadScientistCarl "I am not looking": https://github.com/andreaferretti/patty#constructing-variant-objects
20:20:59FromDiscord<ShalokShalom> sum types
20:21:07FromDiscord<ShalokShalom> just named and implemented Nim way
20:21:32FromDiscord<ShalokShalom> In reply to @huantian "in 2.0 with overloadableEnums,": this
20:21:51FromDiscord<MadScientistCarl> Ok, a macro. I'll try to use as much stdlib as possible when I am starting out
20:21:55FromDiscord<ShalokShalom> @MadScientistCarlNim is crude. Get used to it 😉
20:21:57FromDiscord<ShalokShalom> Its worth
20:22:03FromDiscord<ShalokShalom> And fits you, kinda 😄
20:22:32FromDiscord<ShalokShalom> In reply to @MadScientistCarl "Ok, a macro. I'll": This is just a shorthand for object variants with an enum attached
20:23:07FromDiscord<MadScientistCarl> If I have a thousand variants, does it take 1000x memory?
20:24:49FromDiscord<eyes> In reply to @ted__ "if you have a": okay it seems that pure does the opposite of what I thought it did? I’m not sure whats going on because I thought changing it fixed my problems
20:25:31FromDiscord<eyes> I was under the impression that pure causes an enum’s values to be accessible without prefixing the enum type
20:25:40FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/Rvr
20:25:46FromDiscord<ShalokShalom> Up is fsharp
20:26:09FromDiscord<ShalokShalom> And Discord highlighting for Nim is broken
20:27:12FromDiscord<ted__> In reply to @eyes "I was under the": `{.pure.}` encapsulates the values it contains and forces you to fully qualify the value with the containing enum type: https://nim-lang.org/docs/manual.html#pragmas-pure-pragma
20:27:14FromDiscord<ShalokShalom> (edit)
20:27:21FromDiscord<ShalokShalom> even that for ml fits it better
20:27:23FromDiscord<ShalokShalom> in my opinion
20:28:36FromDiscord<eyes> In reply to @ted__ "`{.pure.}` encapsulates the values": okay yeah i have no clues what my problems earlier were. pure is great! i have changed my mind
20:29:06FromDiscord<ShalokShalom> 💡 🧠
20:30:06FromDiscord<MadScientistCarl> Does Nim have union types?
20:30:16FromDiscord<MadScientistCarl> I mean that it overlaps the memory
20:30:54FromDiscord<MadScientistCarl> Or is that what the case under object do?
20:34:50*kenran joined #nim
20:36:34FromDiscord<konsumlamm> that is what case objects do, yes
20:36:47FromDiscord<huantian> Yes with case under object it’ll only use the memory of the largest variant
20:39:11FromDiscord<Phil> TFW you think "async won't be so bad, you'll just need to pass a proc, easy right?" And then nim has some custom stuff that you first need to wrap your head around
20:39:15FromDiscord<cow> In reply to @MadScientistCarl "Does Nim have union": yep https://media.discordapp.net/attachments/371759389889003532/1063920251462504568/image.png
20:39:24FromDiscord<Phil> (edit) "proc," => "proc that deals with the unpacked value,"
20:39:43FromDiscord<cow> (this type is an AST node for example)
20:40:10FromDiscord<cow> you should use enums to specify what types
20:40:19FromDiscord<cow> but beware, you can't have the same name in different cases
20:40:44FromDiscord<ted__> as others have said, that's what case statements are for. you can play with this a bit to see for yourself with the `sizeof` proc, here's an example: https://play.nim-lang.org/#ix=4lec
20:42:52FromDiscord<Phil> Turns out it is not quite as fancy as I thought... I hope, you just need to do the unpacking yourself via the read proc
20:48:20FromDiscord<Phil> Do you have to await with async? Doesn't that block? Or is it non-blocking?
20:56:53FromDiscord<Elegantbeef> Await doesnt block
20:57:02FromDiscord<Phil> and waitFor?
20:57:36FromDiscord<Phil> Yeah waitFor blocks, alrighty
20:57:46FromDiscord<Elegantbeef> Yes
20:58:23FromDiscord<Elegantbeef> You dont have to await a future, you can technically make the future then use a callback or `finished` on it to get the value
20:59:09FromDiscord<ShalokShalom> @jmgomez I just see the video of yours, Getting started with NimForUE on Windows and I think your voice is really well suited to make tutorials
20:59:11FromDiscord<Elegantbeef> Not that it's overly idiomatic
20:59:20FromDiscord<ShalokShalom> and everything else, where you hear a voice a long time
20:59:47FromDiscord<Phil> And "await" is supposed to... unpack a value from within a Future or sth?
21:00:18FromDiscord<Elegantbeef> Await allows giving up the cpu and is continuable
21:00:43FromDiscord<Elegantbeef> It goes "hey we can give the cpu up for this process, come back here when this future is finished"
21:01:11FromDiscord<Phil> Ah so basically await doesn't unpack anything, it just means "cpu, do other shit and only continue working on this piece of code when the future is finished. We're not unpacking, the user can do that in the followign lines of code"
21:01:29FromDiscord<Elegantbeef> Well it 'unpacks' the future since you're waiting for it
21:01:35FromDiscord<Elegantbeef> There isnt much reason to await and not unpack the future
21:05:31FromDiscord<Phil> Okay, so "await" is only for within async procs and unpacks values of a future.↵Async procs must return futures.↵Outside of async procs you cannot use await, you must use waitFor, which is blocking
21:05:47FromDiscord<Phil> Or you can use addCallback
21:06:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lek
21:06:11FromDiscord<Elegantbeef> Or use a callback
21:06:41FromDiscord<Elegantbeef> Both are a bit faux pas
21:07:46FromDiscord<Elegantbeef> You do need to use `poll` or similar proc that gives up cpu in sync code to allow the cpu to process other logic
21:08:01FromDiscord<Saint> How do I get the first element of a table?
21:09:48FromDiscord<Elegantbeef> You use `OrderedTable` and do `for key, val in myOrderedTable.pairs: result = val`
21:10:09FromDiscord<Elegantbeef> Alternatively you question whether you need a table
21:10:12FromDiscord<MadScientistCarl> Can you define bitwise logical ops on enums?
21:10:23FromDiscord<Elegantbeef> You dont need to
21:10:23FromDiscord<jmgomez> In reply to @ShalokShalom "<@726017160115126333> I just see": My spoken english kinda sucks but I appreciate the comment 😄
21:10:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lel
21:10:28FromDiscord<Elegantbeef> You use a `set[MyEnum]`
21:10:44FromDiscord<Elegantbeef> Yea jmgomez i wasnt going to be the dick that said "It's kinda hard to understand"
21:10:51FromDiscord<MadScientistCarl> Well, what if interfacing with C
21:11:10FromDiscord<Elegantbeef> You use a `set[MyEnum]` unless the C code doesnt use contiguous enums
21:11:24FromDiscord<Elegantbeef> A `set[MyEnum]` is a bitset but 100000 times more ergonomic
21:11:32FromDiscord<Elegantbeef> And with that i'll be back in a bit
21:11:42FromDiscord<MadScientistCarl> Well, Vulkan has enum bitset
21:12:10FromDiscord<ShalokShalom> In reply to @jmgomez "My spoken english kinda": its more the tone, that is soothing and I like the English as well
21:12:17FromDiscord<ShalokShalom> there is far more worse
21:12:27FromDiscord<MadScientistCarl> So each enum is actually defined one-hot bit, and using OR on them is normal operation
21:12:41FromDiscord<Phil> In reply to @ShalokShalom "there is far more": Written like a true german in search for his breakfast mirror egg
21:13:32FromDiscord<ShalokShalom> 😅
21:13:58FromDiscord<ShalokShalom> German English is only topped by that one from Indians.
21:14:24FromDiscord<ShalokShalom> Who ever invented Indians, thought surely "lets see how to make it the most funny, if they ever speak English"
21:15:14FromDiscord<Phil> In reply to @ShalokShalom "Who ever invented Indians,": Nothing beats people from Sachsen
21:16:05FromDiscord<ShalokShalom> A friend of mine is from Vienna
21:16:19FromDiscord<Phil> Anyway, I don't quite get why procs added with "addCallback" don't execute.↵Maybe I do have to waitFor the future in order for it to actually ever execute all its attached callbacks
21:16:24FromDiscord<ShalokShalom> And her way of talking English causes me to feel physically hurt
21:16:53FromDiscord<ShalokShalom> Its even on video
21:16:57FromDiscord<ShalokShalom> But I have mercy with you
21:17:26FromDiscord<Phil> Aaaaaand yep, you have to `waitFor` a future in order for its callback chain to get executed
21:18:26FromDiscord<Phil> So basically a future must sooner or later always end in a waitFor?
21:19:00FromDiscord<Phil> Well, or a while-loop that's also blocking as beef pointed out
21:20:33FromDiscord<jmgomez> As a side note Phil, if you use Nim as a library you could also have a exposed epol(0) via FFI and call it from that library loop. In the case of a game engine, the tick function
21:21:21FromDiscord<Phil> What benefit does that provide?↵Like, what does that give me?
21:21:55FromDiscord<jmgomez> In the particular case of the game engine being able to use await/async in the game thread
21:22:52FromDiscord<jmgomez> I guess it's applicable to UIs too
21:23:00FromDiscord<Phil> Check, I'm not going to do games so I'm likely not that much performance bound though ^^
21:23:24*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
21:23:49FromDiscord<Phil> I do wonder though what the equivalent in nim is to Javascripts `then` function
21:24:14FromDiscord<Phil> `addCallback` isn't quite an equivalent because `addCallback` requires you to waitFor the future that you're adding callbacks to
21:24:18FromDiscord<Phil> There is no such requirement in JS
21:24:20FromDiscord<ShalokShalom> You mean andThen?
21:24:24FromDiscord<ShalokShalom> In functional languages
21:24:46FromDiscord<Phil> I wouldn't know, I haven't done functional and nim itself has no `andThen` proc
21:24:47FromDiscord<jmgomez> It's `await`
21:24:53FromDiscord<Phil> await only works within async procs
21:24:59FromDiscord<Phil> As far as I've seen so far
21:25:00FromDiscord<jmgomez> you can wrap it in a func
21:25:12FromDiscord<ShalokShalom> No, doesnt seem so
21:25:15FromDiscord<Phil> Which then returns a future, which itself again must be waitfor'd again
21:25:17FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4lep
21:25:27FromDiscord<ShalokShalom> I just had seen Javascript
21:25:39FromDiscord<ShalokShalom> please excuse me for a second
21:25:43FromDiscord<ShalokShalom> I have to wash out my eyes
21:27:01FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4leq
21:27:15FromDiscord<jmgomez> In reply to @Isofruit "Which then returns a": just like `then` although then is not composable, that is. Nothing stops you from doing a flatmap or merge (think of rx extensions)
21:28:25FromDiscord<jmgomez> that map gets executed, you can turn it into a then by not returning. If you call epol at somepoint it will be resolved
21:28:28FromDiscord<Phil> In nim you're always sooner or later landing in a place in your call-hierarchy where you won't have an async proc, so you can't await while still having a Futurer[T] and at that point you're either while-looping over that until its finished or you use waitFor
21:28:50FromDiscord<Phil> So the equivalent in nim always needs an additional line after the "addCallback" that does a waitfor somewhere
21:29:11FromDiscord<jmgomez> but that's just because js calls the loop internally for you
21:29:25FromDiscord<Phil> Ah so JS does the same thing but implicitly?
21:29:39FromDiscord<Phil> Or rather you never get out of the equivalent of being in an async proc
21:29:48FromDiscord<Phil> (edit) "proc" => "proc?"
21:29:57FromDiscord<jmgomez> https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
21:30:08FromDiscord<Phil> Yeah EventLoop, just haven't yet connected the dots fully
21:30:26FromDiscord<Phil> Watched a pretty nice talk about it and about the different stages it has etc.
21:37:13FromDiscord<Phil> Okay so maybe I'm just tired, but this:↵> min time avg time std dv runs name↵> 23.221 ms 27.428 ms ±2.204 x179 Aldrune calls↵Basically means the proc "aldrune calls" needed an average time of 27 and a half milliseconds... right?
21:47:03*kenran quit (Remote host closed the connection)
21:48:23FromDiscord<Elegantbeef> Then Nim's bitset should work↵(@MadScientistCarl)
21:48:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lew
21:49:03FromDiscord<Elegantbeef> Whoops that should be `1 or 2 or 4`
21:49:22FromDiscord<MadScientistCarl> But can I explicitly assign which bit is which name?
21:50:02FromDiscord<Elegantbeef> Order of declaration
21:50:14FromDiscord<Elegantbeef> The ordinal value is the bit it is
21:50:27FromDiscord<MadScientistCarl> Not sure if that will actually work if I am generating from C code...
21:50:35FromDiscord<Elegantbeef> so a is bit 0 and b is bit 1
21:51:22FromDiscord<System64 ~ Flandre Scarlet> Is it normal I still can't compile Owlkettle examples? https://media.discordapp.net/attachments/371759389889003532/1063938401356763317/message.txt
21:51:42FromDiscord<Elegantbeef> I mean if it's an ordinal enum Nim's bitset is identical to manually bitwise oring integers
21:51:42FromDiscord<Elegantbeef> Like what is your C enum definition?
21:52:46FromDiscord<Elegantbeef> If it's a contiguous enum it's fine, if it's non contiguous then you get to do `ord(myEnum) or ord(myOtherEnum)`
21:53:14FromDiscord<MadScientistCarl> Hopefully they are actually ordinal
21:53:27FromDiscord<MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4lex
21:54:50FromDiscord<MadScientistCarl> sent a code paste, see https://play.nim-lang.org/#ix=4ley
21:55:18FromDiscord<Elegantbeef> Yea typical shitty C enums
21:55:52FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lez
21:56:15FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4lez" => "https://play.nim-lang.org/#ix=4leA"
21:56:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4leB
21:56:33FromDiscord<MadScientistCarl> The missing value is there, but below. Out of order.
21:57:00FromDiscord<Phil> But what actually happens is:↵It prints every echo once and then nothing happens, the proc body of `callAldrune` does not get executed a second time
21:57:02FromDiscord<MadScientistCarl> I can just hope that everything is at least continuous, so I can fill up holes with something like `ReservedBit10`
21:57:14FromDiscord<Elegantbeef> You could do that
21:57:27FromDiscord<Elegantbeef> I dislike these C enums, since they're just so damn annoying
21:57:46FromDiscord<MadScientistCarl> I guess distinct also works
21:58:08FromDiscord<Elegantbeef> You could also make a Nim enum to C val array
21:58:21FromDiscord<MadScientistCarl> Well, they are annoying, but have an extremely portable ABI
22:01:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4leF
22:01:14FromDiscord<Elegantbeef> This is another option
22:01:26FromDiscord<Elegantbeef> When using static values it's 0 runtime cost
22:01:50FromDiscord<Elegantbeef> When using runtime values it has to iterate the set, which is cheap but it's a consideration
22:02:14FromDiscord<MadScientistCarl> Which one is the static value?
22:02:50FromDiscord<MadScientistCarl> I guess I will go for hole-filling bitsets
22:05:00FromDiscord<Elegantbeef> What?
22:05:29FromDiscord<MadScientistCarl> Like, generating bitset from enums
22:05:45FromDiscord<Elegantbeef> I mean what to the "Which one is the static value"
22:05:57FromDiscord<MadScientistCarl> You mention static values have 0 runtime cost
22:06:11FromDiscord<Elegantbeef> Yes they're compile time constants
22:06:33FromDiscord<Elegantbeef> So like `doThingThatTakesCint({TransferSrc, MidPointChromaSample})`
22:07:39FromDiscord<Elegantbeef> The last code i supplied works using static values to reduce overhead whilst giving an ergonomic API
22:07:40FromDiscord<Elegantbeef> You do have to repeat yourself though
22:07:55FromDiscord<MadScientistCarl> OK
22:10:30*krux02 joined #nim
22:46:51FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4leR
22:47:32FromDiscord<voidwalker> any idea ? the cinclude dir is in that path, but minus the `/src`
23:02:25*krux02 quit (Remote host closed the connection)
23:25:18FromDiscord<voidwalker> does say ` Success: ffmpeg installed successfully.` if I choose `y`, but if I `import ffmpeg` : Error: cannot open file: ffmpeg
23:57:58FromDiscord<MadScientistCarl> Do enum types have default values?
23:59:52FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lf6