<< 29-12-2020 >>

00:12:41*krux02 quit (Remote host closed the connection)
00:14:35FromDiscord<Recruit_main707> in c++, when a function argument is `const void` it means that the memory is not modified, so is it the same as nim's `{.byref.}`?
00:17:18FromDiscord<geekrelief> How would one go about writing a script that can create and terminate a process? I want to create a commands in my build script to start and stop a file monitor. I see osproc.startProcess, and processID, but is there a way to convert the processID to a Process to call terminate?
00:17:45FromDiscord<geekrelief> (edit) removed "a"
00:20:05leorize[m]saem: findProjectNimFile is based on this: https://github.com/alaviss/nim.nvim/blob/master/autoload/nim/suggest/manager.vim#L255-L332, which has seen some updates to eliminate false positives but I haven't integrated back into nimsuggest
00:21:19FromDiscord<ElegantBeef> `startProcess` returns a process which can be ended with `close`, and `kill`
00:21:55FromDiscord<geekrelief> how do I persist the return Process between runs of the build script?
00:22:37FromDiscord<geekrelief> e.g. ./build monitor stop; ./build monitor stop
00:22:44FromDiscord<geekrelief> (edit) "stop;" => "start;"
00:23:13leorize[m]the issue with "find project" function, at least for nim.nvim usage is that I'm practically blocked from launching any further nimsuggest instances until nimsuggest can respond to commands, so currently custom discovery code is still used for nim.nvim
00:23:33FromDiscord<ElegantBeef> well `processID` returns the id of the process, so you could store that somewhere
00:23:56FromDiscord<geekrelief> right, so how do I convert the processID back to a Process?
00:24:04*leorize joined #nim
00:24:23FromDiscord<ElegantBeef> you dont, you reimplement `kill` and `close` to take a process id i guess
00:25:05leorizesaem: this make findProjectNimFile practically useless until we can do one nimsuggest instance for everything
00:25:42FromDiscord<ElegantBeef> It's just a case of `when defined(windows)` do the windows way to close with a PID, else do the normal human way
00:26:26FromDiscord<geekrelief> yeah I'm reading the source now,
00:26:28FromDiscord<geekrelief> (edit) "now," => "now"
00:28:00FromDiscord<ElegantBeef> Alternatively you could write a way to reload a process, no clue how finicky that'd be
00:31:34FromDiscord<geekrelief> hmm I guess must be as easy as putting the processID into a new Process object and using that to call terminate
00:31:50*saem_ joined #nim
00:32:05FromDiscord<ElegantBeef> Yea but ideally you'd reload the stdout, stdin and stderr
00:32:44FromDiscord<ElegantBeef> Not overly difficult on unix atleast
00:33:02FromDiscord<geekrelief> thanks
00:33:24FromDiscord<ElegantBeef> Have no clue the windows method
00:34:38FromDiscord<ElegantBeef> ~~Just remember to make a PR when you're done :P~~
00:41:19*bunbunbunbunny joined #nim
00:41:20saemleorize: is it though, because can't one query existing nimsuggest instances with known to see if they already cover the file you want?
00:48:49FromDiscord<Recruit_main707> can you pass something by reference while making sure its immutable?
00:49:47saemI think the compiler can reason about that optimization in many cases.
00:49:55saemAs in you don't have to.
00:55:18FromDiscord<ElegantBeef> @Recruit_main707 the only way i know of is `strictFuncs` https://play.nim-lang.org/#ix=2K9G
00:56:06federico3TIL https://github.com/Anuken/Nimdustry the author of Mindustry experimenting with Nim
00:56:23FromDiscord<ElegantBeef> Yea @Anuke is here
00:56:25FromDiscord<ElegantBeef> 😄
00:56:27saemleorize: I think the biggest hurdle with nimsuggest is actually known how to start it, because presently starting parameters make a big difference.
00:57:07saemI think one (or more) of the folks behind Fossil SCM are also looking at nim.
01:00:01FromDiscord<ElegantBeef> They've been here for quite a while and showed a demo a bit ago wasm iirc
01:00:23FromDiscord<ElegantBeef> Anuken that is
01:03:21FromDiscord<Recruit_main707> @ElegantBeef strictFuncs will become the default thing eventually, correct?
01:03:26FromDiscord<ElegantBeef> I believe so
01:03:49FromDiscord<ElegantBeef> They're more pure and proper imo
01:04:48FromDiscord<Recruit_main707> and they still allow var mutation, so i think they would be great
01:11:05*Tanger joined #nim
01:17:23saemNever watched the CPU monitor before with ./koch test... makes good use of things. lol
02:07:59*bunbunbunbunny quit (Quit: Lost terminal)
02:08:55FromDiscord<Clyybber> @mratsim Keep in mind, byaddr is nothing magic, its not implemented in the ocmpiler
02:22:37*abm quit (Read error: Connection reset by peer)
02:32:27disruptekmake package management boring again.
02:38:07*vicfred quit (Quit: Leaving)
02:42:45saemI can't agree with that hard enough.
02:46:31leorizesaem: known is terrible
02:46:56leorizeit doesn't handle files that are not imported in your project
02:48:07leorizealso you still have to wait for nimsuggest to return before you can start an another instance
02:48:41leorizeit's extra slow when you deal with things like the compiler
02:49:28disruptekdid you look into load the ic data instead?
02:50:42leorizeis ic ready?
02:50:59leorizeI think we can write a new tool altogether once ic stablise
02:51:49disrupteki'd be surprised if that were worthwhile.
02:52:05disrupteki'm not working on ic anymore; you'd have to ask araq.
02:53:27leorizeit might be worthwhile, though just loading ic data should improve performance significantly
02:54:14disruptekreading the data is easy enough.
02:54:30leorizehooking into sem doesn't give you the full picture until you've processed the entire ast (which was the issue with jump-to-def)
02:54:52saemalso it needs to be forgiving.
02:55:04leorizeas it is right now we can't let nimsuggest be a pass that runs after sem because sem is slow as hell
02:55:36saemOK, I'm new and everything, but how does one get useful information without sem running?
02:55:44disruptekthe ic ast is already sem'd and should (eventually) embed errors inside it as error nodes.
02:56:09disruptekyou can deserialize it back into un-flat types or operate upon the flat/fast ast directly.
02:56:47saemOK, so there is no getting away from sem running, just how much you have to wait.
02:57:22disruptekin theory, not that much, because the compiler should be much faster... 😉
02:57:57disruptekbut again, you have to consult with araq. he told me he was rewriting all my code, so who the fuck knows how long it'll be now.
02:58:45leorizebefore 1.6, so, next year
02:59:48saemI still don't see your point leorize. yes there will be some speedup in terms of waiting on certain things, but first run is going to suck no matter what and IC won't cover any more than the project in nimsuggest terms.
03:00:02saemit's the same analysis, just different caching.
03:00:37saemproject file + defines/switches -> analysis -> get answers.
03:00:42leorizedid I mention that packed ast should also be extra fast in term of node construction? :)
03:01:02saemSure, but again, the completeness of the answer will be no different.
03:01:15leorizeit will be, actually
03:01:19saemhow?
03:02:16leorizenimsuggest only sees part of the ast as it is processed during sem, and it won't start working until the node next to the cursor is reached
03:02:48leorizeso if you want to jump to forward declaration but your cursor is after the declaration, you won't be able to
03:03:06leorizebecause the forward-declared symbol has already been replaced with the implementation
03:03:44saemI remember there was a change around taht recently, can't remember which way it went, doesn't matter...
03:03:59disrupteki think saem's point is that the cached ast won't be available before the module is sem'd.
03:04:07saemYes, that's it.
03:04:14saemAnd you can't cache what you don't analyse
03:04:19saemThat last part is key
03:04:51leorizewe just have to pay the full cost on first run
03:05:05disruptekwe can eventually pre-cache stdlib stuff, but yes, the first run will be a little slower.
03:05:07saemSo if I go super-fast-magic-nim-compiler-with-ic js -d:this -d:that -d:other project.nim <-- this will still not see what it can't see
03:05:10leorizeand the data will be cached on disk, so it accumulates
03:05:11disruptekbut not as slow as a full recompilation.
03:06:31disruptekone day we hope to embed multiplatform support into the sem'd stuff, but it's pretty hard to do it correctly. i don't expect it for a few years, honestly.
03:06:57saemit's not just that, because it's any when(defined) type shit.
03:07:03leorizemost languages just give up on that I think
03:07:06disruptekexactly.
03:07:13saemYes, they do.
03:08:02saemBut that's also my point, it's not simply having a nimsuggest (or whatever) thing around, it's the analysis that it did and cached the user is going to want to move between it as well.
03:08:17leorizethe sad part of this is that I still won't get highlighting of parts that doesn't get sem-ed
03:08:27disruptektrue.
03:08:53disruptekaraq originally wanted to support it but i convinced him not to try.
03:09:05disruptekso you can blame me. but it's pretty damned hard.
03:09:05saemThat's a totally reasonable limitation.
03:09:23disrupteki just don't see it being a priority for anyone.
03:09:40leorizewith the way I believe IC works, we should still get unused template highlighting :P
03:09:50disruptekyes.
03:10:32leorizeso uninstantiated generic procs and templates will get the color treatment \o/
03:10:59FromDiscord<ElegantBeef> Colour treatment?
03:11:35saemI mean syntax highlighting and symbol matching all work now... that's text level stuff and editor can do, even if a bit off, it's good enough.
03:12:05leorizetry nim.nvim, you can't go back to normal highlighting after :P
03:12:26FromDiscord<ElegantBeef> Does nim.nvim differentiate fields and ufcs'd procs?
03:12:35leorizeofc it does :)
03:12:59leorizeunless your colorscheme map Identifier and Function to the same color, but that's easy fix
03:13:41leorizeit will even differentiates templates and procs :)
03:14:08FromDiscord<ElegantBeef> Ah, yea the Vscode extension afaik just uses regex so anything that 's on the right hand of `.` is coloured as a proc unless it's followed by another `.`
03:14:14FromDiscord<ElegantBeef> So changed logic is just the same colour
03:14:28FromDiscord<ElegantBeef> chained
03:14:31FromDiscord<ElegantBeef> I can english yes
03:14:37saemThe same can be done in vs code, I just haven't implemented the highlighting provider.
03:14:50FromDiscord<ElegantBeef> Ah, yea would be nice
03:15:06leorizesaem: just make sure your spawning function is efficient
03:15:32leorizebecause once you start doing highlighting nimsuggest will crash like every second or so
03:16:16saemleorize: for nimsuggest processes? I think it's ok
03:16:22saemI'll find out.
03:16:30FromDiscord<ElegantBeef> Speaking of colours the colouring i did for `--hint:source` makes me pretty happy https://media.discordapp.net/attachments/371759389889003532/793316485060624414/unknown.png
03:16:48saemnice
03:16:49FromDiscord<ElegantBeef> I'm still waiting for further comments about my PR 😄
03:17:23leorizealso the highlighting will be a hotspot, so make sure your deserialize nimsuggest response function is fast too :P
03:21:58FromDiscord<notchris> o/
03:26:55saemok, so going back to the original thing... findProjectNimFile still has some issues that need resolving regardless.
03:27:43leorizeI might have already fixed it in nim.nvim :P
03:27:49leorizeso what's the issue that you found?
03:34:58leorizeiirc there's a bug where it just keep searching even when the project boundary has already been passed
03:36:01leorizeyou may find these commits useful: https://github.com/alaviss/nim.nvim/commit/f8150e05674dbdbf4397f53b2a76b82ccaa72972 and https://github.com/alaviss/nim.nvim/commit/2ba7c6cb6f7ab87175aed104316963d743d02242
03:37:06saemleorize one issue: https://gist.github.com/saem/a5b66e4082910e7ef36ffdd45379f067
03:43:19leorizethat's expected, unfortunately
03:43:28leorizefor a good reason
03:44:09leorizeso .nim.cfg will only be evaluated if you compile the corresponding .nim
03:44:51leorizeso we just sorta guess that that is the main one
03:46:09leorizeits correct most of the time and doesn't harm by much if its wrong (unless the config cause trouble)
03:52:03leorizethe exact file is just used as an entry point for compliation afaict
03:52:31leorizeonce you start running commands on other files they will be compiled if they are not "known"
03:54:01FromDiscord<ElegantBeef> This is where i jokingly say the dumb thing of "Just search for the highest level .nim that isnt imported by anything else
03:54:01leorizeI seperate nimsuggest instances by folders in nim.nvim
03:54:57*muffindrake quit (Ping timeout: 260 seconds)
03:55:27leorizean instance running on `foo/a.nim` can handle `foo/bar/b.nim` because `foo/bar/b.nim` most likely belongs to `foo` project even if it's not imported by anything yet
03:57:10*muffindrake joined #nim
03:57:46saemWait... but if I import a file that doesn't get used by the project file then the analysis/information will be incorrect no?
03:59:09saemAddtionally, i believe using either prj.nim or twocfgs.nim under twocfgs will also always pick the same nim project file. As each of those cfgs have defines, starting off with the wrong ones causes issues.
03:59:23leorizeI haven't seen any evidence of that, so I just assume that there aren't any problem
03:59:44leorizenimsuggest setup for sem seems simple enough that I don't see an issue there
04:01:15saemWell for js projects you get outright crashes without specifying the backend and AFAIR a few defines might be required, didn't get a chance to test that thoroughly yet.
04:01:46leorizeI just put a `when defined(js)` top level for all of my js code :P
04:01:54FromDiscord<ElegantBeef> As you should
04:02:14leorizeor just add a config with: `@if nimsuggest\ndefine="js"\n@end`
04:02:24FromDiscord<ElegantBeef> I prefer `when not defined(js): {.error: "This is a JS API, learn to read".}`
04:02:42leorizeyea... nimsuggest skip errors
04:03:07FromDiscord<ElegantBeef> Aw
04:03:17FromDiscord<ElegantBeef> That's such a good error that users need to see
04:03:29leorizeyou will just get an annoying [User] error when you use `chk`
04:22:13FromDiscord<mixbot> one thing that is quiet different I say is the mutable parameters. The thing is I can't assign something in a common parameter unless the parameter is declared as var. why is that? why this design pattern is chosen for nim?
04:25:37disruptekbecause it helps prevent unintentional mutations (bugs).
04:26:16disruptekless mutability means greater optimization by the compiler, so essentially, we can do the same work quicker with virtually the same code.
04:39:44leorizealso the "implicitly copy parameter so you can modify it locally" is kinda dumb imo
04:43:29FromDiscord<mixbot> I can assign the immutable parameter in a variable inside function scope and modify it... that requires extra work....i think
04:45:02disruptekleorize: you mentioned nimph in this rfc... does it not do the right thing?
04:45:35*spiderstew_ joined #nim
04:46:26disruptekmixbot: if you're going to do that, you can just add a `var` keyword to the call parameter signature.
04:47:09*spiderstew quit (Ping timeout: 268 seconds)
04:47:29FromDiscord<mixbot> var is like reference (&) of c++ right?
04:48:24FromDiscord<mixbot> btw, can result variable store every datatypes?
04:49:07disruptekyes and yes.
04:50:57FromDiscord<mixbot> okay one last thing, can i use a namespace wrapper around types and methods to encapsulate them?
04:51:16disruptekwhy would you want that?
04:51:35disruptekyou can put them in a block to scope them.
04:51:35FromDiscord<ElegantBeef> Namespaces arent used in Nim as it ruins our glorious UFCS 😄
04:51:55FromDiscord<ElegantBeef> You can make a do nothing `namespace` template to block them
04:52:01FromDiscord<mixbot> because I want clear separation between general functions and methods
04:52:06disruptekbut you cannot export except from top-level.
04:52:14disruptekyou want clear separation?
04:52:27disruptekmake a bunch of ## on new lines.
04:52:36disruptekhere are a few to get started: ############################################################################################
04:52:43disruptekthere's more where those came from.
04:53:02FromDiscord<Rika> theres no difference in nim
04:53:23FromDiscord<Rika> nim doesnt have methods in the syntactical sense
04:53:36FromDiscord<ElegantBeef> By methods do you mean the dynamic dispatch, or dont realize we dont have member methods attached to classes
04:53:49FromDiscord<ElegantBeef> We dont have classes either 😄
04:53:59disruptekwell, we /do/ have methods, syntactically.
04:54:16FromDiscord<Rika> dammit disruptek you know what i mean lmao
04:54:19disruptekand they /are/ dispatched dynamically.
04:54:38FromDiscord<ElegantBeef> That's what i said 😄
04:57:44*disruptek is now known as sad
04:57:49FromDiscord<mixbot> so methods are same to functions, you mean... O then I was wrong... I thought methods are bind to types.
04:57:55*sad is now known as disruptek
04:58:12FromDiscord<ElegantBeef> Nim's methods are defined identical to `proc`s just with `method` instead
04:58:21FromDiscord<ElegantBeef> The difference is one is statically dispatched and the other is dynamic
04:58:30FromDiscord<Rika> and theyre not exactly useful if you dont use inheritance
04:59:01FromDiscord<ElegantBeef> Both can be called `obj.doThing` or `doThing(obj)`
05:00:23FromDiscord<mixbot> i understood
05:07:48*NimBot joined #nim
05:51:39*waleee-cl quit (Quit: Connection closed for inactivity)
06:16:08*habamax joined #nim
06:28:13FromGitter<offbeat-stuff> Hi am writing an glx program and I had to write some c++ code to get a glx function not in opengl/glx
06:28:43FromGitter<offbeat-stuff> should I write dynlib pragma or do i not need to as I am already importing opengl/glx
06:30:36*narimiran joined #nim
06:39:02FromDiscord<Cohjellah> What's the best gui framework for Nim atm? Nimx?
06:40:35*vicfred joined #nim
06:49:57*superbia joined #nim
06:59:24FromDiscord<mratsim> depends on your use case @Cohjellah , if you don't want OpenGL because you're not doing a game, nimx doesn't fit
06:59:58FromGitter<offbeat-stuff> Hey
07:00:00FromGitter<offbeat-stuff> /home/kai/.cache/nim/main_d/@[email protected]: In function ‘tyObject_XVisualInfo__p1kBKta9cktKGqLhMGAQYtw* getBestVisual__SbaIoSVYQmaQEDTcOIf6uA(tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q*, int)’: ⏎ /home/kai/.cache/nim/main_d/@[email protected]:233:16: error: ‘struct tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q’ has no member named ‘bestVisual’ ⏎ 233 | result = dpx->bestVisual(snum);
07:00:10FromGitter<offbeat-stuff> proc bestVisual(dpx:PDisplay,snum:cint):PXVisualInfo {.importcpp:"bestVisual",header:"<inc/config.cpp>".}
07:00:22FromGitter<offbeat-stuff> bestVisual(dpx,snum)
07:00:35FromGitter<offbeat-stuff> Can i do something to prevent this
07:00:35FromDiscord<mratsim> @offbeat-stuff, you can import the C++ file directly
07:00:48FromGitter<offbeat-stuff> wdym mratsim
07:00:54FromGitter<offbeat-stuff> Like how
07:01:36FromDiscord<mratsim> here are example on how to wrap C++: https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim#L183-L197
07:02:17FromDiscord<mratsim> the base library is here: https://github.com/mgbellemare/Arcade-Learning-Environment/tree/b2f755781cda57a984b6e3f3b6ef00c1f518b622/src
07:02:52FromDiscord<Cohjellah> HMM I mean, if it works as a regular gui on all platforms why wouldn't I want that aha
07:03:02FromDiscord<Cohjellah> every OS has access to OpenGL now doesn't it?
07:03:02FromGitter<offbeat-stuff> Ok got it i can import cpp coe
07:03:04FromGitter<offbeat-stuff> code
07:03:10FromDiscord<mratsim> I assume you need something like proc bestVisual(dpx:PDisplay,snum:cint):PXVisualInfo {.importcpp:"#.bestVisual(@)",header:"<inc/config.cpp>".}
07:03:15FromDiscord<Cohjellah> Otherwise, what other Gui framework would I even want
07:03:29FromDiscord<Rika> some people want native
07:03:33FromDiscord<mratsim> Apple deprecated OpenGL and OpenCL with Catalina
07:03:43FromDiscord<Rika> gtk, qt, whatever windows calls theirs, etc
07:03:51FromDiscord<mratsim> not sure if it's still there in 10.15
07:04:05FromGitter<offbeat-stuff> Still the same error
07:04:28FromGitter<offbeat-stuff> @mratsim
07:04:34FromDiscord<mratsim> well I don't know your types/header but basically
07:04:50FromDiscord<mratsim> "#" refers to the next unused argument
07:04:55FromGitter<offbeat-stuff> Well It's x11 and glx
07:05:00FromDiscord<mratsim> and "@" refers to the rest of the argument
07:05:46FromDiscord<mratsim> and that's how you can use it to declare that some functions are member functions and need to use foo.myFunction(bar) syntax
07:06:06FromGitter<offbeat-stuff> Okay My error comes because I need the c++ code at final be like result=bestVisual(dpx,snum)
07:06:18FromGitter<offbeat-stuff> but it becomes dpx->bestVisual(snum)
07:06:59FromDiscord<mratsim> Then use "bestVisual(@)"
07:07:45FromGitter<offbeat-stuff> Okay this solves it , Thanks
07:07:59FromDiscord<mratsim> you're welcome
07:08:24FromGitter<offbeat-stuff> Okay so the next error
07:08:44FromGitter<offbeat-stuff> Xdisplay on nim is consider different from xdisplay on c++
07:08:52FromGitter<offbeat-stuff> because of decleration
07:08:58FromGitter<offbeat-stuff> another compile error
07:09:23FromGitter<offbeat-stuff> basically a cannot convert from cannot convert ‘tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q*’ to ‘Display*’
07:09:35FromGitter<offbeat-stuff> cannot convert ‘tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q\* to ‘Display\*
07:09:59FromGitter<offbeat-stuff> They basically are same objects
07:11:25FromDiscord<mratsim> use cast in that case,
07:11:41FromDiscord<mratsim> likely the easiest.
07:11:58FromDiscord<mratsim> otherwise you need to tinker with the C (?) and C++ declaration.
07:11:59FromGitter<offbeat-stuff> Okay cast it but a type that exists in c++
07:12:41FromGitter<offbeat-stuff> also cpp decleration
07:12:43FromGitter<offbeat-stuff> XVisualInfo *bestVisual(Display *display, int screen)
07:12:53FromGitter<offbeat-stuff> There is a * in b/w
07:13:14FromDiscord<mratsim> is ptr in Nim
07:13:42FromGitter<offbeat-stuff> so what should I like put in cast[]
07:14:09FromDiscord<mratsim> so proc bestVisual(display: ptr Display, screen: cint): ptr XVisualInfo {.importcpp:"bestVisual(@)", header: ....}
07:14:16FromGitter<offbeat-stuff> Yeah PDisplay = ptr Display
07:14:33FromDiscord<mratsim> or if you now it's a mutation: proc bestVisual(display: var Display, screen: cint): ptr XVisualInfo {.importcpp:"bestVisual(@)", header: ....}
07:16:15FromGitter<offbeat-stuff> Well adding ptr there doesn't work they already are PTYPE = ptr TYPE
07:17:03FromGitter<offbeat-stuff> What is something that exist both in c++ and nim (type that i can cast to)
07:18:23FromDiscord<Cohjellah> HMMM so what are the most popular frameworks atm that are actively developed. We've got nimx and
07:18:44FromDiscord<Rika> fidget or smth i dunno
07:21:06FromDiscord<ElegantBeef> Nimx, Fidget, Nigui
07:21:12FromDiscord<ElegantBeef> And i guess gintro
07:21:23FromDiscord<ElegantBeef> plus whatever the qt one
07:22:20FromDiscord<Rika> No you’re a qt
07:22:25*nc-x joined #nim
07:23:41nc-xdoes anybody know if there is any reason why `[]` for JsonNode does not support BackwardsIndex, i.e. why a[^1] does not work for jsonnode?
07:23:41FromDiscord<ElegantBeef> Ok
07:23:57FromDiscord<mratsim> We use NimQML at Status for our Destop client
07:23:58FromDiscord<ElegantBeef> there isnt an impl for `[]` that takes a backwards index
07:24:14FromDiscord<mratsim> https://github.com/status-im/nim-status-client
07:24:45FromDiscord<KaiOShin> Okay @mratsim I changed cpp code
07:24:46FromDiscord<KaiOShin> void bestVisual(void dp, int screen)
07:25:02FromDiscord<KaiOShin> Now c++ auto casts variable
07:25:03nc-x@ElegantBeef: I mean is there any technical reason for it, or just that nobody bothered to do it till now and PR's/issues are welcome
07:25:11FromDiscord<ElegantBeef> The latter i imagine
07:25:23FromDiscord<mratsim> it's likely the more mature Nim GUI codebase out there @Cohjellah and we support all OS
07:25:52FromDiscord<mratsim> Oh? I though C++ didn't like auto-casting void pointers.
07:25:59FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/json.nim#L491 like it's not some implementation limitation
07:26:32FromDiscord<KaiOShin> Now There are functions in that cpp that require -lX11 -lGL
07:26:51FromDiscord<KaiOShin> So dynlib pragma (how does it work)
07:27:26FromDiscord<mratsim> dynlib is an alternative to header
07:27:42FromDiscord<mratsim> it loads from the library symbol table directly
07:28:22FromDiscord<Cohjellah> Problem that's probably not that big of a problem, but nimQML's licensing
07:29:24FromDiscord<KaiOShin> Yeah so about those functions
07:29:25FromDiscord<KaiOShin> /usr/bin/ld: /home/kai/.cache/nim/main_d/@[email protected]: in function `bestVisual(void, int)':↵@[email protected]:(.text+0x3e): undefined reference to `glXQueryVersion'
07:29:32FromDiscord<KaiOShin> and 10 more error lines
07:30:08FromDiscord<mratsim> Ah I see, but LGPL for GUI is less of a problem no?
07:30:18FromDiscord<Cohjellah> mmm
07:30:20FromDiscord<Cohjellah> Good point hey
07:31:46FromDiscord<mratsim> QT is LGPL or GPL anyway hence why nimqml has that license
07:31:54FromDiscord<mratsim> !repo webview
07:31:55disbothttps://github.com/daniel-j/nim-webview -- 9nim-webview: 11 15 3⭐ 1🍴 & 1 more...
07:32:26FromDiscord<mratsim> https://github.com/oskca/webview
07:33:19FromDiscord<mratsim> https://github.com/sciter-sdk/nsciter
07:33:28FromDiscord<ElegantBeef> Thanks nc-x, i now want to make a macro that can auto generate backward indexing operators
07:33:46FromDiscord<mratsim> for HTML/JS GUI using native webview and without electron
07:34:18FromDiscord<mratsim> (but without electron you need to do your own OS file access, layer)
07:34:30FromDiscord<Cohjellah> yeah I'm interested in web stuff
07:34:33FromDiscord<Cohjellah> and mobile
07:34:38FromDiscord<Cohjellah> hence why I was peering at nimx
07:34:49nc-xlol, you are welcome @ElegantBeef
07:35:01FromDiscord<Cohjellah> but like, QT is so complete, might be good to stick with it.
07:36:18FromDiscord<mratsim> If you happen to use QML and Nim for a while and later you want a Nim job, I'm sure the Status desktop team would consider your application very seriously.
07:36:45FromDiscord<ElegantBeef> Aw shit that's all i have to do is use QML 😉
07:37:31FromDiscord<Cohjellah> Status desktop team?
07:38:12*nc-x quit (Remote host closed the connection)
07:38:20FromDiscord<ElegantBeef> Status makes software using Nim, desktop is what people call computers, team is a group of individuals
07:38:28FromDiscord<Cohjellah> thank you for the breakdown
07:38:30FromDiscord<Cohjellah> had no idea what Status was
07:38:50FromDiscord<ElegantBeef> https://status.im/
07:39:05FromDiscord<Cohjellah> nifty
07:39:10FromDiscord<Cohjellah> don't suppose their mobile app is made with nim too?
07:39:15FromDiscord<7815> is the default return value for any `ref`, `nil`? or is `result = nil` basically necessary?
07:39:25FromDiscord<7815> (edit) "is the default return value for any `ref`, `nil`? or is ... `result" added "a" | removed "basically"
07:39:28FromDiscord<ElegantBeef> Default value for references is nil
07:39:54FromDiscord<ElegantBeef> Any other return value would be another heap allocation and we cant have that now can we 😄
07:40:03mipri!eval var n: ref int; echo n.isNil
07:40:07NimBottrue
07:40:18FromDiscord<7815> ah, very thank
07:41:22FromDiscord<ElegantBeef> Remember that `ref` is just a fancy managed `ptr` so they behave similarly
07:41:56FromDiscord<Cohjellah> @mratsim is the nimQML library not being touched in 15 months a problem with the updates to QT?
07:42:31FromDiscord<7815> no, i got that much, just wanted to know if there was a defined default result for `ref` procs
07:42:36FromDiscord<ElegantBeef> Ah
07:43:14FromDiscord<ElegantBeef> I over explain to make myself seem more photosynthesis
07:43:23FromDiscord<Cohjellah> btw Elegant. Chat app works
07:43:26FromDiscord<Cohjellah> now to never touch it again
07:43:36FromDiscord<Cohjellah> :nimAngry:
07:44:22FromDiscord<ElegantBeef> Nice
07:44:30FromDiscord<ElegantBeef> Can i see the end result?
07:44:45FromDiscord<ElegantBeef> ~~Dont post it here if you dont throw it in a link
07:45:00FromDiscord<Cohjellah> Yeah won't post it here because the IP pops up
07:45:07FromDiscord<Cohjellah> can send you binaries through dm
07:45:15FromDiscord<ElegantBeef> I mean i just want to see the c ode
07:45:17FromDiscord<ElegantBeef> (edit) "c ode" => "code"
07:45:18FromDiscord<Cohjellah> ah
07:47:13FromDiscord<Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=
07:47:18FromDiscord<Cohjellah> weops. Well that'll do
07:47:28FromDiscord<7815> is result always initialized?
07:47:30FromDiscord<Cohjellah> rip that does actually have the IP
07:47:33FromDiscord<7815> (edit) "result" => "`result`"
07:47:35FromDiscord<Cohjellah> no one play monkey business
07:47:37FromDiscord<ElegantBeef> Result is always the default value
07:47:50FromDiscord<7815> ah, now this makes sense.
07:47:51FromDiscord<ElegantBeef> So if it's a ref it's `nil` if it's a normal object it's `T()`
07:49:07FromDiscord<7815> yes, before this i thought to initialize it by `result = 0` before i.e. `result += 1`
07:49:11FromDiscord<Cohjellah> https://play.nim-lang.org/#ix=2Kbk
07:49:13FromDiscord<Cohjellah> There you go
07:49:33FromDiscord<ElegantBeef> Ah nope, that's the beauty of the result, it's there
07:50:06FromDiscord<7815> very cool, very imperative, very idiomatic
07:50:17FromDiscord<Cohjellah> Who was talking about nimx using openGL? Supposedly uses sdl2
07:50:25FromDiscord<ElegantBeef> probably me
07:50:47FromDiscord<ElegantBeef> https://github.com/yglukhov/nimx/blob/master/nimx.nimble also it does use both
07:51:15FromDiscord<Cohjellah> neato
07:51:19FromDiscord<Cohjellah> OpenGL for web though?
07:51:24FromDiscord<ElegantBeef> Nope, webgl afaik
07:51:30FromDiscord<Cohjellah> oh yeah, my b
07:51:50FromDiscord<ElegantBeef> It uses sdl for windowing/io afaik, and opengl/webgl for rendering and actual stuff
07:52:02FromDiscord<ElegantBeef> @7815 do you know about implict returning?
07:52:23FromDiscord<ElegantBeef> Atleast that's what i call it, probably bad wording by me
07:52:37FromDiscord<7815> no, it wouldn't ring a bell
07:52:44mipriI'd say it's bad, yeah, because there are two ways to return that aren't explicit
07:53:02FromDiscord<ElegantBeef> `proc a(): int = 10` is what i meant
07:53:09FromDiscord<ElegantBeef> The right hand can be any expression
07:53:09FromDiscord<Cohjellah> implicit returning got me so confused for a bit
07:53:13mipribut it's not a weird term in itself
07:53:19FromDiscord<7815> oh, yeah, this makes sense to me
07:53:50FromDiscord<ElegantBeef> It can also be an `if` or `case`, pretty dandy
07:55:52FromDiscord<7815> it's not that alien for me, since i've written much rust
07:56:03FromDiscord<ElegantBeef> Ah
07:56:12FromDiscord<ElegantBeef> Hope you stay to write Nim instead 😛
07:56:24FromDiscord<7815> i've written nim, before, no worries
07:56:54*vicfred quit (Quit: Leaving)
07:56:55FromDiscord<7815> generally fun to poke around with, i might try some embedded stuff without the gc
07:57:02FromDiscord<7815> (edit) "generally fun to poke around with, i ... might" added "also"
07:58:06FromDiscord<ElegantBeef> Ah, hard to beat the new GC methods even for embedded, as far as i know, though i havent touched embedded so i know nothing 😄
07:58:30FromDiscord<Cohjellah> what do you use nim for @ElegantBeef
07:58:39FromDiscord<ElegantBeef> Well nothing really
07:58:46FromDiscord<Cohjellah> epic
07:58:46FromDiscord<mratsim> @Cohjellah we have our own fork: https://github.com/status-im/nimqml
07:58:51FromDiscord<ElegantBeef> I'm a failed game developer that just writes code
07:59:12saemnew version of the extension published, should be a bit better behaved on the compiler, especially with some projects defined (I can send folks a list if they'd like).
07:59:28FromDiscord<ElegantBeef> That sounds sweet
07:59:41FromDiscord<Cohjellah> Interesting
07:59:48FromDiscord<mratsim> meeh, it's not a GC it's memory management
07:59:48FromDiscord<ElegantBeef> A bit better, meaning what though?
07:59:50FromDiscord<Cohjellah> cheers ratsim
08:00:04FromDiscord<mratsim> the "GC" word makes embedded people run away
08:00:13FromDiscord<mratsim> it's even deterministic memory management
08:00:28FromDiscord<ElegantBeef> I know they arent actualy GCs, but it's enabled with `--gc` so hence my gc
08:00:50FromDiscord<mratsim> "Yo Dawg, I put a gc in your gc so that you can gc your gc"
08:00:53saemElegantBeef that means it no longer wants to index the whole world each time and with project definitions I seem to have symbol lookup for the entire compiler project working. Also seem to be able to goto definition etc...
08:01:14FromDiscord<ElegantBeef> So repeat of my last compliment
08:01:18FromDiscord<ElegantBeef> Sounds sweet
08:01:42FromDiscord<mratsim> can you try to open Weave and look if it opening say "parallel_tasks.nim" pegs nimsuggest to 100% again @saem?
08:01:44saemLet's see if it actually holds up to someone who dives into the compiler much harder than I and also isn't on a machine as ridiculous as my own.
08:02:08FromDiscord<ElegantBeef> Well i'm not that deep into the compiler, but i'm on a meh machine
08:02:10saemmratsim hahahaha, it's a trap! but that's a good test case, let me go see, I've been meaning to do that.
08:02:12FromDiscord<ElegantBeef> So i'm probably a good candidate
08:02:23FromDiscord<ElegantBeef> Send the link
08:02:25FromDiscord<mratsim> ridiculous?
08:02:34FromDiscord<ElegantBeef> Probably 3 thread rippers super glued together
08:02:40saemI have a 24 core threadripper
08:02:48FromDiscord<ElegantBeef> Close enough
08:02:57saemdidn't slash out for much RAM, 64GB
08:03:04saemand an nvme, of course
08:03:08FromDiscord<mratsim> @7815 there is an #embedded channel with other embedded folks.
08:03:30saemRan koch test again and watching the activity monitor was... amusing
08:03:34FromDiscord<mratsim> ah, nice, I have a i9-9980XE and 128GB RAM 🙂
08:03:55FromDiscord<ElegantBeef> I have a xeon1231v3 and 16gb of 1333mhz ddr3 😛
08:04:01FromDiscord<ElegantBeef> Yall on fucking spaceships over here
08:04:22FromDiscord<mratsim> well, I can't develop Weave on a dual core can I?
08:04:26saemThe jump in RAM cost wasn't worth it... I can barely max out what I have now. It's not 3 threadrippers, but it is a gen 3.
08:04:31saem:D
08:04:47FromDiscord<ElegantBeef> Hey i've got 8 threads mratsim you might be able to
08:04:54FromDiscord<mratsim> because my laptop is a macbook from 2015 with only 2 cores and that was what I used for a looooong time
08:05:22FromDiscord<mratsim> I need to test scalability and usually scalability is problematic beyond 16 cores due to high synchronization costs.
08:06:05saemmratsim I'd like to cheat a bit here, do you have a single entry point file or one that's basically the "top" or is it a flat space with a few roots?
08:06:30FromDiscord<Cohjellah> Can you make pretty decent looking gui's with Karax?
08:06:31FromDiscord<mratsim> weave.nim at the root
08:06:40FromDiscord<Cohjellah> I'd assume so of course, but like interactive JS apps
08:06:58saemoof, I just walked past that and went straight into the weave folder, thanks.
08:07:00FromDiscord<mratsim> yes, you still need a presentation layer like webview or Electron or QML
08:07:01FromDiscord<ElegantBeef> Well if you use neel, or webview, yes
08:07:24FromDiscord<Cohjellah> Hol up
08:07:39FromDiscord<Cohjellah> so nimQML can be used for webs as well?
08:07:55FromDiscord<ElegantBeef> qt probably has a webview
08:07:55FromDiscord<mratsim> I think you can pass it JS
08:08:32FromDiscord<mratsim> https://doc.qt.io/qt-5/qtqml-javascript-topic.html
08:08:38FromDiscord<ElegantBeef> https://doc.qt.io/qt-5/qml-qtwebview-webview.html
08:08:40FromDiscord<ElegantBeef> Shit!
08:09:16FromDiscord<Cohjellah> so these are just 3 separate libraries
08:09:31FromDiscord<Cohjellah> I know Electron is a GUI framework for JS
08:09:46FromDiscord<Cohjellah> Webview and QML are just C++ libraries with Nim bindings?
08:10:00FromDiscord<mratsim> qml is
08:10:23FromDiscord<mratsim> webview is a C library
08:10:24FromDiscord<mratsim> that just exposes the OS native webview in a OS agnostic way
08:10:51saemOK, time for the test
08:11:14FromDiscord<Cohjellah> interesting
08:11:37saemhaha... computer is definitely spinning up fans
08:12:13FromDiscord<Cohjellah> Okay, so say I definitely hate JS but want to touch websites with Nim, best stack would be Karax, Jester and webview?
08:12:30FromDiscord<Cohjellah> or should I mess around with QML and try get that to function
08:12:44FromDiscord<ElegantBeef> You described me and if i want to use nim on websites i just use `nim js`
08:13:04saemoh interesting... the early stuff in the file works just fine.
08:13:07FromDiscord<Cohjellah> yeaaaah but how do I make some okayish gui's with Nim
08:13:12FromDiscord<Cohjellah> can't just compile anything to JS
08:13:27FromDiscord<Cohjellah> webpages more so. I guess they don't call them gui;'s
08:13:41FromDiscord<ElegantBeef> I mean if you want to make webpages with nim use the dom module 😄
08:13:46FromDiscord<ElegantBeef> Then export the js
08:14:06FromDiscord<ElegantBeef> you can compile "anything" to js, aslong as it has a js representation
08:14:34FromDiscord<Danny Hpy> sent a code paste, see https://play.nim-lang.org/#ix=2Kbp
08:14:37saemah, it's just when is mainmodule, that's the only part that doesn't work, but that makes sense -- mratsim seems ok.
08:15:01FromDiscord<Cohjellah> Interesting. I'll assume Nim In Action covers this when we make the Twitter clone
08:15:14FromDiscord<Cohjellah> I'll just have to spree through the book. Then I'll have less questions to bugger you all with :p
08:15:22FromDiscord<ElegantBeef> @Danny Hpy single type section
08:15:48FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Kbq
08:17:26FromDiscord<ElegantBeef> The important thing to know is that nim has a JS backend so most nim code can be output to JS, like Nico or Nimx do
08:17:35saemmratsim: loading isn't an issue at this point, what else do you want me to test?
08:17:50FromDiscord<mratsim> @saem wild thought, is nimsuggest actually trying to run fib(40)?
08:18:03FromDiscord<mratsim> well I just want to know if nimsuggest gets stuck at 100% still.
08:18:57FromDiscord<mratsim> because the thing is, when it does that, I can't benchmark at all, I get worse times than single-threaded because when a thread "yield" it loses priority, and nimsuggest hogs everything.
08:20:56FromDiscord<KaiOShin> Hi Anyone know how to print glGetString output
08:21:16FromDiscord<KaiOShin> It return ptr GLUbyte
08:21:31FromDiscord<KaiOShin> that should be char(GLubyte)
08:21:39saemmratsim I did get a nimsuggest crash, but the cache is still there to show information. :D
08:22:06FromDiscord<KaiOShin> It exactly is unsigned char
08:22:25FromDiscord<Danny Hpy> Oh I see, thanks a lot!!
08:22:39saemgoing to open it with the extension in a debugger
08:25:36FromDiscord<ElegantBeef> if it's a pointer to a char you should be able to `echo char(val[])`
08:27:25FromDiscord<KaiOShin> Got that working Just had to do loadExtensions() in my code first
08:27:59saemmratsim ok so I just get blips when I have it look up a definition or something,b ut otherwise no big deal.
08:28:09saemmratsim, what's your torture test?
08:28:53FromDiscord<mratsim> that's all really
08:29:20FromDiscord<mratsim> when I had nimsuggest on Weave I just had to kill it every minutes
08:30:54saemdo you use workspaces or just open the folder?
08:33:27FromDiscord<mratsim> I save my workspace but I think just opening the folder does it because it happened on both of my computer
08:33:54FromDiscord<mratsim> TBH I just disabled nimsuggest altogether
08:34:15FromDiscord<mratsim> more trouble than solution
08:34:26FromDiscord<mratsim> did that after my post on developer tools last week
08:35:05saemOK, well you need a setting to make it behave a bit better... you can give it a shot... put that in your .vscode/settings.json { "nim.project": ["weave.nim"] } if you open by folder or in your workspace settings. That should do it.
08:35:32saemAt least it'll behave much better, also use the nim variant of the extension. ;)
08:36:37FromDiscord<mratsim> will remember for when I redevelop on Weave again, thanks 🙂
08:36:54saemI have a few unused import warnings, but that's about it.
08:38:47FromDiscord<mratsim> the unused import are likely wrong
08:39:28saemI'm guessing the defines are a bit off and it's seeing things it shouldn't.
08:39:43FromDiscord<mratsim> it doesn't see a usage actually
08:40:36FromDiscord<mratsim> I don't think I use it in weave but the worse is {.push raises:[Defect].}
08:40:46FromDiscord<mratsim> then you get Defect declared but not used.
08:41:04FromDiscord<mratsim> and this is something that we use everywhere in Status codebase to enforce handling of exceptions
08:53:28FromDiscord<Cohjellah> Real talk. How do JS chat apps and other programs work if threading doesn't exist there
08:53:39FromDiscord<Cohjellah> Does Async await exist?
08:58:33FromDiscord<lqdev> yeah
08:58:54saemBecause JS is asynchronous by nature, this article explains the fundamentals: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
08:59:12FromDiscord<haxscramper> Pattern matching was merged to fusion
09:01:08saem\o/
09:13:31*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:16:46FromDiscord<Cohjellah> Thank youu
09:19:03FromDiscord<Cohjellah> btw, where are nim libraries installed to on ubuntu?
09:19:07FromDiscord<Cohjellah> I went through choosenim
09:19:23FromDiscord<Cohjellah> Can't remember where exactly they are. Need to compile and access Karun from Karax
09:20:23FromDiscord<lqdev> ~/.nimble/pkgs
09:20:23disbotno footnotes for `/.nimble/pkgs`. 🙁
09:20:58FromDiscord<lqdev> if karax doesn't build karun when you nimble install it, report a bug to karax
09:21:03FromDiscord<Cohjellah> oh ok
09:21:08FromDiscord<Cohjellah> they need to update the docs then
09:21:22FromDiscord<lqdev> also make sure that you have ~/.nimble/bin in your PATH
09:21:35FromDiscord<Cohjellah> in the code example it gives the nim c karax/tools/karun
09:21:39FromDiscord<Cohjellah> implying you need to compile it
09:21:54FromDiscord<Cohjellah> yeep you're right karun is already compiled and on path HMM
09:22:01FromDiscord<Cohjellah> (edit) "gives the" => "gives:"
09:22:53FromDiscord<lqdev> open an issue in karax that the docs should be updated
09:23:02FromDiscord<lqdev> or better yet, make a PR
09:23:20FromDiscord<Cohjellah> 😮
09:23:25FromDiscord<Cohjellah> >contributor
09:25:20FromDiscord<Cohjellah> If I'm honest, no idea how to make a PR to change the example
09:25:30FromDiscord<Cohjellah> Still a newbie to Github and git related shenanigans
09:25:59*habamax quit (Ping timeout: 260 seconds)
09:33:40*Tanger quit (Quit: Leaving)
09:34:01saemMight be worth giving it a try yourself, start with a timebox to try and if it doesn't work just report the issue. Even if you don't succeed it'll inform you as to how you can make a better issue report and more experience for next time.
09:41:43FromDiscord<Cohjellah> Timebox?
09:41:46FromDiscord<Cohjellah> I'll have a go
09:42:19saema pre-determined amount of time for you to give it a try.
09:44:48*saem quit (Remote host closed the connection)
09:44:48*saem_ is now known as saem
09:55:47*l1x quit (Quit: Connection closed for inactivity)
10:06:15FromDiscord<cybertim> so to solve my thread issue with halonium I 'rewrote' all the parts I needed from the webdriver to async/await, since it is my first try to get concurrency right in nim maybe someone can review it quickly to see if this is the correct path to go? i put the webdriver in asynchttpserver and it seems to preform great: https://gist.github.com/cybertim/c65b98a154f857270f0555ae6c11a3bc
10:06:55FromDiscord<ElegantBeef> one big thing, use let blocks
10:07:28narimiranYardanico: is ForumUpdaterBot down?
10:08:37*tane joined #nim
10:11:07FromDiscord<cybertim> not familliar with the block statement but i will check the docs, but usage of await, {.async.} and waitFor are my biggest concern 🙂 coudn't find any complete example to check if this is the correct implementation
10:11:13FromDiscord<ElegantBeef> oh not block statement
10:11:28FromDiscord<ElegantBeef> you can define multiple vars under a single `var`, `let`, or `const`
10:11:38FromDiscord<cybertim> ah ok
10:11:48mipri`resp.status == $Http404` , this is testing resp.status against strings like "200 OK", but the "OK" part of that is conventional. You should only be testing for 200
10:12:24FromDiscord<cybertim> ok, it was the linter/doc invscode that marked that one, and suggested using $ i remember
10:13:25FromDiscord<ElegantBeef> Also probably shouldnt use `/` for urls since on windows that'll put `\` afaik
10:13:42miprithose hints are generic type hints. You want the .code proc, that returns an HttpCode
10:14:49FromDiscord<cybertim> ah ok, didnt test the code against an unhappy path, so it didnt come up, but i will fix that
10:14:56FromDiscord<ElegantBeef> you can always define your own version of `/` in here though
10:15:29FromDiscord<ElegantBeef> After you use except to stop importing the os modules `/` 😄
10:15:53FromDiscord<ElegantBeef> You are on posix eh? Dont want to be wrong 😛
10:16:07FromDiscord<cybertim> im testing it with the geckdriver on windows, so i guess / works 😉
10:16:40FromDiscord<ElegantBeef> Guess maybe it's smart enough to take `\` as `/`
10:16:45FromDiscord<ElegantBeef> my browser is atleast 😄
10:19:01*krux02 joined #nim
10:19:05FromDiscord<ElegantBeef> I really dislike the redundant logic for findElements and find element
10:20:17miprios./ definitely uses DirSep which is \ on Windows, which isn't appropriate for URLs. I'd just use &"{self.session.driver.url}/session/{self.session.id}" et al.
10:23:03FromDiscord<cybertim> yes the findElement need some rewrite, but since nim is different from most languages im used to (i would have overloaded or use private functions or somehting) i still need to figure out what is the best way
10:23:04miprifor the async/await stuff specifically... I'm averse to async/await to the point that I still haven't used it in any language, but writing your own polling loop is probably wrong, and you're probably defying the intended style with those Future[T] returns
10:23:23FromDiscord<ElegantBeef> You can overload
10:23:48FromDiscord<ElegantBeef> I'm also not well versed in using async 😄
10:24:17FromDiscord<ElegantBeef> This is one of my super dumb suggestions for your requests https://play.nim-lang.org/#ix=2Kc1
10:24:23FromDiscord<ElegantBeef> I really need to stop using templates
10:25:44FromDiscord<cybertim> thnx stuff like this is weird for me, so i will check this out
10:26:26FromDiscord<ElegantBeef> templates are just nice
10:26:34FromDiscord<ElegantBeef> But i'm over using them as of late
10:27:33FromDiscord<ElegantBeef> Let you copy and paste code without manually doing it
10:31:14mipriit lets you cheaply avoid repeating yourself like that, but there's a readability cost, especially when you're injecting variables that aren't mentioned in the user's scope
10:31:59mipriI use templates for that most often in an inner scope, not at the module level.
10:32:34mipriif you've got a proc with its own inner template that cleans up some repetition, it's a lot harder to miss when you're reading the proc
10:34:34mipriI guess what you're noticing is that there's a false feeling of "job done" once the repetition is removed. The repetition is a sign that something is wrong, and you removed that sign, so is everything OK now?--it often isn't really, when you're using templates like this. You've just swept the dirt under the carpet and have missed a more useful rewrite.
10:34:56FromDiscord<ElegantBeef> Yea hence why i said it's super dumb
10:35:03FromDiscord<ElegantBeef> Using templates like that feels dirty cause it is 😄
10:35:45FromDiscord<ElegantBeef> I tend to suggest many bad things but hope i preface that they're bad enough people dont use them
10:54:33*frost-lab joined #nim
11:19:42*l1x joined #nim
11:22:12*habamax joined #nim
11:23:57*Arrrrrrrr joined #nim
11:28:18*MarderIII joined #nim
11:29:56FromDiscord<Clyybber> disruptek: Fixed taste for real now
11:36:48*frost-lab left #nim (#nim)
11:48:49FromDiscord<mratsim> @zevv: CPS based coroutines /closure iters, https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex06_coroutines.nim#L8-L20↵↵They they only work with int at the moment, seems like if I use auto, the argument is swallowed.
11:49:58FromDiscord<mratsim> probably something to do with generic early resolution ...
11:54:42Zevvmratsim: sweet, nice simple interface
11:55:10FromDiscord<mratsim> ideally we use coro like proc or func afterwards
11:55:15FromDiscord<mratsim> without so pragma
11:55:40FromDiscord<mratsim> so that would be "stage 1", with stage 0 being the resumable/suspend cotninuations
11:55:50FromDiscord<mratsim> withot coro pragma
11:56:33Zevvnow make coroYield return what you pass in pull() :)
11:58:02FromDiscord<mratsim> it does
11:58:34Zevvno, now pull returns what you pass in coroYield
11:58:50Zevvbut nevermind, just trolling
11:59:02Zevv(but lua coros have that, they pass two-way)
11:59:12FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/793448028484141056/unknown.png
11:59:22FromDiscord<mratsim> now I just need to figure why "auto" doesn't work but I think it's the generic early resolution issue
11:59:37FromDiscord<mratsim> yep
11:59:47FromDiscord<mratsim> when i use SomeInteger i have the same problem
12:00:17Zevvinteresting
12:01:56FromDiscord<mratsim> I think it resolves the first one without continuation and calls it
12:02:16FromDiscord<mratsim> but the warning disappears somehow?
12:10:27*clyybber joined #nim
12:13:40FromDiscord<mratsim> @zevv, seems like generics drop the cpsCall pragma cc @Clyybber
12:15:46FromDiscord<mratsim> ah no it's worse
12:15:58FromDiscord<mratsim> cpsCall becomes cpsCall() with generics
12:40:05*Vladar joined #nim
12:42:50*saem quit (Quit: Connection closed for inactivity)
12:47:22*clyybber quit (Quit: WeeChat 3.0)
12:48:10narimiranNim in 2020: A short recap — https://nim-lang.org/blog/2020/12/28/nim-in-2020-a-short-recap.html
12:55:18FromDiscord<narimiran[IRC]> (edit) Nim in 2020: A short recap — https://nim-lang.org/blog/2020/12/28/nim-in-2020-a-short-recap.html
12:59:53superbianarimiran: jesi ziv
13:01:04narimiransuperbia: yep
13:01:48*kungtotte quit (Read error: Connection reset by peer)
13:01:52superbianarimiran: jesi li jako osjetio?
13:02:47narimiransuperbia: ja nisam osjetio nista, a cura koja je bila u drugoj sobi kaze da je bas ful jako treslo. i kod vas je bio isto neki potres?
13:04:06FromDiscord<mratsim> @narimiran, now https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md
13:04:57*kungtotte joined #nim
13:05:00narimiran@mratsim i've read it the other day. is it a candidate for nim blog?
13:05:08FromDiscord<mratsim> yes
13:05:32FromDiscord<mratsim> it's to dispel the 2 different kind of workloads that you have and so that you need different schedulers
13:05:34superbianarimiran: najjaci do sad, drzal sam monitor da mi ne padne s stola
13:05:40FromDiscord<mratsim> i.e. Weave is not for IO
13:07:38narimiran@mratsim now we have some end-of-the-year, new-year-plans articles scheduled, but after that - it can be published as a guest post
13:07:58FromDiscord<mratsim> sure
13:10:39*nc-x joined #nim
13:10:57nc-xanybody here experienced with karax
13:11:00nc-x?
13:11:31FromDiscord<mratsim> @zevv, @disruptek, so I've provided the base API for both continuations and coroutines, however, I'm stuck due to either symbol not resolved, or because i don't understand where to patch stuff missing from the CPS transform: https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex07_functional_stream_compose.nim
13:12:11FromDiscord<mratsim> I don't feel like dealing with types in macro anymore, that's just a waste of time.
13:13:10Zevvbut if we don't do typed, are we stuck with the `var a: int = 3` notation?
13:13:20Zevvbecause, that's kind of sucky
13:13:42*nyd joined #nim
13:13:45FromDiscord<mratsim> why do you need to extract the type? for the proc signatures?
13:14:03Zevvfor the lifting to the env
13:15:12*WilhelmVonWeiner joined #nim
13:15:34FromDiscord<juliuskiesian> what's the name of a data structure that is fifo and has a fixed length? for example, we got [1, 2, 3, 4] with a fixed len of 4, then we push 5 into it, we get [2, 3, 4, 5].
13:15:58FromDiscord<Rika> id call it a glass
13:16:15FromDiscord<mratsim> I'll think about it, it would be easy to solve for C and C++ with a plain array of byte
13:16:28FromDiscord<mratsim> but JS is more tricky.
13:16:36FromDiscord<mratsim> @juliuskiesian a ringbuffer
13:16:51FromDiscord<mratsim> well one that overwrites
13:17:13FromDiscord<Rika> isnt a ringbuffer filo or what
13:18:14FromDiscord<mratsim> no it's fifo
13:18:32FromDiscord<Rika> i see
13:29:41*filcuc joined #nim
13:32:56miprihttps://play.nim-lang.org/#ix=2KcW - needs a third field if you want to pop from it
13:39:07*nc-x quit (Remote host closed the connection)
13:44:33FromDiscord<mratsim> in perf sensitive context, use "if ring.last + 1 >= ring.len: ring.len = 0" instead of mod
13:44:56FromDiscord<mratsim> ring.last=0 sorry
13:46:59miprito avoid division, sure. this is one of those optimizations that I wish would be hidden under a .succ call to an index type
13:47:40miprihere it's trivial but I've made mistakes while trying to avoid division in other contexts with modular numbers
13:48:09FromDiscord<mratsim> yep I know that, if you upgrade to a queue it becomes tricky
13:48:58FromDiscord<mratsim> some enforce a power of 2 queues to make division costless but that waste space
13:49:52FromDiscord<mratsim> and with queue since you track the start and the end you can't just take the modulo or you won't know if the start reached the end or the end reached the start (i;e. if the queue is empty or full)
13:50:16FromDiscord<mratsim> so there are 2 solutions: either add a sentinel slot.
13:50:37FromDiscord<mratsim> or do operation on 2length "domain"
13:51:04FromDiscord<mratsim> which is what I do here: https://github.com/mratsim/weave/blob/master/weave/datatypes/bounded_queues.nim
14:01:20Zevvthis man is like a magician. You need something special, he pulls it out of his weave-hat. I'm starting to believe weave contains at least one universe.
14:01:26Zevveverything is in there
14:02:07FromDiscord<Rika> mratsim secretly programmed his whole brain into weave
14:02:46FromDiscord<shadow.> weave was actually just compiles from his brain. mratsim just plugged a usb into his hippocampus and called it a day
14:04:26FromDiscord<shadow.> (edit) "compiles" => "compiled"
14:07:16FromDiscord<mratsim> haha
14:07:57FromDiscord<Rika> i mean how else would this lib be so fuckin good huh did you squeeze two people's brains into this or just your own
14:10:53*filcuc quit (Quit: Konversation terminated!)
14:11:11*filcuc joined #nim
14:13:35*MarderIII quit (Ping timeout: 258 seconds)
14:17:43*waleee-cl joined #nim
14:19:19FromDiscord<mratsim> I did it multiple times
14:20:06FromDiscord<mratsim> long research, trying to reimplement other competing lib in Nim. Trying other lib, getting a baseline, throwing away the code, restart.
14:20:22FromDiscord<mratsim> and research research research
14:21:48FromDiscord<mratsim> also I happen to understand the problem domain. And the actual primitives are really few. I didn't have to do something completely new on the outside (spawn and parallel for basically).
14:22:15FromDiscord<mratsim> so I could focus on the internals.
14:22:36FromDiscord<Rika> ~~i wasnt being serious~~
14:23:39FromDiscord<mratsim> I know 😉
14:28:29Zoom[m]@mratsim Reading your "flavours" text. May be s/"maximize working time"/"minimize idle time" ?
14:31:01*filcuc quit (Quit: Konversation terminated!)
14:31:17*filcuc joined #nim
14:42:47FromDiscord<mratsim> sgtm, you can open a PR
15:05:42*MarderIII joined #nim
15:09:06FromDiscord<shadow.> could someone explain to me how something like `set[0..99]` works? is it just stored internally as 100 bits, one for each number?
15:09:24*krux02 quit (Remote host closed the connection)
15:09:38FromDiscord<shadow.> from my naive understanding, the largest uint type `u64` would only support something like `set[0..63]` so im sure im misunderstanding how it works
15:09:49*filcuc quit (Ping timeout: 264 seconds)
15:10:13Zevvrecalculate that
15:10:36FromDiscord<shadow.> well
15:10:43FromDiscord<shadow.> a 64 bit unsigned integer is composed of 64 bits, correct?
15:10:50Zevvyes
15:10:59FromDiscord<shadow.> therefore set[0..63] could contain 64 different values right
15:11:04FromDiscord<shadow.> which would be a bit for each value?
15:11:34Zevvyes, but that is not what a set does
15:11:46FromDiscord<shadow.> so then how does a set work internally?
15:11:53FromDiscord<shadow.> if it's easier to just look at source i can
15:12:00Zevvit has a bit for each possible value your type can have
15:12:15FromDiscord<shadow.> hmm
15:12:21FromDiscord<shadow.> well yeah so something like
15:12:26FromDiscord<shadow.> u8
15:12:29ZevvSo a set[uin64] will need 18446744073709551615 bits of storage
15:12:35FromDiscord<shadow.> yeah
15:12:41FromDiscord<shadow.> i know that, sorry
15:12:43FromDiscord<shadow.> what i was saying was
15:13:03Zevvapart from that, yes, that's how it works
15:13:05FromDiscord<shadow.> how can the set use something like 256 bits for a set[u8]
15:13:09Zevvit stores an array if u8s
15:13:12FromDiscord<shadow.> ahhh
15:13:13FromDiscord<shadow.> that makes sense
15:13:20Zevv /of/ u8ts
15:13:20FromDiscord<shadow.> ty
15:13:39Zevvand it has some nice optimizations built around it
15:13:41FromDiscord<shadow.> so does it do modulo to find the index, and then bitshifts and masking for bitops?
15:14:09Zevvsomething like that, yes
15:14:12FromDiscord<shadow.> thanks
15:14:23FromDiscord<cybertim> using asynchttpserver always results in a 'single' execution of per-requests, using async it should at least start a few request together right? is it if one single function (like execProcess) is there, the whole request will just wait for it to return? or maybe this is a windows thing?
15:15:16Zevvshadow.: look at this beauty, this is setting bit 33 in a set[uint8]: a__9cPU9aVmmvIe4EU0aUCl9b41w[(NU)(((NI) 33))>>3] |=(1U<<(((NI) 33)&7U));
15:15:58Zevvcybertim: yes, execProcess will block your async thread
15:16:16*Kaivo joined #nim
15:16:17FromDiscord<cybertim> hm ok
15:16:33FromDiscord<cybertim> and also httpclient?
15:16:47Zevvif you want to go async, you need to go all the way
15:17:04ZevvNim has poor (ie none) async support for subprocesss, but you cna find that here: https://github.com/cheatfate/asynctools
15:17:04FromDiscord<cybertim> im using the asynchttpclient
15:17:10Arrrrrrrrlewd
15:17:34FromDiscord<cybertim> ok thanks
15:41:32Oddmongeris it possible to extend an enum ?
15:42:40Oddmongeri'm using illwill which provides pre-defined colors in enmus (bg & fg colors). I'd like to add values in those enums, without modifying the original source illwill.nim
15:45:24FromDiscord<mratsim> no, but you can use macro to getImpl the enum and create an extended copy for your use
15:45:38FromDiscord<mratsim> similar for the proc of illwill
15:46:08Oddmongera sort of hijack of the original enum ?
15:46:21FromDiscord<mratsim> that's the expression problem. enums make it easy to add proc but hard to add types while inheritance makes it easy to add types but hard to add proc.
15:46:24FromDiscord<mratsim> yep
15:48:06Oddmongerthank you (but for the moment i note it's not possible)
15:56:48disruptekclyybber: holy shit, it actually runs.
15:58:20disruptekhe actually unblocked us. 🎉
16:03:24*Arrrrrrrr quit (Quit: Arrrrrrrr)
16:07:59Oddmongerok tried with a cast (yes, i know), but couldn't extend the colors beyond the basic term 16 colors
16:09:01FromDiscord<lqdev> how would you expect it to work
16:09:05Oddmongerthat must be the term code sent by illwill for composing which should be changed, but that means changing TerminalBuffer and so
16:09:41Oddmongerlqdev : well i was thinking that maybe i could at least use 255 colors codes
16:10:04FromDiscord<lqdev> why not just go with true color
16:10:17FromDiscord<lqdev> if illwill doesn't support true color, then open an issue
16:10:20FromDiscord<lqdev> or PR
16:10:29Oddmongerit doesn't
16:10:55Oddmongerissue has already been opened, if i remember well
16:11:20Oddmongerthat's sad, because the rest is nice (non blocking keyboard, fullscreen mode …)
16:22:23*a_chou joined #nim
16:23:31*a_chou quit (Remote host closed the connection)
16:53:56*krux02 joined #nim
16:53:59Zevvdisruptek: what
16:54:03Zevvunblocked? how?
16:58:05disruptekclyybber fixed it.
17:13:16Zevvclyybber fixed it.
17:13:25Zevvwhat did that take so long if it was so simple!
17:13:33Zevv@clyybber: hero!
17:18:20disruptekit's not really that simple. 😜
17:18:54Zevvpfff
17:18:56disrupteki can finally run tests of typed, and whaddya know, some of them fail.
17:19:09disrupteknow i have to remember how this thing works.
17:19:36ZevvI tried that
17:19:37ZevvI failed
17:19:55Zevvwhat nim branch is that in?
17:22:09disruptekit's not. it's not really fixed; it's a work-around merged into cps master.
17:22:41*abm joined #nim
17:22:47disruptekcarnac is still broken. 😉
17:26:26Zevvoh the dirty bugger just rewrote `nnkYieldStmt` to `coroYield`
17:26:29Zevvho hum
17:27:13disruptekyou are going to have to tell him that mutant doesn't work.
17:27:20disrupteki don't seem to be getting through.
17:27:39Zevvthere will be blood
17:28:00disruptekthe erasure is fine, but the bones can't be those of a mutant.
17:30:55disruptek157 env_402655425(continuation).j_402655427 = 3
17:30:59disruptek159 j = 5
17:31:12disruptekthat dog will not hunt.
17:31:18Zevvgiven his past perspicaciousness in other fields, I give him the benefit of the doubt for now
17:31:40disruptekeh it's wrong.
17:31:51disruptekuse your intuition.
17:31:53ZevvI agree.
17:31:56Zevvand that's all I have
17:32:03disruptekit's enough.
17:32:17disruptekwisdom is a hard thing to pin down, but that doesn't make it any less real.
17:32:37Zevvit'
17:32:48Zevvinuition is the only thing I run on with this stuff
17:33:03*saem joined #nim
17:33:04*nikita` left #nim (#nim)
17:33:08Zevvwhich makes it kind of fun that after all his travels through the looking glass and back, basically brought him back where we sent him
17:33:33disrupteki mean, we all write nim.
17:33:42disruptekthere's some consistency to our taste.
17:34:19Zevvanyhow, given we're no longer blocked
17:34:26Zevvdoes that mean I actually have to /do/ something now?
17:35:16disruptekit would be nice if tzevv failed less predictably.
17:35:37disruptekbtw, my testes are getting to be rather pleasant to use.
17:42:53Oddmongerso much nim… so little time
17:43:03FromDiscord<Rika> nime
17:46:26*Arrrrrrrr joined #nim
17:47:53disruptekzevv: let (x, y) = (cpsCall1(), cpsCall2()); echo x; echo y;
17:47:59disruptekthis is a super fun transform.
17:48:11ZevvI think we decided not to allow that
17:48:17Zevvjust like let x = cpsCall(1) + cpsCall(2)
17:48:29disruptekwhy not?
17:48:50Zevvbecause I have *no* clue how that would work if you go anding and orring
17:48:57Zevvlet x = cpsCall(1) and cpsCall(2)
17:49:03Zevvhow do you transform that?
17:49:08*narimiran quit (Quit: leaving)
17:49:09Zevvwith arbitrary complex expressions
17:49:21disruptekthe same way you transform anything.
17:49:45Zevvmethinks one thing at a time
17:49:53disruptekleft-to-right, baby.
17:50:21Zevvyeah but there's control flow in the expression itself. it requires actually /thinking/ about that stuff
17:50:35disrupteknah.
17:50:50disruptekthe less thinking, the better, with cps.
17:51:00Zevvif you say so, boss
17:55:20disrupteki think we should rewrite finally: as another goto on the stack, but we still need to figure out the actual exception behavior so we can unwind correctly.
17:55:44disruptekthe erasure container helps with this, and result.
17:55:55disruptekjust makes it a little cleaner.
18:01:19*krux02 quit (Remote host closed the connection)
18:06:16disruptekproc zevv(x: int; y = cpsCall(x)) = ## hilarity ensues...
18:13:14FromDiscord<exelotl> oh god lol
18:22:43disruptekWe are having a problem billing your account. Please enter a new payment method or check with your payment provider for details on why the transaction failed. You can downgrade to GitHub Free in your Billing settings.
18:22:52disruptekstory of my life.
18:24:58Zevvwait what
18:29:20Oddmongeris it possible to extract runes from the current terminal's font with Unicode module ?
18:29:43Oddmongerlike the old basics programs which displayed the ascii table :)
18:30:17FromDiscord<haxscramper> Well you can get output of the command and parse it in any way you like
18:30:41FromDiscord<haxscramper> But I'm not sure if it is possible to get text after it has been displayed on terminal
18:31:30Oddmongeroh i would be happy by just displaying in terminal
18:31:32FromDiscord<haxscramper> That is - using stdlib functionality, without messing with API for a particular terminal emulator (some of them might provide support for this)
18:32:49Oddmongerit seems with « unicode » i can only works with runes i provide myself
18:33:14Oddmongernot doing things like for i=1..255: print chr$(i)
18:33:40Oddmonger(sorry for the chr$() , i don't know nim equ)
18:33:58FromDiscord<haxscramper> What exactly you want to do?
18:34:15FromDiscord<haxscramper> Run program and do something with it's output (parse/display again etc.)?
18:34:30Oddmongerjust seeing what can be displayed with the font
18:35:19FromDiscord<haxscramper> So something like `msgcat --color=test`?
18:35:48FromDiscord<haxscramper> But for testing characters
18:35:51Oddmongerah nice, didn't knew this
18:35:57Oddmongeryes something like that
18:36:44FromDiscord<haxscramper> Like if particular terminal font is able to correctly display all necessary runes? Just looping through them is one option, since `Rune(<integer value>)` can give you
18:37:19FromDiscord<haxscramper> If you need to check for particular set of runes you might loop only over necessary unicode blocks (like math for example) if that's what you need
18:39:55Oddmongerah, i can display integer values, that's interesting
18:40:29Oddmongeri was afraiding something like (page, subpage, range, value) (something tricky)
18:45:49Oddmongerthank you haxscramper, it works perfectly
18:46:51FromDiscord<haxscramper> `echo 'import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it))' | nim r --cc:tcc -`
18:46:59FromDiscord<haxscramper> Just for the sake of it
18:47:19FromDiscord<haxscramper> Nim one-liner to display all unicode math runes
18:47:51FromDiscord<haxscramper> hm
18:47:59FromDiscord<haxscramper> !eval import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it)
18:48:02NimBotCompile failed: /usercode/in.nim(1, 64) Error: expected: ')', but got: '[EOF]'
18:48:13FromDiscord<haxscramper> !eval import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it))
18:48:16NimBot∀∁∂∃∄∅∆∇∈∉∊∋∌∍∎∏∐∑−∓∔∕∖∗∘∙√∛∜∝∞∟∠∡∢∣∤∥∦∧∨∩∪∫∬∭∮∯∰∱∲∳∴∵∶∷∸∹∺∻∼∽∾∿≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋⊌⊍⊎⊏⊐⊑⊒⊓⊔⊕�...
18:48:49saemMorning folks
18:51:11*disruptek 👋
18:51:33*jjido joined #nim
18:51:39Oddmonger!eval(Rune(42) & " ")
18:52:03Oddmongerah, discord bot
18:54:29FromDiscord<haxscramper> You forgot to import unicode, this is an IRC bot actually and it seems I killed it
18:59:29Oddmongeranyway, i had forgotten to change Rune to string with $ , for the concatenation
19:02:27Zevvdisruptek: why the github payed account then?
19:04:57*Jjp137 quit (Ping timeout: 260 seconds)
19:05:33*saem_ joined #nim
19:07:54disruptekbecause i have shit tons of code that i don't share.
19:08:20FromDiscord<lytedev> github private repos are free now ;)
19:08:26*Jjp137 joined #nim
19:08:39disrupteki know, it seems i will be "upgrading" to free.
19:19:11*Jjp137 quit (Quit: Leaving)
19:20:13FromDiscord<lqdev> is there any reason to get pro anymore
19:20:21*Jjp137 joined #nim
19:21:16FromDiscord<bark> why do people like github so much argh
19:21:35FromDiscord<bark> if it loves open source so much it should be open source itself
19:22:31FromDiscord<shadow.> bc
19:22:34FromDiscord<shadow.> browser go brr
19:24:21FromDiscord<bark> gitlab: exists, gitea: exists, sr.ht: exists, and many more
19:29:33FromDiscord<bark> wait, nim doesn't support windows 7?
19:30:06FromDiscord<bark> (edit) "wait, nim doesn't support windows 7? ... " added "or was my old laptop 32 bit all along"
19:31:59leorizegithub just have the best UX
19:32:15FromDiscord<bark> i know, and it has the most people
19:32:20FromDiscord<bark> so your project is going to be noticed
19:32:48leorizenim should support windows 7, I don't think we use any APIs beyond Vista/7 in the stdlib
19:32:53FromDiscord<bark> yeha
19:32:59leorizeabout a half should work on XP as well
19:33:03FromDiscord<bark> but it's the 32 bit windows
19:33:09FromDiscord<bark> i messed up
19:34:09FromDiscord<bark> my fault as always
19:39:02*vicfred joined #nim
19:45:23*leorize quit (Ping timeout: 240 seconds)
19:54:18*vicfred_ joined #nim
19:57:08*vicfred quit (Ping timeout: 256 seconds)
19:57:46*vicfred__ joined #nim
20:00:19*vicfred_ quit (Ping timeout: 246 seconds)
20:00:28*vicfred__ quit (Client Quit)
20:02:02*leorize joined #nim
20:02:03saem_Any one got opinions on vscode extensions' project config? considering making it accept an optional backend per project, see: https://github.com/saem/vscode-nim/issues/20#issuecomment-752019115
20:02:04disbotAdd `auto` config to `nim.buildCommand` for multi-target projects
20:12:38disruptekmy opinion is that the energy wasted on supporting stupid code should be devoted instead to supporting transition to better code. make it work the way you want and then you have a smaller userbase of people to help transition.
20:14:18FromDiscord<ElegantBeef> Good job saem, just had goto def work in the compiler 😄
20:14:40saem_Yay, thanks
20:15:19*filcuc joined #nim
20:15:23saem_disruptek: that's my preference, but that requires a certain amount of social capital to say "this is the direction", so Imma count your message as some of that capital and stuffing it in the bank
20:16:16*filcuc quit (Client Quit)
20:16:29*filcuc joined #nim
20:16:33FromDiscord<ElegantBeef> I mean having a config file does the exact same, so maybe the smart thing to do is prompt users to make a config file if they're only developing for a single platform on the first opening of a folder
20:17:18FromDiscord<ElegantBeef> Unless i misunderstand what you were asking about
20:17:59saem_Can a config file in fact set the backend or does it only set defines related to the backend?
20:19:03FromDiscord<ElegantBeef> a config should be able to set `backend` to whichever they want which is what will be used when you use `nim c`
20:19:19FromDiscord<ElegantBeef> `c` is short for compile and not the C backend afaik
20:19:33*filcuc quit (Read error: No route to host)
20:19:35saem_IIUC nimsuggest -d:js != nimsuggest --backend:js, the latter also has the define, but doesn't set the backend which carries further meaning.
20:19:49*filcuc joined #nim
20:20:07*nyd quit (Quit: nyd)
20:21:07saem_That's true, so one can in fact do --backend:js in side a cfg and it's equivalent? <-- having a "geez, I can't believe I didn't think of that moment"
20:21:23FromDiscord<ElegantBeef> Yea a config with `--backend:js` forces `nim c` to compile with js
20:21:37FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/793574463765217330/unknown.png
20:21:45FromDiscord<ElegantBeef> Pic for proof, look at that out file 😄
20:22:29*habamax quit (Ping timeout: 256 seconds)
20:22:39saem_pics... and it did happen.
20:22:44FromDiscord<ElegantBeef> Lol, indeed
20:24:05FromDiscord<ElegantBeef> Disruptek you've masochistically touched the compiler, how much work would it be to make it so iterators can use templates through the dot operator? `toSeq(iterator)` is pretty bad to read
20:24:40FromDiscord<ElegantBeef> I'm guessing a fair bit if it's even possible
20:24:45*filcuc quit (Read error: Connection reset by peer)
20:24:51saem_I have a vague feeling this goes into witness territory.
20:25:00*filcuc joined #nim
20:25:07FromDiscord<ElegantBeef> Huh?
20:26:07saem_OK, that simplifies a thing... now I just need to sort out what to encourage. I think the next thing to figure out is how to have mutually exclusive cfgs but they can work against the same nim project file
20:26:41disruptekhow would you resolve the dot operator without knowing the type of the argument?
20:26:46*FromDiscord quit (Remote host closed the connection)
20:26:58disruptekanyway, what's wrong with `toSeq(iterator)`? i prefer `toSeq iterator`, myself.
20:27:02*FromDiscord joined #nim
20:27:09FromDiscord<ElegantBeef> Ah pretty much impossible then
20:27:36*livelmao joined #nim
20:27:37saem_witness: https://github.com/nim-lang/Nim/pull/11992
20:27:39disbotevery symbol becomes 1st class; defines 0-cost lambda and aliases; inline iterators/templates/etc can be passed to any routine ; snippet at 12https://play.nim-lang.org/#ix=250A
20:28:13livelmao@disbot hi
20:28:15disruptekyeah, i'm afraid of that pr.
20:28:33saem_I'm not advocating for that to be merged, but the results are compelling. But I haven't dug into the details to really figure it out.
20:28:34disruptekdisbot: you have fans?
20:28:35disbotmost likely.
20:28:42disruptekwow.
20:29:09saem_disruptek I bet they even try to slide into disbot's dms
20:29:17disruptekthirsty motherfuckers.
20:29:24saem_srsly
20:29:36FromDiscord<ElegantBeef> Yea i know of that rfc/pr, but it's quite a lot of stuff changed 😄
20:29:54*filcuc quit (Quit: Konversation terminated!)
20:30:09*filcuc joined #nim
20:30:09saem_I know, but foo.toSeq is exactly that type of thing it touches lots of concepts that are deeply fundamental.
20:30:23disruptekyes, this is the problem.
20:31:06FromDiscord<acek7> hope everyone is doing well
20:33:57saem_as well as can be, thanks
20:35:04*filcuc quit (Quit: Konversation terminated!)
20:35:20*filcuc joined #nim
20:36:03*vicfred joined #nim
20:37:02*livelmao quit (Remote host closed the connection)
20:37:31*hnOsmium0001 joined #nim
20:40:14*filcuc quit (Quit: Konversation terminated!)
20:40:30*filcuc joined #nim
20:45:26*filcuc quit (Quit: Konversation terminated!)
20:45:34*filcuc joined #nim
20:46:58Zevv 9
20:47:04saem_10
20:47:06FromDiscord<ElegantBeef> 12?
20:47:12saem_damn, ruined
20:50:35*filcuc quit (Quit: Konversation terminated!)
20:50:45*filcuc joined #nim
20:54:32*Arrrrrrrr quit (Quit: Arrrrrrrr)
20:55:45*filcuc quit (Quit: Konversation terminated!)
20:55:55*filcuc joined #nim
21:00:53*filcuc quit (Quit: Konversation terminated!)
21:01:07*filcuc joined #nim
21:05:59*filcuc quit (Client Quit)
21:06:12*filcuc joined #nim
21:15:20*filcuc quit (Ping timeout: 256 seconds)
21:33:37*NimBot joined #nim
21:35:47disruptekplanetis[m]: why can't add() be efficient in your varchar?
21:38:09planetis[m]maybe it can
21:39:14planetis[m]The length might need more bytes and the rest of the data moved back
21:39:58planetis[m]if you need something simpler there is another varchar implementation that uses seperate length field
21:40:16planetis[m]https://github.com/andreaferretti/spills/blob/master/spills/varchar.nim
21:42:20planetis[m]i guess i can try to do that
22:10:05*superbia quit (Quit: WeeChat 3.0)
22:12:54FromGitter<jrfondren> https://play.nim-lang.org/#ix=2Kfl
22:16:20FromDiscord<ElegantBeef> `sequtils` is like "What am i to you?"
22:16:37FromDiscord<7815> how do i get a `ref`erence or the `p`oin`t`e`r` of an object, in code?
22:16:54FromDiscord<7815> is this even possible?
22:16:57FromDiscord<lqdev> nope
22:17:06FromDiscord<lqdev> due to how `ref`s work and what they are
22:17:08FromDiscord<7815> huh
22:17:15FromDiscord<lqdev> a `ref` is a pointer to some heap-allocated, GCd memory
22:17:19FromDiscord<7815> and the ptr?
22:17:27FromDiscord<lqdev> is a pointer to any old memory
22:17:29FromDiscord<ElegantBeef> `.addr` returns a pointer, ref requires you to do `new T` then passing that around
22:18:03FromDiscord<7815> yes, i have an object, i wish to have its `addr`ess in memory
22:18:08FromDiscord<7815> thank you
22:18:21FromDiscord<7815> c programmer, i know what i'm doing
22:21:29FromDiscord<7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfq
22:24:11FromDiscord<7815> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2Kfs
22:24:47FromDiscord<ElegantBeef> Why are you using `self.addr`?
22:24:57FromDiscord<ElegantBeef> `var Node` is already reference to `self`
22:25:33FromDiscord<ElegantBeef> or rather whatever you passed there
22:27:33FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Kfu
22:28:05FromDiscord<7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfv
22:29:27FromDiscord<7815> getting the address of the node, lets me walk down the tree without having to first check if the root node is `nil`.
22:29:39FromDiscord<7815> it's just much nicer code
22:29:44FromDiscord<ElegantBeef> I'm super confusued
22:30:01FromDiscord<ElegantBeef> It should be identical to this https://play.nim-lang.org/#ix=2Kfw
22:31:28FromDiscord<7815> wouldn't `self = self.lhs` mean that the caller's node then is the inserted node?
22:31:40FromDiscord<7815> this would mutate the caller's node
22:32:12FromDiscord<7815> calling `node.insert(key, val)` would change `node` into the child that's been inserted.
22:32:47FromDiscord<ElegantBeef> Couldnt you just make `cur` a node then, and have the default value as self
22:32:55FromDiscord<ElegantBeef> also if these are ref objects `var` is redundant
22:33:53FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Kfx like isnt this the same as what you had just without your pointer shinanigans
22:34:38FromDiscord<7815> non-`var` wouldn't let me assign to self. and i handle `self = nil` by inserting a root node.↵`.addr` cannot be called on non-`var`
22:35:39FromDiscord<7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfy
22:36:15FromDiscord<7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfz
22:36:20FromDiscord<7815> to preserve the original node
22:36:23miprinon-var doesn't let you assign to self, but var causes you to assign to the caller's variable. you need a new local variable to mutate a parameter locally to a proc
22:36:33FromDiscord<7815> since you're changing `self`.
22:37:07FromDiscord<ElegantBeef> Yea i'm not looking at the logic, just trying to get the addr out since it's almost certainly not needed
22:37:21FromDiscord<ElegantBeef> Bad approach as it doesnt actually look at the end result 😄
22:37:44FromDiscord<7815> you should most probably analyze the logic, otherwise your advice will not match the problem
22:38:30FromDiscord<7815> sent a code paste, see https://play.nim-lang.org/#ix=2KfA
22:41:47FromDiscord<7815> why are docs so difficult to find for i.e. `addr` etc?
22:42:14FromDiscord<ElegantBeef> https://nim-lang.org/docs/system.html#addr%2CT
22:42:22miprihttps://nim-lang.org/docs/lib.html , search for addr, it's the first result.
22:42:28FromDiscord<ElegantBeef> They arent, use the search bar on the docs
22:43:48*_angus_ joined #nim
22:46:29FromDiscord<7815> yes, of course, but is taking an address advised against? for a imperative system programming language, it feels like one of the most important things...
22:47:27FromDiscord<ElegantBeef> It's advised against if you can use any of the other features
22:47:41FromDiscord<7815> mipri: one wouldn't probably look for `addr` one would most likely search for `referenc(ing)`, `dereferencing`, `boxing`, etc
22:47:50FromDiscord<7815> maybe `address`, yes...
22:48:03mipriyeah, ok
22:48:57FromDiscord<ElegantBeef> You might be forced to use addr here
22:49:01FromDiscord<7815> yes.
22:49:19FromGitter<pigmej> Heyah, I was wondering, from 1.3.1 DateTime.hour (and others) are deprecated, I kinda understand the reasoning behind that BUT I was using it sometimes to "abuse" the logic and let's say have original date and go back in time TO FIXED hour, so "gimme all from 11PM today" was basically super easy
22:49:22FromDiscord<7815> this is how you write this, that's just how it is
22:49:38*smitop joined #nim
22:50:09FromGitter<pigmej> now I'm trying to find a way around that and that makes rarely a sense honestly, because DateTime.hour is not accessible also, so I'd need to recalculate everything or create some derived type from DateTime? Or am I reading docs wrong and it's just super easy
22:50:31*_angus_ quit (Remote host closed the connection)
22:50:56mipriif Node's a ref type, none of the addrs are necessary
22:51:15FromGitter<pigmej> basicaly the goal is "realtive time" with a difference that I don't want to move by fixed amount of hours/minutes but rather set the "from the beginning of the hour" or sth like that
22:51:23FromDiscord<ElegantBeef> That's what i was saying, refs are just pointers so it should be fine without addr
22:51:44FromGitter<pigmej> and if I'm not mistaken TimeInterval would not help here at all
22:52:04FromDiscord<ElegantBeef> I'm uncertain the desired here
22:52:10FromDiscord<ElegantBeef> You wan to move to the top of the hour?
22:52:33FromGitter<pigmej> not only, but also "midday two days ago"
22:53:04FromGitter<pigmej> or sth like that, I had it working in uglish way by setting datetime.hour = 12
22:53:05FromGitter<pigmej> for example
22:53:18FromGitter<pigmej> it's fine to go back two days back with timeInterval
22:53:27FromDiscord<ElegantBeef> Isnt it just `day - dayOffset`?
22:53:29FromGitter<pigmej> but I cannot easily go two days ago AND 12PM
22:53:41FromGitter<pigmej> not quite, because that relaative part is then missing
22:54:02FromGitter<pigmej> as the original time mark will be preserved
22:54:42FromGitter<pigmej> obviously I could also create time inverval from midnight and clear the time part from my date time but.... that just sounds hacky
22:55:14FromGitter<pigmej> especially that you cannot get now easily .hour, .seconds, .minutes anymore from datetime
22:55:52FromDiscord<ElegantBeef> You can https://nim-lang.org/docs/times.html#hour%2CDateTime
22:56:58FromGitter<pigmej> oh crap....
22:57:09FromGitter<pigmej> I was somehow looking for "hours" not "hour"...
22:57:34FromDiscord<ElegantBeef> Well it's all there in nice ranged packages
22:58:19FromGitter<pigmej> yeah..
22:58:21FromGitter<pigmej> now all clear..
22:58:33FromDiscord<ElegantBeef> Does that solve all your problems?
22:58:36FromGitter<pigmej> I still don't like that deprecation though but at least clear...
22:58:37FromGitter<pigmej> yeah
22:58:48FromGitter<pigmej> now I just need to distract or create new one
23:00:21FromGitter<pigmej> thx
23:01:35*krux02 joined #nim
23:06:21FromDiscord<7815> mipri: oh, sorry. the algorithm keeps track of a reference to a reference to the object, since it walks the references of the tree, until it gets to a `nil` and then inserts a new node. the double reference is necessitated.
23:07:22FromGitter<deech> How do I move and a `cstring` into an existing null cstring? Simple assignment doesn't seem to work.
23:07:47FromDiscord<7815> mipri: it would be unable to insert a new node into the tree when it arrives at a `nil` if it didn't have another indirection
23:08:05FromDiscord<fwsgonzo> when is the next minor version?
23:08:33miprideech: copyMem. cstrings are ptr, so assignment doesn't copy
23:09:16FromGitter<deech> Ah ok, I was hoping there was an op that just did that. Thanks!
23:15:37*tane quit (Quit: Leaving)
23:25:10*MarderIII quit (Ping timeout: 268 seconds)
23:30:20FromDiscord<Meowz> What build do I get if I use `-d:foobar` ?
23:31:44FromDiscord<ElegantBeef> you define a compile time field entitled `foobar`
23:32:53FromDiscord<ElegantBeef> Which means you can do `when defined(foobar)`
23:33:06FromDiscord<ElegantBeef> Probably should read https://nim-lang.org/docs/nimc.html
23:34:13FromDiscord<fwsgonzo> anyone know what the best package for Nim syntax in Atom is?
23:35:03FromDiscord<Meowz> Oh, thanks
23:41:33*saem quit (Quit: Connection closed for inactivity)
23:41:33*saem_ is now known as saem
23:48:59FromDiscord<shadow.> is there a version of string.split() that's an iterator?
23:49:26FromDiscord<ElegantBeef> yea string.split
23:49:31FromDiscord<shadow.> ah.
23:49:32FromDiscord<shadow.> lmao
23:49:55FromDiscord<ElegantBeef> https://nim-lang.org/docs/strutils.html#15
23:52:20FromDiscord<shadow.> for me `readFile().split()` is outperforming `lines()` by magnitudes
23:52:21FromDiscord<shadow.> is this expected?
23:52:37FromDiscord<shadow.> `11ms` for the former in my program `17-18ms` for lines()
23:52:41FromDiscord<shadow.> (edit) "lines()" => "the latter"
23:52:47mipriyeah, strace your program to see why
23:53:35FromDiscord<shadow.> well im guessing that lines uses a buffered reader and readFile just reads it into memory all at once?
23:53:38FromDiscord<shadow.> which is more efficient?
23:53:48miprireadFile reads it into memory all at once. That's what it's for.
23:53:53FromDiscord<shadow.> yep
23:54:19mipriwhich is *preferable* depends on what you're doing. Reading files into memory all at once is rarely good for anything but benchmarks.
23:54:48FromDiscord<ElegantBeef> Depending on what you're doing both of these iterators are doing more allocating than required
23:58:34FromDiscord<ElegantBeef> Although in my testing i didnt find much(if any) of a speed boost for using `openArray[char]` instead of returning `string`