<< 28-05-2023 >>

00:07:07*disso-peach joined #nim
00:16:08*lucasta quit (Remote host closed the connection)
00:58:21FromDiscord<gogolxdong> Does Nim http module support streaming output?
01:00:56FromDiscord<Graveflo> are you talking about httpclient and access to the socket as a stream?
01:04:07FromDiscord<gogolxdong> yes
01:05:32FromDiscord<Elegantbeef> `response` has a `bodyStream`
01:08:43FromDiscord<Graveflo> I'm not sure about sending a file, but I had to do something like this recently. The httpclient public interface is not very capable of covering more then basic situations but the modules code is written well and not difficult to understand. I was able to get it to do what I wanted by using `privateAccess(HttpClient)` and `import std/httpclient {. all .}`. If you cant get the public interface to do what you want consider calling the inte
01:12:00FromDiscord<Elegantbeef> Oh for uploading
01:12:51FromDiscord<Elegantbeef> `add` has an overload that has `useStream`
01:12:56FromDiscord<Graveflo> bodyStream was an issue for downloading too, in my case, because I needed to go through a www-authenticate (401) redirect sometimes
01:13:23FromDiscord<gogolxdong> like reading from stream word by word of openai chat api response
01:14:30FromDiscord<Graveflo> I'm just checking, but can you just use `response.body()` and then parse the string? or is something more complex going on?
01:16:39FromDiscord<gogolxdong> API responds word by word in stream and body returns all of them at one time.
01:17:10FromDiscord<Graveflo> oh so you want to update on the fly so the user isnt waiting on seemingly nothing for too long
01:17:21FromDiscord<gogolxdong> yes
01:18:33FromDiscord<Graveflo> ok bodyStream may not be what you want since IIRC it just wraps the fully recved text into a stringStream and thus will block until the end anyway. Lemme see
01:18:47FromDiscord<Elegantbeef> `asynchttpclient` 😄
01:19:58FromDiscord<Elegantbeef> Actually same problem just doesnt block at the callsite
01:20:14FromDiscord<Graveflo> oh I ignored that code bc im not using async. Does it feed the bodyStream as pieces come in before the full content-len of bytes is recv?
01:20:41FromDiscord<Elegantbeef> I do not know, but it returns a `Future[string]` so doesnt seem it chuns
01:20:47FromDiscord<Elegantbeef> chunks\
01:20:55FromDiscord<Elegantbeef> I do not do web stuff
01:21:11FromDiscord<Elegantbeef> Yea it calls `readAll` so it is not what they want
01:21:54FromDiscord<Elegantbeef> you'd need to get the `bodyStream` of the response and use async to read it
01:22:08FromDiscord<Elegantbeef> `bodyStream` of both are exposed
01:25:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wRM
01:25:20FromDiscord<Elegantbeef> Reading the first 10 lines from hackernews
01:26:52FromDiscord<Graveflo> You very well may be right, I'm still reading the code again, but the real test would be if the body is sent from the source in intervals. Does the bodyStream start feeding when data is available or only after the full body has been received? Also @gogolxdong are you using async or non-async or is either fine?
01:27:23FromDiscord<Elegantbeef> Nah it doesnt make any sense to download then stream the data
01:27:36FromDiscord<Graveflo> I'm pretty sure that
01:27:48FromDiscord<Graveflo> mb enter by mistake... im pretty sure thats how the non-async does it
01:27:58FromDiscord<Elegantbeef> Got a large file? 😄
01:31:42FromDiscord<Elegantbeef> Preliminary testing shows you might be right
01:32:18FromDiscord<Graveflo> thats actually a decent place to start looking. bc if you look at `downloadFile` for non-async it just swaps the stream on the client object and sets the private `getBody` flag to change how `parseBody` will work a little bit
01:32:30FromDiscord<Elegantbeef> Takes 6 seconds to start reading a 100mb file
01:32:40FromDiscord<Elegantbeef> So yea it certainly does not do what we want
01:33:27FromDiscord<Graveflo> that could be changed with buffer sizes maybe? If it is doing that then it is performing better then the non-async version would.
01:36:44FromDiscord<Elegantbeef> No clue
01:37:37FromDiscord<Graveflo> yea I think the way to get fine-grained control from this would be to look at `downloadFileEx` and `downloadFile` prob going to have to use your own stream. I dont mess with the async stuff, so itll take me a while to figure that out. If I were doing it without async I would get `getBody` to false make the request and then access the stream directly just as `parseBody` does
01:37:40FromDiscord<Graveflo> but thats just me
01:40:08FromDiscord<Graveflo> @gogolxdong is there an example url / query that I could use to test it out. So I can get that delayed behavior that you are trying to work around over the socket?
01:42:39FromDiscord<gogolxdong> https://media.discordapp.net/attachments/371759389889003532/1112194186930827294/gpt4.py
01:43:05FromDiscord<gogolxdong> this is how python sdk works
01:43:54FromDiscord<gogolxdong> (edit) "this is how python sdk works ... " added "when stream=True"
01:47:46FromDiscord<gogolxdong> no luck to have httpclient work so far
01:50:36FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4wRS
01:50:56FromDiscord<gogolxdong> (edit) "https://play.nim-lang.org/#ix=4wRS" => "https://play.nim-lang.org/#ix=4wRT"
01:52:13FromDiscord<Graveflo> alright I had to touch grass for a second. I'll see if I can get something to work
02:15:40FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wRX
02:29:18FromDiscord<Graveflo> yea I'm having an issue where the socket is blocking bc it seems unable to fill the requested size to recv... but there is no content length and typically socket apis will just return with less in this case. The code in httpclient seems to be made with this expectation as well so I'm not sure why its hanging
02:47:05FromDiscord<Graveflo> I'm having a difficult time finding an example url that doesnt use chunked encoding. Do you know if the url you want to use is chunked?
02:56:11FromDiscord<gogolxdong> https://api.openai.com/v1/chat/completions
03:08:01FromDiscord<Rika> accidental paste?
03:12:48FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wS3
03:18:45FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4wS4
03:19:13FromDiscord<gogolxdong> you can try this
03:22:00FromDiscord<Graveflo> yea I dont have an api key. but `response.body()` gets the error message fine. Is there an issue with `response.body()` for you?
03:32:04FromDiscord<gogolxdong> no?
03:33:43FromDiscord<gogolxdong> just have no idea how to show response word by word even with bodyStream
03:34:23FromDiscord<gogolxdong> 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
03:34:28FromDiscord<gogolxdong> try this api-key
03:34:45FromDiscord<gogolxdong> It will be removed after testing
03:35:06FromDiscord<Graveflo> k i try 1 sec
03:37:29FromDiscord<Graveflo> ok I tried it out. Unfortunately, this uses chunked encoding (should have seen that one coming) so what I did will not work without annoying modifications. However there is a decent chance that what beef said will work just fine (go figure). switch to async. reading from the bodyStream concurrently may make data available at the time each chunk arrives
03:40:20FromDiscord<Elegantbeef> Some say I might know things, I still doubt it myself
03:41:56FromDiscord<Graveflo> I'll take a quick look at the code and see if I can tell whether async version will work. If it doesn't the only way I know how to do what you want is to try and re-use the httpclient's `parseChunks` proc, but if that doesn't play well then the only option would be to use the code that I posted and re-implement chunked encoding parsing. Not the end of the world but thats the best I can come up with
03:44:22*arkurious quit (Quit: Leaving)
03:51:33FromDiscord<Graveflo> so `recvFull` only reads up to a certain size and then it dumps the data into the output buffer. That is good news. I think this means that the non-async code will block until `parseChunks` is done but the async version will populate the output stream in chunks without blocking. You should be able to get each chunk as they come in by polling response.bodyStream concurrent to the `request`
03:55:38FromDiscord<Phil Wang> hey all, really enjoying learning Nim so far. was wondering what the community would recommend for building a medium sized website with the least amount of pain these days. I notice that jester is being used for the nim forums, but that prologue seems to be more actively maintained
04:18:11FromDiscord<that_dude> https://github.com/ringabout/awesome-nim#frameworks If you want a good list too look at check out this site. Unfortunately I don't know anything about them
04:19:47FromDiscord<gogolxdong> @Graveflo by polling response.bodyStream concurrent to the request what does this mean
04:19:59FromDiscord<gogolxdong> (edit) "by" => "`by" | "request" => "request`"
04:23:13FromDiscord<lucidrains> yup, gone through that list already and narrowed it down to prologue or jester, and keeping an eye on happyx↵(@that_dude)
04:23:31FromDiscord<Graveflo> I mean that the Future object that is returned by `request` will be ready about at the same time the body start being read. At this time the request's bodyStream will be set up and over the time that it has data being put in it from the async code that is reading the body you can try and read from the stream until it "completes". I'm trying to get basic async examples to compile and they are failing me. I'll keep trying
04:24:12FromDiscord<that_dude> Have you checked out the webdev channel?
04:24:36FromDiscord<lucidrains> oh no I haven't!
04:27:10FromDiscord<Elegantbeef> I do have to say sadly the matrix bridge does not propagate reactions
04:27:34FromDiscord<Elegantbeef> Those discord peasants cannot see your reactions and vice versa for us
04:27:36FromDiscord<lucidrains> Is it a webdev channel specific for Nim?↵(@that_dude)
04:27:44FromDiscord<Elegantbeef> There is one
04:27:46FromDiscord<Elegantbeef> It's in the Nim space
04:28:11FromDiscord<Elegantbeef> [#nim\:envs.net](https://matrix.to/#/#nim:envs.net) for the space
04:33:08FromDiscord<lucidrains> Oh darn, ok I'll stop using them
04:33:09FromDiscord<Elegantbeef> No continue, discourage them for using discord!
04:33:11FromDiscord<lucidrains> Thanks!
04:34:09FromDiscord<that_dude> You get to miss out on Super reactions!
04:38:18FromDiscord<that_dude> Does matrix show history/searching like discord does?
04:38:29FromDiscord<that_dude> show history or have searching
04:38:57FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wSg
04:44:21FromDiscord<Rika> In reply to @Elegantbeef "No continue, discourage them": jokes on you we dont care
04:44:21FromDiscord<Rika> lol
04:49:28FromDiscord<Elegantbeef> Oh shucks I didnt think of that part
05:30:32FromDiscord<HitBlast> sent a code paste, see https://play.nim-lang.org/#ix=4wTq
05:30:54FromDiscord<HitBlast> (edit) "https://play.nim-lang.org/#ix=4wTq" => "https://play.nim-lang.org/#ix=4wTr"
05:31:21FromDiscord<HitBlast> (edit) "https://play.nim-lang.org/#ix=4wTr" => "https://play.nim-lang.org/#ix=4wTs"
05:32:38FromDiscord<Elegantbeef> `import std/sugar` use `collect`
05:36:42FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4wTt
05:37:24FromDiscord<gogolxdong> @Graveflo thanks for your help!
05:38:40FromDiscord<HitBlast> sent a code paste, see https://paste.rs/S7HU3
05:38:48FromDiscord<Elegantbeef> Did you test it?
05:39:00FromDiscord<HitBlast> Haven't yet, testing.
05:39:11FromDiscord<Elegantbeef> Don't ask if something works when you can just test it!
05:41:26FromDiscord<HitBlast> In reply to @Elegantbeef "Don't ask if something": It works, but is there a way to remove this repetition of code? I don't know if this is an optimal solution. https://media.discordapp.net/attachments/371759389889003532/1112254284545917039/Screenshot_2023-05-28_at_11.40.27_AM.png
06:15:02*Notxor joined #nim
06:28:28FromDiscord<Quantum> Are these two absolutely identical, or am I seeing things? 😁 ↵https://nim-lang.org/docs/random.html#initRand%2Cint64↵https://nim-lang.org/docs/random.html#initRand%2Cint64_2
06:30:26FromDiscord<Rika> Looks like a bug in the doc gen
06:33:59*rockcavera quit (Remote host closed the connection)
06:43:49*ntat joined #nim
07:56:11*junaid_ joined #nim
08:14:18FromDiscord<sigmasd> Is something troubling you ?
08:14:19FromDiscord<sigmasd> We were discussing you -- not me.
08:14:19FromDiscord<sigmasd> You're not really talking about me -- are you ?
08:14:19FromDiscord<sigmasd> Is it because you are not really talking about I that you came to me ?
08:14:19FromDiscord<sigmasd> Does it please you to believe I am not really talking about you ?
08:14:49FromDiscord<that_dude> ?
08:15:12FromDiscord<that_dude> bridge lag or bot?
08:16:43FromDiscord<Elegantbeef> There are no other messages here
08:20:00FromDiscord<leorize> tree-sitter-nim showcase\:
08:20:05FromDiscord<leorize> image.png https://media.discordapp.net/attachments/371759389889003532/1112294207542013953/image.png
08:20:33FromDiscord<leorize> you can't get highlighting like this with nimsuggest 😄
08:23:17FromDiscord<Elegantbeef> Semantic highlignting?
08:24:46FromDiscord<Elegantbeef> I'm a bit of a numpty cause I do not really see anything special in your highliting
08:25:19FromDiscord<HitBlast> sent a code paste, see https://play.nim-lang.org/#ix=4wTW
08:25:42FromDiscord<Elegantbeef> `validUtf8`
08:25:45FromDiscord<leorize> yea
08:26:02FromDiscord<leorize> context-aware, too
08:26:43FromDiscord<Elegantbeef> So `isCpsCall` is a field?
08:27:05FromDiscord<leorize> nope, but that's all you can infer from the syntax
08:27:23FromDiscord<Elegantbeef> I see
08:27:28FromDiscord<leorize> for even more bonkers I'd have to write the definition queries to let it support a pseudo-lsp experience
08:27:48FromDiscord<Elegantbeef> I'm a bit silly since I'm mostly fine with Kate's syntax highlighting for Nim
08:28:12FromDiscord<HitBlast> sent a code paste, see https://play.nim-lang.org/#ix=4wTY
08:29:15FromDiscord<Elegantbeef> Sure why not
08:29:31FromDiscord<HitBlast> (edit) "https://play.nim-lang.org/#ix=4wTY" => "https://play.nim-lang.org/#ix=4wTZ"
08:29:38FromDiscord<Elegantbeef> Anywho leo, good job 😄
08:29:48FromDiscord<Elegantbeef> I know people like tree sitter grammars not that I use them
08:30:22FromDiscord<Elegantbeef> It's near the end of the month if you want a TMWN post 😛
08:32:14FromDiscord<leorize> i'd say the killer feature is incremental selection\: https://asciinema.org/a/qO4GzAwYhm7tgLj1TbOdyfXw0
08:32:33FromDiscord<leorize> still have some rough edges but works pretty well
08:33:01FromDiscord<Elegantbeef> Maybe one day I'll try to use nvim as my editor
08:33:11FromDiscord<Elegantbeef> that was a nice notification atleast, no clue what provided that 😄
08:33:30FromDiscord<leorize> that's noice.nvim
08:33:54FromDiscord<leorize> the fun thing about tree-sitter is that it works with any editor that supports it
08:34:11FromDiscord<Elegantbeef> Yea but I generally do want to try nvim again
08:34:13FromDiscord<leorize> and that includes helix, atom, vscode(? not sure but I read about it somewhere)
08:34:17FromDiscord<Elegantbeef> Just need to set it up how i want
08:34:30FromDiscord<leorize> I used a base config this time around
08:34:45FromDiscord<Elegantbeef> Like I generally have a file explorer, then a docked terminal at the bottom
08:34:49FromDiscord<Elegantbeef> Basically like vscode/kate
08:35:04FromDiscord<Elegantbeef> Like a heathen
08:35:05FromDiscord<leorize> my config have that too, I just summon them as needed
08:35:07FromDiscord<Elegantbeef> Tmux i guess does the docked terminal
08:35:35FromDiscord<leorize> although I'd say that fuzzy file search rendered file explorer obsolete
08:35:57FromDiscord<Elegantbeef> The command palette i assume
08:36:28FromDiscord<leorize> nvim is pretty much an ide but not configured by default at this point
08:36:52FromDiscord<Elegantbeef> Oh trust me I know, I've tinkered with it, but never got it comfortable enough for me
08:39:11FromDiscord<leorize> premade configs are getting pretty good at getting out of the way
08:39:15FromDiscord<leorize> in case you want to try again
08:39:35FromDiscord<leorize> and ofc using lua instead of vimscript made life much easier
08:59:04FromDiscord<sOkam!> In reply to @Elegantbeef "Just need to set": try astro or lunarvim. they are both really good
08:59:46FromDiscord<sOkam!> i wanted my own custom config, because im a customization obsessed person... and i didn't even need to bother. those two just do it great, minus some tweaks for my own workflow
09:09:02FromDiscord<leorize> kickstart.nvim for super minimal, lazyvim for in-between, and astro/lunar for full distro
09:23:03*Notxor quit (Remote host closed the connection)
09:36:51*ntat quit (Quit: Leaving)
09:50:27FromDiscord<chmod222> If I have a `ptr T` to some `T` that has a `=destruct` and I want to manually invoke that destructor at the appropriate time, is calling `=destroy(myT[])` the way to go or are there any predefined functions just like `create` is a predefined wrapper over `alloc(sizeOf T)`=
09:51:57FromDiscord<chmod222> I know that `=destroy(myT[])` followed by `dealloc(myT)` properly destroys and frees my object, I'd just like to know if there's maybe an already provided function that does both of these so I wouldn't need to implement it myself
10:07:34FromDiscord<demotomohiro> That sounds like you are going to implment a smart pointer.
10:07:54FromDiscord<chmod222> Not really, I already have a smartpointer somewhere else that properly does this
10:08:17FromDiscord<chmod222> I just need to shove an object that has a destructor as a pointer over an FFI boundary and destroy it on the other side
10:09:10FromDiscord<chmod222> But the one I already have doesn't use nims memory manager so I wouldn't expect there to be a helper function for that
10:17:02FromDiscord<Rika> I switched from neovim to VSCode because I wanted a richer UI than what terminal UIs gave
11:15:41madpropsusing vim mode in vscode?
11:39:02FromDiscord<michaelb.eth> In reply to @Rika "I switched from neovim": any thoughts on how terminal UIs could improve?
11:40:05FromDiscord<Rika> In reply to @michaelb.eth "any thoughts on how": They are already good for most but I want “real”, at least that is what I am chasing
11:40:29FromDiscord<Rika> The character block granularity limitation makes it look dated for me
11:40:59FromDiscord<Rika> Especially for pop ups
11:43:33FromDiscord<伊弉冉の恵み> https://rosettacode.org/wiki/Factorial
11:44:06FromDiscord<Rika> ?
11:44:11FromDiscord<伊弉冉の恵み> the nim one is wrong
11:44:13FromDiscord<Rika> In reply to @madprops "using vim mode in": Yes
11:44:41FromDiscord<Rika> Can’t move away from Vim style editing (not generally modal, specifically Vim)
11:44:53FromDiscord<伊弉冉の恵み> In reply to @伊弉冉の恵み "the nim one is": the recursive one
11:44:59FromDiscord<伊弉冉の恵み> i cant edit my ip range is banned for some reason
11:46:47FromDiscord<Rika> Missing the : int no?
11:46:50FromDiscord<伊弉冉の恵み> yeah
11:46:53FromDiscord<伊弉冉の恵み> on x
11:47:08FromDiscord<伊弉冉の恵み> sent a long message, see http://ix.io/4wUr
11:47:26FromDiscord<伊弉冉の恵み> you can ommit the echo part that was me testing it
11:49:23FromDiscord<Rika> I can’t edit either, don’t know why
11:49:36FromDiscord<Rika> In reply to @伊弉冉の恵み "i cant edit my": If you’re using a VPN
12:23:28FromDiscord<ieltan> In reply to @michaelb.eth "any thoughts on how": People need to make things with `notcurses`
12:24:15FromDiscord<sigmasd> Where can I find the code that nim uses for matrix bridging
12:25:45FromDiscord<伊弉冉の恵み> In reply to @Rika "If you’re using a": ah true
12:25:47FromDiscord<伊弉冉の恵み> i forgot
12:31:43FromDiscord<voidwalker> what's the shortest way to find the index of the first digit char in a string ?
12:32:46FromDiscord<Andreas> In reply to @voidwalker "what's the shortest way": char is known or any digit 0..9 ?
12:32:53FromDiscord<voidwalker> 0..9
12:37:46FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4wUw
12:39:19FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wUx
12:39:25FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4wUx" => "https://play.nim-lang.org/#ix=4wUy"
12:42:48FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4wUB
12:42:50FromDiscord<voidwalker> std/strutils
13:19:02FromDiscord<sOkam!> In reply to @Rika "I switched from neovim": know of Onivim2? abandoned project, but the state they left it in is really amazing if you ask me
13:19:17FromDiscord<Rika> In reply to @sOkam! "know of Onivim2? abandoned": I do
13:20:25FromDiscord<Rika> I don’t think I took it seriously because it’s currently lifeless
13:21:27FromDiscord<sOkam!> im sure there are rough edges missing, but for the most part is as close to RC as i can think of
14:14:41FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wUW
14:15:15FromDiscord<voidwalker> (edit) "code paste," => "long message," | "https://play.nim-lang.org/#ix=4wUW" => "http://ix.io/4wUX"
14:15:21FromDiscord<voidwalker> (edit) "long message," => "code paste," | "http://ix.io/4wUX" => "https://play.nim-lang.org/#ix=4wUW"
14:15:39FromDiscord<voidwalker> how do you get an xmlnode's `.s[0]` ?
14:16:48FromDiscord<voidwalker> the s (seq[XmlNode]) is not public. child only returns the first child node with a given name, and this one doesn't appear to have a name
14:17:28FromDiscord<voidwalker> I need the text, but innerText gives me more than I need (`If n is xnElement, runs recursively on each child node and concatenates the results.↵Otherwise returns an empty string.`)
14:17:33FromDiscord<voidwalker> (edit) "results.↵Otherwise" => "results.Otherwise"
14:17:51FromDiscord<voidwalker> (edit) "results.Otherwise returns an empty string.`)" => "results.`)"
14:23:02FromDiscord<voidwalker> ah, I looked at child proc code, and there's `items(n)`
14:31:54FromDiscord<Rika> holy mother of indentation
14:32:06FromDiscord<Rika> how many levels of indentation is that
14:38:10FromDiscord<System64 ~ Flandre Scarlet> Hi, how can I put a string in the Clipboard please?
14:46:00FromDiscord<Graveflo> I don't think that function is in the standard library. It's a platform specific thing
14:48:35FromDiscord<Graveflo> can try this maybe: https://github.com/genotrance/nimclipboard
14:51:13*lucasta joined #nim
14:52:03*lucasta quit (Remote host closed the connection)
14:52:28*lucasta joined #nim
14:54:36FromDiscord<demetera> Hi guys, do somebody used NiGui extensively?
15:07:29FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4wVm
15:13:12FromDiscord<chmod222> You could use strip from strutils
15:17:18FromDiscord<Chronos [She/Her]> In reply to @chmod222 "You could use strip": That'd break stuff like `00000102`
15:19:01FromDiscord<Graveflo> how would it break it? It would treat the 0s like strip normally treats white space right? so it would strip away `00000` and leave `102`
15:19:22FromDiscord<System64 ~ Flandre Scarlet> In reply to @Graveflo "how would it break": But now there is a problem when the number is... 0
15:19:48FromDiscord<Graveflo> you could make a special condition where the empty string is replaced with 0. I
15:20:04FromDiscord<Graveflo> m assuming that the empty string is what results from stripping 0 from all 0s
15:22:25*Notxor joined #nim
15:27:27FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wVp
15:28:06*rockcavera joined #nim
15:28:46FromDiscord<Graveflo> I removed the code that makes negatives work correctly btw
15:39:28FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wVr
15:42:08FromDiscord<Graveflo> scratch all that. I'm done. Its just wrong
15:51:08FromDiscord<demotomohiro> strformat provides more control to how to print hex rather than toHex: https://nim-lang.org/docs/strformat.html
16:09:21FromDiscord<Graveflo> yea `fmt"{some_int:x}"` is certainly the easiest way since you can omit the padding
16:21:20FromDiscord<michaelb.eth> In reply to @ieltan "People need to make": I'm working on making that possible with Nim
16:21:58FromDiscord<michaelb.eth> (edit) "Nim" => "Nim↵https://github.com/michaelsbradleyjr/nim-notcurses"
16:24:18*derpydoo joined #nim
16:24:43FromDiscord<voidwalker> I'm trying to parse some stuff including file names from an html, with std/htmlparser. Almost finished when I noticed I have some file name printed as `You\xe2�\x99�d` instead of `You’d` - that char is `U+2019 : RIGHT SINGLE QUOTATION MARK {single comma quotation mark}`
16:26:11FromDiscord<voidwalker> so strings are only ascii and I need to use std/unicode ?
16:30:20Amun-Rastrings are more like unspecified binary
16:30:50Amun-RaI mean ASCII characters and non ASCII octets
16:34:04FromDiscord<michaelb.eth> In reply to @voidwalker "I'm trying to parse": what OS are you using?
16:34:11FromDiscord<voidwalker> arch btw
16:35:49FromDiscord<michaelb.eth> In reply to @voidwalker "arch btw": what if you `export LANG=en_US.UTF-8`, does that change the printed output?
16:36:58FromDiscord<voidwalker> it's already en_US.UTF-8
16:39:09FromDiscord<Graveflo> when I read html that has that unicode character in it I am able to parse it and print it without getting the encoding artifacts. is it the terminal? what proc are you using to extract the string? I had the data in an element so I used `innerText`
16:39:11FromDiscord<michaelb.eth> hmm, seeing `�` (replacement character: https://codepoints.net/U+FFFD) is usually a sign there's something wrong with the locale
16:40:04FromDiscord<voidwalker> I use `innerText`
16:40:22FromDiscord<Graveflo> try putting the unicode string in a file and `cat` it. See how the terminal responds
16:40:59FromDiscord<voidwalker> looks fine if I copy paste it from Kate and cat it in terminal
16:41:08FromDiscord<voidwalker> (edit) "from" => "" | "Kate ... and" added "(from .html file)"
16:41:44*pharonix71 quit (Ping timeout: 240 seconds)
16:43:02FromDiscord<sOkam!> Is there any way to restrict/limit the number of entries of an enum to some certain number? (compile time, ofc)
16:43:18FromDiscord<Graveflo> well I'm stumped. Have you confirmed where things start to go wrong. Like where is the string coming in from: a socket, a file, literal? Is it sanitary before it goes into `parseHtml` and only soured after you try and pull data out of the xmlNodes?
16:43:57*pharonix71 joined #nim
16:44:23FromDiscord<voidwalker> it's coming from a local .html file
16:45:20FromDiscord<Rika> when you read the file does the file content string already have the strange bytes
16:46:17FromDiscord<michaelb.eth> there's at std/unicode proc that validates utf8 bytes, I think↵maybe staticRead the file and check if the bytes are valid?
16:46:25FromDiscord<Graveflo> In reply to @sOkam! "Is there any way": arent enums supposed to be defined statically? Are you generating them with a macro or something?
16:46:30FromDiscord<guttural666> shouldn't this return statement work inside the template? it should exit out of the next_token proc? https://media.discordapp.net/attachments/371759389889003532/1112421653297758279/image.png
16:47:19FromDiscord<sOkam!> In reply to @Graveflo "arent enums supposed to": no, just want to mark it so that the enum max value allowed ever is coming from a predetermined const↵just to aid the compiler in case of human-side error
16:47:24FromDiscord<guttural666> (edit) "shouldn't this return statement work inside the template? it should exit out of the next_token proc? ... https://media.discordapp.net/attachments/371759389889003532/1112421653297758279/image.png" added "doesn't seem to want to do it"
16:48:07FromDiscord<sOkam!> the enum is used to map a hardware limitation, and that's a known const
16:48:14FromDiscord<Rika> In reply to @guttural666 "shouldn't this return statement": what does it do instead/
16:49:54FromDiscord<voidwalker> Oh mistery solved. I was echo-ing with that print lib, I forgot : D looks fine with echo
16:49:55FromDiscord<guttural666> endless looping 😄
16:50:15FromDiscord<voidwalker> (edit) "mistery" => "mystery"
16:50:18*ntat joined #nim
16:51:22FromDiscord<guttural666> if a return statement works in principle in a template and there shouldn't be a problem with it, I could have a problem elsewhere
16:52:31FromDiscord<Graveflo> I think there is a pragma to limit the bit size of an enum. Besides that you could try using something like high() at compile time and throw an error. Maybe someone with more knowledge knows a better way
16:53:14FromDiscord<guttural666> I have a problem elsewhere
16:53:51FromDiscord<Rika> In reply to @guttural666 "I have a problem": classic
17:01:21*lucasta quit (Ping timeout: 265 seconds)
17:03:06*arkurious joined #nim
17:13:12FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wVX
17:15:15FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wVY
17:18:47FromDiscord<Graveflo> no idea, but if you find a simpler way lmk. If there isn't a pragma for it one can be made (i think). The only other thing ive personally seen if stuff like this for c compat `{.size: sizeof(cint).}` but that is for byte size restrictions I think
17:19:14FromDiscord<sOkam!> yep, that's bytesize of the enum. been using that for interop
17:33:10FromDiscord<acornes> does anyone know of a good scripting language for android?
17:33:26FromDiscord<acornes> searching it on google doesn't give a clear result
18:08:28*junaid_ quit (Remote host closed the connection)
18:13:52*derpydoo quit (Ping timeout: 248 seconds)
18:35:11*rockcavera quit (Ping timeout: 240 seconds)
18:53:34*rockcavera joined #nim
19:09:12FromDiscord<ShalokShalom> How did the tooling support change within the last months?
19:09:17NimEventerNew thread by Araq: Atlas shrugged..., see https://forum.nim-lang.org/t/10234
19:10:15FromDiscord<ShalokShalom> Does nimsuggest still eat all the resources from time to time?
19:14:05FromDiscord<ShalokShalom> Elegant: Did IC help with nimsuggest, as you hoped it will be?
19:16:50FromDiscord<jmgomez> Nim 2.0 hasn't being released, which according to the roadmap would happen before the work on IC. So nope, nothing has changed regarding to tooling yet
19:21:43FromDiscord<H̲A̲C̲K̲K̲E̲R̲> What is more correct to use when accessing Json data?↵.str or getStr()↵.bool or getBool()↵etc
19:22:04FromDiscord<H̲A̲C̲K̲K̲E̲R̲> (edit) "Json" => "JsonNode"
19:23:09FromDiscord<ShalokShalom> @jmgomez thanks
19:23:20FromDiscord<ShalokShalom> what delays the release of 2.0?
19:23:31FromDiscord<ShalokShalom> I thought this was supposed to happen months ago?
19:25:44FromDiscord<jmgomez> There is from time to time a stopper that appears. I think there is only one or two left now
19:28:48FromDiscord<chmod222> Good to know
19:28:48FromDiscord<chmod222> Ah, so it's not only me who has had nimsuggest murder their desktop?↵(@ShalokShalom)
19:36:52FromDiscord<JJ> yeah, it's a known bug. quite sucks
19:38:10FromDiscord<chmod222> Well, it's not that bad since it only happens every few weeks
19:38:17FromDiscord<chmod222> for me at least
19:38:27FromDiscord<chmod222> Usually I can pkill -9 nimsuggest fast enough
19:41:19*lucasta joined #nim
19:48:09FromDiscord<jmgomez> Wait until you have all the bindings, you will see ;P
19:48:38FromDiscord<jmgomez> I mean, Im used to it. But it makes people go away from NimForUE every other day
19:54:25FromDiscord<ShalokShalom> A language with version number 2.0 and no proper editor support is weird.
19:55:13FromDiscord<jmgomez> ask haskell 😛
19:55:17*krux02 joined #nim
20:06:16FromDiscord<Elegantbeef> The funny thing is thinking 2.0 means anything
20:06:17FromDiscord<Elegantbeef> It's semver that's it
20:07:01FromDiscord<Elegantbeef> All 2.x means is that there are breaking changes to code that runs in 1.x
20:30:09*lucasta quit (Ping timeout: 265 seconds)
20:33:23*ntat quit (Quit: Leaving)
21:08:15FromDiscord<JJ> i mean it is proper editor support just buggy editor support
21:14:56*derpydoo joined #nim
21:25:26*Notxor_ joined #nim
21:25:40*Notxor quit (Read error: Connection reset by peer)
21:48:57*Notxor_ quit (Remote host closed the connection)
22:03:32FromDiscord<chmod222> The only editor support I have ever needed from a language was syntax highlighting and maybe some error squigglies
22:03:32FromDiscord<chmod222> All you need is a magnetic needle and a steady hand
22:03:57FromDiscord<chmod222> I don't think C or C++ have proper support for and from.. anything really
22:04:04FromDiscord<chmod222> Somehow they still ended up everywhere
22:21:36FromDiscord<Graveflo> If C(++) did it right there would be no reason to be here
22:33:34*derpydoo quit (Quit: derpydoo)
22:34:54FromDiscord<JJ> sure c/c++ editor support is atrocious, those definitely shouldn't be a benchmark
22:37:49FromDiscord<JJ> i think rust-analyzer is a good ideal to strive to: but even though currently the langserver is far from that, it can currently report compilation issues inline, provide autocomplete, provide type inference. the big problem is that it's buggy and will crash and/or create orphan processes
22:40:13FromDiscord<jmgomez> I actually find jetbrains's C++ support really good
22:57:55FromDiscord<chmod222> Which one is the premier Nim editor support tool these days? nimlsp, langserver or going raw nimsuggest?
22:58:03FromDiscord<chmod222> I'm not up to speed
23:16:34FromDiscord<michaelb.eth> In reply to @chmod222 "I'm not up to": 90% of the time nimlangserver + emacs works well for me, but I did have to figure some things out re: project "mapping"
23:34:18*LuxuryMode joined #nim