00:12:41 | * | krux02 quit (Remote host closed the connection) |
00:14:35 | FromDiscord | <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:18 | FromDiscord | <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:45 | FromDiscord | <geekrelief> (edit) removed "a" |
00:20:05 | leorize[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:19 | FromDiscord | <ElegantBeef> `startProcess` returns a process which can be ended with `close`, and `kill` |
00:21:55 | FromDiscord | <geekrelief> how do I persist the return Process between runs of the build script? |
00:22:37 | FromDiscord | <geekrelief> e.g. ./build monitor stop; ./build monitor stop |
00:22:44 | FromDiscord | <geekrelief> (edit) "stop;" => "start;" |
00:23:13 | leorize[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:33 | FromDiscord | <ElegantBeef> well `processID` returns the id of the process, so you could store that somewhere |
00:23:56 | FromDiscord | <geekrelief> right, so how do I convert the processID back to a Process? |
00:24:04 | * | leorize joined #nim |
00:24:23 | FromDiscord | <ElegantBeef> you dont, you reimplement `kill` and `close` to take a process id i guess |
00:25:05 | leorize | saem: this make findProjectNimFile practically useless until we can do one nimsuggest instance for everything |
00:25:42 | FromDiscord | <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:26 | FromDiscord | <geekrelief> yeah I'm reading the source now, |
00:26:28 | FromDiscord | <geekrelief> (edit) "now," => "now" |
00:28:00 | FromDiscord | <ElegantBeef> Alternatively you could write a way to reload a process, no clue how finicky that'd be |
00:31:34 | FromDiscord | <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:05 | FromDiscord | <ElegantBeef> Yea but ideally you'd reload the stdout, stdin and stderr |
00:32:44 | FromDiscord | <ElegantBeef> Not overly difficult on unix atleast |
00:33:02 | FromDiscord | <geekrelief> thanks |
00:33:24 | FromDiscord | <ElegantBeef> Have no clue the windows method |
00:34:38 | FromDiscord | <ElegantBeef> ~~Just remember to make a PR when you're done :P~~ |
00:41:19 | * | bunbunbunbunny joined #nim |
00:41:20 | saem | leorize: 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:49 | FromDiscord | <Recruit_main707> can you pass something by reference while making sure its immutable? |
00:49:47 | saem | I think the compiler can reason about that optimization in many cases. |
00:49:55 | saem | As in you don't have to. |
00:55:18 | FromDiscord | <ElegantBeef> @Recruit_main707 the only way i know of is `strictFuncs` https://play.nim-lang.org/#ix=2K9G |
00:56:06 | federico3 | TIL https://github.com/Anuken/Nimdustry the author of Mindustry experimenting with Nim |
00:56:23 | FromDiscord | <ElegantBeef> Yea @Anuke is here |
00:56:25 | FromDiscord | <ElegantBeef> 😄 |
00:56:27 | saem | leorize: I think the biggest hurdle with nimsuggest is actually known how to start it, because presently starting parameters make a big difference. |
00:57:07 | saem | I think one (or more) of the folks behind Fossil SCM are also looking at nim. |
01:00:01 | FromDiscord | <ElegantBeef> They've been here for quite a while and showed a demo a bit ago wasm iirc |
01:00:23 | FromDiscord | <ElegantBeef> Anuken that is |
01:03:21 | FromDiscord | <Recruit_main707> @ElegantBeef strictFuncs will become the default thing eventually, correct? |
01:03:26 | FromDiscord | <ElegantBeef> I believe so |
01:03:49 | FromDiscord | <ElegantBeef> They're more pure and proper imo |
01:04:48 | FromDiscord | <Recruit_main707> and they still allow var mutation, so i think they would be great |
01:11:05 | * | Tanger joined #nim |
01:17:23 | saem | Never watched the CPU monitor before with ./koch test... makes good use of things. lol |
02:07:59 | * | bunbunbunbunny quit (Quit: Lost terminal) |
02:08:55 | FromDiscord | <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:27 | disruptek | make package management boring again. |
02:38:07 | * | vicfred quit (Quit: Leaving) |
02:42:45 | saem | I can't agree with that hard enough. |
02:46:31 | leorize | saem: known is terrible |
02:46:56 | leorize | it doesn't handle files that are not imported in your project |
02:48:07 | leorize | also you still have to wait for nimsuggest to return before you can start an another instance |
02:48:41 | leorize | it's extra slow when you deal with things like the compiler |
02:49:28 | disruptek | did you look into load the ic data instead? |
02:50:42 | leorize | is ic ready? |
02:50:59 | leorize | I think we can write a new tool altogether once ic stablise |
02:51:49 | disruptek | i'd be surprised if that were worthwhile. |
02:52:05 | disruptek | i'm not working on ic anymore; you'd have to ask araq. |
02:53:27 | leorize | it might be worthwhile, though just loading ic data should improve performance significantly |
02:54:14 | disruptek | reading the data is easy enough. |
02:54:30 | leorize | hooking 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:52 | saem | also it needs to be forgiving. |
02:55:04 | leorize | as it is right now we can't let nimsuggest be a pass that runs after sem because sem is slow as hell |
02:55:36 | saem | OK, I'm new and everything, but how does one get useful information without sem running? |
02:55:44 | disruptek | the ic ast is already sem'd and should (eventually) embed errors inside it as error nodes. |
02:56:09 | disruptek | you can deserialize it back into un-flat types or operate upon the flat/fast ast directly. |
02:56:47 | saem | OK, so there is no getting away from sem running, just how much you have to wait. |
02:57:22 | disruptek | in theory, not that much, because the compiler should be much faster... 😉 |
02:57:57 | disruptek | but 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:45 | leorize | before 1.6, so, next year |
02:59:48 | saem | I 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:02 | saem | it's the same analysis, just different caching. |
03:00:37 | saem | project file + defines/switches -> analysis -> get answers. |
03:00:42 | leorize | did I mention that packed ast should also be extra fast in term of node construction? :) |
03:01:02 | saem | Sure, but again, the completeness of the answer will be no different. |
03:01:15 | leorize | it will be, actually |
03:01:19 | saem | how? |
03:02:16 | leorize | nimsuggest 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:48 | leorize | so if you want to jump to forward declaration but your cursor is after the declaration, you won't be able to |
03:03:06 | leorize | because the forward-declared symbol has already been replaced with the implementation |
03:03:44 | saem | I remember there was a change around taht recently, can't remember which way it went, doesn't matter... |
03:03:59 | disruptek | i think saem's point is that the cached ast won't be available before the module is sem'd. |
03:04:07 | saem | Yes, that's it. |
03:04:14 | saem | And you can't cache what you don't analyse |
03:04:19 | saem | That last part is key |
03:04:51 | leorize | we just have to pay the full cost on first run |
03:05:05 | disruptek | we can eventually pre-cache stdlib stuff, but yes, the first run will be a little slower. |
03:05:07 | saem | So 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:10 | leorize | and the data will be cached on disk, so it accumulates |
03:05:11 | disruptek | but not as slow as a full recompilation. |
03:06:31 | disruptek | one 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:57 | saem | it's not just that, because it's any when(defined) type shit. |
03:07:03 | leorize | most languages just give up on that I think |
03:07:06 | disruptek | exactly. |
03:07:13 | saem | Yes, they do. |
03:08:02 | saem | But 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:17 | leorize | the sad part of this is that I still won't get highlighting of parts that doesn't get sem-ed |
03:08:27 | disruptek | true. |
03:08:53 | disruptek | araq originally wanted to support it but i convinced him not to try. |
03:09:05 | disruptek | so you can blame me. but it's pretty damned hard. |
03:09:05 | saem | That's a totally reasonable limitation. |
03:09:23 | disruptek | i just don't see it being a priority for anyone. |
03:09:40 | leorize | with the way I believe IC works, we should still get unused template highlighting :P |
03:09:50 | disruptek | yes. |
03:10:32 | leorize | so uninstantiated generic procs and templates will get the color treatment \o/ |
03:10:59 | FromDiscord | <ElegantBeef> Colour treatment? |
03:11:35 | saem | I 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:05 | leorize | try nim.nvim, you can't go back to normal highlighting after :P |
03:12:26 | FromDiscord | <ElegantBeef> Does nim.nvim differentiate fields and ufcs'd procs? |
03:12:35 | leorize | ofc it does :) |
03:12:59 | leorize | unless your colorscheme map Identifier and Function to the same color, but that's easy fix |
03:13:41 | leorize | it will even differentiates templates and procs :) |
03:14:08 | FromDiscord | <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:14 | FromDiscord | <ElegantBeef> So changed logic is just the same colour |
03:14:28 | FromDiscord | <ElegantBeef> chained |
03:14:31 | FromDiscord | <ElegantBeef> I can english yes |
03:14:37 | saem | The same can be done in vs code, I just haven't implemented the highlighting provider. |
03:14:50 | FromDiscord | <ElegantBeef> Ah, yea would be nice |
03:15:06 | leorize | saem: just make sure your spawning function is efficient |
03:15:32 | leorize | because once you start doing highlighting nimsuggest will crash like every second or so |
03:16:16 | saem | leorize: for nimsuggest processes? I think it's ok |
03:16:22 | saem | I'll find out. |
03:16:30 | FromDiscord | <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:48 | saem | nice |
03:16:49 | FromDiscord | <ElegantBeef> I'm still waiting for further comments about my PR 😄 |
03:17:23 | leorize | also the highlighting will be a hotspot, so make sure your deserialize nimsuggest response function is fast too :P |
03:21:58 | FromDiscord | <notchris> o/ |
03:26:55 | saem | ok, so going back to the original thing... findProjectNimFile still has some issues that need resolving regardless. |
03:27:43 | leorize | I might have already fixed it in nim.nvim :P |
03:27:49 | leorize | so what's the issue that you found? |
03:34:58 | leorize | iirc there's a bug where it just keep searching even when the project boundary has already been passed |
03:36:01 | leorize | you may find these commits useful: https://github.com/alaviss/nim.nvim/commit/f8150e05674dbdbf4397f53b2a76b82ccaa72972 and https://github.com/alaviss/nim.nvim/commit/2ba7c6cb6f7ab87175aed104316963d743d02242 |
03:37:06 | saem | leorize one issue: https://gist.github.com/saem/a5b66e4082910e7ef36ffdd45379f067 |
03:43:19 | leorize | that's expected, unfortunately |
03:43:28 | leorize | for a good reason |
03:44:09 | leorize | so .nim.cfg will only be evaluated if you compile the corresponding .nim |
03:44:51 | leorize | so we just sorta guess that that is the main one |
03:46:09 | leorize | its correct most of the time and doesn't harm by much if its wrong (unless the config cause trouble) |
03:52:03 | leorize | the exact file is just used as an entry point for compliation afaict |
03:52:31 | leorize | once you start running commands on other files they will be compiled if they are not "known" |
03:54:01 | FromDiscord | <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:01 | leorize | I seperate nimsuggest instances by folders in nim.nvim |
03:54:57 | * | muffindrake quit (Ping timeout: 260 seconds) |
03:55:27 | leorize | an 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:46 | saem | Wait... 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:09 | saem | Addtionally, 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:23 | leorize | I haven't seen any evidence of that, so I just assume that there aren't any problem |
03:59:44 | leorize | nimsuggest setup for sem seems simple enough that I don't see an issue there |
04:01:15 | saem | Well 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:46 | leorize | I just put a `when defined(js)` top level for all of my js code :P |
04:01:54 | FromDiscord | <ElegantBeef> As you should |
04:02:14 | leorize | or just add a config with: `@if nimsuggest\ndefine="js"\n@end` |
04:02:24 | FromDiscord | <ElegantBeef> I prefer `when not defined(js): {.error: "This is a JS API, learn to read".}` |
04:02:42 | leorize | yea... nimsuggest skip errors |
04:03:07 | FromDiscord | <ElegantBeef> Aw |
04:03:17 | FromDiscord | <ElegantBeef> That's such a good error that users need to see |
04:03:29 | leorize | you will just get an annoying [User] error when you use `chk` |
04:22:13 | FromDiscord | <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:37 | disruptek | because it helps prevent unintentional mutations (bugs). |
04:26:16 | disruptek | less mutability means greater optimization by the compiler, so essentially, we can do the same work quicker with virtually the same code. |
04:39:44 | leorize | also the "implicitly copy parameter so you can modify it locally" is kinda dumb imo |
04:43:29 | FromDiscord | <mixbot> I can assign the immutable parameter in a variable inside function scope and modify it... that requires extra work....i think |
04:45:02 | disruptek | leorize: you mentioned nimph in this rfc... does it not do the right thing? |
04:45:35 | * | spiderstew_ joined #nim |
04:46:26 | disruptek | mixbot: 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:29 | FromDiscord | <mixbot> var is like reference (&) of c++ right? |
04:48:24 | FromDiscord | <mixbot> btw, can result variable store every datatypes? |
04:49:07 | disruptek | yes and yes. |
04:50:57 | FromDiscord | <mixbot> okay one last thing, can i use a namespace wrapper around types and methods to encapsulate them? |
04:51:16 | disruptek | why would you want that? |
04:51:35 | disruptek | you can put them in a block to scope them. |
04:51:35 | FromDiscord | <ElegantBeef> Namespaces arent used in Nim as it ruins our glorious UFCS 😄 |
04:51:55 | FromDiscord | <ElegantBeef> You can make a do nothing `namespace` template to block them |
04:52:01 | FromDiscord | <mixbot> because I want clear separation between general functions and methods |
04:52:06 | disruptek | but you cannot export except from top-level. |
04:52:14 | disruptek | you want clear separation? |
04:52:27 | disruptek | make a bunch of ## on new lines. |
04:52:36 | disruptek | here are a few to get started: ############################################################################################ |
04:52:43 | disruptek | there's more where those came from. |
04:53:02 | FromDiscord | <Rika> theres no difference in nim |
04:53:23 | FromDiscord | <Rika> nim doesnt have methods in the syntactical sense |
04:53:36 | FromDiscord | <ElegantBeef> By methods do you mean the dynamic dispatch, or dont realize we dont have member methods attached to classes |
04:53:49 | FromDiscord | <ElegantBeef> We dont have classes either 😄 |
04:53:59 | disruptek | well, we /do/ have methods, syntactically. |
04:54:16 | FromDiscord | <Rika> dammit disruptek you know what i mean lmao |
04:54:19 | disruptek | and they /are/ dispatched dynamically. |
04:54:38 | FromDiscord | <ElegantBeef> That's what i said 😄 |
04:57:44 | * | disruptek is now known as sad |
04:57:49 | FromDiscord | <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:12 | FromDiscord | <ElegantBeef> Nim's methods are defined identical to `proc`s just with `method` instead |
04:58:21 | FromDiscord | <ElegantBeef> The difference is one is statically dispatched and the other is dynamic |
04:58:30 | FromDiscord | <Rika> and theyre not exactly useful if you dont use inheritance |
04:59:01 | FromDiscord | <ElegantBeef> Both can be called `obj.doThing` or `doThing(obj)` |
05:00:23 | FromDiscord | <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:13 | FromGitter | <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:43 | FromGitter | <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:02 | FromDiscord | <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:24 | FromDiscord | <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:58 | FromGitter | <offbeat-stuff> Hey |
07:00:00 | FromGitter | <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:10 | FromGitter | <offbeat-stuff> proc bestVisual(dpx:PDisplay,snum:cint):PXVisualInfo {.importcpp:"bestVisual",header:"<inc/config.cpp>".} |
07:00:22 | FromGitter | <offbeat-stuff> bestVisual(dpx,snum) |
07:00:35 | FromGitter | <offbeat-stuff> Can i do something to prevent this |
07:00:35 | FromDiscord | <mratsim> @offbeat-stuff, you can import the C++ file directly |
07:00:48 | FromGitter | <offbeat-stuff> wdym mratsim |
07:00:54 | FromGitter | <offbeat-stuff> Like how |
07:01:36 | FromDiscord | <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:17 | FromDiscord | <mratsim> the base library is here: https://github.com/mgbellemare/Arcade-Learning-Environment/tree/b2f755781cda57a984b6e3f3b6ef00c1f518b622/src |
07:02:52 | FromDiscord | <Cohjellah> HMM I mean, if it works as a regular gui on all platforms why wouldn't I want that aha |
07:03:02 | FromDiscord | <Cohjellah> every OS has access to OpenGL now doesn't it? |
07:03:02 | FromGitter | <offbeat-stuff> Ok got it i can import cpp coe |
07:03:04 | FromGitter | <offbeat-stuff> code |
07:03:10 | FromDiscord | <mratsim> I assume you need something like proc bestVisual(dpx:PDisplay,snum:cint):PXVisualInfo {.importcpp:"#.bestVisual(@)",header:"<inc/config.cpp>".} |
07:03:15 | FromDiscord | <Cohjellah> Otherwise, what other Gui framework would I even want |
07:03:29 | FromDiscord | <Rika> some people want native |
07:03:33 | FromDiscord | <mratsim> Apple deprecated OpenGL and OpenCL with Catalina |
07:03:43 | FromDiscord | <Rika> gtk, qt, whatever windows calls theirs, etc |
07:03:51 | FromDiscord | <mratsim> not sure if it's still there in 10.15 |
07:04:05 | FromGitter | <offbeat-stuff> Still the same error |
07:04:28 | FromGitter | <offbeat-stuff> @mratsim |
07:04:34 | FromDiscord | <mratsim> well I don't know your types/header but basically |
07:04:50 | FromDiscord | <mratsim> "#" refers to the next unused argument |
07:04:55 | FromGitter | <offbeat-stuff> Well It's x11 and glx |
07:05:00 | FromDiscord | <mratsim> and "@" refers to the rest of the argument |
07:05:46 | FromDiscord | <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:06 | FromGitter | <offbeat-stuff> Okay My error comes because I need the c++ code at final be like result=bestVisual(dpx,snum) |
07:06:18 | FromGitter | <offbeat-stuff> but it becomes dpx->bestVisual(snum) |
07:06:59 | FromDiscord | <mratsim> Then use "bestVisual(@)" |
07:07:45 | FromGitter | <offbeat-stuff> Okay this solves it , Thanks |
07:07:59 | FromDiscord | <mratsim> you're welcome |
07:08:24 | FromGitter | <offbeat-stuff> Okay so the next error |
07:08:44 | FromGitter | <offbeat-stuff> Xdisplay on nim is consider different from xdisplay on c++ |
07:08:52 | FromGitter | <offbeat-stuff> because of decleration |
07:08:58 | FromGitter | <offbeat-stuff> another compile error |
07:09:23 | FromGitter | <offbeat-stuff> basically a cannot convert from cannot convert ‘tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q*’ to ‘Display*’ |
07:09:35 | FromGitter | <offbeat-stuff> cannot convert ‘tyObject_XDisplay__pUEYXk7cKlFR9bAMzuMcK1Q\* to ‘Display\* |
07:09:59 | FromGitter | <offbeat-stuff> They basically are same objects |
07:11:25 | FromDiscord | <mratsim> use cast in that case, |
07:11:41 | FromDiscord | <mratsim> likely the easiest. |
07:11:58 | FromDiscord | <mratsim> otherwise you need to tinker with the C (?) and C++ declaration. |
07:11:59 | FromGitter | <offbeat-stuff> Okay cast it but a type that exists in c++ |
07:12:41 | FromGitter | <offbeat-stuff> also cpp decleration |
07:12:43 | FromGitter | <offbeat-stuff> XVisualInfo *bestVisual(Display *display, int screen) |
07:12:53 | FromGitter | <offbeat-stuff> There is a * in b/w |
07:13:14 | FromDiscord | <mratsim> is ptr in Nim |
07:13:42 | FromGitter | <offbeat-stuff> so what should I like put in cast[] |
07:14:09 | FromDiscord | <mratsim> so proc bestVisual(display: ptr Display, screen: cint): ptr XVisualInfo {.importcpp:"bestVisual(@)", header: ....} |
07:14:16 | FromGitter | <offbeat-stuff> Yeah PDisplay = ptr Display |
07:14:33 | FromDiscord | <mratsim> or if you now it's a mutation: proc bestVisual(display: var Display, screen: cint): ptr XVisualInfo {.importcpp:"bestVisual(@)", header: ....} |
07:16:15 | FromGitter | <offbeat-stuff> Well adding ptr there doesn't work they already are PTYPE = ptr TYPE |
07:17:03 | FromGitter | <offbeat-stuff> What is something that exist both in c++ and nim (type that i can cast to) |
07:18:23 | FromDiscord | <Cohjellah> HMMM so what are the most popular frameworks atm that are actively developed. We've got nimx and |
07:18:44 | FromDiscord | <Rika> fidget or smth i dunno |
07:21:06 | FromDiscord | <ElegantBeef> Nimx, Fidget, Nigui |
07:21:12 | FromDiscord | <ElegantBeef> And i guess gintro |
07:21:23 | FromDiscord | <ElegantBeef> plus whatever the qt one |
07:22:20 | FromDiscord | <Rika> No you’re a qt |
07:22:25 | * | nc-x joined #nim |
07:23:41 | nc-x | does 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:41 | FromDiscord | <ElegantBeef> Ok |
07:23:57 | FromDiscord | <mratsim> We use NimQML at Status for our Destop client |
07:23:58 | FromDiscord | <ElegantBeef> there isnt an impl for `[]` that takes a backwards index |
07:24:14 | FromDiscord | <mratsim> https://github.com/status-im/nim-status-client |
07:24:45 | FromDiscord | <KaiOShin> Okay @mratsim I changed cpp code |
07:24:46 | FromDiscord | <KaiOShin> void bestVisual(void dp, int screen) |
07:25:02 | FromDiscord | <KaiOShin> Now c++ auto casts variable |
07:25:03 | nc-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:11 | FromDiscord | <ElegantBeef> The latter i imagine |
07:25:23 | FromDiscord | <mratsim> it's likely the more mature Nim GUI codebase out there @Cohjellah and we support all OS |
07:25:52 | FromDiscord | <mratsim> Oh? I though C++ didn't like auto-casting void pointers. |
07:25:59 | FromDiscord | <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:32 | FromDiscord | <KaiOShin> Now There are functions in that cpp that require -lX11 -lGL |
07:26:51 | FromDiscord | <KaiOShin> So dynlib pragma (how does it work) |
07:27:26 | FromDiscord | <mratsim> dynlib is an alternative to header |
07:27:42 | FromDiscord | <mratsim> it loads from the library symbol table directly |
07:28:22 | FromDiscord | <Cohjellah> Problem that's probably not that big of a problem, but nimQML's licensing |
07:29:24 | FromDiscord | <KaiOShin> Yeah so about those functions |
07:29:25 | FromDiscord | <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:32 | FromDiscord | <KaiOShin> and 10 more error lines |
07:30:08 | FromDiscord | <mratsim> Ah I see, but LGPL for GUI is less of a problem no? |
07:30:18 | FromDiscord | <Cohjellah> mmm |
07:30:20 | FromDiscord | <Cohjellah> Good point hey |
07:31:46 | FromDiscord | <mratsim> QT is LGPL or GPL anyway hence why nimqml has that license |
07:31:54 | FromDiscord | <mratsim> !repo webview |
07:31:55 | disbot | https://github.com/daniel-j/nim-webview -- 9nim-webview: 11 15 3⭐ 1🍴 & 1 more... |
07:32:26 | FromDiscord | <mratsim> https://github.com/oskca/webview |
07:33:19 | FromDiscord | <mratsim> https://github.com/sciter-sdk/nsciter |
07:33:28 | FromDiscord | <ElegantBeef> Thanks nc-x, i now want to make a macro that can auto generate backward indexing operators |
07:33:46 | FromDiscord | <mratsim> for HTML/JS GUI using native webview and without electron |
07:34:18 | FromDiscord | <mratsim> (but without electron you need to do your own OS file access, layer) |
07:34:30 | FromDiscord | <Cohjellah> yeah I'm interested in web stuff |
07:34:33 | FromDiscord | <Cohjellah> and mobile |
07:34:38 | FromDiscord | <Cohjellah> hence why I was peering at nimx |
07:34:49 | nc-x | lol, you are welcome @ElegantBeef |
07:35:01 | FromDiscord | <Cohjellah> but like, QT is so complete, might be good to stick with it. |
07:36:18 | FromDiscord | <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:45 | FromDiscord | <ElegantBeef> Aw shit that's all i have to do is use QML 😉 |
07:37:31 | FromDiscord | <Cohjellah> Status desktop team? |
07:38:12 | * | nc-x quit (Remote host closed the connection) |
07:38:20 | FromDiscord | <ElegantBeef> Status makes software using Nim, desktop is what people call computers, team is a group of individuals |
07:38:28 | FromDiscord | <Cohjellah> thank you for the breakdown |
07:38:30 | FromDiscord | <Cohjellah> had no idea what Status was |
07:38:50 | FromDiscord | <ElegantBeef> https://status.im/ |
07:39:05 | FromDiscord | <Cohjellah> nifty |
07:39:10 | FromDiscord | <Cohjellah> don't suppose their mobile app is made with nim too? |
07:39:15 | FromDiscord | <7815> is the default return value for any `ref`, `nil`? or is `result = nil` basically necessary? |
07:39:25 | FromDiscord | <7815> (edit) "is the default return value for any `ref`, `nil`? or is ... `result" added "a" | removed "basically" |
07:39:28 | FromDiscord | <ElegantBeef> Default value for references is nil |
07:39:54 | FromDiscord | <ElegantBeef> Any other return value would be another heap allocation and we cant have that now can we 😄 |
07:40:03 | mipri | !eval var n: ref int; echo n.isNil |
07:40:07 | NimBot | true |
07:40:18 | FromDiscord | <7815> ah, very thank |
07:41:22 | FromDiscord | <ElegantBeef> Remember that `ref` is just a fancy managed `ptr` so they behave similarly |
07:41:56 | FromDiscord | <Cohjellah> @mratsim is the nimQML library not being touched in 15 months a problem with the updates to QT? |
07:42:31 | FromDiscord | <7815> no, i got that much, just wanted to know if there was a defined default result for `ref` procs |
07:42:36 | FromDiscord | <ElegantBeef> Ah |
07:43:14 | FromDiscord | <ElegantBeef> I over explain to make myself seem more photosynthesis |
07:43:23 | FromDiscord | <Cohjellah> btw Elegant. Chat app works |
07:43:26 | FromDiscord | <Cohjellah> now to never touch it again |
07:43:36 | FromDiscord | <Cohjellah> :nimAngry: |
07:44:22 | FromDiscord | <ElegantBeef> Nice |
07:44:30 | FromDiscord | <ElegantBeef> Can i see the end result? |
07:44:45 | FromDiscord | <ElegantBeef> ~~Dont post it here if you dont throw it in a link |
07:45:00 | FromDiscord | <Cohjellah> Yeah won't post it here because the IP pops up |
07:45:07 | FromDiscord | <Cohjellah> can send you binaries through dm |
07:45:15 | FromDiscord | <ElegantBeef> I mean i just want to see the c ode |
07:45:17 | FromDiscord | <ElegantBeef> (edit) "c ode" => "code" |
07:45:18 | FromDiscord | <Cohjellah> ah |
07:47:13 | FromDiscord | <Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix= |
07:47:18 | FromDiscord | <Cohjellah> weops. Well that'll do |
07:47:28 | FromDiscord | <7815> is result always initialized? |
07:47:30 | FromDiscord | <Cohjellah> rip that does actually have the IP |
07:47:33 | FromDiscord | <7815> (edit) "result" => "`result`" |
07:47:35 | FromDiscord | <Cohjellah> no one play monkey business |
07:47:37 | FromDiscord | <ElegantBeef> Result is always the default value |
07:47:50 | FromDiscord | <7815> ah, now this makes sense. |
07:47:51 | FromDiscord | <ElegantBeef> So if it's a ref it's `nil` if it's a normal object it's `T()` |
07:49:07 | FromDiscord | <7815> yes, before this i thought to initialize it by `result = 0` before i.e. `result += 1` |
07:49:11 | FromDiscord | <Cohjellah> https://play.nim-lang.org/#ix=2Kbk |
07:49:13 | FromDiscord | <Cohjellah> There you go |
07:49:33 | FromDiscord | <ElegantBeef> Ah nope, that's the beauty of the result, it's there |
07:50:06 | FromDiscord | <7815> very cool, very imperative, very idiomatic |
07:50:17 | FromDiscord | <Cohjellah> Who was talking about nimx using openGL? Supposedly uses sdl2 |
07:50:25 | FromDiscord | <ElegantBeef> probably me |
07:50:47 | FromDiscord | <ElegantBeef> https://github.com/yglukhov/nimx/blob/master/nimx.nimble also it does use both |
07:51:15 | FromDiscord | <Cohjellah> neato |
07:51:19 | FromDiscord | <Cohjellah> OpenGL for web though? |
07:51:24 | FromDiscord | <ElegantBeef> Nope, webgl afaik |
07:51:30 | FromDiscord | <Cohjellah> oh yeah, my b |
07:51:50 | FromDiscord | <ElegantBeef> It uses sdl for windowing/io afaik, and opengl/webgl for rendering and actual stuff |
07:52:02 | FromDiscord | <ElegantBeef> @7815 do you know about implict returning? |
07:52:23 | FromDiscord | <ElegantBeef> Atleast that's what i call it, probably bad wording by me |
07:52:37 | FromDiscord | <7815> no, it wouldn't ring a bell |
07:52:44 | mipri | I'd say it's bad, yeah, because there are two ways to return that aren't explicit |
07:53:02 | FromDiscord | <ElegantBeef> `proc a(): int = 10` is what i meant |
07:53:09 | FromDiscord | <ElegantBeef> The right hand can be any expression |
07:53:09 | FromDiscord | <Cohjellah> implicit returning got me so confused for a bit |
07:53:13 | mipri | but it's not a weird term in itself |
07:53:19 | FromDiscord | <7815> oh, yeah, this makes sense to me |
07:53:50 | FromDiscord | <ElegantBeef> It can also be an `if` or `case`, pretty dandy |
07:55:52 | FromDiscord | <7815> it's not that alien for me, since i've written much rust |
07:56:03 | FromDiscord | <ElegantBeef> Ah |
07:56:12 | FromDiscord | <ElegantBeef> Hope you stay to write Nim instead 😛 |
07:56:24 | FromDiscord | <7815> i've written nim, before, no worries |
07:56:54 | * | vicfred quit (Quit: Leaving) |
07:56:55 | FromDiscord | <7815> generally fun to poke around with, i might try some embedded stuff without the gc |
07:57:02 | FromDiscord | <7815> (edit) "generally fun to poke around with, i ... might" added "also" |
07:58:06 | FromDiscord | <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:30 | FromDiscord | <Cohjellah> what do you use nim for @ElegantBeef |
07:58:39 | FromDiscord | <ElegantBeef> Well nothing really |
07:58:46 | FromDiscord | <Cohjellah> epic |
07:58:46 | FromDiscord | <mratsim> @Cohjellah we have our own fork: https://github.com/status-im/nimqml |
07:58:51 | FromDiscord | <ElegantBeef> I'm a failed game developer that just writes code |
07:59:12 | saem | new 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:28 | FromDiscord | <ElegantBeef> That sounds sweet |
07:59:41 | FromDiscord | <Cohjellah> Interesting |
07:59:48 | FromDiscord | <mratsim> meeh, it's not a GC it's memory management |
07:59:48 | FromDiscord | <ElegantBeef> A bit better, meaning what though? |
07:59:50 | FromDiscord | <Cohjellah> cheers ratsim |
08:00:04 | FromDiscord | <mratsim> the "GC" word makes embedded people run away |
08:00:13 | FromDiscord | <mratsim> it's even deterministic memory management |
08:00:28 | FromDiscord | <ElegantBeef> I know they arent actualy GCs, but it's enabled with `--gc` so hence my gc |
08:00:50 | FromDiscord | <mratsim> "Yo Dawg, I put a gc in your gc so that you can gc your gc" |
08:00:53 | saem | ElegantBeef 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:14 | FromDiscord | <ElegantBeef> So repeat of my last compliment |
08:01:18 | FromDiscord | <ElegantBeef> Sounds sweet |
08:01:42 | FromDiscord | <mratsim> can you try to open Weave and look if it opening say "parallel_tasks.nim" pegs nimsuggest to 100% again @saem? |
08:01:44 | saem | Let'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:08 | FromDiscord | <ElegantBeef> Well i'm not that deep into the compiler, but i'm on a meh machine |
08:02:10 | saem | mratsim 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:12 | FromDiscord | <ElegantBeef> So i'm probably a good candidate |
08:02:23 | FromDiscord | <ElegantBeef> Send the link |
08:02:25 | FromDiscord | <mratsim> ridiculous? |
08:02:34 | FromDiscord | <ElegantBeef> Probably 3 thread rippers super glued together |
08:02:40 | saem | I have a 24 core threadripper |
08:02:48 | FromDiscord | <ElegantBeef> Close enough |
08:02:57 | saem | didn't slash out for much RAM, 64GB |
08:03:04 | saem | and an nvme, of course |
08:03:08 | FromDiscord | <mratsim> @7815 there is an #embedded channel with other embedded folks. |
08:03:30 | saem | Ran koch test again and watching the activity monitor was... amusing |
08:03:34 | FromDiscord | <mratsim> ah, nice, I have a i9-9980XE and 128GB RAM 🙂 |
08:03:55 | FromDiscord | <ElegantBeef> I have a xeon1231v3 and 16gb of 1333mhz ddr3 😛 |
08:04:01 | FromDiscord | <ElegantBeef> Yall on fucking spaceships over here |
08:04:22 | FromDiscord | <mratsim> well, I can't develop Weave on a dual core can I? |
08:04:26 | saem | The 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:31 | saem | :D |
08:04:47 | FromDiscord | <ElegantBeef> Hey i've got 8 threads mratsim you might be able to |
08:04:54 | FromDiscord | <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:22 | FromDiscord | <mratsim> I need to test scalability and usually scalability is problematic beyond 16 cores due to high synchronization costs. |
08:06:05 | saem | mratsim 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:30 | FromDiscord | <Cohjellah> Can you make pretty decent looking gui's with Karax? |
08:06:31 | FromDiscord | <mratsim> weave.nim at the root |
08:06:40 | FromDiscord | <Cohjellah> I'd assume so of course, but like interactive JS apps |
08:06:58 | saem | oof, I just walked past that and went straight into the weave folder, thanks. |
08:07:00 | FromDiscord | <mratsim> yes, you still need a presentation layer like webview or Electron or QML |
08:07:01 | FromDiscord | <ElegantBeef> Well if you use neel, or webview, yes |
08:07:24 | FromDiscord | <Cohjellah> Hol up |
08:07:39 | FromDiscord | <Cohjellah> so nimQML can be used for webs as well? |
08:07:55 | FromDiscord | <ElegantBeef> qt probably has a webview |
08:07:55 | FromDiscord | <mratsim> I think you can pass it JS |
08:08:32 | FromDiscord | <mratsim> https://doc.qt.io/qt-5/qtqml-javascript-topic.html |
08:08:38 | FromDiscord | <ElegantBeef> https://doc.qt.io/qt-5/qml-qtwebview-webview.html |
08:08:40 | FromDiscord | <ElegantBeef> Shit! |
08:09:16 | FromDiscord | <Cohjellah> so these are just 3 separate libraries |
08:09:31 | FromDiscord | <Cohjellah> I know Electron is a GUI framework for JS |
08:09:46 | FromDiscord | <Cohjellah> Webview and QML are just C++ libraries with Nim bindings? |
08:10:00 | FromDiscord | <mratsim> qml is |
08:10:23 | FromDiscord | <mratsim> webview is a C library |
08:10:24 | FromDiscord | <mratsim> that just exposes the OS native webview in a OS agnostic way |
08:10:51 | saem | OK, time for the test |
08:11:14 | FromDiscord | <Cohjellah> interesting |
08:11:37 | saem | haha... computer is definitely spinning up fans |
08:12:13 | FromDiscord | <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:30 | FromDiscord | <Cohjellah> or should I mess around with QML and try get that to function |
08:12:44 | FromDiscord | <ElegantBeef> You described me and if i want to use nim on websites i just use `nim js` |
08:13:04 | saem | oh interesting... the early stuff in the file works just fine. |
08:13:07 | FromDiscord | <Cohjellah> yeaaaah but how do I make some okayish gui's with Nim |
08:13:12 | FromDiscord | <Cohjellah> can't just compile anything to JS |
08:13:27 | FromDiscord | <Cohjellah> webpages more so. I guess they don't call them gui;'s |
08:13:41 | FromDiscord | <ElegantBeef> I mean if you want to make webpages with nim use the dom module 😄 |
08:13:46 | FromDiscord | <ElegantBeef> Then export the js |
08:14:06 | FromDiscord | <ElegantBeef> you can compile "anything" to js, aslong as it has a js representation |
08:14:34 | FromDiscord | <Danny Hpy> sent a code paste, see https://play.nim-lang.org/#ix=2Kbp |
08:14:37 | saem | ah, it's just when is mainmodule, that's the only part that doesn't work, but that makes sense -- mratsim seems ok. |
08:15:01 | FromDiscord | <Cohjellah> Interesting. I'll assume Nim In Action covers this when we make the Twitter clone |
08:15:14 | FromDiscord | <Cohjellah> I'll just have to spree through the book. Then I'll have less questions to bugger you all with :p |
08:15:22 | FromDiscord | <ElegantBeef> @Danny Hpy single type section |
08:15:48 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Kbq |
08:17:26 | FromDiscord | <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:35 | saem | mratsim: loading isn't an issue at this point, what else do you want me to test? |
08:17:50 | FromDiscord | <mratsim> @saem wild thought, is nimsuggest actually trying to run fib(40)? |
08:18:03 | FromDiscord | <mratsim> well I just want to know if nimsuggest gets stuck at 100% still. |
08:18:57 | FromDiscord | <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:56 | FromDiscord | <KaiOShin> Hi Anyone know how to print glGetString output |
08:21:16 | FromDiscord | <KaiOShin> It return ptr GLUbyte |
08:21:31 | FromDiscord | <KaiOShin> that should be char(GLubyte) |
08:21:39 | saem | mratsim I did get a nimsuggest crash, but the cache is still there to show information. :D |
08:22:06 | FromDiscord | <KaiOShin> It exactly is unsigned char |
08:22:25 | FromDiscord | <Danny Hpy> Oh I see, thanks a lot!! |
08:22:39 | saem | going to open it with the extension in a debugger |
08:25:36 | FromDiscord | <ElegantBeef> if it's a pointer to a char you should be able to `echo char(val[])` |
08:27:25 | FromDiscord | <KaiOShin> Got that working Just had to do loadExtensions() in my code first |
08:27:59 | saem | mratsim ok so I just get blips when I have it look up a definition or something,b ut otherwise no big deal. |
08:28:09 | saem | mratsim, what's your torture test? |
08:28:53 | FromDiscord | <mratsim> that's all really |
08:29:20 | FromDiscord | <mratsim> when I had nimsuggest on Weave I just had to kill it every minutes |
08:30:54 | saem | do you use workspaces or just open the folder? |
08:33:27 | FromDiscord | <mratsim> I save my workspace but I think just opening the folder does it because it happened on both of my computer |
08:33:54 | FromDiscord | <mratsim> TBH I just disabled nimsuggest altogether |
08:34:15 | FromDiscord | <mratsim> more trouble than solution |
08:34:26 | FromDiscord | <mratsim> did that after my post on developer tools last week |
08:35:05 | saem | OK, 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:32 | saem | At least it'll behave much better, also use the nim variant of the extension. ;) |
08:36:37 | FromDiscord | <mratsim> will remember for when I redevelop on Weave again, thanks 🙂 |
08:36:54 | saem | I have a few unused import warnings, but that's about it. |
08:38:47 | FromDiscord | <mratsim> the unused import are likely wrong |
08:39:28 | saem | I'm guessing the defines are a bit off and it's seeing things it shouldn't. |
08:39:43 | FromDiscord | <mratsim> it doesn't see a usage actually |
08:40:36 | FromDiscord | <mratsim> I don't think I use it in weave but the worse is {.push raises:[Defect].} |
08:40:46 | FromDiscord | <mratsim> then you get Defect declared but not used. |
08:41:04 | FromDiscord | <mratsim> and this is something that we use everywhere in Status codebase to enforce handling of exceptions |
08:53:28 | FromDiscord | <Cohjellah> Real talk. How do JS chat apps and other programs work if threading doesn't exist there |
08:53:39 | FromDiscord | <Cohjellah> Does Async await exist? |
08:58:33 | FromDiscord | <lqdev> yeah |
08:58:54 | saem | Because JS is asynchronous by nature, this article explains the fundamentals: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop |
08:59:12 | FromDiscord | <haxscramper> Pattern matching was merged to fusion |
09:01:08 | saem | \o/ |
09:13:31 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:16:46 | FromDiscord | <Cohjellah> Thank youu |
09:19:03 | FromDiscord | <Cohjellah> btw, where are nim libraries installed to on ubuntu? |
09:19:07 | FromDiscord | <Cohjellah> I went through choosenim |
09:19:23 | FromDiscord | <Cohjellah> Can't remember where exactly they are. Need to compile and access Karun from Karax |
09:20:23 | FromDiscord | <lqdev> ~/.nimble/pkgs |
09:20:23 | disbot | no footnotes for `/.nimble/pkgs`. 🙁 |
09:20:58 | FromDiscord | <lqdev> if karax doesn't build karun when you nimble install it, report a bug to karax |
09:21:03 | FromDiscord | <Cohjellah> oh ok |
09:21:08 | FromDiscord | <Cohjellah> they need to update the docs then |
09:21:22 | FromDiscord | <lqdev> also make sure that you have ~/.nimble/bin in your PATH |
09:21:35 | FromDiscord | <Cohjellah> in the code example it gives the nim c karax/tools/karun |
09:21:39 | FromDiscord | <Cohjellah> implying you need to compile it |
09:21:54 | FromDiscord | <Cohjellah> yeep you're right karun is already compiled and on path HMM |
09:22:01 | FromDiscord | <Cohjellah> (edit) "gives the" => "gives:" |
09:22:53 | FromDiscord | <lqdev> open an issue in karax that the docs should be updated |
09:23:02 | FromDiscord | <lqdev> or better yet, make a PR |
09:23:20 | FromDiscord | <Cohjellah> 😮 |
09:23:25 | FromDiscord | <Cohjellah> >contributor |
09:25:20 | FromDiscord | <Cohjellah> If I'm honest, no idea how to make a PR to change the example |
09:25:30 | FromDiscord | <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:01 | saem | Might 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:43 | FromDiscord | <Cohjellah> Timebox? |
09:41:46 | FromDiscord | <Cohjellah> I'll have a go |
09:42:19 | saem | a 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:15 | FromDiscord | <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:55 | FromDiscord | <ElegantBeef> one big thing, use let blocks |
10:07:28 | narimiran | Yardanico: is ForumUpdaterBot down? |
10:08:37 | * | tane joined #nim |
10:11:07 | FromDiscord | <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:13 | FromDiscord | <ElegantBeef> oh not block statement |
10:11:28 | FromDiscord | <ElegantBeef> you can define multiple vars under a single `var`, `let`, or `const` |
10:11:38 | FromDiscord | <cybertim> ah ok |
10:11:48 | mipri | `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:24 | FromDiscord | <cybertim> ok, it was the linter/doc invscode that marked that one, and suggested using $ i remember |
10:13:25 | FromDiscord | <ElegantBeef> Also probably shouldnt use `/` for urls since on windows that'll put `\` afaik |
10:13:42 | mipri | those hints are generic type hints. You want the .code proc, that returns an HttpCode |
10:14:49 | FromDiscord | <cybertim> ah ok, didnt test the code against an unhappy path, so it didnt come up, but i will fix that |
10:14:56 | FromDiscord | <ElegantBeef> you can always define your own version of `/` in here though |
10:15:29 | FromDiscord | <ElegantBeef> After you use except to stop importing the os modules `/` 😄 |
10:15:53 | FromDiscord | <ElegantBeef> You are on posix eh? Dont want to be wrong 😛 |
10:16:07 | FromDiscord | <cybertim> im testing it with the geckdriver on windows, so i guess / works 😉 |
10:16:40 | FromDiscord | <ElegantBeef> Guess maybe it's smart enough to take `\` as `/` |
10:16:45 | FromDiscord | <ElegantBeef> my browser is atleast 😄 |
10:19:01 | * | krux02 joined #nim |
10:19:05 | FromDiscord | <ElegantBeef> I really dislike the redundant logic for findElements and find element |
10:20:17 | mipri | os./ 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:03 | FromDiscord | <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:04 | mipri | for 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:23 | FromDiscord | <ElegantBeef> You can overload |
10:23:48 | FromDiscord | <ElegantBeef> I'm also not well versed in using async 😄 |
10:24:17 | FromDiscord | <ElegantBeef> This is one of my super dumb suggestions for your requests https://play.nim-lang.org/#ix=2Kc1 |
10:24:23 | FromDiscord | <ElegantBeef> I really need to stop using templates |
10:25:44 | FromDiscord | <cybertim> thnx stuff like this is weird for me, so i will check this out |
10:26:26 | FromDiscord | <ElegantBeef> templates are just nice |
10:26:34 | FromDiscord | <ElegantBeef> But i'm over using them as of late |
10:27:33 | FromDiscord | <ElegantBeef> Let you copy and paste code without manually doing it |
10:31:14 | mipri | it 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:59 | mipri | I use templates for that most often in an inner scope, not at the module level. |
10:32:34 | mipri | if 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:34 | mipri | I 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:56 | FromDiscord | <ElegantBeef> Yea hence why i said it's super dumb |
10:35:03 | FromDiscord | <ElegantBeef> Using templates like that feels dirty cause it is 😄 |
10:35:45 | FromDiscord | <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:56 | FromDiscord | <Clyybber> disruptek: Fixed taste for real now |
11:36:48 | * | frost-lab left #nim (#nim) |
11:48:49 | FromDiscord | <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:58 | FromDiscord | <mratsim> probably something to do with generic early resolution ... |
11:54:42 | Zevv | mratsim: sweet, nice simple interface |
11:55:10 | FromDiscord | <mratsim> ideally we use coro like proc or func afterwards |
11:55:15 | FromDiscord | <mratsim> without so pragma |
11:55:40 | FromDiscord | <mratsim> so that would be "stage 1", with stage 0 being the resumable/suspend cotninuations |
11:55:50 | FromDiscord | <mratsim> withot coro pragma |
11:56:33 | Zevv | now make coroYield return what you pass in pull() :) |
11:58:02 | FromDiscord | <mratsim> it does |
11:58:34 | Zevv | no, now pull returns what you pass in coroYield |
11:58:50 | Zevv | but nevermind, just trolling |
11:59:02 | Zevv | (but lua coros have that, they pass two-way) |
11:59:12 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/793448028484141056/unknown.png |
11:59:22 | FromDiscord | <mratsim> now I just need to figure why "auto" doesn't work but I think it's the generic early resolution issue |
11:59:37 | FromDiscord | <mratsim> yep |
11:59:47 | FromDiscord | <mratsim> when i use SomeInteger i have the same problem |
12:00:17 | Zevv | interesting |
12:01:56 | FromDiscord | <mratsim> I think it resolves the first one without continuation and calls it |
12:02:16 | FromDiscord | <mratsim> but the warning disappears somehow? |
12:10:27 | * | clyybber joined #nim |
12:13:40 | FromDiscord | <mratsim> @zevv, seems like generics drop the cpsCall pragma cc @Clyybber |
12:15:46 | FromDiscord | <mratsim> ah no it's worse |
12:15:58 | FromDiscord | <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:10 | narimiran | Nim in 2020: A short recap — https://nim-lang.org/blog/2020/12/28/nim-in-2020-a-short-recap.html |
12:55:18 | FromDiscord | <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:53 | superbia | narimiran: jesi ziv |
13:01:04 | narimiran | superbia: yep |
13:01:48 | * | kungtotte quit (Read error: Connection reset by peer) |
13:01:52 | superbia | narimiran: jesi li jako osjetio? |
13:02:47 | narimiran | superbia: 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:06 | FromDiscord | <mratsim> @narimiran, now https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md |
13:04:57 | * | kungtotte joined #nim |
13:05:00 | narimiran | @mratsim i've read it the other day. is it a candidate for nim blog? |
13:05:08 | FromDiscord | <mratsim> yes |
13:05:32 | FromDiscord | <mratsim> it's to dispel the 2 different kind of workloads that you have and so that you need different schedulers |
13:05:34 | superbia | narimiran: najjaci do sad, drzal sam monitor da mi ne padne s stola |
13:05:40 | FromDiscord | <mratsim> i.e. Weave is not for IO |
13:07:38 | narimiran | @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:58 | FromDiscord | <mratsim> sure |
13:10:39 | * | nc-x joined #nim |
13:10:57 | nc-x | anybody here experienced with karax |
13:11:00 | nc-x | ? |
13:11:31 | FromDiscord | <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:11 | FromDiscord | <mratsim> I don't feel like dealing with types in macro anymore, that's just a waste of time. |
13:13:10 | Zevv | but if we don't do typed, are we stuck with the `var a: int = 3` notation? |
13:13:20 | Zevv | because, that's kind of sucky |
13:13:42 | * | nyd joined #nim |
13:13:45 | FromDiscord | <mratsim> why do you need to extract the type? for the proc signatures? |
13:14:03 | Zevv | for the lifting to the env |
13:15:12 | * | WilhelmVonWeiner joined #nim |
13:15:34 | FromDiscord | <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:58 | FromDiscord | <Rika> id call it a glass |
13:16:15 | FromDiscord | <mratsim> I'll think about it, it would be easy to solve for C and C++ with a plain array of byte |
13:16:28 | FromDiscord | <mratsim> but JS is more tricky. |
13:16:36 | FromDiscord | <mratsim> @juliuskiesian a ringbuffer |
13:16:51 | FromDiscord | <mratsim> well one that overwrites |
13:17:13 | FromDiscord | <Rika> isnt a ringbuffer filo or what |
13:18:14 | FromDiscord | <mratsim> no it's fifo |
13:18:32 | FromDiscord | <Rika> i see |
13:29:41 | * | filcuc joined #nim |
13:32:56 | mipri | https://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:33 | FromDiscord | <mratsim> in perf sensitive context, use "if ring.last + 1 >= ring.len: ring.len = 0" instead of mod |
13:44:56 | FromDiscord | <mratsim> ring.last=0 sorry |
13:46:59 | mipri | to 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:40 | mipri | here it's trivial but I've made mistakes while trying to avoid division in other contexts with modular numbers |
13:48:09 | FromDiscord | <mratsim> yep I know that, if you upgrade to a queue it becomes tricky |
13:48:58 | FromDiscord | <mratsim> some enforce a power of 2 queues to make division costless but that waste space |
13:49:52 | FromDiscord | <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:16 | FromDiscord | <mratsim> so there are 2 solutions: either add a sentinel slot. |
13:50:37 | FromDiscord | <mratsim> or do operation on 2length "domain" |
13:51:04 | FromDiscord | <mratsim> which is what I do here: https://github.com/mratsim/weave/blob/master/weave/datatypes/bounded_queues.nim |
14:01:20 | Zevv | this 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:26 | Zevv | everything is in there |
14:02:07 | FromDiscord | <Rika> mratsim secretly programmed his whole brain into weave |
14:02:46 | FromDiscord | <shadow.> weave was actually just compiles from his brain. mratsim just plugged a usb into his hippocampus and called it a day |
14:04:26 | FromDiscord | <shadow.> (edit) "compiles" => "compiled" |
14:07:16 | FromDiscord | <mratsim> haha |
14:07:57 | FromDiscord | <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:19 | FromDiscord | <mratsim> I did it multiple times |
14:20:06 | FromDiscord | <mratsim> long research, trying to reimplement other competing lib in Nim. Trying other lib, getting a baseline, throwing away the code, restart. |
14:20:22 | FromDiscord | <mratsim> and research research research |
14:21:48 | FromDiscord | <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:15 | FromDiscord | <mratsim> so I could focus on the internals. |
14:22:36 | FromDiscord | <Rika> ~~i wasnt being serious~~ |
14:23:39 | FromDiscord | <mratsim> I know 😉 |
14:28:29 | Zoom[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:47 | FromDiscord | <mratsim> sgtm, you can open a PR |
15:05:42 | * | MarderIII joined #nim |
15:09:06 | FromDiscord | <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:38 | FromDiscord | <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:13 | Zevv | recalculate that |
15:10:36 | FromDiscord | <shadow.> well |
15:10:43 | FromDiscord | <shadow.> a 64 bit unsigned integer is composed of 64 bits, correct? |
15:10:50 | Zevv | yes |
15:10:59 | FromDiscord | <shadow.> therefore set[0..63] could contain 64 different values right |
15:11:04 | FromDiscord | <shadow.> which would be a bit for each value? |
15:11:34 | Zevv | yes, but that is not what a set does |
15:11:46 | FromDiscord | <shadow.> so then how does a set work internally? |
15:11:53 | FromDiscord | <shadow.> if it's easier to just look at source i can |
15:12:00 | Zevv | it has a bit for each possible value your type can have |
15:12:15 | FromDiscord | <shadow.> hmm |
15:12:21 | FromDiscord | <shadow.> well yeah so something like |
15:12:26 | FromDiscord | <shadow.> u8 |
15:12:29 | Zevv | So a set[uin64] will need 18446744073709551615 bits of storage |
15:12:35 | FromDiscord | <shadow.> yeah |
15:12:41 | FromDiscord | <shadow.> i know that, sorry |
15:12:43 | FromDiscord | <shadow.> what i was saying was |
15:13:03 | Zevv | apart from that, yes, that's how it works |
15:13:05 | FromDiscord | <shadow.> how can the set use something like 256 bits for a set[u8] |
15:13:09 | Zevv | it stores an array if u8s |
15:13:12 | FromDiscord | <shadow.> ahhh |
15:13:13 | FromDiscord | <shadow.> that makes sense |
15:13:20 | Zevv | /of/ u8ts |
15:13:20 | FromDiscord | <shadow.> ty |
15:13:39 | Zevv | and it has some nice optimizations built around it |
15:13:41 | FromDiscord | <shadow.> so does it do modulo to find the index, and then bitshifts and masking for bitops? |
15:14:09 | Zevv | something like that, yes |
15:14:12 | FromDiscord | <shadow.> thanks |
15:14:23 | FromDiscord | <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:16 | Zevv | shadow.: 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:58 | Zevv | cybertim: yes, execProcess will block your async thread |
15:16:16 | * | Kaivo joined #nim |
15:16:17 | FromDiscord | <cybertim> hm ok |
15:16:33 | FromDiscord | <cybertim> and also httpclient? |
15:16:47 | Zevv | if you want to go async, you need to go all the way |
15:17:04 | Zevv | Nim has poor (ie none) async support for subprocesss, but you cna find that here: https://github.com/cheatfate/asynctools |
15:17:04 | FromDiscord | <cybertim> im using the asynchttpclient |
15:17:10 | Arrrrrrrr | lewd |
15:17:34 | FromDiscord | <cybertim> ok thanks |
15:41:32 | Oddmonger | is it possible to extend an enum ? |
15:42:40 | Oddmonger | i'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:24 | FromDiscord | <mratsim> no, but you can use macro to getImpl the enum and create an extended copy for your use |
15:45:38 | FromDiscord | <mratsim> similar for the proc of illwill |
15:46:08 | Oddmonger | a sort of hijack of the original enum ? |
15:46:21 | FromDiscord | <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:24 | FromDiscord | <mratsim> yep |
15:48:06 | Oddmonger | thank you (but for the moment i note it's not possible) |
15:56:48 | disruptek | clyybber: holy shit, it actually runs. |
15:58:20 | disruptek | he actually unblocked us. 🎉 |
16:03:24 | * | Arrrrrrrr quit (Quit: Arrrrrrrr) |
16:07:59 | Oddmonger | ok tried with a cast (yes, i know), but couldn't extend the colors beyond the basic term 16 colors |
16:09:01 | FromDiscord | <lqdev> how would you expect it to work |
16:09:05 | Oddmonger | that must be the term code sent by illwill for composing which should be changed, but that means changing TerminalBuffer and so |
16:09:41 | Oddmonger | lqdev : well i was thinking that maybe i could at least use 255 colors codes |
16:10:04 | FromDiscord | <lqdev> why not just go with true color |
16:10:17 | FromDiscord | <lqdev> if illwill doesn't support true color, then open an issue |
16:10:20 | FromDiscord | <lqdev> or PR |
16:10:29 | Oddmonger | it doesn't |
16:10:55 | Oddmonger | issue has already been opened, if i remember well |
16:11:20 | Oddmonger | that'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:59 | Zevv | disruptek: what |
16:54:03 | Zevv | unblocked? how? |
16:58:05 | disruptek | clyybber fixed it. |
17:13:16 | Zevv | clyybber fixed it. |
17:13:25 | Zevv | what did that take so long if it was so simple! |
17:13:33 | Zevv | @clyybber: hero! |
17:18:20 | disruptek | it's not really that simple. 😜 |
17:18:54 | Zevv | pfff |
17:18:56 | disruptek | i can finally run tests of typed, and whaddya know, some of them fail. |
17:19:09 | disruptek | now i have to remember how this thing works. |
17:19:36 | Zevv | I tried that |
17:19:37 | Zevv | I failed |
17:19:55 | Zevv | what nim branch is that in? |
17:22:09 | disruptek | it's not. it's not really fixed; it's a work-around merged into cps master. |
17:22:41 | * | abm joined #nim |
17:22:47 | disruptek | carnac is still broken. 😉 |
17:26:26 | Zevv | oh the dirty bugger just rewrote `nnkYieldStmt` to `coroYield` |
17:26:29 | Zevv | ho hum |
17:27:13 | disruptek | you are going to have to tell him that mutant doesn't work. |
17:27:20 | disruptek | i don't seem to be getting through. |
17:27:39 | Zevv | there will be blood |
17:28:00 | disruptek | the erasure is fine, but the bones can't be those of a mutant. |
17:30:55 | disruptek | 157 env_402655425(continuation).j_402655427 = 3 |
17:30:59 | disruptek | 159 j = 5 |
17:31:12 | disruptek | that dog will not hunt. |
17:31:18 | Zevv | given his past perspicaciousness in other fields, I give him the benefit of the doubt for now |
17:31:40 | disruptek | eh it's wrong. |
17:31:51 | disruptek | use your intuition. |
17:31:53 | Zevv | I agree. |
17:31:56 | Zevv | and that's all I have |
17:32:03 | disruptek | it's enough. |
17:32:17 | disruptek | wisdom is a hard thing to pin down, but that doesn't make it any less real. |
17:32:37 | Zevv | it' |
17:32:48 | Zevv | inuition 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:08 | Zevv | which 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:33 | disruptek | i mean, we all write nim. |
17:33:42 | disruptek | there's some consistency to our taste. |
17:34:19 | Zevv | anyhow, given we're no longer blocked |
17:34:26 | Zevv | does that mean I actually have to /do/ something now? |
17:35:16 | disruptek | it would be nice if tzevv failed less predictably. |
17:35:37 | disruptek | btw, my testes are getting to be rather pleasant to use. |
17:42:53 | Oddmonger | so much nim… so little time |
17:43:03 | FromDiscord | <Rika> nime |
17:46:26 | * | Arrrrrrrr joined #nim |
17:47:53 | disruptek | zevv: let (x, y) = (cpsCall1(), cpsCall2()); echo x; echo y; |
17:47:59 | disruptek | this is a super fun transform. |
17:48:11 | Zevv | I think we decided not to allow that |
17:48:17 | Zevv | just like let x = cpsCall(1) + cpsCall(2) |
17:48:29 | disruptek | why not? |
17:48:50 | Zevv | because I have *no* clue how that would work if you go anding and orring |
17:48:57 | Zevv | let x = cpsCall(1) and cpsCall(2) |
17:49:03 | Zevv | how do you transform that? |
17:49:08 | * | narimiran quit (Quit: leaving) |
17:49:09 | Zevv | with arbitrary complex expressions |
17:49:21 | disruptek | the same way you transform anything. |
17:49:45 | Zevv | methinks one thing at a time |
17:49:53 | disruptek | left-to-right, baby. |
17:50:21 | Zevv | yeah but there's control flow in the expression itself. it requires actually /thinking/ about that stuff |
17:50:35 | disruptek | nah. |
17:50:50 | disruptek | the less thinking, the better, with cps. |
17:51:00 | Zevv | if you say so, boss |
17:55:20 | disruptek | i 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:44 | disruptek | the erasure container helps with this, and result. |
17:55:55 | disruptek | just makes it a little cleaner. |
18:01:19 | * | krux02 quit (Remote host closed the connection) |
18:06:16 | disruptek | proc zevv(x: int; y = cpsCall(x)) = ## hilarity ensues... |
18:13:14 | FromDiscord | <exelotl> oh god lol |
18:22:43 | disruptek | We 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:52 | disruptek | story of my life. |
18:24:58 | Zevv | wait what |
18:29:20 | Oddmonger | is it possible to extract runes from the current terminal's font with Unicode module ? |
18:29:43 | Oddmonger | like the old basics programs which displayed the ascii table :) |
18:30:17 | FromDiscord | <haxscramper> Well you can get output of the command and parse it in any way you like |
18:30:41 | FromDiscord | <haxscramper> But I'm not sure if it is possible to get text after it has been displayed on terminal |
18:31:30 | Oddmonger | oh i would be happy by just displaying in terminal |
18:31:32 | FromDiscord | <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:49 | Oddmonger | it seems with « unicode » i can only works with runes i provide myself |
18:33:14 | Oddmonger | not doing things like for i=1..255: print chr$(i) |
18:33:40 | Oddmonger | (sorry for the chr$() , i don't know nim equ) |
18:33:58 | FromDiscord | <haxscramper> What exactly you want to do? |
18:34:15 | FromDiscord | <haxscramper> Run program and do something with it's output (parse/display again etc.)? |
18:34:30 | Oddmonger | just seeing what can be displayed with the font |
18:35:19 | FromDiscord | <haxscramper> So something like `msgcat --color=test`? |
18:35:48 | FromDiscord | <haxscramper> But for testing characters |
18:35:51 | Oddmonger | ah nice, didn't knew this |
18:35:57 | Oddmonger | yes something like that |
18:36:44 | FromDiscord | <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:19 | FromDiscord | <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:55 | Oddmonger | ah, i can display integer values, that's interesting |
18:40:29 | Oddmonger | i was afraiding something like (page, subpage, range, value) (something tricky) |
18:45:49 | Oddmonger | thank you haxscramper, it works perfectly |
18:46:51 | FromDiscord | <haxscramper> `echo 'import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it))' | nim r --cc:tcc -` |
18:46:59 | FromDiscord | <haxscramper> Just for the sake of it |
18:47:19 | FromDiscord | <haxscramper> Nim one-liner to display all unicode math runes |
18:47:51 | FromDiscord | <haxscramper> hm |
18:47:59 | FromDiscord | <haxscramper> !eval import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it) |
18:48:02 | NimBot | Compile failed: /usercode/in.nim(1, 64) Error: expected: ')', but got: '[EOF]' |
18:48:13 | FromDiscord | <haxscramper> !eval import unicode, sequtils; echo mapIt(0x2200 .. 0x22FF, Rune(it)) |
18:48:16 | NimBot | ∀∁∂∃∄∅∆∇∈∉∊∋∌∍∎∏∐∑−∓∔∕∖∗∘∙√∛∜∝∞∟∠∡∢∣∤∥∦∧∨∩∪∫∬∭∮∯∰∱∲∳∴∵∶∷∸∹∺∻∼∽∾∿≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋⊌⊍⊎⊏⊐⊑⊒⊓⊔⊕�... |
18:48:49 | saem | Morning folks |
18:51:11 | * | disruptek 👋 |
18:51:33 | * | jjido joined #nim |
18:51:39 | Oddmonger | !eval(Rune(42) & " ") |
18:52:03 | Oddmonger | ah, discord bot |
18:54:29 | FromDiscord | <haxscramper> You forgot to import unicode, this is an IRC bot actually and it seems I killed it |
18:59:29 | Oddmonger | anyway, i had forgotten to change Rune to string with $ , for the concatenation |
19:02:27 | Zevv | disruptek: why the github payed account then? |
19:04:57 | * | Jjp137 quit (Ping timeout: 260 seconds) |
19:05:33 | * | saem_ joined #nim |
19:07:54 | disruptek | because i have shit tons of code that i don't share. |
19:08:20 | FromDiscord | <lytedev> github private repos are free now ;) |
19:08:26 | * | Jjp137 joined #nim |
19:08:39 | disruptek | i know, it seems i will be "upgrading" to free. |
19:19:11 | * | Jjp137 quit (Quit: Leaving) |
19:20:13 | FromDiscord | <lqdev> is there any reason to get pro anymore |
19:20:21 | * | Jjp137 joined #nim |
19:21:16 | FromDiscord | <bark> why do people like github so much argh |
19:21:35 | FromDiscord | <bark> if it loves open source so much it should be open source itself |
19:22:31 | FromDiscord | <shadow.> bc |
19:22:34 | FromDiscord | <shadow.> browser go brr |
19:24:21 | FromDiscord | <bark> gitlab: exists, gitea: exists, sr.ht: exists, and many more |
19:29:33 | FromDiscord | <bark> wait, nim doesn't support windows 7? |
19:30:06 | FromDiscord | <bark> (edit) "wait, nim doesn't support windows 7? ... " added "or was my old laptop 32 bit all along" |
19:31:59 | leorize | github just have the best UX |
19:32:15 | FromDiscord | <bark> i know, and it has the most people |
19:32:20 | FromDiscord | <bark> so your project is going to be noticed |
19:32:48 | leorize | nim should support windows 7, I don't think we use any APIs beyond Vista/7 in the stdlib |
19:32:53 | FromDiscord | <bark> yeha |
19:32:59 | leorize | about a half should work on XP as well |
19:33:03 | FromDiscord | <bark> but it's the 32 bit windows |
19:33:09 | FromDiscord | <bark> i messed up |
19:34:09 | FromDiscord | <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:03 | saem_ | 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:04 | disbot | ➥ Add `auto` config to `nim.buildCommand` for multi-target projects |
20:12:38 | disruptek | my 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:18 | FromDiscord | <ElegantBeef> Good job saem, just had goto def work in the compiler 😄 |
20:14:40 | saem_ | Yay, thanks |
20:15:19 | * | filcuc joined #nim |
20:15:23 | saem_ | 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:33 | FromDiscord | <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:18 | FromDiscord | <ElegantBeef> Unless i misunderstand what you were asking about |
20:17:59 | saem_ | Can a config file in fact set the backend or does it only set defines related to the backend? |
20:19:03 | FromDiscord | <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:19 | FromDiscord | <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:35 | saem_ | 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:07 | saem_ | 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:23 | FromDiscord | <ElegantBeef> Yea a config with `--backend:js` forces `nim c` to compile with js |
20:21:37 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/793574463765217330/unknown.png |
20:21:45 | FromDiscord | <ElegantBeef> Pic for proof, look at that out file 😄 |
20:22:29 | * | habamax quit (Ping timeout: 256 seconds) |
20:22:39 | saem_ | pics... and it did happen. |
20:22:44 | FromDiscord | <ElegantBeef> Lol, indeed |
20:24:05 | FromDiscord | <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:40 | FromDiscord | <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:51 | saem_ | I have a vague feeling this goes into witness territory. |
20:25:00 | * | filcuc joined #nim |
20:25:07 | FromDiscord | <ElegantBeef> Huh? |
20:26:07 | saem_ | 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:41 | disruptek | how 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:58 | disruptek | anyway, what's wrong with `toSeq(iterator)`? i prefer `toSeq iterator`, myself. |
20:27:02 | * | FromDiscord joined #nim |
20:27:09 | FromDiscord | <ElegantBeef> Ah pretty much impossible then |
20:27:36 | * | livelmao joined #nim |
20:27:37 | saem_ | witness: https://github.com/nim-lang/Nim/pull/11992 |
20:27:39 | disbot | ➥ every 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:13 | livelmao | @disbot hi |
20:28:15 | disruptek | yeah, i'm afraid of that pr. |
20:28:33 | saem_ | 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:34 | disruptek | disbot: you have fans? |
20:28:35 | disbot | most likely. |
20:28:42 | disruptek | wow. |
20:29:09 | saem_ | disruptek I bet they even try to slide into disbot's dms |
20:29:17 | disruptek | thirsty motherfuckers. |
20:29:24 | saem_ | srsly |
20:29:36 | FromDiscord | <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:09 | saem_ | I know, but foo.toSeq is exactly that type of thing it touches lots of concepts that are deeply fundamental. |
20:30:23 | disruptek | yes, this is the problem. |
20:31:06 | FromDiscord | <acek7> hope everyone is doing well |
20:33:57 | saem_ | 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:58 | Zevv | 9 |
20:47:04 | saem_ | 10 |
20:47:06 | FromDiscord | <ElegantBeef> 12? |
20:47:12 | saem_ | 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:47 | disruptek | planetis[m]: why can't add() be efficient in your varchar? |
21:38:09 | planetis[m] | maybe it can |
21:39:14 | planetis[m] | The length might need more bytes and the rest of the data moved back |
21:39:58 | planetis[m] | if you need something simpler there is another varchar implementation that uses seperate length field |
21:40:16 | planetis[m] | https://github.com/andreaferretti/spills/blob/master/spills/varchar.nim |
21:42:20 | planetis[m] | i guess i can try to do that |
22:10:05 | * | superbia quit (Quit: WeeChat 3.0) |
22:12:54 | FromGitter | <jrfondren> https://play.nim-lang.org/#ix=2Kfl |
22:16:20 | FromDiscord | <ElegantBeef> `sequtils` is like "What am i to you?" |
22:16:37 | FromDiscord | <7815> how do i get a `ref`erence or the `p`oin`t`e`r` of an object, in code? |
22:16:54 | FromDiscord | <7815> is this even possible? |
22:16:57 | FromDiscord | <lqdev> nope |
22:17:06 | FromDiscord | <lqdev> due to how `ref`s work and what they are |
22:17:08 | FromDiscord | <7815> huh |
22:17:15 | FromDiscord | <lqdev> a `ref` is a pointer to some heap-allocated, GCd memory |
22:17:19 | FromDiscord | <7815> and the ptr? |
22:17:27 | FromDiscord | <lqdev> is a pointer to any old memory |
22:17:29 | FromDiscord | <ElegantBeef> `.addr` returns a pointer, ref requires you to do `new T` then passing that around |
22:18:03 | FromDiscord | <7815> yes, i have an object, i wish to have its `addr`ess in memory |
22:18:08 | FromDiscord | <7815> thank you |
22:18:21 | FromDiscord | <7815> c programmer, i know what i'm doing |
22:21:29 | FromDiscord | <7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfq |
22:24:11 | FromDiscord | <7815> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2Kfs |
22:24:47 | FromDiscord | <ElegantBeef> Why are you using `self.addr`? |
22:24:57 | FromDiscord | <ElegantBeef> `var Node` is already reference to `self` |
22:25:33 | FromDiscord | <ElegantBeef> or rather whatever you passed there |
22:27:33 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Kfu |
22:28:05 | FromDiscord | <7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfv |
22:29:27 | FromDiscord | <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:39 | FromDiscord | <7815> it's just much nicer code |
22:29:44 | FromDiscord | <ElegantBeef> I'm super confusued |
22:30:01 | FromDiscord | <ElegantBeef> It should be identical to this https://play.nim-lang.org/#ix=2Kfw |
22:31:28 | FromDiscord | <7815> wouldn't `self = self.lhs` mean that the caller's node then is the inserted node? |
22:31:40 | FromDiscord | <7815> this would mutate the caller's node |
22:32:12 | FromDiscord | <7815> calling `node.insert(key, val)` would change `node` into the child that's been inserted. |
22:32:47 | FromDiscord | <ElegantBeef> Couldnt you just make `cur` a node then, and have the default value as self |
22:32:55 | FromDiscord | <ElegantBeef> also if these are ref objects `var` is redundant |
22:33:53 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Kfx like isnt this the same as what you had just without your pointer shinanigans |
22:34:38 | FromDiscord | <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:39 | FromDiscord | <7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfy |
22:36:15 | FromDiscord | <7815> sent a code paste, see https://play.nim-lang.org/#ix=2Kfz |
22:36:20 | FromDiscord | <7815> to preserve the original node |
22:36:23 | mipri | non-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:33 | FromDiscord | <7815> since you're changing `self`. |
22:37:07 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> Bad approach as it doesnt actually look at the end result 😄 |
22:37:44 | FromDiscord | <7815> you should most probably analyze the logic, otherwise your advice will not match the problem |
22:38:30 | FromDiscord | <7815> sent a code paste, see https://play.nim-lang.org/#ix=2KfA |
22:41:47 | FromDiscord | <7815> why are docs so difficult to find for i.e. `addr` etc? |
22:42:14 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/system.html#addr%2CT |
22:42:22 | mipri | https://nim-lang.org/docs/lib.html , search for addr, it's the first result. |
22:42:28 | FromDiscord | <ElegantBeef> They arent, use the search bar on the docs |
22:43:48 | * | _angus_ joined #nim |
22:46:29 | FromDiscord | <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:27 | FromDiscord | <ElegantBeef> It's advised against if you can use any of the other features |
22:47:41 | FromDiscord | <7815> mipri: one wouldn't probably look for `addr` one would most likely search for `referenc(ing)`, `dereferencing`, `boxing`, etc |
22:47:50 | FromDiscord | <7815> maybe `address`, yes... |
22:48:03 | mipri | yeah, ok |
22:48:57 | FromDiscord | <ElegantBeef> You might be forced to use addr here |
22:49:01 | FromDiscord | <7815> yes. |
22:49:19 | FromGitter | <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:22 | FromDiscord | <7815> this is how you write this, that's just how it is |
22:49:38 | * | smitop joined #nim |
22:50:09 | FromGitter | <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:56 | mipri | if Node's a ref type, none of the addrs are necessary |
22:51:15 | FromGitter | <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:23 | FromDiscord | <ElegantBeef> That's what i was saying, refs are just pointers so it should be fine without addr |
22:51:44 | FromGitter | <pigmej> and if I'm not mistaken TimeInterval would not help here at all |
22:52:04 | FromDiscord | <ElegantBeef> I'm uncertain the desired here |
22:52:10 | FromDiscord | <ElegantBeef> You wan to move to the top of the hour? |
22:52:33 | FromGitter | <pigmej> not only, but also "midday two days ago" |
22:53:04 | FromGitter | <pigmej> or sth like that, I had it working in uglish way by setting datetime.hour = 12 |
22:53:05 | FromGitter | <pigmej> for example |
22:53:18 | FromGitter | <pigmej> it's fine to go back two days back with timeInterval |
22:53:27 | FromDiscord | <ElegantBeef> Isnt it just `day - dayOffset`? |
22:53:29 | FromGitter | <pigmej> but I cannot easily go two days ago AND 12PM |
22:53:41 | FromGitter | <pigmej> not quite, because that relaative part is then missing |
22:54:02 | FromGitter | <pigmej> as the original time mark will be preserved |
22:54:42 | FromGitter | <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:14 | FromGitter | <pigmej> especially that you cannot get now easily .hour, .seconds, .minutes anymore from datetime |
22:55:52 | FromDiscord | <ElegantBeef> You can https://nim-lang.org/docs/times.html#hour%2CDateTime |
22:56:58 | FromGitter | <pigmej> oh crap.... |
22:57:09 | FromGitter | <pigmej> I was somehow looking for "hours" not "hour"... |
22:57:34 | FromDiscord | <ElegantBeef> Well it's all there in nice ranged packages |
22:58:19 | FromGitter | <pigmej> yeah.. |
22:58:21 | FromGitter | <pigmej> now all clear.. |
22:58:33 | FromDiscord | <ElegantBeef> Does that solve all your problems? |
22:58:36 | FromGitter | <pigmej> I still don't like that deprecation though but at least clear... |
22:58:37 | FromGitter | <pigmej> yeah |
22:58:48 | FromGitter | <pigmej> now I just need to distract or create new one |
23:00:21 | FromGitter | <pigmej> thx |
23:01:35 | * | krux02 joined #nim |
23:06:21 | FromDiscord | <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:22 | FromGitter | <deech> How do I move and a `cstring` into an existing null cstring? Simple assignment doesn't seem to work. |
23:07:47 | FromDiscord | <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:05 | FromDiscord | <fwsgonzo> when is the next minor version? |
23:08:33 | mipri | deech: copyMem. cstrings are ptr, so assignment doesn't copy |
23:09:16 | FromGitter | <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:20 | FromDiscord | <Meowz> What build do I get if I use `-d:foobar` ? |
23:31:44 | FromDiscord | <ElegantBeef> you define a compile time field entitled `foobar` |
23:32:53 | FromDiscord | <ElegantBeef> Which means you can do `when defined(foobar)` |
23:33:06 | FromDiscord | <ElegantBeef> Probably should read https://nim-lang.org/docs/nimc.html |
23:34:13 | FromDiscord | <fwsgonzo> anyone know what the best package for Nim syntax in Atom is? |
23:35:03 | FromDiscord | <Meowz> Oh, thanks |
23:41:33 | * | saem quit (Quit: Connection closed for inactivity) |
23:41:33 | * | saem_ is now known as saem |
23:48:59 | FromDiscord | <shadow.> is there a version of string.split() that's an iterator? |
23:49:26 | FromDiscord | <ElegantBeef> yea string.split |
23:49:31 | FromDiscord | <shadow.> ah. |
23:49:32 | FromDiscord | <shadow.> lmao |
23:49:55 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/strutils.html#15 |
23:52:20 | FromDiscord | <shadow.> for me `readFile().split()` is outperforming `lines()` by magnitudes |
23:52:21 | FromDiscord | <shadow.> is this expected? |
23:52:37 | FromDiscord | <shadow.> `11ms` for the former in my program `17-18ms` for lines() |
23:52:41 | FromDiscord | <shadow.> (edit) "lines()" => "the latter" |
23:52:47 | mipri | yeah, strace your program to see why |
23:53:35 | FromDiscord | <shadow.> well im guessing that lines uses a buffered reader and readFile just reads it into memory all at once? |
23:53:38 | FromDiscord | <shadow.> which is more efficient? |
23:53:48 | mipri | readFile reads it into memory all at once. That's what it's for. |
23:53:53 | FromDiscord | <shadow.> yep |
23:54:19 | mipri | which is *preferable* depends on what you're doing. Reading files into memory all at once is rarely good for anything but benchmarks. |
23:54:48 | FromDiscord | <ElegantBeef> Depending on what you're doing both of these iterators are doing more allocating than required |
23:58:34 | FromDiscord | <ElegantBeef> Although in my testing i didnt find much(if any) of a speed boost for using `openArray[char]` instead of returning `string` |