00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:01:46 | * | junland joined #nim |
00:11:27 | * | Guest1516 is now known as dadada |
00:11:40 | * | vicfred joined #nim |
00:11:56 | dadada | hi nim people! |
00:12:05 | Yardanico | hello |
00:12:25 | dadada | this day goes down in history with a great new release of moe https://github.com/tobimensch |
00:12:33 | dadada | ah sorry, wrong link, that's my github |
00:12:35 | Yardanico | wrong link :P |
00:12:50 | Yardanico | waiting for moe lsp or nimsuggest support :P |
00:12:56 | dadada | https://github.com/fox0430/moe |
00:13:16 | dadada | https://github.com/fox0430/moe/releases/tag/v0.2.1 |
00:14:01 | dadada | me too, but it's already useful now, I edit configs with it and so on |
00:14:22 | dadada | it's won't be long before developing with it will make sense |
00:15:31 | dadada | s/it's/it |
00:16:46 | dadada | there are still a few basic vim operations that I miss, but those can be added quickly |
00:17:27 | dadada | https://github.com/fox0430/moe/projects/26 |
00:17:41 | dadada | Simple auto complete is planned for the next release |
00:17:51 | dadada | LSP/nimsuggest will probably be next after that |
00:20:38 | dadada | a lightweight, really great editor, with sensible defaults, vim keys, great nim support, that's what's it going to be |
00:24:28 | dadada | https://github.com/fox0430/moe/issues/523 <- help wanted ... If you want LSP support, maybe join the project? |
00:24:29 | disbot | ➥ Language Server Protocol |
00:34:29 | leorize | freshly stale: https://github.com/nim-lang/Nim/issues/6169 |
00:34:30 | disbot | ➥ Type inference struggles with `result` inside closures |
01:02:58 | FromDiscord | <Elegant Beef> What does freshly stale mean, does it taste stale but is still texturally fine, or is the flavour good and texture off? |
01:03:28 | Yardanico | open the issue to understand |
01:03:58 | FromDiscord | <Elegant Beef> I wasnt being serious, i knew it was the stalebot kicking in on an issue |
01:17:59 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
01:50:51 | * | endragor joined #nim |
02:01:02 | * | apahl quit (Ping timeout: 246 seconds) |
02:03:09 | * | apahl joined #nim |
02:31:40 | dadada | anyone know something better than base64 for encoding binary data to store it in a text file? |
02:31:51 | Yardanico | why do you need to encode it? |
02:31:58 | Yardanico | just write bytes to the file? |
02:32:05 | Yardanico | or you want to have it as ASCII bytes in the end? |
02:32:12 | Yardanico | I mean human-readable ascii |
02:32:18 | dadada | Yardanico: it's a regular txt file that I'm editing with a text editor |
02:32:27 | Yardanico | well then there's no good alternative] |
02:32:35 | dadada | and I want to put some data in the bottom of the file |
02:34:28 | dadada | ... yeah, I figured as much... |
02:52:47 | * | muffindrake quit (Ping timeout: 240 seconds) |
02:55:13 | * | muffindrake joined #nim |
02:58:07 | * | Jesin quit (Quit: Leaving) |
03:03:43 | * | Jesin joined #nim |
03:08:45 | * | Zevv quit (Quit: Lost terminal) |
03:09:02 | * | Zevv joined #nim |
03:09:25 | Zevv | so, there is your third nim bug |
03:11:14 | disruptek | go back to bed, zevv. |
03:20:41 | Zevv | nope |
03:21:29 | Zevv | coffee, then load up the dog and out for a little hike |
03:21:52 | disruptek | neat. |
03:24:00 | * | Zevv quit (Quit: Lost terminal) |
03:24:13 | * | Zevv joined #nim |
03:24:31 | Zevv | wow stale bugs get closed automatically, no way |
03:24:54 | disruptek | it's pretty awesome, right? |
03:25:09 | Zevv | that is great stuff |
03:25:19 | Zevv | well end up with only a hundred or so |
03:25:30 | Zevv | must be a pretty smart bot if it can do that |
03:25:49 | Zevv | we wont need clyybber anymore |
03:25:55 | disruptek | coffee, zevv, then load up the dog. |
03:26:12 | Zevv | yeah doing just that, but its still to hot |
03:26:15 | Zevv | the coffee |
03:26:33 | disruptek | i just sat down to mangling. |
03:26:40 | disruptek | did you know it doesn't build in release mode? |
03:26:49 | disruptek | we need to get that bot in here. |
03:26:51 | Zevv | nope :( |
03:27:11 | Zevv | i browsed through the patch, its super nasty stuff all that |
03:27:19 | disruptek | oh c'mon. |
03:28:12 | disruptek | it's pretty tame compared to IC. |
03:29:13 | shashlick | weave is getting annoying now - mratsim is never around when i run into issues 😐 |
03:29:42 | disruptek | there's this new thing called `cps`... |
03:29:49 | shashlick | well, how do I use it |
03:29:57 | disruptek | got me. that's zevv's department. |
03:30:24 | disruptek | did you look at the tests? |
03:32:39 | FromDiscord | <flywind> Hi, disruptek. How can I implement timerfd in windows? Many cross platform event libraries use their own cross-platform timer(based on heap or timerwheel). It is hard to implement timerfd in windows because `wepoll` only supports registering socketHandle instead of Handle(waitable timer objects). |
03:33:13 | disruptek | i dunno, but there's a work-around in async that solves the problem there, right? |
03:33:27 | disruptek | this is why i asked you about timers... 😉 |
03:34:06 | disruptek | someone starred a tiny timewheel impl that you could port. |
03:34:16 | disruptek | timerwheel, too. |
03:34:54 | shashlick | let's just say the doc example and the tests are greek |
03:34:56 | FromDiscord | <flywind> I think `asyncdispatch` use its own cross platform timer (based on heap) instead of `timerfd`. |
03:35:12 | * | Zevv quit (Quit: Lost terminal) |
03:35:14 | disruptek | can we do that? |
03:35:23 | disruptek | shashlick: look at the echo server in stash/ |
03:35:32 | disruptek | shashlick: or, really, anything in there. |
03:35:35 | * | Zevv joined #nim |
03:36:05 | disruptek | flywind: timers are outside the scope of cps, anyway; we can do whatever we want, there. |
03:37:15 | Zevv | shashlick: but stuff is not really in a functional state all of the time |
03:37:18 | Zevv | like, now, I think |
03:37:30 | disruptek | i think it is. |
03:37:39 | Zevv | lemme see |
03:37:41 | FromDiscord | <flywind> Ok, I will try to implement it in selectors. |
03:38:06 | Zevv | type mismatch: got <None> but expected 'proc (c: Cont): Cont' |
03:38:11 | Zevv | I need to take out the c: ? |
03:39:13 | Zevv | nope, c'est cassée |
03:39:27 | disruptek | 0.0.13 is solid. |
03:39:29 | disruptek | i swear. |
03:39:38 | Zevv | yeah ok, but people try master of course |
03:39:40 | Zevv | 0.0.13 is ok |
03:40:47 | Zevv | almost :) |
03:40:53 | Zevv | ooh I hear birds, I'm out |
03:41:03 | disruptek | i think i left a quit(1) in 0.0.13. but don't worry about it. |
03:41:08 | disruptek | just look at stash stuff. |
03:43:34 | shashlick | you need a simple example - how to run two procs with a sleep each in pseudo parallel - where sleep is a proxy for a io intensive task |
03:43:35 | disruptek | flywind: you're going to use the heap impl? |
03:43:46 | disruptek | shashlick: that's what tock is. |
03:44:34 | shashlick | what's yield though |
03:44:48 | disruptek | just a keyword we overloaded. |
03:45:00 | disruptek | the only one we overloaded. |
03:45:20 | shashlick | do you need to use yield or cps or something when you do something io intensive |
03:45:43 | disruptek | you use yield when you call a primitive. |
03:45:56 | disruptek | some primitives are defined in cps/eventqueue.nim. |
03:46:01 | disruptek | you can see how they work... |
03:46:36 | disruptek | you can use that dispatcher or you can supply your own and not even import eventqueue. |
03:47:53 | FromDiscord | <flywind> disruptek: Heap version is simpler than `timerWheel` and I'm lazy😜 . I will look into `timerWheel` too. |
03:48:43 | disruptek | fair enough. |
03:49:50 | disruptek | `yield foo()` is the same as `cps foo()` right now. |
03:55:50 | * | vicfred quit (Quit: Leaving) |
04:00:56 | silvernode[m] | morning |
04:02:09 | silvernode[m] | Isn't there a way to do "from libraryFile import proc"? |
04:02:54 | silvernode[m] | I swear I saw that somewhere but apparently "from" is not a keyword |
04:03:28 | disruptek | your syntax is correct. |
04:03:33 | disruptek | from module import symbol |
04:04:30 | disruptek | from appears in doc/keywords.txt |
04:04:38 | disruptek | where did you read that it's not a keyword? |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:40 | * | supakeen joined #nim |
04:16:39 | silvernode[m] | <disruptek "where did you read that it's not"> The compiler is yelling at me |
04:16:58 | silvernode[m] | Latest stable version of Nim |
04:16:59 | disruptek | pay no attention to the man behind the curtain. |
04:18:14 | silvernode[m] | It's probably due to me trying to import an incorrectly named module. I just want to use write or writeLine() without typing stdout.write for example. |
04:18:31 | silvernode[m] | I figure it's part of the stdout lib but apparently not? |
04:18:58 | disruptek | stdout is the name of a filestream. |
04:19:16 | disruptek | stdout.write is the same as saying write(stdout). |
04:19:33 | disruptek | stdout is a value. |
04:20:07 | silvernode[m] | right, I freaking knew that lol, small brain. |
04:20:29 | disruptek | UFCS can be confusing. |
04:20:46 | silvernode[m] | because stdout.writeLine("hello") is the same as writeLine(stdout, "hello") |
04:20:59 | disruptek | indeed. |
04:21:02 | silvernode[m] | duh silvernode |
04:21:27 | disruptek | there are two things i really struggle with: |
04:21:34 | disruptek | UFCS style, and |
04:21:38 | disruptek | regular bathing. |
04:23:26 | silvernode[m] | Is there a way to detect when a user sends a signal to the terminal like Ctrl+C? |
04:23:32 | disruptek | sure. |
04:24:32 | silvernode[m] | I am trying to avoid the error output that appears when cancelling somethng with ctrl+c |
04:24:47 | silvernode[m] | I want to replace that with a message of my own so it looks nicer |
04:25:01 | disruptek | https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29 |
04:26:26 | silvernode[m] | perfect, now i just need to figure out how to properly use it. There does not seem to be an example |
04:26:31 | silvernode[m] | thanks disruptek |
04:27:05 | disruptek | there's an example in golden; see src/golden.nim |
04:27:07 | disruptek | !repo golden |
04:27:08 | disbot | https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 🏆 15 22⭐ 0🍴 |
04:33:36 | silvernode[m] | found the example, playing with it in my code now. It's going to take awhile to wrap my head around how to customize it but that's part of the fun I guess. |
04:35:53 | silvernode[m] | Figured it out |
04:36:25 | * | vicfred joined #nim |
04:36:53 | disruptek | raise newException(BenchmarkusInterruptus, "") |
04:37:03 | silvernode[m] | You have to basically create a proc that contains what you want to happen, then pass that proc to setControlCHook |
04:37:09 | disruptek | i wouldn't have thought that has hard to grok. |
04:37:34 | silvernode[m] | My brain tends to abstract things |
04:38:07 | disruptek | well, my neckbeard smells like vomit. |
04:38:15 | disruptek | i guess that makes us even. |
04:40:09 | silvernode[m] | hah |
04:46:48 | silvernode[m] | time to go clock in for work, have a good night everyone. |
05:22:42 | * | solitudesf joined #nim |
05:50:38 | Zevv | ha |
06:51:00 | * | solitudesf quit (Remote host closed the connection) |
06:54:10 | * | solitudesf joined #nim |
07:12:31 | * | arecacea1 quit (Read error: Connection reset by peer) |
07:14:44 | * | arecacea1 joined #nim |
07:34:01 | FromDiscord | <ShalokShalom> is there map, reduce and so on? |
07:38:23 | FromDiscord | <mattrb> Yeah |
07:39:08 | FromDiscord | <mattrb> Does anyone here have experience with nim and emscripten? |
07:43:19 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2tFy |
07:46:18 | FromDiscord | <mattrb> God I'm dumb |
07:47:04 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2tFA |
07:48:59 | FromDiscord | <Varriount> @mattrb you didn't set the export babe? |
07:49:08 | FromDiscord | <Varriount> name |
07:49:29 | FromDiscord | <mattrb> I spelled the function in Nim "testProc" and tried to call "test" from JS :facepalm: |
07:49:42 | FromDiscord | <Varriount> Yeah |
07:50:08 | FromDiscord | <mattrb> Ah yeah so I could have just set the export in exportc too 🤷♀️ |
07:51:01 | FromDiscord | <mattrb> (edit) "Ah yeah so I could have just set the export in exportc ... too" added "pragma" |
07:51:11 | FromDiscord | <mattrb> Gotta love bugs like that |
07:56:37 | FromDiscord | <lqdev> @ShalokShalom yes, see sequtils |
07:56:37 | * | letto quit (Quit: Konversation terminated!) |
07:58:37 | * | letto joined #nim |
08:07:51 | FromDiscord | <ShalokShalom> @mattrb In the standard Nim disribution? |
08:11:02 | * | NimBot joined #nim |
08:13:12 | FromDiscord | <ShalokShalom> thanks a lot |
08:17:37 | FromDiscord | <ShalokShalom> And pipes? |
08:17:56 | FromDiscord | <ShalokShalom> Like |> passes one function into another, in F# and Haskell. |
08:20:42 | * | apahl quit (Ping timeout: 260 seconds) |
08:21:32 | * | apahl joined #nim |
08:25:18 | FromDiscord | <ShalokShalom> (edit) Like |> passes one function into another, in F# and & in Haskell. Is there something like that? |
08:30:39 | FromDiscord | <mattrb> @Varriount Do you have experience with nim/emscripten? |
08:35:25 | FromDiscord | <mattrb> Or does anyone else have a clue how to use emscripten's `ccall` to call Nim function with an array? I seem to get receiving empty arrays in nim |
08:56:52 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:00:08 | * | k0mpjut0r quit (Quit: Idle for 30+ days) |
09:04:27 | * | drewr quit (Ping timeout: 260 seconds) |
09:05:57 | * | drewr joined #nim |
09:11:29 | * | xet7 joined #nim |
09:12:25 | * | maier_ quit (Ping timeout: 244 seconds) |
09:17:15 | FromDiscord | <mattrb> Hmm I got it to sort of work by taking a pointer to a seq[byte] and a length as parameters, then reading it into a new seq. Unfortunately, it seems like I’m getting different values in the resulting seq for some reason.. |
09:29:48 | Oddmonger | [] for dereferencing, that's cute (even if in C [] is not a pointer :þ ) |
09:37:04 | * | waleee-cl joined #nim |
09:47:38 | * | maier joined #nim |
10:05:43 | * | Cthalupa quit (Ping timeout: 265 seconds) |
10:07:15 | * | Cthalupa joined #nim |
10:12:48 | * | Vladar joined #nim |
10:13:16 | * | opi joined #nim |
10:18:38 | * | clyybber joined #nim |
10:32:25 | * | maier quit (Ping timeout: 240 seconds) |
10:32:36 | FromDiscord | <lqdev> @ShalokShalom#6109 you can just use the method call syntax, eg. `" hello ".strip.toUpper` |
10:34:23 | * | maier joined #nim |
10:39:45 | * | maier quit (Ping timeout: 240 seconds) |
10:43:12 | * | moerm joined #nim |
10:43:31 | moerm | Hello averyone ;) |
10:51:42 | clyybber | sup |
11:06:21 | * | Perkol joined #nim |
11:07:35 | * | lritter joined #nim |
11:10:48 | * | haxscramper joined #nim |
11:34:45 | jken | How do I make nimble forget links Ive made with nimble develop? |
11:36:29 | moerm | Have a nice day everybody |
11:36:36 | * | moerm quit (Quit: Leaving) |
11:36:53 | * | clyybber quit (Quit: WeeChat 2.9) |
11:50:18 | FromDiscord | <lqdev> jken: nimble remove? |
11:52:37 | * | opal quit (Remote host closed the connection) |
11:55:42 | * | opal joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:33 | * | xet7 quit (Quit: Leaving) |
12:06:48 | * | supakeen joined #nim |
12:07:05 | * | xet7 joined #nim |
12:11:23 | * | Vladar quit (Quit: Leaving) |
12:33:51 | FromDiscord | <XxDiCaprioxX> Is there an image type in nim? |
12:46:55 | FromDiscord | <XxDiCaprioxX> how do i declare an array in a type statement? |
12:47:56 | solitudesf | https://nim-lang.org/docs/tut1.html#advanced-types-arrays |
12:50:01 | FromDiscord | <XxDiCaprioxX> thx |
13:01:46 | * | Perkol quit (Remote host closed the connection) |
13:02:29 | FromDiscord | <abisxir> How is the life cycle of a proc in nim when it is inside another proc? |
13:04:30 | FromDiscord | <Clyybber> just as you expect |
13:04:32 | * | Vladar joined #nim |
13:04:35 | FromDiscord | <Clyybber> probably :) |
13:05:26 | FromDiscord | <abisxir> 😅 |
13:06:00 | FromDiscord | <abisxir> So it is defined like a variable and when we are out of the scope there is no valid proc anymore? |
13:06:19 | FromDiscord | <abisxir> For example, is this code valid: |
13:06:37 | FromDiscord | <abisxir> sent a long message, see http://ix.io/2tHa |
13:06:43 | FromDiscord | <Clyybber> yeah its valid |
13:07:02 | FromDiscord | <abisxir> Cool 🙂 |
13:07:29 | FromDiscord | <Tangil> sent a long message, see http://ix.io/2tHb |
13:07:38 | FromDiscord | <Tangil> https://media.discordapp.net/attachments/371759389889003532/742006173192028210/LetterDraftAI.zip |
13:07:39 | FromDiscord | <Tangil> https://media.discordapp.net/attachments/371759389889003532/742006175746490419/LetterDraftAINim.zip |
13:08:13 | * | joelanglois quit (Quit: Connection closed for inactivity) |
13:08:50 | FromDiscord | <abisxir> @Tangil have you compiled nim with -d:release --opt:speed ? |
13:09:15 | FromDiscord | <Tangil> i did `-d=danger --panics=on` since someone suggested that. i'll try your suggestion too |
13:09:18 | FromDiscord | <Rika> oh wow so many new people, did someone post something to HN? |
13:10:14 | FromDiscord | <Tangil> using `-d:release --opt:speed` does not increase the speed |
13:10:15 | FromDiscord | <Recruit_main707> I just constanly bombard them with nim ;P |
13:10:43 | FromDiscord | <Rika> @Tangil give me a moment, i'll try reading through the nim code to see what's being slow |
13:11:29 | FromDiscord | <Tangil> i'm aware that using an array instead of a seq would be faster, but i'm comparing it to c# where i'm using a list instead of an array anyway |
13:11:46 | FromDiscord | <Tangil> (edit) "i'm aware that using an array instead of a seq ... would" added "for `allChampions`" |
13:12:07 | * | oddp joined #nim |
13:13:43 | FromDiscord | <abisxir> @Tangil loadChampions proc is slower? |
13:13:55 | FromDiscord | <Tangil> no, that's not what i'm measuring |
13:14:13 | FromDiscord | <Tangil> i'm only measuring negamax |
13:16:58 | FromDiscord | <Rika> profiling shows validateMove being really slow |
13:18:05 | FromDiscord | <XxDiCaprioxX> Creating a hash with a string and array gives me the error `illformed AST: Hash[]` |
13:18:25 | FromDiscord | <Rika> code? |
13:19:34 | FromDiscord | <XxDiCaprioxX> ``` InfoArray = array[3, Uri] info: InfoArray proc variationHash(x: Variation): Hash =↵ result = x.name.hash !& x.info.hash↵ result = !$result↵``` |
13:19:55 | FromDiscord | <XxDiCaprioxX> (edit) "``` InfoArray = array[3, Uri] info: InfoArray proc variationHash(x: Variation): Hash =↵ result = x.name.hash !& x.info.hash↵ result = !$result↵```" => "sent a code paste, see https://play.nim-lang.org/#ix=2tHg" |
13:20:15 | FromDiscord | <Rika> uh, you dont put code under a `type` block |
13:20:24 | FromDiscord | <XxDiCaprioxX> It is not |
13:20:33 | FromDiscord | <XxDiCaprioxX> Discord just messed up the formatting |
13:20:48 | FromDiscord | <Rika> it still looks like you are |
13:20:53 | FromDiscord | <Rika> i'm kinda confused, sorry |
13:21:00 | FromDiscord | <XxDiCaprioxX> (edit) "https://play.nim-lang.org/#ix=2tHg" => "https://play.nim-lang.org/#ix=2tHi" |
13:21:10 | FromDiscord | <XxDiCaprioxX> Is this more readable? |
13:21:27 | FromDiscord | <XxDiCaprioxX> (edit) "https://play.nim-lang.org/#ix=2tHk" => "https://play.nim-lang.org/#ix=2tHj" |
13:21:37 | FromDiscord | <XxDiCaprioxX> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2tHl |
13:21:55 | FromDiscord | <Rika> ah yes |
13:23:10 | FromDiscord | <Rika> what line is the error saying it is happening at? |
13:24:08 | FromDiscord | <XxDiCaprioxX> It is `illformed AST: Hash[]` in the line `result x.name.hash !& x.info.hash` at the info.hash |
13:26:22 | FromDiscord | <Rika> i'm stumped, i think its because Uri has no hash function |
13:26:49 | FromDiscord | <XxDiCaprioxX> Is there a string.toUri? |
13:27:13 | FromDiscord | <XxDiCaprioxX> So I can save it as a string and then turn it into an Uri on printout |
13:27:32 | FromDiscord | <Rika> parseUri |
13:28:37 | FromDiscord | <Rika> @Tangil i know! try using --gc:arc |
13:29:03 | FromDiscord | <Tangil> `-d:release --opt:speed --gc:arc` like this? |
13:29:04 | FromDiscord | <Rika> wait, one more idea |
13:29:12 | FromDiscord | <Rika> make `Champion` a ref |
13:29:44 | FromDiscord | <Rika> and then explicitly make shallow copies when they really need to be copies (mutated) |
13:30:25 | FromDiscord | <Tangil> using gc:arc made it slower, but i'll try making Champion a ref |
13:31:40 | FromDiscord | <Tangil> wow ref made it a lot faster |
13:31:49 | FromDiscord | <Tangil> down to 1442ms now |
13:31:51 | FromDiscord | <Tangil> thanks |
13:31:54 | FromDiscord | <Tangil> (edit) "thanks" => "thanks!" |
13:32:26 | FromDiscord | <Rika> using --gc:arc with refs doubles speed too from my test |
13:32:35 | FromDiscord | <Rika> but then you have to mind ref semantics |
13:32:43 | FromDiscord | <Rika> making explicit copies when needed |
13:32:45 | FromDiscord | <XxDiCaprioxX> Okay thanks Rika I got it now |
13:33:00 | Zevv | en interstingly, most people *think* in ref semantics |
13:33:11 | Zevv | because that what you get in most languages |
13:33:21 | FromDiscord | <Tangil> i don't mutate Champion, and i already wrote the C# with ref in mind since C# objects are reference objects |
13:33:28 | FromDiscord | <Tangil> (edit) "i don't mutate Champion, and i already wrote the C# ... with" added "code" |
13:33:34 | FromDiscord | <Tangil> (edit) "i don't mutate Champion, and i already wrote the C# code with ref in mind since C# objects are ... reference" added "by" | removed "objects" |
13:33:43 | FromDiscord | <Rika> @XxDiCaprioxX i'm sorry i dont really know what went wrong, but the Uri thing is my suspicion |
13:33:52 | FromDiscord | <Rika> ah then all is good 😛 |
13:35:16 | FromDiscord | <Tangil> still quite a bit slower than c# but this was a nice improvement |
13:35:32 | * | abm joined #nim |
13:36:18 | * | solitudesf quit (Remote host closed the connection) |
13:37:47 | FromDiscord | <Tangil> are sequences passed by value or reference in procs? |
13:37:54 | FromDiscord | <Rika> value |
13:38:18 | FromDiscord | <Rika> everything that isnt "ref" is by value, even if under the hood they are heap allocated |
13:40:15 | Oddmonger | ref or ptr , isn't it ? |
13:40:41 | Oddmonger | or are ptr reserved for C binding ? |
13:42:09 | * | krux02 joined #nim |
13:42:54 | FromDiscord | <Recruit_main707> ptr to afaik |
13:43:00 | FromDiscord | <Recruit_main707> too |
13:43:28 | FromDiscord | <Recruit_main707> It can be used without binding to c |
13:44:35 | * | Cthalupa quit (Ping timeout: 240 seconds) |
13:44:49 | FromDiscord | <abisxir> @Tangil line 58 you copy the seq: var newMove = pickBans |
13:45:39 | FromDiscord | <Tangil> yeah, i tried to keep it like C# |
13:46:45 | FromDiscord | <abisxir> Then in line 27 maybe you can define your seq as var |
13:47:03 | FromDiscord | <abisxir> proc negamaxHeuristicMaxWr(pickBans: seq[Champion]): float to proc negamaxHeuristicMaxWr(pickBans: var seq[Champion]): float |
13:47:18 | * | Cthalupa joined #nim |
13:47:22 | FromDiscord | <abisxir> It also prevents sequence copy |
13:47:40 | FromDiscord | <Tangil> but i need to create a new copy for every iteration of that loop |
13:48:01 | FromDiscord | <Tangil> i'm adding a different element to a new copy |
13:48:06 | FromDiscord | <Tangil> (edit) "i'm adding a different element to a new copy ... " added "each iteration" |
13:48:16 | FromDiscord | <abisxir> But you pass newMove, I think you copied it already |
13:48:23 | FromDiscord | <Tangil> ah ok |
13:49:34 | FromDiscord | <Tangil> it's not any faster but i see the idea behind the optimisation |
13:50:31 | FromDiscord | <Tangil> i tried making all the sequences in the proc parameters var but i didn't get any increase in speed. does var in a parameter make it pass by reference? |
13:50:47 | FromDiscord | <abisxir> Any direct pass, with no var or ptr, is a copy and assignment, so you can prevent it as much as your algo allows it |
13:51:59 | FromDiscord | <abisxir> I think so |
13:53:53 | FromDiscord | <Rika> var uses by ref yes |
13:55:12 | FromDiscord | <Tangil> just realised i did `0..10` instead of `0..9` so it was taking an extra trial into account when benchmarking |
13:55:42 | FromDiscord | <Tangil> didn't really change the benchmarks but just thought i should let you know just in case |
13:56:17 | FromDiscord | <Tangil> what about using ref instead of var in the proc parameters? how would that change things? |
13:57:33 | FromDiscord | <Rika> harder to use for no real gain |
13:58:49 | FromDiscord | <Tangil> dang |
13:59:29 | FromDiscord | <Clyybber> dont use var params to elide copies |
13:59:38 | FromDiscord | <Clyybber> its not needed |
14:02:04 | FromDiscord | <Tangil> so i shouldn't use var in these procs? |
14:02:45 | FromDiscord | <Clyybber> no, if you don't want to modify it its not needed |
14:03:04 | FromDiscord | <Clyybber> nim automatically passes by reference if thats faster |
14:03:07 | FromDiscord | <Tangil> ah ok |
14:03:40 | FromDiscord | <Tangil> explains why i didn't see any change |
14:04:35 | FromDiscord | <Clyybber> you could try doing `var newMove: seq[Champion]; shallowCopy(newMove, pickBest)` instead |
14:04:39 | FromDiscord | <Clyybber> and try without gc:arc |
14:05:12 | FromDiscord | <Tangil> wasn't using gc:arc since it was slowing things down, but i'll try your other suggestion |
14:05:25 | FromDiscord | <Clyybber> It shouldn't change anything I think |
14:05:34 | FromDiscord | <Clyybber> but if it does, then we'll know more :) |
14:06:53 | FromDiscord | <Recruit_main707> Did you use arc and refs?↵I think that was what Rika meant before |
14:08:52 | FromDiscord | <Tangil> the shallowCopy change gives me an index out of bounds exception, so i'll try to debug that and then get back to you on how it changed things |
14:09:44 | FromDiscord | <Clyybber> oh, no need to debug that |
14:09:48 | FromDiscord | <Clyybber> it was just a hunch |
14:09:52 | FromDiscord | <Clyybber> it probably won't change much |
14:09:56 | FromDiscord | <Tangil> oh ok |
14:10:00 | * | solitudesf joined #nim |
14:10:05 | FromDiscord | <Clyybber> I'm gonna download and see what I can do |
14:10:43 | FromDiscord | <Tangil> cool, thanks |
14:18:46 | * | Avatarfighter joined #nim |
14:21:32 | FromDiscord | <Clyybber> Huh |
14:21:51 | FromDiscord | <Clyybber> Arc improves it from 53 secs to 17 |
14:22:04 | FromDiscord | <Clyybber> This is without making the objects refs |
14:23:41 | FromDiscord | <Clyybber> And gc:arc with refs improves it to 6 secs |
14:23:56 | FromDiscord | <Clyybber> @Tangil what version are you on? |
14:24:09 | FromDiscord | <Tangil> i installed nim yesterday, so probably the latest version |
14:24:22 | FromDiscord | <Clyybber> Ok, so the only change I did was change Champion to be a ref object |
14:24:27 | FromDiscord | <Clyybber> And compile with --gc:arc |
14:24:46 | FromDiscord | <Clyybber> Adding -d:danger I get 1 sec |
14:25:16 | FromDiscord | <Clyybber> @Tangil Do you use choosenim? |
14:25:37 | FromDiscord | <Tangil> no i just placed the zip from the website into program files |
14:25:40 | FromDiscord | <Clyybber> Ah ok |
14:26:04 | FromDiscord | <Clyybber> Can you try these: https://github.com/nim-lang/nightlies/releases/tag/2020-08-07-devel-d9ed816 |
14:26:21 | FromDiscord | <Clyybber> And are you sure you compiled with --gc:arc? |
14:26:31 | FromDiscord | <Clyybber> It makes things tremendously faster for me |
14:26:40 | FromDiscord | <Tangil> yep, it slows things down for me |
14:27:09 | FromDiscord | <Tangil> i'll try with the nightly build |
14:29:53 | FromDiscord | <Tangil> i was using nim 1.2.6 for what it's worth |
14:31:10 | * | Avatarfighter quit (Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in) |
14:31:20 | * | Avatarfighter joined #nim |
14:34:55 | FromDiscord | <Tangil> that was a lot faster on the nightly build |
14:34:58 | * | opi quit (Remote host closed the connection) |
14:35:10 | * | dadada quit (Ping timeout: 260 seconds) |
14:35:13 | FromDiscord | <Tangil> marginally slower than c# but that was a really huge improvement |
14:35:18 | FromDiscord | <Tangil> thanks for the suggestions |
14:35:23 | FromDiscord | <Clyybber> heh, interesting |
14:35:35 | FromDiscord | <Clyybber> how much slower is it now? |
14:36:22 | * | dadada joined #nim |
14:36:24 | FromDiscord | <Tangil> only 100ms ish |
14:36:46 | * | dadada is now known as Guest73425 |
14:37:47 | FromDiscord | <Clyybber> cool, one thing you could try to do is inlining a few of these procs |
14:37:53 | FromDiscord | <Clyybber> so adding {.inline.} |
14:38:13 | FromDiscord | <Clyybber> C# does that automatically at runtime once the JIT deems a code path very hot |
14:39:12 | FromDiscord | <lqdev> @Tangil the compiler will pass "big" objects (whose size is >= 3pointer) by reference, and it won't copy sequences if you don't pass them as var |
14:39:20 | FromDiscord | <lqdev> because after all, the copy is pointless |
14:39:25 | FromDiscord | <lqdev> as you can't modify the seq |
14:41:03 | FromDiscord | <Tangil> @Clyybber i'll try that now↵@lqdev good to know |
14:41:32 | FromDiscord | <Clyybber> Hmm, adding {.inline.} to negamaxHeuristicMaxWr and generateValidMoves improves things a lot |
14:41:56 | FromDiscord | <Clyybber> (edit) "negamaxHeuristicMaxWr and" => "" |
14:42:33 | FromDiscord | <Clyybber> oh, nevermind |
14:42:53 | FromDiscord | <Clyybber> the numbers are flucuating hard on my machine :p |
14:44:23 | FromDiscord | <Tangil> it's probably too fast to have any reasonable measurement done to it, might need to increase the depth to have measureable numbers |
14:46:44 | * | Perkol joined #nim |
14:47:23 | * | Cthalupa quit (Ping timeout: 240 seconds) |
14:48:04 | FromDiscord | <Clyybber> @Tangil Removing the `if len(pickBans) == 0:` part improves performance |
14:48:34 | FromDiscord | <Clyybber> Oh, eh disregard that, that also makes it incorrect |
14:48:47 | FromDiscord | <Clyybber> Adding a unlikely to the condition improves performance too though |
14:49:03 | FromDiscord | <Clyybber> `if unlikely len(pickBans) == 0:` |
14:49:07 | FromDiscord | <Tangil> cool |
14:49:33 | Zevv | wow having a microoptimizing party |
14:49:39 | * | Cthalupa joined #nim |
14:49:49 | FromDiscord | <Clyybber> Zevv: hell yeah! |
14:50:20 | Zevv | last time I won anything with an 'unlikely' was, let me think, yeah that was somewhere late september 1998 I think |
14:50:35 | FromDiscord | <Clyybber> heh |
14:50:59 | Zevv | since then I was structurally outsmarted by ever banch b |
14:51:06 | Zevv | predictor I met |
14:52:59 | Zevv | lqdev: dod you know its actually 3 times "float"? that was a bit of a wtf for me when reading the compiler code |
14:59:58 | Zevv | yeah yeah Ill be off then, laways the samy thing with parties, i walk in, the music stops and everybody stops talking |
15:10:51 | Zevv | oh clyybber, amazing how this typed macro+proc bug holds up all that time |
15:11:14 | Zevv | I'd expect something to hit a lot of people, but apparently doing typed macros on procs is not a thing people want to do very often |
15:23:53 | FromDiscord | <abisxir> @lqdev thanks for pointing out that, so it is the same for arrays and tuples. |
15:29:20 | FromGitter | <dreamer3_twitter> Is there some easy way to compile a static server without the getaddrinfo warning? |
15:29:48 | FromGitter | <dreamer3_twitter> or is it just a thing that can often be ignored if glibc is close? |
15:30:07 | FromGitter | <dreamer3_twitter> I was hoping to avoid any OS dependencies at all and just link it all statically. |
15:30:41 | Yardanico | just link with musl |
15:30:47 | Yardanico | statically |
15:30:53 | Yardanico | it works pretty well with nim |
15:33:23 | * | arecacea1 quit (Read error: Connection reset by peer) |
15:33:44 | * | arecacea1 joined #nim |
15:39:11 | FromDiscord | <lqdev> @abisxir pretty sure it's the case for arrays, but "small" tuples are passed by copy afaik |
15:40:26 | FromDiscord | <lqdev> you can enforce certain passing behavior by adding a {.bycopy.} or {.byref.} pragma to an object type |
15:40:27 | * | haxscramper quit (Read error: Connection reset by peer) |
15:42:14 | FromDiscord | <lqdev> eg. an Image type that holds a seq of pixels might not reach the required size of 3sizeof(pointer) to be passed byref, so you can do `type Image {.byref.} = object` and it will always be passed by pointer no matter if the size changes in the future |
15:45:27 | FromDiscord | <abisxir> Ok, I see, but how compiler handles this type of objects? are they the same like ref objects? |
15:45:56 | FromDiscord | <lqdev> no |
15:46:00 | * | tane joined #nim |
15:46:01 | FromDiscord | <lqdev> they're still on the stack |
15:46:15 | Yardanico | @abisxir you can get address of things on the stack |
15:46:36 | FromDiscord | <lqdev> it's just that when you pass them as arguments to procs, they're actually a pointer so they're not copied |
15:49:09 | Yardanico | @abisxir pretty low-level but: https://play.nim-lang.org/#ix=2tHT |
15:49:22 | Yardanico | here "data" is allocated on the stack, and you get it's pointer and pass it to takePtr |
15:49:25 | disruptek | discord bot isn't escaping formatting correctly. |
15:49:27 | Yardanico | this code has 0 allocations |
15:49:30 | Yardanico | disruptek: I know |
15:49:37 | Yardanico | I mean heap allocs |
15:50:51 | disruptek | the thing about `shower sunday` is that if you miss it, there's always another one around the corner. |
15:58:40 | Zevv | just like flossin' easter |
15:59:51 | Zevv | man this new schedule really suits me. up at 500, do stuff until 1300, have lunch, have a nap, wake up at 1700, have a beer, cook dinner, and zevv is like a new man |
16:00:10 | supakeen | Sounds Spanish! |
16:00:37 | Zevv | yeah, most of my life ive been makin fun of lazy spaniards and itialians |
16:00:44 | Zevv | but these guys just have figured it out |
16:00:48 | supakeen | It's perfect for hot days. |
16:01:02 | Zevv | that was kind of the point indeed |
16:28:21 | * | clemens3 quit (Read error: Connection reset by peer) |
16:30:17 | * | clemens3 joined #nim |
16:32:30 | disruptek | that doesn't make them any less lazy. |
16:36:37 | shashlick | Either meow hash is blazing fast or not doing anything - processing 23k files at 860mb takes 0.5s with threadpool, 0.8s with weave |
16:37:09 | supakeen | 1.4 GB/s? |
16:37:35 | disruptek | it's pretty fast. |
16:38:05 | Yardanico | shashlick: weave is not for IO really, maybe it scales incorrectly? |
16:38:24 | shashlick | And I thought up some more optimizations for duplicate files |
16:38:45 | shashlick | But need to verify if this is really correct |
16:39:58 | shashlick | Having an issue passing an importc object thru channels - doesn't get deep copied correctly |
16:40:07 | shashlick | So having to use a string |
16:40:25 | disruptek | !repo frosty |
16:40:26 | disbot | https://github.com/disruptek/frosty -- 9frosty: 11marshal native Nim objects via streams, sockets 15 7⭐ 0🍴 |
16:40:32 | Yardanico | ? |
16:40:50 | Yardanico | serialization/deserialization in the application for itself might be a bit too much |
16:41:29 | shashlick | Meow uses m128i which I importc but when going thru a channel, it's not copied |
16:41:39 | Yardanico | add {.bycopy.} ? |
16:41:51 | shashlick | Tried overriding deepCopy but no luck |
16:41:54 | shashlick | Will try |
16:42:01 | Yardanico | I don't think you can override deepCopy |
16:42:14 | shashlick | You can =deepCopy |
16:42:17 | FromGitter | <pebauer68> Why does this return chars ? ⏎ for line in stdin.readLine: ⏎ ⏎ ```echo "Got:",line``` [https://gitter.im/nim-lang/Nim?at=5f30276865e829425e7124f8] |
16:42:21 | shashlick | But it doesn't get called |
16:42:35 | Yardanico | @pebauer68 because you're iterating over chars in a single line |
16:42:41 | * | opi joined #nim |
16:42:45 | Yardanico | shashlick: well, that's what I mean |
16:42:54 | Yardanico | @pebauer68 with stdin.readLine() you get a string already |
16:42:57 | Yardanico | one single string |
16:42:59 | Zevv | shashlick: did you find something for the C macro calling yet? |
16:43:04 | Yardanico | let line = stdin.readLine() |
16:43:05 | Yardanico | echo line |
16:43:13 | FromGitter | <pebauer68> but I am using readLine ? |
16:43:19 | Yardanico | yhes, that reads a single line |
16:43:27 | Yardanico | but you're iterating over characters in the line you got |
16:43:39 | FromGitter | <pebauer68> ok |
16:44:03 | Yardanico | in "for line in stdin.readLine:" stdin.readLine() reads a *single* line, and then calls the items() iterator for a line impliciyl |
16:44:05 | Yardanico | implicitly |
16:44:10 | Yardanico | which iterates over all chars in the string |
16:44:18 | Yardanico | so in "Got" you get each char individually |
16:44:36 | Yardanico | if you want to read all stdin lines until it's empty, you need to do it a bit differently |
16:45:25 | Yardanico | like https://play.nim-lang.org/#ix=2tIj |
16:48:10 | FromGitter | <pebauer68> ok, thank you |
16:53:36 | shashlick | @Zevv I had to write a proc which means I had to add type info |
16:53:45 | shashlick | Can't do that automatically |
16:54:16 | Zevv | no right, that's the whole problem of coure :/ |
16:54:42 | shashlick | C2nim was smart enough to convert the implementation of the macro into Nim but that wouldn't work either since the procs being called aren't mapped |
16:56:46 | shashlick | I can't think of a generic solution |
16:57:01 | * | superbia2 joined #nim |
16:59:48 | * | superbia1 quit (Ping timeout: 256 seconds) |
16:59:52 | Zevv | I looked into c2nim as well, and "huh?" was also my reaction. Looks smart, but is wrong |
17:00:28 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2tIo |
17:01:30 | FromGitter | <pebauer68> but "lines" returns really lines and not chars: ⏎ for line in stdin.lines: |
17:01:31 | FromDiscord | <lqdev> use `ptr UncheckedArray[uint8]`, `seq`s have a different memory layout |
17:01:41 | Yardanico | @pebauer68 that's different |
17:01:44 | FromDiscord | <lqdev> which includes the length and capacity |
17:02:00 | Yardanico | stdin.lines != stdin.readLine |
17:02:03 | Yardanico | they are different |
17:02:04 | FromDiscord | <mattrb> Perfect 👌 Thank you! |
17:02:08 | * | krux02 quit (Remote host closed the connection) |
17:02:22 | Yardanico | first one is an convenience iterator over "while stdin.readLine(line): yield line" |
17:02:27 | Yardanico | second one is literally "read a single line" |
17:02:56 | * | krux02 joined #nim |
17:02:56 | Yardanico | compare https://nim-lang.org/docs/io.html#lines.i%2CFile |
17:02:59 | Yardanico | to https://nim-lang.org/docs/io.html#readLine%2CFile |
17:04:06 | shashlick | @Zevv I wouldn't say wrong but that you also need to wrap those procs |
17:04:10 | shashlick | It's not unreasonable |
17:04:33 | shashlick | But for meow hash it means wrapping some intrinsics |
17:10:12 | * | Perkol quit (Remote host closed the connection) |
17:21:44 | FromGitter | <adrianperreault> Hi y'all, so with the latest devel build of Nim with --gc:arc I've been getting a compiler exception of "Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]". The project is fairly large (a game engine) and it's been tricky for me to pinpoint where or what's causing this. The project was compiling fine with --gc:arc on a devel build from about a week and a half to two weeks ago. ⏎ ⏎ How can I |
17:21:44 | FromGitter | ... get more debug information about what's up? Has anyone had this type of error and know generally what it's related to?/Can anyone point me in the right direction? Thanks |
17:22:10 | * | iwanttobeanimnin joined #nim |
17:22:18 | iwanttobeanimnin | sup |
17:24:34 | FromDiscord | <Elegant Beef> My ceiling |
17:26:32 | iwanttobeanimnin | which nim web framework do you recommend as a server backend language? I would like to develop a website backend and use nim in place of PHP. |
17:27:13 | iwanttobeanimnin | I've been looking at Jester, however I'm worried about it handling higher loads |
17:27:25 | iwanttobeanimnin | https://github.com/dom96/jester |
17:27:41 | supakeen | Maybe don't worry about things that aren't and might never be, problems. |
17:29:00 | * | natrys joined #nim |
17:29:39 | FromDiscord | <Rika> worry when testing shows it actually happens |
17:30:30 | FromDiscord | <Rika> you're likely prematurely optimizing |
17:31:57 | Zevv | adrianperreault: stupid question, but you do get a stack trace on that exception, pointing to the source of your problem, right? |
17:32:11 | FromGitter | <adrianperreault> Negative :( |
17:32:20 | Zevv | You compile with -d:release or -d:danger? |
17:32:26 | FromGitter | <adrianperreault> correcto |
17:32:30 | FromGitter | <adrianperreault> Turn that off? |
17:32:32 | Zevv | well, don't do that :) |
17:32:33 | Zevv | right |
17:33:13 | FromGitter | <adrianperreault> derp... XD |
17:33:32 | Zevv | got'em |
17:33:33 | Zevv | ? |
17:36:06 | FromGitter | <adrianperreault> No luck :( compiling with: nim c -d:arcgc -d:nimV2 --gc:arc |
17:36:24 | * | disruptek sighs. |
17:37:20 | disruptek | you have some bad ast in a macro. |
17:37:47 | disruptek | you won't get a stack because it's a compile-time exception. |
17:37:52 | disruptek | why are you using those defines? |
17:37:58 | disruptek | i'm just curious. |
17:38:20 | FromGitter | <adrianperreault> Thought it might be related to a macro :( It was working exact same code with a previous devel build though? |
17:38:25 | Zevv | oooh compile time - I didn't read that right, sorry |
17:38:55 | disruptek | i cannot speak to the past. |
17:39:05 | Zevv | you can, but it won't listen |
17:39:12 | disruptek | story of my life. |
17:39:54 | FromGitter | <adrianperreault> Not sure about those defines... should I just be using --gc:arc? |
17:40:22 | disruptek | if you don't know what they do, don't use them. |
17:40:34 | FromGitter | <adrianperreault> XD |
17:40:57 | federico3 | c2nim really needs to improve |
17:41:27 | Yardanico | @adrianperreault just use --gc:arc |
17:43:18 | FromGitter | <adrianperreault> Is there a way to step through compilation to atleast get the name of the offending macro? |
17:43:41 | disruptek | what platform? |
17:43:47 | FromGitter | <adrianperreault> arch linux |
17:44:16 | disruptek | you're using devel, #head? |
17:44:21 | FromGitter | <adrianperreault> yup |
17:44:25 | disruptek | ~gitnim |
17:44:26 | disbot | gitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek |
17:44:37 | disruptek | you can step through past releases easily. |
17:45:09 | disruptek | i will push the nightly in a moment. |
17:45:42 | FromGitter | <adrianperreault> Recommending I rollback to a previous nim build? |
17:46:10 | disruptek | it would be helpful to know if this is your fault. |
17:46:58 | FromGitter | <adrianperreault> Okee, will do |
17:47:13 | disruptek | you say the same code worked a week or two ago? |
17:47:31 | disruptek | gitnim has >1 month of nightlies, roughly every 2-3 days. |
17:48:45 | FromGitter | <adrianperreault> Exact same code, one minute it was compiling *choosenim update devel --latest* --> index 1 not in 0 .. 0 |
17:51:35 | disruptek | well, i don't use choosenim. |
18:06:26 | FromDiscord | <mattrb> Any reason arrays can't be created with `..<` or `..^` ranges? |
18:07:12 | disruptek | can you provide an example? |
18:09:22 | * | hnOsmium0001 joined #nim |
18:09:24 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2tII |
18:10:04 | disruptek | oh, you want it to make an array[4, uint8]? |
18:10:29 | FromDiscord | <mattrb> Didn't even realize that shorthand was allowed, cool! |
18:10:30 | disruptek | oh, you want it to make an array[5, uint8]? |
18:10:37 | disruptek | i should say. 😉 |
18:10:56 | disruptek | ~manual |
18:10:57 | disbot | manual: 11the Nim Manual is https://nim-lang.org/docs/manual.html -- disruptek |
18:11:14 | disruptek | disbot: you're pretty cute, you know that? |
18:11:15 | disbot | yep. 😊 |
18:11:26 | disruptek | disbot: stay frosty, buddy. |
18:11:26 | disbot | on it. 👍 |
18:11:34 | * | aenesidemus joined #nim |
18:11:46 | * | opi quit (Quit: Leaving) |
18:14:43 | FromDiscord | <mattrb> To be fair, I don't believe the manual explicitly states that lol. The only place I see it used is down in the Align Pragma section... https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-align-pragma |
18:15:07 | disruptek | neat. |
18:16:01 | FromDiscord | <mattrb> Yup. |
18:18:26 | * | superbia2 is now known as superbia |
18:21:59 | * | lritter quit (Quit: Leaving) |
18:22:36 | * | nimatar joined #nim |
18:26:25 | FromDiscord | <lqdev> PRs welcome |
18:29:07 | Zevv | well, it is kind of funny actually that ..< does not compute |
18:29:28 | disruptek | agree. |
18:31:58 | * | arecacea1 quit (Remote host closed the connection) |
18:32:17 | * | arecacea1 joined #nim |
18:33:16 | * | nimatar quit (Remote host closed the connection) |
18:33:36 | Zevv | Would this do? "An array type can be defined using the `array[count, T]` syntax, or using |
18:33:40 | Zevv | `array[lo..hi, T]` for arrays that start at an index other then zero." |
18:34:04 | Zevv | I find the nim manual not very strict on nomenclature like 'declarations' and 'definitions' |
18:34:18 | Zevv | but that's probably because I've been infected by the filth of C standards |
18:34:32 | disruptek | disgusting. |
18:35:57 | Zevv | is that text ok like that then |
18:37:25 | Zevv | well then https://github.com/nim-lang/Nim/pull/15173 |
18:37:26 | disbot | ➥ Added array type definition to manual |
18:37:26 | Zevv | whatever |
18:38:04 | disruptek | that's your good deed for the day, zevv. |
18:38:09 | disruptek | now you can go back to being a prick. |
18:38:10 | Zevv | I can now rest |
18:38:14 | * | Kaivo quit (Ping timeout: 256 seconds) |
18:38:15 | disruptek | or that. |
18:38:21 | Zevv | I'll do the prick-thing |
18:38:26 | Zevv | go fix your cps boi |
18:38:39 | disruptek | i'm working on mangling. |
18:38:43 | Zevv | somehow I don't do any of the typing, isn't that interesting |
18:38:56 | Zevv | oh work on mangling then |
18:39:00 | Zevv | ++ |
18:39:00 | disruptek | cps is blocked by so many things... |
18:39:25 | * | narimiran joined #nim |
18:39:27 | Zevv | no, you can just create a new proc prepend with "prick_" and use that until clyybber fixes the bugs |
18:40:34 | * | Kaivo joined #nim |
18:40:44 | disruptek | hmm, it might be worth a shot. |
18:49:19 | FromGitter | <adrianperreault> Ok, @disruptek, I've tried a few different snapshot commits and have narrowed it down a bit. ⏎ ⏎ #d6161 (Aug 1st) -- index 1 not in.. (compilation error) ⏎ ⏎ #2629d (Jul 29th) -- works fine ... [https://gitter.im/nim-lang/Nim?at=5f30452f4c89605c7f8613c7] |
18:49:40 | disruptek | nice. |
18:50:31 | FromGitter | <adrianperreault> I'll try to narrow it further if that would be helpful to you, or... suggest a commit that you think might be suspect |
18:50:34 | disruptek | that shouldn't be hard to figure out. are you using the gitnim builds or just recompiling the compiler? |
18:51:12 | FromGitter | <adrianperreault> choosenim update "#a62bc559..." :P |
18:52:04 | disruptek | 2629d works fine? wild. |
18:52:17 | FromGitter | <adrianperreault> XD... your tool rocks though |
18:52:25 | FromGitter | <adrianperreault> oh, nvm |
18:52:28 | FromGitter | <adrianperreault> ya |
18:53:42 | * | iwanttobeanimnin quit (Ping timeout: 260 seconds) |
18:54:55 | * | narimiran quit (Quit: leaving) |
18:54:58 | * | iwannagetgudatni joined #nim |
18:55:05 | * | iwannagetgudatni left #nim (#nim) |
18:55:09 | * | iwannagetgudatni joined #nim |
18:55:14 | disruptek | hmm, i don't see much that's obvious. other than clyybber's patch. |
18:55:37 | disruptek | is this only a problem in arc? |
18:56:44 | * | lritter joined #nim |
18:58:23 | FromGitter | <adrianperreault> yes |
18:58:38 | disruptek | ahh. |
18:58:46 | FromGitter | <adrianperreault> latest devel compiling fine |
18:59:56 | disruptek | d130175342f2b7c1bf87dd05c86509f04cf78154? |
19:00:15 | disruptek | basically, i'd test all of araq's commits. 😁 |
19:00:50 | disruptek | but, we're going to have to find a way to narrow down the problematic code. |
19:00:54 | FromGitter | <adrianperreault> I'll give that one a go next ;) |
19:06:35 | FromGitter | <adrianperreault> d130175342f2b7c1bf87dd05c86509f04cf78154 no worky XD |
19:07:21 | FromGitter | <adrianperreault> (Trying the commit before now) |
19:11:45 | disruptek | is it an in-house engine, or...? |
19:13:09 | FromGitter | <adrianperreault> in-house, ya, guess I'll go with that XD (not commercial... as of yet) |
19:14:21 | FromGitter | <adrianperreault> Ok, #32c614 checks out... so #d1301 is the winner |
19:14:30 | disruptek | yeah, i had a feeling. |
19:15:28 | FromGitter | <adrianperreault> Is there a way to log the names of the macros as they're being processed by the compiler? |
19:15:44 | FromDiscord | <Elegant Beef> Ah shit gitter bridge borked on discord, look crazy disruptek |
19:16:00 | disruptek | eh? |
19:16:14 | disruptek | macros... no. |
19:16:19 | Yardanico | 123 |
19:16:21 | FromDiscord | <Yardanico> 123 |
19:16:28 | Yardanico | idk why FromGitter isn't transmitted lol |
19:16:32 | FromDiscord | <Elegant Beef> The gitter messages arent coming through here so you look like you're talking to yourself |
19:16:39 | Yardanico | no clue |
19:16:52 | Yardanico | !status |
19:16:53 | FromDiscord | Uptime - 2 days, 22 hours, and 33 minutes |
19:17:00 | FromDiscord | <Elegant Beef> I mean you could always echo at the begining of the macro, but that's manual |
19:17:07 | FromDiscord | <Elegant Beef> Does the bridge work to gitter? |
19:17:14 | Yardanico | yes, we see messages in IRC |
19:17:17 | Yardanico | lemme try to restart the bridge |
19:17:19 | * | FromDiscord quit (Remote host closed the connection) |
19:17:32 | * | FromDiscord joined #nim |
19:17:45 | FromDiscord | <Yardanico> 13 |
19:17:48 | FromGitter | <Yardanico> 123 |
19:17:51 | Yardanico | weird |
19:17:55 | Yardanico | I |
19:18:03 | Yardanico | i'll rollback to the old version for now |
19:18:07 | disruptek | adrian: you could try --sinkinference:off but i'm not super confident. |
19:18:14 | * | jeko joined #nim |
19:18:27 | Yardanico | restarting it again |
19:18:28 | * | FromDiscord quit (Remote host closed the connection) |
19:18:45 | * | FromDiscord joined #nim |
19:18:49 | FromGitter | <Yardanico> 123 |
19:18:57 | Yardanico | ok will keep that for now |
19:19:41 | FromGitter | <adrianperreault> Sounds good Yardanico. Ok, I'll give that a go, disruptek... thanks for all the help btw :) |
19:20:22 | disruptek | i guess if it were me, i'd write some smaller tests until i found where the compiler was losing its mind. |
19:20:59 | disruptek | oh, you can play with my testes if you are feeling adventurous. |
19:21:04 | disruptek | !repo disruptek/testes |
19:21:05 | disbot | https://github.com/disruptek/testes -- 9testes: 11a small unittest framework with decent support 🔴🟡🟢 15 2⭐ 0🍴 |
19:21:16 | FromGitter | <adrianperreault> No luck with the sink inference off |
19:21:30 | Yardanico | did you test on the very latest commit in devel? |
19:21:34 | Yardanico | if so, try to disable cursor inference |
19:21:35 | disruptek | it can handle tests that don't compile, but you will probably still suffer crashes. |
19:21:58 | disruptek | that's what he needs. |
19:22:07 | disruptek | what's the cli option? |
19:22:10 | Yardanico | but enabling cursor inference isn't very simple |
19:22:11 | Yardanico | https://github.com/nim-lang/Nim/blob/devel/compiler/injectdestructors.nim#L1005 |
19:22:15 | Yardanico | you need to comment that line :) |
19:22:31 | FromGitter | <adrianperreault> latest commit in devel as of a few hours ago |
19:22:41 | Yardanico | well arc still has bugs, yes |
19:22:59 | Yardanico | https://github.com/nim-lang/Nim/issues/15122 https://github.com/nim-lang/Nim/issues/15147 are the ones which are open |
19:23:01 | disbot | ➥ [ARC] SIGSEGV with tuple unpacking caused by cursor inference ; snippet at 12https://play.nim-lang.org/#ix=2tJo |
19:24:29 | FromGitter | <adrianperreault> Would it be feasible for me to hack some echo statement somewhere in the compiler to get the name of the macro? Or is that not really how it works? |
19:25:07 | disruptek | i mean, sure. |
19:25:21 | Yardanico | wait with --gc:arc it crashes at comptime? |
19:25:27 | disruptek | yeah. |
19:25:36 | Yardanico | hrm |
19:25:49 | disruptek | it's likely not a macro, though, but the arc xfrm. |
19:25:53 | FromGitter | <adrianperreault> "Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]" |
19:26:10 | Yardanico | well you can try to minimize the tests/code :) |
19:26:28 | disruptek | that's what i suggest as well. it will have more utility to you going forward. |
19:27:01 | disruptek | you might be able to narrow it down to a particular file using `nim check`. |
19:27:19 | disruptek | i doubt it, though. 🙁 |
19:27:51 | FromGitter | <adrianperreault> Alrighty. I'll start commenting out stuff |
19:28:45 | disruptek | pretty rare problem. |
19:35:54 | * | Vladar quit (Quit: Leaving) |
19:36:57 | * | lritter quit (Quit: Leaving) |
19:51:51 | * | Kaivo quit (Ping timeout: 256 seconds) |
19:59:09 | * | NimBot joined #nim |
20:18:54 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
20:35:15 | * | s4mu3lbk joined #nim |
20:47:30 | FromGitter | <adrianperreault> Alrighty... sniffed out the problem... she compiles again on the latest devel with arc :) ⏎ ⏎ https://pastebin.com/0K6fM4dK |
20:54:43 | FromGitter | <benash> Hi everyone, did the `jsonName` pragma ever make it into the codebase? I'm new to nim, experimenting with json unmarshalling, and looking for a way to handle keys that start with underscore. Here's the related (closed) PR: https://github.com/nim-lang/Nim/pull/11416/files |
20:54:45 | disbot | ➥ `doNotSerialize`, `jsonName` pragmas for JSON serialization closes #8104, #10718, also fixes #11415 ; snippet at 12https://play.nim-lang.org/#ix=24Gg |
20:54:54 | Yardanico | no |
20:59:49 | FromGitter | <benash> Got it, I took a closer look and saw some people preferring to wait till this one is merged: https://github.com/nim-lang/Nim/pull/11526 |
20:59:50 | disbot | ➥ getCustomPragma is split up in more usable chunks |
21:02:16 | FromGitter | <ServiceDog_gitlab> Newer to Nim, had a question: I'm aware that for procedures, passing by reference is possible through `proc fxn(x: var string)` (including var). Say though that I wanted to store a reference to a stack variable in a table, so that later I can iterate through the table and assign values to those variables. As far as I can tell, there's no C++-esque '&x' syntax to store a reference or address of a variable |
21:02:16 | FromGitter | ... that's on the stack without having to declare custom types that use the 'ref' keyword. Is there documentation on this that I've missed? |
21:02:40 | disruptek | addr somevarOnstack |
21:08:51 | FromGitter | <ServiceDog_gitlab> would the resulting type be 'ptr string'? Looking at https://nim-lang.org/docs/system.html#addr%2CT, getting an error saying an ordinal type is expected; does it not work with strings? |
21:09:14 | Yardanico | how are you calling addr? |
21:09:17 | Yardanico | and btw, addr is unsafe :) |
21:09:28 | Yardanico | because generally it's unsafe to get pointers to variables on the stack |
21:09:28 | FromGitter | <ServiceDog_gitlab> x.addr |
21:09:38 | Yardanico | it should work just fine if "x" is a "var" |
21:10:42 | nikita` | which nim compiler switch do i want to make bootstrap of koch more verbose than this in a sandboxed build: |
21:10:45 | nikita` | fatal.nim(49) sysFatal |
21:10:48 | nikita` | Error: unhandled exception: value out of range: -1 notin 0 .. 9223372036854775807 [RangeError] |
21:10:57 | Yardanico | ./koch temp |
21:11:07 | Yardanico | ./koch temp c path/to/file.nim |
21:11:52 | nikita` | ok but this is for building koch from source. ommitting lots of code before that, for us it's ./bin/nim c --skipUserCfg --skipParentCfg koch |
21:12:11 | nikita` | i forgot to add, while building nim for a system as a packager |
21:12:21 | Yardanico | oh, bootstrap of koch |
21:12:24 | Yardanico | hrm, very weird |
21:12:29 | nikita` | yeah |
21:12:34 | nikita` | outside it works just fine |
21:13:31 | nikita` | https://github.com/NetBSD/pkgsrc/blob/trunk/lang/nim/Makefile#L28 |
21:20:03 | nikita` | of course i could be wrong, i don't know anymore where i sourced these lines from. i see gentoo doesn't do all of them |
21:21:27 | nikita` | i think the --skip* were added to prevent picking up other configs |
21:21:41 | * | natrys quit (Quit: natrys) |
21:26:43 | * | opal quit (Ping timeout: 240 seconds) |
21:32:16 | FromGitter | <adrianperreault> "oh, you can play with my testes if you are feeling adventurous." -- disruptek ⏎ 😲... XD... What a name... 😂 ⏎ ... testes looks great but dayuum... your cps is what really excites me |
21:39:50 | * | solitudesf quit (Ping timeout: 264 seconds) |
21:44:01 | * | tane quit (Quit: Leaving) |
21:45:37 | FromDiscord | <mattrb> Hey, I can't seem to find docs on this but I might be searching in the wrong place. How would I define a function that takes a type and returns an instance of that type? For example, a proc that takes the _type_ `uint8`, which would return some `uint8`? |
21:45:51 | Yardanico | I don't know if that's actually possible |
21:45:55 | Yardanico | types are a compile-time only thing |
21:46:01 | Yardanico | idk if a compile-time proc will work |
21:46:05 | Yardanico | you can try with a macro |
21:46:13 | FromDiscord | <mattrb> How would I define that with a macro? |
21:47:11 | FromDiscord | <mattrb> Eh, it's not really actually that important. I'll just write a few procs :p |
21:47:20 | FromDiscord | <mattrb> Just thought it would be cool :p |
21:48:17 | * | s4mu3lbk quit (Remote host closed the connection) |
21:48:24 | FromDiscord | <Rika> yardanico: cant you do `proc a(t: typedesc): t`? |
21:48:28 | Yardanico | idk :) |
21:49:06 | FromDiscord | <Rika> !eval proc a(t: typedesc): t = discard; echo typeof a(uint8); |
21:49:07 | NimBot | Compile failed: /usercode/in.nim(1, 56) Error: invalid indentation |
21:49:15 | FromDiscord | <Rika> eeeeeeeeeeee |
21:49:20 | Yardanico | hehe |
21:49:23 | FromDiscord | <Rika> do i have to () the proc |
21:49:29 | FromDiscord | <Rika> i'm lazy to fix this |
21:50:47 | FromGitter | <benash> Hi, would anonymous types ever be possible in Nim, e.g.: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f306fb6d28b99685e52eb05] |
21:51:01 | Yardanico | there are tuples |
21:51:44 | FromDiscord | <Rika> tuples in nim can be named (aka fields can have names) |
21:52:02 | FromDiscord | <Rika> so tuple[city: string, country: string] |
21:52:21 | Yardanico | but really @benash I don't think it would be supported |
21:52:28 | Yardanico | you can just easily declare another type |
21:57:57 | FromGitter | <benash> Got it, so `tuple` with `[ ]` would do it |
21:59:57 | FromGitter | <benash> But this wouldn't work: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f3071dc9b76045d5b8b6444] |
22:00:08 | Yardanico | yes, for that you need [] |
22:00:20 | Yardanico | tuple[city: string, country: string] |
22:01:17 | * | oprypin quit (Quit: Bye) |
22:01:26 | * | oprypin joined #nim |
22:02:03 | FromGitter | <benash> Makes sense. Any simple rule of thumb for deciding between tuples and objects? |
22:04:35 | FromDiscord | <Rika> not really i dont think |
22:04:55 | FromDiscord | <Rika> choose whichever works best for you (imo that would usually be an object) |
22:05:25 | FromGitter | <benash> OK, got it. |
22:20:33 | disruptek | adrianperreault: yeah, cps could be huge. |
22:21:59 | disruptek | !last clyybber |
22:22:01 | disbot | clyybber spoke in 12#nim 7 hours ago 12https://irclogs.nim-lang.org/09-08-2020.html#14:50:35 |
22:24:51 | FromDiscord | <Clyybber> disruptek: sup sup |
22:26:22 | * | stefantalpalaru quit (Quit: ZNC 1.7.5 - https://znc.in) |
22:26:30 | * | stefantalpalaru joined #nim |
22:26:46 | FromGitter | <adrianperreault> Most definitely. Massive potential in that direction. |
22:26:56 | * | arecacea1 quit (Remote host closed the connection) |
22:27:39 | * | arecacea1 joined #nim |
22:27:39 | disruptek | clyybber: my proc types have unique ids but they differ only by pragma; the c++ backend encodes their type names and then the signatures don't match. 🤦 |
22:27:54 | disruptek | this is mangling stuff. |
22:31:21 | FromDiscord | <Clyybber> hmm |
22:31:27 | disruptek | benash: use objects unless you have a reason not to. |
22:31:28 | FromDiscord | <Clyybber> how does the C backend do it |
22:31:30 | FromDiscord | <Clyybber> wait |
22:31:35 | FromDiscord | <Clyybber> how can they differ by pragma |
22:31:38 | FromDiscord | <Clyybber> if they are the same |
22:31:44 | disruptek | the c backend doesn't use the first arg in signatures. |
22:31:51 | * | clyybber joined #nim |
22:32:34 | disruptek | i think mangling only fails 2 tests now. both cpp and both due to the same problem. |
22:32:57 | FromDiscord | <Clyybber> damn, nice! |
22:33:26 | FromDiscord | <Clyybber> I don't think I entirely understood the problem yet |
22:33:39 | FromDiscord | <Clyybber> so the two proc types have different ids? |
22:33:52 | disruptek | different uniqueIds, yes. |
22:33:59 | FromDiscord | <Clyybber> and different pragmas? |
22:34:13 | disruptek | yes. one is closure and i forget what the other is. |
22:34:14 | disruptek | noconv |
22:34:20 | FromDiscord | <Clyybber> but they should still have the same signature? |
22:34:29 | disruptek | and they do, afaik. |
22:34:36 | FromDiscord | <Clyybber> but should they? |
22:34:44 | disruptek | unless the tests are broken. |
22:35:31 | FromDiscord | <Clyybber> hmm |
22:36:14 | FromDiscord | <Clyybber> > /usr/home/build/Nim/compiler/mangler.nim(168, 48) Error: generic instantiation too nested↵oof |
22:36:28 | disruptek | how did you get that? |
22:36:47 | clyybber | I looked at your PR |
22:36:55 | clyybber | I wanted to see which test it is that fails |
22:37:06 | disruptek | it's texitprocs. |
22:37:16 | disruptek | that's the simplest one, and the one i include debugging for. |
22:37:46 | disruptek | it'll `debug sometype` for the offenders. |
22:38:13 | clyybber | ah ok |
22:38:33 | clyybber | I don't quite understand how they can end up with the same signature |
22:38:39 | clyybber | afaict they have different names |
22:38:42 | clyybber | fun1 vs fun2 |
22:38:56 | disruptek | it's the proc type that is the problem. |
22:39:07 | disruptek | we rename it to pro_1233434 (some uniqueId) |
22:39:22 | clyybber | aah |
22:39:41 | clyybber | so fun1/3 and fun2/4 should share it but don't? |
22:40:06 | disruptek | i never actually looked at the test, i don't think. |
22:40:13 | clyybber | heh |
22:40:46 | disruptek | ah, yes. |
22:40:54 | clyybber | i'm blue on discord \o/ |
22:41:11 | clyybber | zima blue |
22:41:18 | disruptek | they should all work, in theory, but addExitProc doesn't take more than one type of proc as input. |
22:42:58 | clyybber | but theres two addExitProc |
22:43:07 | clyybber | one for noconv and one for closure |
22:43:33 | disruptek | good. |
22:43:59 | disruptek | but we're only compiling one version. |
22:44:15 | clyybber | maybe thats the problem |
22:45:00 | disruptek | addExitProc_pro_5855060_stdlib_exitprocs(fun1_5866014_texitprocs); |
22:45:53 | disruptek | oh that's c. |
22:46:41 | disruptek | looks correct in both cases. |
22:48:36 | disruptek | the problem is that the compiler is only generating symbols for addExitProc_pro_5835056_stdlib_exitprocs11pro_5831021 and not addExitProc_pro_5835056_stdlib_exitprocs11pro_5835056 |
22:48:39 | * | krux02 quit (Remote host closed the connection) |
22:49:15 | clyybber | hmm |
22:53:45 | disruptek | the stdlib prototype: N_LIB_PRIVATE N_NIMCALL(void, addExitProc_pro_5835056_stdlib_exitprocs)(pro_5831021 cl) |
22:54:13 | * | iwannagetgudatni quit (Quit: leaving) |
22:54:28 | disruptek | but this is the declaration in the test.cpp: N_LIB_PRIVATE N_NIMCALL(void, addExitProc_pro_5835056_stdlib_exitprocs)(pro_5835056 cl); |
22:54:58 | * | theelous3 joined #nim |
22:55:30 | disruptek | so, it's our fault, but how? |
22:55:35 | disruptek | a rewrite somewhere? |
23:04:10 | clyybber | hmm |
23:04:28 | clyybber | so it ends up in stdlibwhatever.cpp *and* in test.cpp? |
23:05:49 | clyybber | https://www.youtube.com/watch?v=Xis7RT7JCDA |
23:06:30 | disruptek | it's like we give it a prototype after defining the type in the test.cpp. |
23:07:11 | disruptek | then it's getting a proto according to our new type names, which renames the proc but not its param. |
23:07:26 | disruptek | or something. |
23:14:29 | disruptek | maybe assignParam is over-reaching. |
23:24:10 | clyybber | damnit, can't think anymore |
23:24:41 | clyybber | best of luck with that bug, I'll be sleeping |
23:24:46 | clyybber | good night |
23:24:47 | disruptek | aight, gn |
23:24:50 | * | clyybber quit (Quit: WeeChat 2.9) |
23:44:51 | * | stefantalpalaru quit (Changing host) |
23:44:51 | * | stefantalpalaru joined #nim |
23:58:10 | * | vicfred quit (Quit: Leaving) |
23:59:18 | * | vicfred joined #nim |