<< 14-07-2021 >>

00:10:37*stkrdknmibalz joined #nim
00:31:13FromDiscord<HPaulson> Hey all — am very new to nim dev, building a learning project. Does anyone know of a solid crypto lib I could use for things like generating entropy’s?
00:33:27FromDiscord<ElegantBeef> https://github.com/cheatfate/nimcrypto is probably the best crypto library to use
00:33:30fn<R2D299> itHub: 7"Nim cryptographic library"
00:33:37FromDiscord<HPaulson> Doesn’t have what I need
00:33:59FromDiscord<HPaulson> Checked it out -/ seems it only really does hashes and such
00:45:07*stkrdknmibalz quit (Remote host closed the connection)
00:50:39*stkrdknmibalz joined #nim
00:53:57FromDiscord<bernardo> In reply to @HPaulson "Hey all — am": https://github.com/oprypin/nim-random
00:53:59fn<R2D299> itHub: 7"Random number generation library for Nim"
00:55:49FromDiscord<HPaulson> ????
00:55:52FromDiscord<HPaulson> I mean ok lmfao
00:57:23FromDiscord<bernardo> In reply to @HPaulson "I mean ok lmfao": sorry, I guess?
00:57:50FromDiscord<HPaulson> Hahaha, just very confused why you sent a numbers lib when I was tryna find a crypto lib 🤣
00:58:27FromDiscord<bernardo> > I could use for things like generating entropy
00:58:47FromDiscord<HPaulson> Correct, looking to generate entropy’s from mnemonics my guy
00:59:18FromDiscord<bernardo> 👍 good luck, sorry for adding noise to your quest
00:59:23FromDiscord<HPaulson> Haha all go do
00:59:27FromDiscord<HPaulson> (edit) "go do" => "good"
01:00:04FromDiscord<HPaulson> My startup was planning to use Nim in prod, slowly realizing thata prolly not the best choice… assumed support would be larger
01:01:38FromDiscord<ElegantBeef> Well i dont touch crypto so waiting for someone that does probably will give better suggestions 😄
01:01:55FromDiscord<HPaulson> Yeah I feel
01:01:59FromDiscord<HPaulson> Appreciate the help
01:02:29FromDiscord<HPaulson> Am just playing around atm, our CTO recommended the Lang over rust & I’m just rolling with his choice
01:02:43FromDiscord<HPaulson> But lack of pkgs worries me, even with solid bindings to c
01:15:30FromDiscord<Bung> @ElegantBeef oh, I see the process , it currently support primtive and plain objects now
01:23:00FromDiscord<ElegantBeef> Lol really watching it arent you 😄
01:23:09FromDiscord<ElegantBeef> Case objects and unexported fields are going to be tricky
01:26:25FromDiscord<Bung> yeah, I read the source code last night , know the idea how it works, well , string -> PNode maybe complex, like a json parser that produce PNode
01:28:11FromDiscord<Bung> with the macro cache store proc signature, so addToBuffer no more needs
01:36:01*arkurious quit (Quit: Leaving)
01:49:35FromDiscord<ElegantBeef> Yep the big issue though is i dont know how to do cross module accessing of fields
01:57:12FromDiscord<Bung> what's the old way , how it iterate fields of imported types ?
01:57:31FromDiscord<ElegantBeef> Yea
01:58:26FromDiscord<Bung> if that's problem so you even cant properly constructe that type's instance right ?
01:58:45FromDiscord<ElegantBeef> Dont follow
01:59:34FromDiscord<ElegantBeef> I should be able to instantiate any type since i have the symbol of that type
01:59:54FromDiscord<ElegantBeef> That means regardless where it's declared it should be instantiable
02:00:08FromDiscord<Bung> including private fields ?
02:00:17FromDiscord<ElegantBeef> No, that's what i just said is an issue
02:00:36FromDiscord<ElegantBeef> I dont know if one can get symbols for field names so it's an issue
02:01:47FromDiscord<ElegantBeef> For normal objects i can just use the field iterator i assume
02:01:58FromDiscord<Bung> assign private fields by memory aligment possible ?
02:02:11FromDiscord<ElegantBeef> Rather complicated for object variants
02:04:04FromDiscord<ElegantBeef> I probably should just fix hminast for devel so this works
02:04:23FromDiscord<Bung> well, I dont know the other way, since the big issue is private fields are not visible, you get data but have yet found way assign that data to private fields
02:04:49FromDiscord<timotheecour> `privateAccess` in devel
02:06:33FromDiscord<ElegantBeef> Nice
02:07:54FromDiscord<Bung> oh importutils.nim module, hope module symbols get merged soon, currently I track module path by myself.
02:11:49FromDiscord<ElegantBeef> Works beautifully thanks 😄
03:43:19FromDiscord<HPaulson> Does `$` actually change a vars value to a string, or does it just return such stringed?
03:43:28FromDiscord<HPaulson> (edit) "stringed?" => "stringified?"
03:43:39FromDiscord<HPaulson> (Also didn’t see any questions channel so hope this is okay here)
03:45:09FromDiscord<ElegantBeef> Yea it's fine here, it calls the `$` proc for the value
03:45:27FromDiscord<HPaulson> So just grabs the Val rather that reassigning, correct?
03:45:47FromDiscord<ElegantBeef> It does whatever the `$` proc says to do
03:45:49FromDiscord<ElegantBeef> https://nim-lang.org/docs/dollars.html
03:45:56FromDiscord<ElegantBeef> For primitives they're implemented there
03:46:09FromDiscord<HPaulson> 👍
03:46:20FromDiscord<ElegantBeef> like `$100 == "100"`
03:56:51FromDiscord<HPaulson> What would be the equivalent to JS Buffer?
03:57:13FromDiscord<HPaulson> (edit) "JS Buffer?" => "node’s Buffer api?"
04:04:41FromDiscord<Bung> std has simlar but not very close I remenber ? I have one https://github.com/bung87/buffer
04:04:44fn<R2D299> itHub: 7"buffer module write in Nim provide api similar to Nodejs buffer module. "
04:04:55FromDiscord<ElegantBeef> string stream?
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:02FromDiscord<HPaulson> In reply to @Bung "std has simlar but": Awesome thx
04:06:38*supakeen joined #nim
04:17:51*tiorock joined #nim
04:17:51*rockcavera quit (Killed (calcium.libera.chat (Nickname regained by services)))
04:17:51*tiorock is now known as rockcavera
04:20:31*rockcavera quit (Remote host closed the connection)
04:37:53FromDiscord<gogolxdong (liuxiaodong)> Any blake3 library in Nim?
04:38:30FromDiscord<gogolxdong (liuxiaodong)> and chacha8
04:51:42FromDiscord<Jasmine and Don't Forget!~> I'm having an issue with cmake, if anyone wants to help
04:52:46FromDiscord<Jasmine and Don't Forget!~> I'm trying to build nlvm
04:53:02FromDiscord<Jasmine and Don't Forget!~> here's the error message
04:53:03FromDiscord<Jasmine and Don't Forget!~> sent a code paste, see https://play.nim-lang.org/#ix=3sWf
04:53:54FromDiscord<ElegantBeef> Seems you just need to set your compiler
04:54:06FromDiscord<Jasmine and Don't Forget!~> I tried looking for cxx using apt search, but there were a lot of options
04:54:11FromDiscord<Jasmine and Don't Forget!~> So do I just install clang?
04:54:19FromDiscord<Rika> cxx == c++ compiler i believe
04:54:21FromDiscord<ElegantBeef> It's a C++ compiler afaik
04:54:35FromDiscord<Rika> set it to gcc as well
04:54:51FromDiscord<Jasmine and Don't Forget!~> I believe I have gcc installed, how to I set it so cmake can see it?
04:55:05FromDiscord<Rika> in cli `CXX=gcc cmake ...`
04:55:09FromDiscord<Rika> i believe?
04:55:17FromDiscord<Rika> oh yeah its on the error
04:55:23FromDiscord<Jasmine and Don't Forget!~> I always love a copy paste, lmao
04:55:24FromDiscord<Jasmine and Don't Forget!~> thank you
04:55:25FromDiscord<Rika> `Tell CMake where to find the compiler by setting either the environment variable "CXX" `
04:55:31FromDiscord<Jasmine and Don't Forget!~> Ye
04:55:36FromDiscord<ElegantBeef> Should be right
04:56:15FromDiscord<Jasmine and Don't Forget!~> So I just paste that into the terminal?
04:56:27FromDiscord<Jasmine and Don't Forget!~> because it complained when I did that
04:56:31FromDiscord<ElegantBeef> well the `...` is whatever you were sending
04:56:42FromDiscord<Jasmine and Don't Forget!~> Oh, lol
04:56:47FromDiscord<ElegantBeef> should be `CXX=gcc` followed by `cmake args`
04:57:08FromDiscord<ElegantBeef> all on a single line since you didnt `export` the environment
04:58:33FromDiscord<Jasmine and Don't Forget!~> Okay, I didn't have any args for cmake, so I just put in `CCX=gcc cmake`
04:58:39FromDiscord<Jasmine and Don't Forget!~> And then that game me this
04:58:55FromDiscord<Jasmine and Don't Forget!~> sent a code paste, see https://play.nim-lang.org/#ix=3sWg
04:59:00FromDiscord<Jasmine and Don't Forget!~> So I was like, okay, just do
04:59:06FromDiscord<ElegantBeef> How did you run cmake before?
04:59:46FromDiscord<Jasmine and Don't Forget!~> I just did `cmake`, but that had issues with CCX, so then I did `cmake CCX=gcc`, but then it gave me this
05:00:01FromDiscord<Jasmine and Don't Forget!~> sent a code paste, see https://play.nim-lang.org/#ix=3sWh
05:00:09FromDiscord<Jasmine and Don't Forget!~> sorry, that's the same one, the first one was a typo
05:00:10FromDiscord<ElegantBeef> Why are you even using cmake?
05:00:21FromDiscord<Jasmine and Don't Forget!~> because I want to make nlvm
05:00:26FromDiscord<ElegantBeef> but it uses make
05:00:34FromDiscord<ElegantBeef> clone it then run `make`
05:00:49FromDiscord<Jasmine and Don't Forget!~> I am... silly, sorry, lmao
05:01:57FromDiscord<ElegantBeef> Yea you best apologize that's my territory, cannot have interlopers
05:02:36FromDiscord<Jasmine and Don't Forget!~> lol, I'm having more errors because I'm bad at following instructions
05:03:25FromDiscord<ElegantBeef> Did you install all deps, and clone submodules?
05:03:32FromDiscord<Jasmine and Don't Forget!~> this is the error, if you want to help agian https://media.discordapp.net/attachments/371759389889003532/864733835392843776/bash.txt
05:03:49FromDiscord<ElegantBeef> Same issue
05:04:14FromDiscord<Jasmine and Don't Forget!~> I tried giving it the variable
05:04:16FromDiscord<ElegantBeef> `CXX=gcc make`
05:04:59*SebastianM joined #nim
05:05:41FromDiscord<Rika> In reply to @Jasmine and Don't Forget!~ "I just did `cmake`,": backwards
05:05:47FromDiscord<Rika> `CXX=gcc cmake`
05:05:52FromDiscord<Jasmine and Don't Forget!~> Yeah, I did that
05:05:55FromDiscord<Jasmine and Don't Forget!~> thank you
05:06:36FromDiscord<Jasmine and Don't Forget!~> It's still not compiling, it said that it was an issue with the compiler, so I'm going to try clang now
05:06:45FromDiscord<Jasmine and Don't Forget!~> I can give the error log if you want it
05:07:31FromDiscord<ElegantBeef> Maybe it's supposed to be `g++` 😄
05:07:42FromDiscord<Jasmine and Don't Forget!~> lol
05:08:52FromDiscord<Jasmine and Don't Forget!~> sent a code paste, see https://play.nim-lang.org/#ix=3sWn
05:13:44FromDiscord<Tuatarian> hey everyone
05:13:48FromDiscord<ElegantBeef> Hello
05:13:51FromDiscord<Tuatarian> hody
05:13:53FromDiscord<Tuatarian> howdy
05:13:58FromDiscord<ElegantBeef> I have 0 clue how to resolve that issue jasmine
05:14:22FromDiscord<Tuatarian> does anybody remember that one website (can't remember the name, best website ever or something like that) which basically said that the best website design was simple pure html
05:14:44FromDiscord<Tuatarian> completely forgot what the site is
05:14:52FromDiscord<Tuatarian> been trying to find it for a bit
05:15:31FromDiscord<Jasmine and Don't Forget!~> You're good, I'm using windows subsystem for linux
05:15:36FromDiscord<Jasmine and Don't Forget!~> Gosh, I really don't like windows
05:15:48FromDiscord<Jasmine and Don't Forget!~> Honestly thinking about just going back to linux
05:15:50FromDiscord<ElegantBeef> I dont tautarian 😄
05:15:53FromDiscord<ElegantBeef> You should
05:16:02FromDiscord<Tuatarian> linux is great
05:16:07FromDiscord<Tuatarian> but I do things other than code on my computer
05:16:08FromDiscord<Jasmine and Don't Forget!~> Yes I should, but I also like video games
05:16:13FromDiscord<Tuatarian> and windows is infinitely better for general use
05:16:19FromDiscord<Tuatarian> not really a competition imo
05:16:33FromDiscord<ElegantBeef> ~~Is a gamer but still doesnt touch windows~~
05:16:34FromDiscord<Tuatarian> I tried installing linux on this computer
05:16:35FromDiscord<Jasmine and Don't Forget!~> And I'd have to backup all of my minecraft worlds, and projects, and it just seems like a hassle rn
05:16:44FromDiscord<Jasmine and Don't Forget!~> Oh no, I was like you
05:16:44FromDiscord<Tuatarian> had some crazy audio issues, gave up and just went back to windows
05:16:51FromDiscord<Jasmine and Don't Forget!~> I used to game exclusively on linux
05:16:52FromDiscord<Tuatarian> my laptop has linux
05:17:00FromDiscord<Tuatarian> It's not terrible, but it's pretty bad
05:17:12FromDiscord<Jasmine and Don't Forget!~> but then this game from my favorite game studio came out, apex
05:17:18FromDiscord<Jasmine and Don't Forget!~> and it uses easy anti cheat
05:17:23FromDiscord<Jasmine and Don't Forget!~> so I had to use windows to play
05:17:35FromDiscord<ElegantBeef> Yea i still have a windows partition for anti cheat games but hardly touch it
05:36:20fn<ForumUpdaterBot99> New Nimble package! globby - Glob pattern matching for Nim., see https://github.com/treeform/globby
05:36:21fn<R2D299> itHub: 7"Glob pattern matching for Nim."
05:46:05FromDiscord<ElegantBeef> At what point does treeform make `stdliby` so people can use all of his libraries easily 😄
06:33:50arkanoidthis thing that proc in module root can't have closure calling conversion is making proc type comparison harder than it should
06:38:04FromDiscord<ElegantBeef> I dont use closures so uncertain how
06:44:32fn<ForumUpdaterBot99> New thread by Sixte: Contexts, scopes and intrinsic types, see https://forum.nim-lang.org/t/8231
06:56:23FromDiscord<treeform> In reply to @ElegantBeef "At what point does": I don't think my packages provide a very uniform coverage you need for stdlib
06:57:09*SebastianM quit (Quit: Bye)
07:20:35arkanoidis it possible to test for pragma? for example test if proc has {.noSideEffect.}
07:21:00FromDiscord<arnetheduck> In reply to @treeform "I don't think my": they certainly provide the quality 😉 coverage is earier to fix
07:21:00*max22- joined #nim
07:21:06FromDiscord<arnetheduck> (edit) "earier" => "easier"
07:21:17*max22- quit (Remote host closed the connection)
07:21:41*max22- joined #nim
07:22:46FromDiscord<ElegantBeef> Test in what way, a macro can
07:25:53arkanoidElegantBeef I'm actually writing a concept that should match proc types that: get 1 input A gives 1 output B so f(A) is B, is total function (has noSideEffect)
07:26:09FromDiscord<arnetheduck> sent a code paste, see https://play.nim-lang.org/#ix=3sWD
07:26:12FromDiscord<ElegantBeef> ah so yes a macro can be used here
07:26:12arkanoidso the general question is: how to test if a proc has {.noSideEffect.}
07:26:29FromDiscord<ElegantBeef> https://github.com/beef331/oopsie/blob/master/src/oopsie.nim#L21
07:26:38FromDiscord<ElegantBeef> To show how you can use a macro in a concept
07:27:27FromDiscord<ElegantBeef> i'd normally write it for you, but presently dealing with my own macro madness 😄
07:27:55arkanoidno, problem, I'm training, so it's actually good thing :D
07:29:48FromDiscord<ElegantBeef> @Bung well i do support variant objects with a caveat they dont have descrims at the same level, but eh progress 😄
07:30:53FromDiscord<ElegantBeef> but this works now https://media.discordapp.net/attachments/371759389889003532/864770913642610688/unknown.png
07:32:22FromDiscord<Bung> I see two "but" words, does not show any bad news ?
07:32:35FromDiscord<ElegantBeef> well there is that caveat
07:33:05FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3sWH
07:34:07FromDiscord<Bung> the problem is two case or one else branch does not have field ?
07:34:29FromDiscord<ElegantBeef> Two cases on the same level
07:34:42FromDiscord<ElegantBeef> Relatively rare thing of course
07:35:08FromDiscord<Bung> oh, sound good to me , jsonnode only use one case.
07:35:27FromDiscord<ElegantBeef> Oh you and your selfish view! 😄
07:36:50FromDiscord<Bung> yeah, I only wait this feature, so I can have plugin system in my static site generator, and I will migrate my hexo blog to this.
07:37:53FromDiscord<ElegantBeef> Well i guess next thing will be ref objects and seqs
07:38:00FromDiscord<ElegantBeef> though i think i know how ref objects work
07:38:02*max22- quit (Remote host closed the connection)
07:38:49*max22- joined #nim
07:40:00FromDiscord<treeform> In reply to @arnetheduck "btw, <@!107140179025735680> how did": Just with the -d: release, all computers should show same general differences, but different absolute numbers.
07:43:15*Vladar joined #nim
07:56:03FromDiscord<PressF> Quick question. Can nim be used as a functional language like Haskell?↵With this I mean no side effects, recursion over loops, higher order function....
07:56:42FromDiscord<PressF> BTW currently finishing my first nim project and loving it so far
07:56:55FromDiscord<PressF> (edit) "BTW" => "BTW" | "far" => "far"
08:00:29FromDiscord<ElegantBeef> Well with strict funcs the pure functions are more pure, but i dont know about the remainder, not a FP user
08:19:45arkanoidPressF, I'm not a FP but I'm learning a bit of it. You have side effects free func, higher order function, closures, function composition. What you don't get for free are persistent data structures, but you can add them
08:21:56FromDiscord<arnetheduck> In reply to @treeform "Just with the -d:": sure - what I mean is jsony vs nim-json-ser is roughly 1.2x when I run it, whereas on the site, it's more like 1.7x - for the std lib comparison, I see 8x, while on github it's .. closer to 4x if I'm reading it right
08:22:51FromDiscord<arnetheduck> I was thinking it might orc vs normal gc or something like that
08:30:30*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
08:40:08FromDiscord<haxscramper> Editing forum thread title after posting is not possible, correct?
08:40:53fn<ForumUpdaterBot99> New thread by Haxscramper: Declare `[]` iterator, see https://forum.nim-lang.org/t/8232
08:48:10FromDiscord<ElegantBeef> Ah i hit a simpler problem relatively recently opted to `slice(a..b)` 😄
08:52:42*max22- quit (Remote host closed the connection)
08:52:52FromDiscord<haxscramper> In the end I can just overload `items`, but if possible I would prefer to use `object[start .. end]` syntax without paying for intermedite allocations
08:52:59*max22- joined #nim
09:07:54*neceve joined #nim
09:11:41*max22- quit (Remote host closed the connection)
09:14:13*max22- joined #nim
09:22:16FromDiscord<Rika> prolly would be possible once views are stable
09:34:08FromDiscord<haxscramper> It is not about view types, overload resolution just seems to be broken
09:35:27FromDiscord<Bung> @ElegantBeef is it ready for use now ?
09:35:40FromDiscord<ElegantBeef> Nope
09:35:45FromDiscord<ElegantBeef> Still doesnt handle refs
09:35:58FromDiscord<ElegantBeef> Or seqs
09:36:11FromDiscord<Bung> okay
09:45:16FromDiscord<PressF> In reply to @arkanoid "<@391274926541373441>, I'm not a": Thx. I'll need to look into that
09:52:07arkanoidPressF, I'm also playing around with FP and nim, actually testing the limits of nim type system when dealing with proc types. For example: https://play.nim-lang.org/#ix=3sUb
09:52:11FromDiscord<konsumlamm> In reply to @PressF "Quick question. Can nim": you can, but it's definitely not intended and you will likely run into problems
09:53:18FromDiscord<konsumlamm> also see the `zero_functional` package for efficient iterator combinators
09:53:47*max22- quit (Quit: Leaving)
09:56:20arkanoidAfter successfull implementation of function composition using "real types", I'm now trying to reimplement same thing with nim concepts, but I'm facing some compiler errors. Do you see any concept trivial issue in my code? https://play.nim-lang.org/#ix=3sXb
09:59:11FromDiscord<konsumlamm> i'm not sure how making concepts for that makes any sense
09:59:23FromDiscord<konsumlamm> also, those are old-style concepts
09:59:58arkanoidI've just started with concepts, I'm following the manual. What does make them "old"?
10:01:13FromDiscord<konsumlamm> there being new-style concepts
10:01:43arkanoidI'm on nim devel and following https://nim-lang.org/docs/manual_experimental.html#concepts
10:01:53FromDiscord<konsumlamm> see https://github.com/nim-lang/RFCs/issues/168
10:04:30arkanoidinteresting
10:06:17arkanoidare they already implemented?
10:06:49FromDiscord<konsumlamm> partially
10:07:30FromDiscord<konsumlamm> you can see my issues marked with [Conceotd[ for problems with them
10:07:39FromDiscord<konsumlamm> (edit) "[Conceotd[" => "[Concepts]"
10:13:19fn<ForumUpdaterBot99> New thread by Ingo: Yield tuple: Error: invalid type, see https://forum.nim-lang.org/t/8233
10:19:50arkanoiddo you know if it is possible to augment real type with a concept? I mean, add compile time checks to a real type in the concept way
10:42:42FromDiscord<Rika> Enforce a type to always match a concept?
10:43:02FromDiscord<Rika> Not that I know of
10:43:27FromDiscord<Rika> Rather not if the type isn’t controlled by you
10:43:53FromDiscord<Rika> You can limit functions to always match types that match concepts, I don’t really understand what you want
10:44:42arkanoidRika, I'm fixing a testcase, I'll share asap
10:58:45FromDiscord<konsumlamm> In reply to @Rika "Enforce a type to": you can do that, with `static: assert Type is Concept`
11:06:20FromDiscord<Rika> In reply to @Rika "Rather not if the": .
11:08:07FromDiscord<konsumlamm> the above still works tho
11:10:04FromDiscord<Rika> Maybe see definition of "rather"
11:10:16arkanoidhere's my playground. I've both the real type version and the concept one with a compile time switch. The concept version fails to compile and I'm trying to understand why https://play.nim-lang.org/#ix=3sXv
11:16:00FromDiscord<konsumlamm> @Rika i fail to see what you're trying to say
11:20:45FromDiscord<konsumlamm> arkanoid: you realize that a concept doesn't make much sense here, because there is only one `func` type? your concept will only be implemented by very specific functions, which can be better expressed by using a type alias
11:29:00arkanoidkonsumlamm, the non-concept branch is using type aliases: "type Function[A, B] = proc(x: A): B {.noSideEffect.}"
11:29:52arkanoidexercise here is making real/alias branch equivalent to concept one. For equivalent I mean compile and pass test
11:32:14arkanoidreal deal is the error: "/usercode/in.nim(42, 43) Error: cannot instantiate: 'compose[int, float, string]'; got 3 typeof(s) but expected 6". I have no idea where the 3 more typeof are coming from, considering the fact that the real/alias version works
11:34:31arkanoidthere are also warnings that puzzles me when compiling the concept branch: fconcept.nim(7, 5) Hint: 'B' is declared but not used
11:34:46arkanoidbut concept check is f(A) is B
11:54:07FromDiscord<konsumlamm> In reply to @arkanoid "real deal is the": ye, idk what that's supposed to mean, sorry
11:54:44arkanoidnp
11:58:05arkanoidbtw this is what I'm revolving around: https://wiki.haskell.org/Functor, and nim manual makes explicit examples of concept functors https://nim-lang.org/docs/manual_experimental.html#concepts
12:03:11FromDiscord<Rika> you dont declare the function type as a concept usually
12:03:20FromDiscord<Rika> its usually the actual type that's a concept
12:03:21FromDiscord<AKDev> hi
12:03:27FromDiscord<AKDev> i just downloaded nim for opengl
12:03:34FromDiscord<Rika> see how there's not "proc" or "func" in the functor concept
12:04:52arkanoidRika, yeah not common to work with proc types, but makes perfect sense when type + concepts wants to be used for domain driven design or stuff like that
12:05:41FromDiscord<Rika> so what do you really want
12:05:49FromDiscord<Rika> the type version works does it not?
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:38*supakeen joined #nim
12:10:23arkanoidthe type version works, the concept version raises strange errors. Considering the fact that functions are first class in nim, they should be 1:1
12:10:50arkanoidI have the feeling that I'm dealing with some details related to Generic
12:12:07FromDiscord<Rika> its a concept thing, the way concepts work arent the same as what you're thinking is the issue i feel
12:12:52FromDiscord<Rika> like `c is func; c(Function[A, B], Function[B, C]) is Function[A, C]` doesnt mean what i think youre thinking
12:14:48arkanoidno? So what is "c"? Manual says that it should represent an instance of the currently matched type
12:15:18FromDiscord<Rika> yes, but `c()` is a function called c, unrelated to the `c` in c is func
12:15:40arkanoidO_o
12:16:02FromDiscord<Rika> look at one of the concept examples
12:16:17arkanoidI've read dozen, I've in front of me the first one of the manual
12:16:20FromDiscord<Rika> the functor one
12:16:24FromDiscord<Rika> ` map(f, A -> T) is MatchedGenericType[T]`
12:16:38FromDiscord<Rika> `map(...)` function called map
12:16:51FromDiscord<Rika> apply the same thought process to the concept you made
12:16:52FromDiscord<Rika> therefore
12:16:58FromDiscord<Rika> `c(...)` function called c
12:17:44arkanoidbut in "f.val as A" f is an instance of the Functor
12:18:01arkanoids/as/is
12:18:07FromDiscord<Rika> yes
12:18:11FromDiscord<Rika> but its not called
12:18:28FromDiscord<Rika> `c.call is A` would work, but then you need a proc/field called `call`
12:19:00arkanoidso concept doesn't work with proc types, basically
12:19:04arkanoidwhat's the point
12:19:26FromDiscord<Rika> or you can do `c is Function[Function[A, B], Function[Function[B, C], Function[A, C]]]` which is basically the same as the type version
12:19:35FromDiscord<Rika> for non proc types
12:19:50FromDiscord<Rika> if you want static duck typing basically
12:20:38FromDiscord<Rika> i dont even know why you need compose as a proc type
12:20:52FromDiscord<Rika> a regular proc would work pretty much perfectly,
12:20:55FromDiscord<Rika> ah
12:21:03FromDiscord<Rika> i guess if you're gonna use that proc as a value
12:21:13FromDiscord<Rika> but still, a concept isnt needed here
12:22:38FromDiscord<konsumlamm> arkanoid: honestly, if you're trying to do type shenanigans, Nim isn't the right language for that, i'd rather use Haskell (given that you're following the Haskell wiki)
12:22:58FromDiscord<Rika> i agree
12:23:07FromDiscord<Rika> nim's type system isnt as sophisticated as other languages
12:23:19arkanoidA Function and a Composition are two basic blocks of category theory. I've proved that a "real type/alias" version is possible, was just playing around with concepts to achieve the same given the fact that procs should be first class
12:24:31FromDiscord<konsumlamm> sure, i'm just saying that if you want to do category theory, Haskell is way better suited
12:25:33arkanoidsure, but I don't see much sheningans here. I'ts barebone functor and compositor, the shenanigans would be trying to push a Monoidal Category into nim, which I have no intention to do
12:26:37FromDiscord<Rika> you usually make the value type the concept, not the function type
12:27:10FromDiscord<konsumlamm> even a barebone Functor can make problems in Nim, it doesn't have first-class HKT support
12:27:44arkanoidkonsumlamm all the type inference is forward in my case, that's why the "real type" version works without problems
12:27:48FromDiscord<Rika> In reply to @konsumlamm "even a barebone Functor": maybe one day ill have the time and knowhow to help with adding such a thing
12:28:50arkanoidhere is just concept syntax and possible limitations (and obvious noob error I might be typing like considerin "c" the instantiated thing)
12:30:12arkanoidmy general feeling is that is just me not good yet in writing concepts
12:33:39arkanoidand also I'm quite surprised that is not possible to execute a function on the instantiated object
12:40:43FromDiscord<Rika> wdym?
12:49:38*mahlon quit (Ping timeout: 256 seconds)
12:52:02*arkurious joined #nim
12:53:53arkanoidthat in the concept body of the aforementioned example "c" should be the non-generic proc, so doing "c(A) is B" should call that "c", not an external one
12:54:24FromDiscord<Rika> but that's not consistent with the syntax
12:54:57FromDiscord<Rika> are you saying nim should special case when `concept c` is referring to a function type?
12:56:24arkanoidfunction call is not a "special case". c() means call c, and if c is defined as non-generic proc in concept body, why should it be considered something else
12:57:08FromDiscord<Rika> so a special case indeed, because if c is not a function there is no possibility that `c()` would mean call concept instance c
12:58:20FromDiscord<Rika> and that is confusing, what if concept instance c isnt constrained like `c is Function` or whatever, and it matches a function type by chance or w/e? that would mean anything `c()` would mean something else
12:59:55arkanoidit is always possible to design a "catch all" concept, so that is not an argument
13:00:59arkanoidquestion is: if the type I want to match is a function type, how to match if it wants one argument of type A and outputs a B?
13:01:16FromDiscord<Rika> it is possible, is it practical
13:01:27FromDiscord<Rika> do we have the resources to do so
13:02:15FromDiscord<Rika> well we already are throwing the current impl now
13:02:30FromDiscord<Rika> but the new impl wont help you here
13:03:30FromDiscord<Rika> feel free to comment on the new-style concepts rfc about it then i guses
13:03:32FromDiscord<Rika> (edit) "guses" => "guess"
13:03:39arkanoidbtw this is my first experiment with concepts, I've neved used them before. Still I don't feel like asking rocket science
13:04:13FromDiscord<Rika> what do you want us to say other than "you're using it wrong and its not supposed to be used like that"?
13:05:33arkanoidnothing, I'm ok with that. I do see it now. I was just confused by the fact that c(..) was ignored and not raising any error
13:06:44arkanoidthere's no "c" function in namespace, so the concept should not match anything, but it does somehow (the "function" test set succeeds even with concepts)
13:08:12FromDiscord<Rika> so that means either im wrong or the old concepts are buggy (theyve been observed countless times to be buggy so im pretty sure its the latter)
13:11:56arkanoidbasically I'm playing around with concepts for the first time on a buggy implementation and ideas considered sci-fi for now
13:12:50arkanoidstill, I'm happy to have finally grasped at least something about them. I'm planning to use them in next project but yet unsure where
13:20:24arkanoidwith some black magic it might be possible though https://github.com/nim-lang/Nim/issues/5650#issuecomment-860227825
13:24:49arkanoidyet I don't understand what "mapto" and "default" are here https://play.nim-lang.org/#ix=3pPI
13:26:36FromDiscord<Rika> i dont see a default
13:26:48arkanoid"proc mapto[T](x:t):MatchedGenericType[T] = map(f,default(A->T))"
13:27:08FromDiscord<Rika> ah okay
13:27:38arkanoidyou can also find the comments here: https://stackoverflow.com/questions/67958826/trouble-defining-a-nim-concept-with-an-auto-type-inside
13:27:54arkanoidbut I miss the point of declaring a proc into a concept
13:30:16FromDiscord<Rika> In reply to @arkanoid "yet I don't understand": thats still an old-style concept
13:30:51arkanoidok, let's restart from scratch. How to learn writing new concepts?
13:31:06FromDiscord<Rika> read the rfc
13:31:06FromDiscord<Rika> https://github.com/nim-lang/RFCs/issues/168
13:31:31FromDiscord<Rika> its not a complete implementation yet
13:31:32FromDiscord<Rika> but it exists
13:33:52arkanoidthis new kind of concepts really reminds me "Interfaces"
13:35:11FromDiscord<Rika> they are not, they are still strictly compiletime
13:39:13FromDiscord<theangryepicbanana> interfaces have been proposed though
13:40:38arkanoidthe example given by araq in rfc doesn't cover type checking like on current(old) concept version, but in the second post by Andrea Ferretti it seems to check them anyway (see "self is AdditiveMonoid")
13:47:46arkanoidwould you explan what "map(f,default(A->T))" means? I've tried repr on kinda "default(A->T)" and I'm getting "[Field0 = nil, Field1= nil]". What does it mean to map a function to the "default of a proc type"?
13:48:17*rockcavera joined #nim
13:48:17*rockcavera quit (Changing host)
13:48:17*rockcavera joined #nim
13:50:43FromDiscord<haxscramper> !eval import std/sugar; echo default(int -\> int).isNil()
13:50:49NimBotCompile failed: /usercode/in.nim(1, 36) Error: undeclared identifier: '-\>'
13:51:08FromDiscord<haxscramper> big brain time v9000
13:51:25FromDiscord<haxscramper> Anyway, default of a procedure seems to be `nil`
13:51:25FromDiscord<haxscramper> Anyway, `default` of a procedure seems to be `nil`
13:53:34arkanoid!eval import sugar; type A = object; type B = object; type F = A -> B; echo default(F).repr
13:53:38NimBot[Field0 = nil,↵Field1 = nil]↵
13:55:17FromDiscord<Rika> !eval import sugar; type A = object; type B = object; type F = A -> B; echo default(F)
13:55:20NimBotCompile failed: /usercode/in.nim(1, 71) Error: type mismatch: got <F>
13:55:39FromDiscord<Rika> ok
13:55:53FromDiscord<Rika> field0 should be either the proc pointer or the environment pointer
13:56:02FromDiscord<Rika> same with 1 (the other_
13:56:04FromDiscord<Rika> (edit) "other_" => "other)"
13:59:35FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3sZm
14:27:54arkanoidok so that means that's a closure
14:28:21arkanoidso what is "map(f,default(A->T))" ?
14:47:19FromDiscord<hamidb80> hey
14:55:15*mahlon joined #nim
15:13:31FromDiscord<Jasmine and Don't Forget!~> hi
15:19:28FromDiscord<hamidb80> how can i copy a `ref` object ?
15:20:45FromDiscord<Rika> deepcopy
15:22:25FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3t0q
15:23:38FromDiscord<enthus1ast> but f2 is no ref anymore then
15:24:11FromDiscord<Rika> var f2 = new f1.type↵f2[] = f1[]
15:24:15FromDiscord<Rika> perhaps.
15:24:20FromDiscord<Rika> but this is a shallow copy
15:24:28FromDiscord<Rika> deep copies would copy refs in refs as well
15:51:43FromDiscord<Hi02Hi> Is there a way to "restart" a closure iterator?
15:56:44FromDiscord<Jasmine and Don't Forget!~> I'm having an issue with the nim bindings in godot, I've practically written the exact same program in nim and gdscript and for some reason the nim version isn't working
15:56:55FromDiscord<Jasmine and Don't Forget!~> I can paste the code if you want to see
15:57:20FromDiscord<Rika> In reply to @Hi02Hi "Is there a way": no
16:23:07*max22- joined #nim
16:41:11*stkrdknmibalz joined #nim
16:52:58FromDiscord<RattleyCooper> In reply to @Jasmine and Don't Forget!~ "I'm having an issue": Are you using `gdNim` or `godot-nim`?
16:53:11FromDiscord<Jasmine and Don't Forget!~> I'm using godot-nim, I believe
16:54:09FromDiscord<RattleyCooper> Can you send the script?
16:54:14FromDiscord<Jasmine and Don't Forget!~> ofc, one sec
16:54:43arkanoidshoudn't {.raises: [].} be implicit with func/{.noSideEffect.} ?
16:55:09FromDiscord<Jasmine and Don't Forget!~> sent a code paste, see https://play.nim-lang.org/#ix=3t0V
16:55:14FromDiscord<Jasmine and Don't Forget!~> this is the script in nim
16:56:09FromDiscord<Jasmine and Don't Forget!~> and here's the gdscript that I did a little bit ago https://media.discordapp.net/attachments/371759389889003532/864913171369164880/message.txt
16:56:30FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3t0X
16:56:43FromDiscord<RattleyCooper> In reply to @geekrelief "What's the issue?": They're using `godot-nim`
16:57:13FromDiscord<Jasmine and Don't Forget!~> When I use the transform.basis in gdscript, it sets the direciton of the player. But in nim it goes off in random directions
16:57:14FromDiscord<geekrelief> but what issue are you running into? She just says it isn't working.
16:57:21FromDiscord<RattleyCooper> (edit) "In reply to @geekrelief "What's the issue?": They're using `godot-nim` ... " added "and I don't remember if godot-nim needs gdExport"
16:58:18FromDiscord<RattleyCooper> In reply to @geekrelief "but what issue are": Does `godot-nim` need `{.gdExport}` for procs?
16:58:38FromDiscord<Hi02Hi> In reply to @Rika "no": i mean create a var that is a restarted version of the closure iterator, but i dont think thats possible either
16:58:39FromDiscord<RattleyCooper> (edit) "In reply to @geekrelief "but what issue are": Does `godot-nim` need `{.gdExport}` for procs? ... " added " If so, that seems like the problem"
16:58:42FromDiscord<haxscramper> No, raises is related to exception tracking↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
16:58:54FromDiscord<haxscramper> Exception and effect tracking
16:59:04FromDiscord<haxscramper> Not all effects are side effects IIRC
16:59:25FromDiscord<geekrelief> In reply to @Jasmine and Don't Forget!~ "When I use the": Maybe your basis access is transposed?
16:59:25FromDiscord<Rika> @Hi02Hi no you need to run the function that makes the iterator again
16:59:41FromDiscord<Jasmine and Don't Forget!~> How would I fix that?
17:00:18FromDiscord<geekrelief> check to see if you can do `basis.z` instead of `basis[2]`
17:00:46FromDiscord<Jasmine and Don't Forget!~> I tried that, but it didn't like it
17:00:48FromDiscord<geekrelief> https://github.com/pragmagic/godot-nim/commit/f3da1c6ee5331592ee4755ac97e09e94a94a6c0f
17:01:32FromDiscord<Jasmine and Don't Forget!~> I'm using a release, should I build the newer version?
17:02:02FromDiscord<geekrelief> you mean from nimble?
17:02:27FromDiscord<Jasmine and Don't Forget!~> I think so, I mean gic cloning it and following the instructions on the site for how to build it
17:02:35FromDiscord<Jasmine and Don't Forget!~> (edit) "gic" => "git"
17:03:00FromDiscord<geekrelief> that should be fine. just try changing your basis access from using numbers to `x,y,z` first to see if that solves your issue
17:03:46FromDiscord<Jasmine and Don't Forget!~> I already did that, and it was throwing errors. I'll do it on a fresh build, thank you
17:04:09FromDiscord<geekrelief> ok if it was throwing errors then you don't have the commit that implements it
17:04:40FromDiscord<geekrelief> so you can try accessing the `elements` of `basis` create a new vector from that just like it's shown in the commit
17:04:59FromDiscord<geekrelief> if that fixes it, then you just need to update godot-nim to get the accessors
17:07:17*pro joined #nim
17:13:08FromDiscord<ajusa> Is there a zero copy way to go from cstring to string if I know the length as well?
17:15:35FromDiscord<@bracketmaster-5a708063d73408ce4> is there an wasy way to access just the last element of an array in nim?element
17:17:28FromDiscord<geekrelief> In reply to @@bracketmaster-5a708063d73408ce4 "is there an wasy": Use `^`, the BackwardsIndex
17:17:44FromDiscord<konsumlamm> specifically `arr[^1]`
17:18:09FromDiscord<@bracketmaster-5a708063d73408ce4> !nim var a = [1,2,3,4,5]; a[^1];
17:18:14FromDiscord<Rika> eval lol
17:18:22FromDiscord<@bracketmaster-5a708063d73408ce4> !eval var a = [1,2,3,4,5]; a[^1];
17:18:22NimBotCompile failed: <no output>
17:18:29FromDiscord<Rika> !eval var a = [1,2,3,4,5]; echo a[^1];
17:18:29NimBotCompile failed: <no output>
17:18:59FromDiscord<Rika> no output? lol
17:19:27fn<Prestige99> weird
17:19:45FromDiscord<pointystick> !eval [1,2,3,4,5][^1]
17:19:45NimBotCompile failed: <no output>
17:19:52FromDiscord<Rika> needs to echo
17:19:58FromDiscord<pointystick> oops
17:20:01FromDiscord<Hi02Hi> In reply to @Rika "<@!787421416227995699> no you need": yeah that makes sense but the problem is that the iterator is passed as a parameter, so i dont know that function
17:20:08FromDiscord<@bracketmaster-5a708063d73408ce4> !eval echo "hello"
17:20:08FromDiscord<pointystick> !eval echo [1,2,3,4,5][^1]
17:20:08NimBotCompile failed: <no output>
17:20:08NimBotCompile failed: <no output>
17:20:16fn<Prestige99> uhh
17:20:23FromDiscord<Rika> In reply to @Hi02Hi "yeah that makes sense": just so you know python also does not have this feature
17:20:24fn<ForumUpdaterBot99> New question by shuji: How to write accesors for kind Variants in Nim, see https://stackoverflow.com/questions/68382552/how-to-write-accesors-for-kind-variants-in-nim
17:20:29fn<Prestige99> bot is broken?
17:20:29FromDiscord<Rika> the playground is probably down
17:20:34fn<Prestige99> !eval echo "hello"
17:20:34NimBotCompile failed: <no output>
17:20:35fn<R2D299> <no output>
17:20:40fn<Prestige99> yeah..
17:20:41FromDiscord<@bracketmaster-5a708063d73408ce4> what feature?
17:20:59fn<Prestige99> Yep the playground site is down
17:21:02FromDiscord<Rika> i reply to hi02hi
17:21:07FromDiscord<Rika> iterator restarting
17:21:11FromDiscord<@bracketmaster-5a708063d73408ce4> o
17:21:13FromDiscord<@bracketmaster-5a708063d73408ce4> oh
17:21:29FromDiscord<Rika> checked playground
17:21:32FromDiscord<Rika> its indeed down
17:21:39FromDiscord<@bracketmaster-5a708063d73408ce4> was about to say, a[-1] definitely works in Python
17:22:49FromDiscord<Rika> the also should have hinted that i wasnt talking about that tho xd
17:34:07FromDiscord<Hi02Hi> In reply to @Rika "just so you know": i wasnt expecting it, i was asking if i missed anything
17:34:13FromDiscord<Rika> o ok
17:45:19*rockcavera quit (Remote host closed the connection)
17:55:37fn<ForumUpdaterBot99> New post on r/nim by shujidev: How to write accesors for kind Variants in Nim, see https://reddit.com/r/nim/comments/ok9qoe/how_to_write_accesors_for_kind_variants_in_nim/
18:10:30FromDiscord<haxscramper> Where does this `type Value=object` style comes from? Almost all tutorials documentation indent after `type` and put all objects (even non-recursive ones) in a single section
18:11:06FromDiscord<theangryepicbanana> probably people who aren't familiar with nim (or pascal)
18:12:35FromDiscord<theangryepicbanana> their code isn't very good either, so they're probably new to nim
18:17:11FromDiscord<dom96> it's not just people who aren't familiar, there are some who prefer that style
18:17:29FromDiscord<dom96> and probably look at it in the same way as `proc blah ...`
18:21:30*max22- quit (Ping timeout: 268 seconds)
18:56:22*max22- joined #nim
19:05:15*pro quit (Ping timeout: 258 seconds)
19:07:10fn<ForumUpdaterBot99> New thread by Sdmcallister: Nimpy pandas slicing/indexing, see https://forum.nim-lang.org/t/8234
19:08:22*max22- quit (Ping timeout: 268 seconds)
19:18:25*max22- joined #nim
19:33:04*max22- quit (Remote host closed the connection)
19:41:05*max22- joined #nim
20:00:10*max22- quit (Ping timeout: 268 seconds)
20:07:40*max22- joined #nim
20:48:12*rockcavera joined #nim
20:48:12*rockcavera quit (Changing host)
20:48:12*rockcavera joined #nim
20:54:41*max22- quit (Remote host closed the connection)
20:55:05*max22- joined #nim
21:16:47*neceve quit (Ping timeout: 245 seconds)
21:27:51*max22- quit (Quit: Leaving)
21:43:03*max22- joined #nim
22:01:07*Vladar quit (Quit: Leaving)
22:02:59*max22- quit (Quit: Leaving)
22:32:05FromDiscord<Ayy Lmao> What do you all use for text editing? Is there anything good that has good autocomplete and definition finding?
22:34:24FromDiscord<theangryepicbanana> In reply to @Ayy Lmao "What do you all": I think there's some lsp extensions for nim in vscode
22:40:13FromDiscord<ElegantBeef> I use saems extension for vscode
22:46:30FromDiscord<Ayy Lmao> That seems good. I've found the syntax highlighting in the vscode extensions to be a bit wonky sometimes however
22:55:45FromDiscord<Ayy Lmao> Having the lsp installed is really good though, I didn't have that before
23:07:04FromDiscord<System64 ~ Flandre Scarlet> Is it possible to use C code in Nim or I have to port it?
23:09:34FromDiscord<Ayy Lmao> You can use C code, there's an example in here https://nim-lang.org/docs/backends.html
23:10:39FromDiscord<theangryepicbanana> In reply to @Ayy Lmao "That seems good. I've": yeah I'm hoping to work on the syntax highlighting soon-ish
23:10:44FromDiscord<theangryepicbanana> it kinda sucks
23:11:47FromDiscord<System64 ~ Flandre Scarlet> Ooooh alright that's cool!
23:12:45FromDiscord<System64 ~ Flandre Scarlet> this language is neat
23:14:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @Ayy Lmao "You can use C": and if there is multiple files for my C code, is that a problem too?
23:14:40FromDiscord<Ayy Lmao> It is. I hope it gains popularity. I have found it to be a great language to work with for pretty much all of my needs so far
23:14:56FromDiscord<Ayy Lmao> In reply to @System64 "and if there is": It shouldn't be a problem
23:15:05FromDiscord<System64 ~ Flandre Scarlet> alright should try that
23:16:22FromDiscord<Ayy Lmao> You can also link compiled c libs, dynamic and static
23:16:32FromDiscord<System64 ~ Flandre Scarlet> Yeah I know that
23:16:47FromDiscord<System64 ~ Flandre Scarlet> that's what I did with GameMusicEmu and Tilengine
23:30:08FromDiscord<ElegantBeef> @garett you know you starred the completely wrong `hottie` mine was just for porting it to linux 😄
23:30:34FromDiscord<garett> Thanks for the heads up
23:31:27FromDiscord<ElegantBeef> It was just so i could delete it without confusing you
23:31:48FromDiscord<garett> Now I’ve starred treeform’s repo
23:41:16FromDiscord<theangryepicbanana> what's the operator precedence of the deref operator? I can't find it in the docs