<< 27-05-2020 >>

00:00:38*dadada__ joined #nim
00:00:51*ftsf joined #nim
00:04:20*konvertex quit (Ping timeout: 272 seconds)
00:08:58*zacharycarter quit (Ping timeout: 260 seconds)
00:11:50Prestigeo/
00:12:12*avatarfighter quit (Quit: Leaving)
00:17:14*fredrikhr quit (Ping timeout: 256 seconds)
00:18:19FromDiscord<Elegant Beef> Does seq.setLen change the capacity?
00:18:32FromDiscord<Elegant Beef> And hello 😄
00:19:05PrestigeI believe so, even though it can be expanded again as you add elements
00:24:44*dadada__ quit (Ping timeout: 265 seconds)
00:25:23bung_it almost like js .length
00:26:35*sz0 quit (Quit: Connection closed for inactivity)
00:30:36*dadada joined #nim
00:31:02*dadada is now known as Guest44913
00:41:31Prestige@Elegant Beef I have struts being properly allocated for docks now
00:41:45Prestigelooks like polybar is pretty limited though, almost wish I had just written my own bar
00:42:43FromDiscord<Elegant Beef> Lol
00:42:54FromDiscord<Elegant Beef> Next thing is the nimdow status bar?
00:43:55Prestigewell one of the two last things before the beta release. Status bar, and actual floating window support
00:44:06PrestigeEverything else seems to be handled
00:44:19FromDiscord<Elegant Beef> better have super + rmb for resizing floating
00:44:20FromDiscord<Elegant Beef> 😄
00:44:30PrestigeYeah, and lmb for moving
00:45:07Prestigeand I might center floating windows by default.. they seem to anchor with x as 0 for some reason
00:46:38Prestigehttps://0x0.st/ipkb.png <- have polybar on both monitors but it doesn't really support workspaces well, and doesn't support tags at all
00:54:19*Guest44913 quit (Ping timeout: 246 seconds)
00:54:34*lritter quit (Ping timeout: 256 seconds)
00:55:03*lritter joined #nim
01:00:41*dadada__ joined #nim
01:10:13*Tongir joined #nim
01:13:22*Tlanger quit (Ping timeout: 272 seconds)
01:18:43*opal quit (Ping timeout: 240 seconds)
01:21:53*chemist69 quit (Ping timeout: 272 seconds)
01:23:20*chemist69 joined #nim
01:24:46*dadada__ quit (Ping timeout: 272 seconds)
01:26:49*endragor joined #nim
01:30:37*dadada joined #nim
01:31:02*dadada is now known as Guest46778
01:34:09*opal joined #nim
01:42:52*nphg1 joined #nim
01:45:18*nphg quit (Ping timeout: 258 seconds)
01:47:56FromDiscord<Technisha Circuit> How would i make a pragma that calls whatever proc it's assigned to
01:48:21FromDiscord<Technisha Circuit> (edit) 'How would i make a pragma that calls whatever proc it's assigned to ... ' => 'How would i make a pragma that calls whatever proc it's assigned towhenever something happens (like the on_message event for Dimscord)'
01:48:54FromDiscord<Technisha Circuit> And how would i get the name of the proc that has the specific pragma?
01:52:21FromDiscord<Rika> A pragma is just a macro that takes a proc nimnode isn't it
01:52:30FromDiscord<Rika> The name is in the nimnode
01:53:17FromDiscord<Rika> With that, you might be able to figure out the first problem by yourself, but if not, then I can't help because I'm about to pass out
01:53:46FromDiscord<Technisha Circuit> Oki :P
01:53:49FromDiscord<Technisha Circuit> Go to sleep
01:54:10*Guest46778 quit (Ping timeout: 246 seconds)
02:00:37*dadada__ joined #nim
02:17:33FromGitter<DylanModesitt> How would I go about implementing an "unpacking" macro like pythons `f(*args)` or `apply` in lisp that can handle functions both returning void and a type. Is there a type for the union[any, void]? I can do
02:17:39FromGitter<DylanModesitt> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdcdc3b101510b201c79e6]
02:18:08FromGitter<DylanModesitt> or void / no `: auto` or even generic in return type `T`.
02:18:19FromGitter<DylanModesitt> Consider the example: `let green: tuple[r, g, b, a: uint8] = (0.uint8, 255.uint8, 0.uint8, 0.uint8)`
02:20:12FromGitter<DylanModesitt> and wanting to apply unpacking to both ⏎ ⏎ ```proc foo(r, g, b, a: uint8): string = $g``` [https://gitter.im/nim-lang/Nim?at=5ecdce5c4c9b0f060d272454]
02:20:30FromGitter<DylanModesitt> It seems that the macro needs to be overloaded w.r.t the return type
02:21:02FromDiscord<Elegant Beef> I must be daft cause i dont know what you're asking
02:21:55FromGitter<DylanModesitt> Yeah ok - fair that was probably pretty unclear
02:23:02FromGitter<DylanModesitt> Say I wanted a macro `unpack` that could do the following:
02:23:07FromGitter<DylanModesitt> ```proc foo(r, g, b, a: uint8): string = $g ⏎ let a = unpack(foo, green) ⏎ echo a``` [https://gitter.im/nim-lang/Nim?at=5ecdcf0bf0b8a2053ab699e7]
02:23:37FromGitter<DylanModesitt> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdcf29ff7a920a7213c4fa]
02:23:58FromGitter<DylanModesitt> I can use the macro I wrote above to do that just fine
02:24:06*dadada__ quit (Ping timeout: 256 seconds)
02:25:06FromGitter<DylanModesitt> However, If I have a function `bar` that returns `void`. like so:
02:25:20FromGitter<DylanModesitt> ```proc bar(r, g, b, a: uint8) = echo g ⏎ let a = unpack(bar, green)``` [https://gitter.im/nim-lang/Nim?at=5ecdcf8fa91f120a6cc59801]
02:25:35FromGitter<DylanModesitt> The compiler will complain because the expression has no type
02:26:46FromDiscord<Elegant Beef> Sorry im now just at "why?" especially at the `# a is now "255"`
02:27:04FromDiscord<Elegant Beef> oh
02:27:22FromDiscord<Elegant Beef> i was thinking you wanted to change the value in the tuple a to "255"
02:27:44FromGitter<DylanModesitt> oh no I was saying that example works with my macro - but fails in the case of `bar`
02:28:16FromDiscord<Elegant Beef> Well if you dont return something what do you expect?
02:29:06FromGitter<DylanModesitt> No I understand why it does not work for functions like `bar` and `foo` both - but Is there a way I can. It would make sense that you could make a macro like this IMO. The only thing I can think of is this:
02:30:29FromDiscord<Rika> @DylanModesitt there's a module called unpack
02:30:37*muffindrake quit (Ping timeout: 260 seconds)
02:30:41*dadada joined #nim
02:30:44FromDiscord<Rika> Nimble module of course
02:31:05*dadada is now known as Guest26400
02:31:55FromDiscord<Elegant Beef> You example doesnt really make sense for a unpack macro
02:31:59FromDiscord<Elegant Beef> (edit) 'You' => 'Your'
02:32:24*muffindrake joined #nim
02:32:43FromGitter<DylanModesitt> sorry but how come? Say instead of bar it was to do an in place fill on an image or something - I feel like unpacking with the same macro makes sense
02:33:10FromDiscord<Elegant Beef> Well your first example had no reason for a macro 😄
02:33:29FromDiscord<Rika> Please read my response T_T
02:34:41FromDiscord<Elegant Beef> You're asking about unpacking a proc with no return type, so unless you check if the proc has a echo, and then read the std out after it, i have 0 clue how you'd unpack that
02:35:15FromDiscord<Elegant Beef> But i do attest im a numpty
02:35:22FromDiscord<Technisha Circuit> How do i cross compile on Nim?
02:35:24FromDiscord<Technisha Circuit> Nvm
02:35:30FromDiscord<Rika> He means to unpack the tuple to the arts of the proc
02:35:35FromDiscord<Rika> Args
02:35:37FromDiscord<Elegant Beef> ah
02:35:59FromGitter<DylanModesitt> Yeah - sorry maybe unpack is a bad word here - It looks like the unpack module does more of the python `a, b = (1, 2)`
02:36:00FromDiscord<Elegant Beef> Need to make better examples to explain yourself imo 😄
02:36:15FromGitter<DylanModesitt> I want more of the `f(*(1,2))`
02:36:22FromGitter<DylanModesitt> ah im sorry :(
02:37:03FromDiscord<Rika> Dylan: make a proc that takes in a tuple, then use the python style unpacking (actually can be done without the unpack module if it's a tuple), and supply args to the original proc
02:38:26FromGitter<DylanModesitt> Rika that seems like a good practical thing to do - this is all rather silly but I am wondering if there fundamentally is any way to make this macro
02:38:26FromDiscord<Elegant Beef> So much for sleep rike, eh?
02:38:53FromDiscord<Technisha Circuit> Is there a library that makes crosscompiling easy as `compile fileName --os:win --arch:amd64`?
02:38:59FromDiscord<Rika> Something like ``` proc foo(t: tuple[r, g, b, a: uint8]):string = let (r, g, b, a) = t; foo(r, g, b, a)``` or so
02:39:18FromDiscord<Technisha Circuit> Or at least a way I don't have to mess around with the compiler
02:39:25FromDiscord<Elegant Beef> the nim compiler already does
02:39:27FromDiscord<Rika> Yeah it's macroable dylan
02:39:29FromDiscord<Technisha Circuit> Because that's hard to do on Termux
02:39:32FromDiscord<Technisha Circuit> O
02:39:34FromDiscord<Rika> Just can't elaborate how since macro
02:39:40FromGitter<DylanModesitt> I want the nim equivalent of the following python code ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdd2ec27513a72fbb5a308]
02:39:57FromDiscord<Elegant Beef> You can make a nimble package also to do the compiling for different platforms
02:40:09FromDiscord<Elegant Beef> (edit) removed 'a' | 'package' => 'tasks'
02:40:12FromDiscord<Rika> Dylan: I can't elaborate since I'm on the phone and I'm not Technicae
02:40:23FromDiscord<Rika> Cough cough @Technisha Circuit
02:40:31FromDiscord<Elegant Beef> Lol
02:40:38FromDiscord<Elegant Beef> Guy programs on his phone
02:40:48FromDiscord<Elegant Beef> Can android even get a mingw compiler?
02:40:51FromDiscord<Rika> Mr "I program on my phone more than my pc"
02:40:57FromDiscord<Rika> Black fucking magic I say
02:41:04FromGitter<DylanModesitt> Right now, The macro I gave above works for cases of `bar`. I can choose to make it work for cases `foo` by changing to return type of `unpack` to void (or leaving it out) - but I want the macro to work for both just because I feel like that is reasonable.
02:41:32FromDiscord<Technisha Circuit> > Dylan: I can't elaborate since I'm on the phone and I'm not Technicae↵hahaha
02:41:41FromGitter<DylanModesitt> This is not a super practical problem
02:41:48FromDiscord<Technisha Circuit> It's not that bad XD
02:41:58FromDiscord<Rika> Sure it isn't
02:42:19FromDiscord<Rika> Maybe I'll be even more insane than you by compiling on ios
02:42:35FromDiscord<Technisha Circuit> Ios sucks
02:42:39FromDiscord<Technisha Circuit> But it is doable
02:42:53FromDiscord<Technisha Circuit> With an app called `iSH`
02:44:17FromDiscord<Technisha Circuit> And my friend ***Cough Cough*** *@codic ↵* ***Cough Cough*** just SSHed into his ipad without iSH or other similar tools and actually managed to compile Ruby
02:44:56FromDiscord<Technisha Circuit> (edit) '*@codic ↵*' => '*@codic*'
02:45:01FromDiscord<Rika> Man i don't want to intentionally need to shoot myself in the foot and end up blasting my head off
02:45:08FromDiscord<Technisha Circuit> Hahahaha
02:45:32FromDiscord<codic> Wut
02:45:36FromDiscord<Technisha Circuit> He's here XD
02:45:38FromDiscord<codic> It has a built in `sh`
02:45:46FromDiscord<codic> Some really old version but it works
02:45:48FromDiscord<Technisha Circuit> So does android
02:45:51FromDiscord<Technisha Circuit> :P
02:45:54FromDiscord<codic> Yeah of course
02:46:00FromGitter<kaushalmodi> @DylanModesitt https://play.nim-lang.org/#ix=2nsg
02:46:08FromDiscord<Rika> @Dylan: so what I think you can do is to make a macro that takes in a proc (a pragma) which constructs a second proc for the tuole
02:46:08FromDiscord<Technisha Circuit> So how did you compile Ruby anyway?
02:46:12FromGitter<kaushalmodi> here's one way to interpret your Python code
02:46:21FromDiscord<codic> like this:
02:46:30FromDiscord<codic> wait
02:46:47FromDiscord<codic> https://www.ruby-lang.org/en/documentation/installation/#building-from-source
02:46:48FromDiscord<codic> :p
02:46:54FromDiscord<Technisha Circuit> I wonder if i could switch to my android's built-in shell
02:46:59FromDiscord<Technisha Circuit> Wait
02:47:02FromDiscord<codic> Well
02:47:05FromDiscord<codic> That was what I originally tried
02:47:07FromDiscord<Technisha Circuit> Gcc was installed?
02:47:07FromDiscord<codic> But failed
02:47:12FromGitter<DylanModesitt> @kaushalmodi ah sorry - no I am totally cool with that
02:47:18FromGitter<DylanModesitt> I mean how to do it in the unpacking sense
02:47:19FromDiscord<Technisha Circuit> (edit) 'I wonder if i could switch to my android's built-in shell ... ' => 'I wonder if i could switch to my android's built-in shellwithout root'
02:47:26FromDiscord<codic> Also @Technisha Circuit #offtopic
02:47:29FromGitter<DylanModesitt> Imagine I was not the author of foo and bar - I am not looking for a direct translation
02:47:40FromDiscord<Elegant Beef> Yall people coding on your phones need jesus
02:47:58*arecaceae quit (Read error: Connection reset by peer)
02:48:35FromDiscord<Elegant Beef> I've got it, in any library i make im going to check if it's running on mobile, and if so quit with no error message
02:48:42FromDiscord<Rika> Dylan, manually unpack the tuple I assume
02:49:20FromGitter<kaushalmodi> @DylanModesitt I needed to scroll up a bit more.. I didn't understand the problem statement
02:49:21FromGitter<DylanModesitt> Ok - so that is all. One can not write this macro to support functions both of return type `void` and `any`?
02:49:47FromDiscord<Rika> Beef: why not run `rm .`?
02:50:12FromDiscord<Rika> Dylan, I don't see why return types matter
02:52:02FromGitter<DylanModesitt> Because you get compile errors with the macro - you can only choose one or the other
02:52:05FromGitter<DylanModesitt> I.e
02:52:16FromGitter<DylanModesitt> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdd5e027513a72fbb5a85f]
02:52:16FromDiscord<Rika> I mean
02:52:29FromDiscord<Rika> Why would it matter in the context
02:52:40FromGitter<DylanModesitt> Or
02:52:56FromGitter<DylanModesitt> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdd608225dc25f54aa46e8]
02:53:24*arecaceae joined #nim
02:53:40FromDiscord<Rika> Man i would test this code if I coult
02:53:42FromGitter<DylanModesitt> So that the macro can be general?. It seems bad if it only works for functions with non-void and it seems extra silly to nly work with functions for void. The examples of `foo` and `bar` *are not real*
02:54:12FromDiscord<Rika> But I can't ssh into my desktop right now and I would rather torture than code on my phone
02:54:25FromGitter<DylanModesitt> Rika it sounds like your phone programming skills need to get up to par with @Technisha - though I have just met you both 😉
02:54:38*Guest26400 quit (Ping timeout: 260 seconds)
02:54:40FromDiscord<Rika> It's not that I'm incapsble
02:54:46FromDiscord<Rika> It's that I'm unwilling
02:55:32FromGitter<DylanModesitt> Hahaha sure then I mean your willingness for typing on a 3inch wide screen should clearly increase
02:56:05FromGitter<DylanModesitt> Ill keep poking around on it - its not like this is preventing me from doing anything real. It is more just a question of can you do something like this (which the answer to is probably yes).
02:56:52FromDiscord<Rika> Know that you can print how the code looks with result.repr
02:57:03FromDiscord<Rika> And the ast with treeRepr
02:57:29FromGitter<DylanModesitt> yeah
02:57:53FromGitter<DylanModesitt> mean I can make it work either way just fine - I used `treeRepr` while writing this. I just can not get it to work for *both at the same time*
02:57:58FromDiscord<Technisha Circuit> Hahahaha
02:58:13FromDiscord<Technisha Circuit> Come onnnn, coding on mobile isn't thaaaaat bad
02:58:48FromGitter<DylanModesitt> its p crazy to me that you're willing to do that @Technisha
02:58:55FromDiscord<Technisha Circuit> Hahaha
02:59:00FromGitter<DylanModesitt> I get the romance of the idea of it
02:59:01bung_I create a server ,using .close close client, then I re-run client, client cant receive data?
02:59:12FromDiscord<Technisha Circuit> I started coding on mobile because i had no PC at the time
02:59:34FromDiscord<Technisha Circuit> And the advantage of me starting on my phone is that it's easy for me to do so
02:59:36FromGitter<DylanModesitt> I use ios (I know - filth) and have some ssh scripts set up with siri shortcuts and that was fun. But actually writing large programs seems so bad
02:59:49FromDiscord<Technisha Circuit> Oof
02:59:51FromDiscord<Technisha Circuit> Well
02:59:52FromGitter<DylanModesitt> @Technisha dont get me wrong its pretty baller
03:00:08FromDiscord<Technisha Circuit> I've written some big discord bots (that I've gave up on)
03:00:11FromDiscord<Technisha Circuit> Soooo
03:00:24FromDiscord<Rika> I made my ssh to desktop pretty stupidly hard to do on my phone
03:00:40*dadada__ joined #nim
03:00:49FromDiscord<Technisha Circuit> sent a code paste, see http://ix.io/2nsk
03:00:53FromDiscord<Technisha Circuit> That was written on android
03:01:07FromDiscord<Technisha Circuit> > I made my ssh to desktop pretty stupidly hard to do on my phone↵how?
03:01:13FromDiscord<Rika> I was thinking "hmm, this doesn't look like nim code"
03:01:23FromDiscord<Technisha Circuit> Yeah that's Python :P
03:01:29FromDiscord<Rika> Technisha: port knocking
03:01:35FromDiscord<Technisha Circuit> ?
03:01:39FromDiscord<Technisha Circuit> Wdym?
03:02:02FromDiscord<Rika> I have to send packets to certain ports in a certain order to open the ssh port 22
03:02:12FromDiscord<Technisha Circuit> Oo
03:02:26FromDiscord<Technisha Circuit> That seems like a good security method tbh
03:02:29FromDiscord<Rika> I installed it to test it out before I put it on my vps
03:02:36FromDiscord<Rika> Forgot to undo it
03:02:39FromDiscord<Technisha Circuit> Oof
03:03:23FromGitter<DylanModesitt> was this to prevent you from programming on your phone as a personal thing or for some security by obscurity thing @Rika
03:03:49FromDiscord<Rika> Security by obscurity
03:03:55FromDiscord<Rika> It was for testing out
03:03:58FromDiscord<Rika> As I said above
03:04:03FromDiscord<Technisha Circuit> It's a good security method imo
03:04:05FromDiscord<Rika> Not meant to stay on my desktop
03:04:09FromDiscord<Technisha Circuit> How would i do it XD
03:04:19FromDiscord<Technisha Circuit> (edit) 'How would i do it ... XD' => 'How would i do itfor my phone?'
03:04:28FromDiscord<Rika> Tech: if combined with other security methods sure
03:04:37FromDiscord<Rika> Tech, go fuck yourself lmaooo
03:04:43FromDiscord<Technisha Circuit> Hahahaha
03:04:45FromDiscord<Rika> (check out knocks)
03:04:49FromDiscord<Rika> Knockd**
03:04:58FromDiscord<Rika> On github too afaik
03:04:58FromDiscord<Technisha Circuit> I'll probably use some stupid way to do it via a webserver
03:05:03FromGitter<DylanModesitt> yo guys im mad dumb
03:05:05FromDiscord<Technisha Circuit> Ooo
03:05:07FromGitter<DylanModesitt> This works fine
03:05:10FromDiscord<Technisha Circuit> What's up?
03:05:13FromDiscord<Technisha Circuit> Oof
03:05:29FromDiscord<Rika> Was wondering how it didn't work but I brushed it off as "Nim being weird"
03:05:35FromGitter<DylanModesitt> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ecdd8feff7a920a7213d93f]
03:05:42FromDiscord<Rika> Mmm
03:05:44FromDiscord<Technisha Circuit> https://github.com/jvinet/knock this?
03:05:48FromGitter<DylanModesitt> It was because I kept experimenting with `auto` and `any`
03:05:48FromDiscord<Rika> Yes
03:06:00FromGitter<DylanModesitt> and did not try my experiment together
03:06:23FromGitter<DylanModesitt> although it is obviously that `auto` should work and `any` should not
03:06:34FromGitter<DylanModesitt> ugh - sorry folks
03:06:51FromGitter<DylanModesitt> mad dumb question from the getgo
03:06:53FromDiscord<Technisha Circuit> Time to recreate this in the most stupid way possible-
03:07:56*rockcavera quit (Remote host closed the connection)
03:07:59FromDiscord<Technisha Circuit> How would i make it so even if a port isn't open, it'll respond to a certain key/number?
03:08:17FromDiscord<Technisha Circuit> Without upnp either
03:10:48FromDiscord<Rika> Have fun.
03:11:51FromDiscord<Technisha Circuit> Haha
03:12:01FromDiscord<Technisha Circuit> I will (not) :P
03:12:20FromDiscord<Technisha Circuit> Wait, is there a Nim library for upnp?
03:23:23*chemist69 quit (Remote host closed the connection)
03:23:45*chemist69 joined #nim
03:24:24*dadada__ quit (Ping timeout: 256 seconds)
03:29:25*muffindrake quit (Quit: muffindrake)
03:30:43*dadada joined #nim
03:31:06*dadada is now known as Guest94880
03:43:35FromDiscord<Zed> how do you clear a sequence?↵so i have a sequence called tokens
03:43:50FromDiscord<Zed> `var tokens: seq[syntaxObj]`
03:44:47FromDiscord<Zed> but when running `tokens.setLen(0)` to clear the sequence i'm getting an error that it's a type mismatch?
03:45:06FromGitter<kaushalmodi> `tokens = @[]`?
03:46:13FromDiscord<Zed> yeah that worked, and the fact that my dumb ass but it with the wrong indentation
03:47:18*waleee-cl quit (Quit: Connection closed for inactivity)
03:49:13FromDiscord<codic> What is the invalid character constant here? `stdout.styledWrite(fgGreen, " \__/")↵`
03:49:27disruptek\_
03:49:41disruptekuse \\_
03:52:23FromDiscord<codic> Can I use hex codes for styledWrite?
03:52:27FromDiscord<codic> With trueclor perhaps
03:53:01FromDiscord<Technisha Circuit> I also need to know this :P
03:53:54*Guest94880 quit (Ping timeout: 240 seconds)
03:54:12FromDiscord<Technisha Circuit> Aaa
03:54:18FromDiscord<Technisha Circuit> Nothing is loading
03:54:21FromDiscord<Technisha Circuit> Oh it works now
03:56:32FromDiscord<Zed> story of my life
03:56:37FromDiscord<Technisha Circuit> Haha
04:00:40*dadada__ joined #nim
04:01:36*muffindrake joined #nim
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:41*supakeen joined #nim
04:12:16*bunbunbunbunny joined #nim
04:12:19bunbunbunbunnyjoin #python
04:22:15*zacharycarter joined #nim
04:24:18*dadada__ quit (Ping timeout: 256 seconds)
04:29:23FromDiscord<dayl1ght> how can I split a string using another string (not a char) as a separator?
04:30:19FromDiscord<dayl1ght> oh, the split in strutils already does that
04:30:40*dadada joined #nim
04:31:04*dadada is now known as Guest673
04:52:09*kungtotte quit (Read error: Connection reset by peer)
04:52:38*gangstacat quit (Quit: Ĝis!)
04:53:41*kungtotte joined #nim
04:54:16*Guest673 quit (Ping timeout: 256 seconds)
04:55:09*gangstacat joined #nim
04:55:17voltist`Error: undeclared identifier: 'expr'` strange...
05:00:36*dadada__ joined #nim
05:03:44voltistOh, the code is just *super* old
05:05:13FromDiscord<Stuffe> When iterating over enum values, does anyone know if there is a way to only get the valid entries?
05:05:19FromDiscord<Stuffe> Here is an example of what I mean: https://play.nim-lang.org/#ix=2nsw
05:08:25skrylar[m]Zevv: "old 2020 nim" but.. five months isn't that old o__o
05:08:44disruptekpepperidge farm remembers.
05:11:21*nekits quit (Read error: Connection reset by peer)
05:12:06*solitudesf joined #nim
05:13:12*nekits joined #nim
05:23:54*dadada__ quit (Ping timeout: 240 seconds)
05:30:40*dadada joined #nim
05:31:03*dadada is now known as Guest4342
05:40:28skrylar[m]well average attention span is sub-goldfish, so i guess 5 months is old now
05:40:52skrylar[m]people look at me like a mutant when ir emember something they told me 3 days earlier
05:43:06*dddddd quit (Ping timeout: 260 seconds)
05:46:18voltistshashlick: Thoughts on this error with Nimterop? https://pastebin.com/GLmugEQ5
05:46:42voltistI'm not 100% sure you are the nimterop person but I remember so :)
05:54:34*Guest4342 quit (Ping timeout: 272 seconds)
05:56:36*bebarker joined #nim
06:00:04*bbarker quit (Ping timeout: 256 seconds)
06:00:38*dadada__ joined #nim
06:09:49livcdthis is such a bad experience...nim formatter stuck in vscode...cant save a file......
06:10:31*tdc joined #nim
06:11:32skrylar[m]turn it off? :doesn't use the formatter :S:
06:12:58*PMunch joined #nim
06:13:46*zacharycarter quit (Quit: Lost terminal)
06:22:53*lritter quit (Ping timeout: 265 seconds)
06:24:01*dadada__ quit (Ping timeout: 246 seconds)
06:26:11*NimBot joined #nim
06:30:38*dadada joined #nim
06:31:03*dadada is now known as Guest15874
06:37:06Zevvskrylar[m]: yeah, but this is the *new* nim, right?
06:38:11skrylar[m]Zevv: the only 'new' nim i know about is like, newruntime+arc o_O
06:38:27ZevvYou missed some context of my msg I guess :)
06:38:37skrylar[m]apparently.
06:38:51ZevvI hacked the Nim parser to parse this: http://ix.io/2n99
06:39:01skrylar[m]egads.
06:40:32skrylar[m]mostly just been working on money projects this week. and tinkering the tesselator here and there. looked in to defold for a bit and it seems very godot-esque, aside from requiring proprietary software to do skeleton anims xD
06:51:43PMunchZevv, you added brackets to Nim? :P
06:52:10*bunbunbunbunny quit (Quit: leaving)
06:54:13*liblq-dev joined #nim
06:54:38*Guest15874 quit (Ping timeout: 256 seconds)
06:54:43FromDiscord<Elegant Beef> Zevv forgot semicolons
06:55:04FromDiscord<Elegant Beef> Gotta get rid of the significant white space, and then nim can attract more popel
06:55:08FromDiscord<Elegant Beef> (edit) 'popel' => 'people'
07:00:40*dadada__ joined #nim
07:06:45*bung_ quit (Quit: Lost terminal)
07:09:49*Tlanger joined #nim
07:11:11PMunch@Elegant Beef, you can already use semicolons in regular Nim
07:12:17*Tongir quit (Ping timeout: 258 seconds)
07:16:57skrylar[m]eeh the complaitns about whitespace are almost always noise
07:17:08skrylar[m]its like complaints about parens in lisp
07:17:18skrylar[m]the real reason they dont want to use it is because there isn't a superwinner already using it
07:18:12*neceve joined #nim
07:18:33skrylar[m]was pondering about lock-free queues but i'm not sure its worth the effort. some of these "lock-free" things really just spinlock until their counter works like they want, which isn't really different from just using a read/write lock
07:21:55skrylar[m]if its already gonna spinlock, i don't see why not just use the lock test and set http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
07:22:03skrylar[m]and a circular buffer
07:23:07*leorize quit (Remote host closed the connection)
07:23:37*leorize joined #nim
07:23:40FromDiscord<Elegant Beef> I know pmunch
07:23:43FromDiscord<Elegant Beef> That's why i said forgot
07:24:06*dadada__ quit (Ping timeout: 256 seconds)
07:24:48*bung joined #nim
07:26:30*sz0 joined #nim
07:27:50skrylar[m]well. good night.
07:30:43*dadada joined #nim
07:31:06*dadada is now known as Guest45807
07:37:41ZevvPMunch: sure, it's soo broken as it is now
07:42:38*bung quit (Quit: Lost terminal)
07:44:10PMunchHmm, I just realised that there are multiple cache modules in the package manager already...
07:44:16PMunchHow did I not see these earlier..
07:44:27FromDiscord<Doongjohn> > When iterating over enum values, does anyone know if there is a way to only get the valid entries?↵@Stuffe https://github.com/nim-lang/Nim/pull/14008
07:44:28disbotenummaps: library based generalized typesafe enum with holes ; snippet at 12https://play.nim-lang.org/#ix=2iER
07:44:32PMunchNow the question becomes, what do I call mine?
07:45:06*Senny joined #nim
07:47:45ZevvThe Munchinator!
07:48:41PMunchHaha
07:48:42ZevvWith a name like that I would call *all* of projects The Munchinater and just give them sequence numbers.
07:48:46PMunchMuncache
07:49:39FromDiscord<dayl1ght> sent a code paste, see http://ix.io/2nsS
07:49:48FromDiscord<dayl1ght> Can I do this with templates in nim or does it require emacros?
07:50:39FromDiscord<dayl1ght> Oh sorry, I forgot that code blocks don't work in IRC, here's a paste: https://ghostbin.co/paste/7esxz
07:51:03PMunch@daylight, it's actually fixed now :)
07:51:15PMunchYardanicos new bot automatically creates links from code pastes
07:51:19FromDiscord<dayl1ght> nice!
07:51:37PMunchAnd the problem was never that they didn't work, just that they were super spammy
07:53:19PMunchSomething like this? https://play.nim-lang.org/#ix=2nsV
07:53:39PMunchOh, and with the getA and getB of course, didn't know what they were :P
07:54:32*Guest45807 quit (Ping timeout: 256 seconds)
07:55:12PMunchIs there a way to detect that "invalid data" condition: https://play.nim-lang.org/#ix=2nsY =
07:57:48FromDiscord<dayl1ght> oh, that was simpler than I thought, thanks @PMunch
07:57:57FromDiscord<dayl1ght> is there a way to do it with infix syntax inside the template?
08:00:44*dadada__ joined #nim
08:01:46PMunch@dayl1ght, not sure, don't think so. But why would you want to?
08:02:00PMunchNim has universal call syntax so they are the same :P
08:04:06FromDiscord<dayl1ght> just curious 😛 I guess I was mostly wondering if nim had "dumb" macros like c where code is simply copy pasted
08:06:28PMunchNot unless you really force it to
08:06:34PMunchNim tries to not be dumb
08:07:50*Tlanger quit (Remote host closed the connection)
08:08:14*Tlanger joined #nim
08:13:35FromDiscord<Stuffe> @Doongjohn thanks for the link. i will keep an eye out for the fix
08:18:59*konvertex joined #nim
08:20:06*anti[m] quit (*.net *.split)
08:20:09*Northstrider[m] quit (*.net *.split)
08:23:02*vqrs quit (Ping timeout: 264 seconds)
08:23:52*bung joined #nim
08:24:30*dadada__ quit (Ping timeout: 256 seconds)
08:25:07*vqrs joined #nim
08:26:09bungwhat's the recommand way check server ready for connect?
08:26:49*Northstrider[m] joined #nim
08:27:54FromDiscord<Elegant Beef> Typically a handshake is done
08:28:34*anti[m] joined #nim
08:30:42*dadada joined #nim
08:31:06*dadada is now known as Guest18637
08:31:12FromDiscord<Elegant Beef> And in some systems it gets a cringey name like a hug and kiss
08:35:45bunghandshake muanually ? not seen it list in document
08:36:10bungcurrently I use a loop with limit number
08:40:57skrylar[m]well if its a very advanced system there's usually a secondary health check server
08:41:23skrylar[m]but otherwise attempting the connection is fine, though you might want exponential backoff
08:42:56skrylar[m]but most of the time those health check servers are just running a ping, so that's what they're doing anyway
08:48:28FromDiscord<Elegant Beef> I do have to note my experience with servers is purely in small game dev scenarios where you want information from the server if a connection is met 😄
08:49:52FromDiscord<Elegant Beef> So the client typically sends a name and their customization, then the server responds with the server settings and both are merry
08:54:14*Tongir joined #nim
08:57:13*Tlanger quit (Ping timeout: 264 seconds)
09:18:57*liblq-dev quit (Quit: WeeChat 2.8)
09:19:46*Vladar joined #nim
09:30:32*letto quit (Quit: Konversation terminated!)
09:31:20*letto joined #nim
09:58:56*kenran joined #nim
10:00:52*bung quit (Ping timeout: 265 seconds)
10:02:54*Trustable joined #nim
10:14:38*Senny quit (Ping timeout: 260 seconds)
10:30:02*bung joined #nim
10:31:27*Senny joined #nim
10:34:17*bung quit (Ping timeout: 246 seconds)
10:40:29*Senny quit (Ping timeout: 272 seconds)
10:46:03*fredrikhr joined #nim
10:51:09*monokrom joined #nim
10:52:39FromDiscord<Zed> How do you assign nil to a variable?
10:54:22*Guest18637 quit (Ping timeout: 260 seconds)
10:55:26PrestigeI think only ptrs can be nil, but what are you trying to do @Zed?
10:55:28FromDiscord<Zed> im trying to implement some blockchain, but when creating the base block there is no previous hash so the value should be nil for that prevHash variable
10:55:50PrestigeYou can use an Option[T] and set it to none(T) to start
10:56:27FromDiscord<Zed> do you have a rough example?
10:57:06PMunchchainHead = none(BlockType)
10:57:38PMunchBut I guess the type for your block is a ref object? Those should be able to be nil..
10:57:53Prestigehttps://play.nim-lang.org/#ix=2nto @Zed
10:59:11PMunchHow long have you been using Nim now Prestige?
10:59:12*Tongir quit (Ping timeout: 256 seconds)
10:59:25PrestigeHmm I think it's been over a month now?
10:59:54Prestigestarted about mid april
11:00:21PMunchIt's cool to see how fast you've become acquainted with the stdlib and proficient in Nim
11:00:42FromDiscord<Zed> PMunch: my blocks just an object, i only what the prevHash variable to be able to be nilled, swift had a neat feature where you could add '?' and it was automatically nil
11:00:42PrestigeThanks :) I'm loving the language
11:01:08PMunchZed, that's what you would do with Options in Nim
11:02:30FromDiscord<Zed> i cant find anything about them in the nim manual
11:02:52PMunchhttps://nim-lang.org/docs/options.html
11:03:06PMunchIt's a module in the standard library
11:03:18FromDiscord<Zed> Thanks 🙂
11:03:25PMunchSee also my optionsutils module
11:04:16PrestigePMunch: I'm pretty certain I never want to touch xlib again though, I'll need a different type of project next.. lol
11:04:16FromDiscord<Zed> checking it out now
11:04:52PMunchPrestige, haha xlib is a bit clunky to work with :P
11:06:03PMunchI've wanted to look into XCB and also Wayland, but I started with xlib as it appeared to be the easiest and it had a nice step by step guide to create a WM :P
11:07:43PrestigeI'm having issues figuring out how to handle a few weird applications (just wine applications right now), been a pain
11:08:19PMunchYup..
11:08:33PMunchThere are always some weird applications that does something different
11:10:03*Kaivo joined #nim
11:10:32*dadada joined #nim
11:10:55*dadada is now known as Guest33830
11:12:31*bung joined #nim
11:13:00*letto quit (Quit: Konversation terminated!)
11:14:00FromDiscord<Zed> PMunch: How do you assign a value to an optional?
11:14:11PMunchsome(myValue)
11:14:47PMunchOr myValue.option like Prestige did in their example
11:14:55*letto joined #nim
11:15:29FromDiscord<Zed> Why doesn't '=' work with them?
11:15:49PMunchBecause Option[T] != T
11:15:55PMunchThey are two different types
11:16:21FromDiscord<Zed> ah ok
11:16:29PMunchYou could also write `converter toOpt[T](x: T): Option[T] = option(x)` to allow Nim to automatically convert things to options
11:17:34*bung quit (Ping timeout: 240 seconds)
11:17:45PMunch@Zed, so you can have this: https://play.nim-lang.org/#ix=2ntx
11:18:36FromGitter<matrixbot> `sheerluck` converter makes typesystem weak :(
11:19:19FromDiscord<Zed> I think im going to have to read up on the nim docs a bit this weekend
11:20:09PMunch@sheerluck, converter makes some things easier to type :P
11:20:19PMunchOptions in Nim are IMO really annoying to work with..
11:21:10FromDiscord<Zed> What's the difference between a `converter` and a normal `proc`
11:21:11PMunchIf you don't use optionsutils and possibly a converter
11:21:24FromGitter<sheerluck> Explicit is better than implicit.
11:22:16PMunchWell, it this case it's just a matter of if we have a value or not "x = 100" is pretty explicitly setting a value for x.
11:23:47PMunchWhen using Options to determine if a variable has a value or not it all makes sense with "var x: Option[int]" not having a value and "x = 100" having one.
11:24:49FromDiscord<Zed> hmmm....i'll have to do some testing with this
11:27:11*Trustable quit (Remote host closed the connection)
11:28:39*filcuc joined #nim
11:30:25*gangstacat quit (Quit: Ĝis!)
11:30:49*krux02 joined #nim
11:34:09PMunch@Zed, let us know if you need help :)
11:36:47*gangstacat joined #nim
11:40:16PrestigePMunch: Is this a known limitation or am I calling this incorrectly? https://play.nim-lang.org/#ix=2ntE
11:42:27PMunchKnown limitation, but there is a way around it
11:42:32PMunchGive me a sec
11:45:27PMunchThere we go: https://play.nim-lang.org/#ix=2ntH
11:45:52Prestigeoh that was not what I was expecting to be the fix lol
11:46:09PrestigeThanks :)
11:46:43PMunchYeah, it's a feature that not a lot of people know about I think :P
11:47:01PrestigeAlso I found out polybar isn't going to work for my wm because I'm using tags instead of workspaces so I'm going to be writing my own bar... soonish. But I need to get some sleep
11:47:25PMunchHmm, why does that make it not work?
11:47:33FromDiscord<Zed> do you have a link to your wm?
11:48:24Prestigehttps://github.com/avahe-kellenberger/nimdow
11:48:30PMunchTBH it should be displayed a bit more prominently in the generics section of the manual, currently it's only in the "Method call syntax" chapter and not in the generics chapter: https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
11:48:31PrestigeStill in progress but works pretty well
11:48:40PMunchMine is still semi-closed source
11:48:48FromDiscord<Zed> looks good!
11:49:08PrestigePMunch: polybar doesn't allow displaying multiple "workspaces" as active at the same time, which is essentially what tags are
11:49:12PrestigeThanks @Zed
11:49:39PMunchThey're no really active at the same time though are they?
11:50:00PrestigeFor a tag system they are
11:50:16PMunchLike with my multi-head setup only the workspace with the active window is regarded as active, even though three workspaces are currently shown to me
11:50:20PrestigeI haven't handled that functionality in my wm yet though
11:50:57PrestigeI mean I can view windows from multiple tags on the same monitor at the same time
11:51:13PMunchDo you have anything written about tag vs. workspace based WMs by the way? I remember you telling me the difference but I've forgotten :P
11:51:29PMunchAh right..
11:51:51PrestigeI should do a write-up about it.. I think there's a YouTube vid I could link or maybe dwm's page talks about it
11:51:58PMunchBut still though, you can still tell polybar that only the tag with the active window in it is the active one..
11:52:14PMunchI'm not quite sure what polybar wants to use this information for though..
11:52:46PrestigeOh I did write about it
11:52:52Prestigehttps://blog.avahe.tk/posts/nimdow/part1/ at the bottom
11:55:53*filcuc quit (Quit: Konversation terminated!)
11:56:44FromDiscord<Zed> Prestige: Why did you decide to write a wm?
11:56:46PMunchOh neat, didn't know you were writing things as well
11:57:12PMunch@Zed, why not? :P
11:57:26Prestige@Zed window managers were failing me in different ways so I decided to pick up a new language and make one
11:58:03PrestigeAfter I figure out how to manage all the weird windows and write a status bar, it should be smooth sailing
11:58:10PMunchIt's the old slippery slope of being able to do anything
11:58:28PrestigeOkay I'm off for now I'm dead tired, ttyl o/
11:58:34PMunchBye
11:58:46FromDiscord<Zed> fair enough, yup and then you get analysis paralysis because you can do anything
11:58:49PMunchI don't know how many hours I've spent customising my setup and writing various small programs to make it behave the way I want
11:59:03*noonien joined #nim
11:59:32PMunchI mean when I get PiMo done I can have an Arch install with PiMo and pakku, that's a solid Nim based OS :P
12:00:01PMunchIf only I rewrote xlunch in Nim.. But for that I'd need Imlib2 wrappers..
12:01:52FromDiscord<Synth> Hello, is it possible to use asnyc procedures that have return type?
12:02:05PMunchUhm, yes?
12:04:15FromDiscord<Synth> How so? When I try, I keep getting erros
12:04:54PMunchWhat kind of errors?
12:05:02PMunchAre you following any kind of examples/tutorial?
12:05:16*rockcavera joined #nim
12:05:38FromDiscord<Synth> ```nim↵implementation of 'test()' expected↵```
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:23PMunchAnd code?
12:06:38*supakeen joined #nim
12:07:10FromDiscord<Synth> ```nim↵proc test*() {.async.}: string =↵ return "test"↵```
12:07:52FromDiscord<Synth> When I remove the return type string though, the error goes away
12:08:13PMunchAh, that is because you have the async pragma in the wrong place
12:08:42FromDiscord<Synth> Oh?
12:08:52PMunchPragmas for procs go after the return type
12:08:58FromDiscord<Synth> Ohh?
12:09:11PMunchThis should work: `proc test*(): string {.async.} =`
12:09:26PMunchWell, it should get rid of that error
12:09:40PMunchYou probably have to define your return type as Future[string]
12:09:56FromDiscord<Synth> Now I'm getting: `template/generic instantiation of `async` from here`
12:10:07FromDiscord<Synth> (edit) '`async`' => '\`async\`'
12:10:10PMunchThat is not the error
12:10:17FromDiscord<Synth> (edit) '\`async\`' => 'async'
12:10:27FromDiscord<Synth> Oh?
12:10:28PMunchThat is just a hint telling you that another error in your program comes from that place
12:10:35FromDiscord<Synth> I see
12:10:54FromDiscord<Synth> And when I call the procedure, I have to do it by `asyncCheck` right?
12:11:00FromDiscord<Synth> (edit) 'And when I call the procedure, I have to do it by `asyncCheck` ... right?' => 'And when I call the procedure, I have to do it by `asyncCheck`followed by the proc'
12:11:47PMunchWell, asyncCheck is the same as discard for a regular proc (it will attach a callback that checks if it throws an error and rethrow that exception).
12:12:15FromDiscord<Synth> Hmm okay
12:12:32FromDiscord<Synth> Am I able to convert the return type of `Future[string]` into a string?
12:12:42PMunchIf you actually want to get the string return value you'd need `await` if you are in an async context or `waitFor` if you're in a synchronous scope.
12:12:44FromDiscord<Synth> I'm sorry for being such a noob
12:12:55FromDiscord<Synth> Ohh alright
12:12:55PMunchNo worries, most people struggle with async
12:13:34FromDiscord<Synth> So it'd be like: `await test()` right?
12:13:41PMunchYes
12:13:46PMunchThat would return a string
12:13:50FromDiscord<Synth> Mhmm
12:13:52FromDiscord<Synth> Thank you!
12:14:04PMunchBut it requires that you are in an async context
12:14:06ZevvI made async wihthout async the other day - any proc can yield. I should see if I can make that beyoud proof-of-concept.
12:14:31PMunchAsync without async?
12:14:41FromDiscord<Synth> expression 'await test()` has no type (or is ambiguous)
12:14:45FromDiscord<Synth> (edit) 'test()`' => 'test()''
12:14:49FromDiscord<Synth> (edit) 'expression' => '`expression' | 'ambiguous)' => 'ambiguous)`'
12:14:53FromDiscord<Synth> Now I'm gtting this ;-;
12:15:02PMunchCode?
12:15:17FromDiscord<Synth> https://discordapp.com/channels/371759389889003530/371759389889003532/715174254395785276
12:15:19Zevvpmunch: ucontext hack; I'm looking for ways to get Lua coro semantics.
12:15:32FromDiscord<Synth> With the fixed syntaas
12:15:33FromDiscord<Synth> (edit) 'syntaas' => 'syntax'
12:15:34Zevvbut typing makes it hard as well
12:15:45PMunchZevv: Hmm, I know some of those words :P
12:16:19ZevvI never have to sit on my hands before I type when telling you stuff, so dont pretend now
12:16:28PMunchSynth, are you able to share a paste? Or just paste into Discord (this creates a paste automatically now)
12:16:33FromDiscord<Synth> ```nim↵proc test*(): Future[string] {.async.} =↵ return "test"↵```
12:18:06PMunchZevv, wait, you're using Linux' ucontext switching to implement "async"?
12:18:22PMunchThat.. Might actually work..
12:19:16PMunchSynth, not quite sure what your issue is: https://play.nim-lang.org/#ix=2ntS
12:20:05FromDiscord<Synth> Ohh alright, that's weird
12:20:20FromDiscord<Synth> It fixed
12:20:26FromDiscord<Synth> I wasn't using `waitFor`
12:20:32FromDiscord<Synth> I was using `await test()`
12:20:38FromDiscord<dom96> Zevv: you are aware of the Nim coro module right?
12:21:03Zevvsure, but it schedules "wrong"
12:21:26PMunchNim has a coro module?
12:21:33PMunchMan, I'm OOTL on this stuff..
12:21:42shashlick@voltist cPlugin is a standalone Nim program - it needs its own `import strutils`
12:21:42Zevvyeah, but it's discouraged I believe
12:21:58ZevvIt's basically some glue logic over fibers/longjmp/ucontext
12:22:15PMunchI played around with being able to yield to a specific coroutine a while ago: https://github.com/PMunch/nim-coroutines/blob/master/examples/example.nim
12:23:23PMunchNothing as complicated/fancy as ucontext, just uses the same kind of approach that asyncdispatch uses
12:23:29FromDiscord<Recruit_main707> any references for installing vim plugins in windows??
12:23:35PMunchSo procedures are turned into closure iterators
12:23:48Zevvyeah, I started with that. But then you keep this problem.
12:23:53PMunch@Recruit_main707, maybe ask in #vim ? :P
12:24:07PMunchWhat problem?
12:24:12ZevvIt took me a while to realize that my problem with async is that you need to go async all the way.
12:24:17PMunchYeah..
12:24:22PMunchWell, you can call waitFor..
12:24:38Zevvyeah, but you can't yield from everywhere
12:24:55FromDiscord<dom96> coroutines need async all the way too
12:25:20PMunchWhat would a yield do if you weren't in an async context?
12:25:36Zevvthrow an exception I guess :)
12:25:56*Guest33830 quit (Ping timeout: 246 seconds)
12:26:07Zevvbut for example, I can make a closure proc that yields something and pass that as callback to something else
12:26:16Zevvwith coro based, that would work. A proc is just a proc.
12:26:53ZevvThere's always one active context, so if you yield(), the current context swaps with the one activating or "resuming" that context
12:27:19ZevvThat's the way Lua does it. Somehow Lua coros come so natural to me, I use them a *lot* and almost never need to think deep about what I'm doing.
12:27:41ZevvBut with async something is harder, often things dont "fit", but I have a hard time to define even for myself what the exact problem is
12:28:18Zevvbut of course the price you pay for having multiple C stacks/contexts is high. It's so not portable and confuses things. Stack traces get nasty, etc
12:28:21FromDiscord<dom96> can you give examples of the problems?
12:28:42ZevvI think I need to do a writeup of that one day. Like I said, it's hard to figure out for myself even.
12:29:37ZevvAlso the fact that iterators arent reentrant sometimes bites me
12:29:38*abm joined #nim
12:30:07FromDiscord<Technisha Circuit> Did you know that in python a boolean is just a subclass of an int?
12:30:07FromDiscord<Technisha Circuit> 1 == True and 0 == False basically
12:30:10Zevvanother also is the way Lua resume/yield pass data two ways
12:30:38*dadada joined #nim
12:30:42FromDiscord<dom96> iterators might not be reentrant, but async procs effectively are AFAIK
12:30:59Zevvmakes sense
12:31:00PMunchHmm, what if a {.coroutine.} proc would return a Future[T] that held not only room for the return type, but also the closure iterator. That way calling it would just give you a Future no matter where you are, but if you did await on it then await would be the one that registers the iterator?
12:31:00FromDiscord<Technisha Circuit> Wait....
12:31:03*dadada is now known as Guest94415
12:31:50PMunchOr something like that..
12:32:01ZevvPMunch: that needs to sink in a bit here :)
12:32:04FromDiscord<Technisha Circuit> Thank god you can't do true + true in Nin
12:32:07FromDiscord<Technisha Circuit> (edit) 'Nin' => 'Nim'
12:32:12PMunchAnyways, gotta go
12:32:15*PMunch quit (Quit: leaving)
12:32:17ZevvCiao!
12:32:31Zevvechnisha Circuit: Well, if you *want* to do that, you could
12:32:37Zevvproc `+`(a, b: bool) = ...
12:32:57FromDiscord<Technisha Circuit> Oh god
12:33:06FromDiscord<Technisha Circuit> Please no
12:33:14FromDiscord<Technisha Circuit> ;-;
12:40:00*endragor quit (Remote host closed the connection)
12:40:56FromDiscord<Rika> you say "PLEASE NO" to + for bools but "sure" for programming on a phone
12:40:57FromDiscord<Rika> yes
12:42:03FromDiscord<Zed> well priorities
12:43:12*endragor joined #nim
12:43:33*endragor quit (Remote host closed the connection)
12:47:33FromDiscord<Technisha Circuit> Hahahaha
12:47:54FromDiscord<Technisha Circuit> So you want me to start adding bools together?
12:52:59Zevvsure, why not. Anything Python can do, Nim can do better
12:56:28alehander92cant we have
12:56:30FromDiscord<Zed> i will admit, one thing nim doesn't have at the moment is libraries, tutorials and users
12:56:32alehander92int64 sets
12:56:41alehander92or only hashset?
12:57:16FromDiscord<Technisha Circuit> That's true
12:57:48FromDiscord<Chiqqum_Ngbata> I haven't seen much shortage in libraries, but rather applications using Nim
12:58:02FromDiscord<Technisha Circuit> Yeah
12:58:33FromDiscord<Zed> true that
12:58:59ZevvZed: what tutorials are missing you think
12:59:11Zevvhttps://nim-lang.org/learn.html
12:59:29FromDiscord<Rika> int64 sets would need 2^64 bytes would it not? alehander92
12:59:44FromDiscord<Rika> a hashset would work better for int64s
12:59:55alehander92sorry yes
12:59:56FromDiscord<Technisha Circuit> Is it better to compile to C or ObjC?
13:00:01alehander92i wondered if i can compile
13:00:08alehander92hashsets to {} in javascripts
13:00:49*bung joined #nim
13:01:37FromDiscord<Rika> technisha: what kinda question is that?
13:01:45FromDiscord<Technisha Circuit> No idea
13:01:51FromDiscord<Rika> objc is the least worked on for nim afaik
13:01:56FromDiscord<Technisha Circuit> Oh okay
13:03:32FromDiscord<Zed> Zevv: general purpose usage,writing quick scripts to parse large files, all of those python tutorials but implemented in nim. Maybe a game tutorial, see a lot of them implemented in python↵Mostly things that get things done for the user to see and use
13:04:07ZevvAh right
13:04:12ZevvWell, type away! :)
13:04:35FromDiscord<Zed> lmao, i have to get a good grasp on the language first 😛
13:05:12alehander92hmm
13:05:38*bung quit (Ping timeout: 256 seconds)
13:05:42*dddddd joined #nim
13:50:23*cgfuh joined #nim
14:11:04*dcmertens joined #nim
14:11:45dcmertensHello all, I have an idea about centralizing and/or synopsizing information about scientific packages for nim
14:11:51dcmertensthis is based in part on the discussion here: https://forum.nim-lang.org/t/5242
14:12:07dcmertensIs there a github organization for scientific developments in nim?
14:12:24Araqdcmertens: welcome, please wait until mratsim replies
14:12:31dcmertensAraq, thanks
14:14:08*kenran quit (Quit: leaving)
14:14:38dcmertenson a separate note, how do I view a package's documentation? I tried "nim doc ggplotnim", but no luck
14:14:49dcmertenswait...
14:14:53dcmertensI may not have it installed
14:15:00Araq'nim doc -r x' will work in 1.x
14:17:10dcmertensfalse alarm, I had installed it on another machine but not my laptop. Sorry about that
14:24:22*FromDiscord quit (Remote host closed the connection)
14:24:38*FromDiscord joined #nim
14:31:40dcmertensI can create a simple figure using ggplotnim, but "nim doc -r ggplotnim" gives the error "cannot open 'ggplotnim.nim'"
14:31:47dcmertensthoughts?
14:32:17dcmertens(I gotta run for now, but I'll check back later)
14:32:19*dcmertens quit (Quit: Leaving)
14:35:11*MortS joined #nim
14:39:05MortSDumb question time. I declared a object with no body as a placeholder. And later forgot, and created a non-empty seq of them.
14:39:33FromDiscord<Yardanico> That's totally okay, you can have empty objects
14:39:44MortSAnd ended up getting memory corruption, with --gc:arc at least.
14:40:07FromDiscord<Rika> :thonk:
14:40:09FromDiscord<Yardanico> https://github.com/github/linguist/pull/4866 https://github.com/github/linguist/pull/4871 argh Dafny got it before us
14:40:12disbotRevert "Change Nim's colour to better match the logo" ; snippet at 12https://play.nim-lang.org/#ix=2nuH
14:40:18MortSAhh, I was unsure if that was allowed. I got suspicious when my debugging pointed out the sizeof(Thing) was 0.
14:40:19FromDiscord<Yardanico> Will need to find a new colour
14:41:11MortSI should probably open a defect then if that's allowed. Thanks Yardanico.
14:41:11FromDiscord<Rika> or maybe not
14:41:19FromDiscord<Rika> honestly i like the color now
14:41:29FromDiscord<Rika> its closer to C's color than jS's right now\
14:44:55FromDiscord<Yardanico> @MortS do you have a code sample?
14:45:03FromDiscord<Yardanico> I can test on devel
14:55:32MortSyes, here. I'm on devel as well. https://gist.github.com/MortimerSnerd/a30c6f163e11e3c523b9259bc21e50e5
14:56:26livcdthank go!
14:56:29livcdgod*
14:56:31MortSOn my system malloc will assert if you compile with --gc:arc and -d:useMalloc
14:57:07MortSBut some earlier permutations of this ran, and only showed bad reads with valgrind.
14:58:46Araqinteresting bug
15:00:03Araqplease report it on github
15:02:22MortSOk, thanks all.
15:07:39*waleee-cl joined #nim
15:14:06FromGitter<mratsim> @dcmertens: https://github.com/scinim
15:14:34*ftsf quit (Ping timeout: 240 seconds)
15:22:58disruptek~stream
15:22:59disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek
15:23:04disrupteklaunch party, baby
15:27:14*Kaivo quit (Ping timeout: 246 seconds)
15:29:50*Kaivo joined #nim
15:34:35*opDispatch is now known as B4s1l3
15:34:36*B4s1l3 is now known as opDispatch
15:44:09*letto quit (Quit: Konversation terminated!)
15:45:36*bung joined #nim
15:46:01*letto joined #nim
15:50:14*bung quit (Ping timeout: 260 seconds)
15:53:18*liblq-dev joined #nim
15:58:04ZevvBah, it's all touch screen in these modern space pods these days. I like the 60s interiors much better.
15:58:17disruptekmee too.
15:58:22disruptekgimme tactile feedback.
15:58:39Zevvand if it crashes in your back yard, you got tons of nice stuff to recover.
15:59:47alehander92i thouight
15:59:58alehander92the guys just sit and wait there looking to the screen
16:00:04alehander92for like 5 minutes
16:00:06alehander92earlier
16:00:11alehander92it seemed a bit boring
16:00:42alehander92i thought it might be weird to wait for your launch being just livestreamed like that
16:00:57alehander92it took me so much time to notice they dont move and the unnatural hand gesture
16:01:26Zevvthese are patient people, there is no telling
16:02:15alehander92no wonder i am not in the space program
16:02:33alehander92i remember thinking for a few days in a previous life-analysing period
16:02:46alehander92"maybe i can just join spacex"
16:03:12alehander92before realizing i am not actually a bald eagle or any other kind of us born resident
16:03:48alehander92i guess disruptek can join the space force
16:03:59alehander92but they might not let him until he changes his nick
16:07:57*casaca quit (Quit: leaving)
16:08:07*MortS quit (Quit: leaving)
16:14:45*tane joined #nim
16:15:20*casaca joined #nim
16:17:27*MortS joined #nim
16:22:59*dcmertens joined #nim
16:27:45dcmertensReturning to one of my previous questions, I am looking for a place that synopsizes the currently available science-related packages.
16:27:58dcmertensI am happy to help build that place if it doesn't exist
16:28:46dcmertensFor example, are there no bindings to the GNU Scientific Library on nimble.directory? I don't see anything
16:29:07dcmertensI can see a few options for plotting
16:29:35dcmertenswhat is out there for matrix handling (I know: arraymancer, but what does that give me and what's missing?)
16:30:02dcmertensDo we have anything for levenburg-marquardt?
16:30:35dcmertensI feel like this should be on a wiki, except that those quickly go stale
16:30:53dcmertensso instead we can just create a github project with a README that discusses all of these things and accepts pull requests
16:31:25*Trustable joined #nim
16:31:41dcmertensOr, I could bring the topic up periodically---every six months?---on the forum so that there is always a reasonably up-to-date discussion of these things that others can refer to
16:35:20FromDiscord<mratsim> "Are we scientists yet"
16:35:32FromDiscord<mratsim> https://github.com/nim-lang/needed-libraries/issues/77
16:35:33disbot[Meta] Are we scientists yet?
16:35:37dcmertensoh yeah, I remember seeing that a while ago
16:36:12*bung joined #nim
16:36:16dcmertensah ha, thanks!
16:39:10FromDiscord<Synth> Hello, is it possible to free memory manually like the `free()` function in C?
16:39:28FromDiscord<Synth> I tried importing segfaults and using `c_free()` but was told it's undeclaired
16:39:58FromDiscord<mratsim> import system/ansi_c
16:40:13FromDiscord<Synth> Oh, thank you!
16:40:30dcmertensmratsim, is the top of that issue regularly updated?
16:40:43FromDiscord<mratsim> I update it when i get a ping
16:40:47FromDiscord<Technisha Circuit> What's the downsides of doing this?
16:40:51FromDiscord<Technisha Circuit> > import system/ansi_c↵@mratsim
16:41:05FromDiscord<Technisha Circuit> Using `c_free`
16:41:08FromDiscord<mratsim> no downsides? just manual memory management like in C
16:41:13FromDiscord<Technisha Circuit> Oki
16:41:18FromDiscord<mratsim> it needs to be allocated with c_malloc
16:41:25FromDiscord<Technisha Circuit> Nice
16:41:58FromDiscord<mratsim> otherwise you can use Nim allocator manually with alloc/dealloc or create/dealloc or allocShared/deallocShared or createShared/freeShared
16:42:10FromDiscord<Synth> How can I parse a variable's pointer into `c_free()`?
16:42:14FromDiscord<mratsim> depending if you want thread-local or global alloc
16:42:22dcmertensmrastim, can you think of any reason that gsl is not on the science discussion? Are these functions available elsewhere?
16:42:31FromDiscord<mratsim> c_free(myVar.addr) if mutable
16:42:39FromDiscord<Synth> I see, thank you!
16:42:45FromDiscord<Synth> How about it it's not mutable?
16:42:48FromDiscord<mratsim> c_free(mylet.unsafeAddr)
16:42:55FromDiscord<Synth> I see, thank you!
16:43:07FromDiscord<mratsim> but if you fre something it should be mutable
16:43:16FromDiscord<mratsim> otherwise you are lying :p
16:43:40FromDiscord<mratsim> @dcmertens, no idea, no one uses it?
16:44:45FromDiscord<mratsim> if you want to do optimization there is nlopt
16:44:55FromDiscord<mratsim> https://github.com/Vindaar/nimnlopt
16:45:24dcmertensAh, nice
16:47:12alehander92Technisha i'd say its still very atypical
16:47:53alehander92and sometimes people do it just because they copy some c pattern
16:47:59alehander92but of course it has valid usages
16:48:23FromDiscord<Synth> sent a code paste, see http://ix.io/2nvv
16:48:32FromDiscord<Synth> I am not exactly sure why...
16:48:39FromDiscord<mratsim> did you allocate the original via c_malloc?
16:48:51FromDiscord<Synth> Ohh I see
16:48:54FromDiscord<Synth> No, I did not...
16:49:09alehander92but again, are you sure
16:49:16alehander92you need to manually malloc/free ?
16:49:26alehander92what is your usecase
16:49:28FromDiscord<Synth> Yes
16:50:00alehander92ok
16:50:04FromDiscord<Synth> I am generating a very huge sequence and my program always crashes due to not enough free memory
16:50:25*gxt__ quit (Remote host closed the connection)
16:50:27alehander92you can also try to call manually `GC_collect`
16:50:36dcmertensSynth: memmap?
16:50:38FromDiscord<mratsim> but that shouldn't be a problem with Nim sequences?
16:50:47alehander92how huge is it
16:50:50FromDiscord<mratsim> no memmap is even lower-level and it's very slow
16:51:09FromDiscord<mratsim> in any case I suggest you wrap your allocator in something like this: https://github.com/mratsim/weave/blob/master/weave/memory/allocs.nim#L47-L57
16:51:12dcmertensmratsim, finishing slowly is better than crashing, perhaps
16:51:17alehander92like, how does malloc/free helps at all? do you create the seq many times and the gc doesnt release the previous one
16:51:32*dcmertens wants to know this ^^ too
16:52:24FromDiscord<mratsim> memmap is very error prone to use, it's easy to get an incorrect program
16:52:30FromDiscord<mratsim> and it only allocated in power of 2
16:52:35FromDiscord<mratsim> allocates*
16:53:31dcmertenssure, but until Synth tells us how much memory is needed, it's hard to know what the problem is, or which tool is best
16:53:47dcmertensBut if Synth needs many gigabytes, then memmap might be the only game in town
16:53:51FromDiscord<mratsim> and create/createU/createShared/createSharedU allows you to do manual memory management with the Nim allocator
16:54:16dcmertensnow, why malloc would be expected to handle this, I cannot say
16:54:19FromDiscord<mratsim> I would be surprised, I can allocates GB of sequences just fine in Arraymancer
16:54:28FromDiscord<mratsim> it's the deterministic free
16:54:40dcmertenswell my laptop has 4GB
16:54:45dcmertens:-P
16:54:56dcmertensSo *I* can't allocate 8GB no matter how good the allocator is!
16:54:57dcmertens:-)
16:55:03FromDiscord<mratsim> but that can be emulated with either --gc:destructors or wrapping seq in a custom types with destructors
16:55:12FromDiscord<mratsim> I have 128GB 😛
16:55:22FromDiscord<Synth> When it's not crashing, the sequence holds 15018570 items
16:55:25FromDiscord<Rika> dcmertens: swap's always an option
16:55:45FromDiscord<mratsim> that's small though
16:55:52FromDiscord<Synth> Hmm...
16:55:56*gxt__ joined #nim
16:56:10FromDiscord<mratsim> how big are the items? int sized or more?
16:56:32FromDiscord<Synth> They're strings
16:56:37FromDiscord<mratsim> ah
16:56:51FromDiscord<mratsim> it's not memory it's fragmentation that is killing you
16:56:59FromDiscord<Synth> oh?
16:57:31FromDiscord<Synth> (edit) 'oh?' => 'h?'
16:57:34FromDiscord<Synth> (edit) 'h?' => 'Oh?'
16:57:44dcmertensRika: I have only had bad experiences with swap. Probably I didn't tune the settings properly, though
16:57:48FromDiscord<mratsim> fragmentation is when you have memory you can allocate but for that you would need to move the unused memory (i;e. defragment) so that you have a big enough contiguous space
16:58:06FromDiscord<Synth> I see
16:58:08alehander92wow is this a discord bot feature Yardanico? amazing
16:58:25FromDiscord<mratsim> the seq holding the strings is not the issue, but the actual strings may be
16:58:26FromDiscord<Rika> alehander: what is?
16:58:36alehander92the `(edit) .. ` stuff
16:58:36FromDiscord<mratsim> some will take 3 bytes, some will take 100 bytes
16:59:02FromDiscord<mratsim> some are deallocated, and then you need say 20 bytes but you only have holes of 10 bytes
16:59:15FromDiscord<mratsim> so you have memory but not a enough contiguous space
16:59:24FromDiscord<mratsim> not enough*
16:59:51alehander92do gc-s do defragmenation somehow
17:00:21FromDiscord<mratsim> copy all and delete the old and it will "defragment"
17:00:34FromDiscord<mratsim> but otherwise fragmentation is a very very hard problem
17:00:57FromDiscord<Synth> > copy all and delete the old and it will "defragment"↵@mratsim What do you mean by this?
17:01:12FromDiscord<mratsim> and the issue is that either you create your own strings with their own allocators, or you workaround by copying when the size reaches a certain limit
17:01:47FromDiscord<mratsim> let myNewCollection = oldCollection
17:01:55FromDiscord<Synth> Oh that's it?
17:01:59alehander92hm it seems memory managers
17:01:59FromDiscord<mratsim> the copy will be done using contiguous memory
17:02:09alehander92seem to group allocations with similar sizes
17:02:15FromDiscord<mratsim> and don't use oldCollection anymore,
17:02:17alehander92so this shouldn't happen as often as it doe
17:02:18dcmertensSynth, what is the problem you are trying to solve that requires that you have a simple *list* of strings?
17:02:25alehander92but with 15 mln probably this is not enough
17:02:49FromDiscord<mratsim> yeah, usually strings are in a table, not 15 M in a row
17:03:03alehander92yeah, i'd guess some kind of `views` into a big string might be better
17:03:10dcmertenswhat is log2(15M)?
17:03:10alehander92if its e.g. after splitLines
17:03:24alehander92~4k
17:03:25disbotno footnotes for `4k`. 🙁
17:04:11dcmertenslog(15_000_000)/log(2) = 24
17:04:24FromDiscord<Synth> sent a code paste, see http://ix.io/2nvF
17:04:28FromDiscord<Synth> This is pretty much what I'm trying to do :p
17:04:32*dcmertens checks
17:04:45*sschwarzer joined #nim
17:04:50FromDiscord<Synth> (edit) 'http://ix.io/2nvF' => 'http://ix.io/2nvG'
17:04:56FromDiscord<Rika> dont toseq the attemptlist
17:04:59FromDiscord<Synth> (edit) 'http://ix.io/2nvG' => 'http://ix.io/2nvF'
17:05:18FromDiscord<Rika> so its `for attempt in product(charlist, repeat=current):` instead
17:05:27FromDiscord<Rika> i dont see why you need the seq
17:05:43alehander92toSeq
17:05:45FromDiscord<Synth> I will need it as a variable though since I need to get the total amount of items in `product(charlist, repeat=current)`
17:05:46alehander92is your problem
17:05:50alehander92just iterate directly
17:05:58alehander92eh just use a counter variable
17:05:59FromDiscord<Rika> you can calculate that without the seq
17:06:03FromDiscord<Synth> Oh?
17:06:10sschwarzerWhat's the preferred way to compare against `nil`? `isNil(obj)` or `obj == nil`?
17:06:23alehander92and yeah you can just use combinatorics hopefully
17:06:24sschwarzerI've seen both.
17:06:25FromDiscord<Rika> there would be some sort of formula for `product` i assume
17:06:32FromDiscord<Rika> sschwarzer then its either
17:06:50FromDiscord<Rika> personally i use `obj.isNil`
17:07:02FromDiscord<Rika> but i try avoiding nil checks anyway
17:07:20FromDiscord<Synth> How can I get the total amount of items generatied from the product funtion without using `len(seq)`?
17:07:33sschwarzerRika: `isNil` looks a bit cleaner to me because it could include additional actions/checks.
17:07:33FromDiscord<Rika> as alehander said, with combinatorics
17:07:55FromDiscord<Rika> sschwarzer: it probably doesnt, check the source if you wanna ensure it
17:08:33FromDiscord<Rika> @Synth https://en.wikipedia.org/wiki/Cartesian_product
17:08:46alehander92Synth you really should try to use a bit of combinatorics to solve this
17:08:52alehander92its an algo problem
17:09:10FromDiscord<Synth> Yes, but I will need the total amount during the enumeration?
17:09:14FromDiscord<Synth> (edit) 'enumeration?' => 'enumeration...'
17:09:35FromDiscord<Synth> > @Synth https://en.wikipedia.org/wiki/Cartesian_product↵I've read this so multiple times in the past haha
17:09:43FromDiscord<Synth> (edit) 'https://en.wikipedia.org/wiki/Cartesian_product↵I've' => '<https://en.wikipedia.org/wiki/Cartesian_product>↵I've'
17:10:10FromDiscord<mratsim> var count = 0:↵for foo in product(charlist, repeat=current):↵ ...↵ count.inc()
17:10:11sschwarzerRika: My application for the nil check is that I want to handle a special case by using `nil` for an argument which goes into an attribute/member of a type. The other approach would be using `option`, but this seems overkill because the `nil` value is really an exception.
17:10:11FromDiscord<Rika> @Synth its just `length of set to the power of (repeats)` afaik.
17:10:15FromDiscord<Synth> (edit) removed 'so'
17:10:21alehander92but you can do this in any moment
17:10:43alehander92also, what does `repeat` do
17:11:01FromDiscord<Rika> so its `len == 62 ^ current`
17:11:07FromDiscord<Synth> sent a long message, see http://ix.io/2nvJ
17:11:08sschwarzerRika: I'm also fine if it doesn't do anything beyond the actual `nil` comparison
17:11:33alehander92it shouldn't
17:11:40FromDiscord<Rika> sschwarzer: if you're looking for python `NoneType`, use options.
17:11:48FromDiscord<Rika> @Synth see my message
17:11:52FromDiscord<mratsim> @Synth, binomial coef? https://github.com/mratsim/number-theory/blob/master/src/combinatorics.nim#L4-L7
17:11:54FromDiscord<Synth> > so its `len == 62 ^ current`↵This?
17:11:54FromDiscord<Rika> i think thats what youre looking for
17:11:57FromDiscord<Rika> i think
17:12:02FromDiscord<Rika> i got no clue but i think it is
17:12:07FromDiscord<Synth> Why to the power of 62?
17:12:16*tane_ joined #nim
17:12:29FromDiscord<Rika> thats the length of your set
17:12:53FromDiscord<mratsim> I think if you have k iems to choose with repetition among n items, it's actually binomial coefficient that you need
17:13:02FromDiscord<Rika> (btw, the `product` function he is using is in `narimiran/itertools`
17:13:16FromDiscord<mratsim> https://en.wikipedia.org/wiki/Binomial_coefficient
17:13:39sschwarzerRika: I'm going to keep it simple for now and use `nil`. I'll most likely offer the code, once it's done, for review in the forum. Then you can give advice within the given context. I'm still not very experienced with Nim and am trying some things out.
17:13:45FromDiscord<Rika> mratsim: its cartesian product of the set on itself with x repeats
17:13:58sschwarzerRika: but thanks anyway :)
17:14:02*tane_ quit (Client Quit)
17:14:24FromDiscord<Rika> so product "abc", 2 is [aa, ab, ac, ba, bb,....]
17:14:48FromDiscord<Rika> sschwarzer that sounds like a good idea
17:14:48FromDiscord<mratsim> ah I see
17:15:19FromDiscord<Rika> so length should be `set.len ^ repeats` right?
17:15:33FromDiscord<Synth> > so its `len == 62 ^ current`↵This should work, I will test it. Thank you!
17:15:50*haxscramper joined #nim
17:18:07haxscramperI'
17:18:51FromDiscord<Rika> I'?
17:18:57Yardanicoi'
17:19:07haxscramperSorry, I'n not used to this IRC client.
17:19:18Yardanicoit's okay :)
17:19:18haxscramperI'm writing full message now
17:19:22FromDiscord<Rika> okay
17:19:26Yardanicoat least you didn't paste 15 lines of code in IRC XD
17:20:45haxscramperI'm trying to write parser combinator library mostly based on generics. I declared type `Parser[Val, Tok] = proc(buf: Buffer[Tok]): Val` where `Buffer` is a concept `Buffer[Tok] = concept buf`, `buf[0] is Tok`. When i try to instantiate function that returns parser I get `cannot instantiate
17:21:06haxscramper'result:type'. Here is a full code https://play.nim-lang.org/#ix=2nvL
17:21:42*dcmertens quit (Quit: Leaving)
17:22:46haxscramperWhen I try to instantiate parser directly I get internal compiler error `internal error: getTypeDescAux(tyProxy)`. Am I missing something or this is just a bug?
17:22:57Yardanicowell concepts themselves are an experimental feature
17:23:32Yardanicoand your code seems a bit wrong I think
17:23:52Yardanicoyou return type "Parser[Val, Tok]" from the parseStr proc
17:23:54alehander92why dont you just define it like
17:23:58Yardanicobut don't you want that proc itself to have Parser[Val, Tok] type?
17:24:52alehander92yep, if you fix that it works
17:25:45haxscramperI use these procs to return other procs and usem /generated procs/ for parsing. `parseStr` returns closure proc - I don't use it for parsing.
17:26:13FromDiscord<mratsim> not sure about the rest but your concept at least is wrong: https://play.nim-lang.org/#ix=2nvL
17:26:56Yardanicoyeah it seems like with the way you're instantiating it you want to get "string" from "char"
17:27:04Yardanicosince you only know Val and Tok and you pass Tok to Buffer
17:27:53haxscramperWell, yes, that's exactly my the intention: I parse buffer of characters and return some string from it.
17:28:27sschwarzerRika: At the moment it looks like the best option isn't `option`, but a variant type. :-D
17:28:39FromDiscord<Rika> i see
17:28:50FromDiscord<Rika> options are variant types
17:28:57haxscramperOr it is wrong from implementation perspective? I'm not sure if `buf[0] is Tok` is exactly what I need to write in concept in this case.
17:29:20sschwarzerRika: yes, that makes sense, too :)
17:34:07alehander92oh you cant rerturn concepts
17:34:13alehander92currently yet*
17:34:19Yardanicoalehander92: or maybe never :P
17:34:31alehander92so maybe that's leading to this problem
17:35:50Yardanicoi'm more excited towards https://github.com/nim-lang/Nim/pull/14467
17:35:50disbotmore checking for --gc:arc, no need for valgrind
17:36:05Yardanicoref counting checks to detect memory leaks and stuff
17:39:01haxscramperIs there any way to treat `string` as `openarray[char]` then?
17:44:23haxscramperIn the end I specified `Buf` as fully template parameter: `Parser[Val, Buf] ...` - not as pretty as using cocepts but works in the end.
17:44:58alehander92yeah, string should match openarray[char] indeed
17:45:11alehander92but maybe there is some kind of generic edge case issue here
18:20:38leorizeconcepts are kinda funky and you shouldn't use it in it's current state
18:21:09xacequick question: has anyone tried using nim with jupyter? considering jupyter supports c++, it should be possible to support nim too, right?
18:44:53disruptekit'd be great if ssl didn't crash nimph.
18:50:54FromGitter<sheerluck> xace https://github.com/apahl/nim_magic
18:52:55FromGitter<sheerluck> xace https://github.com/stisa/jupyternim
18:53:51FromDiscord<fer> sent a code paste, see http://ix.io/2nwk
18:54:17*oprypin_ is now known as oprypin
18:54:19FromDiscord<fer> (edit) 'http://ix.io/2nwk' => 'http://ix.io/2nwl'
18:54:29FromDiscord<Rika> sent a code paste, see http://ix.io/2nwm
18:54:49FromDiscord<Rika> look into the `options` module
19:13:29*xmon joined #nim
19:14:10*xmon is now known as aredirect
19:15:43xacethanks sheerluck
19:15:56*Vladar quit (Quit: Leaving)
19:23:03*idf joined #nim
19:30:01*wowi42 quit (Quit: Kowa Bunga!!!)
19:30:46*wowi42 joined #nim
19:46:44*lritter joined #nim
19:49:23*MortS quit (Ping timeout: 246 seconds)
19:51:25*martinium joined #nim
19:51:29*MortS joined #nim
19:52:29martiniumwhen writing lots of items to a file it suddenly stops writing and stays stuck. No exception, no crash. Anyone ever come across this before?
19:52:41martiniumusing writeLine to write to a file in a loop
19:53:25martiniumI was thinking maybe my drive needs time to catch up but doesn't seem to be the case
19:54:21livcdtry in debug mode and gdb and let us know
19:54:47bungpaste code please
20:00:57FromDiscord<mratsim> @martinium, it may be fast while it can stay in the OS/disk buffer, and then when it's time to flush, it's slow
20:01:38martiniumman is flush File that slow???
20:01:58martiniumlet me add an echo before it performs the flushfile to see if that is the culprit
20:02:13FromDiscord<mratsim> SSD are about 10k times slower than registers
20:02:27FromDiscord<mratsim> HDD are about a million times
20:02:30martiniumI am writing this to a separate HDD
20:02:47martiniummaybe it'll be faster if I run on my nvme main drive
20:02:51FromDiscord<mratsim> USB?
20:02:58martiniumnah, internal sata
20:03:10martiniumbut I have a really fast nvme drive as my OS drive
20:03:21FromDiscord<mratsim> because transfering data via USB tends to slow down everything (I don't understand the subsystems involved though)
20:03:36martiniumyeah I wouldn't be using usb
20:08:16martiniumtested on faster drive and still pauses while still "writing"
20:08:25martiniumbefore it gets to flushing file
20:09:59martiniumso when I SIGTERM the file is always 166872 rows
20:10:07martiniumalways 13.9MB
20:10:28martiniumwould flushing the file on each iteration be better?
20:10:37martiniumI do it only after all data is supposed to be written
20:12:12bungyou sure you properly break the loop ?
20:12:43martiniumI've never had to manually break out of a loop
20:12:47martiniumyou mean using the break keyword?
20:13:05martiniumI figured once loop completes it would exit automatically no?
20:13:43*PMunch joined #nim
20:13:51martiniumI assume I'll need to add a condition for it to break
20:13:51bungbut that needs you can make sure your loop test works right
20:14:39bungyou test condition may unexpectedly always true
20:14:48martiniumyeah
20:15:29PMunchZevv, did you get anywhere with your coroutines stuff?
20:18:14martiniumbung break keyword is working
20:18:50martiniumbut now it flushes file on each iteration once loop breaks
20:18:51martiniumlol
20:19:10martiniumproc is called from another loop
20:21:07bungdont know another loop process, maybe you can using a buffer size when it exceed flush it
20:21:25martiniumit seems to stop once when it gets to 13.9MB
20:21:34martiniumeven with it flushing on each iteration
20:21:59martiniumbreak keyword caused written file to only be 412KB after sigterm
20:22:25martiniumonly like 4.2k lines written vs 166k lines
20:22:33martiniumweird that it freezes like this
20:23:58bungcheck your code again, most like human mistake.
20:29:03martiniumyeah
20:29:50Yardanicobtw guys did you notice that github changed quite a few icons? :D
20:30:28martiniumYardanico, sup dude
20:30:30alehander92ha i seee it now
20:30:39Yardanicomartinium: hi
20:30:48YardanicoI noticed that they did it by the notification icon
20:30:50Yardanicosince I click it quite often
20:30:57bungstar icon changed
20:33:15ZevvPMunch: didnt work on it anymore. But funnily enough I started this week with an iterator variation that was about 90% similar to your implementation. Same macro, same stuff around it
20:33:20Zevvnever knew you were working on it as well
20:33:44PMunchThe coroutines repo I shared?
20:34:17PMunchI was basically just trying to implement the coroutines example from wikipedia
20:35:00Zevvwell, it is where I started :)
20:35:18ZevvThis is my latest stuff, not sure what state it is in and if it makes any sense at all
20:35:19Zevvhttps://github.com/zevv/nimcoro
20:35:23Zevvucontext doesn't perform well
20:35:46ZevvIs it too silly to even *try* to implement them with threads? Will people laugh at me?
20:36:00disrupteki will.
20:36:08Zevvyou can
20:36:14ZevvI know who's laughing, right
20:37:08PMunchTo implement coroutines with threads? Sounds expensive..
20:38:06Zevvwhat part? Spawning them or using them
20:38:16Zevvbecasue I don't want a ton. I usually have a handful
20:38:43*tdc quit (Ping timeout: 272 seconds)
20:40:02*MortS quit (Ping timeout: 272 seconds)
20:40:17*NimBot joined #nim
20:40:59FromDiscord<Elegant Beef> Dont we already have asyncdispatch, what's the benefit of coroutines over that?
20:41:17PMunchThey work a bit differently
20:41:39PMunchZevv, well doing a context switch is pretty pricy isn't it?
20:42:13ZevvI don't dare answering these kind of questions anymore these days without measuring
20:42:13FromDiscord<exelotl> coroutines (in Lua) are more pleasant to use than async/await (in JS)
20:42:33Zevvexelotl: right, that is what I'm after. But I'm having a hard time explaining *why* I find that
20:42:34*idf quit (Ping timeout: 246 seconds)
20:42:41FromDiscord<Elegant Beef> In Unity i never touch coroutines the entire system is hideous 😄
20:42:52ZevvIn Lua I coro *so* much.
20:43:02FromDiscord<Elegant Beef> Having a `yield return` inside a function that doesnt need a return type
20:43:31FromDiscord<exelotl> this article does a good job of explaining why they rock: https://leafo.net/posts/itchio-and-coroutines.html
20:43:48ZevvI did some work on and off in Nim's async stack, from network side or from the async side. It's pretty solid but every time I feel it is all so complicated
20:43:54PMunchOoh, that will be an interesting read tomorrow
20:43:59FromDiscord<Clyybber> Why can't Nim iterators replace lua coroutines?
20:44:16Zevviterators are special. If you want to yield, you need to be in an iterator
20:44:45Zevvyou can't just yield from anywhere. You can't pass a proc as a callback that will yield whenever something is ready, for example
20:44:54Zevvalso with Lua coro's I find I never need promises or futures
20:45:18Zevvwhat you pass to resume(coro) is the return value for yield(), and what you pass to yield() is the return value for resume(coro)
20:45:32Zevvso it's nice to make filters, producers, consumers as well
20:46:07ZevvPMunch: Sure, a context switch is expensive, but my practical use is mostly async, so typically a proc is already waiting for I/O anyway
20:46:38FromDiscord<Clyybber> But aren't iterators equivalent? You can pass an iterator as a callback
20:47:12FromDiscord<Elegant Beef> I guess i'd have to see a coroutine implemented in nim to actually say if i like them or not, in unity it always felt ugly to use since you had to do `startCoroutine()` and `stopCoroutine()`
20:47:12PMunch@Clyybber, closure iterators*
20:47:17PMunchBut yes, they are very similar
20:47:19shashlickdoes json work at compile time?
20:47:33FromDiscord<Clyybber> PMunch: Yeah, I meant closure iterators :P
20:47:34PMunchshashlick, should do I think
20:47:41Zevvclybber: sure, they are close cousins, but the semantics are just different
20:48:40AraqZevv, I'm researching "continuation passing style" fwiw
20:48:49Zevvwut!
20:48:50Zevv\o/
20:49:07Zevvwhen did that come up?
20:49:09martiniumbung, I switched filter to a group with slightly less rows that need to be written and it completed np
20:49:11martiniumso logic is sound
20:49:34PMunchZevv, do you have an example of how you'd use coroutines with coro in Lua`
20:49:36PMunch?*
20:49:41AraqZevv, last two weeks ago. bought a book about it
20:49:50martiniumanyone know if nim writes above a certain amount need a buffer?
20:49:51ZevvAraq: best reason!
20:52:15bungbetter show your code
20:52:28ZevvPMunch: for my it's typically for async. I have a very lightweight event loop which just calls a callback if a registered fd is readable or a timer expires. This can be used the normal callback way, or you register a function that does a "yield(recv())"
20:52:29*idf joined #nim
20:52:37Zevvand voila, you're async. No futures, etc
20:53:10Araq"async without futures" pretty much nails it
20:53:12Araq:-)
20:53:32Zevvright.
20:53:36FromDiscord<mratsim> the future is bright
20:53:55alehander92sounds like a political slogan
20:54:21ZevvPMunch: my other argument is pretty vague, but with lua coro's I build large stuff and never have to think hard about what is happening, it just flows naturally
20:54:23PMunchIsn't async without futures just callback hell?
20:54:28Zevvnot with coroutines
20:54:42PMunchI think I'm still not getting it :P
20:54:42martiniumbung, https://gist.github.com/martinium/e11f0fd1299675e5c7a0d729f3d342dc
20:54:49FromDiscord<Elegant Beef> I'd like to see an implemention before i complain about coroutines 😄
20:54:57PMunchDo you have a short code example of how you'd use them?
20:55:29martiniumI ended up making this code only do one of my BUs at a time since full dump was overloading the server lol
20:55:41FromDiscord<mratsim> I would expect greenlet is the same philosophy: https://github.com/treeform/greenlet/blob/master/src/cgreenlet/examples/simple-cc.cc#L24
20:55:48ZevvPMunch: I'll try to extend my toy coro implementation to actually work, so you can see
20:56:17FromDiscord<mratsim> or in C: https://github.com/treeform/greenlet/blob/master/src/cgreenlet/examples/simple.c#L31
21:09:04bungmartinium seems pretty good, in the end you dont close the file?
21:09:21martiniumI had that there also just forgot to readd
21:09:28martiniumerror still happens with it
21:09:37*PMunch quit (Quit: leaving)
21:11:01*idf quit (Ping timeout: 258 seconds)
21:14:10bunghmm set a timeout to client see if it works
21:14:39martiniumall the web request complete successfully
21:14:49martiniumit's the writing to file part that eventually just stops
21:14:56martiniumand stays hanging
21:15:05*rockcavera quit (Remote host closed the connection)
21:15:11martiniumstill responsive but no further progress from there
21:15:22martiniuma smaller amount completed successfully
21:15:28martiniumbut larger grouping always cries
21:15:54martiniumdoes anyone have experience rate-limiting number of http requests?
21:18:15bungI dont see problem with file io
21:18:57bungmartinium better set a timeout
21:21:17bungand other thing how much File descriptor limit number, usually when it exceed programs will exit with error
21:24:28martiniumfile descriptor limit?
21:24:34martiniumI've never set one before
21:28:27ZevvPMunch still here? I have a tiny "standalony" async coro example
21:30:15Yardanicodoesn't seem so
21:30:19YardanicoPMunch ([email protected]) has quit (Quit: leaving)
21:31:34Zevvah right - I disabled join/leave messages long ago on #nim - too much noise
21:31:37bungyeah , open too much file for system, might not be the problem as it will exit you program
21:34:06YardanicoZevv: well the other way to easily figure it out is tab completion
21:34:13Yardanicoif your IRC client has that
21:36:39*liblq-dev quit (Quit: WeeChat 2.8)
21:36:42*tane quit (Quit: Leaving)
21:38:08ZevvYardanico: right!
21:38:52*rockcavera joined #nim
21:39:15martiniumbung, yeah def not that
21:39:23martiniumonly one file is open and being written to
21:39:38martiniumseems to be an issue when it's greater than a certain amount
21:40:14bungyour http connection also counts on
21:40:46martiniumhttp connection at that point is already closed
21:41:04martiniumhttp connection closes after each request
21:49:53FromGitter<bung87> OK I have no idea now
21:57:16*haxscramper quit (Remote host closed the connection)
21:57:32martinium:)
21:57:52*sschwarzer quit (Remote host closed the connection)
21:59:19*neceve quit (Ping timeout: 258 seconds)
22:02:18*sschwarzer joined #nim
22:02:42ZevvFor those others then PMunch interested in the async/coro discussion, here is my tiny standalone proof of concept project: https://github.com/zevv/nimcoro/. The magic example is happening here: https://github.com/zevv/nimcoro/blob/master/t.nim#L33
22:03:08Zevvnow I will ZzzZz a bit
22:04:03sschwarzerZevv: good night
22:07:46martiniumbung, going to run it on my linux install and see if it still fails
22:07:47martiniumlol
22:07:55martiniumwell not fails but "hangs"
22:08:44*martinium quit (Read error: Connection reset by peer)
22:10:15*abm quit (Quit: Leaving)
22:12:24*solitudesf quit (Ping timeout: 256 seconds)
22:12:54*Trustable quit (Remote host closed the connection)
22:12:54*martinium joined #nim
22:16:22*aredirect quit (Ping timeout: 256 seconds)
22:16:46*aredirect joined #nim
22:20:47*sschwarzer quit (Quit: leaving)
22:34:12*Senny joined #nim
22:35:36*aredirect quit (Quit: Leaving)
22:47:33*xet7 quit (Quit: Leaving)
22:48:20*xet7 joined #nim
22:55:55*lritter quit (Ping timeout: 246 seconds)
23:05:13*lritter joined #nim
23:12:24*krux02_ joined #nim
23:16:03*krux02 quit (Ping timeout: 260 seconds)
23:17:26skrylar[m]hoi
23:18:49*Jesin quit (Quit: Leaving)
23:23:38FromDiscord<exelotl> zevv this is extremely cool, I hope it goes places :)
23:30:51*Jesin joined #nim
23:52:18bunghow server implement a cursor action ?store state somewhere for specific client next call?
23:56:50*ftsf joined #nim