<< 03-01-2021 >>

00:02:47*mids joined #nim
00:36:22*smitop joined #nim
00:37:37FromDiscord<treeform> @disruptek So what want a deserializer that works like packedjson? Where it keeps the values pointing back at the string that was passed in?
00:38:44disrupteki will probably write something that just unboxes, but it will primarily be stream-based.
00:38:59FromDiscord<treeform> why stream based?
00:39:19disruptekbecause fragments are more typical of my workloads.
00:39:45FromDiscord<treeform> Like reading from network over TCP?
00:40:42disruptekor a file.
00:41:00disrupteky'know, a stream. 😉
00:41:23disrupteki don't want to tear down my serializer and rebuild it constantly.
00:41:32disrupteki just want a window that moves along over the stream.
00:42:09disrupteki will have cps fetching into the queue... that sort of thing.
01:03:22FromDiscord<treeform> I am not longer fan of streams, as they incur 10-40% speed penalty over regular strings.
01:04:56*adnan449 joined #nim
01:05:46adnan449Hello, is there any way I can automatically format all of my nim project from the project root directory? My VS Code is not formatting nim files on save
01:06:13*Jesin quit (*.net *.split)
01:06:14*synthmeat quit (*.net *.split)
01:06:14*WilhelmVonWeiner quit (*.net *.split)
01:06:14*notchris quit (*.net *.split)
01:06:14*screens_ quit (*.net *.split)
01:06:14*dgb quit (*.net *.split)
01:06:14*sepples quit (*.net *.split)
01:06:14*yumaikas quit (*.net *.split)
01:06:14*kaliy quit (*.net *.split)
01:06:14*disruptek quit (*.net *.split)
01:07:20FromDiscord<treeform> I made a tool for that called more pretty
01:07:38FromDiscord<treeform> it does some extra things I wanted: https://github.com/treeform/morepretty
01:07:51FromDiscord<treeform> just run that in your root directly it will walk and format all of the files.
01:08:05FromDiscord<treeform> make sure they are git-commited first
01:09:33*Jesin joined #nim
01:09:33*synthmeat joined #nim
01:09:33*WilhelmVonWeiner joined #nim
01:09:33*notchris joined #nim
01:09:33*sepples joined #nim
01:09:33*disruptek joined #nim
01:09:33*screens_ joined #nim
01:09:33*kaliy joined #nim
01:09:33*dgb joined #nim
01:09:33*yumaikas joined #nim
01:10:10*notchris quit (Ping timeout: 285 seconds)
01:11:37*dgb quit (Ping timeout: 264 seconds)
01:11:45*dgb joined #nim
01:14:17*notchris joined #nim
01:26:47saemadnan449: which vscode extension are you using?
01:27:49adnan449saem, https://marketplace.visualstudio.com/items?itemName=kosz78.nim
01:29:29saemah, the og ts one. nevermind don't maintain that one
01:31:07FromDiscord<Clyybber> saem btw timothee fixed the config order issue
01:31:22saemyay!
01:33:45saemNow just need a compiler param where you can pass in a per run config which can be located anywhere on the files system so tools can coordinate/reuse auto generated cfgs :D
01:33:58saemBut that's later
01:37:52saemadnan449: for nimpretty that's going to be some command line work over each file or hook into git perhaps. In terms of the extension, give this one a shot to see if it works for you: https://github.com/saem/vscode-nim
01:38:22FromDiscord<shadow.> https://github.com/adafruit/Adafruit_BNO055/blob/master/examples/read_all_data/read_all_data.ino↵would this be ffi-able? never worked with ffi before. i know arduino is based on c++ but im not sure if i could ffi this api currently
01:38:58FromDiscord<ElegantBeef> You have seen the nim arduino bindings?
01:39:29adnan449@treeform, organizing imports are really nice, if I am not mistaken, this is not in nimble repository. Why is that?
01:40:44adnan449saem, ok this is actually working. Thank you.
01:41:34saemadnan449: lol, I wasn't quite sure if nimpretty integration broke or not, I don't use it as much as I perhaps should -- extension code is ugly
01:41:46*tsujp joined #nim
01:41:57FromDiscord<shadow.> i have not
01:43:45FromDiscord<ElegantBeef> Well here if you still havent https://github.com/zevv/nim-arduino
01:43:50saem@treeform that's pretty cool, if it was easily installed (eg: nimble or whatever) it could probably be a simple command in the extension.
01:44:39FromDiscord<ElegantBeef> it is easily installed
01:44:55FromDiscord<ElegantBeef> `nimble install https://github.com/treeform/morepretty`
01:45:45saemfair enough :thinking
01:53:59FromDiscord<shadow.> thanks beef
01:54:51FromDiscord<has1> hi
01:55:01FromDiscord<has1> is it possible to load c# class librarys with nim?
01:55:54FromDiscord<ElegantBeef> Nope, there is a project to convert C# to Nim in progress but not very usable atm, https://github.com/kobi2187/cs2nim
02:06:18*adnan449 quit (Remote host closed the connection)
02:11:35*mids quit (Quit: Connection closed for inactivity)
02:14:34*adnan338 joined #nim
02:14:37*adnan338 quit (Remote host closed the connection)
02:14:41saemfun, now to git bisect the compiler
02:14:48*adnan338 joined #nim
02:15:30saemwell nimsuggest
02:17:41*abm quit (Quit: Leaving)
02:33:21FromDiscord<CodeHz> Use winim/clr
02:33:50FromDiscord<CodeHz> !repo winim
02:33:51disbothttps://github.com/khchen/winim -- 9winim: 11Nim's Windows API and COM Library 15 198⭐ 14🍴 7& 1 more...
02:34:22FromDiscord<CodeHz> (edit) "winim/clr" => "[winim/clr](https://khchen.github.io/winim/clr.html)"
02:35:14*junland_ joined #nim
02:36:11FromDiscord<has1> oh wow
02:36:13*def-- joined #nim
02:36:22FromDiscord<has1> so i can use .net framework stuff via nim?
02:36:28FromDiscord<has1> this language is so impressive
02:36:41*screens__ joined #nim
02:37:21FromDiscord<flywind> see https://forum.nim-lang.org/t/7265#45978
02:37:24*sknebel_ joined #nim
02:37:44*antranigv_ joined #nim
02:39:01*oculuxe joined #nim
02:39:13*WilhelmV1nWeiner joined #nim
02:39:46*kali_ joined #nim
02:40:36FromDiscord<has1> can you explain what i am looking at?
02:42:50FromDiscord<has1> https://khchen.github.io/winim/clr.html
02:42:57FromDiscord<has1> wait what, i can compile stuff and execute it?
02:43:00*sepples_ joined #nim
02:43:16*tsujp1 joined #nim
02:43:18FromDiscord<has1> so why cant i just load a c# dll this way?
02:43:40*literal_ joined #nim
02:43:52*Zevv quit (*.net *.split)
02:43:52*junland quit (*.net *.split)
02:43:52*def- quit (*.net *.split)
02:43:52*oculux quit (*.net *.split)
02:43:52*antranigv quit (*.net *.split)
02:43:52*so quit (*.net *.split)
02:43:52*literal quit (*.net *.split)
02:43:52*sknebel quit (*.net *.split)
02:43:53*tsujp quit (*.net *.split)
02:43:53*Jesin quit (*.net *.split)
02:43:53*synthmeat quit (*.net *.split)
02:43:53*WilhelmVonWeiner quit (*.net *.split)
02:43:53*screens_ quit (*.net *.split)
02:43:53*sepples quit (*.net *.split)
02:43:53*yumaikas quit (*.net *.split)
02:43:53*kaliy quit (*.net *.split)
02:43:53*disruptek quit (*.net *.split)
02:43:53*Zevv_ joined #nim
02:43:54*def-- is now known as def-
02:44:02*disrupteq joined #nim
02:44:24*synthmeat joined #nim
02:44:36*disrupteq is now known as disruptek
02:51:06*yumaikas joined #nim
02:52:43FromDiscord<has1> @flywind
02:55:51FromDiscord<has1> i installed nim by running "finish.exe"
02:55:58FromDiscord<has1> but still, nim help returns binary not found
02:56:11FromDiscord<has1> do i need to restart my pc for it to work?
02:56:28FromDiscord<has1> opening a new cmd did not work
02:56:58FromDiscord<flywind> What's your OS?
02:57:28FromDiscord<flywind> Maybe you should check whether bin/nim in your env.
02:57:51FromDiscord<has1> windows
02:58:19FromDiscord<has1> yes its in my path
02:58:38FromDiscord<flywind> maybe restart your computer?
02:58:41FromDiscord<has1> :/
02:59:33*so joined #nim
03:10:22FromDiscord<has1> alright, so it works after the restart
03:10:23FromDiscord<has1> weird
03:10:43FromDiscord<ElegantBeef> Windows doesnt like updating path until restarts
03:12:46FromDiscord<has1> https://khchen.github.io/winim/clr.html
03:12:50FromDiscord<has1> i looked at those examples
03:12:54FromDiscord<has1> but there are no imports
03:13:06FromDiscord<has1> why didnt they include the imports needed to run this example?
03:17:01disruptekthat would be too easy.
03:20:40FromDiscord<has1> i suppose, yes
03:20:45FromDiscord<has1> i didnt know its just↵import winim/clr
03:20:59FromDiscord<has1> I hate it when people dont make their examples work
03:22:22FromDiscord<has1> it was also pretty confusing because i tried to autocomplete the import to winim/clr but typing c didnt autocomplete to clr, it suggested other names, but not that one
03:22:29FromDiscord<has1> so i thought i couldnt import that
03:25:24saemhmm, guess I won't be bisecting nimsuggest.
03:35:12*Gustavo6046 quit (Ping timeout: 260 seconds)
03:37:03*Gustavo6046 joined #nim
03:41:23*leorize quit (Ping timeout: 240 seconds)
03:43:41*leorize joined #nim
03:44:01*Gustavo6046 quit (Ping timeout: 264 seconds)
03:48:45*Gustavo6046 joined #nim
03:49:19*muffindrake quit (Ping timeout: 272 seconds)
03:51:17*muffindrake joined #nim
03:51:36FromDiscord<CodeHz> nope, it should refresh after you restart cmd from shell(explorer)
03:56:58FromDiscord<Cohjellah> That's the idea with websites then hey. No need for dependencies, just plug in the URL - but do you actually need to download QT to open a nimQML program? Seems silly
04:00:06*leorize quit (Remote host closed the connection)
04:00:39*leorize joined #nim
04:05:25*smitop quit (Quit: Connection closed for inactivity)
04:10:34*adnan338 quit (Quit: adnan338)
04:29:19FromDiscord<Avatarfighter> @Cohjellah if you need an example that uses nimQML status is working on their desktop client in nimQML iirc
04:29:44FromDiscord<Avatarfighter> https://github.com/status-im/nim-status-client
04:29:59*adnan338 joined #nim
04:30:07*adnan338 quit (Client Quit)
04:30:17*adnan338 joined #nim
04:30:45FromDiscord<Avatarfighter> no idea what the context of the conversation was but this was cool lol
04:33:41*adnan338 quit (Remote host closed the connection)
04:33:42*Jesin joined #nim
04:33:59*spiderstew joined #nim
04:35:01*spiderstew_ quit (Ping timeout: 268 seconds)
04:38:34FromDiscord<treeform> @saem, i should add it to nimble, I probably just forgot.
04:42:25saemIt's a handy format all/format project. Easy enough to detect it on the path and expose a command.
04:46:29FromDiscord<has1> @ElegantBeef why did you say its not possible?
04:46:47FromDiscord<ElegantBeef> Cause i dont touch windows so didnt expect windows to support it
04:46:50*Cadey quit (Ping timeout: 264 seconds)
04:46:57FromDiscord<has1> it does work
04:47:04FromDiscord<ElegantBeef> Ok sorry
04:47:05FromDiscord<has1> you can do it with the winim lib
04:47:55FromDiscord<has1> if a noob that never touched nim can figure it out in 3 hours, maybe dont jump in too quickly and say its impossible xd
04:47:57*disruptek ponders winning benchmarks.
04:48:00disruptekit's pretty pointless.
04:48:32FromDiscord<has1> i am very impressed by nim, this language is something special
04:48:40FromDiscord<ElegantBeef> > This module add Windows Common Language Runtime (CLR) support to Winim. So that we can use Nim to interact with Windows .NET frameworks.↵Windows .Net, so no doesnt work here
04:49:16FromDiscord<has1> my question was if i can load a dll file in nim
04:49:18FromDiscord<has1> and you can
04:49:25FromDiscord<ElegantBeef> Ok
04:49:31FromDiscord<ElegantBeef> No reason to be so hostile for no reason
04:49:37FromDiscord<has1> how am i being hostile?
04:49:49FromDiscord<ElegantBeef> > if a noob that never touched nim can figure it out in 3 hours, maybe dont jump in too quickly and say its impossible xd↵Read as hostile to me
04:50:28FromDiscord<has1> its not hostile at all. I was just suggesting that you should probably not jump in and say stuff with absolute certainty if you dont know for sure
04:50:56disrupteki will make a faster string freeze/thaw but i don't think i will change my stream r/w.
04:51:48disrupteki don't think streaming data a little faster will help any of my code.
04:52:16FromDiscord<Avatarfighter> @has1 we just try and share our knowledge, elegantbeef thought it was certainly not possible
04:54:05FromDiscord<Rika> it may not be hostile but you cant tell me that's supposed to be friendly
04:54:14*a_chou joined #nim
04:54:15disruptekit's funny that we've somehow curve-fit to our respective benchmarks.
04:54:34FromDiscord<Avatarfighter> disruptek: i have no idea what you're saying rn what is the context
04:54:42FromDiscord<Avatarfighter> what are you benchmarking
04:54:48FromDiscord<Avatarfighter> your massive testes ?
04:54:54FromDiscord<Avatarfighter> (edit) "your massive ... testes" added "library, "
04:55:47FromDiscord<has1> lets just say we were all surprised by nims capabilities
04:59:42FromDiscord<Avatarfighter> disruptek: treeform im guessing based off of the benchmarking
05:09:20disruptekflatty has feature parity to frosty so now we are competing on speed.
05:11:53disrupteki need to break frosty anyway, so it's a good time to update it.
05:13:48disruptekyeah.
05:14:34disruptekalso, he found a bug.
05:14:57disrupteknot sure i'll bother fixing it, but maybe while i'm in there...
05:15:19disruptekit's like, why should i support "freeze(x).thaw(y)"?
05:27:38*Gustavo6046 quit (Ping timeout: 264 seconds)
05:29:30FromDiscord<has1> what is the recommended ide for nim?
05:29:43FromDiscord<has1> the vs code plugin doesnt seem very helpful
05:30:00FromDiscord<Rika> vscode or neovim
05:31:42FromDiscord<has1> definitely not going for vim
05:39:13*a_chou quit (Quit: a_chou)
05:39:16FromDiscord<Rika> the neovim plugin is better than the vscode one 🙂
05:39:29FromDiscord<Rika> anyway yeah those are the ones i know most people use
05:39:34FromDiscord<Rika> i hear theres an emacs one
05:41:13FromDiscord<has1> is there nothing from jetbrains?
05:41:31FromDiscord<has1> oh i think there does seem to be
05:41:36FromDiscord<Rika> its in its infancy
05:41:46FromDiscord<Rika> right now i think its worse than the vs code one
05:44:15*xet7 joined #nim
05:50:31disruptekrude.
05:54:11*waleee-cl quit (Quit: Connection closed for inactivity)
05:57:40*NimBot joined #nim
06:00:21FromDiscord<ElegantBeef> Saem's is improving it quite a bit, but yea some issues
06:05:45disruptekit's so funny, frosty's writes are always slower and my reads are always faster.
06:26:05*Xe joined #nim
06:32:17disrupteklqdev: what kinda endian shit do you want frosty to do for you?
06:38:04*Xe quit (Quit: WeeChat 2.9)
06:40:33*Xe joined #nim
06:44:53*Xe is now known as Cadey
07:20:08saem@Prestige you might be referring to this one as the "good" one, I mean I've updated it more so that's a form of good? https://github.com/saem/vscode-nim (relevant links to marketplace and ovsx therein)
07:31:05PrestigeMight be, I don't use vscode but I've heard there was a "good" nim plugin
07:32:48PrestigeI'm using neovim with nimlsp, but it doesn't seem to detect changes in other files
07:33:52saemYeah, it depends if the LSP launches with refresh or not, can't remember. Also if there isn't a watcher sending mod events it won't work out well.
07:34:57*Zevv_ is now known as Zevv
07:35:13*Zevv quit (Changing host)
07:35:14*Zevv joined #nim
07:36:23*leorize quit (Ping timeout: 240 seconds)
07:39:13FromDiscord<has1> hi, i dont really understand the nim docs
07:39:23FromDiscord<has1> how would i make a http request and include headers in the request?
07:39:30FromDiscord<has1> https://nim-lang.org/docs/httpclient.html
07:40:05FromDiscord<has1> do i just run client.request ?
07:40:09FromDiscord<has1> and pass in all data there?
07:40:14FromDiscord<ElegantBeef> The last one here shows how to use headers https://nim-lang.org/docs/httpclient.html#using-http-post
07:40:23*leorize joined #nim
07:40:55FromDiscord<has1> oh, true. I searched for headers and for some reason ended up at the end of the docs
07:40:59FromDiscord<has1> at the request proc
07:41:30FromDiscord<has1> it actually does not sound that bad to have 1 method that does everything
07:41:35FromDiscord<has1> because you can pass in arguments by name
07:43:23disruptekproc assignParam*(p: BProc, s: PSym; ret: PType) = ## i have nothing good to say about this proc
07:43:33disruptekhehe
07:43:43saemLoL
07:44:13saemOh man, symbol lookup works, I'm so happy
07:44:36FromDiscord<has1> man, the ide support really sucks
07:44:54saemIf found that in an instant -- sorry little wins, it's been way easier navigating thanks to it, but it totally farts up in sem* because includes.
07:47:29Prestigewhat are you using has1?
07:48:08FromDiscord<has1> vs code
07:48:16FromDiscord<Rika> What plug-in
07:48:22FromDiscord<Rika> There are 3 I think
07:48:28FromDiscord<has1> the most popular one
07:48:41FromDiscord<ElegantBeef> Well i suggest saem's with tabnine
07:48:42FromDiscord<has1> by Konstantin Zaitsev
07:49:25FromDiscord<has1> by nimsaem?
07:49:28FromDiscord<ElegantBeef> Yea
07:49:31FromDiscord<has1> the one with 500 downloads?
07:49:40FromDiscord<ElegantBeef> Yes
07:50:13FromDiscord<has1> i mean, cant be worse than what i have
07:50:42FromDiscord<has1> what is the type of a normal array in nim?
07:50:46FromDiscord<ElegantBeef> array
07:50:50FromDiscord<has1> openArray[T] ?
07:50:53FromDiscord<ElegantBeef> Nope
07:50:54FromDiscord<ElegantBeef> Array
07:50:59FromDiscord<ElegantBeef> `array[size,T]`
07:51:20FromDiscord<ElegantBeef> `seq[T]` is a dynamically allocated/sized array
07:51:30FromDiscord<has1> i have json
07:51:40FromDiscord<has1> with an array of items
07:51:42FromDiscord<ElegantBeef> openArray is an abstraction of both of those, and it's a view type
07:51:45FromDiscord<has1> how would i declare that?
07:51:47FromDiscord<ElegantBeef> That'd be a Jarray
07:51:59FromDiscord<Rika> JsonNode with a kind of JArray
07:52:01FromDiscord<ElegantBeef> So it'd be a `JsonNode(kind: JArray)`
07:52:06FromDiscord<has1> wat
07:52:10FromDiscord<has1> as the type definition?
07:52:12FromDiscord<ElegantBeef> Object variant
07:52:14FromDiscord<Rika> No
07:52:16FromDiscord<has1> I want to parse it into my object
07:52:17FromDiscord<ElegantBeef> So it's a JsonNode
07:52:18FromDiscord<Rika> That’s the declaration
07:52:30FromDiscord<Rika> Type is just JsonNode
07:52:36FromDiscord<ElegantBeef> https://nim-lang.org/docs/json.html#JsonNode
07:52:41*Manny8888 joined #nim
07:52:42FromDiscord<has1> can you just tell me the type i need to use
07:52:49FromDiscord<ElegantBeef> We did
07:52:52FromDiscord<has1> to parse it into my json object
07:53:04FromDiscord<Rika> JsonNode
07:53:14FromDiscord<Rika> Or what do you mean
07:53:22FromDiscord<Rika> We don’t understand you
07:53:28FromDiscord<ElegantBeef> Showing us what you want is better than dancing around
07:53:56FromDiscord<has1> sent a long message, see http://ix.io/2KGC
07:54:11FromDiscord<ElegantBeef> No
07:54:28FromDiscord<ElegantBeef> What're you trying to do
07:54:49FromDiscord<has1> let userResponse = to(userJson, Response )
07:55:00FromDiscord<has1> i just have an array of users
07:55:01FromDiscord<ElegantBeef> What is `userjson`
07:55:09FromDiscord<has1> its json
07:55:11FromDiscord<has1> from the server
07:55:18FromDiscord<has1> i have an array
07:55:19FromDiscord<has1> of users
07:55:20FromDiscord<has1> dude
07:55:22FromDiscord<Rika> How do you parse it
07:55:28FromDiscord<Rika> How is it declared
07:55:39FromDiscord<ElegantBeef> So then it'd be a `seq[User]`
07:55:44FromDiscord<has1> this doesnt work?
07:55:46FromDiscord<has1> sent a long message, see http://ix.io/2KGD
07:55:46FromDiscord<Rika> Declared
07:55:46FromDiscord<has1> the array?
07:55:48FromDiscord<Rika> No
07:55:50FromDiscord<Rika> Wait
07:55:51FromDiscord<Rika> No
07:55:57FromDiscord<Rika> You use a seq for that
07:55:59FromDiscord<has1> ok what is the array type
07:56:03FromDiscord<has1> seq?
07:56:03FromDiscord<has1> ok
07:56:04FromDiscord<Rika> Constant size
07:56:04FromDiscord<ElegantBeef> A static array
07:56:10FromDiscord<ElegantBeef> Compile time sized arrays
07:56:15FromDiscord<ElegantBeef> Stack allocated
07:56:42FromDiscord<has1> no generic type param allowed
07:56:49FromDiscord<has1> so not ↵seq[User] either
07:57:03FromDiscord<Rika> What?
07:57:10FromDiscord<Rika> Give us the full error message
07:57:13FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2KGE
07:57:15FromDiscord<ElegantBeef> It clearly works
07:57:15FromDiscord<Rika> You might be misunderstanding it
07:57:25FromDiscord<ElegantBeef> Without the json data we cannot help you with a solution, we dont know how it's aligned
07:58:21FromDiscord<has1> do i need to import something
07:58:24FromDiscord<has1> to use seq?
07:58:28FromDiscord<ElegantBeef> I just proved you didnt
07:58:33FromDiscord<Rika> No
07:58:37FromDiscord<Rika> You do not
07:59:21FromDiscord<ElegantBeef> Give us the json and we can show you how to parse it and explain what you need to do
08:00:07saemhas1: Is this what you want? https://play.nim-lang.org/
08:00:16FromDiscord<ElegantBeef> nice link 😄
08:00:22saemwhoops, sorry
08:00:27saemhttps://play.nim-lang.org/#ix=2KGF
08:00:46FromDiscord<has1> yes
08:01:13saemhas1 great... try starting with a playground next time it's easier to answer questions.
08:03:06FromDiscord<has1> well, i did post the exact same code there, those 4 lines above
08:03:36FromDiscord<ElegantBeef> You never showed the json data so we were left to assuming what you were attempting to parse from
08:03:46saemThis is the example in the manual in regards to unmarshalling in general: https://nim-lang.org/docs/json.html#overview-unmarshalling
08:04:31FromDiscord<has1> sent a code paste, see https://play.nim-lang.org/#ix=2KGH
08:05:12FromDiscord<has1> i am looking at the docs and it returns a Future AsyncResponse
08:05:24FromDiscord<has1> and that should have a body: string
08:06:53saemI don't know the async stuff all that well. :(
08:06:54FromDiscord<ElegantBeef> Your compiler provides an error message
08:07:40FromDiscord<has1> the error message was very unclear to me
08:07:50*narimiran joined #nim
08:07:59FromDiscord<Rika> Response body is a sync
08:08:02FromDiscord<Rika> Async
08:08:04FromDiscord<has1> So i have to await it too?
08:08:05FromDiscord<Rika> You have to await it
08:08:07FromDiscord<Rika> Yes
08:08:11FromDiscord<has1> where does it say that it is async?
08:08:20FromDiscord<Rika> If the type is a Future
08:08:23FromDiscord<has1> Shouldnt it be body: Future<string>?
08:08:29FromDiscord<Rika> It is
08:08:31FromDiscord<has1> but i am already awaiting the response
08:08:32FromDiscord<Rika> Is it not?
08:08:34FromDiscord<ElegantBeef> https://nim-lang.org/docs/httpclient.html#body%2CAsyncResponse
08:08:44FromDiscord<has1> https://nim-lang.org/docs/httpclient.html#AsyncResponse
08:08:46FromDiscord<has1> that is so confusing
08:08:54FromDiscord<ElegantBeef> If you notice the `body` in the AsyncResponse doesnt have an export marker
08:08:54FromDiscord<has1> i was looking at the AsyncResponse
08:08:54FromDiscord<has1> with body: string
08:08:59FromDiscord<ElegantBeef> Yes and that's not exported
08:09:07FromDiscord<ElegantBeef> the proc is exported
08:09:10FromDiscord<Rika> Why do we show that....
08:09:15Prestige^
08:09:20FromDiscord<has1> means exported?
08:09:23FromDiscord<ElegantBeef> Yes
08:09:23FromDiscord<Rika> If it isn’t exported why is it shown
08:09:24FromDiscord<Rika> Yes
08:09:34FromDiscord<has1> So i am actually calling a body proc?
08:09:37FromDiscord<Rika> Yes
08:09:38FromDiscord<ElegantBeef> Yes
08:09:41FromDiscord<has1> well damn
08:09:45FromDiscord<has1> see
08:09:46FromDiscord<Rika> But it’s the fault of the docs IMO
08:09:47FromDiscord<has1> if i had an ide
08:09:49FromDiscord<ElegantBeef> Which your compiler would've told you about
08:09:51FromDiscord<has1> this might be clearer
08:09:59FromDiscord<ElegantBeef> I mean your compiler said as much
08:10:03FromDiscord<Rika> The compiler should be telling you about it
08:10:10FromDiscord<has1> my compiler had like 20 lines
08:10:14FromDiscord<ElegantBeef> `type mismatch got <Future[string]>: expected`
08:10:15FromDiscord<ElegantBeef> Yes
08:10:16FromDiscord<has1> and it was definitely about a future
08:10:16FromDiscord<has1> but
08:10:17FromDiscord<Rika> An IDE would likely depend on the compiler
08:10:18FromDiscord<ElegantBeef> Type mismatch
08:10:27FromDiscord<ElegantBeef> I mean i dont disagree type mismatch is a shitty message
08:10:30FromDiscord<Rika> So there wouldn’t be much difference
08:10:31FromDiscord<ElegantBeef> I have a PR in waiting to resolve it
08:10:44FromDiscord<has1> I did get such a message. But when looking at the docs i just saw body: string.↵↵So you can see how that was confusing
08:10:47disruptekshit it's late.
08:10:48disruptekzevv: get to work.
08:11:15FromDiscord<ElegantBeef> Whenever this gets merged it'll make type mismatches so much less obnoxious https://media.discordapp.net/attachments/371759389889003532/795202600478703626/102961120-c5dd4180-44a0-11eb-97eb-f0054176aee6.png
08:12:14FromDiscord<Rika> I still think it looks awful
08:12:19FromDiscord<ElegantBeef> But eitherway most of the time the error messages produced by the compiler are helpful and point to the issue, although unreadable as hell
08:12:23FromDiscord<ElegantBeef> Why does it look awful?
08:12:27FromDiscord<Rika> Especially that I don’t exactly look at colored items more
08:12:38FromDiscord<Rika> Too many procs shown
08:12:41FromDiscord<ElegantBeef> My next thing will be adding `\n` after each mismatch
08:12:48FromDiscord<ElegantBeef> so then there is less of a block message
08:12:51FromDiscord<ElegantBeef> But that's in a another PR
08:13:21FromDiscord<Rika> The error message is too far to the right
08:13:24FromDiscord<ElegantBeef> Well it shows all mismatches and only hides them after X number, which i believe can be configured
08:13:56FromDiscord<ElegantBeef> I mean help me work on the error messages then 😄
08:14:04FromGitter<gogolxdong> Is there anyone working on Gossip pub/sub library?
08:14:50FromDiscord<Rika> I’ll consider it
08:15:02FromDiscord<Rika> I mean that to beef by the way irc people
08:16:34FromDiscord<ElegantBeef> The biggest issue to new people are the error messages are rather hard to read/undescript, like someone had an issue with an immutable seq and it wasnt very clear that it was due to that immutable until you look at that large mismatch error
08:17:00FromDiscord<ElegantBeef> A nice "At least one of the mismatches is due to an immutable" on a single line would save brain cells
08:19:06FromDiscord<has1> does nim support the language server protocol?
08:19:10FromDiscord<ElegantBeef> Yep
08:19:18FromDiscord<ElegantBeef> `nimble install nimlsp`
08:19:21FromDiscord<has1> why is the edit support still so bad then though?
08:19:24FromDiscord<ElegantBeef> There is also a vscode extension that uses it
08:20:10FromDiscord<has1> i really like nim, but not having good IDE support is really a bad experience
08:20:10FromDiscord<ElegantBeef> Cause tooling hasnt been the prime target for development
08:20:30FromDiscord<ElegantBeef> But it seems like 2021 that's going to become a target
08:21:17FromDiscord<ElegantBeef> https://github.com/nim-lang/RFCs/issues/300
08:21:18disbotDeveloper tooling
08:22:01FromDiscord<19> i dont think it's that bad. i mean sure it can be better but all you need saem's vscode extension and hook it with lldb / gdb debugger.
08:22:44FromDiscord<19> at least thats what works for me 🤷‍♂️
08:23:06FromDiscord<ElegantBeef> Yea saem's making good strides in making a better extension
08:24:19FromDiscord<ElegantBeef> They already know things like highlight needs to be worked on aswell, `a.field.int.float` should be highlighted based off the sym types and not just the regex expression captures 😄
08:24:23FromDiscord<19> yes and most of the time u dont even need a debugger. you just need to get used to the red squiglies messages
08:24:33FromDiscord<ElegantBeef> The compiler is the best debugger 😛
08:25:08FromDiscord<ElegantBeef> When talking about compilation errors, for actual debugging i rarely need a breakpoint debugger
08:27:30FromDiscord<19> yeah i only need debugger if im doing some stupid "shoot yourself in the foot" pointer manipulation
08:28:12FromDiscord<19> otherwise, compiler errors and stack traces are all you really care about
08:29:18FromDiscord<19> i wonder if hot code reloading + arc/orc compatibility is fixed. i had some crashes with HCR and Arc/Orc
08:31:16kinkinkijkinanyone here know OOP well? i need to know the name of an OO memory concept i just added to my game engine
08:33:09FromDiscord<ElegantBeef> Best to just describe it 😛
08:34:15kinkinkijkinthere's two trees of types in my type heirarchy: one called "Extensions" and the other called "Extensibles". the "Extensions" are classes that can be arbitrarily added to any "Extensible" which add extra functionality without going linearly through a type tree and needing to duplicate types to get needed features through
08:35:59FromDiscord<ElegantBeef> So composition
08:36:33FromDiscord<ElegantBeef> Sounds similar to the Unity entity component system where all logic is inside components and all entities are a list of components
08:37:27kinkinkijkinevery "Extensible" has at least one optional reference to an "Extension", and every "Extension" and kind of "Extension" has standard methods to be activated arbitrarily (without knowing the specific type), along with unique methods to be used knowing the type
08:37:35kinkinkijkinsounds familiar
08:38:00FromDiscord<ElegantBeef> Also sounds similar to interfaces
08:38:29FromDiscord<ElegantBeef> But overall it's composition based OOP, which is the proper way to do OOP imo 😄
08:38:48kinkinkijkinthere's also a majour type of "Extension" called "ExtWithPass", which is just an extension with an additional standard method that provides the parent "Extensible"'s member items
08:39:24kinkinkijkinokay, good, i don't know OOP very well and was hoping i didn't just make something
08:43:10saemI mean if you need that level of dynamism sure. Most things are pushed into runtime so it's harder to reason about but that might be necessary.
08:47:07kinkinkijkinthe idea is that my engine is made to be data-efficient, and make data-efficient programming easy to write, and this is just part of my overall plan for how to implement modular, data efficient code in a way that's more intuitive than purely linear trees
08:48:29kinkinkijkinnext is writing in avenues of using this easily, then after that ways of using it to extend the engine in an extremely easy manner
08:49:15FromDiscord<ElegantBeef> Game engine? Have you looked into ECS?
08:50:29kinkinkijkinyeah, this is kinda mixing that with the more traditional inheritance that i know well
08:51:02FromDiscord<ElegantBeef> Really if you're doing OOP based you cannot do much better than the Godot/Unity EC way
08:51:28kinkinkijkinI've worked with godot, it's quite different from unity...
08:51:36FromDiscord<ElegantBeef> It's the same
08:51:41FromDiscord<ElegantBeef> Nodes would be components
08:51:55FromDiscord<ElegantBeef> It's just done in a better manner
08:51:59kinkinkijkinI'm coming from extremely basic OOP in C# and primarily functional stuff in audio
08:52:16FromDiscord<ElegantBeef> Aiming for a 3D or 2D engine?
08:52:49FromDiscord<ElegantBeef> Also no clue if you know but #nim-gamedev exists 😄
08:52:52kinkinkijkinboth
08:52:53kinkinkijkini do know
08:53:08FromDiscord<ElegantBeef> Oh cool, you have my intrigue
08:53:17FromDiscord<ElegantBeef> Source code open?
08:53:25kinkinkijkinyep
08:53:28kinkinkijkinMIT
08:53:42kinkinkijkinbeing written as a library
08:54:05FromDiscord<ElegantBeef> Are you going for a framework, or a full on editor + engine?
08:54:21FromDiscord<ElegantBeef> Anywho link?
08:54:33kinkinkijkinthe render side is really, really naively done since im trying to juggle 3 graphics apis while keeping from being hard-on-pure 3d or 2d
08:54:45kinkinkijkinlemme push my new changes then ill link
08:55:18FromDiscord<ElegantBeef> Manually using metal,vk, and dx, seems like bgfx would save you a few headaches
08:56:35kinkinkijkinim using gles2, gles3, and gl2.1 lol
08:57:05FromDiscord<ElegantBeef> Oh
08:57:14kinkinkijkinhttps://github.com/kinkinkijkin/brutelyEngine
08:57:42kinkinkijkinthe issue is that i've just started writing this and didn't have access to gles3-capable hardware for a while, after already writing it all in gles3
08:59:37FromDiscord<ElegantBeef> Didnt answer if you were aiming for an editor + engine or just more frameworky
09:00:10kinkinkijkinjust frameworky
09:00:23FromDiscord<ElegantBeef> Want some code critique? 😄
09:00:30kinkinkijkinoh
09:01:11kinkinkijkingo ahead
09:01:29FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2KGW
09:01:31FromDiscord<ElegantBeef> I see a lot of `var`s 😄
09:01:47kinkinkijkinit's a jumble from me finding some stuff on OOP code quality suddenly after writing most of what's there so far
09:02:11kinkinkijkinim aware of this
09:03:56FromDiscord<ElegantBeef> Also your objloader file is just a mess of bad formatting 😄
09:04:35kinkinkijkinyep
09:04:42kinkinkijkini wrote that a while ago
09:04:46kinkinkijkina whiiiiile ago
09:04:51FromDiscord<ElegantBeef> Ah
09:05:03kinkinkijkinjust copied it over, been meaning to get rid of it completely, the ply loader is meant to replace it
09:05:24kinkinkijkinbut the ply loader isn't functional yet
09:05:31FromDiscord<has1> wait
09:05:36FromDiscord<has1> why is there just body: string
09:05:45FromDiscord<has1> shouldnt there also be a "byte" version?
09:05:55FromDiscord<ElegantBeef> Strings are byte sequences
09:06:21kinkinkijkinif you're talking about the shader compilation
09:06:30kinkinkijkinlook at datahelpers.nim
09:06:40kinkinkijkinlook at what the CSARRAY procs do
09:06:58FromDiscord<ElegantBeef> I was responding has1's question
09:07:04kinkinkijkin(it's very gross and i hate that it had to be done like that but gles3 is grody)
09:07:06kinkinkijkini was too
09:07:24FromDiscord<ElegantBeef> They're talking about asyncresponse
09:07:28kinkinkijkinoooooooh
09:07:33FromDiscord<ElegantBeef> Lol
09:07:33kinkinkijkinokay i shut up
09:07:47FromDiscord<ElegantBeef> That code is old aswell i take iit
09:07:52kinkinkijkinyes
09:07:59FromDiscord<ElegantBeef> Seeing `inseq.len - 1` instead of `inseq.high`
09:08:08kinkinkijkin... .high is a thing?
09:08:11FromDiscord<ElegantBeef> yep
09:08:25FromDiscord<ElegantBeef> we also have `for i, x in inseq` where i would be index and x is element
09:08:34kinkinkijkinive been writing nim since 0.12 ish btw, on and off
09:08:44FromDiscord<ElegantBeef> so you body would be `outUCA[i] = x`
09:08:52FromDiscord<ElegantBeef> Ah
09:09:06FromDiscord<ElegantBeef> Sorry if i'm redundant then 😄
09:09:35kinkinkijkinnono, ive had my programming learning stunted by starting out with turing and processing
09:09:45kinkinkijkinand then moving to c# and pure ARM asm
09:09:47FromDiscord<has1> So how do i conver it
09:09:53FromDiscord<has1> (edit) "conver" => "convert"
09:09:58FromDiscord<has1> from string to byte
09:11:27FromDiscord<ElegantBeef> What do you need to convert it for?
09:12:08FromDiscord<ElegantBeef> Either way this is the easiest way https://play.nim-lang.org/#ix=2KGZ
09:12:49FromDiscord<ElegantBeef> But if you're just going to be saving it, leaving it as a string is identical in the end result
09:13:17FromDiscord<has1> i am trying to do this
09:13:19FromDiscord<has1> sent a code paste, see https://play.nim-lang.org/#ix=2KH0
09:13:29FromDiscord<has1> writeallbytes expects bytes
09:13:49FromDiscord<ElegantBeef> https://nim-lang.org/docs/io.html#writeFile%2Cstring%2Cstring
09:14:26FromDiscord<has1> no, i am trying to use c# for it
09:14:28FromDiscord<ElegantBeef> Idk why you'd use C# for that
09:14:33FromDiscord<has1> and pass the bytes to c#
09:14:55FromDiscord<ElegantBeef> Anywho
09:15:13FromDiscord<ElegantBeef> Well kin happy to see your work 😄
09:15:20FromDiscord<has1> i will probably need to create a new c# byte object or something?
09:15:36*Ekho quit (Ping timeout: 268 seconds)
09:15:40FromDiscord<ElegantBeef> I dont know how the interop is done
09:15:54FromDiscord<has1> https://khchen.github.io/winim/clr.html
09:16:04FromDiscord<has1> the examples show it just passing strings directly into the functions
09:16:09FromDiscord<has1> but maybe that is just strings
09:16:18FromDiscord<has1> and other types dont work this way?
09:16:25FromDiscord<ElegantBeef> I mean use the C# WriteAll instead
09:16:40FromDiscord<ElegantBeef> No reason to convert to a byteseq really
09:17:08FromDiscord<ElegantBeef> Ah sorry `WriteAllTExt`
09:18:11FromDiscord<has1> Need to pass byte.↵↵There is a bunch of stuff like toCLRvariant etc
09:18:13FromDiscord<ElegantBeef> Kin is it up to the point a numpty like me could toy with some 3D renderering
09:18:17FromDiscord<has1> ill take a look at those
09:23:19FromDiscord<has1> sent a code paste, see https://play.nim-lang.org/#ix=2KH2
09:23:31FromDiscord<has1> i am having a bit of trouble understanding the docs
09:24:09FromDiscord<has1> sent a code paste, see https://play.nim-lang.org/#ix=2KH3
09:24:41FromDiscord<ElegantBeef> It's a generic proc yes
09:24:55FromDiscord<has1> and do i need to pass the type into the function when using it? ↵↵like ↵toCLRVariant<T>(x)
09:25:00FromDiscord<has1> or can i just call with
09:25:02FromDiscord<has1> toCLRVariant(x)
09:25:13FromDiscord<has1> (edit) "↵toCLRVariant<T>(x)" => "↵toCLRVariant[T](x)"
09:25:18FromDiscord<ElegantBeef> Did the compiler error?
09:25:32FromDiscord<has1> it didnt error, the execution failed though
09:25:42FromDiscord<ElegantBeef> So then it's not the issue
09:26:31FromDiscord<has1> but my byte seq is of type openArray[T], or is it?
09:26:49FromDiscord<has1> is it using the first proc, or does it overload to the second proc?
09:27:01FromDiscord<ElegantBeef> It's' of `seq[byte]`
09:27:13FromDiscord<has1> does openArray not implement that?
09:27:13FromDiscord<ElegantBeef> which falls under an `openArray` abstraction
09:27:27FromDiscord<has1> right, but isnt seq a type of openArray?
09:27:31FromDiscord<ElegantBeef> it is
09:27:36FromDiscord<ElegantBeef> So it uses the most specific proc
09:27:46FromDiscord<ElegantBeef> the one of `openArray[T]`
09:29:20FromDiscord<has1> how do i find the VarEnum?
09:29:25FromDiscord<has1> https://khchen.github.io/winim/objbase.html#VARENUM
09:29:29FromDiscord<has1> this gives me a 404
09:29:47FromDiscord<ElegantBeef> Winims source code is on your computer
09:32:18*Ekho joined #nim
09:33:45FromDiscord<has1> where is it?
09:35:06FromDiscord<ElegantBeef> your nimble directory
09:35:34FromDiscord<has1> where specifically?
09:35:44FromDiscord<ElegantBeef> nimble/pkgs/winims
09:36:10FromDiscord<has1> where is the nimble directory?
09:36:16FromDiscord<ElegantBeef> idk on windows
09:36:29FromDiscord<ElegantBeef> it's `~/.nimble` on linux
09:38:02saemDo a nim --dump --dump.format:json yournimfile.nim
09:38:32saemThat should output basically everything you could possibly want to know including your nimble directory
09:45:23FromDiscord<has1> i found it 🙂
09:45:31FromDiscord<has1> not very helpful though
09:46:16FromDiscord<has1> https://play.nim-lang.org/#ix=2KHb
09:46:19FromDiscord<has1> these are my options
09:47:26FromDiscord<has1> i tried VT_SAFEARRAY and VT_BSTR
10:00:00*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:05:40FromDiscord<has1> anyone has any suggestions here?
10:05:49FromDiscord<has1> i am still stuck :X
10:06:05*Vladar joined #nim
10:09:48*PMunch joined #nim
10:10:06*mids joined #nim
10:22:36FromDiscord<j-james> out of curiosity, why can't identifiers include a dash?
10:23:17mipriI doubt there's a deep reason for it. It's just a basic decision to make about a language.
10:24:08PMunchBecause a dash is a minus
10:24:47PMunchHow would you tell the difference between "one-two" meaning variable `one` minus variable `two`, and one variable `one-two`
10:26:42FromDiscord<j-james> got it, that makes sense
10:28:24*opal quit (Remote host closed the connection)
10:51:49FromDiscord<has1> pls
10:51:50FromDiscord<has1> guys
10:55:40Oddmongeris it possible to cast a pointer to a seq ?
10:55:50FromDiscord<Rika> i dont know, has1, sorry
10:56:14FromDiscord<Rika> you can try doing that oddmonger but it has to match the memory structure
10:56:23Oddmongerso i've alloc buffer, and did: var myseq = cast[seq[char]](myalloc)
10:56:30Oddmongerand got an « out of memory »
10:56:53FromDiscord<Rika> uh a seq is not just a simple buffer
10:57:29FromDiscord<Rika> if you want a simple buffer use `cast[ptr UncheckedArray[T]]` of course with T being the real type
10:58:18Oddmongerok
10:58:46Oddmongerhard to load seqs (from a file) which are not (u)int8
10:58:53FromDiscord<has1> how do i declare an openArray type?
10:59:03FromDiscord<has1> proc readBytes(f: File; a: var openArray[int8 | uint8]; start, len: Natural):
10:59:06FromDiscord<Rika> openArray[T]?
10:59:09FromDiscord<Rika> what?
10:59:23FromDiscord<Rika> wdym?
10:59:29FromDiscord<has1> i need ↵↵var oo openArray[T]
10:59:42FromDiscord<Rika> i do not understand what youre trying to do
10:59:46OddmongeropenArray is seq or array , at your convenience
11:00:07FromDiscord<has1> readBytes (inside io) wants an openArray
11:00:18FromDiscord<has1> i need to pass that into the function
11:00:30FromDiscord<Rika> you can use a seq instead
11:00:31Oddmongerjust allocate a seq with the filesize
11:00:36FromDiscord<has1> but how
11:00:37FromDiscord<has1> var oo seq[T]
11:00:45FromDiscord<Rika> var oo: seq[T]
11:01:02FromDiscord<Rika> i dont understand whats wrong
11:01:34Oddmongervar mybuffer = newSeq[uint8](filesize)
11:01:56Oddmongerif you want uint8 (readBytes)
11:02:27Oddmongerbe careful if it's text, you will have to convert it before display (otherwise you'll get values, not chars)
11:02:35FromDiscord<Rika> bridge butchered that, its `var mybuffer = newSeq[uint8]()`
11:03:34FromDiscord<has1> it doesnt work for me
11:03:34FromDiscord<has1> https://play.nim-lang.org/#ix=2KHF
11:03:48FromDiscord<has1> i used int8 here
11:04:31FromDiscord<has1> undeclared identifier: 'newSequint8'
11:04:39FromDiscord<Rika> read this has1
11:04:54Oddmongeroo must be allocated
11:05:17FromDiscord<has1> oh,
11:05:18FromDiscord<has1> Error: unhandled exception: index out of bounds, the container is empty
11:05:22Oddmongerput filesize as argument
11:05:34Oddmonger(gotta go, good luck)
11:06:18FromDiscord<has1> put it where?
11:06:45FromDiscord<has1> oh in the newSec?
11:06:52FromDiscord<Rika> yes
11:06:59FromDiscord<has1> still doesnt work
11:07:00FromDiscord<has1> Error: unhandled exception: unable to invoke specified member: WriteAllBytes (0x80131512) [CLRError]
11:07:12FromDiscord<Rika> then thats a winim issue now
11:07:36FromDiscord<has1> yes, i just want to convert my byte seq to a c# byte array...
11:07:40FromDiscord<has1> so i can invoke writeallbytes
11:07:53FromDiscord<has1> can no one help me with this?
11:08:10FromDiscord<Rika> i cant help you with winim
11:08:11FromDiscord<has1> the docs for toCLRVariant are here:↵↵https://khchen.github.io/winim/clr.html#toCLRVariant%2CT
11:09:34FromDiscord<has1> am i supposed to call it with the VARENUM param?
11:11:15FromDiscord<has1> i just noticed i am also using the return value from readBytes (which is the read count) instead of the buffer value
11:11:25FromDiscord<has1> but even with that fixed it still doesnt work
11:18:48FromDiscord<has1> seriously.. with text it works fine
11:19:15FromDiscord<has1> i just need to convert it to bytes
11:19:31FromDiscord<Rika> convert the seq[int8] to a seq[char] maybe
11:19:52FromDiscord<has1> by casting it?
11:19:57FromDiscord<Rika> you can probably cast the seq[int8] to a string even
11:20:22FromDiscord<has1> but i need to call the function and pass bytes to it
11:20:40FromDiscord<Rika> if text works then it works with a string
11:20:42FromDiscord<has1> ill try with seq[char]
11:20:50FromDiscord<has1> yes it works with a string
11:20:59FromDiscord<Rika> then what is wrong with casting it into a string
11:21:03FromDiscord<has1> @File.WriteAllText("""C:\Users\user\Desktop\test.dat""", "test")
11:21:19FromDiscord<has1> because that is not the function i am using. I am using a different function that only accepts bytes
11:21:39FromDiscord<has1> i am using writeallbytes as example
11:21:39FromDiscord<Rika> dude i have no idea what bytes are theres no bytes in nim unless you mean seq[byte]
11:22:14FromDiscord<has1> public static void WriteAllBytes(string path, byte[] bytes);
11:22:19FromDiscord<has1> its a csharp function.
11:22:22FromDiscord<Rika> i dont know c#
11:22:34FromDiscord<has1> you dont know what bytes are?
11:22:38FromDiscord<has1> or an array?
11:22:41FromDiscord<has1> its the same thing
11:22:41FromDiscord<Rika> i do, i dont know c#
11:22:49FromDiscord<Rika> man whatever you're on your own
11:22:54FromDiscord<has1> what does it have to do with it though? the API is in nim
11:23:03*FromGitter * yumaikas knows C#
11:24:09FromGitter<yumaikas> @has1 What are you trying to do?
11:26:04FromDiscord<has1> i am trying to call a c# function and pass an argument of type byte[] to it
11:26:19FromDiscord<Rika> try casting to seq[byte] then
11:26:33FromGitter<yumaikas> Do you have a paste of the code in question, on both sides?
11:28:23FromDiscord<has1> @Rika i already tried it all.↵↵pass the seq[uint8], pass the clr variant of that, pass the value directly, pass seq[byte]
11:29:01FromDiscord<has1> https://play.nim-lang.org/#ix=2KHM
11:29:28FromDiscord<has1> toCLRVariant is supposed to convert it to the CLR variant, this is where im unclear about
11:30:22FromGitter<yumaikas> Hrm... I'm going to guess that CLRVariant is of type Object, when it comes to dispatch?
11:30:45FromDiscord<Rika> no
11:30:49FromDiscord<has1> i am not sure about that. This is where i was hoping for some help
11:30:49FromDiscord<Rika> its a distinct ref object
11:30:56FromDiscord<has1> https://khchen.github.io/winim/clr.html#toCLRVariant%2CT
11:30:58FromDiscord<has1> here are the docs
11:31:11FromDiscord<Rika> clr variant is a distinct of this https://khchen.github.io/winim/com.html#variant
11:31:29FromGitter<yumaikas> No, I mean on the .NET side
11:32:05FromDiscord<Rika> dunno, i dont know a lick of C#
11:32:07FromGitter<yumaikas> Because from the sounds of it, it's the .NET side where you're running into trouble.
11:32:15FromGitter<yumaikas> I know a *lot* of C#
11:32:34FromGitter<yumaikas> (COM is one of my weaker parts of C# though)
11:32:56FromGitter<yumaikas> Why not use WriteAllText, rather than WriteAllBytes?
11:32:58FromDiscord<Rika> sounds like you can help them then
11:33:31FromDiscord<has1> because its an example for a function
11:33:36FromDiscord<has1> i need to pass bytes to it
11:33:38FromDiscord<has1> i cant use text
11:34:04FromDiscord<has1> trust me, i am lazy, if i could pass text to it i would do it xd
11:35:01FromGitter<yumaikas> What imports/nimble installs do I need to get your paste to compile?
11:35:11FromDiscord<has1> and the c# execution works great. I tried ↵↵@File.WriteAllText("""C:\Users\user\Desktop\aaa.dat""", "some text")
11:35:14FromDiscord<Rika> i think its just winim
11:35:23FromDiscord<has1> import winim/clr, asyncdispatch, httpclient, json
11:35:31FromDiscord<has1> winim/clr
11:35:39FromDiscord<Rika> oops i mean that for the installs
11:37:04FromDiscord<has1> (edit) "and the c# execution works great. I tried ↵↵@File.WriteAllText("""C:\Users\user\Desktop\aaa.dat""", "some text")" => "sent a long message, see http://ix.io/2KHP"
11:39:47FromGitter<yumaikas> Ok, so the first thing you're going to want to do is to figure out what types the CLR variants are resolving to
11:41:28FromGitter<yumaikas> Huh... So it complains "variant is not an object", which means I can't call GetType() on it....
11:42:12FromDiscord<has1> i was hopeing calling toCLRVariant would take care of that
11:43:09FromDiscord<has1> i suppose you mean which nim type corresponds to the byte[] type in c# though? That is what you were saying ?
11:44:22FromGitter<yumaikas> Nah, on the C# side one needs to know what the type of your clrVar is. Right now, I don't know what it is.
11:44:40FromGitter<yumaikas> But I do know that a standard GetType() call on it fails
11:49:02*Vladar quit (Quit: Leaving)
11:52:19FromGitter<yumaikas> @has1: I think you'll have to new up a buffer, and then copy data into it byte by byte
11:52:27FromGitter<yumaikas> Just looking at how things work.
11:52:37FromGitter<yumaikas> I'll see if I can get a paste up once.
11:52:42FromDiscord<has1> how would i do that?
11:53:05FromGitter<yumaikas> Not using toObject, I can tell you that
11:53:50FromDiscord<has1> i just thought about something
11:54:15FromDiscord<has1> couldnt i base64 encode the bytes, call base64 decode via c# code and store the result in a variable
11:54:20FromGitter<yumaikas> You'd grab the `System.Byte[]` type, construct one of the appropriate length, and then either give it a pointer, or use whatever autogenerated indexing operators exist to assign into the ByteArray
11:54:24FromDiscord<has1> then call the function with the result of the decode
11:54:29FromGitter<yumaikas> @has1 Overkill, IMO
11:54:40FromDiscord<has1> i mean, i am desperate at this point
11:54:54FromGitter<yumaikas> @has1: Read the examples more, IMO
11:55:04FromDiscord<has1> which examples? There is no convert example
11:57:19FromGitter<yumaikas> https://github.com/khchen/winim/blob/master/examples/clr/misc_examples.nim#L44-L53 <- That takes bytes from C# and spits them to Nim, so it's a start
11:58:35FromGitter<yumaikas> What specific API do you need to call?
11:58:47FromGitter<yumaikas> (The WPF example is also worth a look)
11:59:59FromDiscord<has1> just↵File.WriteAllBytes
12:00:08FromDiscord<has1> if that works, ill be on my way
12:00:19FromGitter<yumaikas> Why that instead of WriteAllText ?
12:02:07FromDiscord<has1> because it uses bytes
12:02:12FromDiscord<has1> and i need to call a function with bytes
12:02:20FromDiscord<has1> i just noticed
12:02:25FromDiscord<has1> i can convert from string to bytes
12:02:34FromDiscord<has1> with Encoding.UTF8.GetBytes
12:02:40FromDiscord<has1> i tried Bytes.Parse before
12:02:41FromGitter<yumaikas> Yep
12:02:42FromDiscord<has1> but that didnt work
12:03:27FromGitter<yumaikas> You can also use MemoryStreams, IIRC with the right wrappers that lets you stream in things one byte at a time
12:06:07FromDiscord<has1> well fuck.. that doesnt work
12:06:16FromDiscord<has1> i am using the http client
12:06:19FromDiscord<has1> to get the "string"
12:06:31FromDiscord<has1> let response = await client.request(host, httpMethod = HttpGet)↵ let data = await response.body
12:06:53FromDiscord<has1> doing the string convert worked (i used hello world as string, and it wrote the result just fine)
12:07:07FromDiscord<has1> but using this data (which is of type string??) did not work
12:08:18FromGitter<yumaikas> So, C# strings are in UTF-16, so getting the UTF8-bytes will expect a UTF-16 string
12:10:58FromDiscord<has1> so what does that mean for me?
12:11:17FromDiscord<has1> do i need to cast the response.body into a different string type? Into char? Into cstring?
12:11:53FromGitter<yumaikas> I'm not sure, tbh, I'm still trying to get a byte array cast around
12:13:18FromDiscord<has1> var mscor = load("mscorlib")↵ var Encoding = mscor.GetType("System.Text.Encoding")↵ var bytes = @Encoding.UTF8.GetBytes("hello world")
12:13:22FromDiscord<has1> you can do that to get the bytes
12:14:05FromDiscord<has1> what type is the nim string? is that utf8?
12:15:09PMunchWell it's just a series of bytes
12:15:17PMunchBut it can hold UTF-8 data
12:15:29FromDiscord<lqdev> disruptek: not much really, just wanna be sure the output always is either big endian or little endian
12:15:32FromDiscord<has1> but .net expects utf-16
12:15:35FromDiscord<Rika> its not necessarily utf-8 either
12:15:38PMunchBut myStr[10] for example will get the 10th character, not the 0th UTF8 rune
12:15:40FromDiscord<Rika> you can give it utf-16
12:15:49FromDiscord<lqdev> would help with using frosty for networking and such
12:15:51FromDiscord<has1> how can i give it utf-16?
12:15:54PMunchBut you have the unicode module for getting runes
12:16:01FromDiscord<Rika> just make a utf-16 sequence
12:16:04FromDiscord<has1> how?
12:16:10FromDiscord<Rika> no clue, never needed to
12:18:47PMunchYou can use the encodings module: https://nim-lang.org/docs/encodings.html
12:19:01FromDiscord<haxscramper> https://nim-lang.org/docs/widestrs.html#Utf16Char
12:19:30FromDiscord<haxscramper> I haven't used it, just found out this module exists
12:19:59*FromGitter * yumaikas is tapping out for now
12:20:13FromDiscord<haxscramper> But `newWideCString` seems like exactly what you need
12:21:10FromGitter<yumaikas> @has1: Fwiw, C# has a very fully-featured HTTP Client if you're using newer versions, perhaps you can use compile() with the right .DLLs to use that. If you're going to experiment with C# code, I highly recommend LinqPad
12:21:38FromDiscord<has1> that was literally my "out"
12:21:45FromDiscord<has1> like my last ditch
12:21:45PMunch@has1: like this: https://play.nim-lang.org/#ix=2KI7
12:21:53FromDiscord<has1> but then i would basically not use any nim anymore
12:21:55FromDiscord<has1> xDD
12:22:22FromGitter<yumaikas> @has1: There may not be any reason to use Nim, then
12:23:03FromGitter<yumaikas> The main thing that Nim has that C# doesn't is macros. Everything else C# has an answer for, or better. Except for C interop, that's a bit more awkward in C#
12:23:23FromGitter<yumaikas> But, like, async when from C# to Nim, more or less, not the other way around
12:24:11FromGitter<yumaikas> And COM-based interop is always a tricky process unless you happen to have pretty solid understanding of COM itself
12:26:39FromGitter<yumaikas> (If you have any C# questions, I'll be online for a while longer)
12:29:02FromDiscord<has1> ill try the encoding thing
12:29:47*mids quit (Quit: Connection closed for inactivity)
12:31:07FromDiscord<has1> lmao
12:31:12FromDiscord<has1> the encoded one was even worse
12:31:44FromDiscord<has1> MZ�
12:31:57FromDiscord<has1> thats the "raw" response.body
12:32:28FromDiscord<has1> this is the utf16 encoded one
12:32:29FromDiscord<has1> M
12:33:25PMunchAre you sure it expects utf16?
12:33:53FromGitter<yumaikas> winim/clr might do the necessary convertions
12:34:09PMunchWhat are you actually trying to do?
12:34:14FromGitter<yumaikas> Given how it converts other strings (at least string literals) just fine
12:36:24FromDiscord<has1> i am calling
12:36:25FromDiscord<has1> Encoding.UTF8.GetBytes
12:36:31FromDiscord<has1> so whatever that one expects
12:36:59FromDiscord<has1> my data comes from my server. which returns bytes
12:37:20PMunchWell that would expect UTF8 surely
12:39:20FromGitter<yumaikas> Encoding.UTF8.GetBytes takes a C# string, and turns it into UTF8 bytes
12:39:31FromDiscord<has1> yes
12:39:35FromGitter<yumaikas> I think Encoding.UTF8.FromBytes might be handy?
12:39:55FromDiscord<has1> wait wait
12:40:04FromDiscord<has1> that expects Byte[]
12:40:13FromGitter<yumaikas> Thought that would probably get you back to square 1, lol
12:40:18FromDiscord<has1> yes
12:40:37FromGitter<yumaikas> Did you look at the COM1DArray stuff?
12:41:03FromDiscord<has1> hmm, no
12:41:12FromDiscord<has1> what was that?
12:42:18*fputs joined #nim
12:43:15FromGitter<yumaikas> It's something I saw in the examples.
12:45:28narimiranZevv: are you around maybe?
12:50:23narimiranZevv: nvm, the bug was at my end :)
12:51:33Zevvyeah I'm around
12:51:35Zevvbut nevermind
12:51:37Zevvthe bug was on your end
12:56:12FromDiscord<has1> alright boys
12:56:17FromDiscord<has1> i found a solution
12:56:59FromDiscord<has1> sent a code paste, see https://play.nim-lang.org/#ix=2KIj
12:57:13FromDiscord<has1> i returned base64 from my server
12:57:29PMunchHmm, anyone here familiar with https://github.com/clj/nim-esp8266-examples ?
12:57:49PMunchTrying to run some comparative benchmarks against C and MicroPython for my FOSDEM presentation
13:00:53FromDiscord<has1> but my solution sucks, lets be honest
13:00:57FromDiscord<has1> 33% increase in file size
13:02:51PMunchbase64'll do that to ya
13:03:39PMunchZevv, did you ever try Nim en an ESP8266?
13:03:43PMunchon*
13:03:49PMunchfederico3, or maybe you did
13:03:54FromDiscord<has1> oh
13:03:57FromDiscord<has1> i improved my code
13:04:04PMunchOr @clj
13:04:11PMunch@has1, always a good idea
13:04:31FromDiscord<has1> now i am still returning bytes
13:04:32FromDiscord<has1> sent a long message, see http://ix.io/2KIq
13:04:36FromDiscord<has1> but encoding it in nim
13:04:46FromDiscord<has1> then decoding it using c# and the
13:04:51FromDiscord<has1> (edit) removed "and the"
13:05:24FromDiscord<has1> now the only cost is increased cpu usage to do the silly base64 game
13:06:19PMunchYou shouldn't need to convert to base64
13:06:34PMunchAs long as you match their encodings
13:07:41FromDiscord<has1> its a file
13:08:07PMunchAh, you're sending a file?
13:08:36FromDiscord<has1> yes
13:10:18PMunchAnd it doesn't work?
13:10:47PMunchDoes the file have a BOM marker messing things up?
13:11:01PMunchIs it stored as UTF-16?
13:11:08PMunchWhat kind of file is it basically :P
13:11:16PMunchAnd do you read it into a string before sending it?
13:11:24PMunchSender is C#, recipient is Nim right?
13:11:33FromGitter<yumaikas> Also, why do you need C# for this? Is there C# library, or a db connection or the like?
13:14:39*abm joined #nim
13:36:28FromDiscord<has1> i have some legacy code that uses byte that i want to keep using. Basically, use c# as plugin system for old code and nim for new code
13:37:49FromDiscord<has1> the file is just an arbitrary file (user supplied)↵and its sent as-is in byte form via a go http server
13:46:05PMunchVia a go HTTP server?
13:46:11PMunchAnd you ant to receive it in Nim?
13:46:16PMunchOr in C#?
13:49:35*PMunch quit (Quit: leaving)
13:50:52*PMunch joined #nim
13:52:21FromDiscord<Rika> i need some opinions on my new library https://github.com/de-odex/shama before i decide to do anything else substantial to it
13:56:04*lritter joined #nim
14:13:01federico3PMunch: join us on #nim-embedded
14:24:45*Vladar joined #nim
14:28:18*lritter quit (Ping timeout: 256 seconds)
14:31:41ForumUpdaterBotNew question by Victor Golovanenko: How to insert a character into a string in Nim, see https://stackoverflow.com/questions/65550953/how-to-insert-a-character-into-a-string-in-nim
14:34:38FromDiscord<zetashift> GTK & Nim is #1 on HN again
14:34:54FromDiscord<zetashift> I'm seeing Nim a lot on HN these days
14:41:21PMunchLink?
14:41:24FromDiscord<Rika> wow TOP
14:41:30FromDiscord<Rika> https://news.ycombinator.com/item?id=25621700
14:42:10PMunchWait, Gtk4?
14:43:53Oddmongernot so fast, i'm still using gtk2
14:44:26FromDiscord<lqdev> boomer
14:45:45Oddmongerrather petrolcrisiser
14:49:29FromDiscord<Rika> i didnt even know gtk4 existed until now lmao
15:04:43*waleee-cl joined #nim
15:07:56*tane joined #nim
15:12:24Oddmongerseems i cannot dereference an UncheckedArray
15:12:27Oddmongerhttps://play.nim-lang.org/#ix=2KJl
15:14:46FromDiscord<lqdev> what do you mean "dereference an UncheckedArray"?
15:14:54FromDiscord<lqdev> you wanna take an element, use `myalloc_ptr[0]`
15:15:22FromDiscord<lqdev> UncheckedArray[T] does not have an $ because how do you know what's the length of the array
15:16:21Oddmongeri was expecting slice support…
15:16:40Oddmongerok it's not boundchecked, but trust me, i know the bounds :)
15:18:20FromDiscord<lqdev> maybe turn it into an openArray with toOpenArray?
15:21:26Oddmongerseems i need an array to do this
15:21:58Oddmongerah sorry ,read too fast
15:22:13Oddmongerproc toOpenArray[T](x: ptr UncheckedArray[T]; first, last: int): openArray[T] {...} , indeed
15:23:08Oddmongerit's ok with that, thank you
15:23:54Oddmongerbut i wonder if for my need, it wouldn't be faster to concanete an array (the goal is too form a string from bytes)
15:34:21FromDiscord<CodeHz> I don't think openarray is equals to slice
15:36:49FromDiscord<Rika> it kinda is but not really no
15:36:54FromDiscord<CodeHz> (you cannot use openarray to create a slice of seq (only partial data, not whole) without breaking the gc
15:37:11FromDiscord<fwsgonzo> sent a code paste, see https://paste.rs/ZkC
15:37:23FromDiscord<fwsgonzo> bereq.append("")
15:37:51FromDiscord<CodeHz> Yes, but you need export it
15:37:55FromDiscord<fwsgonzo> yep, thanks 😄
15:38:25FromDiscord<CodeHz> (edit) "it" => "it(if not in same module"
15:38:55FromDiscord<Rika> only few instances you cant use ufcs on
15:39:04FromDiscord<Rika> and all proc you can
15:39:12FromDiscord<Rika> only in macros or templates is it ever iffy
15:39:17Oddmongercan you tell me if you can execute this ? https://play.nim-lang.org/#ix=2KJo (for me, the circle of compilation-wait turns forever)
15:40:18FromDiscord<fwsgonzo> its blank for me
15:40:24FromDiscord<Rika> it compiles for me
15:40:38Oddmongerthat's odd… thank you for trying
15:40:57FromDiscord<Rika> i tested on wsl
15:41:02FromDiscord<CodeHz> Why not use chr instead of char
15:41:16FromDiscord<Rika> might be an issue of playground rn
15:41:55Oddmongerhum, even with chr as suggested
15:42:09Oddmongerindeed , char(i) is not what i want anyway
15:43:01Oddmongerwith inim, it's ok, but «str» is still blank after the loop
15:43:21FromDiscord<CodeHz> Because it is not visible character
15:43:23Oddmongerwell, it has 26 values in it, but obviously not… ah wait
15:43:30Oddmongeri'm dumb , that's official
15:44:35Oddmongerchr('a'.int+i) will do
15:45:01Oddmongerwith 0 starting slice, of course
16:02:22*leorize quit (Read error: Connection reset by peer)
16:03:43FromDiscord<fwsgonzo> how exactly do you interface with C using pointer-length?
16:03:55FromDiscord<fwsgonzo> seems to me that seq[uint8] is not compatible
16:04:00FromDiscord<fwsgonzo> and strings are useless
16:04:08FromDiscord<fwsgonzo> (edit) "and strings are useless ... " added "- Nim calls strlen"
16:04:40FromDiscord<fwsgonzo> in C++ we can use strings just fine, because nobody is calling strlen on it
16:05:44FromDiscord<lqdev> you pass yourSeq[0].unsafeAddr as the pointer and yourSeq.len as the length
16:05:50*zedeus quit (Ping timeout: 256 seconds)
16:06:08FromDiscord<fwsgonzo> and the other way?
16:07:50FromDiscord<exelotl> is there a nice way to fall back to another string if the first string is empty?
16:07:52*zedeus joined #nim
16:08:43*leorize joined #nim
16:09:06FromDiscord<exelotl> like `echo prop.attr("value") or prop.text`
16:17:36FromDiscord<haxscramper> There is `getOrDefault`, https://nim-lang.org/docs/tables.html#getOrDefault%2CTable%5BA%2CB%5D%2CA
16:18:01FromDiscord<haxscramper> Assuming `prop` is some kind of table
16:18:09FromDiscord<Rika> there isnt anything for just strings, otherwise
16:18:18FromDiscord<Rika> you can make an overload prolly
16:18:34FromDiscord<exelotl> it's an XmlNode :(
16:18:44FromDiscord<haxscramper> Xml node uses strtabs
16:18:55FromDiscord<haxscramper> so `getOrDefault` will work
16:19:09FromDiscord<haxscramper> https://nim-lang.org/docs/strtabs.html#getOrDefault%2CStringTableRef%2Cstring%2Cstring this one
16:19:21FromDiscord<fwsgonzo> how do you return a pointer, length pair back to C by returning?
16:19:48FromDiscord<fwsgonzo> usually this would be done by either returning a struct with 2 members (which fit in 2 integer registers - which the C calling convention allows)
16:19:56FromDiscord<fwsgonzo> or you take a pointer to the length as a function parameter
16:21:06FromDiscord<haxscramper> You want to declare nim proc that does this? I would use second approach most likely
16:22:40FromDiscord<haxscramper> Something like that in function signature: `tokens: ptr [ptr [CXToken]]; numTokens: ptr [cuint]`
16:23:15FromDiscord<fwsgonzo> yes - there is technically a third option too, as I can "stop the world" from a C function, so I could take the pointer, length pair as parameters to this special function, and then take it from there. the problem is that I have no idea what I would break in Nim if things just suddenly stop running (only to return by calling some other nim function later)
16:23:39*opal joined #nim
16:23:45FromDiscord<haxscramper> And this corresponds to `CXToken Tokens, unsigned NumTokens`
16:24:03FromDiscord<fwsgonzo> (edit) "later)" => "later)↵although, maybe I could mark it as noreturn"
16:24:10FromDiscord<haxscramper> I would recommend second option anyway
16:24:17FromDiscord<fwsgonzo> ok
16:24:30FromDiscord<haxscramper> You need to make it accessible from C, right?
16:24:34FromDiscord<fwsgonzo> yep
16:25:22FromDiscord<haxscramper> You can also try `tokens: var ptr CXToken, numTokens: var cuint` and see how it maps to generated C code
16:25:36FromDiscord<haxscramper> So you won't have to explicitly deal with pointers on nim side
16:34:25*Gustavo6046 joined #nim
16:39:52*leorize quit (Remote host closed the connection)
16:40:18*leorize joined #nim
16:47:04FromDiscord<fwsgonzo> thanks, I was thinking about this during dinner and now I think it won't work
16:47:34FromDiscord<fwsgonzo> keep in mind that I'm calling into Nim from <let's pretend it's C> and I'm returning back to C with a result that I don't want destroyed
16:47:54FromDiscord<fwsgonzo> i don't know if nim zeroes out the things that fall out of scope, but I can imagine that it will
16:48:28FromDiscord<fwsgonzo> so in my current example I call into Nim and then Nim gzips something, and I want to return the result back to C - how would you do that?
16:48:44*Arrrrrrrr joined #nim
16:49:26leorize[m]this implies that you want C to control the resulting memory?
16:49:58FromDiscord<fwsgonzo> yes, and it will in more ways than one - Nim is inside a VM and returning from that function call stops everything
16:50:15*Vladar quit (Remote host closed the connection)
16:50:45FromDiscord<fwsgonzo> that also means there's no real calling convention other than what I make up - but C is handy as everyone has some support for it
16:50:47*antranigv_ is now known as antranigv
16:51:58FromDiscord<fwsgonzo> I also have control over the heap btw 🙂
16:52:12leorize[m]this is very hard then, as far as semantics go
16:52:14FromDiscord<fwsgonzo> (edit) "I also have control over the heap btw 🙂 ... " added "I can allocate for the guest VM and deallocate any pointer it gives back, if I have to"
16:52:48FromDiscord<haxscramper> IIRC object lifetimes are subject to regular rules - value types go out of scope of course, `ref` types are collected by GC or ARC (with latter one being comparatively similar to value types IIUC), and pointers' lifetimes is entirely in your control
16:53:26FromDiscord<fwsgonzo> one of my gotos is to make a function call immediately vmexit, and probably mark the function as noreturn, but I still need to present the right values in the right registers
16:53:38leorize[m]are you willing to require that C have to use Nim's API for freeing whatever nim returns?
16:54:03FromDiscord<fwsgonzo> I guess so, if its a generalizable?
16:54:04leorize[m]if not then your only chance is to allocate a buffer using malloc and copy the gzip-ed stuff over
16:54:34*Vladar joined #nim
16:55:51*abm quit (Quit: Leaving)
16:56:20leorize[m]that is hard then, since when destructors come into play you have to know the exact type you're dealing with from nim side...
16:57:44leorize[m]if you return `ref T` to C then when C send `ref T` for freeing the nim compiler must know what this `T` is, so not very generalizable...
16:58:11FromDiscord<fwsgonzo> i have an idea, actually: a callback
16:58:35FromDiscord<fwsgonzo> the callback is the return value
16:58:46FromDiscord<fwsgonzo> after the callback ends, I can resume the VM which then destroys the Nim stuff
16:59:52FromDiscord<fwsgonzo> so from Nim I would call something like myreturn(seq.pointer, seq.length) with everything still alive, and once that returns, Nim would just see everything unwind and destruct like normal
17:02:26leorize[m]sounds like CPS to me :P
17:05:52FromDiscord<Gibson> should a new httpclient be made for each request?
17:06:14FromDiscord<Gibson> if I try to reuse one after a delay from when it was first created, it errors with "Connection was closed before full request was made"
17:06:23FromDiscord<Gibson> but calling newHttpClient for each works fine
17:07:24FromDiscord<Rika> i just do that but i dont know if its right either
17:07:35*PMunch quit (Quit: leaving)
17:13:49FromDiscord<dom96> a http client for each async "thread"
17:14:06FromDiscord<dom96> just don't use the same http client while another async proc is using it and you should be fine
17:15:37*Arrrrrrrr quit (Quit: Arrrrrrrr)
17:17:15FromDiscord<Gibson> this is single threaded
17:17:36FromDiscord<Gibson> idk what the problem is, but doing this fixes it https://media.discordapp.net/attachments/371759389889003532/795340095901138944/unknown.png
17:18:39FromDiscord<Gibson> possibly due to keep-alive expiring and it tries to reuse a connection?
17:19:29*WilhelmV1nWeiner quit (Quit: leaving)
17:19:38*WilhelmVonWeiner joined #nim
17:20:17FromDiscord<Gibson> all the requests are to the same server, and this reliably happens when there is a long (several second) delay between requests
17:24:11FromDiscord<dom96> yes, httpclient will attempt to reuse the connection. I guess it fails to detect this case, can you file a bug report?
17:24:20FromDiscord<Gibson> 👍
17:46:20*rominf joined #nim
17:57:25disruptekyou're blowin' my mind right now.
18:00:23disruptekyes.
18:00:31disruptekhttpclient isn't made to make multiple requests.
18:01:21disruptekhttpclient isn't made to make multiple requests.
18:02:25disruptekmake the title as follows:
18:02:26disruptekhttpclient isn't made to make multiple requests.
18:02:32disruptektreeform: so i'm looking at frosty vs. flatty and it's going to be hard to to improve on copyMem.
18:02:34disrupteki'm going to have to take this to the next level somehow.
18:03:46FromDiscord<treeform> Well most objects don't go into copyMem. copyMem is only a big winner when doing arrays of simple objects.
18:05:00disrupteksure, but i'm only using it for copy-like serialization.
18:05:19disruptekie. i/o on strings or whatever.
18:06:01FromDiscord<treeform> So in your tests we have same time because we just spend it all in copyMem?
18:06:33disruptekno, i dunno how my new code work yet because it doesn't compile. 😁
18:15:38FromDiscord<juan_carlos> @haxscramper macro generates a lot of `DeclaredButNotUsed` (?), try `nim check tmatching.nim`
18:20:08FromDiscord<haxscramper> I don't see any - `nim check --hints:off --skipParentCfg --skipUserCfg --skipProjCfg tmatching.nim ` only shows one unused import
18:20:18FromDiscord<haxscramper> Checked on master branch, not even follow-up PR
18:20:27FromDiscord<juan_carlos> hints on
18:20:44FromDiscord<haxscramper> oh
18:20:45FromDiscord<haxscramper> shit
18:20:53FromDiscord<haxscramper> whoever designed this CLI
18:21:40*hnOsmium0001 joined #nim
18:26:46disruptekif you look on the bottom it says, `designed by timmy in california`.
18:29:11FromDiscord<haxscramper> the concept of CLI is garbage in general, tools need to be shipped as libraries
18:29:15FromDiscord<haxscramper> With something like cligen on top
18:29:25planetis[m]except my ecs game where everything is copymem'ed
18:29:45FromDiscord<haxscramper> And everyone should write own wrappers for everything
18:29:53disruptekscramper: i agree; everything should be a library.
18:30:15FromDiscord<haxscramper> The idea is even worse that what we have now, but at least I wont' have to search for correct `skipCfg`
18:30:27planetis[m]disruptek: i don't know if you noticed but, streams.writeData uses copymem internally, so changing your lib would be trivial really
18:30:38FromDiscord<haxscramper> worse in terms of time spent overall
18:31:19disruptekplanetis[m]: yeah, that's why i don't care about changing it. 😉
18:31:36disruptekonly the public api matters to me, and it's only getting two changes:
18:31:45disruptekarg reorder and typedesc support for chaining.
18:32:07planetis[m]also what is 20% of 10ms?
18:33:00*rominf quit (Ping timeout: 245 seconds)
18:33:14disruptekso very many things...
18:33:35disruptekmy old t1 latency, 😢
18:33:53disrupteki would kill for a t right now.
18:34:13disruptekdon't wave that shit in front of my face or you just might lose a limb.
18:34:56saemIf my wifi could extend that far I would share.
18:35:26FromDiscord<Daniel> just boost it to 200mW, its probably limited to 50mW
18:35:44saemAnyone using ndi (Nim debug info) files for anything?
18:35:45FromDiscord<Daniel> (edit) "just boost it to 200mW, ... its" added "now"
18:37:25saemDaniel of likely have to do that, setup a directional, then setup a chain of them that's likely not only to raise the ire of two radio regulators but also run afoul of border regulations.
18:37:54saemI mean, nbd
18:38:13disruptekfcc is toothless when it comes to radio.
18:39:34planetis[m]disruptek: lol i was just making a point against "streams are bad"
18:39:48disruptekstreams are good.
18:41:17saemJust ask twitch
18:41:50disruptekyou can get a tech license in the US for radio; easier than an ops license and it will let you build a high-speed wan locally.
18:41:56FromDiscord<Filipe Duarte> Is anybody here from Brazil?
18:42:14disruptekbut, no point where there is no decent peering avail.
18:43:17*PrvDragon joined #nim
18:44:07planetis[m]also that same unrealistic benchmark (which creates 100 level deep trees or something), measures the copy from string to stringstream (which can be fixed with a patch to stdlib) but whatever its "fast."
18:44:44disruptekright.
18:45:09disrupteki usually benchmark serializing my graphs instead; they represent real workload.
18:52:50planetis[m]Just venting off this whole discussion about who has the fastest lib really killed the fun for me, I find it more like negative competition than constructive talk.
18:53:03planetis[m]Can't find a channel without that bs going on
18:53:06*planetis[m] left #nim ("User left")
18:53:16disruptekit has been constructive.
18:53:31disruptekflatty got better and i fixed frosty's api.
18:53:55disruptekfrosty wasn't an academic exercise.
18:54:16disruptekit was built to replace the sqlite serializer araq wrote for ic.
19:00:13*fputs quit (Ping timeout: 264 seconds)
19:03:36FromDiscord<haxscramper> fixed now
19:04:22FromDiscord<haxscramper> not absolutely everything, but `ok` and `wasSet` ones should not show up anymore
19:04:42FromDiscord<juan_carlos> Cool :D
19:09:04FromDiscord<Recruit_main707> shouldnt we add some higher level functions to endians?
19:09:23FromDiscord<Clyybber> @haxscramper Whats the problem with the CLI you had?
19:09:25disrupteksee endians2.
19:11:50FromDiscord<haxscramper> If you disregard general whining about everything - it usually takes me several tries to figure out all `--skipCfg` I need, and things like `--hints:off`
19:12:17FromDiscord<haxscramper> But it is not the problem to be honest
19:13:10FromDiscord<haxscramper> Because skipping project cfg does not actually skip `config.nims`, but `skipCfg` makes tests uncompilable
19:13:28FromDiscord<haxscramper> Because path is set using `.nims` switch
19:13:59disruptekc'mon, you love it.
19:14:05disruptekjust embrace the madness.
19:14:59FromDiscord<haxscramper> I wanted to write my own CLI generator
19:15:21FromDiscord<Clyybber> so its a bug?
19:15:25FromDiscord<haxscramper> no
19:15:36FromDiscord<haxscramper> Well, `skipCfg` skips all configuration
19:16:19FromDiscord<haxscramper> So it works the way it should, but considerint there is four different switches and for some reason warnings are controlled using `hints:off`
19:17:04FromDiscord<haxscramper> But again, "XDeclaredButNotUsed" but not be a warning technically, but it certainly is in my understanding, so it causes another confusion
19:17:23FromDiscord<haxscramper> And `--warning[XDeclaredButNotUsed]:off` being the thing doesn't help too
19:17:43FromDiscord<haxscramper> (edit) "is" => "are"
19:22:07FromDiscord<juan_carlos> @haxscramper https://github.com/nim-lang/fusion/runs/1640307695#step:8:245
19:23:00FromDiscord<juan_carlos> I think that test chunk is too big.
19:29:23FromDiscord<haxscramper> Cant' reproduce it locally with 1.0.0
19:29:35*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
19:29:37FromDiscord<haxscramper> Nor with 1.0.10
19:30:15FromDiscord<haxscramper> And run you linked was two hours ago, are sure it is still relevant?
19:31:51*NimBot joined #nim
19:34:05*pbb joined #nim
19:38:12FromDiscord<no name fits> I might be stupid, but is there some suggested plug-ins for VSCode somewhere?↵if not, which ones are you guys using for Nim dev in VSCode?
19:48:29FromDiscord<no name fits> Also I don't quite get the difference between ``if`` and ``when``. I looked at the docs and it says it's the same except the root is ``nnkWhenStmt`` and I tried to look that up but I couldn't
19:50:29FromDiscord<haxscramper> `if` is for runtime checking `when` is for compile-time
19:50:42FromDiscord<haxscramper> `when` is closer to `#ifdef` basically
19:51:10FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement
19:51:38FromDiscord<no name fits> Ooooh I see. Thanks so much
19:51:53FromDiscord<haxscramper> You probably looked in `std/macros` which does indeed say about `nnkWhen`
19:51:58FromDiscord<no name fits> Right
19:52:16FromDiscord<haxscramper> ~tutorial
19:52:16disbottutorial: 11intro to sacred manuscripts: https://nim-lang.org/docs/tut1.html
19:52:57FromDiscord<no name fits> Oh I see! I was using the index page
19:53:13FromDiscord<no name fits> <https://nim-lang.org/docs/theindex.html>
19:53:53FromDiscord<haxscramper> ~learn
19:53:53disbotno footnotes for `learn`. 🙁
19:53:57FromDiscord<Enimatek> is there some more deep information / article about the diff between proc, func and methode? i've been using proc all the time, but sometimes i see a method or func passing by, but it seems to do the same thing though, and the articles desribing the difference are also saying its (practically) the same, would really like to know the situations one or the other would make a difference
19:54:02FromDiscord<haxscramper> ~learn is https://nim-lang.org/learn.html
19:54:02disbotlearn: 11https://nim-lang.org/learn.html
19:54:21FromDiscord<haxscramper> ~learn is contains links to lots of interesting articles and tutorials to get started with nim
19:54:21disbotlearn: 11contains links to lots of interesting articles and tutorials to get started with nim
19:55:00FromDiscord<haxscramper> `func` has no side effects (can read/write files, access global vars etc), `proc` is just regular procedure
19:55:12FromDiscord<haxscramper> `method` is for dynamic dispatch for OOP
19:55:48FromDiscord<no name fits> As I understand it, ``func`` makes it easier to do functional programming
19:55:51FromDiscord<haxscramper> So yes, they are largely the same except for dispatching - `method` uses runtime, `proc`/`func` static
19:56:25FromDiscord<haxscramper> No, not really, it just checks that you have no side effects, Useful bonus, but nothing over regular `proc`
19:56:42FromDiscord<haxscramper> Actually `func` is just sytnax sugar for `proc {.noSideEffect.}`
19:56:49FromDiscord<no name fits> Oh I see
19:58:08FromDiscord<Enimatek> hm, so i do a lot of 'OO' in my code, or at least i always start with a type ref object and start making 'procs' for it, would methods be a better option in that case? though with procs i never had any issues till now
19:59:47FromDiscord<haxscramper> 1 `method` is necessary for implementation overriding for derived classes↵2 if you have `ref` object it is not an OOP actually, just means you allocate objecs on heap. To actually do OOP (be able to derive) you need to do `ref object of RootObj` or `ref object of SomeOtherParentObj`
20:00:11FromDiscord<haxscramper> So in your code you won't benefit from methods at all, since you don't seem to use runtime dispatch for anything
20:01:46*al1ranger joined #nim
20:02:07*al1ranger quit (Client Quit)
20:02:32FromDiscord<Enimatek> ok, thanks for the info, i will dive into these subjects, since most things you just mentioned are alien to me i guess, maybe because i never thought about the heap in the first place before using nim 🙂
20:03:03FromDiscord<haxscramper> http://zevv.nl/nim-memory/#_two_ways_to_organize_memory
20:03:37FromDiscord<Enimatek> its probably also the reason why i dont 'get' the difference between proc/method etc.
20:05:48FromDiscord<no name fits> Thanks for being helpful btw ❤️
20:06:47FromDiscord<Privacy_Dragon> How do I get the IUP stuff on my laptop?
20:09:17FromDiscord<juan_carlos> @haxscramper https://github.com/nim-lang/fusion/pull/64/checks?check_run_id=1640605058#step:8:67
20:09:17disbotCI JS WIP
20:09:33disruptekscramper: footnotes aren't cumulative.
20:09:40disruptek~learn is https://nim-lang.org/learn.html
20:09:40disbotlearn: 11contains links to lots of interesting articles and tutorials to get started with nim
20:09:41disbotlearn: 11https://nim-lang.org/learn.html
20:12:19FromDiscord<haxscramper> I cant reproduce this only on 1.4.0 but not on 1.4.2
20:13:29FromDiscord<haxscramper> So it seems like the bug is not on my side, and it was old enough to be backported to even 1.0.10
20:18:02FromDiscord<juan_carlos> I believe u 👍
20:19:02FromDiscord<haxscramper> IIRC fusion must be backwards compabile with all LTS versions
20:19:06FromDiscord<haxscramper> Is that correct?
20:19:15FromDiscord<haxscramper> E.g. 1.0.10, 1.2.6 and 1.4.2
20:19:25FromDiscord<Privacy_Dragon> please can anyone tell me how to get libiup.so? or where does Nim search for it?
20:19:41FromDiscord<haxscramper> Have you installed it with your package manager?
20:19:47FromDiscord<Privacy_Dragon> no
20:19:53disrupteki wouldn't worry too much about fusion; i expect it to be reworked soon.
20:19:54FromDiscord<Privacy_Dragon> I don't have root access
20:20:27FromDiscord<haxscramper> disruptek: well, I dont care about fusion in particular, just matching.nim
20:21:02disruptekwhat i mean is, i wouldn't worry too much about supporting early versions.
20:21:10FromDiscord<haxscramper> I personally
20:21:27FromDiscord<juan_carlos> @haxscramper I had to add that because says unused, can u check on your branch https://github.com/nim-lang/fusion/blob/5c7d630bc33d9468ed971d0ea9025901de25d1fc/src/fusion/matching.nim#L2157
20:22:01FromDiscord<haxscramper> oh, I didnt' know about `.used.`
20:22:27FromDiscord<juan_carlos> :)
20:22:32FromDiscord<haxscramper> Yes, it has some very annoying conditions to determine if it is used or not, so I left it as-as, will fix now
20:24:26FromDiscord<juan_carlos> You can even make the macro add .used if it must.
20:28:03FromDiscord<haxscramper> no, I'd rather reduce codegen when possible, but in case of `pos` and several others there is no other option
20:29:53FromDiscord<Privacy_Dragon> !@#$%^& I have much problems with nimble...
20:29:59disruptekweird.
20:31:28FromDiscord<Privacy_Dragon> Error: Unable to find `nim` binary - add to $PATH or use `--nim`
20:33:45FromDiscord<Privacy_Dragon> oh, now got it working
20:33:52FromDiscord<Privacy_Dragon> but still don't get iup working
20:34:06FromDiscord<haxscramper> Pushed now - no warnings (though I turned `ConvFromXtoItselfNotNeeded` off because right now I can't come with proper non-synthetic example that doesn't trigger this warning)
20:34:25FromDiscord<juan_carlos> Makes sense.
20:34:32FromDiscord<haxscramper> Since it would require building at leas three levels of OOP inheritance
20:35:17*Gustavo6046 quit (Quit: ZNC 1.7.5 - https://znc.in)
20:36:10Zevvmratsim: how's life @64k
20:36:12*Gustavo6046 joined #nim
20:41:27FromDiscord<j-james> Are the official Nim logos okay to use on websites that are about Nim, but not officially afflicted?
20:41:36disruptekyes.
20:41:53*abm joined #nim
20:47:40FromDiscord<Avatarfighter> :disruptek:
20:48:15*PrvDragon quit (Quit: Konversation terminated!)
20:48:31FromDiscord<dom96> :nimble:
20:48:45Zevv:huh:
20:48:53disruptek:goatlicking:
20:49:44disruptekleorize: seems like maybe github's macos actions fail correctly now?
20:50:47*lritter joined #nim
21:18:10*Gustavo6046 quit (Quit: ZNC 1.7.5 - https://znc.in)
21:18:34*Gustavo6046 joined #nim
21:23:16*Vladar quit (Quit: Leaving)
21:27:38*narimiran quit (Ping timeout: 264 seconds)
21:28:45*xet7 quit (Quit: Leaving)
21:37:48*lritter quit (Quit: Leaving)
21:38:18*lritter joined #nim
21:40:45FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2KLK
21:40:53FromDiscord<fwsgonzo> but: ffi.nim(36, 23) Error: expression has no address; maybe use 'unsafeAddr'
21:41:46FromDiscord<exelotl> yes, because resp is a `let` var, it's considered immutable so you can't use `addr` with it
21:43:11FromDiscord<exelotl> if you're planning to mutate it via the pointer, you should change it to var, otherwise you can use resp[0].unsafeAddr
21:45:19FromDiscord<fwsgonzo> ok thanks 🙂
21:56:02FromDiscord<fwsgonzo> works fine, its just zippy erroring out with something
21:57:22*PMunch joined #nim
22:10:07*lritter quit (Quit: Leaving)
22:11:01FromDiscord<fwsgonzo> does Nim call something eq to abort_message when it throws?
22:11:17FromDiscord<fwsgonzo> fprintf(stderr into exit 1?
23:16:03*tane quit (Remote host closed the connection)
23:26:45FromDiscord<fwsgonzo> well i found the problem
23:26:59FromDiscord<fwsgonzo> apparently exceptions require a 262kb allocation
23:27:05FromDiscord<fwsgonzo> in my 64kb env 🙂
23:27:18PMunchAre you also doing embedded stuff?
23:27:42FromDiscord<fwsgonzo> HTTP caches handle 20k clients concurrently
23:28:29FromDiscord<fwsgonzo> 64kb is 1.25 GB of workspace
23:29:59FromDiscord<fwsgonzo> its not a matter of having the memory either, its a matter of not trashing the caches for every single instruction
23:33:04FromDiscord<fwsgonzo> and while i dont expect regular code to throw, its important to be able to catch it so that we can see what went wrong
23:33:25FromDiscord<fwsgonzo> is it a worst-case type of single allocation?
23:35:40disruptekthat sounds nuts.
23:35:52disruptekwhich gc are you using?
23:36:01FromDiscord<fwsgonzo> ORC
23:36:16disruptekwhy not arc?
23:36:18FromDiscord<fwsgonzo> it might be zippy that does the allocation, I'm still trying to figure things out
23:38:43disruptekclyybber: do we care about arc being bug-free on clang?
23:39:26disrupteki just learned that skiplists fails on osx in 1.4 and 1.5.
23:39:43FromDiscord<fwsgonzo> https://github.com/guzba/zippy/issues/3↵that's what I get for not checking the issues
23:39:47disbot[bug] Compression failing when building on a 32-bit machine ; snippet at 12https://play.nim-lang.org/#ix=2KMb
23:40:03FromDiscord<fwsgonzo> ill change to 64-bit VMs 🙂
23:45:33Zoom[m]Hey, PMunch, do you run Nim on 8266? I almost started to dig into elcritch/nesper but then I found out the board I have is ESP8266, not ESP32 :P
23:45:46PMunchIndeed
23:45:52PMunchOr at least that's what I'm trying to do
23:46:03PMunchI have managed to get it working now, but exceptions are still missing
23:46:33PMunchBut it might be that the ESP8266 Arduino libraries simply doesn't support them
23:46:56Zoom[m]There's a bunch of various SDKs and some half-finished wrappers for Nim. What do you use?
23:47:08PMunchJust custom stuff
23:47:17PMunchThe idea is to standardise it
23:47:23PMunchBut it's tricky
23:48:01PMunchThis is what I have so far: http://ix.io/2KMc
23:50:12PMunchOh woops
23:50:15PMunchSlight error in that
23:51:13Zoom[m]That's nice. I wouldn't know where to start
23:51:17PMunchThere: http://ix.io/2KMh
23:51:48PMunchespmake is from makeEspArduino
23:53:59Zoom[m]Did you see some espressif repos where they mention they plan to converge on more or less unified SDK for EPS32 and 8266?
23:58:24PMunchHaven't seen that, but then I haven't been looking for that either