00:14:49 | zacharycarter | @mratsim: hmmm... I don't remember this haha |
00:15:01 | zacharycarter | but that's a very cool example |
00:20:57 | * | clemens3 quit (Ping timeout: 265 seconds) |
00:23:41 | * | clemens3 joined #nim |
00:29:41 | FromDiscord | <Zed> a path tracer from what i recall is the same as a ray tracer except it has a bounce limit, whereas a ray tracer will keep bouncing rays until it reaches the light source or something |
00:30:56 | zacharycarter | oh I just meant I don't remember sharing one with him |
00:31:37 | FromDiscord | <Zed> well it was a couple of weeks ago 😛 |
00:31:52 | zacharycarter | this is true |
00:32:05 | FromDiscord | <Zed> @mratsim You have some amazing stuff on your github! |
00:36:03 | * | Senny joined #nim |
00:49:24 | * | marquisdefalbala joined #nim |
00:56:15 | * | Tlanger joined #nim |
00:58:31 | * | Tongir quit (Ping timeout: 246 seconds) |
01:01:40 | * | dddddd quit (Ping timeout: 246 seconds) |
01:08:19 | * | lritter quit (Ping timeout: 246 seconds) |
01:09:10 | * | lritter joined #nim |
01:10:13 | * | Senny quit (Quit: WeeChat 2.8) |
01:12:22 | * | Senketsu joined #nim |
01:12:33 | skrylar[m] | tested replacing cbor for ebml in my little derpy game engine. something interesting i noticed is that there's a lot less code for that |
01:13:07 | skrylar[m] | probably because of all the missing type checking rofl |
01:15:31 | * | krux02_ quit (Remote host closed the connection) |
01:15:48 | skrylar[m] | in cbor there's some type testing flags (it has rich typing) for booleans/integers of various sizes and whatnot, then multiple segments of reading (the size of len field is part of the header).. in ebml they just sort of steal a couple bits off the int for the field size, and i slapped the zigzag encoder from protobuf in there just to see |
01:26:18 | * | chemist69_ joined #nim |
01:29:37 | * | chemist69 quit (Ping timeout: 264 seconds) |
01:33:42 | * | Satomi-Kowa quit (Quit: Connection closed) |
01:56:26 | * | minnr joined #nim |
01:58:04 | minnr | Probably an obvious answer, but is there a simple way to have a for loop without an identifier? I just want to do something 50 times but I don't need access to the counter value... |
01:58:36 | Yardanico | minnr: use "_" |
01:58:40 | Yardanico | for _ in 0 .. 50: |
01:58:48 | zedeus | thats 51 times :) |
01:58:53 | Yardanico | i know :P |
01:59:16 | FromDiscord | <Elegant Beef> eh that's within a reasonable error margin, good enough for space |
01:59:29 | minnr | Ah, when I did that VSCode said "_" was of type int so I assumed it was using it as a unicode char. Thanks! |
01:59:32 | FromDiscord | <Elegant Beef> 50 +- 2% |
01:59:50 | zedeus | I've mostly narrowed down the async issue now, it crashes when receiving the html from a local server |
01:59:55 | Yardanico | ok I'm done with making a graph for all nimble pkgs btw |
02:00:00 | Yardanico | currently playing with dot for nice output |
02:00:04 | zedeus | sick |
02:00:36 | Yardanico | just for a teaser: https://i.imgur.com/EYSU9pq.png |
02:01:00 | FromDiscord | <Elegant Beef> So this is dependancy hell |
02:01:01 | zedeus | beautiful |
02:02:07 | Yardanico | good news - there's quite a lot of nimble packages which don't depend on other packages |
02:02:50 | Yardanico | ~878 packages |
02:02:54 | Yardanico | yes, that many |
02:03:04 | Yardanico | out of ~1.27k |
02:03:48 | FromDiscord | <Elegant Beef> damn ~ 66% that's pretty good |
02:03:48 | Yardanico | I also thought about making a special node "<nothing>" |
02:03:49 | yumaikas | cligen tho |
02:03:51 | Yardanico | to show all packages without deps |
02:04:00 | * | minnr quit (Quit: Leaving) |
02:05:56 | Yardanico | oops |
02:06:02 | Yardanico | dot: maze.c:313: chkSgraph: Assertion `np->cells[1]' failed. |
02:06:06 | Yardanico | crashed graphviz |
02:06:17 | FromDiscord | <Elegant Beef> Clearly it should be "Strong independant module" |
02:06:32 | Yardanico | I really like to look at these |
02:07:13 | Yardanico | https://i.imgur.com/flv4usT.png like their own smol worlds :P |
02:10:02 | Yardanico | this is the tree of all packages which depend on others (and these other packages themselves of course), so no packages which don't have any dependencies and no package depends on them https://i.imgur.com/RqFHawk.png |
02:10:49 | Yardanico | quite a lot of pkgs depend on zip btw |
02:11:52 | Yardanico | this is how it looks if I have the nothing node |
02:11:54 | Yardanico | https://i.imgur.com/WCAyX7P.png |
02:12:55 | zedeus | whats in the middle |
02:12:59 | Yardanico | <nothing> |
02:13:10 | zedeus | oh |
02:13:17 | zedeus | nice, actually |
02:13:19 | Yardanico | ok did it without that nothing node but still keeping the packages |
02:13:34 | Yardanico | https://i.imgur.com/oVN375w.png |
02:13:37 | Yardanico | like an ocean of packages |
02:13:40 | Yardanico | with some island in the middle :D |
02:13:59 | FromDiscord | <Elegant Beef> Who needs a island generator when you have that |
02:14:05 | Yardanico | yeah ikr |
02:14:19 | Yardanico | it only took me a few hours and 2.7gb of cloned repos (yes I cloned repos of ALL packages in nimble) |
02:14:27 | FromDiscord | <Elegant Beef> Damn |
02:14:34 | Yardanico | I did it with --depth=1 tho |
02:14:41 | Yardanico | so it's just a few repos which are fat |
02:14:44 | Yardanico | idk which ones yet |
02:20:51 | Yardanico | so ok I made a png file |
02:21:01 | Yardanico | 5kx5k pixels |
02:21:17 | FromDiscord | <Elegant Beef> Make it a SVG instead dumb dumb 😛 |
02:21:23 | Yardanico | I can |
02:21:24 | Yardanico | easily |
02:21:29 | Yardanico | but you won't be able to view it easily |
02:21:34 | Yardanico | at least not in the browser |
02:21:58 | FromDiscord | <Elegant Beef> Wikipedia says "Try me bitch"↵https://upload.wikimedia.org/wikipedia/commons/1/1b/Linux_Distribution_Timeline.svg |
02:22:32 | Yardanico | https://raw.githubusercontent.com/gist/Yardanico/4d25f7395af01b06cf9035c8024f02c6/raw/192dca7c9cb2747e5ab2030baab08a59748434f3/graph.svg |
02:23:19 | Yardanico | also btw |
02:23:24 | Yardanico | all names are minimized and _ is removed |
02:23:28 | Yardanico | because nimble does that too btw |
02:23:32 | shashlick | Nice to see nimterop getting some dependents |
02:23:45 | Yardanico | nimgen has more :D |
02:23:52 | Yardanico | because all treesitter pkgs depend on it |
02:24:09 | FromDiscord | <Elegant Beef> This now needs colour |
02:24:30 | shashlick | Hehe I think most are because of me |
02:24:58 | shashlick | I should convert tree sitter to nimterop as well |
02:30:20 | * | sz0 quit (Quit: Connection closed for inactivity) |
02:32:56 | * | NimBot joined #nim |
02:34:34 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
02:37:08 | * | madpata joined #nim |
02:38:23 | * | muffindrake quit (Ping timeout: 265 seconds) |
02:40:22 | * | madpata_ quit (Ping timeout: 246 seconds) |
02:40:32 | * | muffindrake joined #nim |
02:45:20 | Yardanico | btw, don't forget to vote on https://github.com/github/linguist/pull/4866 if you agree with changes :P |
02:45:33 | Yardanico | (you can do a thumbs down if you don't agree too) |
02:49:10 | * | dadada quit (Ping timeout: 256 seconds) |
02:54:28 | * | B4s1l3 is now known as opDispatch |
02:54:45 | Yardanico | btw I parsed all requires from .nimble (both nims and ini style) and .babel files with npeg |
02:54:51 | Yardanico | requires <- i"requires" * *nl * ?':' * *nl * ?'(' * *(entry * ?',' * *nl) * ?')' * *nl |
02:55:28 | Yardanico | entry <- '"' * >*(Print - '"') * '"' |
02:58:48 | * | JustASlacker quit (Ping timeout: 256 seconds) |
03:02:53 | * | ftsf joined #nim |
03:09:59 | * | sasamba joined #nim |
03:10:18 | sasamba | Hi! How can i make parallel async HTTP requests, wait for all to complete and gather responses? |
03:10:56 | FromDiscord | <Rika> asyncdispatch and httpclient's asynchttpclient? |
03:11:15 | zedeus | you can do `var futs: Future[Request]` then add the futures returned by asynchttpclient.get, and `await all(futs)` |
03:11:29 | zedeus | er I meant `seq[Future[Request]]` |
03:18:31 | FromDiscord | <Elegant Beef> Rika is my readme any better? 😄 |
03:18:32 | FromDiscord | <Elegant Beef> https://github.com/beef331/constructor |
03:19:09 | Yardanico | well yeah it's just a small sugar thing |
03:19:14 | Yardanico | to write less code |
03:19:16 | Yardanico | I mean it's ok |
03:19:35 | FromDiscord | <Elegant Beef> Yea rika said it wasnt clear the last time i posted it so... |
03:19:40 | Yardanico | but I don't like code formatting :D |
03:19:52 | FromDiscord | <Elegant Beef> Huh? |
03:20:00 | zedeus | you could also use tuples |
03:20:11 | FromDiscord | <Elegant Beef> Yea it supports both |
03:20:14 | Yardanico | the preferred style almost universally in most languages is something like "var a: int = 5" |
03:20:18 | Yardanico | no space after "a" |
03:20:27 | Yardanico | but space after ":" |
03:20:35 | FromDiscord | <Rika> hey let him do whatever |
03:20:37 | Yardanico | try to run nimpretty on your code |
03:20:38 | zedeus | var a :int= 5 |
03:20:39 | Yardanico | @Rika I know |
03:20:42 | Yardanico | zedeus: :((( |
03:20:43 | FromDiscord | <Rika> nims literally "have whatever except tabs as indent" |
03:20:51 | * | nsf joined #nim |
03:20:52 | Yardanico | @Rika uhh |
03:20:56 | zedeus | well, you can do that |
03:20:59 | zedeus | but you shouldn't |
03:21:18 | Yardanico | !eval vAR a: iNT = 5; eChO a |
03:21:20 | NimBot | 5 |
03:21:36 | zedeus | use tabs and your code automatically gets indented with 8 beautiful spaces by github |
03:21:43 | Yardanico | (yes keywords are partially case insensitive too) |
03:21:43 | FromDiscord | <Elegant Beef> Yum |
03:21:45 | FromDiscord | <Elegant Beef> My favourite |
03:22:03 | sasamba | So I need to make 1 client = 1 future or i can use one client for many futures? |
03:22:06 | FromDiscord | <Rika> keywords are just special idents why would they not be style insens |
03:22:11 | sasamba | If I use one client it crashes |
03:22:11 | Yardanico | shashlick: 1 client = 1 future |
03:22:20 | Yardanico | don't worry, it won't really affect performance |
03:22:27 | zedeus | sasamba: one client per request, it's a little strange but yeah, no performance hit |
03:22:29 | Yardanico | unless you want to do millions of requests per second :D |
03:22:38 | zedeus | in which case you can use a pool |
03:22:47 | sasamba | Oh |
03:22:49 | sasamba | Thx! |
03:23:11 | Yardanico | .good night |
03:23:48 | zedeus | for my nitter project a new client is created for every request, and I serve hundreds of thousands every day |
03:23:55 | FromDiscord | <Elegant Beef> buh bye yard |
03:23:59 | zedeus | I should probably use a pool.. but it's fine |
03:24:03 | FromDiscord | <Elegant Beef> I hate you for hating my formatting |
03:24:23 | zedeus | gn, thanks for helping with troubleshooting |
03:24:39 | FromDiscord | <Rika> zedeus what server specs tho 👀 |
03:24:51 | zedeus | 2 core vps at hetzner |
03:25:06 | zedeus | runs two instances of the program for load balancing |
03:25:11 | FromDiscord | <Yardanico> 6 euro one? |
03:25:15 | zedeus | yep |
03:25:18 | FromDiscord | <Yardanico> Amazing |
03:25:21 | FromDiscord | <Yardanico> I have it too |
03:25:31 | FromDiscord | <Yardanico> (the 6 euro one too) |
03:25:34 | zedeus | 8.5 million redis commands processed in the past few days |
03:25:38 | FromDiscord | <Rika> damn, 2 cores and how many people use nitter |
03:25:49 | zedeus | last I checked 17k unique users daily |
03:25:55 | FromDiscord | <Yardanico> Bruh |
03:25:59 | FromDiscord | <Rika> daaaaamn |
03:26:05 | FromDiscord | <Rika> thats an efficient program |
03:26:12 | FromDiscord | <Yardanico> Nim |
03:26:14 | zedeus | ^ |
03:26:26 | zedeus | the only bottleneck is waiting for Twitter requests |
03:26:32 | FromDiscord | <Rika> you just said good night yardanico go to sleep damn it |
03:26:33 | FromDiscord | <Rika> xd |
03:26:35 | zedeus | when I cache everything, full timelines are served in 10 ms |
03:26:51 | FromDiscord | <Yardanico> How much ram does nitter use btw? Single instance |
03:26:58 | FromDiscord | <Yardanico> The binary itself |
03:27:17 | * | opDispatch quit (Quit: Konversation terminated!) |
03:27:36 | zedeus | due to large spikes it uses a lot, both instances typically grow to 1.5 gb before getting OOM'd unless i kill them myself first |
03:27:59 | FromDiscord | <Yardanico> Ok now good night for real |
03:28:11 | zedeus | but that's with fetching and parsing ~4 MB html requests every time |
03:28:22 | zedeus | working on using the new json api, way more efficient |
03:28:26 | FromDiscord | <Rika> zedeus: no swap? |
03:28:42 | zedeus | nope, but I feel like that would be a bad idea |
03:28:52 | zedeus | easier to just let nitter die and restart, there's no state |
03:30:59 | FromDiscord | <Technisha Circuit> How would i make a proc called `__import__`? |
03:31:06 | zedeus | you cannot |
03:31:11 | FromDiscord | <Technisha Circuit> I have to have this exact name |
03:31:14 | FromDiscord | <Technisha Circuit> Damn |
03:31:25 | zedeus | double underscore is specifically banned |
03:31:34 | FromDiscord | <Technisha Circuit> Why? |
03:31:38 | zedeus | https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifiers-amp-keywords |
03:32:06 | * | fredrikhr joined #nim |
03:32:07 | zedeus | I think it's to avoid clashing with C preprocessor stuff, not sure |
03:32:16 | FromDiscord | <Technisha Circuit> Hm |
03:32:29 | zedeus | but it wouldn't make sense anyway as underscores are ignored |
03:32:31 | FromDiscord | <Technisha Circuit> Can i somehow bypass this with macros? |
03:32:42 | zedeus | a_b is the same as ab |
03:33:01 | FromDiscord | <Elegant Beef> Why does it have to be `__import__``? |
03:33:05 | FromDiscord | <Elegant Beef> (edit) '`__import__``?' => '`__import__`?' |
03:33:20 | FromDiscord | <Technisha Circuit> I'm attempting to start implementing a python transpiler in Nim |
03:33:33 | FromDiscord | <Yardanico> Check out py2nin |
03:33:39 | FromDiscord | <Yardanico> (I'm sleeping btw) |
03:33:42 | FromDiscord | <Elegant Beef> Ah |
03:33:58 | FromDiscord | <Elegant Beef> Damn yard is smarter asleep than me when im awake |
03:34:31 | FromDiscord | <Technisha Circuit> Haha thanks |
03:34:52 | FromDiscord | <Yardanico> https://github.com/metacraft-labs/py2nim_deprecated/ |
03:35:40 | * | marquisdefalbala quit (Quit: Konversation terminated!) |
03:36:53 | FromDiscord | <Elegant Beef> I still dont understand why one would transpile python to nim, when they could just write nim 😄 |
03:37:09 | * | sasamba quit (Ping timeout: 245 seconds) |
03:37:14 | FromDiscord | <Elegant Beef> *Spoken like a true person that's never really used pythong* |
03:37:19 | FromDiscord | <Elegant Beef> (edit) 'pythong*' => 'python*' |
03:37:33 | * | rockcavera quit (Remote host closed the connection) |
03:37:34 | FromDiscord | <Technisha Circuit> Haha |
03:38:37 | * | sasamba joined #nim |
03:38:43 | sasamba | And damn why it gives me an error like this in random places: template/generic instantiation of `routes` from here |
03:39:04 | zedeus | nimsuggest doesn't like async very much |
03:39:58 | sasamba | Uhh |
03:39:59 | sasamba | K |
03:40:00 | sasamba | Thx! |
03:40:03 | * | sasamba left #nim (#nim) |
03:46:05 | FromDiscord | <Rika> @Elegant Beef can you make it make `initObj` for regular objects and `newObj` for ref? |
03:46:13 | FromDiscord | <Rika> wait |
03:46:17 | FromDiscord | <Rika> are you the right person |
03:46:19 | FromDiscord | <Rika> yes |
03:46:22 | FromDiscord | <Elegant Beef> yes |
03:46:28 | FromDiscord | <Elegant Beef> I suppose i could |
03:50:21 | FromDiscord | <Elegant Beef> Seems it doesnt even work for refs so yay! |
03:51:14 | FromDiscord | <Rika> lmao |
03:51:20 | FromDiscord | <Rika> the syntax should be the same |
03:52:44 | FromDiscord | <Elegant Beef> well i was taking only objects/distincts |
03:52:51 | FromDiscord | <Rika> @Elegant Beef your readme is also broken lmao |
03:53:04 | FromDiscord | <Rika> 2nd example has coolInt as 10 in the macro but 11 generated |
03:53:23 | FromDiscord | <Elegant Beef> lol |
03:53:25 | FromDiscord | <Elegant Beef> i cant read |
04:03:49 | FromDiscord | <Elegant Beef> Well now your wish has been granted |
04:04:08 | FromDiscord | <Elegant Beef> Init for stack and new for heap |
04:04:16 | FromDiscord | <Elegant Beef> Now it's garuenteed to be broken |
04:04:19 | FromDiscord | <Elegant Beef> But dont ask about that |
04:04:55 | FromDiscord | <Rika> guaranteed to be broken? |
04:05:00 | FromDiscord | <Rika> oh the readme? |
04:05:26 | FromDiscord | <Elegant Beef> Nah i just feel that i probably missed a case where this can be used and will crash |
04:05:30 | FromDiscord | <Elegant Beef> I am a numpty afterall 😛 |
04:05:47 | FromDiscord | <Rika> a ref ref objet |
04:05:50 | FromDiscord | <Rika> xd |
04:05:55 | FromDiscord | <Rika> are those even possible i wonder |
04:06:00 | FromDiscord | <Rika> rather |
04:06:02 | * | supakeen quit (Quit: WeeChat 1.9.1) |
04:06:05 | FromDiscord | <Elegant Beef> A super managed object |
04:06:05 | FromDiscord | <Rika> possible as a "type" |
04:06:15 | FromDiscord | <Rika> like `type something = ref ref object` |
04:06:27 | FromDiscord | <Elegant Beef> It compiles |
04:06:33 | FromDiscord | <Rika> !eval type something = ref ref ref ref object |
04:06:35 | NimBot | <no output> |
04:06:39 | FromDiscord | <Rika> it compiles... |
04:06:44 | * | supakeen joined #nim |
04:06:47 | FromDiscord | <Rika> horror right here |
04:07:02 | FromDiscord | <Rika> who needs double indirection when theres quadruple indirection |
04:07:05 | leorize[m] | !eval echo repr (ref ref ref ref ref ref RootObj)() |
04:07:06 | NimBot | Compile failed: /usercode/in.nim(1, 44) Error: object constructor needs an object type |
04:07:39 | leorize[m] | !eval echo repr new(ref ref ref ref ref ref RootObj) |
04:07:40 | FromDiscord | <Rika> !eval type something = ref ref ref ref object; echo repr new new new new something |
04:07:42 | NimBot | Compile failed: /usercode/in.nim(1, 64) Error: type mismatch: got <something> |
04:07:43 | NimBot | ref 0x7f84a4295048 --> nil↵ |
04:07:49 | FromDiscord | <Rika> oh lord |
04:07:57 | FromDiscord | <Elegant Beef> lol |
04:08:14 | FromDiscord | <Rika> this is horror |
04:08:21 | FromDiscord | <Elegant Beef> We're super high IQ now, we can do quantum mechanics by hand without any thinking |
04:21:29 | FromDiscord | <Elegant Beef> Now if only there was a good place to put this without creating dependancy hell 😄 |
04:23:39 | * | sasamba joined #nim |
04:23:56 | sasamba | How can I interrupt endless cycle in asyncChecked proc? :) |
04:24:14 | FromDiscord | <Elegant Beef> We need a `communitysugar` module that has all these small sugar macros as sub files so there is a reason to post it to nimble 😄 |
04:24:39 | leorize[m] | that's like, fusion |
04:24:53 | FromDiscord | <Elegant Beef> Ah |
04:24:56 | FromDiscord | <Elegant Beef> Nice |
04:32:49 | * | disruptek sighs. |
04:33:22 | FromDiscord | <Elegant Beef> Dies. |
04:35:36 | FromDiscord | <Rika> flies. |
04:40:57 | * | Senketsu quit (Ping timeout: 260 seconds) |
04:41:01 | * | bebarker quit (Ping timeout: 264 seconds) |
04:44:16 | * | bbarker joined #nim |
04:58:56 | * | narimiran joined #nim |
05:08:21 | * | Jesin quit (Read error: Connection reset by peer) |
05:10:04 | * | Jesin joined #nim |
05:25:43 | * | Tongir joined #nim |
05:25:45 | * | ftsf_ joined #nim |
05:25:47 | * | Tlanger quit (Read error: Connection reset by peer) |
05:28:50 | * | ftsf quit (Ping timeout: 265 seconds) |
05:31:18 | * | liblq-dev quit (Quit: WeeChat 2.8) |
05:37:03 | * | solitudesf joined #nim |
05:47:27 | * | lritter quit (Remote host closed the connection) |
05:59:39 | * | sasamba quit (Ping timeout: 245 seconds) |
06:00:36 | * | Satomi-Kowa joined #nim |
06:03:54 | * | fredrikhr quit (Remote host closed the connection) |
06:04:11 | * | fredrikhr joined #nim |
06:11:52 | * | Senketsu joined #nim |
06:18:20 | * | Trustable joined #nim |
06:26:42 | skrylar[m] | arguably quantum computing is just using floats instead of bits, and then you only ever get uniqueptrs xD |
06:57:49 | * | solitudesf quit (Ping timeout: 264 seconds) |
06:58:27 | * | PMunch joined #nim |
07:00:14 | PMunch | Hmm, does `{.threadvar.}` work even if it isn't Nim who's creating the threads? |
07:02:14 | * | JustASlacker joined #nim |
07:13:05 | * | Senketsu quit (Ping timeout: 252 seconds) |
07:18:28 | PMunch | @Technisha Circuit, I was looking through the IRC logs and saw you asking about embedding Python in Nim. I've seen it done in a C program so I think it should be fairly doable. |
07:19:10 | Zevv | I guess so - it just emits __thread on your variable |
07:19:22 | Zevv | it's the compiler doing the work here, not Nim |
07:19:22 | PMunch | Hmm |
07:19:51 | PMunch | I'm getting this annoying segfault in my program, but it doesn't tell me where.. |
07:19:59 | * | Zevv sings the valgrind song |
07:20:12 | PMunch | Yeah I guess I could try gdb/valgrind.. |
07:20:18 | PMunch | But it's inside a docker container.. |
07:20:26 | Zevv | that's your own fault, not mine |
07:20:34 | PMunch | Haha, true :P |
07:20:54 | PMunch | Hmm, I guess I can run it without the container now that I think about it |
07:21:04 | Zevv | so much masochism in the world today. docker galore |
07:21:22 | Zevv | I had sooo much fun. My $customer needed IPv6 in kubernetes. |
07:21:29 | Zevv | But in 2020, its kind of a no-no |
07:21:29 | Zevv | to do that |
07:22:07 | PMunch | What? |
07:22:16 | PMunch | IPv6 should be standard everywhere.. |
07:22:50 | Zevv | yeah, that was kind of my point. This is so ridiculous |
07:23:13 | Zevv | I know next to nothing about all that kubernetes stuff and docker and all |
07:23:20 | FromGitter | <sheerluck> so we should implement kubernetes in Nim, right? |
07:23:32 | PMunch | Nimberenetes |
07:23:50 | Zevv | but I do know my drills about ipv6 and containerezation, so I'm perfectly able to get something working with low level networking stuff. But there is hardly an adminisrative way to do this in k8s |
07:23:59 | PMunch | Well I find docker great for being able to build a container that contains all the libraries and systems required |
07:24:18 | PMunch | So I can just push the docker image and our ops team can deploy it on our servers |
07:24:34 | Zevv | I stopped having opinions about this stuff. |
07:24:40 | Zevv | I'm an old grunt I guess |
07:24:42 | PMunch | No need for me to tell them to read the README where I describe the dependencies and file structure required |
07:24:56 | FromDiscord | <Elegant Beef> Well i mean doesnt that also apply to appimage? |
07:25:32 | FromDiscord | <Elegant Beef> I've never used containerized environments outside of snap/appimages 😄 |
07:25:34 | Zevv | so much administrative and mental overhead in all that stuff. |
07:25:38 | PMunch | Hmm, I haven't really used appimage, but maybe |
07:25:44 | livcd | I find docker great for one thing |
07:26:50 | FromGitter | <bung87> mostly ops get benefit |
07:27:51 | Zevv | I hate it so much. I have this app I need to run in docker and it emits verbose logging of all GL commands happening in an AOSP container. That's quite a bit. Usually loading up a log file of 100mb in less or vi happens in an instant. But no, `docker-compose logs' needs 25 seconds to get my log out |
07:27:56 | Zevv | Why the hell?! |
07:28:16 | livcd | you dont see the big picture! |
07:28:24 | livcd | you are not supposed to view the logs that way |
07:28:25 | Zevv | And really, IPv6 *that* hard? And then still I need to do IPv6 masquerading! Ha! |
07:28:32 | livcd | You have to collect them in splunk & friends |
07:29:35 | PMunch | Zevv: https://www.youtube.com/watch?v=y8OnoxKotPQ |
07:29:50 | Zevv | and now I have these kids running around talking about calilo, pods, ipam, configmap, EKS, AKS, GKE and kubeadm |
07:29:56 | Zevv | and I see them writing yaml config files with json in there |
07:30:01 | Zevv | it really hurts, it hurts so much |
07:30:44 | Zevv | PMunch: yes, sooo yes |
07:30:56 | FromGitter | <sheerluck> so basically you are saying I need to `ssh` to host with VirtualBox with Lubuntu to run doker to run python script to use IPv6 in Nim to download some yaml config files |
07:31:13 | Zevv | I don't know. I gave up on "IT" |
07:31:40 | Zevv | I am now demoted to the beard. I debug and fix stuff and do the plumbing. |
07:31:49 | Zevv | works just fine for me. |
07:32:41 | Zevv | the other 50% of the time I spend argueing with architects. So my next business card will say "architectural plumber" |
07:32:45 | Zevv | and proud of it |
07:32:59 | PMunch | Haha :P |
07:34:18 | Zevv | btw, I yesterday whipped up a somewhat crude VM profiler for shashlik. I'm not sure if it is suitable to make a PR for because I'm a bit ashamed, but it seems waste to just throw it away. Does someone feel this is worth making into something? |
07:34:56 | Zevv | this is what it looks like: http://ix.io/2mMG |
07:34:59 | Araq | Zevv, it's only worth doing when you blog about it afterwards |
07:35:17 | Zevv | Then I might as well stop doing anything at all. |
07:35:30 | PMunch | Haha |
07:35:43 | Zevv | I tried that a few times, but it just doesn't work for me. |
07:37:39 | PMunch | Hmm, does finalisers work with markandsweep? |
07:42:05 | Zevv | well, do they? |
07:42:21 | PMunch | I dunno |
07:43:08 | PMunch | I think I've tracked by crash back to my cache |
07:43:35 | PMunch | And it does two things, use global memory (woops) and use finalisers |
07:43:44 | PMunch | With thredavar it was still crashing |
07:44:38 | PMunch | Oh well, gotta walk the dog |
07:45:48 | Zevv | that what dogs are for, right |
07:46:13 | FromDiscord | <Elegant Beef> nah they take humans for walks very rarely the other way around |
07:47:37 | * | liblq-dev joined #nim |
07:47:59 | Zevv | that's the whole point of me having a dog |
07:48:03 | Zevv | it's taking me off my couch |
07:48:33 | * | bebarker joined #nim |
07:49:41 | skrylar[m] | i thought that was cats |
07:50:17 | * | Satomi-Kowa quit (Ping timeout: 260 seconds) |
07:51:54 | * | bbarker quit (Ping timeout: 265 seconds) |
07:53:01 | FromDiscord | <Elegant Beef> Well cats just make you leave the house not be active |
07:53:15 | FromDiscord | <Elegant Beef> No one wants to hear meowing at 4am for no reason |
07:55:28 | livcd | the whole `devops` bullshit is just that... `bullshit` |
07:57:49 | * | dadada joined #nim |
07:58:13 | * | dadada is now known as Guest150 |
08:06:57 | * | Trustable quit (Remote host closed the connection) |
08:11:41 | alehander92 | morning |
08:11:49 | alehander92 | pmunch wow |
08:11:52 | alehander92 | you have a dog |
08:11:57 | alehander92 | does it like snow |
08:13:43 | livcd | :D..you know it looks funny...at least to me..I already had 2 beers |
08:17:46 | * | zedeus quit (Ping timeout: 246 seconds) |
08:19:41 | * | zedeus joined #nim |
08:36:17 | skrylar[m] | i was always told devops was just programmers who were made to run the servers |
08:37:34 | skrylar[m] | i will also admit there's one or two very specific setups that seemed kinda interesting; mostly the ones where you had a nomad/terraform config or a nixos config as text and then you could put those in phabricator where all the audit/code review lived, and then you just kinda have the one forum-like place where all the crap is sourced from. |
08:37:43 | PMunch | alehander92, it's not really my dog unfortunately. There is a "wilderness experience centre" close to where I live. Since they don't have any tourists anymore they have been asking for people if they want to keep one of their dogs for a while. They're all sledding dogs, and so he loves snow. He's used to sleeping outside in it :P And yes Zevv, it's great for getting me out of the house. Without him I would just be sat at my desk all day.. |
08:38:06 | * | xace quit (Ping timeout: 260 seconds) |
08:41:20 | * | neceve joined #nim |
08:42:27 | PMunch | Hmm, removing the global cache didn't seem to fully eliminate the problem.. I got a stack smashing error from select in my Http get call. |
08:42:46 | PMunch | (every time I need to get something I create a new client, so it's not a shared client) |
08:46:47 | PMunch | Now I got a SIGABRT: http://ix.io/2mN1 |
08:47:00 | PMunch | Ah no, it's the same: http://ix.io/2mN2 |
08:49:56 | * | xace joined #nim |
08:51:04 | * | krux02 joined #nim |
08:53:00 | PMunch | I even have that section in a lock.. |
08:53:18 | PMunch | So only one thread at a time uses it.. |
08:53:30 | PMunch | Is HttpClient not possible to use from multiple threads? |
08:57:37 | alehander92 | is it somehow possible to gdb it |
08:58:04 | PMunch | Yeah I guess I can |
08:58:20 | alehander92 | otherwise, impressive, i hope it likes the summer too now :D |
09:03:11 | PMunch | TBH he seems pretty happy no matter what's going on |
09:03:15 | PMunch | Except from getting into the car |
09:03:29 | PMunch | He doesn't mind driving, or being in the car, but getting in he hates.. |
09:05:08 | alehander92 | he doesnt mind driving |
09:05:21 | alehander92 | he's not so fond of all the formula1 years |
09:05:24 | alehander92 | a bit exhausting |
09:05:57 | alehander92 | but just driving around, eating a bone while donutting on the ice rink |
09:06:15 | alehander92 | still reminds him of the happy years as volvo tester dog |
09:12:41 | PMunch | Haha |
09:13:33 | PMunch | He did try to jump in my lap once when I was driving |
09:13:47 | PMunch | And considering he's quite a big dog that wasn't a great scenario |
09:14:49 | alehander92 | :)) |
09:15:08 | alehander92 | can he have a belt on |
09:16:08 | PMunch | I guess he could, but as he's not wearing pants I don't really see the point |
09:16:32 | FromDiscord | <willyboar> 1-1 |
09:16:42 | PMunch | Haha :P |
09:16:50 | alehander92 | well, a seatbelt :D |
09:16:57 | alehander92 | otherwise, he can wear pants |
09:17:40 | PMunch | I don't think seatbelts would work for a dog unfortunately |
09:17:41 | alehander92 | but only if they match his sled |
09:17:54 | PMunch | At least not the normal one |
09:18:12 | PMunch | I tend to tie him down in the back of the car |
09:18:29 | alehander92 | i think you need a teacher for him |
09:18:40 | PMunch | To teach him what? |
09:18:47 | PMunch | He's not the brightest.. |
09:18:49 | alehander92 | a friend of mine says his dog learned how to not bother him during driving |
09:18:53 | * | fanta1 joined #nim |
09:18:56 | alehander92 | well get him a lamp |
09:19:40 | PMunch | Hmm, when not running in docker it takes a while and then I get a "Device or resource busy" |
09:29:58 | skrylar[m] | heh. reading some of these compression libs |
09:30:26 | skrylar[m] | it amuses me how many sloc are behind some of these compressors, and then something like fastlz or density are barely any code and they're almost as good |
09:30:40 | skrylar[m] | zstd is huge |
09:31:47 | skrylar[m] | https://github.com/ariya/FastLZ/blob/master/fastlz.c entire thing is ~500 and i'd guess a bit of that is c cruft. https://github.com/facebook/zstd/blob/dev/lib/decompress/zstd_decompress.c this isn't even the entire decompressor and its already ~3x that |
09:32:41 | * | solitudesf joined #nim |
09:35:21 | * | marquisdefalbala joined #nim |
09:36:02 | Zevv | PMunch: strace? |
09:36:22 | PMunch | Hold on, I'm tracking what I think might be the bug.. |
09:38:45 | dom96 | PMunch, Snow puppers? :O |
09:38:55 | dom96 | You're really making me want to move to Norway |
09:39:19 | dom96 | Sounds like I should visit that experience center at least to support them via my own tourism :D |
09:40:34 | PMunch | You can go dog sledding there, it's pretty fun |
09:40:34 | * | Vladar joined #nim |
09:40:49 | PMunch | Would it help if I said I still have over a meter of snow in my garden? |
09:41:01 | dom96 | Yes :D |
09:41:12 | dom96 | Where is this picture of that pupper, can't see it |
09:42:27 | PMunch | I didn't send one :P |
09:42:51 | PMunch | Here you go: https://photos.app.goo.gl/Ezt44RGoM3gmk8Nu6 |
09:43:05 | dom96 | oh I guess you just talked about the dog |
09:43:08 | PMunch | (he get's a bit suspicious when I take photos of him :P) |
09:43:10 | dom96 | I skimmed the IRC logs :) |
09:43:56 | FromGitter | <sheerluck> oh so you are Peter Munch-Ellingsen |
09:44:01 | dom96 | Awww, looks like he needs lots of snacks |
09:44:48 | PMunch | sheerluck, you say that like you know who I am? :P |
09:45:54 | alehander92 | ohh nice dog |
09:45:55 | alehander92 | indeed |
09:49:01 | * | abm joined #nim |
09:56:28 | * | Trustable joined #nim |
10:05:09 | * | brainbomb joined #nim |
10:05:48 | FromGitter | <jorjun_twitter> Can anybody summarise the nim news so far or tell me where to get it? I am generation X so there is no implied irony or self-deprecation or satyrical aim. |
10:06:53 | PMunch | Nim news since when= |
10:06:56 | FromGitter | <jorjun_twitter> My point of view is scripter who wants to take advantage of collossal machine power we now have as commodity. Either on Web or iOT or a gaming |
10:08:02 | FromGitter | <jorjun_twitter> Just a brief. Like should I try and make a native version of SDL or chip in with some random github project? How do I help ? Who is sponsoring. Are they evil? Can I ta |
10:08:27 | FromGitter | <jorjun_twitter> Can I/ should I take a punt on this new stack. I know right now it is incredibly niche. But I was like this with Python in 1996 |
10:10:22 | FromGitter | <jorjun_twitter> I drop in from time to time and just get a sense that good beavering is happening and there is no spare resource for communication which is natural and expected. I love the tech. I trained a bit. How should i get further in.. should I just get more app dev experience and shut up? |
10:12:45 | FromGitter | <jorjun_twitter> Perhaps the project is more private for now than a public free-for-all |
10:15:09 | PMunch | It's definitely not private |
10:15:13 | FromGitter | <jorjun_twitter> me? I ultra small family business we run one web site that makes ad revenue income. Otherwise we’re doing speculative product dev., currently targetting a small IoT venture. and web dev. |
10:15:23 | skrylar[m] | well its stable now (1.2) at least |
10:15:45 | PMunch | I think the best way to get into Nim is to just try to make some small stuff with it |
10:16:10 | FromGitter | <jorjun_twitter> the js compiler output I saw looked so bloated wasn't sure if I could gain from moving to nim |
10:17:36 | FromGitter | <sheerluck> @jorjun_twitter try it and you will fall in love with Nim |
10:17:55 | FromGitter | <jorjun_twitter> PMunch + Andrew, thanks. Already have, had great experience so far. |
10:18:59 | PMunch | Don't worry about the JS output |
10:19:02 | FromGitter | <jorjun_twitter> But it is all entirely discarnate entity, the founder is quite easy to see - public persona. Not many others. No sense of community yet. I am going to need to collaborate to get the geeky specifics I need, I think |
10:19:03 | PMunch | It's efficient |
10:19:14 | FromGitter | <jorjun_twitter> good to know... |
10:19:59 | FromGitter | <jorjun_twitter> I just wrote a small webRTC thing in typescript which would be much better expressed in Nim. Was astonished at speed of js. I can make simple realtime effect filters. |
10:22:04 | FromGitter | <jorjun_twitter> But if I want to make a fast game / something. Immediately I am up against established libraries, something-GL for web or SDL for other platforms. There aren’t enough full-native options. Hoping that will change I guess. There’s an immediate impedance mismatch for noobs not used to native interfacing |
10:23:10 | FromGitter | <jorjun_twitter> I could have gone down native code route, but C++ completely turned me off. I did compiler stuff for ten years but only on commercial platforms. So, it’s conflicting feeling to love a new language and then immediately have to try to contend with all that C and C++ shit that you tried to escape from. |
10:24:10 | skrylar[m] | well most js code ends up bundled with jquery or similar, so the overhead nims runtime bloats up the js output is comparable to normal javascript |
10:24:13 | FromGitter | <jorjun_twitter> Nearly all the difficulty surrounds memory management, I suppose. Staying with Nim it is mostly a non-issue. But we can't |
10:25:21 | FromGitter | <jorjun_twitter> I am going to run a trial next then Skrylar, I have some webRTC code which will show me if there are performance issues quickly. thanks. Guys. Will drop in another time. And leave you be. Bon chance. |
10:26:09 | dom96 | @jorjun_twitter let us know what you find, many of us are using the JS backend and would love to see benchmarks |
10:26:51 | skrylar[m] | i dont think the js code is any slower than normal; there's just some rtl cruft that makes it look scary if your scripts are small |
10:28:11 | skrylar[m] | having said that i just tried to compile something to js and crashed the compiler ._.; |
10:28:21 | PMunch | Hmm, might have some load-time penalties though since it wouldn't be possible to cache it |
10:28:47 | skrylar[m] | why wouldn't you be able to cache nimjs |
10:30:05 | PMunch | Is it a separate file? |
10:30:18 | PMunch | I thought it all got bundled into one script |
10:31:25 | skrylar[m] | sure, it's not modular. but the blob is still cachable |
10:32:18 | PMunch | What I meant was that either your browser or some local node will have jquery cached |
10:32:31 | PMunch | So loading a small script that uses jquery only needs to load the small script |
10:32:45 | skrylar[m] | sure but don't you end up paying to init all of jquery constantly since it doesn't get dead code elim'd |
10:32:56 | PMunch | True |
10:33:06 | PMunch | Depends on network speed I guess |
10:33:28 | dom96 | I did some webasm benchmarks and was very unimpressed |
10:33:38 | dom96 | which makes me wonder what the hype is about |
10:33:58 | skrylar[m] | did you test against assemblyscript |
10:34:16 | skrylar[m] | i've never seen emscripten output that was all that satisfying |
10:34:24 | dom96 | I didn't use emscripten |
10:34:40 | dom96 | I implemented fib myself |
10:34:44 | dom96 | + used Rust's output |
10:35:01 | dom96 | and also looked at a benchmarking site which had a fib benchmark |
10:35:09 | dom96 | for wasm vs. js |
10:35:15 | skrylar[m] | native client was nice.. but they killed it :\ |
10:35:31 | dom96 | but I bet most of the slowness I saw was due to JS<->WASM communication |
10:35:53 | skrylar[m] | possibly. it probably varies between fox and chrome too |
10:36:21 | dom96 | https://takahirox.github.io/WebAssembly-benchmark/ |
10:36:22 | skrylar[m] | i saw some crypto people get decent performance out of wasm but it was because they used a wasm->llvm->dll layer and were transpiling it, which the browsers dont do |
10:37:02 | dom96 | huh, on my laptop webasm wins |
10:37:05 | dom96 | but on my desktop it doesn't |
10:37:33 | skrylar[m] | Result (average [ms]) JavaScript: 990.0000 WebAssembly: 810.0000 JavaScript/WebAssembly: 1.2222 |
10:37:58 | skrylar[m] | that is a horrifying margin considering |
10:38:13 | dom96 | JS still wins collision detection on my laptop though |
10:38:23 | skrylar[m] | isn't wasm even static typed and no-gc |
10:38:41 | dom96 | yep |
10:39:09 | * | skrylar[m] is confuzzled. |
10:39:33 | dom96 | maybe the JS JIT'ing really is just that good |
10:39:59 | dom96 | they had many years to optimise it and lots of reason to after all |
10:40:17 | FromGitter | <jorjun_twitter> dom96 Really did not expect to be able to grab real time video frame and mess with them and put the result back on a canvas |
10:40:36 | alehander92 | i think js<->wasm was slow |
10:40:39 | alehander92 | at one point |
10:40:56 | skrylar[m] | https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%F0%9F%8E%89/ looks like theres a lot of crap between the vms |
10:41:21 | dom96 | In case you want to try the benchmark I did: https://gist.github.com/dom96/b9d613396f3cdedd9e45438ce23f7d04 |
10:42:00 | dom96 | IIRC it was 22mil ops/s for WASM and 44mil ops/s for JS |
10:42:42 | alehander92 | please try on firefox as well |
10:44:14 | alehander92 | and are you sure any of the console logs dont happen somehow inside this time |
10:44:15 | * | Tlanger joined #nim |
10:44:29 | dom96 | This was in Firefox |
10:44:57 | dom96 | what console logs? |
10:45:03 | dom96 | There are no console logs during the benchmark |
10:46:09 | alehander92 | ah i am just not sure |
10:46:15 | alehander92 | how the api of this suite works, sorry |
10:46:34 | * | Tongir quit (Ping timeout: 240 seconds) |
10:49:18 | alehander92 | then, you're right, strange |
10:49:26 | dom96 | give it a try :) |
10:49:57 | dom96 | I think it is still a bit unfair, because JS<->WASM certainly will always have some significant overhead |
10:50:17 | alehander92 | yeah, i tried :) |
10:50:20 | dom96 | Ideally I would need to measure time in WASM and JS |
10:50:25 | alehander92 | the browser one, not yours |
10:50:51 | alehander92 | but yeah once there is direct access to browser from wasm |
10:50:53 | alehander92 | it would be good |
10:51:36 | PMunch | Hmm, so I really need the cache, but I can't keep it global because the VM freaks out |
10:51:44 | PMunch | s/VM/GC |
10:53:06 | * | neceve quit (Ping timeout: 256 seconds) |
10:56:14 | alehander92 | can't you put locks |
10:56:17 | alehander92 | around accesses |
10:57:37 | PMunch | I already have |
10:58:18 | alehander92 | isn't sharedtable for |
10:58:20 | alehander92 | cases like that |
10:59:07 | PMunch | I guess |
10:59:14 | PMunch | But my cache is a bit more complicated than that |
10:59:30 | alehander92 | btw why http://web.mit.edu/nim-lang_v0.16.0/ |
11:06:03 | * | madpata quit (Quit: Lost terminal) |
11:12:40 | PMunch | It's a bit odd that threadvar didn't work though isn't it? |
11:16:55 | PMunch | Realised I had put the initCache call in the global initialiser still.. |
11:17:34 | * | xace quit (Ping timeout: 240 seconds) |
11:17:36 | PMunch | Seems stable so far with "if pubKeyCache == nil: pubKeyCache = initCache()" |
11:17:43 | PMunch | In the operate procedure |
11:22:09 | PMunch | Memory consumption seems stable as well |
11:25:56 | * | brainbomb quit (Quit: Leaving.) |
11:30:26 | * | xace joined #nim |
11:30:46 | * | solitudesf quit (Quit: Leaving) |
11:31:31 | PMunch | Holy shit, NimLSP is using a solid 300MB of RAM.. |
11:31:34 | PMunch | That's not good |
11:31:54 | PMunch | I'm guessing that's nimsuggests fault? |
11:47:03 | * | solitudesf joined #nim |
11:56:01 | * | rockcavera joined #nim |
11:58:22 | * | sz0 joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 1.9.1) |
12:06:42 | * | supakeen joined #nim |
12:27:14 | * | fredrikhr quit (Ping timeout: 256 seconds) |
12:34:37 | * | Vladar quit (Quit: Leaving) |
12:53:19 | * | Guest150 quit (Ping timeout: 258 seconds) |
12:55:02 | * | dadada joined #nim |
12:55:26 | * | dadada is now known as Guest87103 |
12:59:49 | * | dcmertens joined #nim |
13:01:01 | dcmertens | Here's a question about language design philosophy and nim |
13:01:08 | dcmertens | I am reading through Nim in Action |
13:01:10 | dcmertens | it's nice! |
13:01:21 | dcmertens | nim's handling of modules is quite nice |
13:01:41 | dcmertens | but when we import threadpool, we have to compile with --threads:on |
13:02:02 | dcmertens | is there any reason that the importing of the module itself doesn't turn this on for us? |
13:02:33 | dcmertens | I know I can put the configuration into a .nims file, but this is philosophically different from what you get with scripting languages |
13:02:52 | dcmertens | where (nearly) all of the configuration is in the software itself |
13:03:20 | FromDiscord | <Rika> ~~because this isnt a scripting language~~ |
13:03:38 | dom96 | because --threads:on is a global flag, rather than a per-module flag |
13:03:38 | dcmertens | indeed, and that is what I like about nim. :-) |
13:03:45 | FromDiscord | <Clyybber> yeah, automatically turning --threads:on might not be a stupid idea |
13:03:49 | dcmertens | dom96, thanks |
13:03:52 | FromDiscord | <Clyybber> or making it the default rather |
13:04:19 | FromGitter | <zetashift> why is it not the default? |
13:04:45 | FromGitter | <zetashift> Maybe there was/is a reason behind it :O |
13:04:45 | FromDiscord | <Rika> maybe it has overhead somehow |
13:04:57 | PMunch | Performance I'm guessing |
13:05:26 | dcmertens | how many globals are handled by nim? When we use threads, does it have to copy all of them? |
13:05:28 | PMunch | Some modules might have a switch to check if threads are on and only then lock access to things |
13:05:55 | FromDiscord | <mratsim> Nim can handle up to 3200 globals |
13:06:06 | dcmertens | In Perl, spawning a thread is costly because it has to copy the entire interpreter state. |
13:06:06 | FromDiscord | <Clyybber> dcmertens: There are globals, and there are threadvars |
13:06:27 | dcmertens | to be clear, I'm not talking about user-defined globals, I mean nim's execution state |
13:06:31 | FromDiscord | <mratsim> --threads:on has overhead especially on memory allocation as the GC now uses locks |
13:06:50 | FromDiscord | <Clyybber> ah |
13:07:39 | dcmertens | well, thanks all for discussing my question. :-) |
13:08:39 | dom96 | --threads:on also adds dependencies which I've seen cause problems |
13:11:24 | CcxWrk | Changing the process to multithreaded modifies behaviour of some POSIX functions IIRC. So simple programs generally avoid it there. |
13:11:24 | FromGitter | <jorjun_twitter> gotta convert this TS: `navigator.mediaDevices ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ ` [https://gitter.im/nim-lang/Nim?at=5ec52c7c5ad7623956f455ef] |
13:12:05 | FromGitter | <jorjun_twitter> should I use the sugar import and try to match it close as poss? |
13:12:09 | PMunch | dcmertens, I don't think Nim has a lot of state it needs to copy over |
13:12:23 | PMunch | But threads are still expensive to create because of the OS |
13:12:41 | PMunch | But expensive =/= expensive |
13:13:16 | dcmertens | PMunch, right |
13:13:50 | dcmertens | jorjun_twitter, what is "TS"? |
13:13:57 | FromGitter | <jorjun_twitter> typescript |
13:14:01 | PMunch | TypeScript I'm guessing |
13:14:18 | dcmertens | ah, thanks |
13:16:35 | dcmertens | Actually, coming back to my original question: is there any circumstance in which a programmer would import threadpool and *not* want --threads:on? |
13:16:55 | Yardanico | threadpools requires --threads:on anyway :D |
13:17:17 | dcmertens | Can a module turn this on, or just a nimscript file? |
13:18:02 | FromDiscord | <mratsim> only the nim.cfg file or nimscript file |
13:18:03 | FromDiscord | <Clyybber> only a nimscript file, or .cfg file |
13:18:07 | Yardanico | lol |
13:18:15 | FromDiscord | <Clyybber> since when the module is processed it might be too late to turn threads:on |
13:18:32 | dcmertens | Clyybber, true, but nim supports some level of compile-time code execution |
13:18:47 | FromDiscord | <Clyybber> yes |
13:18:55 | FromDiscord | <mratsim> it's beyond "some level" but not up to compiler flags 😉 |
13:18:55 | FromDiscord | <Clyybber> But that doesn't change the order problem |
13:19:06 | FromDiscord | <mratsim> the C compiler flags yes though |
13:19:39 | dcmertens | mratsim, got it. Some day I hope to know enough about nim to understand why that is the case |
13:19:47 | FromDiscord | <Clyybber> dcmertens: You would have to follow all imports first, look for threads, turn it on and then reprocess all of them |
13:19:54 | dcmertens | but for now, I'll just patiently read Nim in Action |
13:20:03 | FromDiscord | <Clyybber> because other modules might change their behaviour depending on wether --threads is on or off |
13:20:07 | dcmertens | Clyybber, yeah, that's what I would have expected |
13:20:08 | FromDiscord | <Clyybber> with locks and such |
13:21:00 | dcmertens | I would have expected nim too process the entire import dependency chain before compilation |
13:21:04 | * | fredrikhr joined #nim |
13:21:57 | FromDiscord | <Clyybber> it gets done during compilation |
13:22:03 | FromDiscord | <Clyybber> because you can have conditional imports |
13:22:23 | FromDiscord | <Clyybber> like `when condition: import somemodule` |
13:22:55 | Yardanico | ah btw guys I completed making the graph yesterday, although didn't visualize it in a good way yet https://gist.githubusercontent.com/Yardanico/4d25f7395af01b06cf9035c8024f02c6/raw/192dca7c9cb2747e5ab2030baab08a59748434f3/graph.svg |
13:23:05 | Yardanico | almost all packages in nimble are there with their dependencies |
13:23:23 | FromDiscord | <Clyybber> @Yardanico Btw are you not in #test ? |
13:23:34 | Yardanico | I only use #test when testing ircord :P |
13:23:39 | FromDiscord | <Clyybber> ah alright |
13:23:40 | Yardanico | other times it's not bridged |
13:24:21 | FromDiscord | <Rika> Yardanico: whys there one package with the full url |
13:24:26 | FromDiscord | <Rika> actually many |
13:24:41 | * | dcmertens looks up treesitter |
13:24:51 | Yardanico | @Rika they're the ones which are not in nimble |
13:25:06 | Yardanico | or just specified as github urls in the nimble file |
13:25:15 | Yardanico | you know you don't have to specify *only* nimble pkgs, right? |
13:25:22 | Yardanico | you can specify any git/hg url |
13:25:32 | PMunch | And what would you do if one module tried to turn threads off and another tried to turn them on? |
13:25:37 | dom96 | Yardanico, wow, that's cool |
13:26:28 | Yardanico | right now I lowercase all packages and remove _ |
13:26:37 | Yardanico | because ast_pattern_matching is the same as astpatternmatching :P |
13:26:50 | PMunch | So an arrow means that the package depends on what it is pointing at right? |
13:26:53 | Yardanico | yes |
13:26:57 | Yardanico | no arrows - no dependencies |
13:27:11 | Yardanico | dom96: btw I did the parsing for all different .babel and .nimble (both ini and nims) with npeg :DD |
13:27:19 | dcmertens | PMunch, isn't that going to be a problem no matter what? |
13:27:21 | Yardanico | one thing though is that if a package has test dependencies - they'll be included as normal ones here |
13:27:38 | PMunch | dcmertens, why? |
13:27:55 | Yardanico | https://play.nim-lang.org/#ix=2mNM that's the parser |
13:28:02 | PMunch | I mean one of the packages would now output an error saying it can't run with threads, and the other would say that it required threads |
13:28:02 | dcmertens | PMunch, if a module doesn't like threads, and you're trying to use them, you're out of luck, right? |
13:28:05 | Yardanico | of course I also do some other stuff later like remove version specifiers |
13:28:10 | PMunch | Depending on how you switch the threads:on switch |
13:28:16 | dom96 | Yardanico, whyyy not just use Nimble? |
13:28:23 | Yardanico | dom96: for 1.3k repos? :) |
13:28:26 | Yardanico | I cloned them all locally |
13:28:34 | * | ftsf_ quit (Ping timeout: 246 seconds) |
13:28:36 | PMunch | I mean the compiler could have an error message for this, something like "conflicting switching of threads" or something |
13:28:46 | dcmertens | PMunch, right |
13:28:50 | FromDiscord | <Rika> dcmertens: there's a difference between a module not liking threads and a module explicitly disabling them |
13:28:52 | dom96 | Yardanico, yeah? Why not? Too slow? |
13:29:06 | Yardanico | well how can I tell nimble to show me package dependencies without installing them? |
13:29:13 | PMunch | Yardanico, could you tell dot to make the graph prettier? |
13:29:22 | PMunch | Like not overlap the arrows over nodes |
13:29:25 | Yardanico | PMunch: well I experimented a bit but still haven't found anything nice |
13:29:28 | Yardanico | I can do -Goverlap=scale |
13:29:30 | dom96 | Yardanico, I mean use Nimble's code |
13:29:31 | Yardanico | but then the graph is HUGE |
13:29:34 | dom96 | to parse the .nimble file |
13:29:43 | Yardanico | dom96: well it was easier to just do this with npeg :D less code |
13:30:07 | PMunch | Yardanico, do you have the .dot file? I can try to see if I can find something |
13:30:11 | * | couven92 joined #nim |
13:30:11 | Yardanico | yeah |
13:30:13 | PMunch | Can't remember the flag I use |
13:30:38 | * | fredrikhr quit (Disconnected by services) |
13:30:38 | * | couven92 is now known as fredrikhr |
13:30:40 | Yardanico | PMunch: https://transfer.sh/16iU1i/deps_nothing.dot |
13:30:53 | * | couven92 joined #nim |
13:31:01 | Yardanico | it's the most plain simple .dot file just like the nim compiler makes |
13:32:06 | bebarker | so far my understanding of Nim is that an object can't have both immutable and mutable members: it is either completely immutable or completely mutable, is that right? |
13:32:24 | Yardanico | well you can do mixed if you use getters/setters |
13:32:43 | Yardanico | like don't export the fields of an object and only export getters for all fields and setters for fields you want to be mutable |
13:32:53 | bebarker | Yardanico, ah right |
13:35:07 | Yardanico | dom96: btw around 66% nimble packages don't have any dependencies :P |
13:35:18 | FromGitter | <jorjun_twitter> found this: https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers |
13:36:50 | PMunch | Yardanico, what are you using now? |
13:36:57 | Yardanico | PMunch: what do you mean? |
13:37:05 | PMunch | To generate the graph |
13:37:09 | PMunch | What arguments |
13:37:21 | * | raskol joined #nim |
13:37:21 | * | raskol quit (Client Quit) |
13:37:29 | Yardanico | I think it was sfdp |
13:38:02 | Yardanico | and almost no args, only -Goverlap=prism and -Gpack=false I think |
13:38:03 | Yardanico | graphviz is confusing :D |
13:38:20 | * | raskol joined #nim |
13:38:20 | * | raskol quit (Client Quit) |
13:39:43 | Yardanico | This is how I do parsing btw (yes it's not that pretty but it works and fast :P) https://github.com/Yardanico/nim-snippets/blob/master/pkgraph/parse.nim |
13:41:23 | * | raskol joined #nim |
13:41:23 | * | raskol quit (Client Quit) |
13:42:01 | * | raskol joined #nim |
13:42:01 | * | raskol quit (Client Quit) |
13:43:39 | Yardanico | btw after cloning like 1k repos github limited my download speed so I had to use a VPN :D |
13:43:53 | Yardanico | I did shallow clones though |
13:44:27 | * | couven92 quit (Ping timeout: 256 seconds) |
13:44:37 | dom96 | no reason to clone it to be honest |
13:44:57 | dom96 | just request projectName.nimble file :P |
13:45:17 | disruptek | that won't work for all packages, sadly. |
13:46:24 | * | NimBot joined #nim |
13:48:52 | * | couven92 joined #nim |
13:55:36 | PMunch | Yardanico, add -Gsplines=true |
13:55:50 | PMunch | And listen to your computer trying to fly away for a little while :P |
13:56:27 | FromDiscord | <Technisha Circuit> > @Technisha Circuit Circuit, I was looking through the IRC logs and saw you asking about embedding Python in Nim. I've seen it done in a C program so I think it should be fairly doable.↵Instead of Python I'd want to do it with NimScript because NimScript ftw |
13:56:40 | * | raskol joined #nim |
13:57:40 | FromDiscord | <Technisha Circuit> (edit) 'NimScript' => 'Nim' |
13:58:20 | PMunch | And Yardanico you should generate a colour for each package based on its name and colour the node and the lines going to it in that colour |
13:58:28 | Yardanico | PMunch: yes I know |
13:58:33 | Yardanico | I did that in the past for compiler dep graph |
13:58:44 | Yardanico | https://i.imgur.com/nETUyzK.png |
13:58:48 | Yardanico | that's from start of february |
13:59:07 | Yardanico | its too complicated :D |
13:59:10 | PMunch | Haha, that looks a bit crazy :P |
13:59:26 | PMunch | I mean if the lines weren't straight it would probably be easier to read.. |
13:59:36 | PMunch | And I think nimble packages aren't as connected as the compiler |
13:59:44 | * | solitudesf- joined #nim |
13:59:45 | disruptek | just have the graph shuffle stuff around. |
13:59:49 | FromDiscord | <Rika> that lonely package outside the hell box though |
13:59:52 | disruptek | it's trivial to do in graphviz. |
13:59:58 | Yardanico | how? :) |
14:00:24 | * | JustASlacker quit (Ping timeout: 258 seconds) |
14:00:36 | PMunch | @Rika, osseps or system? |
14:00:48 | FromDiscord | <Rika> is |
14:00:50 | FromDiscord | <Rika> osseps* |
14:01:05 | FromDiscord | <Rika> system isnt that lonely, it has some packages around it |
14:01:08 | PMunch | Yardanico, the compiler one should have grouped by folder by the way |
14:01:20 | Yardanico | wdym folder |
14:01:21 | PMunch | @Rika, most of those are in the "system" folder |
14:01:25 | Yardanico | there's only one folder for the compiler |
14:01:25 | PMunch | Directory |
14:01:35 | FromDiscord | <Rika> its a joke T_T |
14:01:49 | PMunch | Huh, you're right |
14:01:52 | PMunch | I was thinking of stdlib |
14:02:37 | * | solitudesf quit (Ping timeout: 265 seconds) |
14:04:02 | * | raskol quit (Quit: Lost terminal) |
14:05:12 | Yardanico | also another version https://i.imgur.com/J2XjRwT.png |
14:05:30 | FromDiscord | <Rika> spaced out as fuuuck |
14:05:47 | Yardanico | -Goverlap=scale |
14:05:49 | Yardanico | so nothing overlaps |
14:05:53 | dom96 | Yardanico, you should turn this into a live interactive website |
14:06:00 | dom96 | would be a cool way to discover packages :) |
14:06:28 | Zevv | poor osseps |
14:06:31 | Zevv | nobody loves him |
14:06:38 | * | kungtotte quit (Read error: Connection reset by peer) |
14:06:49 | Zevv | your dot graphs have the funniest spacing |
14:07:11 | PMunch | With splines they get a lot better :P |
14:07:12 | * | raskol joined #nim |
14:07:12 | * | raskol quit (Client Quit) |
14:07:32 | * | kungtotte joined #nim |
14:08:34 | * | abm quit (Read error: Connection reset by peer) |
14:09:22 | FromGitter | <jorjun_twitter> if a monkey stole your face... |
14:09:37 | PMunch | What? |
14:11:29 | PMunch | That would be one odd looking monkey |
14:11:38 | PMunch | Even though I do have a bit of a beard going at the moment |
14:12:47 | alehander92 | yardanico |
14:12:49 | alehander92 | awesome |
14:12:58 | alehander92 | i wanted to do stuff like that for functions |
14:13:00 | alehander92 | and modules |
14:14:53 | Yardanico | PMunch: well splines help a bit |
14:15:08 | PMunch | A bit? Now all the labels are readable :P |
14:15:18 | * | raskol joined #nim |
14:15:30 | Yardanico | PMunch: https://gist.githubusercontent.com/Yardanico/194f832818f636721b8054e70c0b50a2/raw/5763a6f1ec29f38cf2a1f19dca9ae1d85a804759/fa.svg |
14:17:19 | PMunch | Yeah, that looks similar to what I got |
14:17:49 | PMunch | The reason I wanted colours, because it's a tad hard to see exactly where arrows point to |
14:18:19 | Yardanico | well yeah I did that in february |
14:18:26 | Yardanico | I manually added random colors |
14:18:31 | Yardanico | well manually I mean with nim program |
14:18:41 | Yardanico | post-processing :P |
14:19:04 | bebarker | It seems like let-declared references can still be assigned to unlike non-ref values (by dereferencing with []), which I guess makes a certain sense; does this mean there is no difference between let x = ref ... and var x = ref ...? |
14:19:14 | Yardanico | bebarker: there is |
14:19:19 | alehander92 | one thing one can do is |
14:19:45 | alehander92 | graphing all the modules/functions of nim program after compilation |
14:19:48 | Yardanico | bebarker: if you make a ref object as "let", you can't mutate the reference |
14:19:55 | Yardanico | and that makes perfect sense |
14:20:09 | Yardanico | since with "ref object" you're actually declaring the reference itself as immutable |
14:20:12 | Yardanico | not the underlying data |
14:20:25 | alehander92 | very easy to analyze e.g. how coupled stuff is |
14:20:46 | bebarker | Yardanico, hmm, that's kinda what i was wanting to achieve but maybe I did something wrong, let me post my example |
14:21:39 | bebarker | Yardanico, https://gist.github.com/bbarker/903ff7608e20bdcac09656b2803fa76c |
14:21:59 | * | JustASlacker joined #nim |
14:22:20 | Yardanico | bebarker: in your example you're not changing the reference itself, it stays the same |
14:22:25 | Yardanico | you're changing the underlying data |
14:22:35 | bebarker | ah, right |
14:22:49 | bebarker | i see what you mean |
14:26:56 | FromDiscord | <slymilano> The string in Rust seem pretty gnarly and hard to work with for "mere mortals" does Nim abstract this away from us? https://news.ycombinator.com/item?id=23246908 |
14:27:29 | FromDiscord | <slymilano> Been working with Nim a bit and haven't run into any issues like that, I can just use good old string |
14:27:30 | bebarker | Maybe a better approach would be to make a ref object and overload [] to allow setting on that, then I think you would have an array where individual indices could be altered but the entire array couldn't be assigned to. Better yet, I think i could use distinct so that set ([]) only works on the distinct type |
14:28:29 | PMunch | slymilano, yeah strings are about as easy as they get in Nim |
14:29:27 | dom96 | Nim has `string` and `cstring` and that's it |
14:29:41 | * | dddddd joined #nim |
14:29:43 | PMunch | You have string and cstring, where the latter is just the same as "char *" and used for C interop. |
14:29:45 | dom96 | (And `TaintedString` but don't worry about that :)) |
14:29:56 | PMunch | Haha, oh yes TaintedString |
14:30:09 | Yardanico | nobody likes TaintedString :( |
14:30:21 | PMunch | I really like the idea of TaintedString, but I've never done anything but .string on one... |
14:32:17 | dom96 | It's okay, let's just forget it exists :) |
14:35:05 | * | nekits quit (Read error: Connection reset by peer) |
14:35:42 | * | nekits joined #nim |
14:36:08 | FromDiscord | <mratsim> strings are easy until you want to do time critical string processing (but same problem in any non-garbage collected language) |
14:40:28 | FromDiscord | <Rika> `given how frictionless Rust otherwise tends to be.` ????? |
14:43:43 | shashlick | how do you wrap c++ reference params in nim |
14:45:12 | FromDiscord | <mratsim> You should ask genotrance, he is the specialist of wrapping 😉 |
14:45:15 | * | raskol quit (Ping timeout: 258 seconds) |
14:45:21 | FromDiscord | <mratsim> (irony :P) |
14:45:58 | FromDiscord | <mratsim> https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim#L111 |
14:46:05 | FromDiscord | <Rika> when will we get to a sufficient enough size where we dont need to direct people to specific people for certain tasks |
14:46:36 | FromDiscord | <mratsim> genotrance == shashlick |
14:47:26 | disruptek | mratsim: any idea why your rt demo crashes with larger constants? |
14:47:54 | shashlick | thanks m |
14:48:02 | FromDiscord | <Rika> > genotrance == shashlick↵holy fuck you just made my mind melt |
14:48:46 | disruptek | i thought i'd run it for awhile but i think it segvs after 10-15m. |
14:49:00 | shashlick | @mratsim: am looking at some C++ to see how it would map to nim for nimterop |
14:49:03 | shashlick | https://github.com/ocornut/imgui/blob/master/imgui.h#L305 |
14:49:13 | shashlick | there, ImVec2& pos |
14:49:33 | zacharycarter | use a pointer Shashlick |
14:49:34 | shashlick | but ImVec2 is just a struct |
14:49:36 | zacharycarter | Nim doesn't have ref parameters |
14:49:53 | FromDiscord | <mratsim> @disruptek no idea, I think Weave transformation to send tasks to threads prevent tail call optimization and the "radiance" function is recursive |
14:50:03 | shashlick | so C++ refs can be mapped to Nim ptr? |
14:50:18 | zacharycarter | or ref types |
14:50:37 | zacharycarter | but ImVec2 is a struct |
14:50:43 | zacharycarter | so you'd pass a pointer in this case |
14:50:44 | FromDiscord | <mratsim> no pointer not ref |
14:50:53 | shashlick | but the same type could be used as an object and a ref |
14:51:02 | zacharycarter | not if you make it a ref type |
14:51:08 | zacharycarter | so yeah, use pointer |
14:51:18 | FromDiscord | <mratsim> if you gdb you see that it crashes at 4480 depth of the radiance function: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L134-L136 |
14:51:47 | disruptek | yeah but.. |
14:51:53 | disruptek | 😀 |
14:52:30 | disruptek | what's developing that we don't expect to develop... |
15:02:53 | * | s4mu3lbk joined #nim |
15:02:59 | Yardanico | btw, about colors |
15:03:03 | Yardanico | before - https://i.imgur.com/EWxTOsp.png |
15:03:05 | Yardanico | after - https://i.imgur.com/Bz5TvxK.png |
15:03:14 | Yardanico | (that's how it would look if they merge it) |
15:03:50 | FromDiscord | <Rika> i dont know if i like the similarity to JS |
15:04:06 | Yardanico | lemme try to find a repo with both nim and js |
15:04:07 | Yardanico | to compare |
15:05:26 | Yardanico | a bit oof but who cares about JS right? :D (I manually modified width so it's 50/50) |
15:05:26 | Yardanico | https://i.imgur.com/U3KcqYY.png |
15:05:38 | Yardanico | I still can just close the PR but there's almost no discussion |
15:06:13 | FromDiscord | <Rika> yeah as a colorblind motherfucker i cannot see the difference |
15:06:16 | Yardanico | lmao |
15:06:28 | shashlick | @zacharycarter - why not use var instead of ptr - passing by reference is just for that right |
15:07:47 | shashlick | `proc SetNextWindowSize(size: var ImVec2, cond: ImGuiCond = 0)` for `void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0);` |
15:09:48 | * | s4mu3lbk quit (Quit: Leaving) |
15:10:15 | * | s4mu3lbk joined #nim |
15:11:53 | FromDiscord | <willyboar> ~stream |
15:11:54 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) |
15:12:00 | Yardanico | yep join mumble |
15:12:13 | FromDiscord | <Generic> I didn't expect to recognise these github colors so well |
15:12:35 | FromDiscord | <Generic> but yes, yellow has already burned in an association with js |
15:12:43 | Yardanico | well give your suggestions :P |
15:12:50 | Yardanico | https://github.github.io/linguist/ to see all current colours on github |
15:13:14 | alehander92 | eh green is ok |
15:13:18 | FromDiscord | <Generic> Nim is quite a unique color |
15:13:53 | FromDiscord | <Generic> C# is probably the most popular thing with a similar color |
15:14:21 | FromDiscord | <Generic> but atleast I can easily separate them |
15:14:24 | FromDiscord | <Clyybber> or maybe make it a bit darker |
15:14:27 | FromDiscord | <Clyybber> so that its orange |
15:14:35 | FromDiscord | <Clyybber> like arnetheducks avatar |
15:14:50 | FromDiscord | <Generic> tbh I don't really see the point in changing it |
15:15:02 | FromDiscord | <Clyybber> there is no point |
15:15:08 | FromDiscord | <Clyybber> but it would then fit with the website |
15:15:12 | FromDiscord | <Clyybber> and the logo |
15:15:12 | FromDiscord | <Generic> the colors for the popular languages are mostly chosen without any association |
15:15:16 | dom96 | yeah, sucks a little that it's so close to JS :( |
15:15:22 | dom96 | since JS is so popular |
15:15:36 | FromDiscord | <Clyybber> recolor js |
15:15:37 | FromDiscord | <Clyybber> haha |
15:15:56 | dom96 | the JS yellow is pretty gross though |
15:16:27 | FromDiscord | <Generic> Java is the worst with it's ugly brown |
15:16:41 | FromDiscord | <Generic> which doesn't match it's branding btw |
15:16:52 | FromDiscord | <Generic> that would be orange/red |
15:16:55 | FromDiscord | <Rika> well its ugly so it still kinda does |
15:17:12 | FromDiscord | <Generic> I held that joke back 🙂 |
15:17:41 | FromDiscord | <Rika> me? hold jokes back? |
15:17:57 | FromDiscord | <Generic> well I associated it more than once with feces |
15:18:03 | FromDiscord | <Rika> fitting. |
15:18:13 | FromDiscord | <Generic> but I thought that was too much |
15:22:25 | disruptek | another good demo of nimph today. |
15:22:53 | FromDiscord | <Rika> congrats |
15:23:14 | disruptek | just making a note for the video. |
15:24:27 | shashlick | disruptek: have the nimterop changes made life better in nimph |
15:24:31 | FromDiscord | <Yardanico> changed discord server structure a bit |
15:24:33 | FromDiscord | <Yardanico> added #rules |
15:24:46 | disruptek | shashlick: dunno; i cannot build nimph. |
15:24:55 | shashlick | ? |
15:25:11 | FromDiscord | <Lantos> https://media.discordapp.net/attachments/371759389889003532/712687371111628860/unknown.png |
15:25:36 | Yardanico | what hex code is that? |
15:25:42 | Yardanico | so I can chech color proximity |
15:27:42 | FromDiscord | <Lantos> https://media.discordapp.net/attachments/371759389889003532/712688006145900614/unknown.png |
15:28:40 | FromDiscord | <Lantos> #ffcb00 |
15:28:55 | * | solitudesf- is now known as solitudesf |
15:28:56 | FromDiscord | <Lantos> still our yellow but just more royal with cheese |
15:29:17 | Yardanico | nah, can't use that |
15:29:21 | Yardanico | "The following 1 languages have failing color thresholds. Please modify the hex color. - Parrot (#f3ca0a) is too close to ["ffcb00", "f3ca0a"]" |
15:29:44 | FromDiscord | <Lantos> shame |
15:29:46 | FromDiscord | <willyboar> #c0b752 |
15:30:21 | FromDiscord | <Lantos> whats the closes we can get just outside thesholds |
15:31:14 | Yardanico | @willyboar that one is fine but imo it's a bit too darkish |
15:31:44 | Zevv | Yardanico: where can I find all these parsers of yours |
15:31:45 | FromDiscord | <willyboar> well how many projects are build with nim and js only? |
15:32:14 | Yardanico | Zevv: it's not that nice but here it is https://github.com/Yardanico/nim-snippets/blob/master/pkgraph/parse.nim |
15:32:24 | Yardanico | I could've also tried to do the version stripping in npeg but I was too lazy :D |
15:32:31 | Zevv | it's like bowel surgery, it's never nice, but sometimes you need it. |
15:32:41 | FromDiscord | <Lantos> #dfb316 |
15:32:45 | Yardanico | in fetch.nim you need to do execProcesses instead of just echoing cmds |
15:32:49 | Yardanico | (yes I cloned _all_ nim repos) |
15:32:55 | Yardanico | and pkgs.json is packages.json from packages repo |
15:37:00 | dcmertens | Is it correct to think of variant types as defining a family of structs with identical heads but differing tails? |
15:37:11 | dcmertens | (in the parlance of C, that is) |
15:37:39 | dcmertens | and this would be why "assignment to discriminant changes object branch" is an exception |
15:39:00 | * | JustASlacker quit (Ping timeout: 272 seconds) |
15:39:10 | FromDiscord | <Clyybber> dcmertens: They could have different heads, but identical tails too |
15:39:14 | Zevv | right |
15:39:16 | Yardanico | dcmertens: nim object variant is just like a union struct in C :P |
15:39:17 | Zevv | and different inbetweens |
15:39:21 | FromDiscord | <Clyybber> Its best to think of them as a part of the object being an union |
15:39:25 | Zevv | the 'case' part is implemented by an union inside a struct |
15:39:55 | Yardanico | dcmertens: https://gist.github.com/Yardanico/495a87da26c08c441509267f98b60864 |
15:40:04 | * | dcmertens reads |
15:40:18 | Zevv | dcmertens: gimme a sec |
15:40:44 | dcmertens | Zevv, Yardanico has a good example |
15:40:56 | dcmertens | got it, thanks |
15:41:03 | Zevv | Me too :) https://play.nim-lang.org/#ix=2mOs |
15:41:09 | dcmertens | hahaha |
15:41:33 | Zevv | dang are we helpful or what |
15:41:53 | Yardanico | xd |
15:42:33 | dcmertens | awesome, thanks |
15:43:18 | dcmertens | I must say, I like that Nim provides simple facilities for "tricky" things in C |
15:43:49 | Yardanico | for JS backend too :P |
15:44:13 | dcmertens | Yardanico, I'll have to take your word for it. I know nothing about JS |
15:44:29 | Yardanico | dcmertens: I mean Nim's JS backend basically supports all nim language features (except the backend specific ones) |
15:44:34 | Yardanico | including case objects of course |
15:44:43 | Yardanico | but in JS it's simpler |
15:44:54 | dcmertens | sure, but I was saying that I've seen this union trick in C before |
15:45:08 | Yardanico | in JS it compiles to |
15:45:09 | Yardanico | "var a_11612014 = {kind: 0, data: makeNimstrLit("hello"), test: 0, ok: 0.0};" |
15:45:17 | Yardanico | since js doesn't have types, so it's just an object |
15:45:37 | dcmertens | Well sure, I'm not surprised that a simple JS implementation exists |
15:45:59 | dcmertens | I'm just saying that this is a somewhat common idiom in C, but sufficiently rare in my use that I never used it |
15:46:09 | Yardanico | yeah I know it's quite common in C |
15:46:11 | dcmertens | and so I'd have to think carefully about it before trying it in C |
15:46:33 | dcmertens | nim makes it easier, so I'm more likely to use it |
15:46:37 | alehander92 | i'd really compare |
15:46:41 | alehander92 | case objects to ADT-s |
15:47:06 | alehander92 | i know they are a bit more general in some extent, but i think that's also a good comparison |
15:47:33 | dcmertens | alehander92, right, but the nuts-and-bolts implementation of ADTs in C is defined by the programmer using bit fields or flags and union types |
15:47:49 | alehander92 | yeah |
15:48:09 | alehander92 | but one can have even a more haskell/rust-like ADT definition in nim e.g. with macro |
15:48:31 | dcmertens | well, I haven't gotten to those yet. :-) |
15:48:45 | alehander92 | but whatever is comfortable |
15:59:30 | dcmertens | Judging by testanything.org, it looks like nim doesn't have a module for TAP tests? |
16:00:00 | dcmertens | Coming from Perl, I've come to really like TAP. |
16:00:04 | * | dcmertens puts that on to-do list |
16:00:25 | FromDiscord | <mratsim> you can even simulate a class + inheritance via ADTs + macros |
16:00:41 | FromDiscord | <mratsim> (I have one already written, super useful to avoid heap allocation) |
16:01:00 | FromGitter | <kaushalmodi> I came across an interesting user error today |
16:01:20 | FromGitter | <kaushalmodi> I have a nim wrapper that dyn links to .so separately compiled using g++ |
16:01:22 | FromGitter | <kaushalmodi> and it works great |
16:01:38 | FromGitter | <kaushalmodi> the g++ compiled .so's were compiled using version 6.3.0 |
16:01:47 | dcmertens | mratsim, thanks |
16:01:57 | FromGitter | <kaushalmodi> but the nim wrapper got compiled using g++ 8.4.0 by mistake |
16:02:17 | FromGitter | <kaushalmodi> and I got that "unable to find the linked .so" error |
16:02:37 | FromGitter | <kaushalmodi> can Nim improve that error in any way? |
16:03:17 | FromGitter | <kaushalmodi> just by chance it occurred that may be I should check the gcc versions used for compiling the nim wrapper vs the linked .so, and I realized that I need to used the same g++ versions on both ends |
16:03:37 | FromDiscord | <mratsim> that seems like the same error we have in unix when you try to execute a non-executable file |
16:03:42 | FromDiscord | <mratsim> "file not found" |
16:03:59 | FromDiscord | <mratsim> instead of permission error |
16:04:19 | FromGitter | <kaushalmodi> 1 min.. let me paste the exact error.. it's not that unix "file not found" error |
16:04:40 | alehander92 | mratsim is right, case objects widely used in imo |
16:04:50 | alehander92 | otherwise i am not sure about TAP |
16:04:56 | alehander92 | i thought its a perl thing |
16:05:01 | * | s4mu3lbk quit (Ping timeout: 264 seconds) |
16:05:34 | dcmertens | alehander92, it is mostly a Perl thing |
16:05:41 | FromGitter | <kaushalmodi> @mratsim : ⏎ ⏎ ```could not load: external_lib_64.so ⏎ compile with -d:nimDebugDlOpen for more information``` [https://gitter.im/nim-lang/Nim?at=5ec555553d81ad775847b8f6] |
16:05:58 | dcmertens | but I've really come to like it. Compact output if you want it, verbose descriptive output if you want it. |
16:05:59 | alehander92 | how can it be used in nim |
16:06:03 | alehander92 | with the correct output? |
16:06:05 | FromGitter | <kaushalmodi> the cause of that error was that I was building nim wrapper with g++ 8.4.0 while that external_lib_64.so was built with 6.3.0 |
16:06:06 | FromGitter | <bung87> @alehander92 I add a simple analyzer to my tool. |
16:06:17 | alehander92 | bung87 oh sounds good |
16:06:19 | alehander92 | how does it work |
16:06:35 | bebarker | is it possible and are there examples to overload [] (surround-fix?) for objects that behave like arrays? |
16:06:37 | FromGitter | <kaushalmodi> compiling with `-d:nimDebugDlOpen` did not help either |
16:07:22 | Yardanico | bebarker: yes it's actually quite easy |
16:07:27 | FromGitter | <bung87> it use typescript compiler , collect all symbols to a list ,then I can find closest symbol when I need |
16:07:31 | Yardanico | proc `[]`(a: MyObj, b: idx): MyType = stuff |
16:07:50 | Yardanico | if it's generic, do proc `[]`[T](a: MyObj[T], b: int): T = stuff |
16:08:00 | bebarker | nice, ty, Yardanico |
16:08:27 | FromGitter | <bung87> so if(a) if(isNil(a)) now is possible. |
16:08:40 | * | waleee-cl joined #nim |
16:09:23 | FromGitter | <bung87> I havenot cover all case, just done one unit test. |
16:19:29 | alehander92 | hm, do those symbols come with a type bung87 |
16:20:50 | FromGitter | <bung87> yes, that's why need a analyzer. |
16:23:46 | FromGitter | <bung87> I havnt test a solution do trace, node or n8, so I cant get c type. |
16:26:16 | FromDiscord | <mratsim> @bebarker a custom tensor type I created for a metaprogramming challenge against Julia: https://github.com/SimonDanisch/julia-challenge/blob/master/nim/nim_sol_mratsim.nim#L8-L68 |
16:26:35 | FromGitter | <kaushalmodi> I have asked about that g++ version issue on https://forum.nim-lang.org/t/6357 |
16:31:39 | Prestige | Looking into launching external programs from my WM written in Nim - I found startProcess but I'm not sure if this is what I want. I'll have to manage the started processes and close them at some point? |
16:31:53 | disruptek | that /is/ what you want. |
16:32:13 | dcmertens | mratsim, what was the result of the Julia Challenge? |
16:32:44 | Prestige | disruptek: so say they open a browser and close it themselves later, I'll still have to handle that? |
16:36:08 | * | nsf quit (Quit: WeeChat 2.8) |
16:39:00 | FromDiscord | <mratsim> The result is that I've proven that yes metaprogramming is very interesting for numerical algorithm and adapt the language to a domain and provide convenient domain-like data structures seamlessly in the language |
16:39:20 | FromDiscord | <mratsim> but Julia is not the only language to provide that |
16:39:32 | * | raskol joined #nim |
16:39:32 | * | raskol quit (Quit: Lost terminal) |
16:39:50 | FromDiscord | <mratsim> which was the premise the author wanted counterexamples of: https://nextjournal.com/sdanisch/the-julia-challenge |
16:40:38 | FromDiscord | <mratsim> Also, it seems liek what the author wanted was super confusing for most, so I guess when I explain features of my code I also need to be aware of that :p |
16:40:49 | FromDiscord | <mratsim> (because it was super clear to me 😉 ) |
16:40:50 | dcmertens | mratsim, I skimmed the page, I thought the author was also going for benchmarks |
16:41:14 | FromDiscord | <mratsim> benchmarks where the icing, having a matrix-like syntax was the key |
16:41:47 | FromDiscord | <mratsim> i.e. being able to do A * B and A[i, j, k] *= 10 (and broadcast 10 to the whole tensor) |
16:42:12 | FromDiscord | <mratsim> also it took me less than a day between the announce and my code 😉 |
16:42:29 | Yardanico | people think their language is cool |
16:42:32 | Yardanico | until they see Nim |
16:44:55 | dcmertens | mratsim, did the author ever analyze the published results according to his own winning criteria? |
16:45:04 | FromDiscord | <mratsim> Regarding speed I have a faster implementation in Laser for strided iteration (for example resulting from slicing or even reversing some dimensions)↵https://github.com/numforge/laser/blob/master/benchmarks/loop_iteration/iter_bench.nim#L141-L175 |
16:45:14 | FromDiscord | <mratsim> in the PR you have comments |
16:45:59 | FromDiscord | <mratsim> in the benchmark, the 49.648 milliseconds result is the code I used for the julia challenge,↵and the 30.583ms is the code I cooked up as an improvement |
16:46:26 | FromDiscord | <mratsim> but it's way harder to follow: https://github.com/numforge/laser/blob/master/benchmarks/loop_iteration/iter05_fusedpertensor.nim#L9-L143 |
16:47:04 | * | dcmertens reads the pull request |
16:47:49 | FromDiscord | <mratsim> but basically instead of having iterating on i, j, k --> feeding that to A[i, j, k] and B[i, j, k], I have each tensor maintaining their own iteration state |
16:48:35 | FromDiscord | <mratsim> so that you don't recompute i\*strideA + j\*strideA + k\*strideA |
16:50:15 | FromDiscord | <mratsim> and it improves on the syntax by reusing the "for"-loop like syntax https://github.com/numforge/laser/blob/master/benchmarks/loop_iteration/iter05_fusedpertensor.nim#L165-L167 |
16:50:31 | FromDiscord | <mratsim> with any number of tensors |
16:51:51 | shashlick | mratsim - byref is on the type but the type could be used by ref or normally in procs |
16:52:01 | shashlick | how about using var instead? |
16:52:06 | shashlick | looking for a generic way to do this |
16:52:37 | bebarker | mratsim, ooh, thanks will definitely make a note to check that out |
16:54:19 | FromDiscord | <mratsim> @shashlick yes you can use var, just pay attention to arrays, they have weird semantics in C++ |
16:54:53 | FromDiscord | <mratsim> Example to wrap the C stdlib, I needed some compat shim for C++: https://github.com/mratsim/weave/pull/150/commits/5286ca0b2060f3fdcdb9f9220bd19e8953613c45 |
16:56:22 | shashlick | okay good - i know who to bother to enable C++ wrapping in nimterop |
16:56:32 | shashlick | looks like you've dabbled around with this quite a bit |
16:56:41 | FromDiscord | <mratsim> Also one thing that might cause issue is when C++ classes are returning (mutable) references. The var return type works for trivial types but at least for arrays it's all kind of broken, it might be tricky for tuples as well |
16:57:27 | * | abm joined #nim |
16:57:30 | FromDiscord | <mratsim> I had to to use CUDA :/ |
16:57:57 | * | fanta1 quit (Quit: fanta1) |
16:58:38 | * | JustASlacker joined #nim |
17:02:49 | FromDiscord | <mratsim> what are you working on @bebarker? |
17:04:05 | bebarker | mratsim, just trying to prototype a simple API for converting between immutable and mutable arrays (freeze and thaw) |
17:04:20 | * | couven92 quit (Ping timeout: 256 seconds) |
17:05:23 | bebarker | mratsim, that code you shared was already helpful, realized i need to implement []= |
17:05:33 | * | couven92 joined #nim |
17:06:46 | * | JustASlacker quit (Ping timeout: 256 seconds) |
17:07:30 | FromDiscord | <mratsim> I yes I remember using haskell vectors |
17:07:58 | bebarker | mratsim, yeah that was sort of what I had in mind, though not trying to reproduce it 100% |
17:07:58 | FromDiscord | <mratsim> here you go: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L12-L14 |
17:08:13 | FromDiscord | <mratsim> and: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L104-L111 |
17:08:25 | FromDiscord | <mratsim> this was to allow safe pointer accesses |
17:08:50 | bebarker | mratsim, oh and hi - thanks for your comment on github issues, just haven't had a chance to digest it all yet |
17:09:04 | FromDiscord | <mratsim> so when taking a pointer of a tensor, if it was mutable you get a RawMutablePtr with []= defined |
17:09:35 | FromDiscord | <mratsim> and if it was an immutable tensor, you get a pointer that prevents you from mutating the data |
17:10:14 | FromDiscord | <mratsim> though one thing I can't do yet is preventing the user from escaping with the pointer if the tensor was only local |
17:10:36 | FromDiscord | <mratsim> that would need some escape analysis |
17:10:48 | FromDiscord | <mratsim> i.e. t's a poor man's write tracking system: https://nim-lang.org/araq/writetracking.html |
17:11:42 | * | Vladar joined #nim |
17:13:23 | FromDiscord | <dom96> did the person that wrote the Julia Challenge ever write up a follow up to declare the winner? |
17:14:22 | FromDiscord | <mratsim> I don't think so, maybe there is a wrapup on Reddit or Hacker news or the julia forum |
17:15:10 | FromDiscord | <mratsim> for example there is a huge Nim thread on Julia forum: https://discourse.julialang.org/t/version-1-0-released-of-nim-programming-language/29099/47 |
17:17:27 | bebarker | mratsim, I tried doing this, which seems to work as expected (haven't tested the last note on line 39): https://gist.github.com/bbarker/903ff7608e20bdcac09656b2803fa76c#file-makerefarray-nim-L22-L41 |
17:17:52 | bebarker | not sure of the performance implications of wrapping an array in a ref object though |
17:18:30 | FromDiscord | <mratsim> it depends, if you do that in a loop, it's bad |
17:18:43 | * | audiofile joined #nim |
17:18:44 | FromDiscord | <mratsim> if it's once before heavy processing it's the same as stack |
17:18:48 | audiofile | hello my favourite people |
17:18:54 | FromDiscord | <mratsim> hello there |
17:19:00 | audiofile | :D |
17:19:04 | audiofile | how goes it |
17:19:23 | FromDiscord | <mratsim> good and you? |
17:19:35 | bebarker | mratsim, cool, i'll look at your code more soon as well |
17:19:42 | audiofile | awesome, im feeling pretty good about today =) |
17:19:59 | FromDiscord | <mratsim> the main question with ref array is whether you want separate copies on assignment or if you want assignement to share the same data |
17:22:24 | * | go|dfish quit (Remote host closed the connection) |
17:22:47 | bebarker | mratsim, yeah i've been thinking of that as well - a way to compose mutable operations on an array for instance |
17:23:26 | bebarker | well, i haven't thought about it much yet! I should say i need to think about it |
17:23:41 | FromDiscord | <mratsim> did you read about the `dup` macro? |
17:23:48 | * | go|dfish joined #nim |
17:23:51 | * | Satomi-Kowa joined #nim |
17:24:11 | FromDiscord | <mratsim> See https://nim-lang.org/blog/2020/04/03/version-120-released.html grep for "dup" |
17:24:39 | * | couven92 quit (Read error: Connection reset by peer) |
17:24:40 | bebarker | mratsim, i had the sugar page open just now and saw it when you mentioned it - nice |
17:25:03 | * | couven92 joined #nim |
17:27:13 | * | JustASlacker joined #nim |
17:27:25 | * | Jesin quit (Quit: Leaving) |
17:29:50 | FromDiscord | <mratsim> meh, the documentation of "dup" is better in the release notes |
17:30:54 | * | Jesin joined #nim |
17:36:19 | * | JustASlacker quit (Ping timeout: 260 seconds) |
17:39:08 | * | jasper_ joined #nim |
17:47:33 | FromDiscord | <Jondice> Yes, I see. I wonder if going the other way (automatically detecting where operations that sequentially modify and return a copy) could be detected in the compiler as an optimization (or is already). |
17:47:36 | FromDiscord | <Rika> 😮 bebarker on discord |
17:50:06 | * | cornfeedhobo_ joined #nim |
17:50:19 | * | cornfeedhobo quit (Ping timeout: 260 seconds) |
17:50:20 | * | cornfeedhobo_ is now known as cornfeedhobo |
17:54:55 | FromGitter | <bung87> does vscode nim has format feature? I face error for a while when I run format document command. |
17:55:09 | FromDiscord | <Rika> yes it shouldhave |
17:55:12 | FromDiscord | <Rika> (edit) 'shouldhave' => 'should have' |
17:55:43 | FromDiscord | <Rika> it only works if the nim file is valid syntactically afaik? |
17:56:00 | FromGitter | <bung87> hmm I can't remember when it becoming not avaliable. |
17:56:48 | FromGitter | <bung87> `Command 'Format Document' resulted in an error (An unknown error occurred. Please consult the log for more details.)` |
17:57:06 | FromGitter | <bung87> just note here, check it later |
17:58:07 | * | hoijui joined #nim |
17:58:25 | * | fredrikhr quit (Ping timeout: 264 seconds) |
18:00:59 | * | audiophile joined #nim |
18:01:53 | * | theelous3 joined #nim |
18:04:19 | * | audiofile quit (Ping timeout: 260 seconds) |
18:04:23 | * | neceve joined #nim |
18:04:23 | * | audiophile is now known as audiofile |
18:05:22 | FromDiscord | <Rika> holy shit i just read through more of the concepts documentation |
18:05:29 | FromDiscord | <Rika> its pretty insane this thing |
18:11:23 | FromGitter | <bung87> using concept will make me like debuger not programer. |
18:13:57 | FromDiscord | <Rika> what |
18:14:56 | * | jasper_ quit (Quit: Lost terminal) |
18:15:01 | FromGitter | <zetashift> he debugs more using concepts than actually programming because they are still experimental? |
18:15:39 | Guest87103 | VM does not support 'cast' from tyPointer to tyRef |
18:15:46 | * | Guest87103 is now known as dadada |
18:16:06 | dadada | so this happened, built my code around the wrong assumption that type casts like that are possible |
18:18:03 | FromDiscord | <Rika> no since ref is managed and casting changes merely the representation of the memory |
18:18:14 | FromDiscord | <Rika> i assume refs have more data associated to it than just pointers |
18:21:04 | * | Jesin quit (Quit: Leaving) |
18:23:07 | * | Jesin joined #nim |
18:26:26 | FromDiscord | <mratsim> you can cast ref to pointer, until it doesn't work because the GC moved memory |
18:26:42 | * | hoijui quit (Quit: Leaving) |
18:26:47 | FromDiscord | <mratsim> casting pointer to ref is wrong 😛 |
18:35:37 | FromDiscord | <Clyybber> dadada: I think you don't want to cast it |
18:35:42 | FromDiscord | <Clyybber> You want to do this: |
18:35:46 | FromDiscord | <Clyybber> addr myRef[] |
18:40:04 | * | jwm224 quit (Ping timeout: 246 seconds) |
18:42:06 | * | jwm224 joined #nim |
18:55:44 | * | audiophile joined #nim |
18:56:08 | rockcavera | Is there a reason why the net.parseIPv4Address and net.parseIPv6Address procs are not marked (*) for export? |
18:59:23 | * | audiofile quit (Ping timeout: 260 seconds) |
18:59:29 | * | audiophile is now known as audiofile |
19:01:23 | FromDiscord | <mratsim> Can we add a feature to the forum that automatically recase NIM to Nim? it burns my eyes? |
19:01:47 | FromDiscord | <dom96> lol |
19:07:30 | leorize[m] | well NIM stands for New Improved Modula 3 :P |
19:07:31 | * | couven92 quit (Read error: Connection reset by peer) |
19:08:13 | alehander92 | Rika why is it insane |
19:08:17 | leorize[m] | @mratsim I might be wrong but I'm pretty sure refc don't move memory? |
19:09:38 | FromDiscord | <mratsim> they do :/ I allocated 1000 of NN layers in Arraymancer and then I realized that somehow when going back to the parent (which were ptr casted from ref) somehow I ended up skipping a lot of layers |
19:09:51 | FromDiscord | <mratsim> and when I changed the ptr back to ref, it was fixed |
19:09:59 | FromDiscord | <Rika> alehander insane as in "crazy powerful" |
19:11:00 | FromDiscord | <mratsim> so i had to rollback this change: https://github.com/mratsim/Arraymancer/pull/180/commits/e892715f5473a35b6fdde9a84e2936fa08e0b59c |
19:11:02 | disbot | ➥ Autograd no cyclic strong ref |
19:11:46 | * | fredrikhr joined #nim |
19:12:03 | FromDiscord | <mratsim> there: https://github.com/mratsim/Arraymancer/pull/329/commits/30749e58a0c8fb4d933d2be6e448b2b5dbe1bdf1 |
19:12:07 | disbot | ➥ Shakespeare text generator + numerous fixes |
19:12:32 | * | couven92 joined #nim |
19:12:38 | Araq | mratsim: no GC that Nim uses moves memory around. but too early reclamation and use-after-free can maybe make you think that it does |
19:13:24 | Araq | however, assuming a moving GC is good for hygiene |
19:13:29 | FromDiscord | <mratsim> that's strange because it was a DAG and the parent couldn't be reclaimed before the children was reclaimed |
19:15:32 | FromDiscord | <mratsim> anyway, yes I just assume a moving GC |
19:16:42 | * | dcmertens quit (Quit: Leaving) |
19:17:15 | * | liblq-dev quit (Quit: WeeChat 2.8) |
19:27:35 | * | natrys joined #nim |
19:29:21 | FromDiscord | <Clyybber> dadada: Did it work? |
19:35:59 | * | FromDiscord quit (Remote host closed the connection) |
19:36:12 | * | FromDiscord joined #nim |
19:46:05 | FromGitter | <bung87> when choose proc as inline? |
19:52:32 | leorize[m] | when it's small |
19:53:10 | Yardanico | @bung87 you only really need to think about inlining if you really care about performance and already did the profiling :) |
19:53:19 | Yardanico | C compiler itself can do some inlining automatically if deemed neccesary |
19:54:01 | Yardanico | the way inline pragma works is that it duplicates the proc body in each c file where it's called so that the C compiler fill (almost surely) inline it |
19:54:03 | FromGitter | <bung87> if call multiple times make code larger |
19:54:30 | FromGitter | <bung87> so main purpose is reduce the call routes? |
19:54:40 | Yardanico | the main purpose is make the performance better |
19:54:45 | Yardanico | no function call overhead |
19:55:37 | FromGitter | <bung87> ok, then I choose no extro pragma , make code simple clean |
19:56:14 | leorize[m] | the main purpose of the `{.inline.}` pragma in Nim is so that the code can be inlined across modules |
19:56:15 | Yardanico | yeah for most code out there you don't really need to care about that pragma :P |
19:57:35 | * | lritter joined #nim |
19:57:46 | FromGitter | <kaushalmodi> Is there a need for a `getVersion` proc?: http://ix.io/2mQa/nim |
19:58:01 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec58bc93d81ad77584854e4] |
19:58:39 | FromGitter | <kaushalmodi> If someone is interested, they can help me make it a bit more robust.. support across different apps |
19:59:52 | FromGitter | <bung87> leorize in that case the proc not emit any code in the module where it is? |
20:00:22 | * | Vladar quit (Quit: Leaving) |
20:02:01 | FromGitter | <bung87> I think I can create new PR now, thank your both nice explanation |
20:22:28 | FromDiscord | <mratsim> the inline pragma is easy:↵- you profiled that inline gives better performance↵- the resulting file size is acceptable (you can check with Google bloaty) |
20:23:11 | Yardanico | google bloaty? hmm |
20:23:17 | FromDiscord | <mratsim> in general functions that are less than 3 lines of code always benefits from inlining because making a function call also requires moving parameters |
20:23:37 | FromDiscord | <mratsim> literally Google BLoaty: https://github.com/google/bloaty |
20:23:41 | Yardanico | yeah I found it :) |
20:24:32 | FromDiscord | <willyboar> @Yardanico does 1.2.2 containing asynchttpserver fix? |
20:24:41 | Yardanico | @willyboar it should for sure |
20:24:49 | Yardanico | lemme check |
20:26:14 | Yardanico | yeah it's in 1.2 |
20:26:18 | Yardanico | https://github.com/nim-lang/Nim/commit/c4dfdb71f4d2b1b9bd284fd58464524917d32718 |
20:26:31 | Yardanico | I mean backported to 1.2 branch so it will be in 1.2.2 |
20:26:42 | FromDiscord | <willyboar> nice |
20:27:15 | narimiran | speaking of which, 1.2.2-beta is out and ready for y'all to test it: https://github.com/nim-lang/nightlies/releases/tag/2020-05-20-version-1-2-7800fa3 |
20:27:33 | Yardanico | narimiran: I already put it into announcements on discord btw :) |
20:28:10 | FromDiscord | <Elegant Beef> Is there some way of doing this? https://play.nim-lang.org/#ix=2mQj |
20:28:17 | FromDiscord | <Elegant Beef> Or do i just use a seq of procs? |
20:28:48 | Yardanico | just use a seq of procs |
20:28:56 | Yardanico | i mean what other way would there be? :P |
20:29:16 | FromDiscord | <Elegant Beef> Idk there could've been a type i didnt know about in one of the modules 😄 |
20:29:19 | Yardanico | @willyboar for all commits in 1.2.2 you can use this https://github.com/nim-lang/Nim/compare/7e83adff84be5d0c401a213eccb61e321a3fb1ff...7800fa394f26e9a5a6cb30964ba005512199be58 |
20:29:30 | Yardanico | diff between 1.2 and 1.2.2 |
20:30:36 | * | Satomi-Kowa quit (Ping timeout: 256 seconds) |
20:50:23 | FromDiscord | <willyboar> thank you |
20:50:42 | Yardanico | devel had much more interesting stuff than 1.2.2 btw :) |
20:54:07 | * | nimskull joined #nim |
20:57:39 | nimskull | I'm coming to nim from a python/numpy experience. I am trying to do some basic geometry stuff (hopefully faster than python). For starters I'm trying to make a random nx3 matrix and calculate the euclidean norm... I can do this with seq[array[3, float]], and if I fix n I can use an arraymancer Tensor. But how do I make a procedure that is flexible |
20:57:40 | nimskull | wrt n? |
20:59:20 | PMunch | Depends on how flexible you want it |
20:59:47 | PMunch | You can make it generic which means it will still be an array of static size, but you can call the procedure with different sized arrays |
20:59:49 | FromDiscord | <Technisha Circuit> Nice https://media.discordapp.net/attachments/371759389889003532/712771586809397298/Screenshot_20200520_215942.jpg |
21:00:09 | FromDiscord | <Technisha Circuit> Nice makeover |
21:00:27 | Yardanico | yeah @Lantos proposed something like that |
21:00:34 | FromDiscord | <Technisha Circuit> So how would i make an android app in Nim? |
21:00:38 | * | narimiran quit (Ping timeout: 256 seconds) |
21:00:42 | Yardanico | sdl2 |
21:00:57 | FromDiscord | <Technisha Circuit> Any simple lib for it then? |
21:01:18 | FromDiscord | <Technisha Circuit> (@codic i don't have to manually interface with Java like you said( |
21:01:20 | nimskull | what would that look like PMunch? proc [N] randnorm(): array[N, float) = |
21:01:23 | FromDiscord | <Technisha Circuit> (edit) 'said(' => 'said)' |
21:01:33 | * | samuelb joined #nim |
21:01:35 | nimskull | would that be the proc signature (is that the nim word for that even) |
21:02:14 | * | s4mu3lbk joined #nim |
21:03:04 | * | samuelb left #nim (#nim) |
21:03:34 | * | samuelb joined #nim |
21:03:38 | * | samuelb left #nim (#nim) |
21:03:52 | PMunch | nimskull, yeah we call it the signature :) And almost it would be `proc randnorm[N: static[int]](): array[N, float] |
21:04:00 | PMunch | ` |
21:04:13 | PMunch | That would only be 1 dimension though |
21:05:35 | nimskull | and I can refer to that N within the scope of the proc? |
21:05:43 | PMunch | @Technisha Circuit, an approach like this could work: https://github.com/cnlohr/rawdrawandroid |
21:05:46 | PMunch | nimskull, yes |
21:06:14 | FromDiscord | <Technisha Circuit> Nice |
21:06:17 | PMunch | And since it's `static` (meaning it's compile-time) you can use `when N > 3:` for example instead of if |
21:06:27 | PMunch | And those branches will get evaluated at compile-time |
21:07:50 | nimskull | thank you very much PMunch |
21:08:51 | FromGitter | <bung87> does seq[byte] more closer to the blob word ? |
21:09:08 | Yardanico | string is a sequence of bytes too |
21:09:22 | FromGitter | <bung87> `if SQLITE_OK != ps.bindBlob(idx,cast[ptr seq[byte]](v.getPointer)):` |
21:09:30 | Yardanico | uh |
21:09:35 | Zevv | sequence of characters, techincally |
21:09:36 | FromGitter | <bung87> I am doing db string, not sure which one is good |
21:09:42 | PMunch | nimskull, no problem |
21:09:46 | Yardanico | @bung87 what's the C definition of bindBlob ? |
21:10:08 | PMunch | bung87, that very likely won't work.. |
21:10:22 | Yardanico | I'd suggest you to use an UncheckedArray[char] here |
21:10:22 | FromGitter | <bung87> oh it only need pointer |
21:10:48 | PMunch | A seq[byte] is essentialy a length: int, capacity: int, data: ptr T |
21:11:17 | PMunch | UncheckedArray on the other hand might work |
21:11:31 | FromGitter | <bung87> hmm, oh yes, that's the problem |
21:13:21 | FromDiscord | <mratsim> seq[byte] for binary blobs yes |
21:13:41 | FromDiscord | <mratsim> UncheckedArray[byte] if you are interfacing with a void * |
21:13:53 | FromDiscord | <mratsim> or a char * of non-ASCII |
21:13:55 | FromDiscord | <Elegant Beef> Now to seem like a complete idiot, how does one pass a proc to a macro as the proc and not a AST? |
21:14:09 | FromDiscord | <mratsim> everything in a macro is AST |
21:14:22 | FromGitter | <bung87> I just try using `UncheckedArray[char] ` |
21:14:29 | FromDiscord | <Elegant Beef> the docs clearly state static works for primitives |
21:15:00 | FromGitter | <bung87> first I cant get it from Any time, second I can't get its len.. |
21:15:08 | FromDiscord | <mratsim> byte and char are physically equivalent but semantically distinct |
21:15:10 | FromGitter | <bung87> `Any` type |
21:15:15 | Yardanico | @bung87 you get len from the C side usually |
21:15:16 | lqdev[m] | @bung87 use `ptr UncheckedArray[char]`, just using UncheckedArray doesn't work afaik |
21:15:18 | FromDiscord | <mratsim> Any shouldn't be used |
21:15:24 | Yardanico | bindBlob should return a length too |
21:15:42 | FromDiscord | <mratsim> @Elegant Beef what do you want to do with this proc? |
21:15:52 | FromGitter | <bung87> but the c binding need prefill a len param. |
21:15:52 | FromDiscord | <Elegant Beef> make an enum,proc LUT |
21:16:09 | Yardanico | @bung87 which C function are you calling? |
21:16:28 | Yardanico | int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); ? |
21:16:29 | FromGitter | <bung87> sqlite3_bind_blob |
21:16:30 | FromDiscord | <mratsim> and this LUT is compile-time or runtime? |
21:16:39 | FromDiscord | <Elegant Beef> It's for runtime |
21:16:55 | FromDiscord | <mratsim> but constructed at compile-time? |
21:16:59 | FromDiscord | <Elegant Beef> that's the goal |
21:17:23 | PMunch | So just take the name of the proc as AST and output that in you LUT? |
21:17:25 | FromDiscord | <Elegant Beef> I've made a lut like this before but that was for a int, Typedesc |
21:18:12 | FromDiscord | <mratsim> here you go: https://github.com/status-im/nimbus/blob/master/nimbus/vm/interpreter/gas_costs.nim#L455 |
21:18:36 | FromDiscord | <mratsim> ah mayb not exactly |
21:19:05 | FromDiscord | <mratsim> but it's not too hard, the first requirement is that all procs have the same signature |
21:19:10 | FromGitter | <bung87> `seq[char]` seems more closer |
21:19:13 | FromDiscord | <mratsim> or you will need to cast them |
21:19:15 | FromGitter | <kaushalmodi> what would be an strscans pattern for the regex `v?[0-9]+\.[0-9]+\.[0-9]+`? |
21:19:15 | FromDiscord | <Elegant Beef> Yea that's clear |
21:20:01 | FromDiscord | <Elegant Beef> How does the name of the proc from the AST help pmunch? |
21:20:06 | FromGitter | <kaushalmodi> is there an optional match pattern in strscans? |
21:21:17 | Yardanico | @kaushalmodi well you can implement your own matches in strscans, they also have scanp macro |
21:21:23 | Yardanico | and what is that regex supposed to mean? :P |
21:21:43 | * | solitudesf quit (Ping timeout: 260 seconds) |
21:21:50 | FromGitter | <kaushalmodi> Yardanico: matches "v1.1.1" or "1.1.1" as an example |
21:21:51 | PMunch | @Elegant beef, isn't that what you want to return? |
21:21:52 | FromDiscord | <mratsim> sent a code paste, see http://ix.io/2mQB |
21:22:13 | FromGitter | <kaushalmodi> Yardanico: Looks like I need to learn the scanp syntax.. will have a look |
21:22:47 | FromDiscord | <Elegant Beef> I mean i want to be able to call the proc so i just assume the name doesnt help 😄 |
21:22:50 | FromDiscord | <mratsim> and the table can be a simple array |
21:22:59 | * | marquisdefalbala quit (Quit: Konversation terminated!) |
21:23:20 | FromDiscord | <mratsim> is that clear enough or o you need a runnable example? |
21:23:21 | FromDiscord | <Elegant Beef> Yea i know it could be sized of the enum values and just convert to int |
21:23:22 | PMunch | Yardanico, zero or one 'v' followed by one or more characters in the range 0-9, followed by a literal dot, a new group of digits, another literal dot, and another group of digits |
21:24:08 | PMunch | @Elegant beef, well it's not so much the name and more the identifier. You can simply generate a nnkCall with that as the first argument and you're fine |
21:24:21 | PMunch | It's not the name as a string or anything |
21:24:22 | FromDiscord | <mratsim> AFAIk it's just a dispatch |
21:24:26 | FromDiscord | <mratsim> there is no generation to do |
21:24:41 | FromGitter | <kaushalmodi> the PEG thing looks crazy complicated.. will have to put it off for another day |
21:25:38 | Yardanico | try npeg |
21:28:37 | FromDiscord | <Elegant Beef> Ok so i guess i do need a runnable example since i dont see how to convert routine to the proc required |
21:29:19 | FromDiscord | <mratsim> lol I managed to crash the C compiler: https://play.nim-lang.org/#ix=2mQE |
21:29:32 | Yardanico | which version ? :D |
21:29:45 | Yardanico | or you mean you got the codegen error? |
21:30:25 | FromDiscord | <mratsim> here you go: https://play.nim-lang.org/#ix=2mQE |
21:30:30 | FromGitter | <kaushalmodi> Yardanico: npeg has its own syntax.. :) |
21:30:36 | Yardanico | @kaushalmodi it's not that hard |
21:30:39 | Yardanico | and the readme is really good |
21:30:41 | FromDiscord | <mratsim> https://play.nim-lang.org/#ix=2mQG |
21:30:49 | FromDiscord | <mratsim> you don't even need macro |
21:30:58 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec5a1913be96c0df995b081] |
21:31:39 | FromDiscord | <mratsim> @Elegant Beef is that more clear? |
21:31:46 | FromGitter | <bung87> I ' ll test it now. |
21:32:32 | FromDiscord | <Elegant Beef> Yea |
21:32:46 | FromDiscord | <Elegant Beef> *does having a return type fuck with this?*' |
21:33:08 | FromDiscord | <mratsim> the const Foo = static(FooCT) solves issues with object variants and tables. |
21:33:11 | FromDiscord | <mratsim> no it doesn't |
21:34:03 | FromDiscord | <Elegant Beef> `type mismatch: got <None> but expected 'proc (): Level'` |
21:34:04 | FromDiscord | <Elegant Beef> Hmm |
21:34:38 | FromDiscord | <mratsim> all same return type? |
21:34:59 | nimskull | does anyone here have a recommendation for a plotting tool? I've seen some suggestions for nim-plotly |
21:35:09 | FromDiscord | <Elegant Beef> Yea |
21:35:10 | Yardanico | ggplotnim - nim-native |
21:35:15 | Yardanico | nim-plotly - with plotly |
21:35:29 | nimskull | does discord see IRC or is it a one-way mirror |
21:35:40 | Yardanico | lol |
21:35:43 | Yardanico | we see each other :) |
21:35:46 | Yardanico | !status |
21:35:46 | FromDiscord | Uptime - 1 hour, 59 minutes, 45 seconds, 556 milliseconds, 981 microseconds, and 210 nanoseconds |
21:35:47 | FromDiscord | <Elegant Beef> Nah i cant see it |
21:35:52 | FromDiscord | <mratsim> I don't want to see Yardanico |
21:37:26 | FromDiscord | <mratsim> otherwise Arraymancer has a rudimentary plotting tool for debugging https://github.com/mratsim/Arraymancer/blob/master/tools/visualize_tensor_csv.py see https://github.com/mratsim/Arraymancer/pull/205 |
21:37:28 | disbot | ➥ Tensor csv export |
21:38:02 | PMunch | @Elegant Beef: https://play.nim-lang.org/#ix=2mQJ |
21:38:57 | FromDiscord | <speckledlemon> @mratsim If I'd like to contribute to <https://github.com/mratsim/Arraymancer/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aeasy> again, is there a particular issue of interest? |
21:39:03 | FromDiscord | <Elegant Beef> I want modules to subscribe a function to a LUT so that doesnt exactly solve my issue |
21:39:59 | PMunch | @Elegent Beef, with return type: https://play.nim-lang.org/#ix=2mQL |
21:40:36 | PMunch | (Note that this depends on implicit return since it doesn't use `return`) |
21:41:58 | FromDiscord | <mratsim> @Elegant Beef can you post the return type bug you are stuck with? |
21:43:00 | FromDiscord | <Elegant Beef> https://hatebin.com/zvhssljsyz |
21:43:46 | FromDiscord | <Elegant Beef> Is it cause it's a getter and this val doesnt exist at compile time? |
21:46:10 | FromDiscord | <mratsim> @speckledlemon the Conv2D one is probably the easiest to get started with and test: https://github.com/mratsim/Arraymancer/issues/288 |
21:46:12 | disbot | ➥ [NN DSL] Convolution not taking account custom strides |
21:46:28 | FromDiscord | <speckledlemon> cool, thank you |
21:46:46 | FromDiscord | <mratsim> if you like front end, this is something I don't do well at all: https://github.com/mratsim/Arraymancer/issues/169 |
21:46:48 | disbot | ➥ [Docs, CSS FrontEnd, Responsive] Improve drop-down menu on small width |
21:47:36 | FromDiscord | <mratsim> ah it may not be that easy, you need some macro knowledge |
21:47:53 | FromDiscord | <speckledlemon> I do computational science and cannot design anything |
21:48:03 | FromDiscord | <mratsim> lol OK |
21:48:16 | FromDiscord | <speckledlemon> and have only done simple templates, no full-blown macros |
21:48:19 | FromDiscord | <mratsim> actually it's really easy |
21:48:31 | FromDiscord | <mratsim> hint, it should be a one-line change here: https://github.com/mratsim/Arraymancer/blob/master/src/nn_dsl/dsl_forwardsugar.nim#L13 |
21:48:58 | FromDiscord | <speckledlemon> ok |
21:49:49 | FromDiscord | <mratsim> otherwise you can always add new stuff that you find useful |
21:50:13 | FromDiscord | <mratsim> in general things related to Numpy, Scipy or scikit learn are OK |
21:50:38 | FromDiscord | <mratsim> and there is the SciNim gitter if you want to discuss with the other science people in the Nim community |
21:50:51 | FromDiscord | <mratsim> @Yardanico maybe we can add a bridge to SciNim? |
21:51:19 | FromDiscord | <mratsim> https://gitter.im/SciNim/community |
21:51:36 | Yardanico | well FromGitter isn't mine :D |
21:51:49 | FromDiscord | <mratsim> add Gitter support :p |
21:52:00 | * | audiophile joined #nim |
21:52:37 | FromDiscord | <speckledlemon> I was trying to do a very simple autograd example to compare against Python libs (outside the context of a network or training anything) and just could not figure it out in a reasonable amount of time...might revisit that at some point |
21:54:51 | * | audiofile quit (Ping timeout: 260 seconds) |
21:54:54 | * | audiophile is now known as audiofile |
21:55:02 | Yardanico | @mratsim well yeah I already had the idea to try to add gitter to ircord :P |
21:59:50 | * | jwm224 quit (Ping timeout: 260 seconds) |
22:00:46 | * | clemens3 quit (Read error: No route to host) |
22:01:36 | * | neceve quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
22:02:04 | * | neceve joined #nim |
22:02:49 | * | jwm224 joined #nim |
22:07:06 | * | lritter quit (Quit: Leaving) |
22:07:34 | FromDiscord | <Elegant Beef> So weirdly doing `fileName.getLevel` resolved my issue |
22:07:56 | FromDiscord | <Elegant Beef> Even though the only other getLevel has the same exact signature |
22:08:00 | * | jwm224 quit (Ping timeout: 256 seconds) |
22:08:05 | FromDiscord | <Elegant Beef> Thanks @mratsim |
22:08:46 | dadada | Clyybber: no, I need to cast something first to a pointer, and then back to a ref... to store values of different types in one data structure |
22:09:05 | FromDiscord | <mratsim> @speckledlemon that was my first project in Nim actually: https://github.com/mratsim/nim-rmad |
22:09:10 | * | jwm224 joined #nim |
22:09:13 | dadada | Clyybber: it does work at runtime, not at compiletime |
22:09:50 | FromDiscord | <mratsim> basically I was learning NN through this JS tutorial, but doing it in Nim: https://karpathy.github.io/neuralnets/ |
22:10:09 | FromDiscord | <mratsim> and then when I had 40 lines of gradient, I just gave up on the tutorial and did an autograd |
22:10:32 | FromDiscord | <speckledlemon> I should have clarified, I was trying to use autograd in Arraymancer...couldn't figure out the context stuff |
22:10:39 | FromDiscord | <mratsim> ah |
22:10:55 | FromDiscord | <mratsim> context is just some place that records operations |
22:11:24 | FromDiscord | <mratsim> it's a blackbox |
22:11:26 | FromDiscord | <mratsim> see https://github.com/mratsim/Arraymancer/blob/master/examples/ex03_simple_two_layers.nim#L17-L33 |
22:11:28 | FromDiscord | <Clyybber> dadada: What do you cast to a pointer? |
22:11:52 | dadada | Clyybber: ref object, but could also be NimNode to be honest |
22:11:58 | * | neceve quit (Ping timeout: 256 seconds) |
22:12:01 | dadada | basically anything :D |
22:13:03 | FromDiscord | <Clyybber> Hmm, casting a ref to a pointer and back is not a good idea in general though |
22:13:21 | FromDiscord | <Clyybber> Since when you don't guarantee that the ref isn't going to die in between |
22:13:24 | FromDiscord | <Clyybber> its unsafe |
22:13:32 | FromDiscord | <speckledlemon> hm, quite a simple example. I can't remember exactly what my confusion was other than it seemed as though I needed to define a network |
22:13:35 | FromGitter | <bung87> `Error: unhandled exception: value out of range: 3 notin -2147483648 .. 2147483647 [RangeError]` |
22:13:54 | FromGitter | <bung87> how does this happened? |
22:15:10 | FromDiscord | <Clyybber> bung87: Not sure, but there was a csize bug about that |
22:15:15 | FromDiscord | <Clyybber> You should report it if possible |
22:15:26 | FromDiscord | <Clyybber> But try on devel first if possible |
22:16:01 | FromGitter | <bung87> hmm, I cant narrow the problem where is. |
22:18:02 | * | abm quit (Quit: Leaving) |
22:18:34 | dadada | yeah, I've thought of that, what happens if I cast a Object[T] where t is string to a Object[T] where T is int, and then recast it to Object[T] where T is string, will it 1) work and will the string value still be the same as originally? ... I assume this will not even compile/work... but I'm grasping for solutions |
22:18:39 | dadada | @ clyybber |
22:19:10 | nimskull | I'm trying to make a flexible 2D array with default dimensions. I can use [M = 3, N: static[int]] as a generic type. I thought M was being explicitly given the static[int] type but when I changed to M=3, N=10: static[int] the compiler complained "expected ']', but got: ':'" |
22:19:18 | dadada | basically I've a list of Object[T] and I do not want a separate list for each type T can be |
22:19:34 | nimskull | in the original version, is M being given the static[int] type implicitly, or some other type the compiler infers? |
22:19:58 | nimskull | if I remove the ': static[int]' from the second, what types are inferred? |
22:20:36 | FromGitter | <bung87> `val.len.int32` val is a cstring ,this causes |
22:20:46 | FromDiscord | <Clyybber> dadada: Its a bad idea |
22:20:59 | FromDiscord | <Clyybber> dadada: And will not work with gc:arc |
22:21:00 | FromDiscord | <mratsim> @nimskull, it's pretty old but this is the codebase i used as reference when learning Nim: https://github.com/unicredit/linear-algebra/blob/master/linalg/private/types.nim#L14-L23 |
22:21:34 | FromDiscord | <mratsim> (and yes it's from the biggest Italian bank ;)) |
22:21:49 | FromDiscord | <Clyybber> dadada: Its likely to fail with the GC too, since the refcount of the string will change to 0 and it will get collected |
22:21:50 | nimskull | @mratsim I don't immediately see any default generic types... |
22:21:53 | FromGitter | <kaushalmodi> toy project of the day: https://github.com/kaushalmodi/get_version |
22:22:14 | FromDiscord | <Elegant Beef> Is it possible to import all nim files in a directory? |
22:22:25 | FromDiscord | <mratsim> ah no, you can't have default generic |
22:22:41 | Yardanico | @Elegant yes |
22:22:42 | nimskull | @mratsim: it compiles... |
22:22:42 | Yardanico | with a macro |
22:22:44 | FromDiscord | <Clyybber> dadada: If you want to do a kind of duck typing, I think its a better idea to generate case objects, or cast the address of what you want to use to a pointer. |
22:22:50 | FromDiscord | <Elegant Beef> Ah |
22:22:53 | FromDiscord | <mratsim> @speckledlemon you can have a context without a network, the network were added after, but it's quite tedious to use |
22:23:14 | FromGitter | <bung87> I insert blob to sqlite memory db, when I get back the value the repr second part inconstant , is it right? |
22:23:31 | FromDiscord | <mratsim> before: https://github.com/mratsim/Arraymancer/blob/master/benchmarks/ex01_xor.nim#L17-L25, after: https://github.com/mratsim/Arraymancer/blob/master/benchmarks/ex01_xor_dsl.nim#L17-L23 |
22:23:51 | Yardanico | @Elegant actually I found my macro |
22:23:53 | Yardanico | from my old project |
22:23:55 | PMunch | mratsim, wait, are you telling me that the bank UniCredit uses Nim? |
22:24:03 | FromDiscord | <Elegant Beef> Ah nice i was just about to start on mine 😄 |
22:24:37 | FromDiscord | <mratsim> @PMunch you would have to ask Andrea Ferretti about that |
22:24:37 | FromDiscord | <Elegant Beef> It |
22:24:43 | FromDiscord | <Elegant Beef> (edit) 'It' => 'It's super simple' |
22:24:45 | FromDiscord | <Elegant Beef> Which is nice |
22:24:50 | dadada | Clyybber: if I could cast this pointer back so that I could use it again like the original object, it would be fine, but this is exactly what I can't do in Nimscript, or my code was wrong, but it worked at runtime is all I can say, ..., for the most part I love Nim, really love it, but then things like this that should be simple are seemingly impossible |
22:25:35 | PMunch | dadada, there aren't pointers in NimScript.. |
22:25:46 | FromDiscord | <Clyybber> dadada: What you want to do is cast ptr T to pointer to ptr A and so on |
22:25:57 | FromDiscord | <Clyybber> But yeah may not work at compile time |
22:25:58 | Yardanico | @Elegant I just quickly translated comments into english, you'll have to adapt to your own project https://gist.github.com/Yardanico/60e3de6af76ee70d6023e1f6256fdf6b |
22:26:01 | FromDiscord | <Clyybber> Maybe it does tho |
22:26:14 | FromDiscord | <Clyybber> pointer support at compile time has gotten better |
22:26:24 | Yardanico | and then you call that macro |
22:26:29 | PMunch | Oh, are there actually pointers on compile-time now? |
22:26:29 | Yardanico | in the place where you want to import all files |
22:26:31 | FromDiscord | <Elegant Beef> Yea i got it |
22:26:32 | Yardanico | PMunch: yep |
22:26:41 | PMunch | Huh, TMYK |
22:26:45 | FromDiscord | <Elegant Beef> *I know how macros work* when dealing with the AST |
22:27:08 | PMunch | @Elegant Beef, "I know how macros work" that's a bold statement :P |
22:27:11 | FromDiscord | <Elegant Beef> Eh i think i might just make my own that takes a str to path |
22:27:16 | dadada | Clyybber: ah, thanks for the clue, I'll try that |
22:27:22 | FromDiscord | <Elegant Beef> Hey i have constructor doneish so that makes me an expert! |
22:27:27 | FromDiscord | <Elegant Beef> (edit) 'expert!' => 'expertish!' |
22:27:29 | PMunch | dadada, what are you trying to do? |
22:28:27 | dadada | PMunch: storing Object[T] for all types T can be in a common datastructure |
22:28:43 | PMunch | And by the way for you comment "for the most part I love Nim [...] but then things like this that should be possible are seemingly impossible", remember that most languages can barely do anything at compile-time :P |
22:29:05 | PMunch | dadada, ah that is indeed a bit tricky |
22:29:13 | PMunch | Simply because Object[T] can have different lengths |
22:29:20 | FromDiscord | <Elegant Beef> For the most part i love nim but the lack of official tab support is absurd 😛 |
22:29:37 | dadada | PMunch: you're absolutely right! I just sometimes hit a hard wall (like now), and it sucks especially if you were productive in the days before that |
22:30:03 | PMunch | So you either need to use an invariant object (which will always be the biggest possible size), or you need to use pointers and rely on some runtime logic to figure out what to cast them to. |
22:30:45 | dadada | well, I had that runtime logic, but it still failed at compile time, while it worked at runtime ,,, |
22:31:08 | dadada | I'll now try to use the tricks of casting from casts to casts that Clyybber mentioned |
22:31:13 | PMunch | dadada, for sure, I've been there. Everything seems to go fine then bam! But it gets easier the more you get used to it. And it always reminds me that I'm actually pretty close to hardware in Nim, which is what a lot of these "hard" things stem from. |
22:31:16 | Yardanico | @Elegant I also did a really simple logging implementation I used in that project |
22:31:17 | Yardanico | https://gist.github.com/Yardanico/61c1d7bd2cf59ceeff872b9803c44343 |
22:31:36 | nimskull | well! it accepts the definition, and you can use the procedure if you specify the value, but the default values don't work: https://play.nim-lang.org/#ix=2mRa |
22:32:08 | nimskull | actually you can specify the values, but they're ignored!! this is not good |
22:32:11 | PMunch | Hmm, I wish there was an easier way to define an invariant object for T |
22:32:21 | PMunch | Instead of having to list all the cases manually |
22:32:49 | PMunch | Have Nim build the invariant object based on whichever types it required, similar to how generic procedures work. |
22:33:06 | dadada | PMunch: that's if you have cases, but what if if you want to allow for any possible T... |
22:33:09 | PMunch | But I guess that would require runtime type information.. |
22:33:22 | PMunch | dadada, yeah I know |
22:36:37 | FromDiscord | <mratsim> "pointer at compile-time" wait what? |
22:36:45 | Yardanico | yes |
22:36:52 | Yardanico | https://nim-lang.org/docs/nims.html |
22:36:57 | Yardanico | "ptr operations are are hard to emulate with the symbolic representation the VM uses. They are available and tested extensively but there are bugs left." |
22:37:11 | FromDiscord | <mratsim> @nimskull, the fact that default are accepted is probably a bug, there is not even default for classic types |
22:37:12 | Yardanico | "ref ref int" wouldn't work tho |
22:38:08 | FromDiscord | <mratsim> if you want to do a default generic do it like this↵proc newMatrix(M: static int = 3, N: static int = 3): Matrix[M, N] |
22:38:31 | FromDiscord | <mratsim> or initMatrix if those are value types |
22:38:37 | FromDiscord | <mratsim> (Nim convention) |
22:39:25 | * | NimBot joined #nim |
22:42:07 | FromDiscord | <mratsim> you're trying to cast a string ... |
22:42:16 | FromDiscord | <mratsim> even at runtime that's sketchy |
22:42:24 | FromDiscord | <Elegant Beef> Well yard i just hardcoded the path cause it's just for levels and fuck people with different organization to mine |
22:43:36 | FromDiscord | <Elegant Beef> Toyed around with nico a bit and found the that you'd have to do levels appalling so cleaned it up so each level can be it's own self contained logic, and doesnt use a hideously large main file |
22:44:15 | PMunch | @mratsim, sure, but at least on runtime it works |
22:44:55 | PMunch | And it's actually the line with the int that fails |
22:45:08 | PMunch | Changing it to a more basic type yields the same error: https://play.nim-lang.org/#ix=2mRe |
22:45:44 | PMunch | @Elegant Beef, reminds me of a gamejam I did in Nim. I think the entire game was just one long file :P |
22:45:53 | FromDiscord | <Elegant Beef> Yea i dont like that one bit |
22:45:59 | FromDiscord | <Elegant Beef> My main file is 36 lines of code now |
22:46:32 | FromDiscord | <Elegant Beef> There is a "scene manager" which basically just a level which is the init,update, and draw procs |
22:46:37 | FromDiscord | <Elegant Beef> It's so much nicer to look at imo |
22:47:13 | PMunch | Oh don't get me wrong, I don't like it either :P |
22:47:22 | PMunch | But it's only so much you can do in 48 hours.. |
22:47:25 | PMunch | https://github.com/PMunch/TromsoGameJam2017/blob/master/src/sgtest.nim |
22:47:31 | PMunch | The file is even called test -_- |
22:47:32 | FromDiscord | <Elegant Beef> Yea i get it |
22:48:16 | PMunch | Favourite part has to be this: https://github.com/PMunch/TromsoGameJam2017/blob/master/src/sgtest.nim#L305 |
22:49:06 | FromDiscord | <Elegant Beef> oh god |
22:49:08 | FromDiscord | <Elegant Beef> https://github.com/beef331/nico-helper/blob/master/src/levels/title.nim |
22:49:11 | FromDiscord | <Elegant Beef> Look at that though |
22:49:13 | FromDiscord | <Elegant Beef> It's beautiful |
22:49:14 | PMunch | That line is 1276 characters long, and is a formula for calculating where the middle point of a cable with slack in it would be :P |
22:49:36 | Yardanico | jesuis |
22:49:48 | PMunch | That is actually pretty beautiful |
22:50:18 | FromDiscord | <Elegant Beef> Well im actually debating using nico so really wanted to make it maintainable |
22:50:24 | PMunch | (by the way, that formula was basically me setting up some formulas and passing it through WolframAlpha to solve for y) |
22:50:26 | FromDiscord | <Elegant Beef> Default nico is like fuck you and maintainabllity 😄 |
22:51:11 | PMunch | Man.. It's been way to long since I've done a gamejam.. |
22:51:36 | PMunch | 2017... |
22:51:38 | FromDiscord | <Elegant Beef> I did one not too long ago and continue to delay polishing it further |
22:51:45 | FromDiscord | <Elegant Beef> I've done quite a bit |
22:51:55 | PMunch | Oh yeah, I always do that |
22:52:07 | * | jwm224 quit (Quit: WeeChat 2.9-dev) |
22:52:10 | FromDiscord | <Elegant Beef> <https://jbeetham.itch.io/cords> one in question |
22:52:17 | PMunch | Come out of it thinking "with a bit of polish this would actually be a pretty good game", then years later *crickets* |
22:52:30 | FromDiscord | <Elegant Beef> I mean i've polished a bit |
22:52:31 | nimskull | what is nico? |
22:52:38 | FromDiscord | <Elegant Beef> pico but for nim |
22:52:46 | FromDiscord | <Elegant Beef> Basically best way to describe it |
22:52:50 | nimskull | pico the editor? |
22:52:53 | FromDiscord | <Elegant Beef> pico8 |
22:52:58 | FromDiscord | <Elegant Beef> The fantasy retro console |
22:53:12 | FromDiscord | <Elegant Beef> Nico isnt locked down as much as nico which is nice |
22:53:16 | FromDiscord | <Elegant Beef> You arent locked to 128x128 |
22:53:28 | FromDiscord | <Elegant Beef> *atleast i think pico is locked* |
22:53:38 | FromDiscord | <Elegant Beef> (edit) 'nico' => 'pico' |
22:53:41 | * | jwm224 joined #nim |
22:54:11 | nimskull | you're lucky nim is case sensitive to first character or that would be ambiguous |
22:54:40 | FromDiscord | <Elegant Beef> what? |
22:54:41 | PMunch | Araq, didn't you say this was a regression? https://github.com/nim-lang/Nim/commit/6b39b47abcf5c528dbaf84ca75b693d1fc4da004 |
22:54:55 | PMunch | Or is that just a fix to patch it over until the regression is fixed? |
22:55:09 | FromDiscord | <Elegant Beef> Hell pmunch i started on a unity build system in nim over polishing cords |
22:55:13 | FromDiscord | <Elegant Beef> It's comical 😄 |
22:55:38 | FromDiscord | <Elegant Beef> But hey i can now make desktop builds async so it's like <1min for 3 builds |
22:55:45 | FromDiscord | <Elegant Beef> Instead of doing them one by one |
22:55:55 | * | gxt joined #nim |
22:56:41 | PMunch | Haha, I had to go to the bottom of page 2 of my repositories to even find the code for that project.. |
22:56:53 | PMunch | So it's not like I've done nothing for the past 3 years :P |
22:57:30 | PMunch | nimskull, he's on Discord so for him that was just an edit |
22:57:44 | PMunch | He doesn't see the (edit) 'nico' => 'pico' bit |
22:58:01 | nimskull | confusing |
22:58:22 | PMunch | Welcome to the world of bridges |
22:58:36 | PMunch | Were everyone can talk to each other, but there is still a river of abstraction between us |
22:58:53 | nimskull | (edit) 'Were' => 'Where' |
22:59:01 | dadada | it annoys me to no end that the terminal in vscode disappears when going back into the source code, and there seems to be no setting for it |
22:59:04 | PMunch | Haha :P |
22:59:10 | dadada | or I'm blind |
22:59:23 | PMunch | dadada, that laugh wasn't meant for you by the way :P |
22:59:42 | PMunch | Join the dark side, use a terminal editor :) |
22:59:44 | dadada | PMunch: I'm glad you clarified, but I still felt like it was deserved |
23:00:03 | Yardanico | dadada: ctrl+` |
23:00:26 | Yardanico | ` is backtick (the key where you have ` and ~) |
23:00:30 | nimskull | I can't use my terminal IRC here because XftOpenFont breaks on the crown in the title |
23:00:35 | PMunch | Ctrl+Z to send the editor to the background, boom terminal. Done with the terminal? Write fg<enter> and boom you're right back where you left off in your editor. |
23:01:07 | PMunch | Yardanico, I hate ` as a shortcut key with passion.. |
23:01:12 | Yardanico | you can change it |
23:01:16 | PMunch | I know |
23:01:17 | PMunch | But still |
23:01:18 | dadada | Yardanico: what's supposed to happen there? nothing here |
23:01:23 | Yardanico | dadada: termina will open |
23:02:25 | PMunch | Hmm, maybe I should write a "Why I use terminal editors" article.. |
23:02:41 | dadada | Yardanico: ah, ctrl+shift+` works! |
23:02:46 | Yardanico | huh |
23:02:50 | Yardanico | i think you can rebind it |
23:06:51 | nimskull | the arraymancer documentation has a really annoyingly sensitive menu that I can't even access all of |
23:09:11 | PMunch | Is there anything special I should do to speed up embedded NimScript speed? |
23:09:51 | PMunch | With "-d:release -d:danger --gc:markandsweep" a simple echo "Hello from NimScript" is 10x slower than Python. |
23:10:04 | PMunch | Granted, Python has a lot more optimisation going on that NimScript |
23:10:07 | PMunch | But still, 10x? |
23:10:20 | nimskull | how to fill an arraymancer tensor with rand(1.0)? I can loop over each dimension but surely there's a better way |
23:10:27 | Yardanico | hmm |
23:10:27 | dadada | PMunch: I just wanted to say, especially with simple stuff like string manipulation python apparently can be very fast |
23:10:43 | dadada | PMunch: don't worry too much :D |
23:11:08 | Yardanico | can you guys check if that crashes for you? https://gist.github.com/Yardanico/194ef43f8dcfd1ada8eb379de6abaee9 |
23:11:09 | dadada | better help me to figure out why the casting that works at runtime fails at compiletime and then let's fix that |
23:11:32 | FromDiscord | <Elegant Beef> Now to try to clean this up further, can macros add to enums? |
23:12:36 | nimskull | Yardanico SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
23:12:41 | Yardanico | thanks |
23:12:49 | dadada | well, it doesn't necessarily have to be simple, but I mean the common stuff |
23:13:44 | PMunch | @Elegant Beef, define "add to" |
23:13:58 | PMunch | It can't add to an existing enum if that's what you're asking |
23:14:24 | FromDiscord | <Elegant Beef> Yea that's what i was asking |
23:14:51 | PMunch | I don't worry :P I was just curious if I was doing something silly :P |
23:15:00 | * | fredrikhr quit (Quit: Client Disconnecting) |
23:16:42 | * | natrys quit (Quit: natrys) |
23:17:35 | * | krux02 quit (Remote host closed the connection) |
23:21:17 | PMunch | Curiously it's creating the interpreter that takes most of the time: http://ix.io/2mRj |
23:21:43 | PMunch | Actually executing a routine from the script is virtually free |
23:22:46 | nimskull | Is there a good profiler for nim? |
23:23:13 | PMunch | valgrind? |
23:24:07 | * | Trustable quit (Remote host closed the connection) |
23:26:53 | Yardanico | ok seems like I found some kind of GC regression between 1.0.6 and 1.2.0 |
23:27:54 | Yardanico | guess I'll have to use git bisect :P |
23:29:36 | PMunch | https://github.com/nim-lang/Nim/issues/14409 |
23:32:19 | Yardanico | https://github.com/nim-lang/Nim/issues/14410 |
23:32:21 | Yardanico | XD |
23:32:58 | Yardanico | time to git bisect |
23:34:15 | PMunch | "Additional Information: Works with --gc:arc" |
23:34:19 | PMunch | Welcome to the future! |
23:35:17 | Yardanico | yep |
23:38:11 | Yardanico | funny how I found this regression in my old project :D |
23:38:58 | skrylar[m] | i've started testing arc a little |
23:39:14 | skrylar[m] | hm. i wonder if anything stupid happens with nim code used as a plugin |
23:39:27 | Yardanico | with arc - nothing bad should happen |
23:39:28 | skrylar[m] | there were weird rules for writing vsts because of how everything gets loaded in the address spaces |
23:39:29 | zacharycarter | I'm already using Nim code in plugins |
23:39:41 | zacharycarter | w/ arc |
23:39:52 | zacharycarter | https://github.com/zacharycarter/frag |
23:39:54 | skrylar[m] | more worried about if the rtl will step on itself |
23:40:16 | skrylar[m] | with vsts you cant use like, gtk2 and gtk3, because if the host loads gtk3 and a plugin tries to load gtk2 the symbols clash |
23:40:47 | skrylar[m] | so if one plugin is nim 1.2 and another is nim 1.3, will they work or will they kill each other |
23:40:55 | skrylar[m] | :mysteryghost: |
23:41:21 | zacharycarter | probably if you're using the stdlib |
23:42:19 | skrylar[m] | i guess we should talk about decoupling strings/seqs from the stdlib |
23:42:42 | skrylar[m] | i know obj-c does something weird like this; if you try to use an objc compiler without openstep or cocoa it just whines that a bunch of magic classes aren't implemented |
23:43:25 | skrylar[m] | i dunno if the segment is large enough but the vst stuff has like, no variety. you get c++ and probably juce, and that's about it |
23:43:26 | PMunch | Hmm, interesting |
23:44:36 | PMunch | I set it up to use my local branch of Nim, and now I'm 10ms off-of Python performance for the simple "Hello world" script test |
23:46:10 | PMunch | Instead of 10x off |
23:46:30 | PMunch | (Which was about 300ms) |
23:50:45 | PMunch | Curiously it also compiles with arc/orc, but fails on running the script |
23:50:54 | Yardanico | PMunch: yeah I know about that |
23:51:01 | Yardanico | nimsuggest fails too, the compiler can compile but fails too |
23:51:11 | Yardanico | runtime bugs are the worst ones ;P |
23:52:48 | Yardanico | time to git bisect |
23:55:55 | leorize[m] | skrylar[m]: plugins compiled with different versions of Nim will work fine |
23:56:18 | leorize[m] | they will die if you try to pass `ref`s between them though |
23:58:28 | * | ftsf joined #nim |