00:00:16 | * | zahary quit (Quit: Leaving.) |
00:03:18 | axion | krux02: tbh i don't like your approach |
00:08:11 | axion | In Common Lisp, I have a compiler for GLSL to CL such that I can define GLSL functions indistinguishable from the host language that are reusable across shader programs and can be individually live-recompiled to transitively update any programs using them, rather than dumping GLSL into a string and doing minor parsing/string replacement to inject nim variables. |
00:08:11 | * | krux02_ joined #nim |
00:08:40 | axion | I'd like to do something for Nim some day, but that was an incredible amount of work |
00:08:59 | * | sealmove quit (Ping timeout: 250 seconds) |
00:10:31 | * | krux02 quit (Ping timeout: 246 seconds) |
00:13:57 | axion | don't get me wrong, your thing is cool and all, but a decent bit of macrology will allow you to have a reusability of gpu functions across many shader programs without code duplication, and the ability to transitively update parts of the dependency graph that changed at runtime |
00:16:05 | axion | i just don't see any value in the disconnect of writing GLSL when we have macros, with the added benefit of granular function/var code reuse |
00:17:59 | FromDiscord | <Generic> tbh I don't really see the point of writing shaders in Nim |
00:18:08 | FromDiscord | <Generic> you could reuse some code |
00:18:31 | FromDiscord | <Generic> but then you somehow have to make sure that the cpu code uses the same vector/matrix types |
00:19:16 | FromDiscord | <Generic> though what do think would be useful, is using macros to get rid of all of the boiler plate interface code |
00:20:12 | krux02_ | axion, can you elaborate? |
00:20:53 | krux02_ | I generally have a hard time elaborating the benefits of my shaderDsl macro to other people. Usually people don't understand it. |
00:21:15 | axion | It's pretty amazing what you can do, and the point is you gain all the benefits of Nim if you model it as such. For example, in CL I brought higher-order functions to GLSL which never had them; I can call shader functions that accept other shader functions as arguments. It's incredibly more useful for the gpu than one might think |
00:21:22 | krux02_ | Btw I have basically two project in opengl-sandbox. |
00:22:50 | axion | krux02_: Considering you are at least somewhat familiar with emacs-lisp, I can show you my library of reusable gpu functions written in lisp |
00:22:59 | krux02_ | The first on (the older one) does only shader integration. It does variable lifing for explicit variables only and there are sections for vertex and fragment shader and geometry shader. The second project, in the experiment folder, has a nim to glsl compiler written as a macro. This does allow you to do full shader development in Nim only. No glsl necessary anyomer. |
00:23:00 | axion | It's CL, but it should make some sense to you |
00:23:12 | krux02_ | yea |
00:23:36 | axion | https://github.com/mfiano/umbra |
00:23:36 | krux02_ | I thought about writing my library in lisp as well, but for my project I need to know the types. |
00:25:21 | krux02_ | I am looking at umbra cod enow, I see type annotations like ``:vec3``, but this is a symbol to lisp, not a type am I right? Or is it actually a type annotation that I don't know? |
00:26:39 | axion | This is a dialect of Lisp I wrote in CL, so no, it's just a symbol that semantically means a GLSL type annotation |
00:26:55 | axion | It's a dialect specifically for writing shader functions |
00:27:01 | krux02_ | ok |
00:27:09 | krux02_ | so you can write shader functions in glsl. |
00:27:18 | krux02_ | sorry I mean lisp |
00:28:03 | krux02_ | but how do you specify vertex attributes? |
00:28:13 | krux02_ | and how do you access them from lisp? |
00:28:24 | axion | Ah, well the way it works is |
00:28:44 | axion | sec lemme find the link |
00:29:22 | axion | here is a program definition https://github.com/mfiano/umbra/blob/master/src/sprite.lisp#L48 |
00:29:49 | axion | that specifies a program with a vertex and fragment stage, using the respective functions named by those symbols... |
00:30:34 | axion | now for vertex stages, the input arguments to the function are vertex attributes, and since lisp can return multiple values from a function, the first value represents the gl_Position, and all subsequent return values are passed as input arguments to the next stage |
00:31:01 | * | sealmove joined #nim |
00:31:05 | axion | For fragment stages, multiple return values are used to specify framebuffers for multiple render targets |
00:31:13 | axion | so there is none of that i/o block nonsense anywhere |
00:32:46 | krux02_ | and what is this: https://github.com/mfiano/umbra/blob/8bfcc30642537319965324236967c8c066b665c3/src/sprite.lisp#L21 |
00:33:06 | krux02_ | looks like an i/o block to me |
00:33:42 | FromDiscord | <Elegant Beef> You guys are talking about using nim for shader programming and im just like "i'd like a game engine to use with it" |
00:33:43 | krux02_ | :P |
00:34:01 | axion | that's an input argument to the function annotated to let it know it's an SSBO data using the layout of the spritesheet-data gpu struct |
00:34:35 | krux02_ | yea, and that part is what is completely automated in my Nim macro. |
00:35:51 | krux02_ | here is where I write a shader in nim: https://github.com/krux02/opengl-sandbox/blob/master/experiment/noiseSphere.nim#L272 |
00:36:04 | krux02_ | I call `simplex` wich is imported from a module |
00:36:11 | krux02_ | so very similir to what you are doing there. |
00:36:14 | krux02_ | in lisp |
00:36:18 | axion | where this syste really shines is it's completely interactive. hitting C-c C-c in emacs on any gpu function will compute the affected shader programs from anything in the graph that was modified and send a recompile signal to them to see the changes update in real time |
00:36:54 | axion | that is, functions act like normal CL functions in that it is fully live-recompilable in the same ways |
00:37:06 | krux02_ | the difference is here: https://github.com/krux02/opengl-sandbox/blob/master/experiment/noiseSphere.nim#L286 |
00:37:27 | axion | and everything is modeled in a way to look exactly like the host language, so you use the same operators and idioms for the most part |
00:38:12 | krux02_ | modelview comes from the outer scope here: https://github.com/krux02/opengl-sandbox/blob/e076f29efde28a440470dd8fec24a061819d9014/experiment/noiseSphere.nim#L266 |
00:38:49 | krux02_ | it is a normal varable. The macro analyzes what variables are used and all used variables are packed into a single uniform buffer object. |
00:39:09 | axion | this codebase i linked is just my gpu stdlib. just small utilities i call from my real game's shaders |
00:39:15 | krux02_ | but yea the disadvantage is that when you change the shader, you have to recompiler the entire project. You can't just hotswap the shader only. |
00:39:24 | krux02_ | at least not with the nim to glsl compiler. |
00:40:19 | axion | cool |
00:42:25 | krux02_ | btw did you already decide on a vectormath library? |
00:43:40 | axion | a friend and i grew frustrated with Unity and Unreal (we worked with them extensively in a game studio) about a decade ago and have been writing a fully interactive game engine ever since. it actually has a couple games written for it already, but still a ways to go before a public release. we can live recompile every aspect and see the changes instantly, not just shaders. texture definitions, mesh |
00:43:42 | axion | specifications, prefabs, materials, etc. all just a keybind away from seeing the whole game change. That is the nice thing about macros |
00:44:35 | * | rockcavera joined #nim |
00:45:02 | axion | Yes I have. I am porting our own CL math library that has all sorts of things you don't find in many math FOSS libraries |
00:45:27 | krux02_ | ok |
00:45:47 | krux02_ | I always try to convince people to use the glm port that I worked on :P |
00:45:57 | krux02_ | https://github.com/stavenko/nim-glm |
00:46:27 | krux02_ | It is basically written entirely by me by now, even though I don't host it. |
00:46:32 | krux02_ | "host" |
00:47:23 | krux02_ | the requirement was to have a precise glsl functionality in Nim, so that I can simply translate Nim to glsl. |
00:48:01 | krux02_ | So a lot of work went into making the behavior precisely like glsl. But yea if you are looking for awesome feauters, no it just has what glsl has as well. |
00:48:36 | krux02_ | but yea I guess you have your own library that you want to port ¯\_(ツ)_/¯ |
00:48:43 | axion | cool |
00:49:10 | axion | Yes I very much do. What we have is like nothing else and I'd like to bring it to the world of Nim |
00:49:52 | krux02_ | ok |
00:50:30 | krux02_ | At some point I tried using SIMD for that glm port. But lack of time prevented that I can implement it. |
00:51:06 | krux02_ | btw nim-glm has full swizzle support. |
00:51:29 | axion | Yeah that's very easy with macros. That was the first thing I did. |
00:51:55 | krux02_ | for me as well, but you also need language support for some operations. |
00:56:25 | axion | Another reason I want to port this math library over to Nim apart from the fact that it's just great, is because I've poured MANY years into the CL version and it's something I'm familiar enough with to know how to do it correctly and efficiently. It turns out, a lot of the math can be simplified or made more correct than what GLM and other libraries provide. I figured my knowledge here would be a |
00:56:27 | axion | good way to learn Nim trying to reconstruct that |
00:57:25 | * | Hideki_ joined #nim |
01:01:28 | krux02_ | well, glm isn't perfect that I found out. |
01:01:42 | axion | anyway, cool talk, but bed time for me. loving Nim :) |
01:02:13 | krux02_ | yea, I should go, too |
01:03:42 | * | Zectbumo quit (Remote host closed the connection) |
01:08:44 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:09:11 | * | pbb joined #nim |
01:09:35 | * | pbb quit (Client Quit) |
01:11:22 | * | pbb joined #nim |
01:24:06 | * | shadowbane quit (Remote host closed the connection) |
01:25:04 | * | shadowbane joined #nim |
01:31:12 | * | dwdv quit (Ping timeout: 256 seconds) |
01:36:07 | FromGitter | <cndkhuong> hello |
01:37:01 | FromGitter | <cndkhuong> 👑️ |
01:38:06 | disruptek | sup dawg |
01:38:14 | * | couven92 joined #nim |
01:44:45 | * | couven92 quit (Remote host closed the connection) |
01:45:11 | * | couven92 joined #nim |
01:51:49 | * | couven92 quit (Ping timeout: 264 seconds) |
02:40:54 | silvernode | disruptek: yo, how's it going? |
02:41:02 | disruptek | aight, you? |
02:41:35 | silvernode | Making progress on the game. At least 1 commit a day. I have issues staying motivated. |
02:42:13 | silvernode | Decided to make it a turn based game |
02:42:18 | disruptek | then aim for two commits. 😉 |
02:42:36 | silvernode | Hah, I have actually been doing more than that already |
02:43:09 | silvernode | I might need some ideas for the next part I want to write. |
02:43:20 | disruptek | what's that? |
02:44:10 | * | chemist69 quit (Ping timeout: 246 seconds) |
02:44:41 | silvernode | In a nutshell, functions for different tasks like mining. The main game loop counts the turns and the player chooses how many turns they want and then the mining function gets ran that many times, adding ore to your cargo hold. |
02:45:33 | silvernode | I am having trouble adding things to the cargo which is a seq that takes an object instead of a string |
02:45:46 | silvernode | I tried using the add() proc but it wants a string |
02:45:49 | * | Hideki_ quit (Remote host closed the connection) |
02:46:08 | disruptek | when you define the seq, define it like `seq[SomeObject]` instead of `seq[string]`. |
02:46:21 | * | chemist69 joined #nim |
02:46:41 | * | Hideki_ joined #nim |
02:47:22 | disruptek | !repos pulseaudio |
02:47:24 | disbot | https://github.com/pulseaudio/pulseaudio -- 9pulseaudio: 11Mirror of the PulseAudio sound server (for bug reports and pull requests go to the website!) 15 197⭐ 140🍴 |
02:47:25 | disbot | https://github.com/masmu/pulseaudio-dlna -- 9pulseaudio-dlna: 11A lightweight streaming server which brings DLNA / UPNP and Chromecast support to PulseAudio and Linux 15 1023⭐ 124🍴 |
02:47:25 | disbot | https://github.com/EHfive/pulseaudio-modules-bt -- 9pulseaudio-modules-bt: 11Adds Sony LDAC, aptX, aptX HD, AAC codecs (A2DP Audio) support to PulseAudio on Linux 15 905⭐ 38🍴 7& 27 more... |
02:47:32 | disruptek | ugh. |
02:48:40 | silvernode | disruptek: I already have seqs that take an object but I want to push new objects but that add() proc doesn't like that. |
02:49:00 | disruptek | use variant objects so all the objects are effectively of the same type. |
02:49:33 | silvernode | hmm, varient objects |
02:49:48 | silvernode | I will search the web for that |
02:50:28 | disruptek | aka case objects because you define them using a case statement syntax in the typedef. |
02:50:49 | * | Hideki_ quit (Ping timeout: 246 seconds) |
02:52:15 | FromDiscord | <Elegant Beef> I might be daft cause i still have 0 idea how to pass inputs into the started process 😄 |
02:52:29 | silvernode | I will have to learn more about that. I am still using common if statement structures in pretty much everything I write. I tend to understand those a bit more. |
02:53:02 | silvernode | although I do use case statements to take command arguments in my shell scripts. |
02:53:26 | disruptek | silvernode: i always write the simplest code i can. |
02:53:36 | disruptek | beef: inputs? |
02:53:43 | disruptek | beef: you can write the proc's stdin. |
02:53:54 | silvernode | disruptek: I try to do the same but could learn more in order to do that better. |
02:54:02 | FromDiscord | <Elegant Beef> I've tried that, but doesnt work for nano or vim |
02:54:13 | FromDiscord | <Elegant Beef> Since they dont use the stdin, so i imagine i need to change the entire terminal |
02:55:24 | disruptek | why guess? find a tiny emulator and see how it does it. |
02:56:11 | FromDiscord | <Elegant Beef> Well i was looking at xterm/vim to see where they get their inputs |
02:56:22 | FromDiscord | <Elegant Beef> but i couldnt find it on xterm |
02:56:43 | FromDiscord | <Elegant Beef> rather how it sends inputs in xterm |
02:58:26 | disruptek | look at the suckless term. |
03:03:26 | * | sealmove quit (Quit: WeeChat 2.7.1) |
03:09:21 | * | Hideki_ joined #nim |
03:10:13 | * | Hideki_ quit (Remote host closed the connection) |
03:11:11 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:11:22 | FromDiscord | <Elegant Beef> Im thinking i need to make use of pty, so this is pretty much all for naught atm |
03:12:51 | * | muffindrake joined #nim |
03:14:50 | disruptek | yep. |
03:15:45 | * | dadada quit (Ping timeout: 250 seconds) |
03:16:02 | FromDiscord | <Elegant Beef> How dare you agree |
03:16:30 | FromDiscord | <Elegant Beef> > Man spends more time then needed designing a shitty terminal that doesnt work properly |
03:17:35 | * | dadada joined #nim |
03:17:59 | * | dadada is now known as Guest16115 |
03:18:36 | FromDiscord | <Elegant Beef> This is where i just give in and use st as a base and intercept the output to render specialties |
03:18:52 | disruptek | i mean, it's not nuts. |
03:19:10 | FromDiscord | <Elegant Beef> what isnt? |
03:19:24 | FromDiscord | <slymilano> My first package! https://github.com/nim-lang/packages/pull/1402 - Hope it passes muster and helps out some dudes |
03:19:25 | disbot | ➥ Add filesize package |
03:21:14 | * | disruptek 🎉 |
03:21:17 | FromDiscord | <Elegant Beef> Does it support to from bibytes? |
03:21:43 | * | leorize joined #nim |
03:22:01 | FromDiscord | <slymilano> no |
03:22:30 | FromDiscord | <Elegant Beef> Well time to add it 😛 |
03:26:01 | * | shadowbane quit (Ping timeout: 264 seconds) |
03:26:17 | disruptek | ahh, i can do polls now on stream. |
03:26:24 | disruptek | i guess that's worthwhile. |
03:32:57 | * | krux02_ quit (Remote host closed the connection) |
03:38:03 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
03:44:30 | disruptek | tomorrow we will do some kind of pulseaudio shit on stream. |
03:45:02 | disruptek | i need some way to setup this stuff smoothly and programmatically. |
03:45:49 | * | adnanyaqoobvirk quit (Remote host closed the connection) |
04:01:17 | * | rockcavera quit (Remote host closed the connection) |
04:30:13 | * | jholland__ quit (Quit: Connection closed for inactivity) |
04:41:25 | * | nsf joined #nim |
05:16:13 | silvernode | how would I simply check if an item exists in a sequence so I can do something in the event that it does exist or something else if it does not exist? |
05:18:11 | FromDiscord | <Elegant Beef> the contains proc https://play.nim-lang.org/#ix=2esY |
05:18:41 | FromDiscord | <Elegant Beef> Also worlds bestest grammar by me |
05:21:07 | silvernode | this is on the right track however I would like to reach into the sequence and look to see if an object is there by name. In my code I add ore to the player inventory but instead of adding duplicate ore, I want to check for it and if it exists, then change an attribute of the ore object instead. |
05:21:42 | FromDiscord | <Elegant Beef> sounds like you want a table instead of a sequence |
05:21:53 | FromDiscord | <Elegant Beef> Tables store int or string to a value type |
05:22:01 | silvernode | I didn't know we had tables in Nim |
05:22:12 | silvernode | I used to use tables in Lua for this kind of stuff |
05:22:16 | FromDiscord | <Elegant Beef> So you could do `inventory["ironOre"] = 10` |
05:22:18 | FromDiscord | <Elegant Beef> Yep |
05:22:29 | FromDiscord | <Elegant Beef> they dont autohash types which is sorta disapointing |
05:23:10 | silvernode | I would like to send you to some of my code, hang on. |
05:24:23 | silvernode | https://github.com/silvernode/space-nim/blob/experimental/src/space_nimpkg/items.nim |
05:25:08 | FromDiscord | <Elegant Beef> ok so your inventory could be a table and you could use the name as a key to the table |
05:25:09 | silvernode | So I have an Item type which goes into the cargo attribute of the Ship type. |
05:25:23 | silvernode | the cargo is a seq |
05:25:42 | silvernode | ah I think I know what you mean |
05:26:05 | FromDiscord | <Elegant Beef> so in this case you could do `if(cargo.containsKey(item.name)): #do something here` |
05:26:34 | silvernode | the name of the table is player.cargo.ore.name (or something like that) |
05:30:58 | FromDiscord | <Elegant Beef> Something like this |
05:30:58 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2et2 |
05:32:03 | * | silvernode-mobil joined #nim |
05:32:11 | * | narimiran joined #nim |
05:37:43 | silvernode | I like that, however the cargo happens to be a seq that is part of the ship object so it probably complicates matters |
05:38:23 | silvernode | https://github.com/silvernode/space-nim/blob/experimental/src/space_nimpkg/ships.nim |
05:38:55 | FromDiscord | <Elegant Beef> how does it complicate it |
05:39:00 | FromDiscord | <Elegant Beef> It's just a different collection type |
05:39:17 | silvernode | right, I think I am the one complicating things here |
05:39:50 | silvernode | I need to go afk for a bit, are you going to be on irc for awhile? |
05:40:02 | FromDiscord | <Elegant Beef> Well im in discord so yes 😄 |
05:40:25 | silvernode | It is 22:40 here and I need to stay awake all night to keep my work schedule |
05:40:45 | FromDiscord | <Elegant Beef> "Work schedule" with corona that shouldnt matter ;P |
05:40:59 | silvernode | barely anyone is online when I have a night off. \ |
05:41:39 | silvernode | Safeway doesn't care about corona, they are making loads of cash right now. I stock for the night crew there. It's crazy right now! |
05:42:02 | silvernode | anyway bbl |
05:42:55 | FromDiscord | <Elegant Beef> A more safe method is to use enums over strings though |
05:42:55 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2et4 |
05:46:14 | * | solitudesf joined #nim |
06:35:14 | * | dddddd quit (Ping timeout: 246 seconds) |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:01:15 | * | tdog joined #nim |
07:04:54 | * | gmpreussner joined #nim |
07:10:17 | * | Guest16115 is now known as dadada |
07:29:20 | * | leorize quit (Remote host closed the connection) |
07:29:38 | * | leorize joined #nim |
07:29:45 | leorize | Araq: https://github.com/nim-lang/Nim/pull/13670 |
07:29:46 | disbot | ➥ Disable Github Actions CI |
07:31:07 | leorize | shashlick: I figured that you might be interested in moving our release pipeline away from travis |
07:31:45 | leorize | github actions got unlimited jobs for open source projects, so we should not be bottlenecked by travis limitations |
07:36:56 | silvernode | leorize: That is actually huge that they are offering that |
07:37:11 | * | chemist69 quit (Ping timeout: 272 seconds) |
07:37:22 | silvernode | travis is so slow |
07:37:35 | * | chemist69 joined #nim |
07:37:51 | leorize | yep |
07:39:48 | * | silvernode quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
08:14:35 | FromDiscord | <kodkuce> does nim have any Android UI lib? |
08:17:24 | * | dwdv joined #nim |
08:40:32 | * | PMunch joined #nim |
08:41:55 | FromDiscord | <djazz> What is the difference between using asyncfile and openFileStream from the streams module? When I read data into a buffer, which is blocking the thread more? For a web server, which should I use to send files to the client? Rn I use the streams module, a buffer and socket.send() which is async |
08:44:44 | FromDiscord | <djazz> I don't want it to affect other connections to the asynchttpserver |
08:49:50 | PMunch | Isn't there an asyncstreams module? |
08:51:11 | Zevv | there is |
09:03:46 | * | koltrast quit (Ping timeout: 240 seconds) |
09:04:04 | * | Zectbumo joined #nim |
09:04:16 | * | kungtotte quit (Ping timeout: 246 seconds) |
09:05:20 | FromDiscord | <djazz> How do you do file IO with asyncstreams? |
09:06:31 | * | Zectbumo quit (Remote host closed the connection) |
09:14:57 | * | Vladar joined #nim |
09:37:45 | FromDiscord | <djazz> found readToStream, but that uses asyncfile anyway |
09:45:38 | FromDiscord | <Varriount> Azure pipes are still down? |
09:57:25 | * | zahary joined #nim |
10:01:17 | * | koltrast joined #nim |
10:02:13 | * | kungtotte joined #nim |
10:03:09 | * | krux02 joined #nim |
10:08:04 | Zevv | async file I/O is a lie |
10:12:00 | Araq | Varriount: no, they are up |
10:19:21 | * | natrys joined #nim |
10:32:46 | FromDiscord | <Varriount> Zevv: The truth is it's all done by tiny people carrying messages back and forth in hidden pipes |
10:37:47 | * | abm joined #nim |
10:39:07 | * | arecaceae quit (Ping timeout: 246 seconds) |
10:42:31 | * | abm quit (Ping timeout: 250 seconds) |
10:57:52 | * | zahary quit (Quit: Leaving.) |
11:05:36 | * | JustASlacker joined #nim |
11:05:40 | JustASlacker | so |
11:06:00 | JustASlacker | any recommendation for a editor with nim support? |
11:06:22 | JustASlacker | the syntax highliting in vim doesnt work sometimes |
11:08:36 | FromDiscord | <exelotl> vs code is probably your best bet |
11:16:46 | * | Zectbumo joined #nim |
11:34:13 | * | tane joined #nim |
11:36:57 | federico3 | Vim |
11:37:06 | PMunch | JustASlacker, what is your problem with the syntax highlighting in Vim? I've used Vim exclusively for years now.. |
12:03:11 | JustASlacker | well, same here, I use vim for everything |
12:03:21 | JustASlacker | and I wish I knew how to debug it |
12:03:42 | JustASlacker | I have some .nim files for which it wont highlight anything |
12:05:21 | FromDiscord | <Recruit_main707> how developed is multithreading in Nim? |
12:07:00 | * | rockcavera joined #nim |
12:13:36 | * | arecaceae joined #nim |
12:22:32 | PMunch | JustASlacker, what do you use for highlighting? |
12:23:10 | PMunch | Recruit_main707, it works well, but it might be a bit hard to get right if you don't know what you're doing due to a lack of documentation |
12:26:27 | JustASlacker | zah/nim.vim as vundle plugin does the highliting I think |
12:28:14 | PMunch | Hmm, same one that I use |
12:28:25 | PMunch | Do you have an example file? |
12:30:13 | lqdev[m] | I wish there was better documentation for locks. I already asked like, 3 times before but nobody was kind enough to answer |
12:30:43 | * | opal quit (Ping timeout: 240 seconds) |
12:30:47 | lqdev[m] | I get the idea of a lock, it's basically like a memory semaphore, but how does it know what memory to actually lock? C++ has std::lock which takes the locked objects as arguments, but I don't see anything like that in Nim's stdlib |
12:31:03 | * | leorize quit (Ping timeout: 240 seconds) |
12:33:30 | FromGitter | <kaushalmodi> lqdev: I have not idea what locks are but is this similar? https://nim-lang.github.io/Nim/locks.html |
12:33:52 | * | opal joined #nim |
12:34:22 | lqdev[m] | that's what I'm talking about, I'm just asking if somebody could explain to me how they work. |
12:34:31 | FromGitter | <kaushalmodi> I agree though that that locks module needs some prefacing documentation and then doc examples for all procs |
12:36:02 | PMunch | Ah |
12:36:09 | PMunch | Okay, so a lock isn't actually attached to anything |
12:36:15 | PMunch | By default anyways |
12:36:45 | FromGitter | <alehander92> it seems it allocates the memory itself |
12:36:58 | FromGitter | <alehander92> initSysLock calls L = castSysLock (c_malloc(sizeof(SysLockObj))) |
12:37:09 | FromGitter | <alehander92> and then `pthread_mutex_init` |
12:37:24 | FromGitter | <alehander92> on posix(??) |
12:37:41 | FromGitter | <alehander92> you can take a look at syslocks.nim |
12:37:52 | FromGitter | <alehander92> i am not an expert as well |
12:39:27 | PMunch | There is however this experimental feature: https://nim-lang.org/docs/manual_experimental.html#guards-and-locks |
12:39:51 | PMunch | Where you can tell Nim that a variable is guarded by a lock, and use a pragma to aquire said lock |
12:41:06 | FromGitter | <alehander92> interesting! |
12:41:49 | PMunch | I really should finish my article on multitasking in Nim.. |
12:42:02 | PMunch | So much to do! |
12:46:24 | JustASlacker | PMunch: https://termbin.com/hwkr |
12:48:09 | PMunch | But to answer your question a bit more structured lqdev[m]: A lock is not anything special, you can just treat it as an object that you can call acquire and release on. The special property of a lock is that once one thread calls acquire, no other thread will be able to acquire the lock until the first thread calls release on the lock (simplifying a bit here, there are RW locks as well). Whatever you do in this so called "critical section" is up |
12:48:09 | PMunch | to you, but should include any reading/writing of shared resources that can't be interleaved with other access to the same resource. This takes a bit of careful thinking to figure out what actually needs to be locked and not for optimal performance, but that's a much wider topic. By default a lock is not attached to anything, so what you do in the critical section is completely up to you. But if you use the experimental guard feature I linked to |
12:48:10 | PMunch | Nim will guarantee that a {.locks.} statement occurs around access to a {.guard.}-ed variable. As the documentation explains it doesn't actually lock anything, so you should do that with a template as it shows. Hope that helps to make it at least a bit clearer.. |
12:48:30 | * | NimBot joined #nim |
12:48:35 | axion | Can someone help me with a template? I'm not sure if a template or macro is needed for this, and I'm really clueless how to approach the problem |
12:49:07 | PMunch | JustASlacker, that site is blocked by our work-network that I'm VPN-ed into atm.. Could you use ix instead? |
12:49:12 | PMunch | Or pastebin or whatever |
12:49:21 | PMunch | axion, hit me |
12:49:22 | JustASlacker | ix ? |
12:49:52 | axion | https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 |
12:50:06 | PMunch | JustASlacker, ix.io |
12:50:13 | JustASlacker | https://pastebin.com/zmbGDYYM |
12:50:17 | JustASlacker | too late -_- |
12:50:19 | PMunch | It's what the playground uses for its pastes :) |
12:50:30 | JustASlacker | ah, good to know |
12:50:43 | * | kungtotte quit (Ping timeout: 246 seconds) |
12:50:57 | JustASlacker | hmm, pastebin isnt showing any highliting either |
12:51:36 | PMunch | Highlights fine for me: https://uploads.peterme.net/2020-03-17-135111_1229x951_scrot.png |
12:51:42 | JustASlacker | http://ix.io/2eur |
12:52:11 | PMunch | ix also highlights it properly: http://ix.io/2eur/nim |
12:52:19 | * | kungtotte joined #nim |
12:52:25 | PMunch | Err, well up to a point.. |
12:52:28 | JustASlacker | :P |
12:52:43 | PMunch | It doesn't seem to understand the """ quotes |
12:52:49 | JustASlacker | well, I dont really need a python mulitline thingy |
12:53:29 | JustASlacker | is that actually a valid nim construct ? |
12:53:41 | FromGitter | <alehander92> have to tell that sublime works fine |
12:53:44 | JustASlacker | or was I just lucky to get that compiled |
12:53:48 | FromGitter | <alehander92> but its not free software so yeah |
12:53:56 | FromGitter | <alehander92> but its an option |
12:54:06 | * | leorize joined #nim |
12:56:13 | PMunch | axion, oh you want one that works with Vec[N] basically? |
12:57:10 | JustASlacker | guess I have to ask #vim |
12:57:20 | axion | PMunch: yeah |
13:01:16 | axion | PMunch: Oh forgot to mention, it should generate `<` too, so I get `>` and `>=` automatically |
13:02:33 | PMunch | axion, something like this? https://play.nim-lang.org/#ix=2euv |
13:02:56 | * | couven92 joined #nim |
13:04:20 | axion | Interesting...inspecting. Btw, it suddenly became useful to make this macro more generic, so I can just give it an operator to generate any component-wise boolean check |
13:06:03 | * | shadowbane joined #nim |
13:09:29 | PMunch | https://github.com/nim-lang/packages/pull/1403 < as soon as this is merged I will add macroutils to the playground :) |
13:09:31 | disbot | ➥ Add macroutils package |
13:09:47 | FromDiscord | <Recruit_main707> c++ `uintptr_t` is `ptr uint` in Nim? |
13:10:04 | Yardanico | cuint? |
13:10:15 | Yardanico | ah nvm |
13:10:22 | Yardanico | maybe just "pointer" ? |
13:10:42 | FromGitter | <alehander92> PMunch https://github.com/PMunch/macroutils |
13:10:46 | FromGitter | <alehander92> where are the examples? |
13:10:51 | Yardanico | in the docs |
13:11:04 | Yardanico | https://uploads.peterme.net/macroutils.html |
13:11:05 | FromGitter | <alehander92> like, i dont see them rendered |
13:11:13 | FromGitter | <alehander92> no, they are in the rst source |
13:11:24 | FromGitter | <alehander92> so they should be in github as well |
13:12:20 | PMunch | Yeah I know.. For some reason GitHub doesn't seem to support code-block.. |
13:12:34 | PMunch | So I need to convert my docs to use ``` instead |
13:13:09 | FromGitter | <alehander92> yeah i recall correctly nope |
13:13:11 | FromGitter | <alehander92> https://raw.githubusercontent.com/alehander92/RFCs/master/RFCs/nilcheck.rst |
13:13:18 | FromGitter | <alehander92> i think i managed to fix it for my rfc |
13:13:22 | FromGitter | <alehander92> with using one empty line (?) |
13:13:37 | FromGitter | <alehander92> so you can use rst |
13:14:12 | PMunch | Oh an empty line after .. code-block:: nim as well? |
13:14:22 | PMunch | Damn it, why is RST so fiddly! |
13:16:17 | FromGitter | <alehander92> yep it seems as maybe more proper syntax |
13:16:21 | FromGitter | <alehander92> couldnt find a good source |
13:16:24 | FromGitter | <alehander92> but yeah |
13:16:43 | FromGitter | <alehander92> no it's good if you get used it |
13:18:17 | PMunch | No, it's not.. |
13:18:27 | * | lritter joined #nim |
13:18:51 | PMunch | Hmm, new line didn't work.. |
13:19:52 | FromGitter | <alehander92> well it does work: the source i send gets rendered ok |
13:20:19 | PMunch | Yet when I updated my file it didn't |
13:20:22 | PMunch | Found the issue |
13:20:43 | PMunch | You need both a newline and a space between :: and nim |
13:20:44 | axion | Has anyone ever gotten an unused import warning, but the code actually does work, and removing the import line is a semantic error with nim check? |
13:20:53 | FromGitter | <alehander92> oh yes |
13:21:10 | FromGitter | <alehander92> to PMunch* |
13:21:42 | FromGitter | <alehander92> axion what are you using from that import? a macro/variable/function? |
13:22:32 | PMunch | There! finally! |
13:22:55 | PMunch | If RST was good it wouldn't take me two days to get code blocks to show up on GitHub.. |
13:23:11 | PMunch | A semantic error? |
13:23:48 | axion | PMunch: https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 |
13:24:09 | PMunch | I still think something like this should be part of Nim by the way: https://github.com/PMunch/macroutils/blob/master/nimtorst |
13:24:20 | axion | Can anyone explain that? I have never seen it do this |
13:24:40 | PMunch | Huh, that is indeed strange |
13:24:42 | FromGitter | <alehander92> huh seems like a bug |
13:24:49 | * | shadowbane quit (Quit: Konversation terminated!) |
13:24:56 | PMunch | Nim doesn't appear to consider using a const as using a module |
13:25:45 | axion | Huh |
13:27:25 | * | okcc joined #nim |
13:31:16 | FromGitter | <alehander92> probably a bug |
13:31:21 | FromGitter | <alehander92> best to report it on github |
13:31:23 | axion | I'm reporting it now |
13:31:42 | FromGitter | <alehander92> thanks! |
13:34:22 | axion | Issue #13673 is my first :D |
13:34:24 | disbot | https://github.com/nim-lang/Nim/issues/13673 -- 3Nim doesn't appear to consider using a const as using a module ; snippet at 12https://play.nim-lang.org/#ix=2euB |
13:35:02 | FromGitter | <alehander92> :) |
13:39:04 | FromGitter | <alehander92> iirc nim maybe does turn const-s into values very early |
13:39:30 | FromGitter | <alehander92> because i think i remember some compile-time errors which used the "calculated" values instead of the const names |
13:39:45 | * | okcc quit (Quit: Leaving) |
13:39:55 | FromGitter | <alehander92> so if that's true maybe it just doesnt see a const node with original module info anymore when it checks for usage |
13:40:00 | FromGitter | <alehander92> but this might be a wrong hypothesis |
13:40:30 | axion | I hope a resolution can be found if that's the case. I typically write whole modules with nothing but constants in other languages. |
13:41:07 | PMunch | Is there a top-level {.using.} pragma? |
13:41:09 | FromGitter | <alehander92> for now as a workaround you can use the used |
13:41:10 | FromGitter | <alehander92> https://nim-lang.org/docs/manual.html#pragmas-used-pragma |
13:41:22 | PMunch | Ah, meant used |
13:41:30 | FromGitter | <alehander92> but eventually it should be fixed hopefully |
13:41:51 | FromGitter | <alehander92> <3 |
13:42:05 | FromGitter | <alehander92> axion i looked through your blog and other stuff and you seem as a big lisp fan |
13:42:09 | FromGitter | <alehander92> how do you find nim for now |
13:42:35 | axion | Oh my blog is ancient. I don't think I updated it in years lol. |
13:43:04 | FromGitter | <alehander92> yeah i am just a curious guy sorry |
13:43:14 | axion | I find Nim...nice so far. Not Lisp by any means, for better or worse, but nice so far (only been using it a couple weeks or so) |
13:43:31 | FromGitter | <alehander92> i also liked lisp a lot before, not so much but moderately |
13:43:42 | * | Hideki_ joined #nim |
13:43:47 | axion | I have a lot of problems with Lisp after 2 decades of exclusive use. |
13:43:48 | FromGitter | <kaushalmodi> axion: (e)lisp + nim fan here |
13:44:05 | FromGitter | <alehander92> wow a lot |
13:44:47 | axion | I could list all the issues I have with it, and why Nim is better if you don't mind a huge rant |
13:44:58 | * | dddddd joined #nim |
13:46:01 | FromGitter | <kaushalmodi> You can blog about it :) |
13:46:30 | FromGitter | <alehander92> i dont mind |
13:49:27 | axion | 1) Software distribution is a huge pain with Lisp. There are no versioned dependencies. Instead we rely on a central repository which pulls tracked github repositories and http tarballs once per month at a time unbeknownst to developers, and they are not included if there are build failures. So in this respect, every user of some tool is always up to a month (sometimes longer) behind, and as a |
13:49:29 | axion | developer, trying to fix bugs for the next release is a losing battle because you never know when a release will occur. The fact that there is no possible way for a project to depend on different versions, and always uses the latest in the central repository is a huge point of failure. |
13:51:57 | FromDiscord | <Kiloneie> Why is Nim's survey vastly different than last year's ? |
13:51:59 | federico3 | just like go |
13:52:01 | axion | 2) Editor support and tooling. For Common Lisp, since it is probably the most interactive programming language in that you have access to the parser, evaluator, compiler and printer during parsing, evaluating, compiling or printing recursively, allows a lot of powerful introspection support, but absolutely requires using Emacs with a specific plugin. There are other editors with similar tools, but |
13:52:03 | axion | you're throwing away a decent chunk of the language by using them, because Common Lisp is just built with interactivity in mind from the ground up. |
13:53:06 | FromDiscord | <Kiloneie> I think these yearly surveys could cover more topics. |
13:53:47 | federico3 | axion: taking regular snapshots is a very good design, but not from a random commit obviously |
13:53:51 | axion | 3) Documentation. Common Lisp software is rarely ever documented. 4) Software quality. Apart from documentation, software is usually incomplete and broken in lots of ways, due to the fact that there is no collaboration. Every piece of software is developed by a single developer for their particular use case. CL developers do not like to work together. |
13:56:27 | axion | 5) The standard was published in 1994 to bring the features of Lisp since the 1960's into a standard document...an eternity in the software world, and won't ever be updated. This is nice in that software from the 60's still runs today on conforming implementations of the language, but it also means that the language is stuck in the past, and you pretty much have to write everything extra yourself (see |
13:56:29 | axion | #4 above on why this is bad). |
13:57:05 | axion | I could go on, but that's enough for now :) |
13:57:39 | FromDiscord | <Rika> nim takes on semver which is nice |
13:58:03 | FromDiscord | <Rika> it gives the benefit of 5 without the disadvantage |
14:00:09 | FromGitter | <alehander92> axion i see |
14:00:14 | FromGitter | <alehander92> interesting observations |
14:00:30 | FromGitter | <alehander92> so why did you decide to stop with clojure which i saw in your blog which seems as a more modern lips |
14:00:31 | FromGitter | <alehander92> lisp |
14:01:13 | axion | That said, it does have a lot of benefits that other languages haven't come close to, particularly the interactivity and the power provided by its macro system. Yes, even Nim unfortunately. |
14:01:43 | axion | I don't like Clojure at all. |
14:02:34 | axion | It sort of forces you down a particular paradigm of immutable-style FP, and it runs on the JVM where you don't really have control over memory or code generation. |
14:03:07 | axion | For real time applications and low memory footprint, Clojure is just impractical. |
14:03:41 | Araq | for me dynamic typing remains a showstopper |
14:03:53 | Araq | DT simply ain't for me |
14:04:17 | * | abm joined #nim |
14:05:43 | FromGitter | <alehander92> :) |
14:07:14 | axion | I have stayed with Common Lisp for so long because I'm a game developer, and I can generate efficient machine code with the right CL implementation, while being able to control every aspect of the compiler at runtime. For example, I could recompile a DSL that defines a texture to point to a new image on disk, and every entity in the game will get updated immediately, without stopping the game, |
14:07:16 | axion | compiling and waiting, starting the game, and getting back to the point where you were. For subtle changes, you have to screenshot to even notice any effect. |
14:08:31 | axion | That last bit was with most other languages of course. |
14:11:09 | axion | Well CL moreso has a gradual typing system. |
14:11:42 | Araq | when I looked at it its type system was mostly "assume type X here for optimization" |
14:12:00 | Araq | it didn't check anything |
14:12:27 | axion | Type annotations are implementation-specific, so if you're talking about the language then yes you're correct. Some implementations will allow you to annotate and turn aggressive checking up so that they are compile time errors. |
14:13:47 | Araq | fair enough but I doubt it works well in practice where one tends to work with underspecified junk code :-) |
14:14:07 | axion | Hence why everyone writes their own stuff |
14:15:07 | axion | I am sick of all that to be honest, but I have about 100k lines of a game engine that I will probably still work on in my off time, because it's pretty much my life's work. |
14:15:52 | Araq | well in C++ game engines everything is written from scratch often too |
14:16:05 | Araq | (STL is bad!) |
14:16:10 | axion | :) |
14:24:29 | * | clyybber joined #nim |
14:30:45 | * | clyybber quit (Read error: Connection reset by peer) |
14:31:14 | * | clyybber joined #nim |
14:34:05 | axion | @alehander92: {.used.} on a const doesn't seem to remove the warning for me |
14:34:14 | FromGitter | <alehander92> no no |
14:34:23 | FromGitter | <alehander92> {.used.} on the whole module |
14:35:03 | axion | Ah I saw the toplevel declaration in the manual, but I don't understand what `defined(numHasUsed)` is actually doing. |
14:35:35 | FromGitter | <alehander92> axion yeah |
14:36:00 | FromGitter | <alehander92> sorry, the first thing is still useful info : obviously {.used.} doesnt work for consts itself |
14:36:09 | FromGitter | <alehander92> otherwise i suspect this is for backward compat |
14:36:25 | FromGitter | <alehander92> if you happen to have a lib targetting older nim where {.used.} didnt exist? |
14:36:40 | FromGitter | <alehander92> but normally you would just do `{.used.}` |
14:36:47 | axion | I kinda feel dirty for treating the whole module as used though. I kinda want the warnings to appear for non-consts in that module to catch mistakes |
14:37:00 | FromGitter | <alehander92> yes, you're correct, that's why the bug is there |
14:40:35 | FromGitter | <alehander92> oh man i finally realized i am stopping a parent process of the one i wanted to stop.. |
14:44:21 | axion | If I have a type parameter T that is an "or" typeclass for a few different array container types, is there a way to get the containing type of that array as another parameter? |
14:54:40 | FromGitter | <qqtop> ((https://camo.githubusercontent.com/6aba6c848ec3c87a75eb8ec63f734ab70f609c88/687474703a2f2f7171746f702e6769746875622e696f2f6e696d2e6769663f7261773d74727565)) |
14:55:09 | clyybber | sick |
14:56:05 | clyybber | axion: You mean like [T: int or uint](a: array[T]) ? |
14:56:41 | axion | Maybe, lemme try in a few when I'm done with lunch. Thanks |
14:59:59 | lqdev[m] | axion: if you have sth like [T: array | seq](a: T) you'll need to write a macro that extracts generic types |
15:01:09 | * | jholland__ joined #nim |
15:01:11 | lqdev[m] | something similar to https://github.com/liquid600pgm/euwren/blob/9148e9d439ae091ccca72a71e91c466f3a0ef0e4/src/euwren.nim#L224 |
15:02:39 | clyybber | lqdev[m]: You should be able to do [D, T: array[D] | seq[D]](a: T) |
15:02:54 | clyybber | ignore the array only having one generic param :p |
15:05:17 | disruptek | ~stream |
15:05:18 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
15:05:27 | disruptek | time to write a pulseaudio controller. |
15:05:35 | disruptek | name suggestions? |
15:06:03 | disruptek | it just has to let me automatically adjust levels and connect sinks/sources by app name. |
15:07:29 | * | sammich quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
15:08:07 | * | crem quit (Ping timeout: 272 seconds) |
15:08:16 | clyybber | disruptek: Nice, pulsecontrol? |
15:08:30 | disruptek | seems like this has been done so many times but i cannot find the right solution for me. |
15:08:40 | disruptek | i think i can just use dbus. |
15:08:41 | clyybber | pulsemixer? |
15:08:46 | clyybber | have you heard of that one? |
15:08:57 | clyybber | thats what I use |
15:09:14 | clyybber | dunno, if it can connect sinks/sources by app name tho |
15:09:23 | disruptek | yeah, that's the problem. |
15:09:34 | clyybber | sounds like you are looking for jack :p |
15:09:46 | clyybber | or pipewire |
15:09:46 | disruptek | yeah, i'm just not ready to take the plunge into jack. |
15:09:55 | disruptek | this'll be a stream hack. like 2-3hrs. |
15:09:55 | clyybber | pipewire is jack + pulseaudio |
15:09:58 | clyybber | ah |
15:10:00 | clyybber | ok |
15:10:07 | disruptek | start-to-finish cli tool. |
15:12:24 | disruptek | pulsemixer is kinda what i want, but there's no way to automate it. |
15:12:33 | disruptek | pavucontrol is the same thing, basically. |
15:13:04 | * | kokzhou joined #nim |
15:13:20 | shashlick | does it have a wrapper |
15:13:25 | disruptek | not yet. |
15:13:44 | disruptek | i thought about that, but i'm not the right guy to stream it. 😘 |
15:14:21 | disruptek | pulseauto |
15:14:32 | FromGitter | <alehander92> oh ok so pgrep -P <pid> |
15:14:35 | FromGitter | <alehander92> is what i need |
15:14:51 | * | Hideki_ quit (Remote host closed the connection) |
15:15:26 | * | kokzhou quit (Client Quit) |
15:15:35 | * | Hideki_ joined #nim |
15:20:01 | * | Hideki_ quit (Ping timeout: 264 seconds) |
15:20:19 | FromGitter | <kristianmandrup> I'm getting `undeclared field: 'kind' for type system.NimNode` |
15:20:28 | * | JustASlacker quit (Remote host closed the connection) |
15:20:32 | FromGitter | <kristianmandrup> macro defineComponent*(body: untyped): auto = ⏎ if body.kind == nnkStmtList: |
15:20:44 | FromGitter | <kristianmandrup> defineComponent: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e70eacc11701c039554d32d] |
15:21:34 | FromGitter | <kristianmandrup> I took this directly from `react.nim` so wondering if sth in the nim internals changed? |
15:21:35 | FromGitter | <kristianmandrup> https://github.com/andreaferretti/react.nim/blob/master/example/app.nim#L42 |
15:22:28 | FromGitter | <kristianmandrup> NimNode* {.magic: "PNimrodNode".} = ref NimNodeObj ⏎ ⏎ ```## Represents a Nim AST node. Macros operate on this type.``` [https://gitter.im/nim-lang/Nim?at=5e70eb33ebcea00e68fd00c4] |
15:23:39 | * | lritter quit (Remote host closed the connection) |
15:24:20 | FromGitter | <kristianmandrup> Hi @alehander92 , I'm finally back |
15:25:20 | * | lritter joined #nim |
15:25:45 | FromGitter | <alehander92> hey |
15:25:49 | FromGitter | <alehander92> welcome :) |
15:25:55 | FromGitter | <alehander92> yeah the definition is a builtin |
15:26:08 | FromGitter | <alehander92> so `kind` is defined internally afaik |
15:26:58 | FromGitter | <kristianmandrup> so what could I be missing. I literally copied the macro and using the same way of calling it as in `react.nim` example |
15:27:10 | FromGitter | <alehander92> but i have no idea why would you get missing field |
15:27:32 | FromGitter | <kristianmandrup> https://github.com/andreaferretti/react.nim/blob/master/react.nim#L155 |
15:28:16 | FromGitter | <kristianmandrup> https://github.com/kristianmandrup/react-16.nim/blob/master/react16.nim#L9 |
15:28:23 | * | Hideki_ joined #nim |
15:28:29 | FromGitter | <kristianmandrup> https://github.com/kristianmandrup/react-16.nim/blob/master/example/sandbox.nim#L8 |
15:28:51 | FromGitter | <kristianmandrup> Been trying to upgrade the original `react.nim` to work with latest nim and React 16.x |
15:29:51 | FromGitter | <kristianmandrup> How can I best debug this issue? |
15:31:11 | axion | I'm probably overthinking slices here, but how would i write the contents of 2 smaller arrays into a larger one? a = [0, 1]; b = [2,3]; c = [0,1,2,3]? |
15:31:28 | FromGitter | <alehander92> well you can try echo body.repr |
15:31:31 | FromGitter | <alehander92> then echo body.treerepr |
15:31:32 | axion | trying to do it concisely without multiple result slices |
15:31:33 | FromGitter | <kristianmandrup> If I look into the nim compiler, it always seems to reference `PNode` |
15:31:34 | FromGitter | <kristianmandrup> proc makeStmtList*(n: PNode): PNode = ⏎ if n.kind == nkStmtList: |
15:31:35 | FromGitter | <alehander92> in the beginning of the macro |
15:31:55 | FromGitter | <alehander92> yeah NimNode is used for macros, PNode is just a compiler detail |
15:32:34 | FromGitter | <alehander92> i guess NimNode basically is a PNode actually but that's the user facing api yeah |
15:33:00 | FromGitter | <alehander92> mostly the difference practically is to use nk for PNodes and nnk for NimNodes iirc |
15:33:45 | FromGitter | <kristianmandrup> macro defineComponent*(body: untyped): auto = ⏎ echo body.repr ⏎ echo body.treerepr ⏎ if body.kind == nnkStmtList: [https://gitter.im/nim-lang/Nim?at=5e70edd9e72d577020a0d846] |
15:33:52 | FromGitter | <kristianmandrup> Nothing is being printed |
15:34:09 | FromGitter | <alehander92> well, that's strange |
15:34:20 | FromGitter | <alehander92> can you just call it with a very simple argument next to the macro def |
15:34:42 | FromGitter | <alehander92> try a minimal repro example which works and go on from there |
15:34:55 | axion | proc foo(c: var array[4, int], a, b: array[2, int]): # is there anyway to write the values of A and B into C in a single line without two `c[N..M] = ...` lines? |
15:35:00 | FromGitter | <kristianmandrup> yeah, so I'm calling macro with a proc node |
15:35:51 | FromGitter | <kristianmandrup> I tried |
15:35:52 | FromGitter | <kristianmandrup> defineComponent: ⏎ ⏎ ```var x = 2``` [https://gitter.im/nim-lang/Nim?at=5e70ee5711701c039554e142] |
15:35:59 | FromGitter | <kristianmandrup> With |
15:36:00 | FromGitter | <kristianmandrup> macro defineComponent*(body: untyped): auto = ⏎ echo body.repr ⏎ echo body.treerepr |
15:36:12 | FromGitter | <kristianmandrup> still the same error and nothing being printed |
15:36:24 | * | sammich joined #nim |
15:37:31 | FromGitter | <kristianmandrup> nim --version ⏎ Nim Compiler Version 1.1.1 [MacOSX: amd64] ⏎ Compiled at 2020-03-17 |
15:37:39 | FromGitter | <kristianmandrup> react16.nim(11, 12) Error: undeclared field: 'treerepr' for type system.NimNode |
15:39:03 | FromGitter | <alehander92> you need to import macros |
15:39:13 | FromGitter | <alehander92> maybe react is exporting them but not completely |
15:39:17 | FromGitter | <alehander92> https://play.nim-lang.org/#ix=2ev8 |
15:39:54 | FromGitter | <alehander92> (click on showing output and then on Run) |
15:40:23 | FromGitter | <alehander92> and on showing output again, i mean whenever you need to see debug/compiler info |
15:41:16 | FromGitter | <alehander92> PMunch maybe we can one day show both |
15:41:21 | FromGitter | <alehander92> on a side by side view |
15:41:28 | FromGitter | <alehander92> i know tho , PR-s welcome |
15:54:33 | clyybber | PMunch: How do you know I want a string literal and not an ident? |
15:54:38 | clyybber | In you Command example |
16:18:58 | * | a_b_m joined #nim |
16:20:34 | * | a_b_m quit (Client Quit) |
16:21:25 | * | abm quit (Ping timeout: 246 seconds) |
16:24:07 | PMunch | Huh? |
16:24:25 | PMunch | clyybber, ^ |
16:24:46 | clyybber | PMunch ? |
16:25:12 | PMunch | You asked how I know if you want as string literal |
16:25:19 | clyybber | yeah |
16:25:58 | clyybber | Did I miss your answer? |
16:26:00 | PMunch | You mean how I know to convert the first string to an ident and the second to a tring literal? |
16:26:11 | clyybber | Yeah |
16:26:36 | clyybber | Do you only implicitly convert to ident? |
16:28:40 | PMunch | Ah, Command has the signature "proc Command(name: string | NimNode; arguments: varargs[NimNode]): NimNode" |
16:28:58 | PMunch | And string literals are auto-converted to NimNodes of a string literal |
16:29:03 | axion | if i do [N, M: static[int]] is it enforced that both must be different values, and if not, is it possible to do this? |
16:29:21 | clyybber | axion: Yeah, but you gotta use when inside the proc/template |
16:29:24 | clyybber | PMunch: I see |
16:29:35 | PMunch | But if Command is given a string as the first argument it is converted to an Ident |
16:29:41 | leorize | axion: when N == M: {.error: "Your error message here.".} |
16:29:57 | axion | I see, thanks. |
16:33:16 | * | Hideki_ quit (Remote host closed the connection) |
16:34:21 | * | Hideki_ joined #nim |
16:39:13 | * | Hideki_ quit (Ping timeout: 264 seconds) |
16:56:55 | * | zahary joined #nim |
17:03:32 | * | zahary quit (Quit: Leaving.) |
17:06:58 | * | Trustable joined #nim |
17:08:26 | * | Hideki_ joined #nim |
17:08:33 | * | lopofsky joined #nim |
17:17:58 | FromGitter | <Kvothe87> hi, can i ask for some simple help? |
17:18:19 | FromGitter | <Kvothe87> i want read a csv and convert to a json format but i have some issues |
17:18:21 | FromGitter | <Kvothe87> https://play.nim-lang.org/#ix=2evu |
17:18:37 | FromGitter | <Kvothe87> example of what i'm trying and what i am trying to obtain |
17:20:55 | * | Hideki_ quit (Ping timeout: 246 seconds) |
17:22:34 | * | actuallybatman quit (Ping timeout: 256 seconds) |
17:23:13 | * | thomasross quit (Ping timeout: 256 seconds) |
17:25:17 | FromGitter | <alehander92> why dont we detect |
17:25:28 | FromGitter | <alehander92> exportc for same names with different signatures |
17:25:36 | FromGitter | <alehander92> probably the c compiler error is good enough? |
17:28:00 | leorize | well when you `{.exportc.}` you basically tell the compiler: I know what I'm doing |
17:31:14 | * | nsf quit (Quit: WeeChat 2.7) |
17:35:20 | leorize | Kvothe87: here you go: https://play.nim-lang.org/#ix=2evF |
17:35:52 | leorize | I swapped to stringstreams because your version wouldn't run on the playground |
17:42:54 | * | Trustable quit (Remote host closed the connection) |
17:44:50 | * | Trustable joined #nim |
17:48:53 | disruptek | #13065 |
17:48:54 | disbot | https://github.com/nim-lang/Nim/pull/13065 -- 3Better C++ based exception handling |
17:48:58 | disruptek | any eta? |
18:01:25 | * | jjido joined #nim |
18:05:54 | * | jjido quit (Client Quit) |
18:07:21 | * | ptdel joined #nim |
18:14:11 | * | Vladar quit (Quit: Leaving) |
18:14:47 | Araq | disruptek, found more failing tests with it |
18:14:50 | Araq | however |
18:15:00 | Araq | --exceptions:goto does work with 'nim cpp' |
18:15:07 | disruptek | ah, nice! |
18:15:17 | Araq | and should be a good workaround |
18:15:17 | disruptek | it's not default, though, right? |
18:15:22 | Araq | nope |
18:15:30 | Araq | speaking of which |
18:15:44 | Araq | https://github.com/nim-lang/Nim/issues/13668 is a worst case |
18:15:47 | disbot | ➥ goto exceptions bug: an error cannot catch by except. ; snippet at 12https://play.nim-lang.org/#ix=2evQ |
18:15:59 | Araq | I'm rewriting the implementation yet again, rather unsuccessfully |
18:16:31 | Araq | turns out that 'getCurrentException' is hard to support :-( |
18:16:47 | disruptek | oh dear. |
18:17:39 | disruptek | why does that break? |
18:17:58 | Araq | conflicting code generation requirements |
18:18:56 | Araq | for the simple case I have workarounds... |
18:22:22 | disruptek | i hate that i require defer. |
18:23:22 | * | thomasross joined #nim |
18:23:27 | * | thomasross quit (Remote host closed the connection) |
18:28:45 | FromGitter | <dumjyl> can https://github.com/nim-lang/Nim/pull/13567 be merged or should I make another PR without the unrelated changes? |
18:28:46 | disbot | ➥ Add nnkMacroDef to RoutineNodes in macros.nim. |
18:29:25 | Araq | please create a fresh PR that only touches macros.nim |
18:30:13 | * | cyraxjoe joined #nim |
18:32:38 | * | MightyJoe quit (Ping timeout: 268 seconds) |
18:36:16 | * | natrys quit (Quit: natrys) |
18:39:31 | Yardanico | there's a guy in telegram asking if nim has something in stdlib to truncate a float to some decimal points, like -0.0980000 to -0.09 |
18:39:40 | FromGitter | <Kvothe87> @leorize thank you |
18:39:43 | Yardanico | right now he uses formatFloat with parseFloat |
18:39:57 | Yardanico | parseFloat(num.formatFloat...) |
18:39:58 | disruptek | strformat |
18:39:59 | Araq | strformat can also do it iirc |
18:40:10 | Yardanico | well, he doesn't want to print it out |
18:40:15 | Yardanico | he wants to truncate it as a "float" type :P |
18:40:23 | disruptek | that's not a thing. |
18:40:34 | leorize | yep that's not a thing |
18:40:36 | Araq | exactly |
18:40:54 | Araq | there is round() though and friends |
18:41:09 | leorize | tell him that if he want precision, floating point isn't the right thing to use |
18:41:47 | dom96 | !eval echo(("0.0980000")[0 .. 4]) |
18:41:49 | NimBot | 0.098 |
18:41:54 | dom96 | :P |
18:42:06 | Yardanico | yeah he does something like that |
18:42:12 | Yardanico | return parseFloat(i.formatFloat(ffDecimal, dec_acc+1)[0..^dec_acc]) |
18:42:23 | Araq | tell him it's fine |
18:42:25 | leorize | I'm scared :P |
18:42:30 | Araq | hmm |
18:42:39 | Araq | oh well |
18:42:54 | clyybber | floats are overused and misunderstood |
18:44:13 | FromGitter | <matrixbot> `BarrOff` Could someone please take a look at https://github.com/nim-lang/Nim/issues/13675 ? I would really appreciate opinions and guess it is low hanging fruit. |
18:44:15 | disbot | ➥ nimcall not passable to closure parameter ; snippet at 12https://play.nim-lang.org/#ix=2ew1 |
18:44:52 | leorize | BarrOff: you can join our irc channel at #freenode_#nim:matrix.org |
18:45:41 | Araq | type conversions are not lifted to typeclasses |
18:46:26 | Araq | no bug here and you should use overloading, Nim is not a shitty version of Go |
18:49:05 | Araq | hmm this version is close to working... |
18:58:09 | FromGitter | <matrixbot> `BarrOff` Sure, overloading with two procs solves the problem, but why doesn't it work as I had hoped for? |
18:58:33 | Araq | because type conversions are not lifted to "or types" |
18:59:19 | Araq | I'm not sure it would be sound :P |
19:00:44 | Araq | wooohhooo! got it |
19:00:56 | Araq | man this was a hard one... |
19:00:58 | FromGitter | <matrixbot> `BarrOff` oh, ok. Will look that one up in the documentation. Thank you for the help |
19:01:15 | Araq | probably not covered by the spec :-( |
19:02:13 | clyybber | hehe, --threads:on is broke with --gc:arc and -d:useMalloc |
19:02:55 | Araq | how come? |
19:03:05 | clyybber | /home/clyybber/builds/nim/lib/system/mm/malloc.nim(79, 23) Error: pragmas are only allowed in the header of a proc; redefinition of 'deallocOsPages' from /home/clyybber/builds/nim/lib/system/threads.nim(111, 8) |
19:03:13 | clyybber | Because of this error ^ |
19:03:54 | Araq | so ... I think I got it |
19:04:02 | Araq | the code is also simpler than before |
19:04:45 | clyybber | Araq: What did you solve? |
19:04:54 | clyybber | The exceptions thing? |
19:04:54 | Araq | issue #13668 |
19:04:56 | disbot | https://github.com/nim-lang/Nim/issues/13668 -- 3goto exceptions bug: an error cannot catch by except. ; snippet at 12https://play.nim-lang.org/#ix=2evQ |
19:04:59 | clyybber | Nice |
19:05:09 | Araq | only had to rewrite the implementation once again |
19:05:17 | clyybber | hehe |
19:05:22 | Araq | but now it makes plenty of sense and the code is faster |
19:05:31 | Araq | less junk generated |
19:07:16 | PMunch | Kvothe87, not sure if you're still around: http://ix.io/2ewa |
19:10:50 | * | abm joined #nim |
19:12:07 | Araq | and the optimization is not required anymore either, nice |
19:15:23 | * | NimBot joined #nim |
19:16:06 | leorize | ~matrix is the #nim channel on Matrix can be found at #freenode_#nim:matrix.org |
19:16:06 | disbot | matrix: 11the #nim channel on Matrix can be found at #freenode_#nim:matrix.org |
19:16:16 | * | shadowbane joined #nim |
19:23:07 | clyybber | Araq: That diff is a beauty: 7 adds, 23 dels :D |
19:23:26 | clyybber | Araq: But it can't handle currentException? |
19:25:36 | * | mattmurr quit (Quit: ZNC 1.7.5 - https://znc.in) |
19:28:38 | * | lopofsky quit (Quit: Leaving) |
19:31:21 | * | shadowbane quit (Quit: Konversation terminated!) |
19:36:00 | * | shadowbane joined #nim |
19:36:59 | Araq | yeah I think so as it's part of the intensive tests |
19:37:04 | * | ptdel quit (Ping timeout: 246 seconds) |
19:37:08 | Araq | getting them all to pass is an art... |
19:37:16 | clyybber | Nice |
19:37:44 | * | shadowbane quit (Remote host closed the connection) |
19:37:44 | clyybber | Araq: Btw, regarding the threads:on issue, when is the stub in malloc.nim required? |
19:38:00 | Araq | I dunno, aks Zevv |
19:38:13 | clyybber | Zevv: ping |
19:41:10 | * | shadowbane joined #nim |
19:43:46 | * | ptdel joined #nim |
19:47:30 | FromDiscord | <Simula> does nim have a well-documented easy-to-use gui library? |
19:50:07 | PMunch | Define well-documented |
19:50:25 | * | NimBot joined #nim |
19:50:29 | PMunch | Same for wxWidgets |
19:51:13 | FromDiscord | <Simula> i can write code without having to dig through apis and poorly documented examples |
19:51:37 | PMunch | You might want to check this out: https://matthiashager.com/gui-options-for-nim |
19:52:43 | FromDiscord | <Simula> i checked that out, nothing fits what i need |
19:52:59 | FromDiscord | <Simula> ah well, i'll try and contribute when i can |
19:53:16 | PMunch | I have been saying for years now that I should write a UI toolkit for Nim.. |
19:53:30 | PMunch | So maybe if you wait a couple more years I'll get around to it :P |
19:54:37 | FromDiscord | <Simula> I like what exists now, I just can't figure out how to get it to work for me :/. |
19:54:38 | FromDiscord | <Simula> I like what exists now, I just can't figure out how to get it to work for me :/ |
19:57:28 | PMunch | What is it that you can't figure out? |
20:01:18 | FromDiscord | <Simula> e v e r y t h i n g |
20:01:39 | FromDiscord | <Simula> i'm trying to make an image previewer of sorts. i want to display some image previews in a grid that scrolls along the y axis |
20:02:24 | PMunch | Haha, well everything is a bit hard to explain :P |
20:04:29 | FromDiscord | <Simula> i'm already farther in Qt haha |
20:04:45 | FromDiscord | <Rika> good qt lib when |
20:05:16 | FromDiscord | <Simula> the only good qt lib is for c++ |
20:05:33 | FromDiscord | <Recruit_main707> python? |
20:05:39 | FromDiscord | <Rika> that sucks simula |
20:06:51 | axion | Probably good to contribute to existing efforts, because GUI is one of the most time consuming things you can work on - ask any game developer. |
20:07:35 | axion | THis floated by me recently, a decent start it looks like: https://github.com/johnnovak/koi |
20:07:39 | FromDiscord | <Elegant Beef> i liked nigui but it was a pain |
20:07:44 | FromDiscord | <Elegant Beef> i liked nigui but it is a pain |
20:07:49 | Yardanico | axion: did you usee gintro? |
20:07:53 | FromDiscord | <Rika> but i dont need immediate mode tho |
20:07:59 | Yardanico | IMO it's the only viable option for easy desktop apps in Nim rn :P |
20:08:06 | Yardanico | well, also nimx, but idk :D |
20:09:26 | axion | I'm not really one to "use" any toolkits. I don't even use GUIs really. I use my browser when I have to, and not with the mouse. |
20:13:09 | * | mattmurr joined #nim |
20:15:03 | PMunch | I wrote the genui macros for wxWidgets and Gtk which works pretty well. But I never really used them all that much |
20:15:06 | * | shadowbane quit (Quit: Konversation terminated!) |
20:28:14 | * | chemist69 quit (Ping timeout: 246 seconds) |
20:28:17 | * | bra-ket joined #nim |
20:29:17 | * | chemist69 joined #nim |
20:30:42 | * | zyklon quit (Ping timeout: 256 seconds) |
20:33:46 | * | chemist69 quit (Ping timeout: 246 seconds) |
20:34:09 | * | chemist69 joined #nim |
20:35:01 | * | narimiran quit (Ping timeout: 264 seconds) |
20:39:30 | * | NimBot joined #nim |
20:40:36 | axion | What are some good projects that exemplify writing great documentation, preferably with rich Nim DocGen output? |
20:41:12 | * | zahary joined #nim |
20:43:57 | PMunch | I try to give my projects as good documentation as I can, not sure if that counts.. |
20:46:09 | * | sealmove joined #nim |
20:46:23 | FromGitter | <alehander92> i think all kinds of projects |
20:46:33 | FromGitter | <alehander92> but especially ones which can be educational |
20:46:39 | FromGitter | <alehander92> or which can have many edge cases/gotchas |
20:46:43 | FromGitter | <alehander92> in their implementation |
20:46:55 | * | shadowbane joined #nim |
20:49:15 | * | Zectbumo quit (Remote host closed the connection) |
20:52:28 | axion | Ok thanks. Another question |
20:53:05 | axion | How should you split up newlines when you have a real long type parameter section, and thus parameter list, and you want to stay within 80 columns? |
20:53:37 | axion | The compiler doesn't like the parameter list on a new line after the type parameters |
20:54:20 | disruptek | i split on the pragma and in the parameter list, what else? |
20:54:49 | PMunch | You mean like this? https://github.com/PMunch/macroutils/blob/master/src/macroutils.nim#L990-L994 |
20:55:11 | axion | That's fine and all, but if the type parameters doesn't leave room for the parameters that are expected to be on the same line as the last type parameter line, what to do? |
20:55:40 | PMunch | I don't understand what you mean.. |
20:57:16 | axion | proc foo*[some really\nlong\ntype\parameters](parameters) = discard. Here (parameters) must be next to the ], but there isn't room in 80 columns to do that |
20:57:49 | axion | if i i mean i could do it but the shape of the code looks very bad and painful to read |
20:58:01 | axion | s/if i// |
20:59:06 | PMunch | Do you have a concrete example? |
20:59:37 | axion | Sure, something like: https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 |
20:59:40 | * | Zectbumo joined #nim |
21:00:01 | axion | It reads poorly with the parameter list required to be next to the ] and not easily scanned |
21:01:20 | PMunch | I'd probably end up doing something like this: https://play.nim-lang.org/#ix=2ewT |
21:01:28 | disruptek | ~stream |
21:01:28 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
21:01:33 | disruptek | finishing this pulseaudio tool |
21:01:50 | PMunch | You're writing a pa tool? |
21:02:37 | axion | I was considering something like that or https://play.nim-lang.org/#ix=2ewU but both just equally bad to me. I guess I'll have to get used to it :/ |
21:03:49 | FromDiscord | <Simula> axion: that hurt to read |
21:04:40 | PMunch | Yeah I guess that's another option |
21:07:24 | axion | is nimsuggest what is responsible for reformatting on file save in nim.nvim? |
21:07:59 | PMunch | That might be nim --stylecheck or something like that |
21:08:12 | axion | PMunch: because with your suggestion, it is reformated to make it look like the parameter list is part of the body...even more difficult to read: https://play.nim-lang.org/#ix=2ewX |
21:08:45 | PMunch | Haha, yeah that isn't great.. |
21:09:01 | PMunch | I really wish Nim was a bit more lenient on where it allowed newlines sometimes.. |
21:09:50 | FromGitter | <dumjyl> @Vindaar Your recent changes to ginger are causing CI failures, infinite recursion here: https://github.com/Vindaar/ginger/blob/master/src/ginger.nim#L1779. |
21:09:53 | axion | Yeah I don't know much about the compiler but it would seem to be trivial to allow newlines after a closing delimiter |
21:10:08 | axion | Must be a good reason for not allowing such though...who knows |
21:12:35 | * | abm quit (Quit: Leaving) |
21:18:15 | * | Hideki_ joined #nim |
21:20:05 | FromGitter | <Vindaar> @dumjyl oh crap. I didn't think about the fact that it'd already use the new version for `ggplotnim` |
21:20:17 | FromGitter | <Vindaar> I'll fix it! Thanks for notifying me! |
21:22:55 | krux02 | axion: what do you want to pass to init? |
21:23:01 | * | Hideki_ quit (Ping timeout: 264 seconds) |
21:23:49 | * | tdog quit (Ping timeout: 246 seconds) |
21:24:52 | krux02 | to me it looks like you want to pass a type and a static parameter. |
21:24:52 | FromGitter | <Vindaar> @dumjyl ok, updated. The next time CI runs it should be fine again. Sorry everyone :) |
21:27:09 | axion | krux02: That was just a contrived example to demonstrate the identation issue. |
21:27:46 | clyybber | I guess the issue would be that [] is also used for indexing |
21:28:00 | krux02 | ah, ok |
21:28:24 | clyybber | And the `(` in the next line could be parsed as the beginning of a tuple assignment |
21:28:27 | krux02 | well you have a very unusual combination of arguments there |
21:28:50 | FromGitter | <dumjyl> @Vindaar thanks for the quick response. |
21:30:08 | leorize | axion: nim.nvim have no such feature.... |
21:31:39 | * | dadada quit (Ping timeout: 250 seconds) |
21:32:06 | axion | leorize: Hmm, could be vim-polyglot then or something that reformats code into Nim style on save then |
21:34:36 | krux02 | axion, just a question though. As a (former) lisp programmer, do you use emacs for Nim? |
21:35:06 | * | zahary quit (Quit: Leaving.) |
21:35:42 | axion | I would have expected mentioning nim.nvim and vim-polyglot to answer that |
21:36:04 | FromDiscord | <Rika> lol |
21:36:05 | * | jjido joined #nim |
21:36:32 | krux02 | ok then |
21:36:59 | axion | I fucking hate Emacs. |
21:37:07 | krux02 | interesting. |
21:37:09 | axion | I used it because I had to, but no more. |
21:37:17 | axion | Always loved vim |
21:37:31 | krux02 | well I used both, and I hated both |
21:37:37 | krux02 | now I can use both. |
21:38:18 | krux02 | I started with vim, hated it. Changed to emacs, hated it. Stopped complaining, internally resigned, and then just got along with it. |
21:38:22 | krux02 | Now I like it. |
21:38:27 | axion | I do most of my work remotely, and neovim has true-color support on the terminal and is fast, so shrug |
21:39:08 | krux02 | well, neovim is certainly good. But I am hoping that someday sombody comes to me on my lonely emacs nim island. |
21:39:39 | leorize | kaushalmodi is a fellow emacs user :P |
21:39:43 | axion | I use Linux for my OS, but thanks anyway |
21:39:51 | * | voltist joined #nim |
21:40:14 | krux02 | I like `vim` as an editor, but I really don't like vimscript. But I do like elisp somehow. That is the most important reason for emacs. |
21:41:49 | axion | Well vimscript is a DSL, it a GP language suitable for writing the OS that is Emacs. It's designed to be concise and to conform to Vim's data structures. |
21:41:50 | krux02 | I hope that someday an experienced emacs guy comes to the Nim world and starts to fix the problems that nim-mode has and that are too hard for mee to fix. |
21:41:57 | disruptek | designing dbus api on-stream |
21:41:59 | axion | it's not a GP language* |
21:42:00 | disruptek | ~stream |
21:42:01 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
21:42:30 | voltist | Could anyone explain to me what TArg is for the Thread object? |
21:42:37 | PMunch | Yes |
21:42:53 | PMunch | TArg is what the thread takes as its startup argument |
21:43:04 | krux02 | What I don't like about vimscript is that I don't understand the anatomy (syntax tree) of vimscript. Everything is just unclear to me, where does a token end? What is a function etc. |
21:43:09 | PMunch | It's only one argument, so if you need to pass more than one thing, use a tuple or an object |
21:43:21 | krux02 | My knowlegde of programming languages does not map to vim. |
21:43:35 | leorize | krux02: it uses a function-endfunction style of syntax |
21:44:24 | axion | I prefer fun-endfun myself, but yeah |
21:44:24 | leorize | everything in vimscript is a vim command |
21:44:32 | voltist | PMunch: So the type accepted by the proc that the Thread executes? |
21:44:43 | krux02 | What I mean was, I once made something into a comment via " |
21:44:47 | voltist | *thread |
21:44:54 | PMunch | voltist, yes. Pretty much |
21:44:58 | krux02 | but then it wasn't really a comment but leaked into a package and then errors occured. |
21:44:59 | leorize | voltist: TArg is a generic type, just like (ie. `T`) |
21:45:09 | krux02 | really weird, I didn't understand |
21:46:08 | PMunch | Normally you define a thread by attaching the {.thread.} pragma to a procedure with one argument. And then you can start that thread by calling "createThread" on a variable that is a Thread with that same argument as it's TArg. |
21:46:13 | PMunch | Like they do in the example |
21:46:31 | krux02 | then there are things that you just copy over from other init script that do things for example, nobody explained to be why I had to put ``call plug#begin('~/.vim/bundle')`` in there |
21:46:59 | leorize | that's because you're using vim-plug :P |
21:47:00 | krux02 | and is the # like accessing a namespace? or is it just a single identifier containing # |
21:47:26 | krux02 | yea I know that it is for vim-plug :P I mean I don't understand what is going on. |
21:47:28 | axion | I suggest reading the book a friend of mine wrote "Learn Vimscript the Hard Way" available for free online |
21:47:32 | leorize | and yea `#` is kinda a namespace |
21:47:35 | * | leorize quit (Quit: WeeChat 2.7.1) |
21:47:39 | voltist | "Error: no generic parameters allowed for Thread". Interesting... |
21:47:44 | krux02 | I just have a simple time to understand emacs lisp, even though that can be tough to understand as well. |
21:48:06 | leorize[m] | axion: that's the book I used to learn vimscript for writing nim.nvim :) |
21:48:26 | axion | Ah yeah I'm friends with the author who is also a Common Lisper. Good book! |
21:49:06 | PMunch | voltist, you seem to be doing something wrong.. |
21:49:08 | rayman22201 | I've been a vim guy for a long time, but just started emacs to check out the "other side". I also do a lot of remote dev, and I'm actually really enjoying it. TRAMPS is pretty F*&king amazing. |
21:49:31 | PMunch | I really want to give kakoune another go |
21:50:05 | leorize[m] | I used emacs for awhile but I don't like how bloated it is |
21:50:08 | leorize[m] | kakoune is a fun editor |
21:50:28 | voltist | PMunch: Indeed |
21:50:33 | krux02 | leorize[m], yea emacs is bloated, but still it starts quickly and that is what matters. |
21:50:41 | leorize[m] | they still don't have proper tab-as-space expansion the last time I checked |
21:50:49 | krux02 | It just doesn't start quickly if you add a lot of bloat on top |
21:50:55 | krux02 | but that is true for emacs as well |
21:51:01 | krux02 | I mean true for vim as well |
21:51:15 | * | leorize joined #nim |
21:51:24 | leorize[m] | took me 30s to have it booted up on a brand new setup :P |
21:51:47 | krux02 | and by now I used too many emacs featurs that I would want to switch back to Vim. |
21:52:21 | rayman22201 | A big reason is, I use windows for work reasons, and I want a sane OS abstraction on top if it. Emacs works pretty good for that purpose. Also, emacs server mode works really well in windows as well. So the startup issue isn't that big of a deal for me. :-P |
21:52:39 | axion | leorize[m]: that's builtin |
21:52:40 | rayman22201 | Emacs still takes up less memory than the freaking slack client I have to keep open on windows lol |
21:52:54 | Demos[m] | IMHO the correct sane OS to use on windows is NT |
21:52:57 | krux02 | lol |
21:53:05 | rayman22201 | lol |
21:53:08 | Demos[m] | NT is sane, very sane, windows not so much |
21:53:16 | voltist | PMunch: I'm using an Object 'ObjectX' as TArg when creating an array of Thread objects |
21:53:26 | krux02 | windows NT doesn't run games. |
21:53:42 | krux02 | :P |
21:53:45 | voltist | var thr: array[0..49, Thread[ObjectX]] |
21:53:50 | Demos[m] | emacs suffers from the "I'm a linux app and I expect CreateProcess to be fast" problem :( |
21:54:22 | clyybber | kakoune is great |
21:54:56 | rayman22201 | Demos[m]. Biggest disadvantage to using emacs on windows. I can live with it for now though :-P |
21:56:04 | krux02 | Demos: that is better than th "I'a a windows app and I expect that you tell me where you installed the c++ compiler is for every project" |
21:56:15 | Araq | what's up with ggplot? broken? |
21:56:51 | FromDiscord | <Rika> more like "i expect this compiler to have specific features the compiler you have doesnt" |
21:57:43 | PMunch | clyybber, yeah I tried it for a while just as I was getting into Vim properly. But it missed some things I had configured my Vim to do, which I no longer use. |
21:58:16 | PMunch | And what is ObjectX, do you have a code snippet? |
21:58:38 | Demos[m] | wait does nim have a ggplot impl? |
21:59:19 | Araq | sure |
21:59:54 | clyybber | and its really great |
21:59:58 | voltist | PMunch: Here is the object https://pastebin.com/q7ZYjEKG |
22:00:15 | federico3 | is treeform around? |
22:00:46 | PMunch | Oh wow, that opened in a different browser from the one I normally use. Is pastebin really that full of adds? |
22:01:24 | clyybber | hastebin is a good bin |
22:01:28 | leorize | I refuse to browse the internet without an adblocker for this exact reason |
22:01:32 | Yardanico | ublock origin blocked google tracking and some shady aj2073.online website for pastebin :P |
22:01:59 | Yardanico | leorize: I have uBlock Origin + AdGuard Home (a blocking dns server similar to pihole but easier to set up) |
22:02:27 | voltist | Yeah I don't notice thanks to my ad blocker |
22:02:50 | leorize | simple-adblock + unbound solves it for me on my router |
22:05:03 | PMunch | voltist, don't know what you were doing but this works fine: http://ix.io/2exd |
22:05:17 | PMunch | leorize, yeah my normal browser obviously has an ad blocker |
22:05:25 | PMunch | clyybber, ix.io is the best one IMO |
22:06:01 | leorize | and 0x0.st for sharing pictures |
22:06:26 | PMunch | I just use my own server for that.. |
22:07:07 | leorize | that's quite a luxury to me |
22:07:36 | PMunch | Everyone should have their own server :( |
22:08:22 | leorize | too expensive :( |
22:08:35 | FromGitter | <Vindaar> @Araq I broke something by updating ginger (backend) and introducing a bug. It should be fixed now |
22:09:34 | PMunch | leorize, yeah I know it can be expensive.. |
22:09:56 | PMunch | I guess I'm lucky, I even have a static IP at home so worst case scenario I could set up my server here |
22:10:08 | voltist | PMunch: Ah, it's because my proc has "var Worm". Would there be a thread-safe way to modify the object? |
22:11:15 | PMunch | Uhm, probably not.. |
22:11:29 | PMunch | Well, I mean you could add a Lock to the object |
22:14:30 | voltist | Ok, I'll have a look into that |
22:15:09 | PMunch | Oh well, time for bed |
22:15:10 | * | PMunch quit (Quit: leaving) |
22:15:38 | Araq | Vindaar: do you use --gc:arc ? |
22:17:52 | FromGitter | <Vindaar> @Araq: nope, not yet. PMunch's persvector doesn't yet support it, afair |
22:18:09 | Araq | ok so I can merge https://github.com/nim-lang/Nim/pull/13677 then |
22:18:10 | disbot | ➥ rewritten goto based exception handling; much cleaner implementation;… |
22:18:56 | FromGitter | <Vindaar> yeah, if `ggplotnim` was the only failing package, it should be safe. Was a stupid bug on my part |
22:20:50 | * | couven92 quit (Read error: Connection reset by peer) |
22:21:34 | * | solitudesf quit (Ping timeout: 246 seconds) |
22:24:22 | Araq | yeah the others were green |
22:25:51 | FromGitter | <Vindaar> ah good. I'll be off to bed now. Good night everyone! |
22:27:23 | FromGitter | <zetashift> gnight |
22:33:40 | * | zahary joined #nim |
22:37:32 | axion | If I define a constant locally in a proc, is that okay? Will it really not have global scope, and is it idiomatic to do this? |
22:39:53 | leorize | axion: yes, it won't have global scope, and it's an idiomatic thing |
22:40:04 | axion | great thanks |
22:41:32 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:42:33 | * | jjido joined #nim |
22:50:14 | Yardanico | damn our discord server has 781 members :P most of them are inactive though |
22:53:23 | * | voltist quit (Quit: Leaving) |
22:55:28 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:56:28 | * | jjido joined #nim |
23:03:01 | Yardanico | What does <//> mean in the source code? https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/collections/lists.nim#L102 |
23:03:15 | Yardanico | https://nim-lang.org/docs/lists.html#SinglyLinkedList one of the types has parens and the other doesn't, but they're the same type |
23:04:02 | * | rmt joined #nim |
23:08:18 | * | silvernode-mobil quit (Ping timeout: 256 seconds) |
23:08:41 | * | ftsf joined #nim |
23:11:00 | FromGitter | <dumjyl> It is the `owned` operator for `--newruntime`. It was supposed to be removed but idk what happened: https://github.com/nim-lang/Nim/pull/11145 |
23:11:02 | disbot | ➥ introduce temporary <//> for 'owned' to get this compile with 0.19 |
23:15:50 | * | luis_ joined #nim |
23:17:16 | * | Trustable quit (Remote host closed the connection) |
23:17:34 | luis_ | Hi everyone, hope you all safe and healty... is there a quick way to check whether a website is on using nim? |
23:18:14 | luis_ | I have been using something like: https://i.imgur.com/Y60yVp0.png |
23:18:53 | luis_ | Or is there a quicker way? |
23:19:54 | FromDiscord | <Rika> send a head request maybe idk |
23:32:37 | * | zahary quit (Quit: Leaving.) |
23:32:52 | * | zahary joined #nim |
23:33:24 | * | zahary quit (Client Quit) |
23:38:00 | * | silvernode-mobil joined #nim |
23:39:25 | * | actuallybatman joined #nim |
23:42:19 | * | zedeus quit (Read error: Connection reset by peer) |
23:42:23 | jjido | Mmh. Looking at my chan log. It is 2020, and the Vim-Emacs argument is *still* not settled. LOL |
23:47:37 | * | silvernode-mobil quit (Ping timeout: 264 seconds) |
23:47:40 | * | zedeus joined #nim |
23:48:12 | FromDiscord | <exelotl> *laughs in normie text editors* |
23:48:16 | * | lritter quit (Quit: Leaving) |
23:49:19 | jjido | exelotl what do you use for nim? |
23:50:03 | FromDiscord | <exelotl> I use vs code but I've also been trying textadept for some things |
23:50:34 | jjido | vs code is capable |
23:51:09 | FromDiscord | <Skaruts> how do I move an item in a seq to another position in the seq? |
23:52:12 | FromDiscord | <exelotl> I don't like how bloated vscode can be, but it's comfortable and well designed, I can always get stuff done in it |
23:52:22 | leorize | Nim-wise, vscode and neovim provides the best integration :P |
23:53:20 | FromDiscord | <Rika> huh when was vscode bloated |
23:53:46 | leorize | when it was born :) |
23:54:08 | FromDiscord | <exelotl> when you have a lot of extensions and several windows open |
23:54:27 | FromDiscord | <exelotl> it uses a lot of ram |
23:54:39 | FromDiscord | <exelotl> as is the nature of most electron apps |
23:56:50 | * | luis_ quit (Ping timeout: 246 seconds) |
23:58:16 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:58:30 | * | tane quit (Quit: Leaving) |
23:59:19 | FromDiscord | <exelotl> @Skaruts huh i don't see anything for it in the standard library. Simple solution would be s.delete(i) s.insert(item, j) |
23:59:46 | FromDiscord | <exelotl> but I guess if you wanted the most efficient solution you'd have to write your own procedure |