<< 06-07-2021 >>

00:02:35FromDiscord<leorize> what `--gc` are you using?
00:06:46ricemanI've tried boehm, arc, and the standard Nim GC. In the past, I had this issue on a project that needed to rapidly send post requests via httpclient and boehm solved the crashes, but no luck this time w that
00:09:04ricemanI'm trying to walk directories recursively to get a list of the files inside, about 4,000, and then upload them to an AWS bucket. I've tried running spawn(file) directly, as well as writing the list to a file and doing "for line spawn()", but both eventually crash.
00:10:34ricemansleep(100) or so seems to help between thread spawns, but it still SIGSEGVs eventually, no matter how slow I make it go.
00:11:04FromDiscord<leorize> are your threads accessing any global resources?
00:12:34ricemanI don't believe so, but I'm a hobbyist programmer up until recently. I'm passing each line to the async function via parameter. That's the only thing being used that originates globally. Spawning clients inside the async proc too to be safe.
00:14:28ricemanThanks for the help, by the way! I appreciate it
00:15:50FromDiscord<leorize> wait wait wait
00:16:03FromDiscord<leorize> you're using asyncdispatch and threadpool?
00:16:43FromDiscord<leorize> mixing both async and thread is a very dangerous recipe in nim \:P
00:18:04FromDiscord<leorize> if you have an async procedure, then you can just collect all `Future` from them into a seq then use `asyncdispatch.all()` to wait for all of them to be done
00:18:38FromDiscord<leorize> if you want to both do this and multi-threaded, then the creation of these async procedure should be done within their respective threads
00:23:15ricemanThat's great to know, thank you. I'll do some googling and see what I can find out about asyncdispatch.all() usage. Really appreciate it.
00:42:24FromDiscord<leorize> sorry, it's in asyncfutures
00:42:54FromDiscord<leorize> can you explain a bit on how your threadpool + async workflow works?
00:49:55ricemanGotcha! And sure! I'm using async because it's tied to the only functional s3 library I could find. My script is so short it might be able to be easily pasted here.
00:51:34riceman```proc up(upload:string) =; var client:S3Client; var creds:(string,string); discard client.put_object("BUCKET", upload, readFile(upload)); for file in walkDirRec("./data"): discard spawn up(file)```
00:52:03ricemanThat's essentially my entire script right there, minus credentials and bucket name.
00:54:27FromDiscord<leorize> which s3 library are you using?
00:57:17ricemanI'm using https://github.com/ThomasTJdev/nim_awsS3. It's a bit broken, but the other two I tried were seemingly nonfunctional, even with modifications
01:00:48FromDiscord<leorize> I think the s3PutObject api would work better
01:01:23FromDiscord<leorize> since it doesn't rely on you having to read the file before passing it on
01:02:54FromDiscord<leorize> so to use it you gotta do this\:
01:07:22FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3s5f
01:07:50FromDiscord<leorize> ^ hopefully that would work for your usage, afaict from the library you sent
01:09:50FromDiscord<leorize> might need a few fixes here and there since I've never worked with AWS before
01:15:02ricemanLet me give that a shot and see! You're amazing, thank you.
01:22:10FromDiscord<leorize> you might want to use this API\: https://github.com/ThomasTJdev/nim_awsS3#s3putobjectis2xx
01:22:12fn<R2D299> itHub: 7"Amazon Simple Storage Service (AWS S3) basic API support"
01:22:32FromDiscord<leorize> then in the case where upload fails you can echo the failed file or smt
01:27:26ricemanTried that to begin with, but something about it wasn't working. Let me take another look at it.
01:28:08ricemanA big issue is the library controls the http client, which seems to invoke some weird design quirks that I have a hard time working around.
01:30:14ricemanAh, right. the 2xx one was giving me 400 errors with the proper creds, so it seems to be broken or I'm unknowingly incorrectly using it in some major way
01:31:11FromDiscord<leorize> you can try echo-ing out the response \:p
01:34:40ricemanIt's echoing me the response, but it seems to be speaking in terms the API isn't expecting or wanting
01:35:07FromDiscord<leorize> then I can't help you with that, sorry \:/
01:36:11ricemanUnfortunately, it looks like AWS uses Java exclusively for a special bulk-upload feature of the api... ah man.
01:36:44ricemanMight have to hop to that to bypass the individual file method. Either way, thank you a ton for your help. I learned a lot about async usage today!
01:38:47FromDiscord<leorize> you're welcome \:)
02:37:50*arkurious quit (Quit: Leaving)
02:42:58*stkrdknmibalz quit (Ping timeout: 240 seconds)
03:10:24*SebastianM joined #nim
03:10:35*SebastianM quit (Client Quit)
03:11:21*vicfred quit (Quit: Leaving)
03:57:17FromDiscord<aleclarson> is there a obviously fastest way to convert int to string?
03:57:25FromDiscord<aleclarson> (edit) "a" => "an"
03:57:43FromDiscord<aleclarson> or does `repr` work fine for performance-intensive scenarios?
03:58:45FromDiscord<Rika> Repr? Why not $
03:59:19FromDiscord<Rika> I’m pretty sure it’s fast enough, stringifying an integer isn’t as difficult as a float
04:00:36FromDiscord<aleclarson> great thx
04:02:20FromDiscord<Rika> If you’re looking for a bottleneck it’s best to use a profiler
04:03:16FromDiscord<aleclarson> truth \:)
04:05:31*rockcavera quit (Remote host closed the connection)
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:37*supakeen joined #nim
04:09:47*vicfred joined #nim
05:05:30*vicfred quit (Quit: Leaving)
05:12:21fn<ForumUpdaterBot99> New Nimble package! gm_api - Bindings for Greasemonkey API and an userscript header generator, see https://gitea.com/thisago/gm_api
05:58:26GreaseMonkeyif anyone's wondering, yes, i did in fact get namedropped :^)
06:00:05FromDiscord<Quantumly> When I compile a DLL is it fully independent? or does Nim have to be installed for it to work
06:02:41FromDiscord<ElegantBeef> Lol greasemonkey
06:03:02FromDiscord<ElegantBeef> Nim compiles to C so it works just like distributing C libraries
06:18:16*pro joined #nim
06:31:41*Schnouki joined #nim
06:42:46FromDiscord<pointystick> sent a code paste, see https://play.nim-lang.org/#ix=3s63
06:50:33FromDiscord<ElegantBeef> No i dont think you should be able to have var methods as that implies you can change where the var points
06:50:50FromDiscord<ElegantBeef> But codegen is an issue so issue time 😛
06:53:51FromDiscord<ElegantBeef> @pointystick ^ i really need to start reading when messages were sent
07:08:02FromDiscord<pointystick> I've raised this as issue: https://github.com/nim-lang/Nim/issues/18437
07:42:47*Vladar joined #nim
07:54:32*neceve joined #nim
07:56:11FromDiscord<Clonkk> What's the recommended way of dealing with exception that happens in a separate thread ?
07:56:25FromDiscord<Clonkk> (beside a global try / except in the thread proc)
07:57:49*max22- joined #nim
07:58:06*max22- quit (Remote host closed the connection)
07:58:28*max22- joined #nim
09:00:53FromDiscord<planetis> I would like to know as well, but nothing else than the "global try/except in the thread" seem to work.
09:01:37FromDiscord<planetis> i tried this https://github.com/planetis-m/dumpster/blob/master/multithread/threrror.nim but its not supposed to compile
09:02:18FromDiscord<planetis> (bc getCurrentExpeption just returns a new reference and doesnt move the exception)
09:02:48FromDiscord<planetis> there is also https://nim-lang.github.io/Nim/system.html#globalRaiseHook and localRaiseHook
09:02:56FromDiscord<planetis> not sure how they work
09:08:14FromDiscord<no name fits> How do you guys handle when requirements for GUI changes all the time? I'm seriously so sick of doing UI already, and when I have to keep "fixing" it, it feels like I'm getting nothing done
09:08:41FromDiscord<ElegantBeef> I dont do UI much but dont follow what you mean 😄
09:09:48FromDiscord<Rika> Basically when you need to change the layout again/?
09:10:07FromDiscord<Rika> I think that's one reason people use Immediate Mode gui
09:10:15FromDiscord<Rika> Painless to change the layout
09:10:16FromDiscord<no name fits> sent a long message, see http://ix.io/3s6D
09:10:56FromDiscord<no name fits> At which point the "forgot password" flow becomes obsolete because it's tied to your vendor
09:12:37FromDiscord<no name fits> I think I'm trying to ask if there's a way to do UI so these changes are less of a hassle
09:13:42FromDiscord<no name fits> And sorry if I seem irritated. I thought I had a chance to knock down some tasks today but I got put on "clean the coffee machine" duty
09:14:36*pro quit (Quit: WeeChat 3.2)
09:17:42FromDiscord<Rika> as ive said probably best to look into immediate mode ui
09:19:05FromDiscord<no name fits> I'll look into it while I wait for this thing to finish
09:27:38FromDiscord<no name fits> And I just splashed myself with water 🙂
09:30:04FromDiscord<Rika> 😄
09:42:49FromDiscord<Clonkk> Interesting i'll look into it
09:44:22FromDiscord<planetis> tell me how it went pls
10:21:22*max22- quit (Ping timeout: 246 seconds)
11:08:00*max22- joined #nim
11:27:23*max22- quit (Ping timeout: 252 seconds)
11:36:27fn<ForumUpdaterBot99> New thread by Miran: Nim online meetup - Friday July 9th, see https://forum.nim-lang.org/t/8203
11:42:58FromDiscord<Zoom> sent a long message, see http://ix.io/3s79
11:44:08FromDiscord<Rika> uh, where
11:44:14FromDiscord<Zoom> I use this to store a bitmap where you have three operations\: add bits, remove rows, shift rows
11:44:20FromDiscord<Rika> i mean where in the file
11:44:43FromDiscord<Rika> you really need to break this file up ngl
11:45:01FromDiscord<Zoom> I haven't pushed yet.
11:45:05FromDiscord<Rika> oh ok
11:45:09FromDiscord<Zoom> I'm still not sure if it's a good idea
11:45:16FromDiscord<Zoom> wdym?↵(@Rika)
11:45:19FromDiscord<Rika> well i cant tell until i see it
11:45:25FromDiscord<Rika> the long tetronimia file
11:45:46FromDiscord<Zoom> Is it considered long? It's less than 500 lines
11:46:00FromDiscord<Rika> well i think it can be shorter
11:46:29FromDiscord<Rika> thats fine for now i guess
11:46:31FromDiscord<Rika> minor issue
11:46:45FromDiscord<Zoom> Yeah, splitting CLI handling is the first candidate.
11:48:25FromDiscord<Zoom> Isn't my description clear enough? I'm more interested in hearing your thoughts on the whole idea first than on the particular implementation↵(@Rika)
11:48:34FromDiscord<Rika> not for me it isnt
11:48:46FromDiscord<Zoom> Ok. I'll push soon
11:48:57FromDiscord<Rika> im not someone who can understand things by description
11:49:14FromDiscord<Rika> but i have a feeling that the length field is redundant
11:49:27FromDiscord<Rika> not that i can actually tell because yeah
11:58:45FromDiscord<Rika> In reply to @Zoom "Ok. I'll push soon": if you werent sure it was a good idea, you should have made a branch first and made the changes there
11:58:53FromDiscord<Rika> then you merge the branches when you're sure
11:59:07FromDiscord<Rika> otherwise you can just delete it then carry on with the older code
12:04:13FromDiscord<Zoom> That's exactly what I do↵(@Rika)
12:04:57FromDiscord<Rika> it sounded like you werent doing so
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:37*supakeen joined #nim
12:13:44*xet7 joined #nim
12:15:11*xet7 quit (Remote host closed the connection)
12:15:56*xet7 joined #nim
12:18:10*Vladar quit (Remote host closed the connection)
12:20:08*Vladar joined #nim
12:20:21*PMunch joined #nim
12:23:49FromDiscord<Zoom> https://github.com/indiscipline/tetronimia/blob/shufflearray/src/shufflearray.nim
12:25:40FromDiscord<Zoom> Hm, not sure why. I'm just playing with things in my private repo and don't push until it at least compiles \:D↵(@Rika)
12:28:31FromDiscord<Zoom> Also, I have some initialization warnings for the `initShuffleArray` proc and pragmas don't help \:(
12:35:12*arkurious joined #nim
12:55:37FromDiscord<Rika> I'll look at it when I'm free
12:55:42FromDiscord<Rika> Prolly in a few minutes
13:14:06FromDiscord<Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/861935798919233556): I'm still not sure if this data structure is a good idea
13:15:01FromDiscord<gerwy> okay , does anyone know if i can use parsexml without saving my string into some file?
13:17:32FromDiscord<gerwy> in xmlparser
13:17:41FromDiscord<exelotl> @gerwy you can use a StringStream
13:17:55FromDiscord<gerwy> ooh
13:19:00FromDiscord<gerwy> oh i think xmlparser can use string, sorry i was using parsexml instead of it
13:32:44FromDiscord<Rika> zoom so L is capacity and len is data-length?
13:32:58fn<ForumUpdaterBot99> New post on r/nim by FORCE4760: Would Nim be a good fit for my use cases?, see https://reddit.com/r/nim/comments/oev01r/would_nim_be_a_good_fit_for_my_use_cases/
13:35:34FromDiscord<Rika> i dont really understand the point of storing indices as well
13:46:42FromDiscord<gerwy> Yooooo it works
13:47:00FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/861966462599168030/Zrzut_ekranu_2021-07-6_o_15.46.54.png
13:48:29FromDiscord<gerwy> sent a long message, see http://ix.io/3s7z
13:51:21*max22- joined #nim
13:51:22PMunch@gerwy, creating a YouTube front-end?
13:56:53FromDiscord<gerwy> no no, making a bot for my laziness
13:58:28fn<Prestige99> For a youtube search?
13:58:53FromDiscord<gerwy> but i kinda don't know how to parse the date, because there is this annoying T between date and time and parser doesn't like that
13:59:15*rockcavera joined #nim
13:59:15*rockcavera quit (Changing host)
13:59:15*rockcavera joined #nim
13:59:30FromDiscord<dom96> You can ignore it by using `'T'` in your parsing format string
13:59:36FromDiscord<gerwy> doesn't work
13:59:47FromDiscord<dom96> code?
13:59:57fn<Prestige99> !yt nim conf 2021
13:59:58fn<R2D299> ndreas Rumpf: Welcome to NimConf 2021 + Zen of Nim: 2https://www.youtube.com/watch?v=D_G9h7DcIqM
13:59:59FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/861969729886748702/Zrzut_ekranu_2021-07-6_o_15.59.54.png
14:00:19FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/861969815250010122/Zrzut_ekranu_2021-07-6_o_16.00.16.png
14:00:21FromDiscord<dom96> is R2D2 your bot Prestige?
14:00:41fn<Prestige99> Yes
14:01:53FromDiscord<gerwy> i think i also need to do something with this "+00:00" but what?
14:01:57FromDiscord<gerwy> maybe just ignore it
14:02:47FromDiscord<gerwy> and do it like [string.low ...^5]
14:02:56FromDiscord<dom96> I think you can parse it using the timezone format patterns
14:03:12FromDiscord<gerwy> ah yeah i noticed zzzz
14:03:18FromDiscord<gerwy> (edit) "zzzz" => "zzz"
14:03:49FromDiscord<gerwy> okaay now works properly
14:04:06FromDiscord<gerwy> even adds up my timezone to it interesting
14:04:35FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/861970887175438427/Zrzut_ekranu_2021-07-6_o_16.04.30.png
14:04:44*tiorock joined #nim
14:04:44*tiorock quit (Changing host)
14:04:44*tiorock joined #nim
14:04:44*rockcavera quit (Killed (iridium.libera.chat (Nickname regained by services)))
14:04:44*tiorock is now known as rockcavera
14:07:27FromDiscord<gerwy> yeah i checked on some random video its right, because im in +2 timezone it mades it correct
14:07:33FromDiscord<gerwy> thank u for halp
14:10:42FromDiscord<Zoom> @dom96\: check your matrix dm please. Also, why are using discord at all? \:P
14:10:42FromDiscord<Zoom> Oops, bridge died again!
14:10:42FromDiscord<Zoom> Yep.↵(@Rika)
14:11:51FromDiscord<dom96> Why are you using Matrix? 😛
14:12:04FromDiscord<dom96> I don't have access to my Matrix on this machine in any case
14:16:00FromDiscord<Zoom> You know the answers, I presume. If not, this is a discussion for #offtopic↵(@dom96)
14:16:49FromDiscord<gerwy> lol works flawlessly
14:18:20FromDiscord<gerwy> but the code is messy and probably i won't publish this anywhere, also its not hard to make
14:24:24FromDiscord<Clonkk> Why are people using secure open-source solution instead of centralizing all their communications and services in platform whose main purpose is to sell your datas so you can be spammed by targeted ads↵(@dom96)
14:24:25FromDiscord<Clonkk> Really I wonder
14:24:27FromDiscord<Clonkk> Truly a mystery
14:25:06fn<Prestige99> Needs a better client imo, and the matrix servers get bogged down
14:25:12fn<ForumUpdaterBot99> New thread by Yglukhov: Awaitable threadpools, see https://forum.nim-lang.org/t/8204
14:25:22fn<Prestige99> looking forward to matrix getting bigger and better
14:30:32FromDiscord<gerwy> you can have throw out email for this type of accounts if you don't like be spammed with targeted ads
14:30:48*aeverr_ joined #nim
14:31:15*aeverr quit (Ping timeout: 268 seconds)
14:33:14FromDiscord<Clonkk> 1. It's not a solution, it's a temporary workaround. 2) Many services that are based on emails will ban throw out email. 3) Throw-out emails are usually not secure and leave your accont exposed to being stolen.
14:33:22FromDiscord<Clonkk> The only good solution is the development of privacy friendly alternative
14:34:47FromDiscord<Clonkk> And yes, that will usually require compromise in functionnality and ergonomics because those costs money
14:34:58FromDiscord<gerwy> but no one wants to use alternative, thats the problem
14:36:00FromDiscord<hugogranstrom> I'm I no one? ;)
14:38:11FromDiscord<hugogranstrom> But true, most people don't care about their privacy sadly. Or even worse, don't realize to what extent they give up their privacy
14:39:47FromDiscord<Rika> not really no one, "none of my friends"
14:39:55FromDiscord<Rika> none of the laymen care enough
14:40:01FromDiscord<Rika> its a negative feedback loop
14:40:01FromDiscord<hugogranstrom> If more people did understand that, I'm sure more people would look for "alternatives"
14:40:02FromDiscord<vindaar> 💯
14:40:32FromDiscord<Rika> In reply to @hugogranstrom "But true, most people": even if they knew the losses in privacy, there's still convenience
14:40:33fn<Prestige99> You have friends?
14:41:02FromDiscord<Rika> how convenient is it to make an account, how convenient is it to use on my phone, etc
14:41:10FromDiscord<Rika> prestige: do you want to stoop that low?
14:41:24fn<Prestige99> It was a joke about programmers having friends :P
14:41:47FromDiscord<Rika> not appreciated
14:41:49fn<Prestige99> But yeah, nobody I know irl cares about privacy
14:42:06FromDiscord<Zoom> Rika, have you seen my answers regarding my ShuffleArray? Discord bridge lagged
14:42:40FromDiscord<Rika> i dont think so
14:42:52FromDiscord<Rika> i only see a "yep
14:42:53FromDiscord<Rika> "
14:43:32FromDiscord<Zoom> So, ShuffleArray.L is capacity and `len` field is, well, length. `idx` are index association array which is the point of the whole thing
14:46:18FromDiscord<Zoom> Is this type a good idea and what's wrong with the init proc, as it gives me a `can't prove` warning
14:46:41fn<Prestige99> @Rika didn't mean to offend, was just a self-deprecating joke
14:47:05FromDiscord<Rika> okay
14:48:06FromDiscord<Rika> the init proc needs to use the init syntax `result = ShuffleArray[L, T](len: 0)` replaces the result.len line
14:48:09FromDiscord<Rika> i believe
14:48:29FromDiscord<Rika> whats the index association array for? whats the benefit?
14:50:16fn<Prestige99> I wonder if people actually try talking to others about data privacy
14:52:46*aeverr_ quit (Read error: Connection reset by peer)
14:54:56FromDiscord<vindaar> I do, with varying success. Many people say they understand what I'm saying, but then immediately go on about convenience and "ahh, they don't care about me specifically / I have nothing to hide".↵But then I just force them by not using whatsapp anymore 😛↵(<@709044657232936960_fn=5b=49=52=43=5d>)
14:56:11FromDiscord<deech> What does the `=trace` hook do?
14:59:35*Vladar quit (Remote host closed the connection)
15:01:48FromDiscord<Zoom> The main use case of the type is frequent reordering so this trades index indirection for less moves in memory↵(@Rika)
15:03:49FromDiscord<Rika> so instead of an N\count byte shift it's a 4count byte shift?
15:04:01FromDiscord<gerwy> well i care about privacy but its pretty hard to hold it in modern world↵its not 90s, everything is for some reason digitalized and we don't have our own stuff anymore, everything is in cloud and shared to us which is sad
15:04:40FromDiscord<leorize> it doesn't do anything anymore, but originally it was made for the gc to traverse custom types for reference scanning by `refc`. ARC/ORC obsoleted this though↵(@deech)
15:06:14FromDiscord<dom96> In reply to @Zoom "You know the answers,": I know some of the answers, but always curious about why specific people are opting for it
15:07:10FromDiscord<haxscramper> I want to write my own client for it, and with discord it is not possible
15:07:49FromDiscord<haxscramper> But discord has better search for chat
15:08:11FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3s8l
15:08:33FromDiscord<haxscramper> Then make it `static[int]` generic parameter
15:08:58FromDiscord<dom96> Really hope they fix this Gitter relay bug, otherwise we'll need to switch to an alternative bridge :/
15:09:06FromDiscord<haxscramper> `BitVector[size: static[int]] = object` and `array[size, uint64]`
15:10:47FromDiscord<deech> leorize, does `=dispose` do anything? I see on use of it in a test and no docs.
15:12:31FromDiscord<dom96> In reply to @haxscramper "I want to write": I've gone down this path with IRC and learned that I should have created Slack/Discord all along 😉
15:12:36FromDiscord<Zoom> If you'd like to know, Matrix is a protocol, Discord is an implementation of a protocol which actively discourage third-party clients. That's just one of the reasons but I think it's enough to not use it.
15:12:37FromDiscord<Zoom> If you'd like to know, Matrix is an protocol, Discord is an implementation of a protocol which actively discourage third-party clients. That's just one of the reasons but I think it's enough to not use it.↵(@dom96)
15:13:36FromDiscord<leorize> matrix is really just discord but open and decentralized
15:14:10FromDiscord<leorize> it's working well, so why not use it?
15:14:16FromDiscord<dom96> Of course, that's fair. Personally I don't really mind, I can easily switch to Matrix (or back to IRC) if Discord annoys me
15:15:11FromDiscord<dom96> I don't have any real reason to use it
15:15:14FromDiscord<Zoom> May be we should continue in #offtopic
15:15:18FromDiscord<dom96> right now at least
15:15:24FromDiscord<dom96> sure
15:21:16fn<ForumUpdaterBot99> New Nimble package! asyncthreadpool - Awaitable threadpool, see https://github.com/yglukhov/asyncthreadpool
15:21:17fn<R2D299> itHub: 7"Awaitable threadpool for nim"
15:21:41FromDiscord<Rika> interesting
15:22:10FromDiscord<Zoom> I had basically the same question a few days ago. What would be the proper place in the manual to put this in?
15:29:38FromDiscord<haxscramper> Generics, generic parameters
15:29:41FromDiscord<haxscramper> Probably not `static:` block
15:29:41FromDiscord<haxscramper> Actually generic example is really dense
15:29:49FromDiscord<haxscramper> And has a lot of unnecessary noise
15:29:50FromDiscord<haxscramper> 60+-line binary tree implementation, really?
15:39:23FromDiscord<carpal> In reply to @ElegantBeef "There is also https://github.com/Carpall/nobject": lol
15:39:26FromDiscord<carpal> 💚
15:39:49FromDiscord<carpal> a very funny and simple lib for dynamic typinh (even badly written)
15:41:35*FromDiscord quit (Remote host closed the connection)
15:41:47*FromDiscord joined #nim
16:03:03FromDiscord<aleclarson> is there a built-in helper for parsing ISO datetimes?
16:03:12FromDiscord<aleclarson> or do i just use `parse` with a format string
16:03:38FromDiscord<aleclarson> (edit) "ISO" => "ISO-8601"
16:06:44FromDiscord<@bracketmaster-5a708063d73408ce4> @haxscramper\:matrix.org - tried what you suggested but `var myvar = BitVector[3]` doesn't work
16:06:59FromDiscord<@bracketmaster-5a708063d73408ce4> so I guess what I'm asking is how do I actually instantiate BitVector?
16:07:37FromDiscord<haxscramper> Doesn't work how? And you need to add () if you want to assign yo var
16:07:53FromDiscord<haxscramper> Right now you are assigning type to a variable
16:08:24FromDiscord<@bracketmaster-5a708063d73408ce4> heh - brainfart
16:08:35FromDiscord<@bracketmaster-5a708063d73408ce4> thx
16:09:07*Vladar joined #nim
16:09:22fn<ForumUpdaterBot99> New Nimble package! sums - Accurate summation functions, see https://github.com/planetis-m/sums
16:09:22fn<R2D299> itHub: 7"Accurate summation functions"
16:17:11*stkrdknmibalz joined #nim
16:17:32FromDiscord<aleclarson> is there a difference between `int64(x)` and `cast[int64](x)`?
16:17:42FromDiscord<Rika> yes
16:18:23FromDiscord<Rika> its a conversion vs a reinterpretation
16:18:49FromDiscord<Rika> float(int(1)) == 1.0, cast[float](int(1)) == ??????????
16:19:44FromDiscord<aleclarson> is casting `uint8` to a `int64` alright, or am i better off with conversion?
16:20:15FromDiscord<Rika> cast only when needed
16:20:23FromDiscord<Rika> use a conversion for as much as you can
16:20:36FromDiscord<@bracketmaster-5a708063d73408ce4> is there a way to run for loops at compile time?
16:20:43FromDiscord<aleclarson> In reply to @Rika "use a conversion for": great thx
16:20:44FromDiscord<Rika> yeah, wrap them in a static block
16:21:14FromDiscord<haxscramper> Don't we already have this in stdlib?↵(<@709044657232936960_fn=5b=49=52=43=5d>)
16:21:16FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/devel/lib/std/sums.nim
16:21:17FromDiscord<vindaar> it was deprecated an hour ago or so
16:21:22FromDiscord<haxscramper> Ah
16:21:25FromDiscord<Rika> lmao
16:21:26FromDiscord<haxscramper> Quick reaction
16:21:49FromDiscord<vindaar> the new package is by the person who added it to the stdlib if I'm not mistaken
16:21:53FromDiscord<haxscramper> And a day ago I wanted to write inflammatory RFC about keeping modules small
16:22:09FromDiscord<Rika> lol
16:22:38FromDiscord<haxscramper> From our discussion on genast
16:23:22FromDiscord<haxscramper> I meant not keeping modules small and instead adding things to existing ones
16:23:54FromDiscord<leorize> we should encourage more packages instead of keep piling onto the stdlib
16:24:08FromDiscord<haxscramper> But anyway, how this got into stdlib (sums) in the first place is still beyond me
16:24:27FromDiscord<leorize> it's hard right now because, well, nimble
16:25:10FromDiscord<haxscramper> Do you think new RFC would fix that?
16:25:11FromDiscord<leorize> the basics, then yea
16:25:32FromDiscord<leorize> it's not fixing the "using a package is harder than stdlib", but that is not too important right now
16:33:17FromDiscord<@bracketmaster-5a708063d73408ce4> any restrictions to what nim can handle at compile time?
16:33:28FromDiscord<@bracketmaster-5a708063d73408ce4> Hopefully more advanced than nim secret?
16:33:35FromDiscord<@bracketmaster-5a708063d73408ce4> handle -\> evaluate
16:33:48FromDiscord<@bracketmaster-5a708063d73408ce4> As in, evaluate in a `static` block
16:34:06FromDiscord<leorize> anything that doesn't involve FFI works
16:35:17FromDiscord<leorize> so most of Nim, except things like `re`, `nre` (as these are pcre wrappers), things that get the current time
16:46:20FromDiscord<@bracketmaster-5a708063d73408ce4> ah
16:46:26FromDiscord<@bracketmaster-5a708063d73408ce4> does it use the Nim VM?
16:47:46*max22- quit (Ping timeout: 240 seconds)
16:48:19FromDiscord<Rika> static blocks? yes
17:04:18FromDiscord<timotheecour> > anything that doesn't involve FFI works↵on 1st approximation. `cast[int8](somefloat)` works at RT but not VM currently; there's also `--experimental:compiletimeFFI`
17:05:49FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3s8U
17:09:09FromDiscord<timotheecour> sent a code paste, see https://paste.rs/pkW
17:09:15FromDiscord<timotheecour> (edit) "https://play.nim-lang.org/#ix=3s8V" => "https://play.nim-lang.org/#ix=3s8W"
17:09:27FromDiscord<timotheecour> (edit) "https://play.nim-lang.org/#ix=3s8W" => "https://play.nim-lang.org/#ix=3s8X"
17:09:27FromDiscord<@bracketmaster-5a708063d73408ce4> sent a long message, see https://paste.rs/W3E
17:10:45FromDiscord<timotheecour> don't use getTime for benchmarking, read the docs
17:11:24FromDiscord<konsumlamm> is the error `Error: cannot 'importc' variable at compile time`? that means it uses the FFI and thus can't be used in the VM
17:14:43FromDiscord<@bracketmaster-5a708063d73408ce4> no, oddly enough, the error was\: "/Users/yehowshuaimmanuel/git/BitVector/fac.nims(9, 5) Error\: cannot evaluate at compile time\: a"
17:15:44FromDiscord<haxscramper> `--profileVm:on`
17:16:55FromDiscord<@bracketmaster-5a708063d73408ce4> `nim --profileVM:on fac.nims` like that?
17:19:18FromDiscord<RattleyCooper> Is `osproc`'s `readLines` working properly? I keep getting an error saying that a `File` type is expected but I'm using a `Process` type
17:19:35FromDiscord<RattleyCooper> same with `lines` and `readLine`
17:19:45FromDiscord<RattleyCooper> Docs say to use a `Process` type.
17:19:56FromDiscord<@bracketmaster-5a708063d73408ce4> @\_discord\_427948629249228800\:t2bot.io - looking for benchmark[s] benchmark[ing] in the manual - didn't see it - SO recomended using `times` here\: https://stackoverflow.com/questions/36577570/how-to-benchmark-few-lines-of-code-in-nim
17:20:07FromDiscord<@bracketmaster-5a708063d73408ce4> do you recommend a better way?
17:21:16FromDiscord<RattleyCooper> I'm importing all of `osproc`, am I missing something here?
17:22:10FromDiscord<@bracketmaster-5a708063d73408ce4> I see you can set `--benchmarkVM:on`
17:22:26FromDiscord<@bracketmaster-5a708063d73408ce4> `nim --benchmarkVM:on fac.nims` doesn't seem to do anything different?
17:22:33FromDiscord<@bracketmaster-5a708063d73408ce4> https://nim-lang.org/docs/nimc.html
17:24:28FromDiscord<@bracketmaster-5a708063d73408ce4> Code snippet?↵(@RattleyCooper)
17:25:07FromDiscord<RattleyCooper> sent a long message, see http://ix.io/3s93
17:25:52FromDiscord<RattleyCooper> Haven't hooked up `echo_data` to the `exec_processes` call yet bc it won't compile as is, telling me it expectes a `File` type
17:25:57*max22- joined #nim
17:25:58FromDiscord<RattleyCooper> (edit) "expectes" => "expects"
17:26:54FromDiscord<RattleyCooper> Command is being executed if I remove the call to `lines` bc the host name is displayd by the process
17:27:14FromDiscord<RattleyCooper> (edit) "process" => "process. So it works, I just can't check on the output."
17:30:30FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3s95
17:31:07FromDiscord<dom96> bracketmaster: please switch to Discord/Matrix if you can, the code is coming through really poorly via the relay
17:31:30FromDiscord<@bracketmaster-5a708063d73408ce4> import osproc↵let outp = execProcess("hostname", args=["-s"], options={poUsePath})↵echo outp
17:31:36FromDiscord<@bracketmaster-5a708063d73408ce4> I'll just do unformatted from now on
17:32:41FromDiscord<RattleyCooper> Yeah, I have no issues using `execProcess` but `execProcesses` isn't letting me access output via any of the `readLine`, `readLines` or `lines`
17:33:07FromDiscord<RattleyCooper> I'm hoping to run the commands in parallel and run the callback once the process is finished.
17:33:48FromDiscord<@bracketmaster-5a708063d73408ce4> ah - I've never tried that before - not sure I'm of much help
17:33:56FromDiscord<RattleyCooper> (edit) "I'm hoping to run the commands in parallel and run ... theoutput" added "a callback to log" | "callback" => "output"
17:34:43FromDiscord<RattleyCooper> It's ok. The documentation states that `readLines`, `readLine` and `lines` take a `Process` type but if you give it a `Process` then it errors out saying it needs a `File`
17:35:42FromDiscord<RattleyCooper> I think it's broken
17:36:28FromDiscord<⃟⃟> in regards to the stream object
17:36:33FromDiscord<@bracketmaster-5a708063d73408ce4> Anybody know how to benchmark a nimscript?
17:36:42FromDiscord<⃟⃟> do i have to implement everything i see in the documentation to make my own stream?
17:37:10FromDiscord<@bracketmaster-5a708063d73408ce4> I've been trying this for the past hour and I haven't found a way
17:37:19FromDiscord<@bracketmaster-5a708063d73408ce4> `--profiler:on --stackTrace:on` from compiled nim also doesn't work
17:41:32FromDiscord<timotheecour> here, it's explained here: https://forum.nim-lang.org/t/5261#52440
18:03:35FromDiscord<Quantumly> Is it possible to get Nim to put everything in a single C file including the base?
18:04:46*max22- quit (Ping timeout: 246 seconds)
18:05:06FromDiscord<leorize> not without compiler modification
18:13:56*tiorock joined #nim
18:13:56*tiorock quit (Changing host)
18:13:56*tiorock joined #nim
18:13:56*rockcavera quit (Killed (mercury.libera.chat (Nickname regained by services)))
18:13:56*tiorock is now known as rockcavera
18:15:32*rockcavera quit (Remote host closed the connection)
18:15:33FromDiscord<gerwy> okay so i basically made my little youtube bot, i could probably go below 100LoC but well it just tool made for me to be even more lazy↵but i have a problem
18:15:53FromDiscord<gerwy> when i want to open a file, it only gets a filename, not entire path, how to use path instead of only filename?
18:17:26FromDiscord<gerwy> nvm found it :3
18:19:37FromDiscord<gerwy> okay nevermind
18:19:45FromDiscord<gerwy> oh to open file with path? not filename?
18:22:33FromDiscord<haxscramper> https://zen.su/posts/amalgamating-nim-programs/↵(@Quantumly)
18:25:17FromDiscord<JH> hello, nim gets flagged as a virus by windows when I download it from nim-lang.org. Is it normal?
18:26:28FromDiscord<timotheecour> read related forum posts
18:28:04FromDiscord<JH> found one thanks 👍
18:28:10FromDiscord<gerwy> guys pls halp
18:29:06fn<Prestige99> read a file by its path?
18:29:31FromDiscord<gerwy> yeah, how to get file by its path, not by the filename, because putting path into `open` doesn't work
18:31:10FromDiscord<timotheecour> define filename; it can be used with different meanings. you have `readFile(path)` if that's what you want.
18:33:34FromDiscord<gerwy> nope, doesn't work
18:33:52FromDiscord<gerwy> it takes filename too
18:34:11FromDiscord<timotheecour> then define your meaning of path
18:35:17FromDiscord<gerwy> not relative path to file↵what i mean by that is i open script in one place and i want it to open file in another place, not relative to the script
18:35:36FromDiscord<gerwy> for example i open script at ~/ but the files i need are in ~/Youtube Fetcher/
18:35:36*fputs joined #nim
18:35:38fn<Prestige99> So you have an absolute path to the file?
18:35:43FromDiscord<gerwy> yep
18:35:44FromDiscord<gerwy> how
18:36:20fn<Prestige99> idk if it expands ~
18:36:23fn<Prestige99> if you're using that
18:37:02FromDiscord<gerwy> yeah well hmm it should but i will try absolute path from root
18:38:05FromDiscord<gerwy> hmm doesn't output error so i guess it works :3↵But i would treat it as a bug or lack of functionality, it should expand ~ i think
18:38:09FromDiscord<RattleyCooper> You can use `os.getHomeDir()` to get home directory without knowing username, etc
18:38:36FromDiscord<RattleyCooper> and you can make your own expanding function
18:38:42FromDiscord<gerwy> okaay i will add that if someone else would like to use this program, but its not likely
18:38:58FromDiscord<timotheecour> see expandTilde
18:39:07FromDiscord<RattleyCooper> or do that XD
18:39:08FromDiscord<timotheecour> (edit) "see ... expandTilde" added "also"
18:39:27FromDiscord<timotheecour> everything works as intended here.
18:39:40FromDiscord<timotheecour> (edit) "here." => "as far as those things are concerned."
18:40:25FromDiscord<gerwy> In reply to @timotheecour "see also expandTilde": oh right yeah there is something like this↵but shouldn't this be in open already? Or maybe there is something like this and i don't know about it, like a macro with open and expandTilde
18:41:44*rockcavera joined #nim
18:41:44*rockcavera quit (Changing host)
18:41:44*rockcavera joined #nim
18:44:08FromDiscord<timotheecour> separation of concerns.
18:49:17FromDiscord<gerwy> okay okay it works
18:49:18FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/862042537165586462/Zrzut_ekranu_2021-07-6_o_20.png
18:50:42FromDiscord<gerwy> im pretty proud of myself, thanks everyone for help :3 and sorry for disturbing chat https://media.discordapp.net/attachments/371759389889003532/862042892466126897/Zrzut_ekranu_2021-07-6_o_20.50.21.png
18:58:55FromDiscord<@bracketmaster-5a708063d73408ce4> thanks↵(@timotheecour)
18:59:07*max22- joined #nim
19:08:23FromDiscord<ynfle (ynfle)> Can the case statement macro from fusion/matching be used as an expression? It doesn't seem like it can. Anyone if it can?
19:09:05FromDiscord<konsumlamm> it should be possible
19:09:13FromDiscord<konsumlamm> maybe you dpn't have an else case?
19:09:18FromDiscord<konsumlamm> (edit) "dpn't" => "don't"
19:10:30FromDiscord<ynfle (ynfle)> I don't think I need one. I've covered all the cases I think
19:10:36FromDiscord<ynfle (ynfle)> One second I'll show you
19:11:34FromDiscord<ynfle (ynfle)> https://play.nim-lang.org/#ix=3s9J
19:11:47FromDiscord<ynfle (ynfle)> This should work as I've covered all the cases
19:12:17FromDiscord<Kermithos> In reply to @Life Sucks "im pretty proud of": are you using RSS?
19:12:34FromDiscord<ynfle (ynfle)> Me?
19:12:41FromDiscord<ynfle (ynfle)> What's RSS in this context?
19:12:44FromDiscord<Kermithos> no, @gerwy
19:12:55FromDiscord<gerwy> In reply to @Kermithos "are you using RSS?": yeep↵getting the first entry in channels rss feed
19:13:11FromDiscord<Kermithos> In reply to @Life Sucks "yeep getting the first": nice, any ratelimit problems?
19:13:17FromDiscord<ynfle (ynfle)> \:thumbsup\:
19:13:18FromDiscord<konsumlamm> In reply to @ynfle (ynfle) "I don't think I": well you covered all cases, but the macro doesn't know that, it doesn't check for exhaustiveness, so you need to add a dummy `else` case
19:13:40FromDiscord<konsumlamm> or change the last case to an else
19:13:56FromDiscord<gerwy> In reply to @Kermithos "nice, any ratelimit problems?": what do you mean by ratelimit ?
19:13:56FromDiscord<ynfle (ynfle)> Oh ok
19:14:23FromDiscord<ynfle (ynfle)> Maybe I'll add a PR
19:14:24FromDiscord<@bracketmaster-5a708063d73408ce4> is there documentation for nimVM?
19:14:31FromDiscord<@bracketmaster-5a708063d73408ce4> Like its bytecode or anything?
19:14:37FromDiscord<Kermithos> In reply to @Life Sucks "what do you mean": the first time I told you about the RSS endpoint you said that you may get ratelimited by youtube
19:16:01FromDiscord<gerwy> hmm i was talking about FreeTube, because after some amount of subscribers you have on it, it switches from i think Youtube's API (or Local API idk, something like this) to RSS Feed, so you won't get banned or slowed down
19:16:11FromDiscord<Kermithos> ah ok
19:16:44FromDiscord<gerwy> rss feed is actually pretty fast, i slow down my app a little so that it doesn't quit suddenly and also gives me time to react for new videos showed
19:17:08FromDiscord<gerwy> but well, for now no new vids are here :3 so need to wait for them to see if it actually works
19:17:12FromDiscord<Kermithos> is the code already on github?
19:17:31FromDiscord<haxscramper> https://github.com/haxscramper/fusion/blob/f55323541494fb4718ef68e76e504556f5a13dfd/tests/tmatching.nim#L242
19:19:12FromDiscord<gerwy> noope, its a little messy, i didn't planned on open sourcing it↵i can share it with you if you have any improvements ↵its almost less than 100LoC
19:19:28FromDiscord<haxscramper> `else` clause is mandatory
19:19:28FromDiscord<haxscramper> There is no exhaustiveness cheking in `fusion/matching`
19:19:29FromDiscord<haxscramper> But I think it should be added in v2 for simple cases
19:19:29FromDiscord<haxscramper> Though it is not really useful
19:19:29FromDiscord<haxscramper> Except for tuples of enum and case objects
19:19:32FromDiscord<haxscramper> IIRC there is no implementation documentation, but you can look into compiler
19:19:32FromDiscord<haxscramper> `compiler/vm`
19:19:32FromDiscord<ynfle (ynfle)> @haxscramper\:matrix.org how hard do you think it is to implement
19:19:33FromDiscord<haxscramper> It is a register-based VM with opcodes
19:20:25FromDiscord<Kermithos> In reply to @Life Sucks "noope, its a little": sure, if you want you can send me the code via PM
19:20:43FromDiscord<haxscramper> Depends on the subset of features you want to support
19:20:48FromDiscord<haxscramper> and `case` in matching is `untyped`
19:20:48FromDiscord<haxscramper> In order to implement full coverage checking you need to have a type information
19:20:51FromDiscord<haxscramper> And it is extremely annoying to work with
19:21:03FromDiscord<haxscramper> So yes, it is doable, I even know how, but not sure if the effort worth it
19:21:32FromDiscord<haxscramper> But it would turn into multistage macro
19:22:27FromDiscord<@bracketmaster-5a708063d73408ce4> some crude tests seem to indicate nimVM is about 1000 times slower than python
19:22:34FromDiscord<@bracketmaster-5a708063d73408ce4> and by crude, I mean fac(100)
19:22:42FromDiscord<haxscramper> well, that's not a test
19:22:50FromDiscord<haxscramper> I'm sorry but that's BS
19:22:58FromDiscord<@bracketmaster-5a708063d73408ce4> WDYM?
19:23:16FromDiscord<leorize> it is slower than python vm, confirmed by Araq
19:23:17FromDiscord<ynfle (ynfle)> Not having to as an else for tuples and objects
19:23:28FromDiscord<haxscramper> `> about 1000 times `?
19:23:42FromDiscord<@bracketmaster-5a708063d73408ce4> I know, I was wondering about how much slower in practice
19:23:51FromDiscord<@bracketmaster-5a708063d73408ce4> fac BigInt is a solid test
19:24:05FromDiscord<leorize> not sure what's the metric, but it's not fast fast, for sure
19:24:10FromDiscord<@bracketmaster-5a708063d73408ce4> BigInt is data structure as well as arithmetic intense
19:24:36FromDiscord<@bracketmaster-5a708063d73408ce4> BigInt requires traversing and appending a Seq as well as lots of multiplies and adds
19:24:38FromDiscord<haxscramper> In reality it means "not having `else` for flat tuples with enum values and objects that dont' have their field matched". Everything else is hard to implement
19:24:38FromDiscord<leorize> isn't most python bigints shell out to C?
19:24:58FromDiscord<@bracketmaster-5a708063d73408ce4> BigInt in Nim -c -r is about as fast as Python
19:25:23FromDiscord<haxscramper> That means python shells out to C
19:25:25FromDiscord<@bracketmaster-5a708063d73408ce4> yes - I know
19:25:28FromDiscord<ynfle (ynfle)> What does "objects that don't have their field matched mean?
19:25:51FromDiscord<gerwy> In reply to @Kermithos "sure, if you want": if you want it, because im pretty done with the code and if it works, its finished for me, i kinda made it for myself so there isn't any error checking and the absolute path is also made for my disk so if you want to test it out you need to change it
19:26:03FromDiscord<@bracketmaster-5a708063d73408ce4> Actually, BigInt in compiled Nim is 10x slower than Python - but that's the fault of BigInt implementation
19:26:18FromDiscord<@bracketmaster-5a708063d73408ce4> If we factor that in, we could say nimVM is 100x slower than Python?
19:26:22FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3s9Q
19:26:28FromDiscord<@bracketmaster-5a708063d73408ce4> like I said - very crude
19:26:30FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3s9R
19:26:31FromDiscord<haxscramper> sent a code paste, see https://paste.rs/R18
19:26:42FromDiscord<@bracketmaster-5a708063d73408ce4> but nimVM is clearly much slower than Python
19:26:53FromDiscord<@bracketmaster-5a708063d73408ce4> I just didn't expect it to be that much slower
19:26:56FromDiscord<haxscramper> checking for `strVal` - impossible by definition
19:27:27FromDiscord<leorize> if you want a VM bench it should be fully contained in the VM
19:27:49FromDiscord<@bracketmaster-5a708063d73408ce4> fac(100) is fully contained in the VM
19:28:01FromDiscord<leorize> at the moment we don't have compiler plugins yet to shell some vm code to native for speed up, nor do we have jit
19:28:40FromDiscord<@bracketmaster-5a708063d73408ce4> yes - I realize that
19:28:57FromDiscord<haxscramper> No, it is spread between VM and compiled part. For example internally VM uses `PNode` to operate on sequences, so most likely sequence addition part runtime comes from VM
19:29:05FromDiscord<haxscramper> moving data to and from
19:29:19FromDiscord<haxscramper> IIRC it uses `PNode` to represent runtime values
19:29:28FromDiscord<leorize> that's just impl detail
19:29:52FromDiscord<@bracketmaster-5a708063d73408ce4> the reason I bring this up is because I'm implementing a digital logic(like Verilog or VHDL) language in Nim
19:30:04FromDiscord<@bracketmaster-5a708063d73408ce4> Digital logic languages have two phases, elaboration and simulation
19:30:11FromDiscord<ynfle (ynfle)> So what does matched mean in this case?
19:30:13FromDiscord<@bracketmaster-5a708063d73408ce4> I'm trying to move elaboration to compile time
19:30:17FromDiscord<leorize> what we are focusing on is that all non-primitive operations are in the vm itself and not optimized by compiling to native
19:30:32FromDiscord<timotheecour> https://github.com/timotheecour/Nim/issues/598 would solve that
19:30:58FromDiscord<@bracketmaster-5a708063d73408ce4> but I don't know if elaboration at compile time would be too slow - I guess there's only one way to find out
19:31:22FromDiscord<timotheecour> (edit) "that" => "that. There's indeed no upper bound on cost of VM relative to native code (python comparison is irrelevant because it can use C), depending on use case."
19:31:34FromDiscord<haxscramper> [ynfle (ynfle)](https://matrix.to/#/@ynfle-5f16f3e4d73408ce4fea241f:gitter.im)\: matched means ... matched? We are doing pattern matching, so matched means "object triggers against this branch, and it is executed"
19:31:43FromDiscord<leorize> if you're mainly generating AST then it should not be too slow
19:31:47FromDiscord<timotheecour> (edit) "that." => "that, allowing VM for select user defined code to be as fast as native code."
19:31:56FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3s9T
19:31:57FromDiscord<@bracketmaster-5a708063d73408ce4> yes - mainly AST
19:33:19FromDiscord<@bracketmaster-5a708063d73408ce4> but a user of the DSL could decide they want to do some expensive computation to determine to parameterize their logic↵↵I guess the answer is, just don't do that
19:34:10FromDiscord<haxscramper> Isn't this stuff terribly expensive?
19:34:47FromDiscord<@bracketmaster-5a708063d73408ce4> elaboration is just AST traversal
19:34:53FromDiscord<@bracketmaster-5a708063d73408ce4> simulation is the expensive part
19:35:34FromDiscord<@bracketmaster-5a708063d73408ce4> now if the person has a very complex design such as a 2000 core GPU, elaboration can get pretty expensive
19:36:28FromDiscord<haxscramper> hmm, maybe I've just messed up terms. I thought elaboration included layout and all that kind of styff
19:36:50FromDiscord<@bracketmaster-5a708063d73408ce4> no, thats PNR - or place and route
19:37:40FromDiscord<@bracketmaster-5a708063d73408ce4> elaboration consumes some DSL and spits out a digital circuit
19:37:43FromDiscord<@bracketmaster-5a708063d73408ce4> that is represented as a graph
19:38:24FromDiscord<haxscramper> netlist? Btw, there is a third option - you can use nimscript and pass some implementation procs to it, that do all heavy lifting
19:39:03FromDiscord<haxscramper> But that is only viable if your DSL is completely detached from other nim code
19:39:04FromDiscord<haxscramper> Just purely DSL
19:39:04FromDiscord<haxscramper> Just pure DSL
19:39:05FromDiscord<@bracketmaster-5a708063d73408ce4> circuit == netlist in most contexts I think
19:39:37FromDiscord<@bracketmaster-5a708063d73408ce4> the netlist elaboration spits out is usually far less granular than the synthesis netlist however
19:40:01FromDiscord<@bracketmaster-5a708063d73408ce4> implementation procs?
19:40:09FromDiscord<@bracketmaster-5a708063d73408ce4> tell me more?
19:41:33FromDiscord<haxscramper> You can embed nimscript in your program - https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test5.nim#L112↵Or you can use `compiler/parser` that would accept nim code
19:41:52FromDiscord<haxscramper> Basically if everything you care about is a macro, you can implement a program
19:41:59FromDiscord<haxscramper> That would act like a macro
19:42:08FromDiscord<haxscramper> Takes nim code, generates `<something>`
19:42:53FromDiscord<haxscramper> But that is more of an extreme option, and I haven't done this for anything yet
19:43:31FromDiscord<haxscramper> I'm just saying it is possible, and not that hard (AST for `compiler/parse` is exactly as NimNode, except it is called PNode)
19:43:55FromDiscord<haxscramper> and some other details
19:44:34FromDiscord<haxscramper> https://github.com/beef331/nimscripter
19:44:37fn<R2D299> itHub: 7"Quick and easy Nim <-> Nimscript interop"
19:44:37FromDiscord<haxscramper> https://peterme.net/how-to-embed-nimscript-into-a-nim-program-embedding-nimscript-pt-2.html
19:44:59FromDiscord<@bracketmaster-5a708063d73408ce4> interesting
19:51:00FromDiscord<haxscramper> If you are writing language (almost) from scratch you can go with compiler parser
19:51:23FromDiscord<haxscramper> Basically just save time on parser
19:52:13FromDiscord<@bracketmaster-5a708063d73408ce4> what do you mean by this?
19:53:50FromDiscord<haxscramper> By "implementing digital logic language" you mean you are writing one from scratch, correct?
19:54:03FromDiscord<haxscramper> And you want to reuse nim macros to define language syntax
19:54:41FromDiscord<@bracketmaster-5a708063d73408ce4> yes
19:54:45FromDiscord<@bracketmaster-5a708063d73408ce4> here is a snippet\:
19:54:50FromDiscord<@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3s9W
19:54:55FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3s9X
19:55:34FromDiscord<Bung> oh, nimscripter why I not notice it earlier , maybe I could use it as theme plugin
19:55:40FromDiscord<haxscramper> I though you just wanted to reuse syntax. But you really want to
19:55:45FromDiscord<haxscramper> use nim type system as well?
19:56:19FromDiscord<haxscramper> Or not? The ` Output c = Signed(1024.Max)` part confuses me
19:56:30FromDiscord<@bracketmaster-5a708063d73408ce4> yes - although I'm open to other options
19:56:47FromDiscord<@bracketmaster-5a708063d73408ce4> What that means is create an 11bit signal
19:57:00FromDiscord<@bracketmaster-5a708063d73408ce4> because we need 11 bits to represent a signed 1024 value
19:57:07FromDiscord<haxscramper (haxscramper)> yes, that message certainly didn't go well through the bridge
19:58:06FromDiscord<haxscramper (haxscramper)> Well, that's an interesting one
19:58:31FromDiscord<@bracketmaster-5a708063d73408ce4> https://spinalhdl.github.io/SpinalDoc-RTD/SpinalHDL/Structuring/components_hierarchy.html#introduction
19:58:35FromDiscord<@bracketmaster-5a708063d73408ce4> that's another one from Scala
19:59:11FromDiscord<haxscramper (haxscramper)> So ideally you want to write this DSL code and make it output netlist, but benefit from nim type checking, correct?
19:59:46FromDiscord<@bracketmaster-5a708063d73408ce4> yes. also, I'd like to support netlist simulation in nim
19:59:58FromDiscord<@bracketmaster-5a708063d73408ce4> although if I export the netlist to verilog, I could simulate in verilator
20:00:40FromDiscord<@bracketmaster-5a708063d73408ce4> In fact, verilator has a c simulator api - its possible to use verilator as a simulation backend from other languages
20:01:09FromDiscord<haxscramper> I think you can do this using compiler API
20:01:10FromDiscord<haxscramper> But no nim macros
20:01:36FromDiscord<@bracketmaster-5a708063d73408ce4> Do you think that's a better idea?
20:01:49FromDiscord<haxscramper> So the idea is - you write your code in separate file as your DSL, then you parse it using `compiler/parser`. Then you convert the code into something nim can semcheck
20:01:59FromDiscord<@bracketmaster-5a708063d73408ce4> Also - want to DM so we don't blow up the Nim chat?
20:02:09FromDiscord<haxscramper> On discord/matrix
20:02:18FromDiscord<haxscramper> or telegram
20:03:27FromDiscord<haxscramper (haxscramper)> or gitter
20:04:56*PMunch quit (Ping timeout: 252 seconds)
20:05:20*PMunch joined #nim
20:21:41FromDiscord<deech> Is there any way to macroexpand a macro that isn't syntactically valid?
20:26:41FromDiscord<vindaar> in what sense syntactically invalid though?
20:26:42PMunchecho result.repr?
20:26:47FromDiscord<vindaar> it must be representable by nim nodes
20:31:49FromDiscord<KJ> sent a code paste, see https://play.nim-lang.org/#ix=3sab
20:32:28FromDiscord<ynfle (ynfle)> Can someone help me with a segfault?
20:35:13FromDiscord<kaushalmodi> In reply to @KJ "Im trying to figure": It says↵↵> required type for default: Option[system.string]↵> but expression 'default = "10"' is of type: string
20:36:01FromDiscord<KJ> so it wants either none or system.string but isnt system.string the same as string
20:36:40FromDiscord<kaushalmodi> In reply to @KJ "so it wants either": It needs `Option[system.string]`, not a plain string. So pass it `some("10")`. e.g. https://play.nim-lang.org/#ix=3sac
20:36:50FromDiscord<ynfle (ynfle)> system.string isnt the same as Option[system.string]
20:37:20FromDiscord<KJ> i see
20:44:14FromDiscord<talaing> Hello. How can I receive data from socket using `nativesockets` module?
20:45:25FromDiscord<talaing> sent a code paste, see https://play.nim-lang.org/#ix=3sag
20:50:22FromDiscord<ynfle (ynfle)> My guess is the buffer
20:58:43FromDiscord<talaing> Also, what is `pointer` type?
20:58:50FromDiscord<talaing> Is it like a pointer to some variable?
20:59:24FromDiscord<ynfle (ynfle)> Ya
20:59:31FromDiscord<ynfle (ynfle)> Like `void ` in C
21:03:01FromDiscord<kaushalmodi> In reply to @talaing "Also, what is `pointer`": https://nim-lang.github.io/Nim/manual#types-reference-and-pointer-types
21:04:03*Vladar quit (Quit: Leaving)
21:16:14FromDiscord<KJ> damn we have pointers in nim, I need to check this shit out. I have been so deprived of that pointer goodness from using python (python has there just isn't much point in using them)
21:16:33FromDiscord<ynfle (ynfle)> `ref` is what you should be using
21:16:39FromDiscord<ynfle (ynfle)> it's traced
21:16:55FromDiscord<ynfle (ynfle)> `ptr` & `pointer` is generally for interface with C
21:17:54FromDiscord<KJ> right
21:18:25FromDiscord<talaing> I'm not really sure how buffer is supposed to work.
21:19:25FromDiscord<talaing> I'm currently looking at https://github.com/nim-lang/Nim/blob/devel/lib/pure/net.nim and trying to understand how `recv()` function works in here, but there are 6 functions called `recv()`
21:20:08FromDiscord<talaing> (edit) "6" => "5"
21:20:33FromDiscord<talaing> 4 of them return `int` and only the last one returns `string`
21:20:47FromDiscord<talaing> sent a code paste, see https://play.nim-lang.org/#ix=3sal
21:22:22FromDiscord<talaing> (edit) "https://play.nim-lang.org/#ix=3sal" => "https://play.nim-lang.org/#ix=3sam"
21:23:59FromDiscord<ynfle (ynfle)> None of them are `recv` from winlean
21:26:52FromDiscord<talaing> https://media.discordapp.net/attachments/371759389889003532/862082188899909632/yD41la8D.png
21:26:58FromDiscord<talaing> this is the first one
21:30:54FromDiscord<ynfle (ynfle)> What makes you think its the one from winlean?
21:30:58*neceve quit (Ping timeout: 240 seconds)
21:33:38FromDiscord<talaing> I don't think recursion would make any sense here
21:34:23FromDiscord<talaing> and all arguments are matching the function from `winlean`
21:34:32FromDiscord<talaing> sent a code paste, see https://play.nim-lang.org/#ix=3sao
21:34:32FromDiscord<ynfle (ynfle)> It has nothing to do with recursion
21:34:34FromDiscord<ynfle (ynfle)> You're right
21:34:41FromDiscord<ynfle (ynfle)> Check out the tests [here](https://github.com/nim-lang/Nim/blob/44e653a9314e1b8503f0fa4a8a34c3380b26fff3/tests/stdlib/tnetdial.nim#L36)
21:35:13*max22- quit (Quit: Leaving)
21:38:18FromDiscord<talaing> Honestly, it's pretty confusing ._.
21:39:33FromDiscord<ynfle (ynfle)> In c, a string is just an array of characters.
21:40:12FromDiscord<ynfle (ynfle)> You pass in the address of the first character and it reads from the buffer (over here the buffer of the socket) in to that "string
21:40:39FromDiscord<ynfle (ynfle)> \basically just array of `char`s with a null terminater
21:40:50FromDiscord<ynfle (ynfle)> Use the high level ones that use `var string`
21:40:57FromDiscord<ynfle (ynfle)> Are you trying to figure out the implementation?
21:44:45FromDiscord<dom96> @talaing what's your goal?
21:48:25FromDiscord<ynfle (ynfle)> How can I use 2 experimental features? 2 experimental statements?
21:49:32FromDiscord<talaing> I'm writing a program which is extremely performance sensitive, I mean I need to achieve speed as fast as possible. I believe there is faster way to use sockets than importing entire `net` module and that's why I want to use lowest level module possible - `nativesockets`.
21:50:07FromDiscord<dom96> what does the program do?
21:50:50FromDiscord<ynfle (ynfle)> @\_discord\_450293018910654464\:t2bot.io what isn't used will be discarded by the compiler
21:52:21FromDiscord<talaing> In reply to @dom96 "what does the program": I feel like explaining it would take a lot of time, as it's really complicated.
21:57:24FromDiscord<talaing> sent a code paste, see https://play.nim-lang.org/#ix=3sar
21:57:28FromDiscord<talaing> Now I need to receive data from socket
21:57:46FromDiscord<ynfle (ynfle)> This is for windows?
21:58:31FromDiscord<talaing> Yes
22:03:30fn<ForumUpdaterBot99> New post on r/nim by h234sd: Nim Data Table | Best Countries for Investments, see https://reddit.com/r/nim/comments/of56bu/nim_data_table_best_countries_for_investments/
22:20:09FromDiscord<dom96> In reply to @talaing "I feel like explaining": surely you can give a high-level overview, knowing this context can help me advise you how to get the best performance
22:23:27FromDiscord<KJ> hmmm, one of my cores was pegged at 100%, turns out `nimsuggest` was absolutely devouring cpu usage
22:23:59FromDiscord<talaing> In reply to @dom96 "surely you can give": I need to send ~18 HTTP requests as fast as possible. My current program which uses `net` does it within `0.006s` which may seem like you can't do better than that, but like I said, I believe I can do way better than that with `nativesockets` module.
22:24:31FromDiscord<talaing> They are all POST requests with some json data.
22:24:55FromDiscord<talaing> (edit) "`0.006s`" => "`0.007s`"
22:25:05FromDiscord<talaing> (edit) "`0.007s`" => "`~0.007s`"
22:27:31FromDiscord<dom96> do all HTTP requests go to the same hostname?
22:27:49FromDiscord<talaing> That's right
22:28:02FromDiscord<dom96> cool, so you can eliminate `getAddrInfo`
22:28:18FromDiscord<dom96> just sock.connect("ip")
22:28:39FromDiscord<talaing> Oh, good to know!
22:29:34FromDiscord<dom96> although if you're doing POSIX sockets then you'll still need to construct this addr info struct
22:30:27FromDiscord<dom96> https://en.wikipedia.org/wiki/Berkeley_sockets#Client
22:30:30FromDiscord<dom96> this has a pretty nice example
22:30:51FromDiscord<dom96> you should be able to translate that to Nim fairly easily
22:32:13*PMunch quit (Quit: leaving)
22:33:02FromDiscord<talaing> I see
22:33:07FromDiscord<talaing> What about SSL?
22:33:27FromDiscord<talaing> I suppose changing `Port(80)` to `Port(443)` is not enough.
22:40:38FromDiscord<dom96> yeah, that's when the complexity comes and where `net` does a lot for you 🙂
22:48:23FromDiscord<talaing> I understand but like I said, I aim for best performance.
22:48:39FromDiscord<talaing> I'm aware that making it work properly can take many many hours.
22:48:45FromDiscord<talaing> (edit) "it" => "this"
22:50:43FromDiscord<RattleyCooper> Anybody know how to format (`fmt`) a string without using a string literal? I want to create string "templates" that I can fill in like so `var some_template = "{x} - took {y} seconds"` then format it after the fact. `fmt` only wants to operate on the string literal and won't do `fmt(some_template)`
22:51:11FromDiscord<RattleyCooper> I could do it manually but figured I would ask beforehand 😛
22:52:37FromDiscord<RattleyCooper> (edit) "Anybody know how to format (`fmt`) a string without using a string literal? I want to create string "templates" that I can fill in ... likeseconds"`." added "after the fact," | "seconds"` then format it after the fact." => "seconds"`." | "like so `var some_template = "{x} - took {y}seconds"`. `fmt` only wants to operate on the string literal and won't do `fmt(some_template)` ... " added "without throwing an error ab
22:53:39FromDiscord<ElegantBeef> there is `strformat.%` which can be used like `"$1 - took $2 seconds" % [$100, $200]`
22:53:55FromDiscord<ElegantBeef> Ah sorry `strutils`
22:53:57FromDiscord<RattleyCooper> Perfect!
22:54:54FromDiscord<ElegantBeef> And how did the reading of nettyrpc go?
22:55:05FromDiscord<RattleyCooper> Very confusing lol
22:55:20FromDiscord<ElegantBeef> Did you look at the expanded code?
22:55:51FromDiscord<RattleyCooper> I didn't because I got distracted. I ended up switching gears and focusing on other things :/
22:57:36FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3saA well here is a small example of what it does
22:59:31FromDiscord<ElegantBeef> Should sorta explain how to atleast manually do what i suggest, but anywho 😄
23:04:18FromDiscord<RattleyCooper> Oh awesome 😄 I am working right now so I'm kind of half present but I'm checking it out!
23:11:52FromDiscord<talaing> How do I proceed? @dom96
23:11:59FromDiscord<talaing> I'm stuck at receiving data from socket 😦
23:18:10FromDiscord<dom96> try to find a openssl tcp recv example in C and translate it, `net` should offer some clues as well
23:20:59FromDiscord<talaing> Alright
23:31:23fn<ForumUpdaterBot99> New thread by Alexeypetrushin: Nim Data Table | Best Countries for Investments, see https://forum.nim-lang.org/t/8206
23:44:15FromDiscord<RattleyCooper> I feel like I'm blowing this chat up so I apologize... But does anybody know how to read user input without new lines being added to CLI? Not sure if this is a windows-specific issue but the following code outputs onto multiple lines. I'm making a command line app and want values to update over the top of old values instead of outputting to new lines.
23:44:32FromDiscord<RattleyCooper> while user_input in exit_commands == false:↵ stdout.write("\rsome shell> ")↵ user_input = stdin.readLine().strip()↵ stdout.write("\r" & user_input)
23:46:13FromDiscord<ElegantBeef> So you want to print over the user input line?
23:46:50FromDiscord<RattleyCooper> I want to output to the line and then overwrite what was output
23:46:59FromDiscord<ElegantBeef> `cursorUp`
23:47:02FromDiscord<ElegantBeef> from `terminal`
23:47:31FromDiscord<RattleyCooper> Aaah, thanks!
23:47:32FromDiscord<ElegantBeef> Or checkout illwill/ncurses for finer control
23:51:09FromDiscord<Zoom> How to deal with `{.requiresInit.}` propagation throughout the code? I'm constructing an object (`func init(): Foo`) where one of the fields is of a type with `requiresInit`. The field gets initialized with the proper func later in the proc, but I get the warning on the first use of the `result` in `init()`.
23:51:44FromDiscord<Zoom> ping [haxscramper](https://matrix.to/#/@haxscramper:matrix.org) ^
23:53:20FromDiscord<Zoom> /me thinks he wants an `=init` hook (#252)