<< 21-06-2021 >>

00:09:14*lucerne quit (Remote host closed the connection)
00:26:01FromDiscord<shadow.> how can i find the value of capture groups after match in re?
00:26:56FromDiscord<Elegant Beef> What procedure are you using?
00:27:11FromDiscord<shadow.> In reply to @Elegant Beef "What procedure are you": `re.match`
00:27:21FromDiscord<shadow.> i can use any i just wanna be able to see capture groups lol
00:27:41FromDiscord<shadow.> oh nvm, you pass the matches
00:27:41FromDiscord<shadow.> lol
00:27:50FromDiscord<Elegant Beef> There or two overloads which will copy the matches
00:28:47FromDiscord<shadow.> yep i saw it after asking, thanks
00:28:51FromDiscord<shadow.> matchTuple when? :p
00:29:02FromDiscord<Elegant Beef> I dont like regex, so never
00:39:01*SebastianM joined #nim
00:39:15FromDiscord<Varriount> @ElegantBeef Regex is one of those necessary evils.
00:39:33FromDiscord<Varriount> It's ugly and unreadable, but it gets the job done quickly.
00:39:53FromDiscord<Varriount> (also, readability can be improved by use of the `x` flag)
00:40:14FromDiscord<Elegant Beef> I dont often need it, i just vastly prefer iterative/scanf, but they're of course usable
00:40:15*lucerne joined #nim
00:53:15*SebastianM quit (Quit: Bye)
01:33:19FromDiscord<Zachary Carter> I've been playing around with CPS today
01:34:12FromDiscord<Zachary Carter> Came up with a simple example to help my understanding of the semantics of continuations
01:34:27FromDiscord<Zachary Carter> https://gist.github.com/zacharycarter/0a3b8f893ed903fe6d8feaa3d0906cda
01:34:49FromDiscord<Zachary Carter> So I think now I have enough understanding to actually replace all the make_fcontext and jump_fcontext assembly calls in my code
01:34:59FromDiscord<Zachary Carter> (edit) "make_fcontext" => "`make_fcontext`" | "jump_fcontext" => "`jump_fcontext`"
01:44:46*vicfred joined #nim
01:54:00*fputs quit (Quit: WeeChat 3.2)
01:54:32FromDiscord<aleclarson> Why does this not compile until I remove `| string` from the generic type?↵https://play.nim-lang.org/#ix=3qBT
01:55:23FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3qBU
01:55:48FromDiscord<Rika> Open array is still kinda buggy I believe?
01:57:07FromDiscord<Elegant Beef> Think it's best to just use a concept here as such https://play.nim-lang.org/#ix=3qBV
01:58:06FromDiscord<Elegant Beef> I'm a dummy with that concept \:D
01:58:37FromDiscord<Elegant Beef> Excuse me while i go self flagellate
01:59:03FromDiscord<Rika> What are you a bacterium
01:59:20FromDiscord<Elegant Beef> > ↵> To whip or flog; scourge.↵>
02:00:52*arkurious quit (Quit: Leaving)
02:01:14FromDiscord<Elegant Beef> Have i redeemed myself any? https://play.nim-lang.org/#ix=3qBY
02:01:43FromDiscord<Elegant Beef> Though that means something like `array[1..2, string]` fails, so nope
02:02:35FromDiscord<aleclarson> @ElegantBeef are concepts documented at all?
02:03:01FromDiscord<Elegant Beef> They're "experimental", but work for many things 😀
02:03:18*fputs joined #nim
02:03:23FromDiscord<Elegant Beef> Added support for those mixed bag arrays with this https://play.nim-lang.org/#ix=3qBY hopefully this is helping and not just frustrating telegram
02:03:40FromDiscord<Elegant Beef> https://nim-lang.org/docs/manual_experimental.html#concepts documentation for them
02:05:13FromDiscord<Elegant Beef> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/856353575926890536): Added support for those mixed bag arrays with this https://play.nim-lang.org/#ix=3qC0 hopefully this is helping and not just frustrating telegram
02:09:15FromDiscord<Zachary Carter> Has an issue already been reported for the openArray issue?
02:13:41FromDiscord<Elegant Beef> This might be related https://github.com/nim-lang/Nim/issues/16153
02:13:43FromDiscord<aleclarson> In reply to @Elegant Beef "https://nim-lang.org/docs/manual_experimental.html#": thx Elegant ^^
02:14:26FromDiscord<Elegant Beef> No problem, concepts look mighty confusing at first, but they're a better way to handling stuff than the compiler magic from things like `openArray` imo atleast
02:15:58FromDiscord<exelotl> I'm liking concepts quite a bit now that I've found a reason to use them, but I'm scared because the new design seems more limited and I don't understand it
02:16:27FromDiscord<Elegant Beef> Well the new design empowers macros for other things
02:17:00FromDiscord<Elegant Beef> I think they can coexist, but dont know if they can in the same block
02:17:52FromDiscord<exelotl> Simple things like "this type needs to be an enum" or "this type needs a field `x: int` aren't possible with the new design right?
02:17:55FromDiscord<Elegant Beef> Like hell i have a proof of concept impl of interfaces using new macros cause it was simple enough to reason about
02:18:03*vicfred_ joined #nim
02:18:41FromDiscord<Elegant Beef> I dont quite know, i try not to depend on devel, so havent tested them much
02:19:12FromDiscord<exelotl> (edit) removed "" | "int`" => "int`""
02:19:42FromDiscord<leorize> no they are not possible↵(@exelotl)
02:20:15*vicfred_ quit (Client Quit)
02:21:02*vicfred quit (Ping timeout: 265 seconds)
02:21:26*fputs quit (Remote host closed the connection)
02:21:35FromDiscord<exelotl> So for maximum future proofing I guess I should only make concepts with rules like `foo(a) is int`
02:23:15FromDiscord<Elegant Beef> Also thanks to talking about new macros I now see i missed someones PR from march \:(
02:23:56FromDiscord<Elegant Beef> But this type of logic is easier since the entire procdef is inside the concept https://github.com/beef331/constructor/blob/master/tests/timplements.nim
02:53:11FromDiscord<exithead> Is there an example for flatty?
03:23:40FromDiscord<Zachary Carter> sent a long message, see http://ix.io/3qCg
03:24:31FromDiscord<Rika> Wonder if someone can base a web server on this lol
03:34:37FromDiscord<Elegant Beef> @exithead\: an example for what?
03:35:10FromDiscord<Zachary Carter> In reply to @Rika "Wonder if someone can": well, I need to finish it and add comments but yeah I think it's pretty cool stuff
03:35:33FromDiscord<Zachary Carter> it has its own drawbacks, some of which I think will be alleviated with moving to continuations
03:35:41FromDiscord<Zachary Carter> and CPS
03:36:00FromDiscord<Zachary Carter> but it definitely beats a threadpool appraoach
03:38:47FromDiscord<Elegant Beef> Also this matrix bridge is pretty cool, linked to the gamedev channel for the matrix channel with your discord channel mention 😀
03:39:23FromDiscord<exithead> @ElegantBeef https://github.com/treeform/flatty
03:39:50FromDiscord<Elegant Beef> Yea i've used flatty before which is why i'm asking what you need an example for
03:40:15FromDiscord<Elegant Beef> Hell i might even be a contributor to flatty for all i recall 😛
03:41:10FromDiscord<exithead> How do you output the "flatty"Ed data to the System? I've used fileWrite but can't open it again with fileRead?
03:42:43FromDiscord<Elegant Beef> sent a code paste, see https://play.nim-lang.org/#ix=3qCi
03:45:12FromDiscord<Elegant Beef> Tested and it did
03:45:50FromDiscord<Elegant Beef> https://play.nim-lang.org/#ix=3qCj full usage
03:45:54FromDiscord<exithead> That's about what I did but I had multiple objects so I ".add" them on to an empty string and read them back by newline? Would that have tripped it up
03:47:12FromDiscord<Elegant Beef> Yea since `\n` is a valid character in the binary stream adding one would mess it up
03:47:27FromDiscord<Elegant Beef> flatty isnt a stream impl
03:47:30FromDiscord<exithead> Wait why am I even doing that, I could write the whole seq as a flatty couldn't I?
03:47:37FromDiscord<Elegant Beef> Yep
03:48:04FromDiscord<exithead> Thank you for helping me answer my real question. I appreciate it man!
03:54:20*rockcavera joined #nim
03:54:20*rockcavera quit (Changing host)
03:54:20*rockcavera joined #nim
03:56:02FromDiscord<aleclarson> is there an easy way to check if a file exists, if i don't care about race conditions
03:56:15FromDiscord<Elegant Beef> `os.fileExists`
03:56:33FromDiscord<aleclarson> gratzi ^^
03:56:42FromDiscord<aleclarson> i was looking in `io` docs
03:57:03FromDiscord<Elegant Beef> Also wouldnt be a race condition more of a toctou error
03:58:39FromDiscord<Rika> Isn’t that just a kind of race condition
03:58:53FromDiscord<Elegant Beef> I guess it does say so on the wiki
04:00:04*tiorock joined #nim
04:00:04*tiorock quit (Changing host)
04:00:04*tiorock joined #nim
04:00:04*rockcavera quit (Killed (sodium.libera.chat (Nickname regained by services)))
04:00:04*tiorock is now known as rockcavera
04:08:16*jkl joined #nim
04:09:36*stkrdknmibalz quit (*.net *.split)
04:10:37*lucerne quit (Read error: Connection reset by peer)
04:55:11FromDiscord<dankey> it&#x27;s just a bit hard to read
04:58:07*rockcavera quit (Remote host closed the connection)
04:59:31*lucerne joined #nim
05:01:43*elph quit (Quit: Connection closed for inactivity)
05:34:23*Gustavo6046 quit (Read error: Connection reset by peer)
05:35:51*Gustavo6046 joined #nim
06:07:30*beeswax joined #nim
06:10:30*Gustavo6046 quit (Ping timeout: 264 seconds)
06:15:27*Gustavo6046 joined #nim
06:33:32*lucerne quit (Remote host closed the connection)
06:48:41FromDiscord<hamidb80> In reply to @Zachary Carter "but it definitely beats": why?
06:50:25FromDiscord<hamidb80> i thought it's not possible in nim to implement fibres
06:50:35*FromDiscord quit (Remote host closed the connection)
06:50:48*FromDiscord joined #nim
06:50:51*Epsilon- joined #nim
06:51:51*Epsilon quit (Quit: Quit)
06:56:00FromDiscord<Zachary Carter> well I don't think it's possible to implement fibers in Nim
06:56:03*beeswax quit (Ping timeout: 265 seconds)
06:56:07FromDiscord<Zachary Carter> but you can implement fibers in assembly 🙂
06:56:27FromDiscord<Zachary Carter> and I guess you really can implement fibers with Nim using CPS and continuations
06:56:37FromDiscord<Zachary Carter> since that's what I'm going to eventually replace the assembly with
07:01:46FromDiscord<Rika> Why do you need to go down to assembly to implement fibers
07:15:39*PMunch joined #nim
07:20:29FromDiscord<hamidb80> i remember Dominik was talking about Nim in Fossdem
07:21:37FromDiscord<hamidb80> at the end of the talk someone asked him
07:22:08FromDiscord<hamidb80> why Nim doesn't support Fibers like Crystal?
07:22:24FromDiscord<hamidb80> and he said that fibers requiers a Rumtime to manager them
07:22:52PMunchSimilar to how async requires a runtime
07:22:53FromDiscord<hamidb80> (edit) "that fibers" => ""fibers" | "them" => "them""
07:25:13PMunchI don't see why it would be impossible to implement them in Nim thought
07:28:03FromDiscord<Rika> Which is probably why they will become possible with CPS
07:28:17FromDiscord<Rika> I assume Nim just didn’t have the primitives to easily make the runtime?
07:28:19*beeswax joined #nim
07:28:52FromDiscord<Zachary Carter> yes
07:29:02FromDiscord<Zachary Carter> maybe it could have been done with closure iterators too
07:29:24FromDiscord<Zachary Carter> I'm not sure if closure iterators can do everything you need to support a fiber
07:29:39PMunchProbably, I implemented a work stealing algorithm at one point using closure iterators
07:29:51PMunchThat could steal half-completed jobs across threads
07:30:11FromDiscord<Zachary Carter> what I should have said is - I didn't think it was possible until I learned about CPS and closure iterators 🙂
07:30:20FromDiscord<Zachary Carter> PMunch: nice!
07:30:48FromDiscord<Zachary Carter> but yeah - fibers and continuations are quite different
07:31:02FromDiscord<Zachary Carter> fibers require a stack
07:31:10PMunchThat was way back before ARC though, so I had to use boehm to make it safe to steal work across threads. But I think you could do it with ARC/ORC now
07:31:16FromDiscord<Zachary Carter> continuations eliminate the need for the stack, but of course there is all the processing up front
07:31:29FromDiscord<Zachary Carter> yeah - I think you'd still need locks unless you're using moves
07:32:05FromDiscord<Zachary Carter> to access the job pool / queue whatever from the threads
07:32:21FromDiscord<Zachary Carter> but I don't think this is really avoidable
07:32:50PMunchIt used some fancy striped locking to avoid lock contention
07:33:00FromDiscord<Zachary Carter> ah yeah
07:33:06PMunchIIRC
07:33:06FromDiscord<Zachary Carter> I just use spinlocks
07:33:11PMunchI seem to have lost it..
07:33:23FromDiscord<Zachary Carter> and a semaphore for signaling when a job is ready / consumed etc
07:33:42FromDiscord<Zachary Carter> but yeah I like all of these concurrency primitives
07:33:56FromDiscord<Zachary Carter> they're super powerful for stuff like this
07:34:00PMunchWhat would you use the semaphore for?
07:34:30FromDiscord<Zachary Carter> I think I describe it a bit in that link I posted earlier to the gist, but basically there's a job selector proc that runs on each thread, including the main one
07:35:04FromDiscord<Zachary Carter> so when a job is dispatched the semaphore will get signaled, and the selector proc will select a job from the job pool
07:36:17*lucerne joined #nim
07:36:20FromDiscord<Zachary Carter> otherwise the job selector function will wait for one to be available
07:36:36PMunchAah right, this kinda works the other way. Each thread has its own queue, then when one thread runs out of tasks they steal half of all tasks from another thread
07:36:57PMunchSo as long as there are enough work available there is no communication overhead
07:38:37FromDiscord<Zachary Carter> gotcha, yeah I've heard about those types of work stealing job system implementations before
07:38:50FromDiscord<Zachary Carter> awesome you made one, I wasn't aware haha. I probably would have asked you for it 🙂
07:38:56FromDiscord<Zachary Carter> oh but boehm yeah...
07:39:39PMunchI'm still annoyed that I've managed to lose it.. Would be interesting to see if it would work with ARC/ORC instead of boehm
07:39:53FromDiscord<Zachary Carter> yeah! I'd be curious as well
07:40:16FromDiscord<Elegant Beef> This is why you dont store work in `/tmp/` 😛
07:41:32FromDiscord<Rika> What? You were working on stuff in temp???
07:41:37FromDiscord<Rika> Why?
07:41:54PMunchHaha, I think it was just stored on my laptop at the time or something like that :P
07:42:21PMunchI'm always testing out things in /tmp, means I don't have to name a project and make a folder under my projects directory
07:42:37FromDiscord<vindaar> I also often do that. I use it for short tests and snippets. And rarely I end up writing more than I initially think. Haven't managed to lose anything though 😅↵(@Rika)
07:43:02PMunchI've managed to turn off the computer by accident a couple times..
07:43:08FromDiscord<Rika> I have a “scratch” directory for small stuff like that
07:43:22PMunchBut then you'd need to clean it
07:43:45FromDiscord<Rika> I’m a bit of a data hoarder so I hate making stuff then deleting them
07:44:20PMunchSame, that's why I have my computer delete them for me :P
07:44:41PMunchI have even set up my browser now to give me a clean slate each time I open it
07:45:06FromDiscord<Rika> I know if the computer will delete it so I’m still wary of that, the tactic won’t work for me
07:45:50FromDiscord<vindaar> happens on my laptop frequently, because I sometimes (but not always!) need to press the powerbutton to get it out of sleep. But if I press it too early it just shuts down↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
07:46:58*Vladar joined #nim
07:46:59FromDiscord<Elegant Beef> To be fair i've also started to use `/tmp/` after pmunch's incident it inspired me to have heartbreak
07:47:41PMunchWait, you started using /tmp after you saw me lose my work? :P
07:48:58FromDiscord<Elegant Beef> Yep
07:54:27FromDiscord<Rika> Beef is a masochist
07:56:17FromDiscord<Elegant Beef> Nah just i test a lot of code so helps to not fill my drive
07:58:34*lucerne quit (Remote host closed the connection)
08:01:28*ozzz joined #nim
08:05:56*Schnouki joined #nim
08:10:27FromDiscord<bung87 (Bung)> So what’s the recommand way use async and threads?
08:29:28FromDiscord<bolino> Hi here, I have a quick Nim-noob question.
08:29:36FromDiscord<bolino> Hi here, I have a quick Nim-noob question.
08:29:48FromDiscord<bolino> Hi here, I have a quick Nim-noob question.
08:31:05FromDiscord<Elegant Beef> Hi there i have a quick answer...
08:34:37PMunchWhy is everyone on Discord suddenly a bot?
08:42:09FromDiscord<Bung> I like quick one
08:43:20FromDiscord<Elegant Beef> Matrix bridge
08:45:37FromDiscord<Bung> I just went to buy icecream outside use gitter on mobile so became bot
08:49:04PMunchAha, so now all the other bots are routed through Discord
08:55:30*jkl quit (Ping timeout: 264 seconds)
09:01:04*supakeen joined #nim
09:22:58FromDiscord<shirleyquirk> In reply to @saem "anyone know how to": compiles if you change to `static varargs[typed,...`
09:27:09*Epsilon- quit (Remote host closed the connection)
09:30:43*Epsilon joined #nim
09:34:48beeswaxquit
09:34:50*beeswax quit (Quit: leaving)
09:42:48*evilkhaoskat joined #nim
10:14:45FromDiscord<dom96> All you matrix users: go back to Discord so you're not bots 😛
10:15:14FromDiscord<vindaar> pff, you should all just leave your corporate overlords behind and join us on matrix 😜
10:15:46PMunchAre you using a client for Matrix?
10:16:26PMunchAnd @dom96 maybe we should rename the FromDiscord bot on IRC to something like BridgeBot so that it's a bit less confusing with the new setup
10:17:22FromDiscord<vindaar> just running element in the browser at the moment↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:17:24supakeenWhat's the new setup? :)
10:17:51FromDiscord<dom96> In reply to @PMunch "And <@132595483838251008> maybe we": but it is FromDiscord 🙂
10:18:29supakeenI've seen better bridges than through this bot, it's a bit wonky from the IRC side I think.
10:18:31PMunchWell it is from Discord, but people on Telegram, Matrix, and Gitter are all routed through Discord while not really coming from Discord
10:18:49PMunch@vindaar, ah bummer
10:19:22PMunchsupakeen, apart from the reply functionality and highlighting being a bit wonky (ref vindaars last message) I feel it works pretty well
10:19:54FromDiscord<dom96> In reply to @hamidb80 "why Nim doesn't support": IIRC that wasn't quite the question, but I was just happy I managed to get through my talk, my answers probably weren't the best lol
10:19:57supakeenYea it's not the worst.
10:21:54FromDiscord<vindaar> PMunch, well there's plenty of choice out there. I'm just one of those people that↵1. don't want to have something like matrix in a terminal (I use it too much for personal stuff where I care about these "modern features"↵2. don't like having a bunch of additional programs running, if the web version is perfectly fine. But tbh I haven't checked any of the proper desktop clients (I just don't want an electron client...)
10:23:17PMunchYeah I feel like a lot of the "modern features" are often web-based so the easiest solution to building a client is to go the Electron route
10:25:34FromDiscord<dom96> The web is the most flexible way to create UIs.
10:26:02FromDiscord<dom96> (Flexible and fast I should say)
10:27:33FromDiscord<dom96> Since Telegram users seem to not like the bridge I'm considering removing it
10:27:38FromDiscord<dom96> I agree that it's a bit meh
10:28:07PMunchI agree, the Telegram community is just too different from this one
10:30:38*Torro joined #nim
10:31:50FromDiscord<gerwy> In reply to @dom96 "Since Telegram users seem": Good↵Telegram is bad
10:31:56FromDiscord<gerwy> Matrix good
10:32:05*evilkhaoskat quit ()
10:32:08PMunchWhy do you think that Telegram is bad?
10:32:25FromDiscord<gerwy> Its not as private as people think↵And Matrix is
10:32:36FromDiscord<gerwy> At least, if you configure it right i think
10:33:01FromDiscord<dom96> I think the best compromise is to have a dedicate telegram channel where messages are bridged
10:33:09FromDiscord<dom96> (edit) "dedicate" => "dedicated"
10:33:57FromDiscord<haxscramper> In reply to @dom96 "Since Telegram users seem": my earlier argument of "questions not being answered" still valid, but considering that we basically ddosed the channel to oblivion it is not much better. Earlier you talked about `#nim-telegram`, so maybe we do this?
10:33:58FromDiscord<vindaar> why are you using discord then? 🤨
10:34:32FromDiscord<dom96> In reply to @haxscramper "my earlier argument of": I think we should still link it to this channel, since we have the most people here to answer questions
10:35:06FromDiscord<haxscramper> By link you mean specifically?
10:35:29FromDiscord<haxscramper> Like is there anything between all-message bridge and no bridge?
10:35:42FromDiscord<dom96> Create a special Telegram channel that links to here
10:35:57FromDiscord<dom96> keep the current telegram channel/room/whatever it's called unlinked
10:41:05FromDiscord<haxscramper> In reply to @dom96 "Create a special Telegram": ah, yeah, that's exactly what I meant
10:41:24FromDiscord<gerwy> Btw because its on topic, idk if anyone showed it here but one of the people i know made a little article about privacy in modern instant messaging apps↵And ranked them based on that, of course ranking method is customizable
10:41:26FromDiscord<gerwy> https://coda.io/@xananax/secure-messaging
10:41:29FromDiscord<haxscramper> In reply to @dom96 "if you want to": I was referring to this
10:43:11FromDiscord<gerwy> (edit) "showed" => "shown"
10:43:20FromDiscord<WhyDee86> how can i create global var in nim
10:43:25FromDiscord<WhyDee86> ??
10:43:34FromDiscord<konsumlamm> `var global = ...`
10:45:04*federico3 quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
10:45:24*federico3 joined #nim
10:45:37FromDiscord<WhyDee86> not working i need to import something?↵(@konsumlamm)
10:46:00FromDiscord<gerwy> Wat, but variables are global if they aren't in any scope right?
10:46:27supakeenHow is it not working?
10:46:28*PMunch quit (Quit: leaving)
10:46:31FromDiscord<WhyDee86> ok my mistake its working great! thx
10:50:19*PMunch joined #nim
11:05:22FromDiscord<Rika> In reply to @Life Sucks "https://coda.io/@xananax/secure-messaging": well it would sure be nice if it said what took away hearts or so
11:11:04*jkl joined #nim
11:13:05PMunchWell Session which is at the top of that list is down (their website)..
11:28:00FromDiscord<dankey> anyone has nim vs. rust benchmarks?
11:29:54FromDiscord<haxscramper> In reply to @dankey "anyone has nim vs.": https://github.com/kostya/benchmarks or something like that
11:30:03FromDiscord<haxscramper> benchmarking languages is useless btw
11:30:43FromDiscord<gerwy> In reply to @Rika "well it would sure": It says, there is lot of info actuallty↵But website sucks for mobile so use desktop
11:33:28FromDiscord<Rika> i am on desktop
11:33:39FromDiscord<Rika> is it the color? i do not perceive color as well as normal people
11:39:09FromDiscord<Rika> explanations as to why the default values are what they are would be nice, i dont have the time to search this
11:46:49ozzzI think this "speed test" is wrong. Studying performance of final product must be done with equal algorithm(function) written as direct equivalent. I don't know which libs that benchmark uses, but implementation of that libs may differ from lang to lang.
11:47:15FromDiscord<Rika> yes
11:47:17FromDiscord<Rika> indeed they do
11:47:27ozzzWho knows how many garbage that libs include in final binary
11:48:39FromDiscord<Rika> well where do you draw the line for "equality in algorithm"?
11:49:13ozzzFor examle equal flow, same types for objects, etc...
11:49:34FromDiscord<Rika> and if they have no equivalents? lets say i wanna compare haskell and C
11:50:26ozzzthen it's possible to write own equivalen I think
11:50:29FromDiscord<haxscramper> In reply to @ozzz "For examle equal flow,": define "equal". Language can have any number of semantic differences like move semantics, boxing on some primitive types, varying implementations of used stdlib parts adn so on
11:50:41FromDiscord<Rika> yes but then is it still equal?
11:51:01FromDiscord<haxscramper> Unless you implement two completely identical programs it would not be really useful
11:51:13FromDiscord<Rika> if you have to rewrite what are primitives in another language then is it still equal
11:51:35FromDiscord<haxscramper> And if you do it is useless because you wrote the same thing twice, most likely in unidiomatic code each time
11:52:01ozzzI don't think so, because we benchmarking not the lang, but compiler
11:52:09FromDiscord<Rika> honestly, the difference gets really really minor when comparing stuff like Nim vs Rust vs Go vs Zig vs ...
11:52:32ozzzI see in that chart C is slow than C++ and others
11:52:34FromDiscord<haxscramper> In reply to @ozzz "I don't think so,": Compiler does not operate on abstract "the code" thing you give it
11:52:58FromDiscord<haxscramper> It uses language-specific optimizations,relies on semantics etc. to provide better optimizations
11:53:04ozzzthat's very strange, because C is close to ASM than any from that list
11:53:53FromDiscord<haxscramper> And good code uses a lot of language-specific implementations, but they again, you are not comparing the languages equally, you just check who can get the most optimizations squeeed out of the compiler
11:53:54FromDiscord<Rika> just because a language is close to metal doesnt mean whoever wrote the code in it made the code efficient lol
11:54:21ozzzRight, that's what I'm sayung
11:55:36FromDiscord<Rika> yes, and if we wrote functional code in both haskell and C its most likely that haskell will win because it is aware of optimisations when it comes to functional code
11:55:38ozzzhow C can be slower than D, only makes me think that code on C was not optimized well (or makes many unneded operations)
11:57:58ozzzRika, C has own optimizations, some of them can parallelize execution when needed, like graphite on gcc. This also should be taken on account.
11:58:07FromDiscord<Rika> well indeed
11:58:39FromDiscord<Rika> but then we're back to testing compiler optimisations and not the lang
11:58:41ozzzIntel's compiler can do interprocedural optimizations
11:58:58FromDiscord<Rika> what does benchmarking a language mean, i just thought about
11:59:07ozzzRigt, but lang is lang, final result depends on compiler
11:59:28ozzzHow we can benchmark raw text
12:00:17FromDiscord<Rika> if we're testing the compiler's ability then why do people still ask about performance of languages and not compilers? and is it really important (as in as important as people seem to make it) to know the performance of the produced binaries of the compilers
12:00:38supakeenGenerally people do mean the compiler or interpreter.
12:01:07FromDiscord<Rika> yeah, okay, im not thinking too hard about it (or maybe i am)
12:01:11supakeenIt's just that for a lot of languages there's a single reference implementation :)
12:04:44FromDiscord<Rika> okay
12:05:01FromDiscord<Rika> i just dont understand why it matters so much when the performance is almost always mainly dependent on the actual written code
12:05:14FromDiscord<Rika> and then the compiler optimisations, which can always come in the future
12:05:28ozzzPreviously I did similar test for myself. C wins, using static buffers (withot link time optimizations). Asm was faster, but all optimizations must be done by human
12:05:46FromDiscord<Rika> i guess it matters more when it comes to runtime'd languages like python java etc
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:37*supakeen joined #nim
12:06:49ozzzIt matters for realtime, energy saving :) If nobofy cares, then ok :)
12:06:53supakeenI feel it rarely matters at all, full stop.
12:07:21FromDiscord<Rika> how many people in this server write realtime code to maximum handwritten optimisation possible?
12:07:35FromDiscord<Rika> how many people in this server even just write realtime code?
12:07:41supakeenI have and do but I don't use any 'language' for that.
12:07:43supakeenSince I'm counting cycles ...
12:07:45FromDiscord<Rika> not even in just this server actually
12:07:47ozzzI had such task couple months ago
12:08:00FromDiscord<Rika> across all programmers, how many people need to write realtime code?
12:08:17FromDiscord<sheerluck> Realtime Python Code
12:08:19FromDiscord<Rika> i'd say its relatively rare
12:08:22supakeenIt's pretty rare.
12:09:56supakeenAnd so specialized that optimizing for it is a lost cause.
12:11:03ozzzWell, I'm not saying that everybody should do that way. But in my opinion, if all programs will be optimized for performance, then computers will produce less heat, and green peace will say thanks for that :)
12:11:28FromDiscord<Rika> indeed but you have to take programmer dev time into account as well?
12:11:32FromDiscord<sheerluck> not if you are Gentoo Linux User
12:11:36FromDiscord<Zed the Fish> welp, this chat is just matrix spam now
12:11:37FromDiscord<Rika> lmaooo
12:11:38ozzzahahaha
12:13:24FromDiscord<Rika> i guess benchmarks matter for absolutely massive applications as well
12:13:49FromDiscord<Rika> but then there are still a lot of things you can do there to optimise without changing language
12:13:55FromDiscord<Rika> or compiler
12:14:02FromDiscord<sheerluck> My Gentoo computer produce so much heat that I decided to stop updating for a month while it's so unusually hot here 😦
12:14:18supakeenGenerally they do help, one of the main reasons I introduced Nim at work was in the area of small helper daemons where it saved us a lot of memory.
12:14:31supakeenThese are things we run on all our VMs so saving 40 MB * 500 VMs is a lot.
12:16:12supakeenHowever it's too complex for me to reason about CPU benefits at that scale.
12:17:06*jkl quit (Ping timeout: 264 seconds)
12:19:19supakeenThose are mostly things that take stuff out of one `redis list` then send it over the network to another system while handling the authentication and crypto bits.
12:20:38FromDiscord<planetis> ozzz\: i feel like Nim users care about performance a lot, sometimes on the expense of writing correct code. I mean using unsafe features is the surrest way to shoot yourself in the foor but that way you get same speed as C
12:20:38FromDiscord<planetis> but i dont think an unsafe block will solve anything, its stupid
12:20:38FromDiscord<tandi> u just need to use matrix \:\>)
12:21:21FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> It would be moved to `#nim-telegram` later I think
12:21:31FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> Because there is really too much content
12:21:53FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> Well, at least compared to wasteland telegram chat is for the most time
12:23:00FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> At least dom seems to be in favor of this idea
12:38:27FromDiscord<dom96> yeah, I'll move it tonight
12:47:43ozzzplanetis, I started use Nim to ease my life. If I need to goo deep in coding, then there must be a reason for that (to do memory management by yourself in C, etc..). Same approach I have in speed regard.memory management by yourself in C, etc..). Same approach I have in performance's regard.
12:48:09FromDiscord<dev1lroot 🇳🇴> is latest?
12:48:10FromDiscord<dev1lroot 🇳🇴> image.jpeg https://media.discordapp.net/attachments/371759389889003532/856515839608225792/image.jpeg
12:48:52FromDiscord<dev1lroot 🇳🇴> installed just now on ubuntu
12:49:49FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> no, it is ancient
12:49:54FromDiscord<𝖍𝖆𝖝𝖘𝖈𝖗𝖆𝖒𝖕𝖊𝖗> latest version is 1.4.8
12:50:31FromDiscord<haxscramper> https://github.com/dom96/choosenim
12:50:43FromDiscord<Juan_Carlos.nim> Someone should report the bug, I reported it and they fixed fast https://gitlab.alpinelinux.org/alpine/aports/-/issues/12742
12:51:20ozzzBtw, what about Symantec? It still identifies nimble, nim and koch as troyan
12:52:10PMunchEy, more Norwegian Nim users?
12:52:26ozzzI compiled Nim from source, it works, but I unable to use nimble ( something wrong with tls/ssl)
12:53:32FromDiscord<Rika> are you on windows?
12:54:09ozzzThis time only on windows.
12:55:05FromDiscord<dom96> you need the openssl DLLs, if you use choosenim it will download them for you
12:56:09*arkurious joined #nim
13:02:31FromDiscord<dsrw> Can anyone think of a reasonable way to process the AST of an entire nim file before inserting it into another nim file?
13:02:41FromDiscord<dsrw> `parseStmt(staticRead(...))` works, but I don't get line numbers. I've also tried passing an `include` to a typed macro and that gets me pretty close, but I've hit a few odd issues, and I'd prefer to have the untyped AST if possible.
13:10:34FromDiscord<dsrw> I THINK I can `staticRead` the source, wrap every single statement in a `{.line: ...}:`, then `parseStmt`but, that seems.... gross.
13:11:06FromDiscord<dsrw> (edit) "gross." => "suboptimal."
13:14:19FromDiscord<vindaar> I don't think it's a great idea to try to parse a full file in a macro. What are you trying to do?
13:14:36FromDiscord<dsrw> It's for a DSL.
13:14:54FromDiscord<vindaar> what kind of DSL? why does that require parsing a full file?
13:15:21FromDiscord<vindaar> Nim macros are supposed to work on nim nodes passed to it essentially
13:16:15*fputs joined #nim
13:18:31FromDiscord<dsrw> A DSL with a lot of magic and bad ideas 🙂 I'm getting by without it, but a lot of what I'm doing would be easier if I could do a light pass over the whole file.
13:19:27FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=3qEd
13:22:27FromDiscord<dsrw> That's basically what I want to do, but the `myMagicDsl:` has to be invisible. It's a DSL aimed at kids. Indentation is a problem.
13:22:45FromDiscord<dsrw> Kids have trouble with indentation.
13:25:06FromDiscord<vindaar> hmm, interesting use case. You think you can make a DSL fool proof enough that kids can work with it who have trouble with indentation? (seriously asking, because writing a robust DSL with good error messages etc. is not exactly trivial)
13:25:08FromDiscord<haxscramper> Nim syntax errors are not the best tbh
13:26:26FromDiscord<haxscramper> Like it only shows error positions, and not the code context
13:26:58FromDiscord<dsrw> The hope is that they figure out indentation pretty quickly. But I want really simple stuff to be possible without it.
13:27:01FromDiscord<haxscramper> it would be easier to write a tool that parses nim code using compiler API, then you have more control over how messages is displayed
13:27:13FromDiscord<haxscramper> and indentation
13:27:49FromDiscord<haxscramper> well, if file is small you can `parseStmt()` ont
13:27:52FromDiscord<haxscramper> (edit) "ont" => "on it"
13:32:20FromDiscord<dsrw> `parseStmt` works, but I want to keep my line numbers for error handling. Compiler API is probably what I want, but I'm not clear on how I should be using it. How do I make something that I can pass to the nim compiler? Can I call it from a macro?
13:36:26*rockcavera joined #nim
13:36:26*rockcavera quit (Changing host)
13:36:26*rockcavera joined #nim
13:37:36FromDiscord<haxscramper> sent a code paste, see https://paste.rs/Oqf
13:37:53FromDiscord<haxscramper> I think there is a smaller solution, I just copied it from one of my earlier tests
13:39:17FromDiscord<haxscramper> so you just write macro that is a separate program
13:39:39FromDiscord<haxscramper> then it can read file, transform it as necessary and then execute actual nim compiler
13:40:43FromDiscord<tandy> my documentation builds keep failing, could someone have a look?↵https://gitlab.com/tandy1000/lastfm-nim/-/jobs/1363704575
13:41:18FromDiscord<dsrw> Interesting. I assume I'd lose line numbers though? If I added anything at least? Or is there some way to make it add `{.line:.}` pragmas to the output?
13:42:33FromDiscord<dsrw> Either way, that's really helpful. I think I can probably figure out something that doesn't add additional lines.
13:45:26FromDiscord<dsrw> If nothing else, I imagine I could add `{.line:.}` to the AST myself.
13:46:11FromDiscord<dsrw> (edit) "`{.line:.}`" => "`{.line:.}:`"
13:46:32FromDiscord<dsrw> I'll look into that some more. Thanks!
13:47:35FromDiscord<haxscramper> In reply to @dsrw "Interesting. I assume I'd": you can add whatever you want to the output
13:47:50FromDiscord<haxscramper> `PNode` has `.info` field that contains all line numbers
13:47:59ozzzdom96: thanks! Can I re-compile from source using choosenim, in case if symantec still will block binaries?
13:49:01FromDiscord<planetis> macros newNimNode has a lineinfo param
13:49:49FromDiscord<haxscramper> In reply to @dsrw "Interesting. I assume I'd": Well, also self-promotion - I have hnimast library https://github.com/haxscramper/hnimast that makes it easier to work with compiler nodes, to the extent where you can write code that runs for both `NimNode` and `PNode` with no changes
13:50:07FromDiscord<haxscramper> E.g. you can write macro that would both work at compile-time or can be used at runtime
13:50:15FromDiscord<haxscramper> Also `quote do` for `PNode`
13:51:09FromDiscord<haxscramper> I provided an example that does not depend on it, but `parsePNodeStr` is implemented in `hnimast/pnode_parse`
13:51:10FromDiscord<planetis> nice
13:51:12FromDiscord<planetis> after touching PNodes some time ago, I did feel like normal macros are a bit limiting
13:51:57FromDiscord<dom96> ozzz: you can select a source-based build of Nim using choosenim, but choosenim won't touch it (so any compilation you need to do yourself).
13:52:12FromDiscord<dom96> Please report those binaries as not a virus in symantec if you can
13:52:31FromDiscord<Rika> cant you make choosenim install latest nightly? choosenim compiles that i believe
13:52:48FromDiscord<dom96> yes, you can
13:53:04ozzzgreat, thanks a lot
13:53:06FromDiscord<Zachary Carter> In reply to @bung87 (Bung) "So what’s the recommand": The recommended way is not to :)
13:53:28FromDiscord<Zachary Carter> I would just avoid async tbh
13:53:43FromDiscord<Zachary Carter> Or roll your own scheduler and coros
13:53:48ozzzdom96: I already reported. They are slow
13:53:56FromDiscord<haxscramper> In reply to @haxscramper "I provided an example": And `treeRepr` v2.0
13:53:57FromDiscord<Zachary Carter> If you really want coroutines
13:54:07FromDiscord<Zachary Carter> Threads are good and fine
13:54:11FromDiscord<dsrw> @hexscramper Nice. Really nice. Thank you. I think that's exactly what I was looking for.
13:54:31FromDiscord<dom96> In reply to @Zachary Carter "The recommended way is": Lies. The recommended way is to do it the way httpbeast does.
13:54:51FromDiscord<dom96> And you can still mix threads and async
13:54:56FromDiscord<dsrw> (edit) "@hexscramper" => "@haxscramper "
13:55:23FromDiscord<haxscramper> In reply to @dsrw "<@!608382355454951435> Nice. Really": If you have any questions of feature requests - feel free to ask
13:55:24FromDiscord<dom96> But the answer @Bung really depends on why you want to mix threads and async
13:55:31FromDiscord<Zachary Carter> Of course you cab
13:55:33FromDiscord<Zachary Carter> Can
13:55:53FromDiscord<Zachary Carter> But I wouldn't do it with Nims async module
13:56:12FromDiscord<Zachary Carter> Or thread pool module
13:56:14supakeenWhy the recommendation against it, Zachary?
13:56:21supakeen(those)
13:58:01FromDiscord<Zachary Carter> Thread pool is buggy afaik. Async is constantly under scrutiny for various implementation details. There's often talk of replacing it with something else
13:58:25supakeenAh the second bit is still ongoing (I'm returning to Nim after a bit of a break).
13:58:38FromDiscord<Zachary Carter> Also red / blue functions suck
13:58:42nixfreak_nim[m]I have two files that "I think" are exactly the same , one was coded on Emacs the other neovim , one compiles and one errors out on assert. I don't know why and have started at both of them for awhile now. https://play.nim-lang.org/#ix=3qEq
13:59:10nixfreak_nim[m] * I have two files that "I think" are exactly the same , one was coded on Emacs the other neovim , one compiles and one errors out on assert. I don't know why and have stared at both of them for awhile now. https://play.nim-lang.org/#ix=3qEq
13:59:11supakeenThat they do :)
13:59:14FromDiscord<Zachary Carter> Which is another reason to steer clear of async await
13:59:40FromDiscord<dom96> Please if you're going to discourage use of async, give explicit reasons. "constantly under scrutiny" sounds like spreading FUD
13:59:50supakeenOn the other hand it is an OK fit for a lot of workloads and perhaps some runSync-primitives make things a lot easier.
14:00:04supakeenLast I looked those existed (I wrote somet testcases for http and asyncFtp I believe?)
14:00:15supakeenOh, asyncHttpServer it was.
14:00:23FromDiscord<dom96> It's frustrating for me because I can't argue against those kinds of things 🙂
14:00:43FromDiscord<Zachary Carter> It is! I'm on my phone so I'm not going to dig up GitHub issues, but there is always talk about issues with async, and it's also the reason there's ba hard fork right?
14:00:51supakeenSpeaking of, I should take a look at that pr I chatted a lot about with dom96 and see what its state is.
14:03:37FromDiscord<dom96> > there is always talk about issues with async↵Maybe I'm blind, but I haven't seen talk of issues in this channel at least for a long time, past month?
14:03:44FromDiscord<dom96> but really, saying stuff like this isn't objective at all
14:04:15FromDiscord<dom96> what matters is whether async is preventing you from implementing something you want to implement and I want to hear about that
14:04:42FromDiscord<Zachary Carter> Well again it's my opinion
14:04:54FromDiscord<Zachary Carter> And recommendation 😀
14:04:56FromDiscord<dom96> The reason there is a fork is because Status wanted to move faster, we've adopted a lot of the fixes
14:05:07FromDiscord<Zachary Carter> I'm sure everyones mileage will vary
14:05:18nixfreak_nim[m] * I have two files that "I think" are exactly the same , one was coded on Emacs the other neovim , one compiles and one errors out on assert. I don't know why and have stared at both of them for awhile now. https://play.nim-lang.org/#ix=3qEq, could someone just take a quick look to see what I am screwing up? Trying to dial in Doom-Emacs so I can use it for my primary coding.
14:05:38FromDiscord<dom96> Yes, and I will challenge anyone that makes that recommendation to back it up with real frustrations they've had with async
14:05:41FromDiscord<Zachary Carter> I don't touch it because I think there are better ways to do async io
14:05:52FromDiscord<Zachary Carter> And I encountered issues in the past
14:05:52FromDiscord<dom96> so that I can either say "That's not true" or "cool, we need to fix that"
14:06:15FromDiscord<Zachary Carter> But I also haven't touched the module in over a year
14:06:58FromDiscord<dsrw> @nixfreak Line 15. You're assigning both `username` and `message` to the `username` field.
14:08:06FromDiscord<vindaar> and in addition to that in one file there's `\c\1` and in the other only `c\1`
14:08:24FromDiscord<vindaar> (since you're already using emacs, use `ediff-buffers` for this)
14:09:28FromDiscord<dom96> I'm more and more excited to finish combining threadpool/channels and async together. I don't really need it myself so it's tough to stay motivated.
14:09:55FromDiscord<dom96> But just to be able to say that it's possible would be awesome
14:10:35supakeenIt should be doable, Python has some related bits like run_in_executor and such.
14:11:03FromDiscord<dom96> yeah, the biggest blocker for this sort of thing has always been the thread-local GCs, but with ARC/ORC this shouldn't be a problem.
14:13:44FromDiscord<Zachary Carter> I think a work stealing job system using threads would be better
14:13:52FromDiscord<Zachary Carter> For async IO
14:14:21FromDiscord<dom96> that's effectively goroutines right?
14:14:26FromDiscord<Zachary Carter> No red/blue functions and all you need are threads
14:14:43FromDiscord<Zachary Carter> No goroutines are green threads like fibers
14:14:57FromDiscord<Zachary Carter> A work stealing job system would use system threads
14:15:13FromDiscord<dom96> goroutines use system threads too
14:15:42FromDiscord<gemath> Threads are inefficient for non-CPU-intensive tasks like IO IMHO.
14:16:14FromDiscord<dom96> It's really important to define what we mean, spawning a thread per connection is indeed inefficient
14:16:21FromDiscord<dom96> but you need threads to utilise all cores
14:18:05FromDiscord<gemath> Yes, that's what I meant. High granularity threading has too much overhead.
14:19:23FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3qEv
14:19:55*DrWhax joined #nim
14:20:06FromDiscord<@bracketmaster-5a708063d73408ce4> sent a code paste, see https://play.nim-lang.org/#ix=3qEw
14:20:18FromDiscord<dom96> That code sample is coming through really poorly
14:20:27FromDiscord<@bracketmaster-5a708063d73408ce4> let me try again
14:20:35FromDiscord<dom96> just post a link to pastebin or gist please
14:21:01FromDiscord<dom96> It boggles my mind why these bridges are still so full of bugs
14:21:09FromDiscord<Zachary Carter> Again work stealing is the key
14:21:29FromDiscord<Zachary Carter> In reply to gemath
14:21:29FromDiscord<dom96> work-stealing sounds like just a type of thread pool
14:21:42FromDiscord<dom96> it's part of the story, you need to do IO somehow too
14:22:59FromDiscord<Zachary Carter> G2g, bout to get on a plane
14:23:07FromDiscord<dom96> see you!
14:24:03FromDiscord<@bracketmaster-5a708063d73408ce4> https://gist.github.com/BracketMaster/f3a3caaa8c0327676fd91e8678e2c735
14:24:03FromDiscord<vindaar> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: don't name the file the same name as an object / type in it
14:24:15FromDiscord<@bracketmaster-5a708063d73408ce4> @vindaar\:matrix.org - why not?
14:24:36FromDiscord<gemath> work-stealing is just a strategy we can use to assign tasks to threads in a pool.
14:24:36FromDiscord<vindaar> because you get errors like the one you get
14:24:36FromDiscord<@bracketmaster-5a708063d73408ce4> That was a really common programming patter in Python
14:24:48FromDiscord<vindaar> but Nim is not Python ;)
14:24:54FromDiscord<@bracketmaster-5a708063d73408ce4> Is it against nim spec?
14:25:18FromDiscord<dom96> Nim should be more like Python in this case ;D
14:26:20FromDiscord<vindaar> maybe, but it isn't and I don't see it changing soon↵(@dom96)
14:26:21FromDiscord<gemath> we still should prefer async for high-granularity io.
14:26:22FromDiscord<dom96> but nothing stops you from doing this, from what I can see the behaviour you see makes sense
14:26:33FromDiscord<@bracketmaster-5a708063d73408ce4> what I've resorted to doing is `var myparent`
14:26:48FromDiscord<@bracketmaster-5a708063d73408ce4> which just reminds me of java all over again
14:26:55FromDiscord<dom96> you've imported `parent` via `import parent` which indeed is different in Nim
14:27:02FromDiscord<dom96> it's the same as `from parent import `
14:27:17FromDiscord<dom96> try `from parent import nil`
14:34:36*PMunch quit (Quit: leaving)
14:34:59FromDiscord<@bracketmaster-5a708063d73408ce4> importing `nil` not really working
14:35:30FromDiscord<@bracketmaster-5a708063d73408ce4> `from parent import parent` also doesn't seem to really work...
14:40:44FromDiscord<dom96> hm, that should work
14:42:05FromDiscord<dom96> I would say it's a bug, but it is true that in general these kinds of bugs don't get a lot of priority so you might be fobbed off if you report it 🙂
14:43:04FromDiscord<@bracketmaster-5a708063d73408ce4> I'm sure as I work more with nim internals - I'll probably be able to fix it
14:43:08FromDiscord<@bracketmaster-5a708063d73408ce4> and make a pull request
14:43:13FromDiscord<@bracketmaster-5a708063d73408ce4> so lets say in a year or so
14:43:29FromDiscord<dom96> Sure, probably not too difficult tbh
14:43:33FromDiscord<dom96> Do report it and CC me in the issue
14:50:18FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3qEE
14:51:02FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3qEG
14:54:30FromDiscord<KJ> how do I use a variable from another nim file. I have the file `constants.nim` with a constant in it called TOKEN. I though I was just able to import it in my `main.nim` with `import constants` and then just use the TOKEN variable but clearly not. I tried looking online and I couldn't see anything. Is anyone able to help me out?
14:54:47FromDiscord<Rika> you need to export it if you havent
14:55:01FromDiscord<Rika> `let TOKEN =...` see asterisk
14:55:40FromDiscord<KJ> i see
14:55:51FromDiscord<@bracketmaster-5a708063d73408ce4> also, apparently, as per above, the variable can't have the filename
14:55:54FromDiscord<KJ> should I be using let or const
14:56:08FromDiscord<@bracketmaster-5a708063d73408ce4> const if for compile time evaluation
14:56:28FromDiscord<@bracketmaster-5a708063d73408ce4> let is to let the compiler know variable shouldn't be mutated during runtime
14:58:23FromDiscord<mlokis> the priority of usage is const > let > var (is you can use const don't use let and so on)
14:58:54FromDiscord<haxscramper> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\:
14:59:04FromDiscord<haxscramper> https://stackoverflow.com/questions/64515076/what-is-the-significance-of-uppercase-file-names/64515178#64515178 for similar issue see this question
14:59:19FromDiscord<haxscramper> Well, just for an explanation of what is goin on
15:00:11FromDiscord<@bracketmaster-5a708063d73408ce4> yeah
15:00:30FromDiscord<@bracketmaster-5a708063d73408ce4> so I usually avoid that by making files lowercase, and types uppercase
15:00:39FromDiscord<@bracketmaster-5a708063d73408ce4> I get into trouble cuz I usually make vars lowercase
15:09:49FromDiscord<pietroppeter> the typical pattern you see around in nim is to have the filename plural (e.g. parents) and the type/object inside will be singular (Parent/parent)
15:10:15FromDiscord<@bracketmaster-5a708063d73408ce4> oh?
15:10:22FromDiscord<@bracketmaster-5a708063d73408ce4> didn't now that
15:11:00FromDiscord<@bracketmaster-5a708063d73408ce4> \\know
15:13:34FromDiscord<Juan_Carlos.nim> This is Godot official poll, would be great to vote for Nim\: ↵https://docs.google.com/forms/d/e/1FAIpQLSfwqkkwxS1PO1ubNzALkNe3pU4pwijbqI8qREYDnEarM6tk4A/viewform
15:21:29FromDiscord<zetashift> Of course rust is the biggest one
15:22:11FromDiscord<bung87 (Bung)> @dom96 the way httpbeast is not adaptable with other lib
15:22:32FromDiscord<@bracketmaster-5a708063d73408ce4> why isn't nim more popular
15:22:49FromDiscord<@bracketmaster-5a708063d73408ce4> I wonder if crystal or nim is more popular
15:23:11FromDiscord<bung87 (Bung)> no fulltime developers
15:23:27FromDiscord<@bracketmaster-5a708063d73408ce4> Araq isn't fulltime?
15:24:02FromDiscord<bung87 (Bung)> he is empolyed
15:26:25FromDiscord<dom96> In reply to @bung87 (Bung) "@dom96 the way httpbeast": what do you mean?
15:26:33FromDiscord<dom96> it works fine with all async libs
15:27:17FromDiscord<dom96> and yes, there are full-time devs working on Nim
15:27:44FromDiscord<zetashift> In reply to @@bracketmaster-5a708063d73408ce4 "I wonder if crystal": Nim! Crystal can't really compete until they have multithreading and full Windows support
15:27:48FromDiscord<zetashift> but they are working on it tho
15:28:21FromDiscord<@bracketmaster-5a708063d73408ce4> I also can only build Crystal for x86 at the moment
15:28:41FromDiscord<@bracketmaster-5a708063d73408ce4> Which is an issue - I do development on POWER9 or Apple silicon
15:28:43FromDiscord<dom96> the reason Nim isn't more popular is simple: we don't have a Google or a Microsoft behind us
15:28:50FromDiscord<zetashift> or Mozilla
15:28:50FromDiscord<@bracketmaster-5a708063d73408ce4> basically exclusively
15:29:06FromDiscord<bung87 (Bung)> @dom96 as last time I asked you said I should go to chronos for help
15:29:25nixfreak_nim[m]I have two files that "I think" are exactly the same , one was coded on Emacs the other neovim , one compiles and one errors out on assert. I don't know why and have stared at both of them for awhile now. https://play.nim-lang.org/#ix=3qEq, could someone just take a quick look to see what I am screwing up? Trying to dial in Doom-Emacs so I can use it for my primary coding. (edited)
15:29:31FromDiscord<dom96> huh? you were asking for help with your http server that uses chronos
15:30:02FromDiscord<bung87 (Bung)> it's not like goroutine just call go with that lib api calls
15:30:58FromDiscord<randyr> In reply to @nixfreak_nim "I have two files": In one file I see c\1 and in the other \c\1?
15:31:23FromDiscord<dom96> In reply to @bung87 (Bung) "it's not like goroutine": are you referring to function colour?
15:32:23FromDiscord<bung87 (Bung)> looks like line breaks, they are same thing
15:33:38nixfreak_nim[m]<FromDiscord "<randyr> In reply to @nixfreak_n"> Damn I bet that’s it , thank you
15:36:59FromDiscord<dom96> @Bung87 can you elaborate?
15:37:44federico3https://github.com/nim-lang/Nim/wiki some "Nim for Go/Rust programmers" pages could help
15:38:19*aeverr quit (Ping timeout: 244 seconds)
15:41:29FromDiscord<bung87 (Bung)> like I have processRequest(), I may simply `go processRequest(request)` in go
15:41:33*Vladar quit (Quit: Leaving)
15:42:03FromDiscord<bung87 (Bung)> it's just one line
15:44:03FromDiscord<dom96> yeah, and Go does a lot in the background for you. Similar to how httpbeast does a lot for you too.
15:44:04*aeverr joined #nim
15:44:19FromDiscord<dom96> What's your motivation for writing a new http server?
15:46:01FromDiscord<bung87 (Bung)> hmm create a framework that provide apis I feel confortable I think.
15:48:25FromDiscord<dom96> why not do that on top of an existing http server like httpbeast?
15:48:58FromDiscord<Terminus Est> you can run it first without awaiting it immediately in nim async, this is same with go, you either have to use waitgroup or use channel and have it block until you got something from processRequest
15:49:53FromDiscord<Terminus Est> also, while you can await, doesn't necessarily you have to immediately await, let it run in the background during io operation, and just await when you need the result
15:50:09FromDiscord<bung87 (Bung)> in that time I dont understand how httpbeast works, I starting by porting asynchttpserver to chronos version
15:51:18FromDiscord<Terminus Est> i don't understand the async/await concept first and had hard time to wrap around how to work with it, but after using it several times, it's really nice actually
15:52:40FromDiscord<bung87 (Bung)> well , single thread has limit performance, my server performance well in single thread, I need multi threads for better
15:53:19FromDiscord<Terminus Est> have threads to work with data, have a single threads for pooling the io
15:54:58FromDiscord<bung87 (Bung)> I tried use channel send and receive but fails
15:59:09FromDiscord<Terminus Est> can't say much about channel, but the alternative could be sharedtable, although you'd deal with mutex, but there's guard pragma too to ease its use
16:00:11FromDiscord<dom96> honestly httpbeast is probably the ideal for a web app that wants to be performant
16:00:20FromDiscord<dom96> so I don't know why you don't want to use it
16:02:57FromDiscord<randyr> sent a code paste, see https://play.nim-lang.org/#ix=3qFe
16:03:06FromDiscord<bung87 (Bung)> maybe I'll use that pattern in my framework.
16:04:44FromDiscord<haxscramper> In reply to @Randall "I have a bad": Maybe you can hash input string and then use case-of on hash to map it to correct output.
16:04:52FromDiscord<bung87 (Bung)> I have not seen code use sharedtable , guess there's performance trade off , If I can I'd prefer use the pattern httpbeast use.
16:05:08FromDiscord<dom96> why not just use httpbeast?
16:06:11FromDiscord<randyr> In reply to @haxscramper "Maybe you can hash": Since this code will run in the middle of tokenization, I don't know ahead of time how long the entity is. So it the string could be e.g. "&AMPere;" and it should match "&AMP"
16:06:34FromDiscord<bung87 (Bung)> but my framework provide more features, If I use httpbeast I only get handleRequest api
16:06:42FromDiscord<dom96> what features?
16:07:21FromDiscord<bung87 (Bung)> I process all message use chronos stream api
16:07:50FromDiscord<bung87 (Bung)> I have router
16:08:13FromDiscord<dom96> There is nothing stopping you building this stuff on top, Jester does it this way
16:08:27FromDiscord<dom96> prologue does it this way too
16:08:36FromDiscord<haxscramper> In reply to @Randall "Since this code will": Then you can generate code, or use chain of `array[char, Handler]` and traverse it like a linked list, choosing next node each time using an array
16:08:37FromDiscord<Hugo Ribeiro> We are not bad
16:08:53FromDiscord<randyr> sent a code paste, see https://play.nim-lang.org/#ix=3qFh
16:09:16FromDiscord<bung87 (Bung)> okay, think I'd look more deep to httpbeast
16:09:48FromDiscord<dom96> great, and I can then answer any questions you might have 🙂
16:10:44FromDiscord<haxscramper> Though array-list solution would be slower than codegen
16:11:02FromDiscord<haxscramper> And your iterative lookup would be the easiest to implement
16:11:42FromDiscord<haxscramper> So depending on the speed requirements etc, I would suggest to go with your iterative lookup first and then go straight to codegen if it is not fast enough
16:11:43FromDiscord<randyr> Yeah it would be easiest to implement and understand. It could even cut down the search range by first checking ahead for a `;` character
16:12:12FromDiscord<randyr> (or any non-name character)
16:13:00FromDiscord<haxscramper> Also I'm no expert, but I think my solution would be horrible for cache performance, since it has to read values from 256-element arrays, multiple times
16:13:48FromDiscord<bung87 (Bung)> cool , then performance is guaranteed.
16:14:04FromDiscord<randyr> Yeah linked lists are typically quite heavy on cache misses
16:14:32FromDiscord<randyr> I did find another data structure, the HAT trie that claims to be a more CPU cache friendly form of trie
16:15:15FromDiscord<randyr> For that matter, the std/critbits module could also be used, but the tree cannot be computed at compile time.
16:17:44*stkrdknmibalz joined #nim
16:33:54*Gustavo6046 quit (Ping timeout: 264 seconds)
16:34:28*Gustavo6046 joined #nim
16:40:21FromDiscord<randyr> The code generation seems to work. Takes 4821 LOC and about half a second to compile, but it works.
16:41:31*supakeen quit (Remote host closed the connection)
16:41:55*supakeen joined #nim
16:47:08*Torro quit (Quit: leaving)
17:15:12*Vladar joined #nim
17:40:05*jkl joined #nim
18:05:39*ayyy_lmao joined #nim
18:16:28FromDiscord<bung87 (Bung)> @dom96 I can directly built upon httpbeast use chronos ? chronos use its own selectors and dispatchers
18:20:18FromDiscord<bung87 (Bung)> Future also its own.
18:26:51*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
18:31:12*Gustavo6046 joined #nim
18:37:22FromDiscord<dom96> I don’t think you can. But why would you want to?
18:37:27*SebastianM joined #nim
18:47:16*xet7 quit (Remote host closed the connection)
18:49:17*xet7 joined #nim
18:54:26FromDiscord<bung87 (Bung)> then my existed code not useable
18:59:50*supakeen quit (Remote host closed the connection)
19:00:13*supakeen joined #nim
19:02:41*SebastianM quit (Quit: Bye)
19:30:38*Vladar quit (Quit: Leaving)
19:31:47dmuDoes anyone know if there a way, when doing a "nimble install x" for the first time, to not have it prompt for "No local packages.json found, download it from internet"? It's keeping me from automating a docker build that installs nimble packages
19:32:57FromDiscord<leorize> `--accept`
19:33:25dmuGreat, thanks
19:35:47FromDiscord<Hi02Hi> there is also `-y`
19:40:45*Gustavo6046_ joined #nim
19:41:24*Gustavo6046 quit (Ping timeout: 252 seconds)
19:43:06*Gustavo6046_ is now known as Gustavo6046
19:58:21*SebastianM joined #nim
19:58:44*SebastianM quit (Client Quit)
20:18:09*supakeen quit (Remote host closed the connection)
20:18:32*supakeen joined #nim
20:20:31*xet7 quit (Quit: Leaving)
20:20:51*xet7 joined #nim
20:27:35*xet7 quit (Remote host closed the connection)
20:40:36*xet7 joined #nim
20:47:32*Gustavo6046_ joined #nim
20:47:32*Gustavo6046_ quit (Write error: Connection reset by peer)
20:47:48*Gustavo6046_ joined #nim
20:48:35*Gustavo6046 quit (Ping timeout: 268 seconds)
20:52:59*Gustavo6046 joined #nim
20:54:14*Gustavo6046_ quit (Ping timeout: 268 seconds)
20:59:13FromDiscord<k1tt3hk4t> Is there any way to hide the internal definition of a type with nim's docgen?
20:59:33FromDiscord<k1tt3hk4t> in the case that all the fields are private and not really relevant to end-users anyways
21:00:15*Gustavo6046 quit (Ping timeout: 258 seconds)
21:02:02FromDiscord<Zachary Carter> In reply to @bung87 (Bung) "then my existed code": Could always add an additional impl to httpbeast that relies on chronos
21:03:01*Gustavo6046 joined #nim
21:31:58FromDiscord<dom96> or use async instead 🙂
21:50:16supakeendom96, have you looked at io_uring for httpbeast?
21:51:07FromDiscord<dom96> nope, but that is a good thought
21:51:20FromDiscord<dom96> I wonder if that's what the winners in TechEmpower use nowadays
21:51:35supakeenI've been kind of wanting to do some Nim again maybe I take a stab at some io_uring stuff, it is of course the future.
21:51:59supakeenBut that's for another day :)
21:53:08FromDiscord<dom96> IIRC io_uring is quite similar to Windows' IOCP, so we would need to integrate it at the asyncdispatch level in async/await
21:53:17FromDiscord<dom96> not sure it's worth the trouble
21:53:41FromDiscord<dom96> for httpbeast that would actually change the model quite significantly so it may require a completely different approach
23:08:15FromDiscord<@bracketmaster-5a708063d73408ce4> in modules in nested directories, I often do `import ../../somemodule`
23:08:16FromDiscord<@bracketmaster-5a708063d73408ce4> Does nim or nimble have support for patterns such as `import src/something/somemodule`?
23:11:31FromDiscord<Elegant Beef> if you have a proper folder directory it should be `something/submodule` afaik
23:11:50FromDiscord<Elegant Beef> Though i could be wrong
23:12:31FromDiscord<@bracketmaster-5a708063d73408ce4> this for example\: https://github.com/BracketMaster/nimulatorPPC/blob/main/src/membus/devices/ram.nim#L8
23:14:05FromDiscord<Elegant Beef> Well this doesnt follow the "proper" nimble directory, so i dont know, ideally it goes `src/nimulatorppc/subdirectories`
23:14:22FromDiscord<@bracketmaster-5a708063d73408ce4> oh - I did not know that
23:15:18FromDiscord<Elegant Beef> Ah guess i'm wring, just, tested with my project and yea didnt import properly 😀
23:15:18FromDiscord<@bracketmaster-5a708063d73408ce4> even with the proper nimble sub-directory and all?
23:15:19FromDiscord<Elegant Beef> Ah guess i'm wrong, just, tested with my project and yea didnt import properly 😀
23:16:11FromDiscord<Elegant Beef> Yea
23:19:51FromDiscord<vindaar> it does work if the project layout is "correct"
23:19:55FromDiscord<vindaar> look at arraymancer's layout
23:20:04FromDiscord<Elegant Beef> Might only work for a library though
23:20:24FromDiscord<Elegant Beef> I have a binary project and it didnt work
23:20:32FromDiscord<vindaar> importing submodule here\: https://github.com/SciNim/Datamancer/blob/master/src/datamancer/formula.nim#L11
23:20:37FromDiscord<vindaar> hm, maybe yes
23:21:00FromDiscord<Elegant Beef> image.png https://media.discordapp.net/attachments/371759389889003532/856675099499561020/image.png
23:21:11FromDiscord<Elegant Beef> My evidence for my argument 😛
23:21:26FromDiscord<vindaar> haha, I did believe you ;)
23:26:08FromDiscord<@bracketmaster-5a708063d73408ce4> @beef331\:matrix.org \: are you writing shaders in nim?
23:27:24FromDiscord<Elegant Beef> I'm presently toying around with raymarching
23:27:37FromDiscord<@bracketmaster-5a708063d73408ce4> are you using any libraries to help accelerate compute?
23:28:05FromDiscord<Elegant Beef> It's gpu based, so opengl \:P
23:28:05FromDiscord<@bracketmaster-5a708063d73408ce4> I briefly tried my hand at rasterizing actually\: https://github.com/BracketMaster/nimRasterizer
23:28:05FromDiscord<@bracketmaster-5a708063d73408ce4> ah
23:28:25FromDiscord<@bracketmaster-5a708063d73408ce4> well, working with rays in openGL can be a pain
23:28:28FromDiscord<@bracketmaster-5a708063d73408ce4> that's why I asked
23:29:00FromDiscord<Elegant Beef> Well currently the more annoying thing seems to be uniform buffer objects' api
23:29:08FromDiscord<Elegant Beef> You need to use strings it seems to query offsets
23:30:03FromDiscord<@bracketmaster-5a708063d73408ce4> are you using Mesa's OpenGL?
23:30:41FromDiscord<Elegant Beef> Dont know what you mean by that \:D
23:30:42FromDiscord<@bracketmaster-5a708063d73408ce4> seems nimGL is largely platform agnostic
23:31:04FromDiscord<@bracketmaster-5a708063d73408ce4> I'm wondering which GL implementation you're using
23:31:09FromDiscord<@bracketmaster-5a708063d73408ce4> there are several
23:31:25FromDiscord<@bracketmaster-5a708063d73408ce4> On Linux, the most popular is Mesa for example
23:31:34FromDiscord<Elegant Beef> Ah, then yea mesa
23:31:41FromDiscord<Elegant Beef> Those are details i dont care about 😛
23:31:50FromDiscord<@bracketmaster-5a708063d73408ce4> anyways - it doesn't really matter - as per the GL spec, all implmentation should be providing roughly the same header file