<< 16-04-2021 >>

00:00:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:01:03*njoseph joined #nim
00:13:50*abm quit (Read error: Connection reset by peer)
00:40:50*krux02 quit (Remote host closed the connection)
00:48:02*audiophile_ joined #nim
00:50:58FromDiscord<ElegantBeef> @Sabena Sema it also works with `type T` and `typedesc T` afaik
00:51:11*audiophile quit (Ping timeout: 240 seconds)
00:51:13*audiophile_ is now known as audiophile
00:51:21FromDiscord<Sabena Sema> isn't `type T` just command syntax though
00:51:30FromDiscord<Sabena Sema> it's the same as `type(T)`
00:51:44FromDiscord<ElegantBeef> nah `type T` == `typedesc T` as a param
00:54:59FromDiscord<theSherwood> Kind of a broad question, but what are the main differences between hindley-milner and nim's type system?
00:56:45FromDiscord<Sabena Sema> HM does global program inference, it can tell you the exact type of any typed thing, even if you don't specify it
00:56:50FromDiscord<Sabena Sema> nim can't do that
00:58:29FromDiscord<ElegantBeef> Nim's is just local scoped type inference
00:58:44FromDiscord<ElegantBeef> Actually local type inference ๐Ÿ˜„
00:58:59FromDiscord<Rika> nim doesnt have inference by return type which makes me sad ๐Ÿ˜ฆ
00:59:19FromDiscord<ElegantBeef> You mean something like auot?
00:59:24FromDiscord<ElegantBeef> (edit) "auot?" => "auto?"
00:59:36FromDiscord<Rika> no
00:59:43FromDiscord<Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=2Wfd
01:00:02FromDiscord<Sabena Sema> it would infer the type from how you use it in the function
01:00:19FromDiscord<Rika> something like `var a: int = someProc[int#[this should not be needed]#](...)`
01:00:51FromDiscord<Rika> someproc is a generic proc [T](...): T
01:00:53FromDiscord<Sabena Sema> the thing is, doing full type inference like that really limits your type system design, and is also not that useful
01:00:54*gpanders joined #nim
01:01:14FromDiscord<ElegantBeef> Ah, makes sense
01:02:11FromDiscord<ElegantBeef> In my view the only type inference that we're really lacking is in case statements
01:02:36FromDiscord<ElegantBeef> `case yourEnum` feels like it should propogate to the `of` branches
01:03:04FromDiscord<Sabena Sema> also nim's generics take the approach of C++'s where it's not so stressed that the generic function actually works for all possible values of the generic parameters
01:04:14FromDiscord<ElegantBeef> Though i'd argue that's someone not using a typeclass or concept ๐Ÿ˜„
01:04:48FromDiscord<Sabena Sema> even concepts don't enforce that in c++
01:04:54FromDiscord<Sabena Sema> I forget if they do in nim
01:05:20FromDiscord<ElegantBeef> Well i'm saying that allowing generics into a function that doesnt support them is just bad limiting imo
01:05:44FromDiscord<ElegantBeef> Like for instance if you had a procedure that only works with string and you didnt do `[T: string]`
01:05:52FromDiscord<Sabena Sema> right, ofc the instantiation won't compile in c++, but the _definition_ compiles
01:06:37FromDiscord<Sabena Sema> it makes the generic system _much_ more powerful if you allow generics unconstrained generics like this
01:06:44FromDiscord<Sabena Sema> but can make it harder to do tooling and such
01:06:48FromDiscord<Sabena Sema> and can make errors worse
01:07:55FromDiscord<theSherwood> Fascinating. What sort of things does full type inference prevent you from doing?
01:08:25FromDiscord<Sabena Sema> overloading is one thing
01:10:07FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2Wfh
01:10:40FromDiscord<ElegantBeef> Yea, though i'd just check if `Count >= sizeOf(T) 8`
01:10:54FromDiscord<ElegantBeef> if it is return 0 else shift
01:11:05FromDiscord<ElegantBeef> Atleast that's what it seemed you were after yesterday
01:11:31FromDiscord<ElegantBeef> Ah nvm you did that ๐Ÿ˜„
01:11:34*gpanders left #nim ("WeeChat 3.1")
01:11:59FromDiscord<ElegantBeef> Red the first if statement and didnt get where it was going
01:12:04FromDiscord<ElegantBeef> (edit) "Red" => "Read"
01:12:20FromDiscord<mattrb> Yeah literally just copying the Crystal implementation because that matches my assumptions :p
01:12:58FromDiscord<ElegantBeef> Well if you dont plan on using the system ones you can always overload the `shr` and `shl` from system, though only would work nicely from the same module
01:14:05FromDiscord<mattrb> I'd also like to fall back to the system ones in that implementation. Could I still do that with `import as` I guess?
01:14:33FromDiscord<mattrb> I mean I personally prefer the operators myself just because that's what I'm in the habit of typing, but I know Araq has voiced his opinion on that one ๐Ÿ˜†
01:14:34FromDiscord<ElegantBeef> well you can do system.\`shr\`(a, b) but yea
01:15:42FromDiscord<mattrb> If I put that in a util file and imported it in every file, would that be enough? I assume system is implicitly the first import so anything else imported would overload system?
01:15:46FromDiscord<ElegantBeef> Well Nim is heavily inspired by wirth languages and due to that a lot of ops use the same words as their ancester version
01:16:06FromDiscord<ElegantBeef> It probably would be ambigious so would require your intervention, you can try though
01:16:52FromDiscord<mattrb> I'll just stick with the custom operators so that I don't mess it up anywhere with a bug that I'll never find :cringeharold:
01:17:06FromDiscord<ElegantBeef> Lol you do you ๐Ÿ˜„
01:24:14ForumUpdaterBotNew post on r/nim by sigzero: Versions 1.4.6 and 1.2.12 released, see https://reddit.com/r/nim/comments/mrsstr/versions_146_and_1212_released/
01:33:55*audiophile quit (Quit: Default Quit Message)
01:41:12*Gustavo6046 quit (Ping timeout: 240 seconds)
01:53:07*gangstacat quit (Ping timeout: 260 seconds)
01:54:29*johnnynitwits quit (Quit: Bridge terminating on SIGTERM)
01:54:29*threenp quit (Quit: Bridge terminating on SIGTERM)
01:56:37*johnnynitwits joined #nim
01:56:40*threenp joined #nim
01:57:57*gangstacat joined #nim
02:00:30*vicfred quit (Remote host closed the connection)
02:00:51*vicfred joined #nim
02:01:48*vicfred quit (Max SendQ exceeded)
02:01:52*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
02:02:13*njoseph joined #nim
02:02:49*vicfred joined #nim
02:05:15*gangstacat quit (Ping timeout: 260 seconds)
02:05:51Prestigesweet
02:12:33*vicfred quit (Quit: Leaving)
02:15:53*vicfred joined #nim
02:18:39*gangstacat joined #nim
03:05:29*vicfred quit (Quit: Leaving)
03:08:45*spiderstew_ joined #nim
03:09:32*spiderstew quit (Ping timeout: 258 seconds)
03:13:45*vicfred joined #nim
03:31:32*vicfred_ joined #nim
03:33:47*vicfred quit (Ping timeout: 246 seconds)
03:38:04ForumUpdaterBotNew question by Dull Bananas: Nim: &amp;quot;invalid type ... in this context&amp;quot; error, see https://stackoverflow.com/questions/67118749/nim-quotinvalid-type-in-this-contextquot-error
03:39:29*vicfred__ joined #nim
03:42:26*vicfred_ quit (Ping timeout: 265 seconds)
03:43:12*beshr quit (Ping timeout: 240 seconds)
03:44:16*beshr joined #nim
04:04:54*vicfred__ quit (Quit: Leaving)
04:19:31*a_chou joined #nim
04:25:33ForumUpdaterBotNew thread by Alexeypetrushin: How to disable logging from db_postgres?, see https://forum.nim-lang.org/t/7801
04:36:48*a_chou quit (Quit: a_chou)
04:37:19*a_chou joined #nim
04:44:13*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
04:44:21*njoseph joined #nim
04:44:53*njoseph quit (Client Quit)
04:45:00*njoseph joined #nim
04:48:43*njoseph quit (Client Quit)
04:48:49*njoseph joined #nim
04:59:29*rockcavera quit (Remote host closed the connection)
05:54:04FromDiscord<pietroppeter> In reply to @mlokis "doesn't stackowerflow recognize nim": @mlokis for Nim highlighting in stack overflow see this question and comments for a possible workaround: https://meta.stackexchange.com/questions/355491/add-syntax-highlighting-support-for-nim
06:06:54*a_chou quit (Remote host closed the connection)
07:01:47*PMunch joined #nim
07:04:40PMunchThere, the playground is back online now
07:04:44PMunchSorry about the downtime
07:05:00PMunchI'll have to figure out how to get docker to clean up after itself better..
07:05:24FromDiscord<ElegantBeef> So much lost money
07:05:25FromDiscord<ElegantBeef> Shame!
07:06:02PMunchLost money?
07:08:41FromDiscord<ElegantBeef> I've been told i'm terrible at jokes
07:08:46FromDiscord<Rika> Whatโ€™s the joke
07:08:58FromDiscord<ElegantBeef> Exactly
07:09:01FromDiscord<Rika> Donโ€™t tell me youโ€™re so terrible the joke doesnโ€™t
07:09:04FromDiscord<Rika> God
07:09:30FromDiscord<ElegantBeef> Nah the actual joke was to imply that massive amounts of money depend on nim playground running properly
07:09:50FromDiscord<Rika> But no idiot would imply that..?
07:11:04FromDiscord<ElegantBeef> Any one can be perceived as an idiot if they're silly enough to make an implication as such
07:11:23PMunchHaha :P
07:24:46PMunchAdded another step of cleaning to the maintenance script. This will hopefully either keep it from crashing, or just push the window of manual intervention further into the future so I forget more of how I solve it :P
07:25:09FromDiscord<Rika> Why donโ€™t you have a system for notification of crash
07:25:26PMunchWell it wasn't crashed as such
07:25:40PMunchI do have a ticker on my status bar telling me if the server is down
07:25:59PMunchThe problem now was that it was just so bogged down in work that it didn't get anything done
07:26:02FromDiscord<ElegantBeef> He may have put a post it on top if it
07:26:13PMunchBut it was still replying to my "HEAD" requests
07:36:05ForumUpdaterBotNew thread by Alexeypetrushin: How to get column names for `db_postgres.getAllRows`?, see https://forum.nim-lang.org/t/7802
07:36:16FromDiscord<jtiai> I don't have anything to ask but I just wanted to express my gratitude for those brave souls who helped me with my stupid questions and in complete ignorance with Nim. Finally pieces are falling into places.
07:38:06PMunchHaha, we where all there at some point :)
07:39:07FromDiscord<ElegantBeef> Yes we were ๐Ÿ˜‰
07:39:34saemWait, it's supposed to get better?
07:39:49FromDiscord<ElegantBeef> Nah saem you touch the compiler it only goes downhill from there
07:40:16FromDiscord<ElegantBeef> You'll be speaking in semAuxProcs and semthis and semthat any semtime semnow
07:40:28saemDo I touch the compiler or does it touch me?
07:40:45saemsemYeah
07:41:08FromDiscord<ElegantBeef> I believe to prevent araq from being arrested for enabling sex crimes you neither
07:41:10FromDiscord<ElegantBeef> (edit) removed "you"
07:41:34saemI mean... I'm into it.
07:42:08FromDiscord<ElegantBeef> We dont judge
07:42:13FromDiscord<ElegantBeef> Ok we do just not much
07:42:16saemMy list has grown, I want to get back to typeDesc stuff soonish
07:42:55saemBeef, BTW you ever poked at CPS?
07:43:32FromDiscord<ElegantBeef> I've looked at it briefly but nope
07:43:58FromDiscord<ElegantBeef> I feel like you overestimate my intelligence by a factor of atleast 10
07:43:58saemDidn't speak to you?
07:44:25FromDiscord<ElegantBeef> I mean if we went over everything that spoke to me, we'd be here all night
07:44:34saemHehe
07:44:42FromDiscord<Rika> Iโ€™m afraid that code does not speak
07:45:45FromDiscord<ElegantBeef> What would you know rika
07:45:51FromDiscord<ElegantBeef> My pillow says you dont know anything
07:46:15saemYour pillow is a pikachu
07:46:15FromDiscord<ElegantBeef> Jokes aside, why were you wondering?
07:46:51saemI'm trying to suss out what does it doesn't seem accessible about it.
07:47:47FromDiscord<ElegantBeef> I might be the best person then, considering my lack of actually writing async code ๐Ÿ˜„
07:48:18FromDiscord<ElegantBeef> Atleast based off my understanding being able to use it to async stuff is a big benefit of it
07:48:35saemCPS isn't necessarily about async, you _could_ use it for that.
07:49:45saemYou can use it for generators, iterators, lots of stuff
07:50:06FromDiscord<ElegantBeef> Yea yea yea, i get that everytime i say that
07:50:12saemCould end up with an actor system, some thread pool thing.
07:55:04FromDiscord<ElegantBeef> Anywho i dont really understand CPS as you can tell, all i know is they kids away from abusive parents
08:02:04*motersen quit (Remote host closed the connection)
08:02:05*Vladar joined #nim
08:16:56FromDiscord<Gary M> I had to dig up some CPS stuff because it's such an archaic way of programming from the 70's lol
08:17:00FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/832529999683911690/Screenshot_20210416-011530.jpg
08:17:08FromDiscord<Gary M> I found this conversation amusing
08:18:52PMunchHaha
08:39:23*arecaceae quit (Read error: Connection reset by peer)
08:39:42*arecaceae joined #nim
08:47:04saemCPS is bonkers if you're actually programming that by hand, it'd be like hand IR/some heavily desugared code.
08:47:45saemAnyways I'm curious what folks make of the CPS library.
08:51:41FromDiscord<flywind> `nim-cps` lacks event loop support for windows and it doesn't seems to support multi-threads scheduler?
08:53:08saemThat's more a matter of writing those than an impossibility.
08:54:41saemFeature gaps aren't a big deal, I'm more curious about the gaps in understanding concepts, trying to use it for initial cases, writing a basic scheduler, etc.
08:59:37FromDiscord<ElegantBeef> Well if you need me to i can always give it a whirl to see what i can actually grasp and then complain about
09:02:14ForumUpdaterBotNew thread by Alexeypetrushin: The `db_postgres` can't execute multiple queries, possible bug?, see https://forum.nim-lang.org/t/7804
09:04:05saem@ElegantBeef: that sounds good.
09:40:26*NimBot joined #nim
09:42:34*Vladar quit (Quit: Leaving)
09:53:05PMunch@Araq, are you around? I was wondering if there is a way to force the code generation for emit to be an inline object and not just an assignment from an object generated elsewhere?
10:01:39*natrys joined #nim
10:08:38*wasted_youth2 quit (Quit: Leaving)
10:17:38*audiophile joined #nim
10:20:56*clyybber joined #nim
10:38:40*wasted_youth2 joined #nim
10:49:42*Vladar joined #nim
11:45:19*lritter joined #nim
11:47:41*natrys quit (Ping timeout: 240 seconds)
12:01:07*natrys joined #nim
12:10:11*natrys quit (Ping timeout: 240 seconds)
12:16:40ForumUpdaterBotNew thread by Acroobat: Any valuable linux project to join?, see https://forum.nim-lang.org/t/7805
12:25:33*natrys joined #nim
12:26:41*tefter joined #nim
12:49:52Clonkk[m]In case anybody is interested, I have a file which when I edit it cause nimsuggest (and neovim but I assume the former cause the latter) to take 110% CPU
12:50:37PrestigeAre you using nimlsp?
12:51:15Clonkk[m]nimlsp and alaviss plugins for neovim
12:51:55PrestigeIt's a nimlsp issue - PMunch we should remove the chk we talked about last week ^
12:52:30PMunchOh yeah, that should definitely be moved
12:52:37Prestigehttps://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L506
12:52:52Prestigeprobably can just remove it from this case
12:54:54*tane joined #nim
12:55:18*sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in)
12:55:51*sacredfrog joined #nim
13:36:45PMunchPrestige, there, done
13:36:58PMunchSeems to work as well, in my very limited test
13:42:40*rockcavera joined #nim
13:43:16PMunchI moved it into didSave, which is where the other diagnostics stuff is
13:43:45PMunchBut Clonkk[m], nimsuggest (the library that nimlsp uses) is known to sometimes peg your CPU or consume all your memory
13:43:50PMunchSo YMMV
13:44:50Clonkk[m]<PMunch "But Clonkk, nimsuggest (the libr"> So I've heard. That's why I wasn't sure if it was related to the ``chk`` issue since the other issue I openened last week was infact linked to syntax highlighting
13:45:34Clonkk[m]I'll test again with 0.3.2
13:47:39*krux02 joined #nim
13:56:32Clonkk[m]I don't think that was the problem. I still have the issue ๐Ÿ™‚
13:59:33PMunchDo you have a file or project I can replicate it with?
14:00:03Clonkk[m]It happens after opening https://github.com/Clonkk/flambeau/blob/feat_generic_tensor/flambeau/tensors.nim
14:00:29Clonkk[m]Few seconds later nimsuggest and nvim both go to 100% CPU
14:02:13*Clonkk[m] < https://matrix.org/_matrix/media/r0/download/matrix.org/ehuKCCYdUpgtGrddFBtCISjT/message.txt >
14:02:29Clonkk[m](not sure if it's useful since I don't know what it means)
14:02:59PMunchdoes it just spam that?
14:05:23PMunchOops, gotta go
14:05:24*PMunch quit (Quit: leaving)
14:05:49Clonkk[m]No worries ๐Ÿ™‚ thatnks for the help - it might not even be linked to nimlsp
14:17:23FromDiscord<mlokis> can i manipulate with seq len and cap on unsafe level?, i would like to implements go-like slicing, (will see if that's a good idea)
14:17:55FromDiscord<Rika> Look into the experimental views in the experimental manual
14:31:32FromDiscord<exelotl> (are they less broken now?) ๐Ÿ‘€
14:37:18*filcuc joined #nim
14:37:57*natrys quit (Quit: natrys)
14:38:00filcucare global objects default allocated in a shared heap?
14:38:44FromDiscord<mlokis> does seq act as pointer of is it copied when moving it around scopes?
14:39:05FromDiscord<mlokis> i mean the content of seq
14:39:55liblq-devthe content is copied, but if the compiler is able to deduce that this is the last place where a copy would normally occur, it'll perform what's called a move
14:40:06liblq-devwhich essentially means, the data in the seq won't be copied
14:40:28FromDiscord<mlokis> so i should pass `ref seq[]`
14:40:33liblq-devno
14:40:36liblq-devdo not use ref seq[T]
14:40:54liblq-devuse var seq[T] instead
14:40:55FromDiscord<mlokis> i mean should i pass seq by reference
14:41:13liblq-dev`ref` does not mean reference
14:41:24FromDiscord<mlokis> if i want to retrun is from func
14:41:26liblq-dev`ref` is what nimions call a "managed pointer"
14:41:35FromDiscord<mlokis> (edit) "retrun" => "return"
14:41:38liblq-devwhich basically means "GC'd"
14:41:57liblq-devif you wanna return a seq from a proc you just use `seq[T]` regularly
14:42:21FromDiscord<mlokis> it will not get copied?
14:42:26liblq-devno
14:42:42liblq-devreturning a value from a procedure always moves the value
14:42:55*natrys joined #nim
14:43:03FromDiscord<mlokis> even if it is getter?
14:43:14liblq-devhmm
14:43:19liblq-devthat's a more difficult question
14:43:40liblq-devif you don't assign the resulting seq to a `var`, then yes
14:44:03liblq-devit'll store a pointer to that seq without copying the data
14:44:23FromDiscord<Hi02Hi> isnt there lent to help with this?
14:44:45liblq-devthere is
14:44:55FromDiscord<Hi02Hi> https://nim-lang.org/docs/destructors.html#lent-typeโ†ต"To eliminate even more creation/copy <-> destruction pairs, a proc's return type can be annotated as lent T. This is useful for "getter" accessors that seek to allow an immutable view into a container."
14:45:24saemClonkk[m]: when nimsuggest went to space, which part of that file precisely were you editing?
14:46:02FromDiscord<mlokis> but i mean, now that i returned seq, the caller can read the content and mutate it but cannot change size, else the seq would get copied to new container, em i right?
14:46:41liblq-devthe caller can only mutate the content of the seq if they assign it to a `var`
14:46:44FromDiscord<Rika> Can change size if capacity allows
14:46:49liblq-devin which case a copy is made
14:46:52FromDiscord<Rika> And that yes
14:47:09FromDiscord<Rika> Can var stuff be returned now?
14:47:10FromDiscord<mlokis> In reply to @Rika "Can change size if": forget about cap
14:47:18liblq-devunless you return `var` or `lent`, which will return a mutable or immutable handle respectively to your original seq
14:47:26FromDiscord<mlokis> (edit) "forget" => "forgot"
14:47:48FromDiscord<mlokis> nice so i can use var in return value
14:47:49liblq-dev@Rika i think it could always be returned, just that with view types it became more "common" or something
14:47:59FromDiscord<Rika> I see
14:48:16FromDiscord<mlokis> tx
14:48:38liblq-devi think what view types introduce is storing that returned var/lent somewhere
14:48:50liblq-devinstead of only being able to use it immediately
14:49:07FromDiscord<Rika> Huh
14:50:33FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2Wiv
14:50:41*idf quit (Ping timeout: 240 seconds)
14:51:26FromDiscord<mlokis> (edit) "https://play.nim-lang.org/#ix=2Wiv" => "https://play.nim-lang.org/#ix=2Wiw"
14:51:37*tiorock joined #nim
14:51:38*tiorock quit (Changing host)
14:51:38*tiorock joined #nim
14:51:38*rockcavera is now known as Guest40911
14:51:38*Guest40911 quit (Killed (tepper.freenode.net (Nickname regained by services)))
14:51:38*tiorock is now known as rockcavera
14:52:24FromDiscord<mlokis> (edit) "https://play.nim-lang.org/#ix=2Wiw" => "https://play.nim-lang.org/#ix=2Wiy"
14:57:55FromDiscord<mlokis> we probably dont have any tool that formats the code
14:58:03*idf joined #nim
14:58:25FromDiscord<Rika> Nimpretty
14:59:12*vicfred joined #nim
14:59:47FromDiscord<mlokis> is it command line thing?
15:01:14*azed joined #nim
15:01:43*kuon joined #nim
15:02:11FromDiscord<Rika> Yes
15:16:00*def- quit (Quit: -)
15:17:16*def- joined #nim
15:18:11*azed quit (Quit: WeeChat 3.1)
15:21:40FromGitter<HJarausch> How to create a pull request? โŽ I have clone nim into github/HJarausch/Median. There I have modified some files. How can I create a pull request now? โŽ Many thanks for a hint, โŽ Helmut [https://gitter.im/nim-lang/Nim?at=6079ab8481866c680c295f46]
15:35:57filcucare global objects default allocated in a shared heap?
15:44:04Clonkk[m]<saem "Clonkk: when nimsuggest went to "> Sorry I just saw your message. Not a specifically part; it happens ~1 seconds after I opened the file. Usually I'm at the beginning of the file
16:10:47*tefter_ joined #nim
16:12:41FromDiscord<jtiai> I have code <https://play.nim-lang.org/#ix=2Wj5> and as seen in the code, I just try to store value to `Memory.data[0]` and read it back. But why I do get 0 instead of 42?
16:12:50FromDiscord<mlokis> is here a test coverage tool for nim?
16:13:46*tefter quit (Ping timeout: 252 seconds)
16:21:06*justsomeguy quit (Ping timeout: 240 seconds)
16:24:42*tefter_ is now known as tefter
16:31:27FromDiscord<demotomohiro> @jtiai
16:31:29FromDiscord<demotomohiro> Range chack in your code should be `m.startAddr <= memaddr and m.endAddr >= memaddr`.
16:36:18liblq-devthat's a weird way to do a range check
16:36:28liblq-devwhy not just memaddr in m.startAddr .. m.endAddr?
16:37:55liblq-devor at least switch the sides of the comparisons so that it's more clear what you're comparing to
16:41:37FromDiscord<jtiai> Well didn't know better way.
16:41:49*junland quit (Quit: %ZNC Disconnected%)
16:42:53*junland joined #nim
16:44:26FromDiscord<jtiai> that apparently fixed it...
16:58:55*justsomeguy joined #nim
17:11:19*justsomeguy left #nim ("WeeChat 3.0.1")
17:19:30FromDiscord<Goel> @mlokis Like this? https://github.com/status-im/nim-testutils
17:33:09reversem3Do you guys think nim will ever have a programming structure ? like when to do use types , generics, templates, macros. Nim isn't an oop language so .....
17:33:40FromDiscord<Solitude> what?
17:34:12*hyiltiz quit (Ping timeout: 240 seconds)
17:36:29FromDiscord<jtiai> Apparently some people never heard of prototype based programming...
17:37:19*hyiltiz joined #nim
17:39:24FromDiscord<Yardanico> Apparently some people never heard of some_trendy_buzzword-based programming...
17:39:48*audiophile_ joined #nim
17:40:10FromDiscord<jtiai> prototype based is quite old.
17:40:57FromDiscord<Solitude> i prefer write-stuff based programming
17:41:03FromDiscord<Yardanico> nice
17:42:11FromDiscord<haxscramper> In reply to @reversem3 "Do you guys think": "When to use ..." - just start with a proc + struct (object) and add stuff as needed
17:43:17*audiophile quit (Ping timeout: 260 seconds)
17:43:21reversem3Yeah thats what I have been doing , but really want to get into meta programming , its like magic lol
17:43:25*audiophile_ is now known as audiophile
17:43:56reversem3Anyway I was just curious , kind of new the answer already
17:44:02reversem3 * Anyway I was just curious , kind of knew the answer already
17:44:18FromDiscord<Yardanico> metaprogramming is not really a separate "programming structure"
17:44:56reversem3what I mean is paradigm (I guess would be a better term)
17:45:20FromDiscord<haxscramper> There is no paradigm to metaprogramming, though there are a couple books on DSL construction
17:45:23FromDiscord<haxscramper> But that is not really necessar
17:45:46FromDiscord<haxscramper> Usually that is exactly "write-stuff based programming" as solitude just mentioned
17:45:49FromDiscord<haxscramper> Identify a problem that can't elegantly solved by simple code and write a macro for that
17:46:04reversem3ahh ok
17:46:22FromDiscord<haxscramper> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html explains how you can approach writing more complex macros
17:46:41reversem3very cool thanks
17:47:09FromDiscord<haxscramper> If you need some rules/directions it would probably be "Use macros for DSL, not for sugar"
17:47:20FromDiscord<haxscramper> "When in doubt add IR"
17:47:36reversem3IR ?
17:48:03FromDiscord<haxscramper> Intermediate representation. Though this one is only applicable when you have macro of certain complexity and not sure how to deal with all DSL features in a nice way
17:48:28FromDiscord<haxscramper> You can basically ignore it for the most part, especially when starting writing macro
17:49:54FromDiscord<haxscramper> Though the question of "how do I get into metaprogramming" is actually kind of important, because not a lot of languages make such big accent on that, so it might be a good idea to come up with a more comprehensive response than just "write-stuff"
17:51:25FromDiscord<haxscramper> Like a bridge between the states of "I know macros are cool"+"I have a problem" and "To solve my problem using macros I would have to do this and that"
17:55:16FromDiscord<whisperdev> How can one tell if a Nim program is using ARC or ORC?
17:55:36FromDiscord<Yardanico> if you just want to check for either of them
17:55:42FromDiscord<Yardanico> when defined(gcDestructors)
17:56:28FromDiscord<Yardanico> for different ones specifically you can use compileOption from system or gcArc and gcOrc (but afaik the first one is preferred
17:56:35FromDiscord<Yardanico> e.g. when compileOption("gc", "arc"): do stuff
17:56:46FromDiscord<Yardanico> like https://github.com/Yardanico/nim-snippets/blob/master/interdetails.nim
17:58:54FromDiscord<whisperdev> What I mean is when I have a binary ๐Ÿ™‚
17:59:11FromDiscord<Yardanico> well, then you use some reverse engineering tool
17:59:23FromDiscord<Yardanico> if you find any references to eqsink, eqcopy, eqdestroy - it's arc or orc
17:59:42FromDiscord<Yardanico> what's your usecase btw?
18:00:08FromDiscord<whisperdev> no use case just curious
18:00:09FromDiscord<whisperdev> but i see
18:00:45FromDiscord<whisperdev> But wait.If I just nimble install this: https://github.com/fox0430/moe/blob/develop/moe.nimble
18:00:50FromDiscord<whisperdev> This is not using arc...
18:01:00FromDiscord<Yardanico> of course?
18:01:05FromDiscord<Solitude> arc isnt default
18:01:15FromDiscord<whisperdev> In reply to @Yardanico "if you find any": I was grep-ing for those and saw them...
18:01:39FromDiscord<Yardanico> how were you greping for them?
18:01:59FromDiscord<whisperdev> strings moe | grep eqcopy
18:02:48FromDiscord<Solitude> In reply to @whisperdev "This is not using": it is using orc
18:02:54FromDiscord<Solitude> https://github.com/fox0430/moe/blob/develop/src/moe.nim.cfg#L4
18:03:07FromDiscord<Yardanico> kek
18:03:13FromDiscord<whisperdev> great
18:13:28FromDiscord<Alea> is there anyway to make an array containing different types?
18:13:46FromDiscord<haxscramper> You can use variant objects
18:14:19FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#types-object-variants
18:14:33FromDiscord<Yardanico> In reply to @Alea "is there anyway to": yeah, as haxscramper said, but generally you really rarely need to store "different types" in containers
18:14:35FromDiscord<haxscramper> And wrap different types in different branches
18:14:48FromDiscord<Yardanico> usually people who come from python to nim try to adapt their python knowledge to nim directly
18:14:55FromDiscord<Yardanico> regarding different types in lists, etcv
18:14:56FromDiscord<Yardanico> (edit) "etcv" => "etc"
18:15:08FromDiscord<Alea> I'm coming from C, so I was thinking an array of pointers
18:15:24FromDiscord<haxscramper> you can do type erasure via pointers of course
18:15:27FromDiscord<Yardanico> then again, you don't do that in Nim usually :)
18:16:41FromDiscord<Alea> it really confuses me how people making games keep track of so many different objectsโ†ตthey all have different types, and yet are kept in one central list
18:16:56FromDiscord<Yardanico> they probably have one base type
18:17:03FromDiscord<Yardanico> or just nim object variants :)
18:18:41FromDiscord<haxscramper> Though nim variant objects are only really suitable when you have a closed object hierarchy that is not intended to be expanded by the user. You can do `ref of RootObj` and `case kind` at the same time though
18:23:47reversem3<FromDiscord "<Yardanico> well, then you use s"> As far as I have seen when you reverse engineer a nim binary that header sticks out like a sore thumb
18:24:09reversem3everything I have compiled so far has the same header information
18:24:45reversem3just use R2 or radare2
18:25:00FromDiscord<Yardanico> what header
18:25:23FromDiscord<Yardanico> I know about r2, ghidra and similar, but not sure what header you're talking about, I know about NimMain and friends, but again, we were talking about ARC/ORC specifically
18:28:32*beshr quit (Ping timeout: 240 seconds)
18:29:19*beshr joined #nim
18:47:46*filcuc quit (Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/)
18:50:33*liblq-dev left #nim ("User left")
18:57:47*lritter quit (Ping timeout: 246 seconds)
19:07:39ForumUpdaterBotNew thread by Mantielero: An easy way of displaying video?, see https://forum.nim-lang.org/t/7806
19:14:21FromDiscord<mlokis> can i somehow restrict generic argument to things with witch you can index into collection?
19:14:46*D_ quit (Ping timeout: 258 seconds)
19:15:23FromDiscord<Yardanico> @mlokis you mean things that have an array subscript operator?
19:15:29FromDiscord<Yardanico> you can use concepts
19:16:06FromDiscord<mlokis> In reply to @Yardanico "you can use concepts": but how?
19:16:12FromDiscord<Yardanico> just use them 4HEad
19:16:24FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#concepts
19:16:56FromDiscord<madman> do concepts work well with arc/orc
19:18:52FromDiscord<Yardanico> concepts are not related to arc/orc at all
19:18:56FromDiscord<Yardanico> so yes, they do work fine with arc/orc
19:19:02FromDiscord<Yardanico> what
19:19:03FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WjZ
19:19:17FromDiscord<Yardanico> oh, so you want something that can index an existing sequence?
19:19:20FromDiscord<mlokis> (edit) "https://play.nim-lang.org/#ix=2WjZ" => "https://play.nim-lang.org/#ix=2Wk0"
19:19:31FromDiscord<mlokis> yes this works
19:19:35FromDiscord<Yardanico> you don't need a concept for that, only ints can index sequences anyway
19:19:40FromDiscord<Yardanico> or other things that convert to int
19:19:44FromDiscord<Yardanico> with converters
19:20:29FromDiscord<mlokis> but i need that nice error when someone tries string as id
19:26:57FromDiscord<Yardanico> In reply to @mlokis "but i need that": they'll just get a type mismatch
19:31:47FromDiscord<JSONBash> out of curiosity is there a way to manually mark a cyclic type so that you can use arc? or will libraries like asyncdispatch always be orc?
19:35:02FromDiscord<Yardanico> In reply to @JSONBash "out of curiosity is": wdym "mark a cyclic type"?
19:35:10FromDiscord<Yardanico> ARC does not prevent you from compiling the code that has cycles
19:35:11FromDiscord<Yardanico> it'll just leak
19:35:13FromDiscord<Yardanico> (edit) "it'll just leak ... " added "memory"
19:35:46FromDiscord<haxscramper> Unless you use non-traced reference via `{.cursor.}` or raw ptr?
19:35:50FromDiscord<haxscramper> (edit) "ptr?" => "ptr?"
19:36:00FromDiscord<Yardanico> well, that's not really related imo :P
19:36:13FromDiscord<Yardanico> At max ARC will emit a warning if it sees that some code absolutely forms a cycle, but ORC exists because only the simplest of cases can be detected at compile-time
19:36:31FromDiscord<Yardanico> but I don't think that you should use asyncdispatch with ARC anyway, it'll leak quite a lot of memory
19:37:21FromDiscord<JSONBash> my real question is will programs that use ARC ever be able to manaully tuned to use ORC? or if there is a cycle is has to use ORC?
19:37:34FromDiscord<Yardanico> still, not sure what do you mean
19:37:47FromDiscord<Yardanico> ARC/ORC are interchangeable, ORC is just ARC + a cycle collector
19:38:13FromDiscord<Yardanico> if you have code that forms a cycle at runtime, ARC will at max just leak memory, while ORC will be able to collect that cycle
19:38:30FromDiscord<Yardanico> And if you mean if you can enable/disable the ORC step at runtime, then yes, you can
19:38:39FromDiscord<JSONBash> as far as i uderstand the cycle collector makes it soft realtime, but arc can be used for hard realtime? unless i understand that wrong
19:39:00FromDiscord<Yardanico> that's because ORC has to collect cycles
19:39:11FromDiscord<Yardanico> we have GC_runOrc/GC_enableOrc/GC_disableOrc
19:39:17FromDiscord<JSONBash> so if i have cycles, i can only ever have soft realtime
19:39:27FromDiscord<Yardanico> no, you can have hard realtime and leak memory
19:39:50FromDiscord<JSONBash> yeah point taken ahha
19:40:00FromDiscord<JSONBash> what if i dont want memory leaks?
19:40:07FromDiscord<JSONBash> am i SOL?
19:40:22FromDiscord<JSONBash> (i dont have a use case just curious)
19:40:25FromDiscord<Yardanico> again, you can only run ORC when you want to
19:40:28FromDiscord<Yardanico> https://github.com/nim-lang/Nim/blob/devel/lib/system/orc.nim#L405
19:40:37FromDiscord<Yardanico> three Orc procs here
19:40:44FromDiscord<Yardanico> actually more
19:43:12FromDiscord<JSONBash> so if i have cycles my only options are: a) have orc collect cycles to which i can control when that happens if i choose to b) leak memory if i dont want to run orc cycle collection
19:43:46FromDiscord<Yardanico> and yeah, in this case haxscramper's advice is correct too - you can mark fields/variables with {.cursor.} which is unsafe, but if you know what you're doing you can avoid cycles
19:43:50FromDiscord<JSONBash> and if i choose b is there anyway to manually 'free' the cycle memory?
19:44:12FromDiscord<JSONBash> okay that seems like a pretty reasonable solution
19:44:14FromDiscord<Yardanico> cursor is an annotation which makes the compiler to not increase the refcount
19:44:21FromDiscord<JSONBash> and to be clear, i don't know what I am doing lol
19:44:24FromDiscord<Yardanico> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation
19:45:55FromDiscord<JSONBash> oh okay I see
19:46:38FromDiscord<JSONBash> i dont fully understand how I would use cursor, but there is a way to avoid cycle data structures if i know what im doing
19:46:43FromDiscord<JSONBash> ?
19:48:16FromDiscord<Yardanico> it always depends on your usecase
19:49:36FromDiscord<haxscramper> My use case is `ref` object tree that sometimes might have reference to other elements (potentially forming a cycle) that I would eventually wrap as a C/C++ library, so I would prefer to make it fully ARC-compliant
19:50:22FromDiscord<haxscramper> I asked basically the same question and advised to use `{.cursor.}`, which seems exactly what I would need in this case
19:52:45FromDiscord<JSONBash> sweet, thank you both for the help ๐Ÿ™‚
19:58:42*konradmb[m] joined #nim
20:06:31FromDiscord<ellliottt> hi, just started using nim. how would i implement a stack?
20:07:15FromDiscord<ellliottt> im guessing an array plus some accessor functions, but is there a more idiomatic way>
20:07:16FromDiscord<ellliottt> (edit) "way>" => "way?"
20:07:54FromDiscord<Yardanico> In reply to @ellliottt "hi, just started using": just a seq will work
20:08:18FromDiscord<Yardanico> since seqs have a `pop` proc
20:08:29FromDiscord<Yardanico> there are also deques https://nim-lang.org/docs/deques.html
20:09:33FromDiscord<ellliottt> oh nice, thankyou :)
20:11:01FromDiscord<ellliottt> maybe a stupid question, where do i find the docs for builtin types like `seq`?
20:12:06FromDiscord<Yardanico> In reply to @ellliottt "maybe a stupid question,": https://nim-lang.org/docs/system.html
20:13:00FromDiscord<ellliottt> ahh the name `system` confused me. thanks!
20:13:13FromDiscord<Yardanico> @ellliottt system is the module that is always imported
20:13:17FromDiscord<Yardanico> in all nim files
20:13:52FromDiscord<Yardanico> it's also worth checking https://nim-lang.org/documentation.html
20:13:59FromDiscord<Yardanico> e.g. https://narimiran.github.io/nim-basics/
20:14:33FromDiscord<ellliottt> yeah i read through the introduction tutorial, going to try writing some stuff now :)
20:14:43FromDiscord<Yardanico> well, there are a lot of other tutorials except that one :)
20:15:18FromDiscord<ellliottt> tbh i feel somewhat comfortable already, ive used python/haskell/c and nim feels like its right in the middle of all of them
20:15:28FromDiscord<ellliottt> so im going to try and just jump in and try some stuff
20:15:38FromDiscord<ellliottt> if i get overwhelmed ill try some of the guides, thankyou :)
20:19:17*happycorsair[m] joined #nim
20:19:37FromDiscord<j-james> If you're looking for quick-and-dirty examples, I really like https://nim-by-example.github.io/
20:20:16*beshr quit (Remote host closed the connection)
20:21:10FromDiscord<Yardanico> oh, maybe I should a PR to here, change some small things
20:25:47ForumUpdaterBotNew thread by Quokka70: Global array access can have side effects?, see https://forum.nim-lang.org/t/7807
20:34:48FromDiscord<ellliottt> sent a code paste, see https://play.nim-lang.org/#ix=2Wkl
20:34:54FromDiscord<ellliottt> (edit) "https://play.nim-lang.org/#ix=2Wkl" => "https://play.nim-lang.org/#ix=2Wkm"
20:35:07FromDiscord<Yardanico> nim strings don't have a specific encoding, they're just a sequence of chars
20:35:13FromDiscord<Yardanico> to treat strings as unicode there's a unicode module
20:35:18FromDiscord<Yardanico> https://nim-lang.org/docs/unicode.html
20:35:41FromDiscord<Yardanico> e.,g. for your second line you need echo "โ„›".runeAt(0)
20:36:24FromDiscord<Yardanico> and your third line is incorrect - to get a sequence of runes from a string you use toRunes
20:36:34FromDiscord<Yardanico> so echo "โ„›".toRunes()[0]
20:37:11FromDiscord<ellliottt> ah i see
20:37:14FromDiscord<ellliottt> thanks :)
20:37:26FromDiscord<dk> `Rune()` is a dumb type converter
20:37:49FromDiscord<ellliottt> is it more efficient to just store a `seq[Rune]` rather than a `string` then
20:38:18FromDiscord<Yardanico> not really
20:38:32FromDiscord<Yardanico> but if you need to do a lot of unicode operations on a string, then it's more efficient I guess
20:38:37FromDiscord<Yardanico> but just to store string is better
20:39:05FromDiscord<ellliottt> if your string contains unicode data then you need to convert it to a `seq[Rune]` to do anything to it
20:39:11FromDiscord<Yardanico> not neccessarily
20:39:22FromDiscord<dk> there's also an iterator
20:39:38FromDiscord<Yardanico> but anyway, `Rune` is internally represented as an `int32` so it's less efficient, especially if your string is mainly ASCII
20:39:53FromDiscord<Yardanico> then each ascii char will be represented as 4 bytes instead of one
20:41:57FromDiscord<ellliottt> ok i misunderstood that
20:42:24FromDiscord<ellliottt> so just `.runeAt` to get a rune, but store it as a string for space efficiency
20:42:43FromDiscord<Yardanico> depends on how often you need to do some specific operations on it as a unicode string
20:43:32FromDiscord<Yardanico> @ellliottt ah right sorry, runeAt isn't really what you want
20:43:50FromDiscord<Yardanico> it's better to use the iterators from the unicode module
20:44:16FromDiscord<Yardanico> since runeAt returns the unicode rune at the byte index
20:44:30FromDiscord<Yardanico> also there are a lot of procs in the unicode module that take a string and return a string
20:44:37FromDiscord<Yardanico> but internally they do specific unicode operations
20:44:42FromDiscord<Yardanico> like https://nim-lang.org/docs/unicode.html#swapCase%2Cstring
20:44:51FromDiscord<ellliottt> ah ok
20:45:06FromDiscord<ellliottt> so `for ch in runes(some_string) ...`
20:45:36FromDiscord<Yardanico> yeah
20:49:54FromDiscord<Yardanico> actually, looking at nim by example again, I wonder if we can use https://github.com/pietroppeter/nimib for it
20:50:06FromDiscord<Yardanico> I know, rewriting is wasting time, but it's much more suited for Nim specifically :P
20:52:25FromDiscord<ellliottt> sorry for more questions. are iterators first class, or can they only be used in a `for` loop?
20:52:37FromDiscord<ellliottt> (edit) "iterators" => "iterator instances"
20:52:40FromDiscord<Yardanico> by default iterators are inlined
20:52:46FromDiscord<Yardanico> but there are closure iterators that are "first class"
20:52:51FromDiscord<Yardanico> they can be passed around, etc
20:52:55FromDiscord<ellliottt> oh nice
20:53:04FromDiscord<Yardanico> https://nim-by-example.github.io/for_iterators/ :P
20:53:15FromDiscord<ellliottt> thanks :P
21:05:04*vicfred_ joined #nim
21:06:16*vicfred quit (Read error: Connection reset by peer)
21:13:40*Vladar quit (Quit: Leaving)
21:19:12FromDiscord<ellliottt> sent a code paste, see https://play.nim-lang.org/#ix=2Wkz
21:21:08FromDiscord<Yardanico> raise (ref Exception)(someData: 5)
21:21:12FromDiscord<Yardanico> (edit) "Exception)(someData:" => "MyException)(someData:"
21:22:31FromDiscord<ellliottt> whats going on there?
21:22:41FromDiscord<ellliottt> why can you call a ref?
21:22:48FromDiscord<Yardanico> this is object construction syntax
21:22:56FromDiscord<Yardanico> `raise` only can raise refs
21:23:07FromDiscord<Yardanico> so you construct a new ref MyException with someData equal to 5
21:23:21FromDiscord<Yardanico> you can of course have MyException be "ref object of Exception" and then can raise it with just raise MyException(someData: 5)
21:23:31FromDiscord<ellliottt> ahh that makes sense
21:23:32FromDiscord<ellliottt> thanks
21:24:20FromDiscord<ellliottt> so in that case the default behavior of `Exception` taking a string message is overwritten s
21:24:21FromDiscord<ellliottt> (edit) removed "s"
21:24:27FromDiscord<ellliottt> so i need my own `msg` field
21:28:42FromDiscord<dk> In reply to @ellliottt "so i need my": there is already such a field https://github.com/nim-lang/Nim/blob/devel/lib/system/exceptions.nim#L34
21:29:32FromDiscord<ellliottt> oh so it inherets the field from `Exception`
21:29:37FromDiscord<dk> but really, what's the points of providing anything more than a message
21:30:02FromDiscord<ellliottt> In reply to @dk "but really, what's the": in this case im parsing some text, and i want to return the current state of the parser along with a message
21:30:17FromDiscord<ellliottt> so that the message can be formatted later
21:30:27FromDiscord<ellliottt> (edit) "so that the message can be formatted later ... " added "with info from the state"
21:52:20*MightyJoe quit (Quit: I'm out!)
21:54:57*cyraxjoe joined #nim
21:58:10FromDiscord<Yardanico> Apparently now github activity shows new releases of the repos you starred
21:58:17FromDiscord<Yardanico> (even if you don't watch them)
21:58:37FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/832736765335961660/unknown.png
22:18:02*Jesin quit (Quit: Leaving)
22:21:15*tane quit (Quit: Leaving)
22:21:47*D_ joined #nim
22:38:30*Jesin joined #nim
22:39:05FromDiscord<clyybber> In reply to @Yardanico "Apparently now github activity": I think theres a seperate watch feature for that; something like "watch for releases"
22:39:08FromDiscord<clyybber> maybe you enabled that?
22:39:12FromDiscord<Yardanico> no, I double-checked
22:39:31FromDiscord<Yardanico> for ytdl I have this one (it's the default) https://media.discordapp.net/attachments/371759389889003532/832747056446963754/unknown.png
22:39:41FromDiscord<Yardanico> same for https://github.com/Celludriel/X4_Universe_Generation_Tool which I don't even remember that I starred :P
22:39:44FromDiscord<Yardanico> (but I sure did)
22:40:44FromDiscord<clyybber> oh, cool
22:41:13FromDiscord<Yardanico> didn't find it in their changelog so I'm a bit confused
22:45:34FromDiscord<ellliottt> sorry for asking so many questions ๐Ÿ˜… can i get `runes(str)` as a closure iterator? or is there a difference in how they are defined?
22:47:14FromDiscord<dk> I guess you can wrap the inline iterator in a new closure iterator, but that would suck
22:47:45FromDiscord<dk> people generally don't use closure iterators I think
22:48:23FromDiscord<ellliottt> In reply to @dk "I guess you can": how would that work, and why would it be bad?
22:48:37FromDiscord<Yardanico> In reply to @ellliottt "how would that work,": it would be bad because it means worse performance
22:48:40FromDiscord<ellliottt> or do you mean make a new iterator that does `for ..`
22:48:41FromDiscord<Yardanico> why do you want to wrap it in a closure iterator?
22:48:42FromDiscord<ellliottt> (edit) "..`" => "... yield`"
22:49:19FromDiscord<ellliottt> im parsing some text so i want to read a file one rune at a time
22:49:30FromDiscord<Yardanico> you usually use a while loop for that
22:49:51FromDiscord<ellliottt> but im writing a parser, so it cant be contained in a while loop
22:49:59FromDiscord<ellliottt> i want my parser state to store the iterator/stream
22:50:00FromDiscord<Yardanico> it can, why not?
22:50:06FromDiscord<ellliottt> recursive functions
22:50:21FromDiscord<ellliottt> i guess it could be a loop but it would be horrible to write
22:50:33FromDiscord<Yardanico> well, I'm still not sure if I understand why you can't just do it with a simple for loop
22:50:41FromDiscord<Yardanico> but you can check https://github.com/kostya/benchmarks/blob/master/brainfuck/bf.nim which uses closure iterators for a similar thing
22:50:59FromDiscord<Yardanico> although this is not really idiomatic nim, it's been written to be in line with other implementations, usually you'd not use a closure iterator here
22:52:11FromDiscord<ellliottt> what im doing is (badly) reimplementing a stream type
22:52:31FromDiscord<ellliottt> cant i store a file handle and pull bytes from it?
22:53:14FromDiscord<Yardanico> sure, but that might again be not very efficient since you'll have to do a system call every time you read the stuff from the file :P
22:53:30FromDiscord<Yardanico> there's https://nim-lang.org/docs/memfiles.html which maps files to memory
22:53:45FromDiscord<Yardanico> but it's better to just read everything from the file first, if the file's not big of course
22:54:30FromDiscord<ellliottt> memmap is how you'd do it in C probably, so i guess ill go with that :)
22:55:00FromDiscord<ellliottt> ah, but reading runes from that will be hard
22:55:11FromDiscord<ellliottt> since the `unicode` functions take strings
22:55:23FromDiscord<Yardanico> why would it be hard?
22:56:19FromDiscord<ellliottt> if i have an index into a memfile, i dont know how many bytes to read to get a rune
22:58:48FromDiscord<ellliottt> i dont see a way to index into a memfile anyway
22:58:57FromDiscord<ellliottt> it just has functions for opening/closing/flushin
22:58:59FromDiscord<ellliottt> (edit) "opening/closing/flushin" => "opening/closing/flushing"
23:13:52*krux02 quit (Ping timeout: 240 seconds)
23:17:52*vicfred_ quit (Quit: Leaving)
23:31:18*Jesin quit (Quit: Leaving)
23:40:02*Jesin joined #nim
23:47:25*Gustavo6046 joined #nim