<< 19-08-2023 >>

00:01:53arkanoidI never stepped into writing web frontends starting from "low-level" html, but always via high level components and stuff (because I'm lazy, and also because I hated the web scene when it was js only). What's the more ergonomic way to get bi-directional web app with ready-to-use component blocks and stuff like that, with nim?
00:02:30arkanoidwith python I'd use streamlit or stuff like that, that let's me write a single codebase for both parts. Is there anything like this in nim?
00:10:01FromDiscord<jviega> Or else I'm doing it wrong.
00:11:06FromDiscord<jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DUA
00:14:35FromDiscord<Elegantbeef> Is redeclaring a destructor a static error or a silent error?
00:14:43FromDiscord<jviega> It's two different programs
00:14:54FromDiscord<Elegantbeef> Right but I'm implying Nim declares one
00:15:03FromDiscord<jviega> No you can declare multiple ones and set priorities
00:17:43FromDiscord<jviega> `attribute((destructor(101))` sets the priority to 101 (everything has to be over 100, anything lower is reserved)
00:21:41FromDiscord<jviega> Odd, I don't even see it generated when I disassemble the debug version??
00:22:30FromDiscord<Elegantbeef> Nim's dead code elimination
00:22:50FromDiscord<Elegantbeef> throw `exportc` on there
00:24:02FromDiscord<jviega> No, cdecl
00:24:07FromDiscord<jviega> It's the calling convention
00:24:12FromDiscord<Elegantbeef> What?
00:24:20FromDiscord<Elegantbeef> It's not the calling convention
00:24:31FromDiscord<Elegantbeef> Linux is cdecl anyway
00:24:32FromDiscord<jviega> I don't need exportc, it works fine w/ just cdecl
00:24:50FromDiscord<Elegantbeef> No it doesnt
00:25:16FromDiscord<jviega> On my mac it does anyway. Either works.
00:25:20FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1142252928023928913/image.png
00:25:24FromDiscord<jviega> I've tried it all 3 ways
00:25:42FromDiscord<jviega> But no worries, I trust you, exportc it is 🙂
00:25:47FromDiscord<Elegantbeef> Just use exportc to skip Nim's dead code elimination 😄
00:25:49FromDiscord<jviega> Thanks for the ear
00:25:58FromDiscord<Elegantbeef> Really though you could make a pragma to make this cleaner
00:26:08FromDiscord<Elegantbeef> But who needs that many destructors
00:26:54FromDiscord<jviega> Well, right, it's fine to have it be ugly, but wouldn't be a bad idea to have pragmas in the std library to make it easy for people to do it if they need to
00:27:20FromDiscord<Elegantbeef> The issue with pragmas is you cannot export them
00:27:33FromDiscord<Elegantbeef> Actually maybe you can... hmmm
00:27:57FromDiscord<jviega> If you exportc you automatically get cdecl then?
00:28:42FromDiscord<Elegantbeef> nah you cannot sadly
00:28:58FromDiscord<Elegantbeef> You probably should do `exportc, cdecl`
00:29:05FromDiscord<Elegantbeef> But on Unix `cdecl` is `nimcall`
00:29:24FromDiscord<jviega> Got it. I assume stdcall on windows?
00:29:41FromDiscord<Elegantbeef> Fastcall or stdcall, don't recall
00:29:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DUC
00:30:44FromDiscord<jviega> I've actually found that if I've got cross-module dependencies that would make the code unclear to split up, I just break the need for a cyclic import with an importc, works pretty well 🙂
00:30:55FromDiscord<jviega> Yeah, that's super nice
00:31:51FromDiscord<Elegantbeef> I dumbly just reach for generics for breaking up cycles
00:32:05FromDiscord<Elegantbeef> Generics really are a form of dependency injection that allow you to break module cycles
00:32:40FromDiscord<Elegantbeef> I say I dumbly do that, but I havent actually done that, I've thought about it a tinge
00:33:28FromDiscord<jviega> Yeah, really in C it's never a problem due to header files, and even if I didn't have a header file, a simple "extern" would do the trick. Maybe I should sugar the thing... 50K lines of code later, I've had to do it a few times
00:34:07FromDiscord<jviega> Anyway, thanks again, helpful as ever.
00:34:30FromDiscord<Elegantbeef> No problem, you mostly solved the problem 😛
00:37:01FromDiscord<jviega> Yeah, still helpful; if you hadn't given me hope I would have .emit'd the C, found that it worked, and lived with that.
00:45:48FromDiscord<etra> In reply to @Elegantbeef "They're all added to": I'm confused, because it's spawning them but they shouldn't get any cpu until you await them? and since it awaits them in order how is that not the same as a simple synchronous for loop
00:45:55FromDiscord<etra> unless there's a background polling thread
00:46:32FromDiscord<Elegantbeef> Await gives up the CPU to handle any presently pooled futures afaik
00:52:35*tam joined #nim
01:08:17FromDiscord<m4ul3r> Is there a way to get the time at compile in nim similar to `TIME` macro in cpp? https://media.discordapp.net/attachments/371759389889003532/1142263735235391510/image.png
01:08:36FromDiscord<m4ul3r> (edit) "cpp?" => "cpp?↵can't use now because `cannot evaluate at compile time: localInstance`"
01:12:05FromDiscord<m4ul3r> nvm, i'm just dum https://nim-lang.org/docs/system.html#CompileTime
01:12:28FromDiscord<m4ul3r> (edit) "nvm, i'm just dum ... https://nim-lang.org/docs/system.html#CompileTime" added ":smooth: "
01:34:11FromDiscord<System64 ~ Flandre Scarlet> I don't understand why profiling give me irrevelent lines
01:51:43*jmcantrell left #nim (WeeChat 4.0.3)
01:57:16*tam quit (Ping timeout: 256 seconds)
01:58:17dithprihuh I missed the 2.0 release
01:58:19*tam joined #nim
01:58:23dithpris/2.0/2.0.0
01:58:31*tam quit (Client Quit)
01:59:45FromDiscord<heysokam> is there something like `FILE`, and `LINE` from C, but in Nim that gives the same info with correct data from nim introspection?
02:00:27FromDiscord<heysokam> I figure i could wrap those, but then I would access the C backend information, right? 🤔
02:01:49FromDiscord<Elegantbeef> There is the `line` pragma
02:03:34FromDiscord<juan_carlos> https://nim-lang.github.io/Nim/macros.html#lineInfoObj%2CNimNode
02:21:25FromDiscord<jos7388> is there a nim implementation of btreemap?
02:30:01FromDiscord<jos7388> also, after getting `nimble develop` to work, vscode doesn't know how to load up the lib i was doing develop for
02:30:13FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1142284352034705488/image.png
02:30:26FromDiscord<jos7388> but the compiler is fine
02:30:35arkanoidwithout any index metric in nimble.directory, searching for the best library for the task is hard
02:32:05FromDiscord<jos7388> are u responding to me?
02:32:09FromDiscord<Elegantbeef> Close and restart vscode
02:32:29FromDiscord<jos7388> In reply to @Elegantbeef "Close and restart vscode": i did try that
02:32:33FromDiscord<jos7388> it doesn't seem to change anything
02:33:03FromDiscord<jos7388> i'm using the nimseam fork
02:34:53dithpriwhat's that
02:36:16FromDiscord<jos7388> it's the vscode extension i was told to install, after i had problems with another one
02:36:27FromDiscord<jos7388> the nimsaem one was updated in 2022, other one like 2020
02:36:40FromDiscord<Elegantbeef> Odd that it doesnt work
02:37:16FromDiscord<jos7388> tbh not surprised when you decouple all the configuration like i mentioned
02:37:19FromDiscord<jos7388> i knew this would happen
02:37:32FromDiscord<Elegantbeef> Lol
02:37:43FromDiscord<Elegantbeef> It uses the path in the pkgs
02:38:11FromDiscord<Elegantbeef> There should be no decoupling issues since it should emit a config like atlas ideally
02:38:28FromDiscord<jos7388> maybe i should switch to atlas then
02:38:32FromDiscord<jos7388> nimsuggest should read nim.cfg right
02:38:39FromDiscord<jos7388> no matter what that should work
02:38:47FromDiscord<Elegantbeef> Yes
02:39:45FromDiscord<jos7388> "Upcoming Nim version 2.0 will ship with atlas"
02:40:06FromDiscord<jos7388> dont think i got it with choosenim
02:40:16FromDiscord<Elegantbeef> You do it's not linked though
02:41:02FromDiscord<jos7388> do u happen to know where it's installed?
02:41:07FromDiscord<Elegantbeef> Choosenim wasnt updated to properly link it cause it's not a nim-lang repo apparently
02:41:19FromDiscord<Elegantbeef> should be `.choosenim/toolchain/nim-2.0.0/bin`
02:41:57FromDiscord<jos7388> oh sweet i found it
02:41:58FromDiscord<jos7388> thanks
02:42:07FromDiscord<jos7388> u know a lot about nim
02:43:31FromDiscord<Elegantbeef> What, no!
03:33:38*lucasta_ joined #nim
03:33:39*lucasta_ quit (Client Quit)
03:53:50*xet7 quit (Ping timeout: 245 seconds)
04:54:48FromDiscord<ShalokShalom (ShalokShalom)> He is our AI
04:54:54FromDiscord<ShalokShalom (ShalokShalom)> Nim\`s personalized AI with tutoring capabilities
05:28:59*junaid_ joined #nim
05:55:43*fallback quit (Ping timeout: 244 seconds)
06:03:54*fallback joined #nim
06:07:45FromDiscord<Phil> Okay is testament just buggy when it comes to when statements?
06:09:35FromDiscord<Phil> Well first things first, how do I get testament to not eat my echo statements, I'd like to debug-log but they're getting swallowed by testament and --verbose is not spitting them back out
06:09:57FromDiscord<Phil> I'm running ` exec "testament --verbose --print run tests/externalAPI/test_map_validation.nim"`
06:24:01FromDiscord<Phil> Okay no it's not testament, it's some absolutely weird fucking behaviour around macros
06:30:21FromDiscord<Phil> What in the...↵Uuuuuuugh it's because of test-paths that testament requires.↵That means when I `import mapster` it's not importing the project, it's importing from `~/.nimble/pkgs2` gnaaaaaa
06:31:29FromDiscord<Phil> Okay how do I change how a test file under `tests/externalAPI/test_map_validation.nim` imports its own source-code from the project?
06:34:56FromDiscord<Elegantbeef> `configs.nims` with a `path`
06:35:40FromDiscord<Phil> Does testament listen to config.nims as well?
06:35:55FromDiscord<Elegantbeef> It should since it compiles a nim file
06:36:46FromDiscord<Phil> For context: I currently have a fundamental trust issue because I was under the impression testament on its own would figure out that entire path situation since nothing hinted at that not being the case, so I'm currently assuming testament does everything in weird custom ways
06:37:32FromDiscord<Phil> Like heck, testaments own flipping docs and functionality demand that you put your tests into subdirectories of the tests directory rather than directly in it, that that breaks the entire path situation is super confusing
06:38:32FromDiscord<Phil> As for config.nims:↵`switch("path", "$projectDir/../src")`↵This is the default one and that looks like it should always work
06:44:31*jmdaemon joined #nim
06:47:20FromDiscord<jos7388> does UFCS not work with generics
06:47:22FromDiscord<jos7388> im trying to do
06:47:37FromDiscord<Elegantbeef> `bleh.proc[: T]()`
06:47:43FromDiscord<jos7388> why
06:47:59FromDiscord<Elegantbeef> `[T]` is ambiguous for `[](bleh.proc, T)`
06:49:07FromDiscord<Phil> Okay testament is just straight up broken I have to assume, it correctly encounters the project error'ing out at compile-time due to invalid validation, and the test just still fails because it starts comparing completely unrelated files to one another.↵Like wtf is this
06:50:46FromDiscord<jos7388> In reply to @Elegantbeef "`[T]` is ambiguous for": i dunno what this even means
06:51:05FromDiscord<jos7388> that means deref the tuple? [] is the deref operator, right?
06:51:10FromDiscord<Phil> And the worst part is I can't even test it normally with `compiles` because `compiles` breaks when the expression inside of it contains a pragma. Gnaaaaa
06:51:11FromDiscord<jos7388> and it's right associative?
06:51:13FromDiscord<Elegantbeef> `[]` is also array index
06:51:18FromDiscord<jos7388> \
06:52:17FromDiscord<jos7388> dunno somehow it still doesn't work
06:52:22FromDiscord<Elegantbeef> `[](bleh.proc, T) is how you write array access without syntax sugar, but the thing is `a.b[T]\` is considered array index
06:52:29FromDiscord<Elegantbeef> Whoops bad quote
06:52:59FromDiscord<Elegantbeef> Anyway point is `myObject.array[ind]` is preferred over `myObject.proc[T]` and as such `[: T]` is used
06:52:59FromDiscord<jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4DVR
06:53:04FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1142350502240206899/image.png
06:53:05FromDiscord<Elegantbeef> The hell
06:53:16FromDiscord<Elegantbeef> `DUiComponent[int].new)`
06:53:27FromDiscord<Elegantbeef> `DUiComponent[int].new()`
06:53:38FromDiscord<jos7388> oh its beacuse i'm using new
06:53:44FromDiscord<jos7388> weird
06:53:45FromDiscord<Elegantbeef> No
06:53:47FromDiscord<jos7388> it is
06:53:55FromDiscord<Elegantbeef> What you can alias new
06:53:55FromDiscord<jos7388> changing the name fixes the issue
06:54:08FromDiscord<jos7388> yea i did before
06:54:10FromDiscord<jos7388> without an issue
06:54:14FromDiscord<jos7388> but never with a generic
06:54:19FromDiscord<Elegantbeef> The issue is likely that you have no argument and are importing this module
06:54:38FromDiscord<Elegantbeef> As such `system.new` and this module's `new` are the same level
06:55:12FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1142351040679784489/image.png
06:55:13FromDiscord<jos7388> idk
06:55:59FromDiscord<Elegantbeef> Right the issue here is your generic parameter is not an int
06:56:18FromDiscord<Elegantbeef> The generic parameter of `DUiComponentData` is attached to that type
06:56:36FromDiscord<Elegantbeef> there is only a single generic parameter here
06:57:00FromDiscord<jos7388> DUiComponentData has no generic parameters
06:57:19FromDiscord<Phil> Beef? Any way that something does not compile other than `compiles()` and testament?
06:57:21FromDiscord<jos7388> it's just used to calculate some runtime data in the actual new impl
06:57:28FromDiscord<Phil> (edit) "Beef? Any way ... that" added "to test"
06:57:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DVS
06:57:47FromDiscord<jos7388> ye it's meant to be unparameterized
06:58:04FromDiscord<Elegantbeef> This works
06:58:04FromDiscord<Elegantbeef> Or just `MyObject[int].new()` without the `[T]` inside the proc
06:58:26FromDiscord<ajusa> Is the standard library threadpool any good? I feel like folks have told me that using `spawn` is a bad idea. If so, what's a good library to do this type of function parallelization? Is there anything more high level than creating raw threads?
06:58:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DVU
06:59:57FromDiscord<Elegantbeef> https://github.com/Araq/malebolgia is what araq suggests now
07:02:02FromDiscord<ajusa> Huh okay, I'll look into that. No flowvar, instead it has some weird syntax for awaiting a task and storing it in a variable
07:02:33FromDiscord<Elegantbeef> Otherwise weave and taskpools are the goto afaik
07:03:55FromDiscord<ajusa> This also requires Nim 2.0, will try status taskpool again. I feel like it didn't support returning strings when I looked at it before
07:04:10FromDiscord<Elegantbeef> Oh noes stable Nim! 😛
07:06:34FromDiscord<ajusa> I guess it's out, but I'll hold off on upgrading for a bit due to all of the changes. I'll probably wait a few months and verify that all the libs I normally use work as well
07:26:36FromDiscord<kyre58> @ElegantBeouf is nim the best programming language
07:27:07FromDiscord<Elegantbeef> This smells of LLM testing
07:27:26FromDiscord<kyre58> @ElegantBeouf what is LLM
07:27:38FromDiscord<Elegantbeef> No clue
07:28:02FromDiscord<kyre58> @ElegantBeouf you aren’t a bot :PokemonTangelaStare:
07:28:14FromDiscord<Elegantbeef> I sure hope not
07:28:39FromDiscord<Phil> sth sth everything is a simulation and testament is sucking my soul out sth sth
07:28:47FromDiscord<kyre58> @ElegantBeouf have you hacked Discord?
07:29:04FromDiscord<Elegantbeef> People really are the most confused about webhooks
07:29:18FromDiscord<Elegantbeef> No I'm using matrix and this discord server uses t2bot to bridge to matrix
07:29:35FromDiscord<Phil> Example of me (Phil) writing from matrix btw.
07:30:21FromDiscord<Elegantbeef> Nah he hacked discord
07:30:39FromDiscord<Phil> Ah when I do it suddenly it's hacking?
07:30:48FromDiscord<Elegantbeef> Of course
07:32:13FromDiscord<Phil> ... yknow what, I'll build my own mechanism for checking if a thing compiles, seems easier
07:52:11FromDiscord<.maverk> does nim programming language have asm keyword ?
07:53:13ehmry.maverk: no, but you can use emit to generate C code that does
07:53:34FromDiscord<.maverk> In reply to @ehmry ".maverk: no, but you": thanks
07:54:03FromDiscord<Phil> Hmm can you write nim-code to a file "in-memory" and compile that file?
07:55:30ehmryI think so, you could write a proc that returns a string of code and use that in {.emit.}
07:55:32FromDiscord<Phil> Basically I want to execute `nim c` on a string of nim-code to see if it compiles.↵The current path I see is write that nim-code to a file, execute nim c on that file, delete the file afterwards.↵I recall writing a file to memory being a thing, just wondering if that would be useable in this scenario
07:57:40ehmrynvm, I'm thinking of something else
07:58:15FromDiscord<.maverk> In reply to @ehmry ".maverk: no, but you": you are wrong
07:58:27FromDiscord<.maverk> nim does have the ``asm`` keyword
07:58:48FromDiscord<.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4DWc
08:00:23ehmry.maverk: you are right, i didn't notice that it was added
08:00:36FromDiscord<dersnof> bruh i sit in front of computer, i have nim compiler on my hand etc but
08:00:40FromDiscord<dersnof> no idea what to code
08:01:04FromDiscord<dersnof> i dont wanna code tic tac toe, i did already at like 5 yrs ago or smth
08:01:13FromDiscord<.maverk> https://media.discordapp.net/attachments/371759389889003532/1142367649028898858/ttest.PNG
08:02:24FromDiscord<Phil> Ahhhh crap, I want to execute a shell command at compiletime
08:02:46FromDiscord<Elegantbeef> so?
08:03:26FromDiscord<Phil> I forgot what the procs for that where so that's 5 mins diving again to figure out which ones were the runtime ones and which ones were the compiletime ones
08:03:38FromDiscord<Elegantbeef> `staticExec`
08:03:54ehmryURLs are a thing https://nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement
08:04:02FromDiscord<kyre58> Anyone know how good the discord nim library is?
08:04:32FromDiscord<Elegantbeef> I heard it took money out of a tip jar
08:05:21FromDiscord<k0ts> Use it and find out
08:05:59FromDiscord<kyre58> :PepeSuffering: :PepeSuffering: :PepeSuffering:
08:06:15FromDiscord<Elegantbeef> Oh noes I need to build an informed opinion!
08:06:47FromDiscord<kyre58> :PokemonAlolanVulpixAnnoyance:
08:10:28FromDiscord<Phil> Are there versions of staticExec with exitCode?
08:11:12FromDiscord<Elegantbeef> Nope
08:11:33*junaid_ quit (Remote host closed the connection)
08:11:54FromDiscord<Phil> FML, so basically I check that a compilation succeeded by checking the output for `[SuccessX]`
08:12:11FromDiscord<Elegantbeef> `nim check --verbosity: 0 ...`
08:12:42FromDiscord<Elegantbeef> or `nim c`
08:13:46FromDiscord<demotomohiro> In reply to @isofruit "Are there versions of": https://nim-lang.org/docs/system.html#gorgeEx%2Cstring%2Cstring%2Cstring
08:14:04FromDiscord<Elegantbeef> Oh right that exists 😄
08:14:11FromDiscord<Phil> Wait but... wtf... err nice!
08:14:17FromDiscord<Elegantbeef> Odd there is no `staticReadEx`
08:14:38FromDiscord<Elegantbeef> Anyway use `nim check --verbosity: 0`
08:14:49FromDiscord<Elegantbeef> That does semantic analysis but no C generation and is what you want
08:20:30FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWg
08:24:21*azimut quit (Ping timeout: 246 seconds)
08:30:47FromDiscord<dersnof> can i make compiler in nim
08:30:59FromDiscord<Phil> Wait a second... shit an erroneous compile still counts as successfully executed command
08:32:12FromDiscord<demotomohiro> In reply to @dersnof "can i make compiler": I think so because Nim is written in Nim.
08:33:21FromDiscord<dersnof> In reply to @demotomohiro "I think so because": wait Nim is written in Nim, then what Nim is written in ?
08:34:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWh
08:34:59FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4DWh" => "https://play.nim-lang.org/#ix=4DWi"
08:36:17FromDiscord<demotomohiro> In reply to @dersnof "wait Nim is written": Here is source code of Nim.↵I heard Nim was written in Pascal at first.
08:36:25FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/tree/devel/compiler
08:40:44FromDiscord<enthus1ast> Yes and then it was auto translated to nim py pas2nim https://github.com/nim-lang/pas2nim
08:43:50FromDiscord<dersnof> In reply to @demotomohiro "Here is source code": how would you code language in itself though
08:46:04FromDiscord<enthus1ast> You write the compiler in another language until it does something useful, then you rewrite (or auto rewrite) its compiler in itself and let it be compiled by the old compiler
08:46:34FromDiscord<enthus1ast> Imho this is how nim still bootstraps, by a c version of it self
08:47:10FromDiscord<enthus1ast> But yeah it's quite impressive to be honest
09:49:59FromDiscord<Phil> Ugh, if I deal with compilation myself like that I need to keep in mind what the relative filepath is where etc., that gets so ugly so quickly, why can't testament just flipping work
09:52:13FromDiscord<odexine> Because it’s not that widely used (as far as I know only in the compiler and a few packages) so many things aren’t thought over too much
09:56:01FromDiscord<jmgomez> anyone knows where is the repo for the modules that where split from the std? for instance `asyncftpclient`?
09:58:51FromDiscord<jmgomez> nvm just found it
10:08:00*jmdaemon quit (Ping timeout: 245 seconds)
10:16:29FromDiscord<Phil> I finally found the flipping issue... and I can't solve it.↵Testament can't deal with `{.error.}` getting thrown from a file that isn't the test-file
10:16:47FromDiscord<Phil> Time to file a bugreport
10:38:23FromDiscord<starkiller1493> How would I write a macro that returns the currently checked out git hash?
10:39:31FromDiscord<Phil> No need to write a macro for that. You can do both at compile or runtime with just procs
10:40:05FromDiscord<Phil> It's about the hash of the current git commit?
10:40:49NimEventerNew thread by matkuki: Local bug-tracker (written in Nim or not), see https://forum.nim-lang.org/t/10420
10:41:09FromDiscord<Phil> `exec("git rev-parse HEAD")` (assuming this gets executed from within the git repo) should work
10:41:35FromDiscord<starkiller1493> yep↵at runtime it's simple, but i'm not sure how to do it at compile time
10:41:49NimEventerNew thread by Cnerd: Ssl with asynchttpserver, see https://forum.nim-lang.org/t/10421
10:42:14FromDiscord<Phil> `staticExec` should do it, assuming again it's called from within the git repo
10:43:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWE
10:43:57FromDiscord<Phil> mapster is a project of mine that is a git repo
10:44:19FromDiscord<starkiller1493> oh, that's simple, thanks
10:54:13*koltrast_ quit (Quit: ZNC - http://znc.in)
10:54:32*koltrast joined #nim
12:14:08FromDiscord<Phil> I want to kick... I dunno, myself, the docs, sth
12:17:11FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DX2
12:19:25*dithpri quit (Remote host closed the connection)
12:19:48*dithpri joined #nim
12:28:06*azimut joined #nim
12:31:22*azimut quit (Remote host closed the connection)
12:31:43*azimut joined #nim
13:34:25FromDiscord<Phil> ... what was the flag to get generated c code again? cc?
13:35:22FromDiscord<Phil> Pretty sure it's `nim cc ./src/somefile.nim` but I can't find the c-code and when I pass in `-o:./src/cout` to get the c-files in a specific directory I just get the `out` file, not a C-source file
13:35:38FromDiscord<Phil> (edit) "the `out`" => "a `cout.out`"
13:36:51FromDiscord<Phil> I solely want the source files so I can check that some code is in them
13:37:27FromDiscord<ringabout> Well, you might specify the nimcache location by `--nimcache:nimcache` where the C code lay in.
13:38:30FromDiscord<Phil> ... oh wow that's a lot of C code for 2 lines of nim
13:52:37*xet7 joined #nim
13:54:12NimEventerNew post on r/nim by quirkst3r: Evading Windows Defender with Nim [Article], see https://reddit.com/r/nim/comments/15vgwiz/evading_windows_defender_with_nim_article/
13:58:08*junaid_ joined #nim
13:59:18FromDiscord<jos7388> https://media.discordapp.net/attachments/371759389889003532/1142457766657658921/image.png
13:59:20FromDiscord<jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4DXE
13:59:32FromDiscord<jos7388> anything below that padding tuple new thing doesn't work
14:00:07FromDiscord<jos7388> doesn't really make sense to me-- removing the first declaration fixes it
14:02:32FromDiscord<jos7388> i guess overload resolution or whatever doesn't work with generics?
14:04:31FromDiscord<jos7388> weird, because the error'd out line is resolving to `system.new`-- so why is the first declaration even relevant?
14:12:16FromDiscord<jos7388> ok well one thing i can do is make the second arg `typedesc[T]`, and then T is inferred, and it works
14:12:21FromDiscord<jos7388> :PeepoShrug:
14:14:37FromDiscord<Phil> Your entire : int construct weirds me out as hell so I can't really say much here 😅
14:14:55FromDiscord<Phil> I know that to check for inheritance in a way, not for much more than that
14:27:36FromDiscord<odexine> In reply to @isofruit "Your entire : int": wdym
14:34:14FromDiscord<Phil> What is `[ :int]` for a generic type, basically?↵What thus does `new[: int](MyObjectType)` express?
14:34:31FromDiscord<jos7388> In reply to @isofruit "Your entire : int": ye i also don't like this syntax
14:34:44FromDiscord<jos7388> nim pros be like "haha what do you mean??" but the character obviously shouldn't be there
14:34:55FromDiscord<jos7388> the ambiguity with the other expression seems insane to me
14:36:01FromDiscord<Phil> Nim as a language just has a pretty wide range of expressions, knowing them all takes a bit ^^
14:36:31FromDiscord<jos7388> UFCS just has some rough edges
14:36:49FromDiscord<jos7388> i love UFCS in general but this is of those edges i guess
14:37:19FromDiscord<jos7388> i'm sure it could be fixed in some way, maybe with type information-- like array deref should only be valid on array types, and on procs it should prefer to parse as a call
14:37:31FromDiscord<jos7388> but then i guess you don't have a context free grammar any more, right?
14:38:10FromDiscord<Phil> sent a long message, see http://ix.io/4DXQ
14:38:20FromDiscord<Phil> Screenshots generally aren't my favourites when looking at code
14:39:36FromDiscord<jos7388> from a chat before
14:39:41FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4DXR
14:40:05FromDiscord<odexine> or rather insert any type as the first param ... you know what i mean
14:40:09FromDiscord<jos7388> well obviously the [] symbol is overloaded, and <> should have been used for generics
14:40:31FromDiscord<jos7388> that would probably be the most obvious solution if you could go back and change it
14:40:32FromDiscord<odexine> there is the lt-gt problem then
14:40:43FromDiscord<jos7388> eh that is much simpler isn't it
14:40:47FromDiscord<odexine> is it
14:40:53FromDiscord<jos7388> i think so
14:41:11FromDiscord<jos7388> is there any ambiguity with that?
14:41:30FromDiscord<jos7388> there shouldn't be, the symbols are overloaded but in the parser impl they're never used in the same place
14:41:49FromDiscord<jos7388> i know in rust you have to use the weird ::<> operator or it thinks it's a comparison operator
14:41:58FromDiscord<jos7388> but i've never had to do that in other langs that use <> for generics
14:43:14FromDiscord<odexine> because it likely has some hacks (like iirc in c++) that allow it for the more trivial cases but then fail to parse in the more complex cases
14:44:24FromDiscord<jos7388> it probably requires the parser to look ahead a bit more
14:44:30FromDiscord<jos7388> but nobody ever said LL1 was a requirement rly
14:44:46FromDiscord<jos7388> but i dont know
14:44:54FromDiscord<jos7388> it might not be possible in a context free language
14:45:01FromDiscord<odexine> In reply to @jos7388 "it probably requires the": i think it is unbounded how much the parser has to look ahead to properly resolve <>
14:45:10FromDiscord<jos7388> ye but in practice this really doesn't matter imo
14:45:19FromDiscord<jos7388> a lot of compiler design is hoity-toity BS IMO
14:45:35FromDiscord<jos7388> overexplored problem by nerds in the 80's
14:46:25FromDiscord<jos7388> at the end of the day the parser should just parse text and produce some artifact, the LL1 stuff and all those other properties-- just safeguards to make it impossible for the compiler to infinite loop and stuff innit?
14:46:44FromDiscord<jos7388> but if you're okay with maintaining a few places where those invariants are violated
14:46:52FromDiscord<jos7388> why not, if it makes your language better?
14:54:30FromDiscord<jos7388> anyway im working on a UI library that uses ECS patterns and the depth buffer for ordering
14:54:58FromDiscord<jos7388> has anyone done that before? i feel most UI libs use recursive descent down the DOM and painters algorithm for ordering
14:55:08FromDiscord<jos7388> and somehow i think that's probably quite a bit slower, but i'm not sure
14:58:25FromDiscord<System64 ~ Flandre Scarlet> Hi, how can I preallocate a seq and then append stuff into it without reallocating it?
14:58:33FromDiscord<System64 ~ Flandre Scarlet> (edit) "it?" => "it please?"
14:58:34FromDiscord<odexine> newSeqWithCap
15:00:51FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DY2
15:01:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "newSeqWithCap": Seems it doesn't find it
15:01:57FromDiscord<odexine> what?
15:02:00FromDiscord<heysokam> In reply to @sys64 "Hi, how can I": there is also sequtils `newSeqWith` that takes contents so that it is not initialized to `0` or whatever the defaults
15:02:12FromDiscord<odexine> sorry
15:02:15FromDiscord<odexine> newseqofcap
15:02:16FromDiscord<odexine> not with
15:04:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "newseqofcap": Ah thanks, it works↵And to get a slice of a seq?
15:04:59FromDiscord<odexine> toopenarray?
15:05:46FromDiscord<Phil> In reply to @jos7388 "has anyone done that": Sadly I'm uneducated on that, more a higher-level person. can.l might know since he wrote owlkettle and possible one of the folks that wrote bindings to qt/qml
15:07:40FromDiscord<jos7388> those libs look really interesting for all the other parts of building a UI
15:08:12FromDiscord<jos7388> i tried owlkettle before too i think
15:08:15FromDiscord<Phil> I think lower than that the only person I'd guess is treeform maybe (?)
15:08:33FromDiscord<jos7388> i was looking at nimx, have you tried it? it looks really awesome
15:08:37FromDiscord<Phil> I'm super uneducated on the GUI stack
15:08:47FromDiscord<Phil> only played around with owlkettle in terms of GUI
15:08:57FromDiscord<jos7388> u can click around the web demo for nimx if u wanna try it
15:08:59FromDiscord<jos7388> http://yglukhov.github.io/nimx/livedemo/main.html
15:09:26FromDiscord<jos7388> i think it's really neat-- i love how rust has nothing like this because retained mode is so hard with rust's memory model
15:19:22FromDiscord<System64 ~ Flandre Scarlet> Not possible to make X mutable? https://media.discordapp.net/attachments/371759389889003532/1142477914210840607/image.png
15:19:59NimEventerNew thread by mildred: How to update a nimble package?, see https://forum.nim-lang.org/t/10422
15:21:11FromDiscord<odexine> In reply to @sys64 "Not possible to make": no, its a property of the iterator's return value
15:25:26arkanoiddo you know if there's a lib capable of creating object definitions from yaml?
15:26:08FromDiscord<heysokam> In reply to @arkanoid "do you know if": does nimyaml not do that? 🤔↵or do you mean their declarations?
15:27:43arkanoidafaik nimyaml load yaml file and create instances of existing object definitions
15:27:53arkanoid(is it definition or declaration?)
15:28:10FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4DY8
15:28:12arkanoidI mean the "type" section
15:28:49FromDiscord<odexine> as in load a yaml schema?
15:29:34FromDiscord<heysokam> In reply to @chronos.vitaqua "Why not just make": because otherprefix is overriden by this file, and coming from a different library
15:29:43FromDiscord<Chronos [She/Her]> Ah
15:30:00FromDiscord<heysokam> In reply to @arkanoid "(is it definition or": declaration is the type, definition is the contents
15:30:28FromDiscord<heysokam> nimyaml populates data in the definition↵if you meant the declaration, then that's different (i don't know if it does or not"
15:30:30FromDiscord<heysokam> (edit) "not"" => "not)"
15:31:02arkanoidthanks. So I'd like to "declare" types by reading a yaml
15:31:16arkanoidand also creating relative instances
15:31:58FromDiscord<Chronos [She/Her]> In reply to @heysokam "because otherprefix is overriden": You could do it from a config file instead?
15:37:10FromDiscord<heysokam> In reply to @chronos.vitaqua "You could do it": yeah that's what I fell back into. i guess there is no escaping that
15:38:43FromDiscord<heysokam> In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the schema. Hopefully you get a better option than that
15:38:53FromDiscord<heysokam> (edit) "In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the ... schema." added "spec"
15:39:00FromDiscord<heysokam> (edit) "In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the spec ... schema." added "json"
15:58:26*deadmarshal_ quit (Remote host closed the connection)
16:00:30FromDiscord<jos7388> is there anything like std::unique_ptr in nim
16:00:37FromDiscord<jos7388> something i wanna make sure nobody copies
16:00:41FromDiscord<jos7388> by accident
16:00:47FromDiscord<jos7388> and i only want 1 ref to it
16:03:37FromDiscord<k0ts> https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim
16:03:43FromDiscord<k0ts> This exists, never tried it though
16:05:09FromDiscord<amjadhd> How do you backport a fix to Nim 2.0 ? you create a PR against `version-2-0` branch ?
16:15:35FromDiscord<krisp0> Whenever I set my future return type to a type where it could be `Foo|Bar` I get a `cannot instantiate: 'FB`? ↵https://play.nim-lang.org/#ix=4DT3↵Is there a way you could fix this?
16:15:43FromDiscord<odexine> In reply to @amjadhd "How do you backport": maybe also ask in #internals, prolly higher chance to be answered
16:15:52FromDiscord<krisp0> (edit) "'FB`? ↵https://play.nim-lang.org/#ix=4DT3↵Is" => "'FB`↵https://play.nim-lang.org/#ix=4DT3↵Is"
16:16:14FromDiscord<odexine> In reply to @krisp0 "Whenever I set my": not allowed as the return type changes depending on runtime data
16:16:27FromDiscord<odexine> youd need to use object variants or another solution
16:17:11FromDiscord<odexine> btw it's not a problem of async either, this can be further minimised to remove async and still have the same issue
16:50:40*tiorock joined #nim
16:50:40*tiorock quit (Changing host)
16:50:40*tiorock joined #nim
16:50:40*rockcavera is now known as Guest4231
16:50:40*Guest4231 quit (Killed (tungsten.libera.chat (Nickname regained by services)))
16:50:40*tiorock is now known as rockcavera
16:56:38termerAnyone know how I could convert an array[10, char] to a cstring?
16:56:47termerAnyone know how I could convert an array[10, char] to a cstring?
16:56:48termeroops
16:56:53FromDiscord<Chronos [She/Her]> In reply to @heysokam "yeah that's what I": Fair
17:00:42FromDiscord<nomad> how do i kill a alredy running process by name and not id?
17:03:08FromDiscord<jos7388> cute
17:03:29termernomad, It depends on your OS
17:03:48termerI'm not sure if you can see the list of processes in the stdlib, but if you're on Windows, you might want to check the winim library
17:04:04termerKilling a process by name is usually not a very good idea though, since the name of your process might not be unique
17:04:12termerWhy do you need to kill the process by its name?
17:06:02FromDiscord<nomad> im currently trying to make anti-cracking software
17:06:27FromDiscord<nomad> so im finding processes that are used to tamper and crack software and killing those
17:15:52FromDiscord<odexine> its possible that your software wont be running at a privilege where it can kill other processes
17:16:10FromDiscord<odexine> and lots of cracking software can mask its name
17:22:44*junaid_ quit (Remote host closed the connection)
17:28:08FromDiscord<jos7388> does atlas not do recursive pinning?
17:28:12FromDiscord<jos7388> i'm only using 3 deps and my lockfile only has 3 deps
17:28:34FromDiscord<jos7388> oh i think it's flattening out my deps?
17:28:48FromDiscord<jos7388> ye i just have no transient dependencies
17:28:50FromDiscord<jos7388> wild!!
17:29:00FromDiscord<jos7388> that means the stdlib is good
17:33:33termerodexine, I'd look into the winim library then
17:33:40termereverything odexine said is still valid, though
17:33:59FromDiscord<odexine> i think you pinged me by mistake?
17:34:13termerOops
17:34:18termernomad, see what I wrote above lol
18:04:38FromDiscord<etra> Can I have two async runtimes running in two different threads while communicating by a thread-safe channel?
18:04:58FromDiscord<etra> I have some sort of mpsc situation, and I'd like the producers to be on a separated thread than the consumer
18:05:21FromDiscord<etra> should be fine as long as they only communicate by channel right?
18:14:01FromDiscord<odexine> And also that you don’t send futures
18:20:45*azimut quit (Ping timeout: 246 seconds)
18:21:59*azimut joined #nim
18:35:27FromDiscord<heysokam> '
18:36:10FromDiscord<krisp0> Is there a reason why whenever I compile with orc (nim v2.0.0) it gets stuck on `CC main.nim` and finishes compiling within like 120s on average? when I do `--mm:refc` the compilation is decently fast with just 12s on average.
18:36:23FromDiscord<krisp0> (edit) "12s" => "8-12s"
18:36:37FromDiscord<krisp0> I'm using linux mint
18:36:40FromDiscord<krisp0> (edit) "I'm using linux mint ... " added "btw"
18:37:26FromDiscord<heysokam> @ElegantBeouf do you have any package maintained exclusively with graffiti, without any manual release on github, only graffiti tags?↵for some reason, versions with `url/pkg#head` is not updating to the latest version whenever one is stored locally, so wondering if it might be because they are just tags and not proper github manual releases or something 🤔
18:37:28FromDiscord<Phil> Sounds like you're running into a compilation edgecase
18:37:53FromDiscord<Phil> Can you feasably replicate that behaviour with a minimal example?
18:43:23FromDiscord<krisp0> hmm it seems like with a minimal example it only takes 4s, that imports everything that my file does.↵my nim file is 1111 lines long.
18:45:04FromDiscord<krisp0> I compiled a duplicate copy of the file and it took 61s, but the original file takes forever
18:45:16FromDiscord<krisp0> maybe it might be due to something with nim cache
18:45:21FromDiscord<Phil> Note that I'm not an expert in this field, but based on the surface level knowledge I have of ORC (which is the new mm under nim 2.0) I'd assume you're stumbling into a complex data structure of sorts where the compiler has to calculate a lot about where to insert destructors etc.
18:45:39FromDiscord<Phil> You can of course also delete your ~/.cache/nim folder and see if that helps
18:45:52FromDiscord<Phil> (on Linux, no clue about windows)
18:50:16*disso-peach joined #nim
19:02:55*deadmarshal_ joined #nim
19:03:45*junaid_ joined #nim
19:04:11termerElegantbeef, https://github.com/termermc/nim-stack-strings/releases/tag/v1.1.0
19:08:40termerThe `views` experimental feature is great
19:08:46termerit should absolutely be made stable
19:11:14*ntat joined #nim
19:11:35FromDiscord<Chronos [She/Her]> In Nim, are ref types basically an equivalent for C accepting a pointer of a type? (But not as prettily wrapped up)
19:12:41FromDiscord<Chronos [She/Her]> In reply to @termer "Elegantbeef, https://github.com/termermc/nim-stack-": Huh... This looks interesting honestly
19:12:52FromDiscord<Chronos [She/Her]> Why is it nil terminated though, if I can ask?
19:13:01FromDiscord<Chronos [She/Her]> Did it have to be nil terminated?
19:13:17termerThe old version wasn't
19:13:24termerThe new version is so that it can interop with C easier
19:13:48termerC strings are null-terminated and if you want to use a StackString pointer as a cstring instead of copying memory, the only option is making them nil-terminated
19:14:14termerTo answer your question about ref types, ref types are pointers that are managed by the compiler or GC
19:14:25termerManaged in general
19:14:43termerUnder ARC/ORC, they're very similar to C++ and Rust smart pointers
19:15:00termerUnder refc, they're just managed garbage-collected memory
19:15:24termerAre you familiar with the difference between Nim's ptr and ref keywords?
19:17:05termerTL;DR, they're both pointers, but ref is managed and ptr is unmanaged
19:23:52*junaid_ quit (Remote host closed the connection)
19:28:00FromDiscord<heysokam> In reply to @chronos.vitaqua "In Nim, are ref": regular types are the same as C accepting a ptr Type, since C is bycopy and nim is byref (unless you force them otherwise)↵ref types are the same as heap-allocating a C object and then sending the pointer to the function↵both send a ptr of some kind, but very differently used (ptr Type does not need to be heap-alloc, refs are always heap)
19:29:58*def- quit (Quit: -)
19:30:39*def- joined #nim
19:37:11qwrarc/orc might be similar to those smart pointers, but afaik its deferred reference counting, i.e. the compiler minimizes RC updates
19:39:34termerIt might be more compiler-optimized I suppose
19:45:54*ntat quit (Quit: leaving)
19:49:45FromDiscord<Chronos [She/Her]> In reply to @termer "The new version is": Hm fair
19:50:04FromDiscord<Chronos [She/Her]> In reply to @termer "Are you familiar with": Yeah I am
19:50:32FromDiscord<Chronos [She/Her]> In reply to @heysokam "regular types are the": Makes sense, thanks!
19:53:18FromDiscord<heysokam> now that I think about it...↵is Nim also `{.byref.}` when there is no GC involved, like with `--mm:none`?↵or do object automatically become `{.bycopy.}` 🤔
19:53:28FromDiscord<heysokam> (edit) "now that I think about it...↵is Nim also `{.byref.}` when there is no GC involved, like with `--mm:none`?↵or do object automatically become `{.bycopy.}` ... 🤔" added "in that case"
19:57:50termerno idea
20:08:10FromDiscord<Elegantbeef> byref simply means the compiler passes by reference
20:08:32FromDiscord<Elegantbeef> There is no memory management model there it's just instead of generating `T a` in a parameter list it's `T a`
20:13:45FromDiscord<dersnof> is this correct way
20:13:46FromDiscord<dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZb
20:13:47FromDiscord<dersnof> to use macro
20:19:14FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4DZd
20:19:21FromDiscord<heysokam> In reply to @Elegantbeef "There is no memory": ty ✍️
20:20:07FromDiscord<heysokam> Did you see the graffiti @ from before, beef?
20:20:26FromDiscord<Elegantbeef> Just seen the thing about graffiti, all my packages on github use graffiti
20:20:46FromDiscord<heysokam> but do they have manually pushed releases?
20:20:57FromDiscord<Elegantbeef> No
20:20:59FromDiscord<heysokam> for some reason my packages don't get auto-updated, so was wondering why
20:21:28FromDiscord<Elegantbeef> `@#head` should fetch the head regardless if you have a tag
20:21:36FromDiscord<heysokam> yeah i do that
20:21:42FromDiscord<heysokam> but still happens, which is why i asked
20:22:14FromDiscord<Elegantbeef> I don't think `@#head` works with local
20:22:41FromDiscord<dersnof> In reply to @griffith1deadly "but it can also": what is diff between template and macro
20:23:15FromDiscord<Elegantbeef> A template is just code substitution, a macro evaluates code on the VM to mutate a passed in AST
20:23:23FromDiscord<griffith1deadly> In reply to @dersnof "what is diff between": templates allow you passing code block's to argument
20:23:38FromDiscord<Elegantbeef> Macros allow the same
20:23:45FromDiscord<griffith1deadly> ik
20:23:52FromDiscord<Elegantbeef> termer did you use graffiti for that release? 😄
20:24:01termerWhat's that supposed to mean lol
20:24:07termeralso I was about to thank you for the fix
20:24:12FromDiscord<Elegantbeef> Ah nah you didnt
20:24:23FromDiscord<Elegantbeef> graffiti is my automatic git tagger for nimble packages
20:24:40FromDiscord<Elegantbeef> I still need to collate the message like you have there
20:24:42termerI vaguely remember you mentioning it
20:24:43FromDiscord<dersnof> In reply to @Elegantbeef "Macros allow the same": aaand
20:24:46FromDiscord<dersnof> what is the difference
20:24:52FromDiscord<dersnof> where to use template, where to macro
20:25:03termerI think this repo is my most starred on GitHub despite definitely not being the most impressive
20:25:10FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DZf
20:25:14FromDiscord<Elegantbeef> `graffiti ./bleh.nimble 0.1.2` would automatically create a tag, bump nimble, and push it for you
20:25:28termercool
20:25:29FromDiscord<Elegantbeef> You use a template when you want code subsitution
20:25:40FromDiscord<Elegantbeef> You use a macro when you want code introspection
20:26:04FromDiscord<Elegantbeef> I still need to collect all commit messages to produce a nice release message 😄
20:26:39FromDiscord<Elegantbeef> Right now if you use the bump version it just is "bump to version x" and if you do not use the bump version and just do `graffiti ./your.nimble` it uses the commit message of that manual bump
20:27:08termerThat's handy
20:27:27FromDiscord<Elegantbeef> I know sokam wants the whole commit message setup, just havent got around to it
20:30:46FromDiscord<dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZk
20:30:54FromDiscord<dersnof> (edit) "https://play.nim-lang.org/#ix=4DZk" => "https://play.nim-lang.org/#ix=4DZl"
20:30:54FromDiscord<dersnof> is this code gud
20:31:10FromDiscord<Elegantbeef> You're using a macro when a template suffices
20:31:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DZm
20:32:00FromDiscord<dersnof> idk what is difference of macro and template lol
20:32:31FromDiscord<Elegantbeef> One is code substitution like C macros, the other is intropsection
20:32:52FromDiscord<dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZn
20:33:05FromDiscord<dersnof> In reply to @Elegantbeef "One is code substitution": intropsection ?
20:33:34FromDiscord<Elegantbeef> Of course it errored I did a type and forgot the name of the template
20:33:38FromDiscord<Elegantbeef> typo\
20:34:07FromDiscord<Elegantbeef> Introspection is the ability to look inside, macros can change their output depending on their input, templates cannot
20:34:43FromDiscord<dersnof> In reply to @Elegantbeef "Introspection is the ability": are there good guide about template and macros
20:39:07termerhttps://nim-lang.org/docs/tut2.html#templates
20:40:51termerThere are few surprises with templates
20:41:15termerOne thing to note about templates: they're sanitary, so variables inside of them don't leak outside the scope
20:41:28termerbut you can inject them explicitly by annotating them with the {.inject.} pragma
20:41:29FromDiscord<etra> In reply to @odexine "And also that you": apparently `async_http_client` isn't thread safe? if I do one request in one thread, then send the struct to another thread, it raises with a dispatcher error
20:41:43FromDiscord<Elegantbeef> Or by explicitly giving them a name like done above
20:41:58termerthat too
20:42:16termeretra, That's very possible
20:42:49FromDiscord<Elegantbeef> They have seperate dispatchers so moving a request across a thread is not as simple as just giving the future
20:43:09termerOh yeah that's true lol I forgot
20:43:33FromDiscord<etra> In reply to @Elegantbeef "They have seperate dispatchers": no but I mean if I do a complete request, `waitFor`, then move the client, it raises too
20:44:02termerThere may be some references to Futures in the other thread, not sure
20:44:49FromDiscord<dersnof> Wonder if we would rewrite Rust library Nim, would it speed up
20:45:13FromDiscord<Elegantbeef> Are you smarter than the Rust programmer? If so yes
20:45:29FromDiscord<Elegantbeef> When it comes to speed of system languages it's about the cleverness of the programmer and not the programming language
20:46:14termerCompiled languages USUALLY don't have an inherent "speed"
20:46:19termerunless you're talking about compilation speed
20:46:40termerIf you have a perfectly good Rust library, why rewrite in Nim?
20:46:50termerthe only reason to do that is if you want to also use it in Nim
20:47:05termerwhich, if you want to save effort, you could do in many cases by exporting C symbols and then creating a Nim wrapper
20:52:26FromDiscord<emanresu3> correct me if I'm wrong, but rust system libraries produce bigger files sizes than nim's, no?↵(<@709044657232936960_termer=5b=49=52=43=5d>)
20:53:26FromDiscord<dersnof> In reply to @Elegantbeef "When it comes to": Cleverness comes from born so…
20:55:52FromDiscord<Elegantbeef> Uhh
20:56:10FromDiscord<Elegantbeef> If that was the case I'd still shit my... ok never mind point stands
20:57:25FromDiscord<dersnof> In reply to @Elegantbeef "If that was the": Lol
20:59:15FromDiscord<heysokam> In reply to @dersnof "Wonder if we would": make some C ABI exports and then wrap those with nim. thats what https://github.com/heysokam/wgpu does, from the original C https://github.com/gfx-rs/wgpu-native/ that wraps https://github.com/gfx-rs/wgpu
21:01:02*disso-peach quit (Ping timeout: 246 seconds)
21:06:09FromDiscord<dersnof> hmm
21:06:16FromDiscord<dersnof> btw are there backend lib for Nim
21:06:24FromDiscord<dersnof> like Django for Python
21:06:28FromDiscord<etra> In reply to @etra "no but I mean": ok apparently it was a keep-alive issue, if I send it with `Connection: close` it works fine 😄
21:06:48FromDiscord<heysokam> In reply to @dersnof "btw are there backend": backend as in?
21:06:48FromDiscord<griffith1deadly> In reply to @dersnof "btw are there backend": https://github.com/HapticX/happyx
21:07:08FromDiscord<heysokam> ah web framework
21:07:29FromDiscord<heysokam> yeah there are a couple. i don't know names. jester was one of them? 🤔
21:08:19FromDiscord<dersnof> nice
21:09:22FromDiscord<Phil> `happyX` I haven't used yet but the library author looks like they're really putting some quality work in based on the presentation and brief skimming over stuff
21:10:07FromDiscord<Phil> It is more of a full-stack framework, meaning it'll also provide frontend-rendering-options, namely karax
21:10:41FromDiscord<Phil> prologue, mummy and jester are all options that are solely for the backend and do not provide a frontend.↵You'd need to wire one together yourself.
21:10:59FromDiscord<dersnof> interesting, Jester uses HttpBeast. so that means i can make my own Jester with HttpBeast
21:11:02FromDiscord<Phil> (edit) "yourself." => "yourself, but if you're using a JS framework anyway that's not much of a change."
21:11:03FromDiscord<dersnof> would be quite experience
21:11:41FromDiscord<dersnof> httpbeast is very simple lib though, it just gives simple http connection
21:11:49FromDiscord<dersnof> would be hard to build web framework with it
21:12:25FromDiscord<Phil> I'd have a chat with @guzba8 how the performance is compared to mummy, particularly in multi-threaded contexts.
21:12:37FromDiscord<Phil> (edit) "mummy," => "mummy if I were you in that case,"
21:12:44FromDiscord<Phil> (edit) "I'd have a chat with @guzba8 how the performance ... is" added "of httpbeast"
21:13:14FromDiscord<dersnof> In reply to @isofruit "I'd have a chat": oh is he dev of mummy or smth ?
21:13:19FromDiscord<Phil> Pretty much
21:14:09FromDiscord<Phil> The reason I generally steer gently away from jester is because the lead dev is no longer an active nim member, so you're unlikely to sea any future goodies arise from it such as bugfixes.
21:14:30FromDiscord<dersnof> hmm can i make my own jester or smth
21:15:15FromDiscord<Phil> You can still use it perfectly fine for the next eternity basically, that thing is rather robust and nim doesn't change that much, I'd just view it as something that might lead you to limitations unless you take ownership of that codebase as well.
21:15:27FromDiscord<Phil> In reply to @dersnof "hmm can i make": That's always an option
21:15:51FromDiscord<Phil> Though generally I'm also in favour of improving what's there, rather than rewriting it all from the jump
21:16:10FromDiscord<dersnof> In reply to @isofruit "Though generally I'm also": Oh wym ? Like fork jester ?
21:17:44FromDiscord<Phil> That'd be an option.↵Or build something that has a similar/identical API to jester with mummy as the underlying server.↵Or contribute to prologue.↵Or build something that has a similar API to prologue with mummy as the underlying server.
21:18:35FromDiscord<dersnof> Ah jester but has mummy as server instead
21:18:39FromDiscord<dersnof> Wonder would it speed up
21:19:23FromDiscord<Phil> Or write plugins for any of the existing frameworks.↵Like providing an admin area the likes of Django (for prologue I've played around with something like that purely based on generics around the Models of norm).
21:20:10FromDiscord<Phil> In reply to @dersnof "Wonder would it speed": That I am not sure, thus I'd recommend having a chat with guzba to start getting into that topic and httpserver-performance characteristics 😄
21:21:35FromDiscord<Phil> Another nice plugin idea would be to write some kind of mini-routing-framework for any of the servers for websocket messages.↵Basically implement a protocol that allows you to specify different kinds of JSON websocket messages and route them to "Handlers" which expect to receive websocket messages already parsed into a specific nim data type
21:22:30FromDiscord<Phil> Bonus points for some kind of validation on the server that for every "ReceivingWebsocketMessage"-type that exists the server has a message-handler registered
21:22:51FromDiscord<Phil> (edit) "Bonus points for some kind of validation ... on" added "at compile-time or on server start-up"
21:23:33FromDiscord<Phil> Triple bonus points if you can make the type for Websocket Messages that the server can send to the client also integrate nicely with karax
21:24:39FromDiscord<Phil> Other than that you could of course write a component library for karax the likes of bootstrap
21:24:52FromDiscord<Phil> (edit) "bootstrap" => "ng-bootstrap"
21:25:06FromDiscord<dersnof> nice idea
21:25:24FromDiscord<Phil> Okay I don't know what I've eaten today but the ideas for shit to work on kind of are just flowing out of me
21:25:43FromDiscord<Phil> Owlkettle widget library is the equivalent for that btw.
21:25:47FromDiscord<dersnof> yeah kind of nice lol
21:25:51FromDiscord<Phil> (edit) "Owlkettle widget library is the equivalent for that btw. ... " added "on native with GTK"
21:26:19FromDiscord<dersnof> i should read book about networking nowadays, to strengthen my networking knowledge
21:28:19FromDiscord<Phil> sent a long message, see http://ix.io/4DZy
21:28:35FromDiscord<Phil> (edit) "http://ix.io/4DZy" => "http://ix.io/4DZz"
21:29:02FromDiscord<Phil> (edit) "http://ix.io/4DZz" => "http://ix.io/4DZC"
21:29:19FromDiscord<Phil> Could implement acknowledge-messages that automatically get sent back and forth so that the user doesn't have to think about that
21:29:38FromDiscord<dersnof> what is acknowledge-messages ?
21:29:56FromDiscord<Phil> You know how with HTTP you always get a response when you make a request and thus can know when it is finished?
21:30:28FromDiscord<dersnof> yeah
21:30:47FromDiscord<Phil> Websocket messages don't have that, a message there is a one-way street.↵You basically can not know if the server received your message or not by default, you can only send.↵If you want to know that the server received your message, the server needs to implement that it sends you an "acknowledge" that it received the message of id blablabla
21:32:08FromDiscord<arathanis> does nim have logical shl?
21:32:46FromDiscord<Phil> Based on that acknowledge mechanism you could e.g. write a queue that stores messages that you are not sure if the server has received them.↵When you send a message it gets stored in the queue. ↵When the server sends an acknowledge it gets removed from the queue. ↵When a message is stored in the queue for more than X seconds you try to send it again until you get an acknowledge or a max amount of retries has happened, then you inform t
21:33:04FromDiscord<dersnof> In reply to @isofruit "Websocket messages don't have": ah
21:33:22FromDiscord<dersnof> its instant messaging
21:33:30FromDiscord<Phil> That but also much more
21:33:40FromDiscord<Phil> You can replace your entire HTTP layer with websocket messages
21:33:48FromDiscord<Phil> In fact treeform apparently likes to do so
21:34:31FromDiscord<Phil> Excerpt from their WS lib:↵> I love webSockets. They are easy to use and supported everywhere. I use them instead of HTTP REST APIs. I find it much easier to think in terms of client/server messages then verbs and resource paths. Inevitably you want the server to notify the client when some thing changes. Inevitably you will use webSockets. Then you will have two systems. Stop the pain and just use plain webSockets from the start. Say no t
21:34:41FromDiscord<Phil> (edit) "lib:↵>" => "lib README.md:↵>"
21:35:48FromDiscord<Phil> It's a pretty interesting idea and starts becoming really interesting once you have a central store in the frontend with its own centralized event-bus that informs the entire application on which events are currently happening.
21:59:21termerPhil, The annoying part of this is maintaining the websocket connection, and forgoing the ability to make one-shot requests
21:59:34termerThe differentiator is whether you consider your website a fully interactive webapp or not
22:00:06termerI've written a few applications that use exclusively WebSocket for their communication, but those are applications with a ton of back-and-forth with many messages coming from the server
22:01:05FromDiscord<Phil> Absolutely, that was the vein I was thinking about, stuff like notifying users of recent updates that just happened etc.
22:01:16FromDiscord<Phil> (edit) "Absolutely, that was the vein I was thinking about, stuff like notifying users of recent updates that just happened ... etc." added "by another user, chat messages"
22:01:36FromDiscord<Elegantbeef> It also prevents easy usage in other places
22:01:43termerThat's the big problem with it for me
22:01:51termeryou can't just fire shit off with curl
22:01:57termerwhich is fine in certain circumstances
22:02:12FromDiscord<Phil> Doesn't change that it could be interesting to implement a lib to simplify setup and implementation
22:02:28FromDiscord<Phil> Which was what the topic originally was about, suggestions on what one could do
22:03:04termerwebsocket with protobuf
22:03:09FromDiscord<Elegantbeef> it's `shl`↵(@arathanis)
22:03:18termeror msgpack if you don't want to have to use complicated things
22:10:03FromDiscord<Phil> That sounds like some seriously high performance stuff that you could be doing with websockets
22:10:20FromDiscord<Phil> Like a monitoring board with tons of data on it that auto-updates or sth
22:11:17termeryou could certainly do it
22:11:31termerWebSocket doesn't have much overhead over normal TCP sockets after the initial handshake
22:12:07FromDiscord<Phil> I'm aware, it was more the protobuf-bits that made me think of more throughput-heavy applications
22:18:37FromDiscord<Chronos [She/Her]> It wouldn't be too hard to make something to abstract over code for HTTP routes and WS API stuff, would it?
22:18:58termerNot hard
22:19:06termerbut I don't like super proprietary schemes
22:19:19FromDiscord<Chronos [She/Her]> Proprietary?
22:19:37FromDiscord<Chronos [She/Her]> I don't get it in this context
22:19:45FromDiscord<Phil> Pretty sure he just means "non-standard"
22:19:58FromDiscord<Chronos [She/Her]> Ah
22:20:03FromDiscord<Phil> Or "they" rather
22:20:10FromDiscord<Chronos [She/Her]> Gucci
22:22:59FromDiscord<arathanis> In reply to @Elegantbeef "it's `shl` (<@136570191038513152>)": that seems to be bitwise shift left
22:23:37FromDiscord<arathanis> (edit) "bitwise" => "bitwise/arithmetic"
22:23:59FromDiscord<arathanis> it rotates the bits instead of zero padding like a logical leftshift
22:24:49FromDiscord<arathanis> https://media.discordapp.net/attachments/371759389889003532/1142584985778405426/image.png
22:25:03FromDiscord<arathanis> 1 lshl 65 should be 0
22:25:14FromDiscord<arathanis> (edit) "1 lshl 65 should be 0 ... " added "in a 64-bit integer"
22:31:24*lucasta_ joined #nim
22:34:15termerI'm a he, you are free to refer to me as such
22:34:25termerAnd you're right, I mean mostly non-standard
22:34:35termerbut particularly, something that's very language-oriented
22:34:59termerwhen things revolve around one language so heavily, making nice implementations in other languages can suck, or at least feel very unfamiliar
23:01:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "": Sounds like an actual bug
23:01:29FromDiscord<arathanis> this is pretty normal behavior for arithmetic aka bitwise shift
23:01:50FromDiscord<arathanis> i just figured there would be a logical counterpart
23:02:01FromDiscord<arathanis> but i cant seem to find one
23:02:11FromDiscord<System64 ~ Flandre Scarlet> shr gives you... 0
23:02:25FromDiscord<arathanis> is shr doing logical shift...? u-u
23:02:27FromDiscord<arathanis> (edit) "u-u" => "u_u"
23:02:47FromDiscord<arathanis> oh god it is
23:02:59FromDiscord<arathanis> so shl is arithmetic and shr is logical????
23:03:06FromDiscord<sirolaf> This is just what C does
23:03:07FromDiscord<arathanis> im not about that
23:05:05FromDiscord<odexine> shr has an arithmetic version
23:05:19FromDiscord<odexine> ashr is also in the standard library
23:05:35FromDiscord<arathanis> but does shl have a logical version?
23:05:49FromDiscord<arathanis> and maybe I am crazy but I would assume they would be the same...
23:05:52FromDiscord<odexine> Not that I know of
23:06:01FromDiscord<arathanis> so shl and shr would both be arithmetic or logical
23:06:10FromDiscord<odexine> I would say they are the same in behaviour
23:06:12FromDiscord<arathanis> and then either lshl and rshr or ashl and ashr would be the others
23:06:24FromDiscord<odexine> I mean logical and arithmetic shift left
23:07:19FromDiscord<arathanis> one truncates and the other rotates
23:07:54FromDiscord<arathanis> assuming 64-bit:↵1 lshl 65 == 0↵1 ashl 65 == 1 ashl 2 == 2
23:09:00FromDiscord<arathanis> probably isnt too hard to roll your own lshl i guess. i just figured there would be one in there somewhere
23:09:07FromDiscord<arathanis> like even in std/bitops
23:09:23FromDiscord<odexine> Nim has rotate left in bitops
23:09:49FromDiscord<arathanis> ahh there it is
23:10:41FromDiscord<arathanis> shl: arithmetic left shirt↵shr: logical right shift↵ashr: arithmetic right shift↵std/bitops.rotateLeftBits: logical left shift
23:11:55FromDiscord<odexine> Shift left cannot make numbers 64 bit depending on how much it shifts because it would then depend on the possibly runtime data, and if it only does for static data then the logic would be inconsistent between static and runtime data
23:58:02FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4E03
23:58:04FromDiscord<etra> (edit) "https://play.nim-lang.org/#ix=4E03" => "https://paste.rs/tP6IF"
23:58:44FromDiscord<Elegantbeef> The issue is the `isolation` destructor
23:58:58FromDiscord<etra> (edit) "https://play.nim-lang.org/#ix=4E05" => "https://play.nim-lang.org/#ix=4E04"
23:59:09FromDiscord<Elegantbeef> It's not a big issue presently, but in the future destructors will likely be forced to be `{.raises: [].}`