00:15:26 | Prestige | irchaxwell: stop watching me! ;) |
00:15:39 | FromDiscord | <ElegantBeef> Huh? |
00:15:40 | Prestige | Beef how are your string views coming? |
00:15:54 | FromDiscord | <ElegantBeef> Got an rpi pico infront of me, so... uhhh not? |
00:15:56 | irchaxwell | Prestige, from Reddit? |
00:16:01 | Prestige | Ye |
00:16:04 | irchaxwell | he he |
00:16:30 | Prestige | Beef: oh :P okay |
00:16:42 | Prestige | I really need to work on Nimdow sometime |
00:20:26 | FromDiscord | <ElegantBeef> But strviews is ok for most str splitting applications |
00:30:18 | FromDiscord | <Zachary Carter> I think that's exactly why Disruptek was kicked / banned / whatever - for saying something that could be taken a certain way, to a newcomer |
00:30:26 | * | WilhelmVonWeiner joined #nim |
00:31:42 | FromDiscord | <Zachary Carter> and then I think things escalated after he was called out for it |
00:35:50 | FromDiscord | <Zachary Carter> it's unfortunate, but he's unable to keep his opinions to himself sometimes, and know when things are or aren't appropriate to type |
00:36:26 | FromDiscord | <Zachary Carter> I'm sure if he apologies and makes some behavior changes he'd be welcomed back, but I don't think he wants to anymore. I think he feels like he's been burned or has lost interest, I don't know which. |
00:37:05 | FromDiscord | <Zachary Carter> Maybe just taking some time away from Nim is best |
00:41:14 | FromDiscord | <konsumlamm> for reference, the quote he was banned for, afaict, was "why do you think it's okay to criticize others when your work is so bad that it drags down an entire language, let alone an irc community", though i doubt that was the sole reason |
00:41:57 | leorize | Araq said it's because he was bullying dom96 |
00:42:06 | FromDiscord | <ElegantBeef> It's silly for me to want to remake the pico sdk in pure nim isnt it? π |
00:42:09 | Prestige | yeah, he was trashing dom |
00:42:19 | Prestige | Not at all Beef :) |
00:42:53 | FromDiscord | <konsumlamm> (that quote was to dom) |
00:42:57 | FromDiscord | <ElegantBeef> Considering i know pretty much zero C, quite possibly it is |
00:43:04 | FromDiscord | <Zachary Carter> well he was |
00:43:18 | FromDiscord | <Zachary Carter> that's what I meant when I said it escalated |
00:43:22 | FromDiscord | <ElegantBeef> If dom and disruptek spoke near the same time it was typically disruptek insulting dom |
00:43:31 | FromDiscord | <Zachary Carter> I didn't want to call out specific people haha |
00:43:32 | Prestige | C isn't too bad to figure out usually |
00:43:49 | Clonkk[m] | At some point, being toxic and disrespectful on a regular basis is a choice. |
00:43:49 | Clonkk[m] | My guess is that it was more the straw that broke the camel's back. |
00:44:04 | FromDiscord | <Zachary Carter> the camel's back has been broken before |
00:44:10 | Prestige | poor camel |
00:44:19 | FromDiscord | <Zachary Carter> this was it being dropped off of a roof through a flaming table |
00:44:27 | FromDiscord | <Zachary Carter> and then breaking its back |
00:44:44 | FromDiscord | <ElegantBeef> you say that prestige but i'm looking at `#define clocks_hw ((clocks_hw_t const)CLOCKS_BASE)` going ah yes seems to be an immutable pointer to a specific address of type clockshw π |
00:44:48 | Clonkk[m] | Some of his work looks really good though so it's a shame he couldn't respect some simple rules and got himself banned |
00:45:03 | FromDiscord | <Zachary Carter> eh it's a bit more complicated than that but yeah |
00:45:16 | FromDiscord | <Zachary Carter> it is a shame |
00:45:24 | Prestige | Lol well most things aren't that bad |
00:45:50 | FromDiscord | <ElegantBeef> Well the pico is a micro controller i most stuff is like that(assuming that's to me) |
00:45:50 | Prestige | I had to ask a few Q's about the source of different WMs because some things in c/c++ are weird looking |
00:46:19 | FromDiscord | <ElegantBeef> (edit) "Well the pico is a micro controller i ... most" added "assume" |
01:02:03 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:02:27 | * | njoseph joined #nim |
01:04:59 | ForumUpdaterBot | New thread by Domino: Stdout.write nor printf work from within threads. Is this a bug or intended behavior?, see https://forum.nim-lang.org/t/7461 |
01:08:00 | * | FromDiscord quit (Remote host closed the connection) |
01:08:16 | * | FromDiscord joined #nim |
01:28:19 | * | a_chou joined #nim |
01:42:20 | * | NimBot joined #nim |
01:48:12 | * | filcuc joined #nim |
02:03:49 | * | Tlangir is now known as Tanger |
02:08:36 | * | abm quit (Read error: Connection reset by peer) |
02:31:53 | * | irchaxwell_ joined #nim |
02:33:05 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
02:33:16 | * | mmohammadi9812 joined #nim |
02:33:46 | * | rockcavera quit (Remote host closed the connection) |
02:35:31 | * | irchaxwell quit (Ping timeout: 272 seconds) |
02:38:21 | * | filcuc quit (Ping timeout: 264 seconds) |
02:44:32 | * | krux02 quit (Remote host closed the connection) |
02:54:46 | FromDiscord | <exelotl> I see disruptek as one of those fabled "rockstar developers" |
02:56:16 | FromDiscord | <exelotl> As in, they do brilliant work but they also act recklessly and make people uncomfortable |
02:56:46 | FromDiscord | <Rika> when you say rockstar do you mean the actual word or the company |
02:56:58 | FromDiscord | <exelotl> The actual word |
02:59:11 | ForumUpdaterBot | New thread by Halloleo: Objects for "classes" with ref or without?, see https://forum.nim-lang.org/t/7462 |
03:07:11 | ForumUpdaterBot | New thread by Halloleo: How to change teh default initialisation for object types, see https://forum.nim-lang.org/t/7463 |
03:18:46 | FromDiscord | <Avatarfighter> irchaxwell: welcome to Nim btw just saw your reddit post, I hope you enjoy our community for all it offers π |
03:19:00 | FromDiscord | <Avatarfighter> all that it offers |
03:20:43 | FromDiscord | <ElegantBeef> Dont welcome them like that they might stay π |
03:21:21 | FromDiscord | <Avatarfighter> Psh you gotta invite them to the big family π |
03:25:52 | * | a_chou quit (Remote host closed the connection) |
03:26:11 | * | a_chou joined #nim |
03:29:14 | leorize | Yardanico: IIRC you said you were porting a path library, right? |
03:29:30 | FromDiscord | <Yardanico> no, I don't think I said that π€ |
03:29:32 | FromDiscord | <Yardanico> what path library? |
03:30:00 | leorize | guess I misremembered |
03:30:10 | * | a_chou quit (Client Quit) |
03:30:29 | leorize | the "/path/to/something" kind of path library |
03:30:51 | FromDiscord | <Yardanico> hmm, I don't think I ever did anything like that |
03:31:13 | leorize | yea, guess it was someone else |
03:52:18 | FromDiscord | <smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3u |
03:52:32 | FromDiscord | <smallgram> (edit) "https://play.nim-lang.org/#ix=2O3u" => "https://play.nim-lang.org/#ix=2O3v" |
03:54:20 | FromDiscord | <ElegantBeef> Do you need to store these in a big collection? |
03:54:33 | FromDiscord | <smallgram> No larger than say 10 inputs. |
03:54:34 | FromDiscord | <ElegantBeef> (edit) removed "big" |
03:54:48 | FromDiscord | <ElegantBeef> My dumb brain wrote big instead of homogenous π |
03:55:16 | FromDiscord | <smallgram> I was thinking I would eventually store them in a list or table... |
03:55:30 | FromDiscord | <ElegantBeef> Ok so you want the int inputs and float inputs stored together |
03:55:33 | FromDiscord | <smallgram> Which would push towards subtypes? |
03:55:48 | FromDiscord | <ElegantBeef> Well most nimions dont use OOP for something so simple |
03:57:17 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2O3w |
03:57:18 | FromDiscord | <ElegantBeef> Using an object variant |
03:57:31 | FromDiscord | <smallgram> Yeah, that was one option I was looking at. |
03:57:39 | FromDiscord | <Rika> then you can make a template |
03:58:01 | FromDiscord | <smallgram> Seems nice--not experienced with object variants, but look interesting. |
03:58:29 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:58:35 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2O3x |
03:58:39 | FromDiscord | <Rika> then you can plainly use i.value as usual |
03:59:37 | FromDiscord | <ElegantBeef> that wont work you dont have a return type on the template |
03:59:45 | FromDiscord | <Rika> `:untyped` then |
03:59:47 | FromDiscord | <ElegantBeef> Yea |
03:59:52 | FromDiscord | <ElegantBeef> Just wanted to make sure it was proper |
03:59:52 | * | muffindrake joined #nim |
03:59:54 | FromDiscord | <Rika> i keep on forgetting that it defaults to typed and not untyped |
04:02:08 | FromDiscord | <ElegantBeef> Although that might not even compile considering if you do `a = i.value` it has a case statement of non similar types |
04:02:37 | FromDiscord | <Rika> if a isnt a var |
04:02:38 | FromDiscord | <Rika> yes |
04:02:47 | FromDiscord | <Rika> i mean, a declaration |
04:02:54 | FromDiscord | <Rika> if its a set only |
04:05:13 | FromDiscord | <ElegantBeef> I dont think it evaluates properly regardless |
04:05:21 | FromDiscord | <Rika> hm, ive used it before and it works |
04:05:31 | FromDiscord | <ElegantBeef> You sure you used it with different types? |
04:05:32 | FromDiscord | <Rika> prolly due to using generic functions and not setting it to a var |
04:05:37 | FromDiscord | <Rika> maybe not |
04:06:18 | FromDiscord | <Rika> ive mainly stopped programming like that already so sorry if i forget |
04:06:29 | FromDiscord | <Rika> generics are just way too good versus that kinda shit |
04:06:43 | FromDiscord | <ElegantBeef> Yea but generics dont allow homgenous collections |
04:07:02 | FromDiscord | <ElegantBeef> Cannot put a `seq[float]` and `seq[int]` in a collection together without boxing |
04:07:56 | FromDiscord | <Rika> i dont remember the last time i needed to do that though |
04:08:04 | FromDiscord | <smallgram> Aside from the collections issue, which isn't too big of a deal in my actual application... I like the idea of just using generic types and functions. However I don't know how to keep a `focus` reference that can point to whatever `Input[T]` object...? |
04:08:20 | FromDiscord | <Rika> a ref? |
04:08:32 | FromDiscord | <ElegantBeef> or a `lent` |
04:08:33 | FromDiscord | <Rika> and Input isnt a generic type in this case |
04:08:38 | FromDiscord | <smallgram> Can I have a ref that "stays generic"? |
04:08:42 | FromDiscord | <Rika> yes |
04:14:07 | FromDiscord | <smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3B |
04:14:25 | FromDiscord | <Rika> if you do that, you cannot do `seq[Input]` |
04:14:35 | FromDiscord | <Rika> youd need to do `seq[Input[int]]` |
04:14:37 | FromDiscord | <Rika> or float |
04:15:45 | FromDiscord | <smallgram> Right. But the alternative would be the `Input` base type and `IntInput` and `FloatInput` sub-types, right? And then `seq[Input]` could be done... |
04:16:01 | FromDiscord | <Rika> or the object variant beef sent |
04:16:09 | FromDiscord | <smallgram> Yeah.. |
04:16:11 | FromDiscord | <ElegantBeef> You have OOP, Generics, or Variants |
04:16:32 | FromDiscord | <ElegantBeef> Generics might not work well for this case due to having multiple Ts |
04:17:23 | FromDiscord | <smallgram> While on the topic, if I did the generic version and ignored collections for multiple Ts, how do you have a generic `Input[T]` ref that can point to any `Input`? |
04:17:36 | FromDiscord | <Rika> you cant either lol |
04:17:47 | FromDiscord | <Rika> can only point to the same T i believe |
04:18:24 | FromDiscord | <smallgram> Oh okay. Yeah, that's what I was thinking, but then you confused me earlier when you said "yes" to "can I have a ref that "stays generic"" lol |
04:18:27 | FromDiscord | <ElegantBeef> Well you can use lower level logic to achieve that |
04:18:41 | FromDiscord | <ElegantBeef> `pointer`s do exist, but not recommended |
04:18:52 | FromDiscord | <smallgram> Right, was trying to avoid. |
04:19:33 | FromDiscord | <ElegantBeef> Variants or OOP will be your best bet, i prefer the former since you dont have to cast |
04:19:34 | FromDiscord | <smallgram> That was the first thing that my mind went to from my limited C experience. π |
04:20:10 | FromDiscord | <Rika> i meant that to beef |
04:21:27 | FromDiscord | <smallgram> on the last line. |
04:21:28 | FromDiscord | <smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3G |
04:23:56 | FromDiscord | <ElegantBeef> Well yea it doesnt |
04:24:16 | FromDiscord | <ElegantBeef> Oh wait |
04:24:21 | FromDiscord | <smallgram> Yeah, I guess I can't shadow it... |
04:24:29 | FromDiscord | <ElegantBeef> You should be able to |
04:24:55 | FromDiscord | <Rika> wont it be the same issue of my template |
04:24:57 | FromDiscord | <Rika> the type gets lost |
04:26:04 | FromDiscord | <smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3H |
04:26:12 | FromDiscord | <ElegantBeef> In this case it can fall back ot `Input` which is the issue |
04:26:15 | FromDiscord | <Rika> line numbers accidentally copied π |
04:26:17 | FromDiscord | <ElegantBeef> (edit) "ot" => "to" |
04:26:32 | FromDiscord | <ElegantBeef> The only type that all of those can fit into is an `Input` |
04:26:37 | FromDiscord | <smallgram> Ha, yeah didn't bother to not copy them. lol |
04:26:52 | FromDiscord | <Rika> remember to "+y instead of ctrl+shift+c |
04:28:22 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2O3J |
04:28:26 | FromDiscord | <ElegantBeef> You have to do it like this |
04:29:07 | FromDiscord | <ElegantBeef> The typing has to be figured out at compile time so the `var` has to be an Input in your example as it's the only type that can hold all of the return values |
04:29:13 | FromDiscord | <ElegantBeef> You could use methods here |
04:29:17 | FromDiscord | <ElegantBeef> Depending on what you need |
04:32:23 | FromDiscord | <smallgram> Yeah, thanks beef. I was trying to do the type conversion up front, to avoid duplicating a bunch of the proc in two branches. |
04:32:46 | FromDiscord | <smallgram> But I was also just looking at methods. Thanks! |
04:35:25 | FromDiscord | <smallgram> The brain has become weaker working in Python and JS so much. lol |
04:36:37 | FromDiscord | <smallgram> (edit) Yeah, thanks beef. I was trying to do the type conversion up front, to avoid duplicating a bunch of the proc in two branches, but not looking possible. |
04:37:29 | FromDiscord | <ElegantBeef> "This is your mind on dynamic typing" |
04:38:54 | FromDiscord | <ElegantBeef> There is also https://github.com/Carpall/nobject |
04:40:13 | FromDiscord | <ElegantBeef> Not that i encourage the use of dynamic typing, but i cannot stop you if you do use it π |
04:50:40 | * | spiderstew_ joined #nim |
04:52:19 | * | spiderstew quit (Ping timeout: 272 seconds) |
05:19:14 | * | opal quit (Ping timeout: 264 seconds) |
05:37:03 | * | opal joined #nim |
05:59:18 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:59:24 | * | njoseph joined #nim |
06:00:00 | * | njoseph quit (Client Quit) |
06:00:07 | * | njoseph joined #nim |
06:00:07 | * | njoseph quit (Client Quit) |
06:00:16 | * | njoseph joined #nim |
06:01:03 | * | njoseph quit (Client Quit) |
06:01:10 | * | njoseph joined #nim |
06:01:28 | * | njoseph quit (Client Quit) |
06:01:34 | * | njoseph joined #nim |
06:03:06 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:16:25 | * | narimiran joined #nim |
06:24:15 | * | vicfred joined #nim |
06:37:30 | * | icebattle quit (Ping timeout: 246 seconds) |
07:32:08 | * | caesarsalad quit (Ping timeout: 258 seconds) |
07:43:20 | * | couven92 joined #nim |
07:53:13 | * | liblq-dev joined #nim |
08:02:29 | * | wasted_youth quit (Read error: Connection reset by peer) |
08:02:51 | * | leorize quit (Remote host closed the connection) |
08:03:16 | * | leorize joined #nim |
08:38:31 | * | actuallybatman quit (Ping timeout: 272 seconds) |
08:48:46 | * | d10n quit (Quit: why all the #hashtags #lol #hackers #overheard) |
08:49:03 | * | d10n joined #nim |
08:49:03 | * | d10n quit (Changing host) |
08:49:03 | * | d10n joined #nim |
08:51:44 | FromDiscord | <djazz> Updated nim from 1.2.6 to 1.4.2 and now I get `Error: internal error: inconsistent environment type` on a line. I think gcsafe or something is messing it up. The error occurs on this line https://github.com/daniel-j/nim-webview/blob/master/examples/demo/demo.nim#L37 and these are the relevant code for the procs called https://github.com/daniel-j/nim-webview/blob/master/src/webview.nim#L167-L190 (eval and return cause it) |
08:52:47 | FromDiscord | <djazz> webview has a dispatch function I use, which calls the proc passed on the main gui thread (it is stored in a queue, internally in upstream webview library) |
08:53:29 | * | PMunch joined #nim |
08:53:43 | FromDiscord | <djazz> This code worked fine before, although it's not a pretty solution... |
09:00:03 | * | VijayMarupudi[m] quit (Quit: Idle for 30+ days) |
09:05:39 | * | wasted_youth joined #nim |
09:15:29 | * | joast quit (Ping timeout: 265 seconds) |
09:18:39 | FromDiscord | <mratsim> seems like a regression in closure capture |
09:18:57 | FromDiscord | <mratsim> if you now how to clone and build nim from source |
09:19:09 | FromDiscord | <mratsim> (with ./build_all.sh script) |
09:19:28 | FromDiscord | <mratsim> you can run ./koch temp c <path/to/your/file.nim> |
09:19:47 | FromDiscord | <mratsim> that will create a temporary Nim compiler in debug mode with stack traces |
09:20:53 | FromDiscord | <mratsim> you can then create an issue with a link to your code (tag the precise commit/permalink by pressing "y"), the project file we need to compile and the stacktrace. |
09:21:32 | FromDiscord | <mratsim> if you can reduce the example great but I think this one might be tricky to reduce and with the stacktrace and git bisect we can narrow down the regression |
09:26:52 | * | MarderIII joined #nim |
09:31:24 | FromDiscord | <djazz> alright |
09:32:01 | FromDiscord | <djazz> the example compiles sucessfully with 1.2.8, and fails on 1.4.0 |
09:32:23 | FromDiscord | <ElegantBeef> Does it fail on devel? |
09:32:24 | FromDiscord | <djazz> will take a closer look at it later with a custom nim build |
09:52:14 | * | fanta1 joined #nim |
10:03:52 | * | MarderIII quit (Ping timeout: 260 seconds) |
10:05:45 | * | abm joined #nim |
10:11:09 | * | liblq-dev quit (Quit: WeeChat 3.0) |
10:11:18 | * | liblq-dev joined #nim |
10:19:12 | FromGitter | <Lecale> What's the easiest way to find out your machine name with nim? I've just scoured the os module and totally failed to find something. |
10:19:24 | * | qwertfisch quit (Ping timeout: 240 seconds) |
10:20:34 | * | qwertfisch joined #nim |
10:22:12 | FromDiscord | <mratsim> execProcess("uname -a") |
10:22:16 | FromDiscord | <mratsim> or something like that |
10:23:44 | FromGitter | <Lecale> oh i'm in the wrong module then :) |
10:24:12 | FromDiscord | <haxscramper> https://nim-lang.org/docs/posix.html#getlogin_r%2Ccstring%2Cint |
10:26:10 | FromDiscord | <haxscramper> Oh, you need a machine not username - `gethostname` from the same module is probably what you need |
10:29:14 | PMunch | Assuming you are on a POSIX system though |
10:30:59 | PMunch | Hmm, I'm in a bit of a pickle.. |
10:32:20 | FromDiscord | <ElegantBeef> He turned himself into a pickle. Funniest shit i've ever seen. |
10:32:21 | PMunch | I have a procedure that reads from a stream, and that stream was based on a socket |
10:32:43 | PMunch | Filled my bath-tub with vinegar, salt, and sugar and pickled myself |
10:32:47 | PMunch | I'll never go old! |
10:32:59 | FromDiscord | <ElegantBeef> Nor will you grow up |
10:33:01 | PMunch | I will be a bit soggy and translucent though.. |
10:33:49 | PMunch | Anyways |
10:33:50 | FromDiscord | <ElegantBeef> What's the issue with the stream? |
10:34:00 | PMunch | Well, now I need to perform my stuff async |
10:34:25 | PMunch | Because I want to send as many requests as I can |
10:34:33 | PMunch | Hmm, I guess I could create a bunch of sockets... |
10:34:44 | PMunch | And then just readAll |
10:35:05 | PMunch | The problem is that these are DNS messages, so I don't know the size of the message without parsing it |
10:35:20 | PMunch | And the parser is based on binaryparse and uses a stream |
10:36:46 | FromDiscord | <ElegantBeef> Well since async occurs linearly cant you just hold those async procedures hostage with a while loop and a bool, similar to a threading lock? |
10:37:50 | FromDiscord | <ElegantBeef> My super dumb idea |
10:37:54 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/xut |
10:39:13 | FromDiscord | <ElegantBeef> I obviously dont use async π |
10:39:47 | PMunch | How would that help? |
10:40:05 | PMunch | The problem is that trying to parse a DNS message from the stream is a blocking operation |
10:40:23 | PMunch | Or wait, reading from a stream with not enough data is an exception? |
10:40:38 | PMunch | I think I've been mixing channels and streams in my head -_- |
10:41:29 | FromDiscord | <ElegantBeef> Ah didnt get that as a problem, so thought the solution was just accessing the stream async caused issues |
10:41:40 | FromDiscord | <ElegantBeef> I dont async so i shouldnt speak π |
10:42:00 | PMunch | Don't do async kids |
10:42:24 | PMunch | It's a gateway paradigm |
10:43:09 | FromDiscord | <ElegantBeef> First you async, then you thread, then you use opencl, finally you use cluster computing |
10:43:46 | FromDiscord | <GreenFork> good times when CPU only had 1 thread |
10:43:57 | FromDiscord | <ElegantBeef> 1 thread no gpu |
10:44:04 | FromDiscord | <ElegantBeef> There was only the correct way to program π |
10:45:06 | PMunch | As someone who's done multi-tasking by context switching with assembly, no, no it's not |
10:45:19 | FromDiscord | <ElegantBeef> Lol |
10:46:06 | FromDiscord | <ElegantBeef> Speaking of context switching, good night π |
10:46:44 | PMunch | Good night |
10:49:10 | * | FromGitter quit (Remote host closed the connection) |
10:49:41 | PMunch | Hmm, seems FromGitter went to bed as well.. |
10:52:31 | * | FromGitter joined #nim |
10:59:08 | FromDiscord | <dom96> Async is there to prevent blocking on a read π |
11:00:21 | PMunch | Well yes, but the thing reading from the stream isn't async |
11:00:26 | PMunch | And the stream isn't async.. |
11:01:07 | PMunch | It's the classic red/blue async issue |
11:01:11 | PMunch | https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ |
11:03:07 | FromDiscord | <Rika> We have βconverterβ from async to sync but not reverse |
11:03:17 | FromDiscord | <Rika> And I donβt think reverse is easily doable |
11:04:06 | FromGitter | <Araq> gah not this color thing again... |
11:04:41 | FromDiscord | <Rika> Thereβs been an article βdebunkingβ it |
11:06:52 | FromDiscord | <Rika> https://www.tedinski.com/2018/11/13/function-coloring.html |
11:08:03 | PMunch | Brb, reading |
11:14:12 | FromDiscord | <Rika> Also do we not have asynchronous streams |
11:16:36 | PMunch | Okay done |
11:16:52 | PMunch | That article doesn't really refute any of my issues though.. |
11:17:08 | PMunch | The problem isn't "is it impossible to rewrite this to be properly async" |
11:17:31 | PMunch | The problem is "I have existing libraries of two different colours that can't mix" |
11:17:49 | PMunch | Even though the underlying types differ, they have different execution models, and I can't mix them |
11:18:57 | PMunch | Don't get me wrong, I don't know of another language where this wouldn't be a problem (except perhaps for languages that force everything to be async as a default, but that has another set of issues) |
11:35:01 | FromGitter | <Araq> well yes and no |
11:35:18 | FromGitter | <Araq> "I can't mix them" is a strong statement, there is always threads and channels |
11:35:52 | FromGitter | <Araq> or even interprocess communication |
11:36:49 | FromGitter | <Araq> I agree it's annoying though and in an ideal world things worked much like they do in Golang *shrug* |
11:37:17 | FromDiscord | <basdk> hi i was wondering if there is any proc or other to sum differents json like thisβ΅{"a":1, "b":2}+{"a":2, "b":3, "c":1}= {"a":3, "b":5, "c":1}? |
11:37:38 | FromDiscord | <Rika> no, sounds niche |
11:37:40 | PMunch | @Araq, I don't think golang would fix this, would it? |
11:38:18 | PMunch | But yeah, I could jump some hoops and get it working, but I'm trying to load test something so I need it to spew as many DNS requests as fast as possible |
11:38:34 | FromGitter | <Araq> why not? there is no async in Golang, there is only 'go fun(a, b, c)' which every library can use or not |
11:38:55 | FromDiscord | <Rika> how high is the overhead for that |
11:39:19 | PMunch | Oh really? Huh, so they have some kind of global async context behind the scenes that all their procedures need to interact with (although hidden from the user) |
11:39:29 | PMunch | I guess it makes sense for what Golang tries to be |
11:39:49 | FromDiscord | <Rika> no they use greenlets |
11:40:45 | FromGitter | <Araq> well 'greenlet' is just a word. the question is can other goroutines run when you call io.write. And afaik they can |
11:42:07 | FromDiscord | <Rika> ah i guess greenlets are an "async context" in a way |
11:42:12 | FromGitter | <Araq> and yet io.write doesn't produce a Future[], the type system isn't involved, the code looks synchronous / "Blocking" |
11:47:26 | FromDiscord | <Clyybber> Araq: Go uses `chan` as a Future type |
11:47:53 | FromGitter | <Araq> `write` doesn't return a channel |
11:48:09 | FromGitter | <Araq> nor does `read` require a channel |
11:48:41 | FromDiscord | <Clyybber> yeah; I mean for the classical 'get future; await it' flow |
11:51:42 | FromGitter | <Araq> my favourite paradigm is still threads+locks fwiw |
11:53:11 | PMunch | AFAIK a Goroutine will tell the scheduler "hey I'm about to block this thread" before doing so and that triggers it to create a new thread for computations |
11:53:23 | FromDiscord | <Clyybber> Araq: Go's io module uses interfaces as a means to be async |
11:53:41 | FromGitter | <Araq> one major problem with threads is the stack management overhead but that's a legacy forced upon us by the OS and ABIs, in principle a linked list of call frames makes for a nice stack implementation |
11:53:45 | FromDiscord | <Clyybber> if you want to do some streaming thing using goroutines you have to use `chan` |
11:53:48 | PMunch | But that is for OS blocking like file/socket reads |
11:54:30 | FromDiscord | <Clyybber> Yeah, weave is a great thread abstraction IMO |
11:54:42 | FromDiscord | <Clyybber> or implementation rather |
11:54:48 | PMunch | I've yet to play around with Weave |
11:55:21 | PMunch | And yeah, it's unfortunate that threads are so heavy |
11:55:25 | PMunch | Comparatively speaking |
11:55:37 | FromGitter | <Araq> Clyybber: really? that sucks. |
11:55:57 | FromDiscord | <Clyybber> yep |
11:57:47 | * | liblq-dev quit (Ping timeout: 258 seconds) |
12:00:23 | * | liblq-dev joined #nim |
12:04:37 | FromGitter | <Araq> we should use CPS on top of weave then... oh wait that's the plan already |
12:05:55 | * | krux02 joined #nim |
12:08:20 | PMunch | What's the status of CPS by the way? |
12:13:44 | FromGitter | <Araq> I don't know |
12:16:48 | * | nc-x joined #nim |
12:18:27 | FromDiscord | <mratsim> Golang made the choice "C and Go" don't mix well. |
12:18:56 | FromDiscord | <mratsim> because they choose fibers/stackful coroutines which have a different calling covnention from C |
12:19:19 | nc-x | PMunch: disruptek was waiting for compiler bugs to be fixed |
12:19:28 | FromDiscord | <mratsim> (Cilk made the same choice for their runtime in 1995 and it's still state of the art for multithreading, Weave has somewhat less overhead but tht's thin) |
12:19:43 | nc-x | so cps is on hiatusΒ as of now |
12:19:54 | FromDiscord | <mratsim> also goroutines are unsuitable for compute/memory bound workloads |
12:20:24 | FromDiscord | <mratsim> I need to work on some crypto (like I said 2 weeks ago) but I plan to continue working on CPS. |
12:21:02 | FromDiscord | <mratsim> @miran / narimiran: when do you think it's suitable to submit this blog post for publishing? https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md |
12:23:46 | FromGitter | <Araq> > disruptek was waiting for compiler bugs to be fixed β β yeah well, don't do that. if the CPS transformation is beyond the macro system's capabilities, write it as a compiler transformation |
12:24:29 | FromDiscord | <mratsim> I think the hard part is following the types in macros |
12:24:32 | narimiran | @mratsim oh, thanks for reminding me! i forgot about it in the mean time, sorry |
12:24:56 | FromDiscord | <mratsim> the compiler transformation was done. |
12:25:17 | FromDiscord | <mratsim> I'd like to see an example of liftLocals / owner use to create custom closure btw. |
12:25:32 | * | rockcavera joined #nim |
12:26:22 | FromDiscord | <Goel> Is there any public "Roadmap" for Nim future releases in 2021? |
12:26:25 | FromGitter | <Araq> tests/fields/tfields.nim |
12:27:44 | FromDiscord | <mratsim> @Goel keep an eye here: https://github.com/nim-lang/RFCs/milestones |
12:27:58 | nc-x | Goel: the roadmap is mostly polishing the features of 2020 roadmap |
12:28:18 | nc-x | arc/orc, ic, not nil, views |
12:28:24 | FromDiscord | <mratsim> 2020 milestones where not fully delivered (IC, nil checking) and there is developer tooling for 2021 |
12:28:28 | nc-x | and if time permits concepts also i think |
12:28:43 | * | joast joined #nim |
12:29:11 | FromDiscord | <mratsim> I assume nil checking means statically/formally prover not nil |
12:29:16 | FromDiscord | <Goel> I was most concerned about the compiler error handling, since im just starting to learn Nim, one of the most common complains on reddit about Nim is about that |
12:29:16 | FromDiscord | <mratsim> proven |
12:29:40 | FromDiscord | <mratsim> what kind of error handling? |
12:29:47 | FromGitter | <Araq> error messages |
12:29:48 | nc-x | mratsim https://nim-lang.github.io/Nim/manual_experimental_strictnotnil.html |
12:29:51 | FromDiscord | <mratsim> if you have a link to the thread that would be useful |
12:30:42 | FromDiscord | <mratsim> AFAIK @haxscramper is reviewing the errors at the moment |
12:30:50 | FromDiscord | <mratsim> not sure if it's about the compiler though |
12:31:12 | FromGitter | <Araq> why? it's always the same, people try Nim for the first time and blame the compiler's error messages. When they stay they start to complain about threading, concepts, bugs |
12:31:49 | PMunch | @Goel, not sure why people still complain about error messages. They have gotten a lot better |
12:32:18 | FromDiscord | <mratsim> If everyone does complain maybe there is something we can improve |
12:32:34 | FromGitter | <Araq> error messages can always be improved |
12:32:48 | FromGitter | <Araq> and most complains have a nugget of truth to them. |
12:32:59 | FromGitter | <Araq> the question is how to prioritize development |
12:33:05 | nc-x | the only thing you need to understand about error messages is that if you get more than 1 error, start with the first one. because some of the others might be a consequence of the first error. |
12:33:27 | nc-x | this is the solution of most error message complaints on reddit or github |
12:33:41 | FromDiscord | <mratsim> developing without users is useless. |
12:33:52 | FromDiscord | <mratsim> we need a balance |
12:34:08 | FromGitter | <Araq> and if Nim is really served well by more users who are language hoppers that cannot find information about `-d:release` |
12:34:11 | FromDiscord | <mratsim> making stability and polish a focus of 2021 also means addressing common concerns |
12:34:17 | FromDiscord | <Goel> I'm not sure about that, but they was saying that is not as detailed as for example in Rust or Golang, but again, since im new to programming i can't compare it with other languages, for sure it can be improved, but they was not "hating" the Nim compiler for the sake of it |
12:34:57 | FromDiscord | <mratsim> Well Rust needs very detailed and clear error messages because it tries to shove complex concepts from the get go |
12:35:12 | FromDiscord | <mratsim> while in Nim they are more opt in, you get complex concepts when you try to use them. |
12:35:40 | FromDiscord | <mratsim> tbh I prefer Nim error messages to python for example |
12:35:58 | * | Tlangir joined #nim |
12:36:00 | FromGitter | <Araq> also, Nim is an open source project, things we add to the compiler to make our user's lives easier |
12:36:06 | FromDiscord | <mratsim> or Java |
12:36:20 | FromGitter | <Araq> can make the Nim compiler itself harder to understand and discourage potential compiler developers |
12:36:44 | Clonkk[m] | Java error message is mostly "Null Pointer Exception "π |
12:36:45 | FromGitter | <Araq> but that's probably just my crappy way of doing compiler development speaking here. |
12:36:58 | FromDiscord | <mratsim> as I said, it's a balance. With more users you have a larger user base to get compiler devs from |
12:37:13 | nc-x | well nim community does have plenty of compiler devs |
12:37:24 | nc-x | it is just that most of them work for status |
12:37:31 | FromDiscord | <mratsim> but not plenty who have time |
12:37:34 | nc-x | yeah |
12:38:16 | * | Tanger quit (Ping timeout: 240 seconds) |
12:38:42 | FromGitter | <Araq> mratsim: does tests/fields/tfields.nim help? |
12:38:55 | FromGitter | <Araq> (yeah, that test name is ridiculous) |
12:39:36 | nc-x | well, getting a large user base is pretty difficult. all the hype is going to rust because microsoft and few other big names have adopted it and are forming their own compiler teams as well... |
12:40:34 | FromDiscord | <mratsim> @Clyybber https://github.com/fastfloat/fast_float |
12:40:58 | FromGitter | <Araq> we should look for a "decently sized" user base before a "large" one :-) |
12:41:24 | FromDiscord | <Clyybber> oh, parsing float into string |
12:41:36 | FromDiscord | <Clyybber> thanks @mratsim |
12:44:18 | FromDiscord | <Goel> By the way, who crowned Nim? (in the Logo) Was it self-crowned like Napoleon did? |
12:44:53 | Clonkk[m] | <FromGitter "<Araq> we should look for a "dec"> :wqaq |
12:45:56 | FromDiscord | <Clyybber> @Goel the crown came from heaven :p |
12:50:54 | FromGitter | <Araq> Goel: it was me... |
12:51:11 | FromDiscord | <Goel> Is it always a best choise (performance wise) to use extensivly iterators over Loops? |
12:51:26 | FromDiscord | <konsumlamm> @mratsim btw, what's the relationship between weave-io and asyncdispatch? they're both meant for IO workloads, no? |
12:51:33 | PMunch | @Goel, it is based on the old name "Nimrod" who was a king |
12:52:12 | FromDiscord | <mratsim> No relation, for now weave-io is a stash for my research on multithreading IO workloads. |
12:52:21 | PMunch | Well, he was a king in the bible, I don't think he matches any historical figure |
12:52:48 | FromDiscord | <Goel> I'm reading about him on wikipedia, thanks for the hint |
12:52:56 | FromDiscord | <mratsim> ultimately, we have CPS as a base layer for resumable functions and people can use resumable functions as a primitive building block for schedulers, be it IO or CPU |
12:53:02 | PMunch | But he's commonly associated with the tower of Babel, which was built by a community who all spoke a perfect world language. |
12:53:23 | PMunch | Which I think is how it links to Nim the programming language (please correct me if I'm wrong) |
12:53:26 | FromDiscord | <Yardanico> yes, and "nimble" was initially named babel because of that :) |
12:53:29 | FromDiscord | <konsumlamm> the biggest problem with error messages imo is type mismatch errors, so i'm glad hax made https://github.com/nim-lang/RFCs/issues/325 |
12:54:06 | nc-x | well error messages don't really need rfcs |
12:54:19 | FromDiscord | <mratsim> I think they do |
12:54:20 | FromDiscord | <konsumlamm> well, it has one anyway |
12:54:22 | nc-x | they need somebody to work on improving them |
12:54:29 | FromGitter | <Araq> nc-x: we can be successful in a world where Rust is hyped. In fact, it can be helpful, just imagine having to wrap code that doesn't lie about data types ("yay, a pointer, can it be NULL? is it actually an array in disguise?") |
12:54:36 | FromDiscord | <mratsim> consistency between errors really help |
12:55:06 | FromDiscord | <mratsim> @konsumlamm here is my current thinking: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md |
12:55:23 | nc-x | Araq: i like the goals of rust, but not the language itself, that's why i am here :D |
12:55:33 | FromDiscord | <mratsim> basically decouple the async transformation/resumable functions from the scheduler. |
12:55:57 | FromDiscord | <mratsim> embrace that people will likely need custom schedulers (threadpools, weave, asyncdispatch, multithreaded IO, even MPI) |
12:56:11 | FromDiscord | <mratsim> and just give them tool to stop/resume computation anywhere. |
12:56:20 | FromDiscord | <mratsim> which would be CPS (aka a "continuation) |
12:56:50 | FromGitter | <Araq> nc-x: great. but my point is that maybe we should embrace a rust2nim tool |
12:56:54 | FromDiscord | <mratsim> or can even use continuation without any scheduler a.k.a iterators |
12:56:55 | FromDiscord | <konsumlamm> i like the goals of rust and the language itself, yet i'm here lol |
12:57:06 | FromDiscord | <mratsim> https://github.com/arnetheduck/nbindgen |
12:58:14 | FromGitter | <Araq> yeah. like that. |
13:03:45 | PMunch | Hmm, socket.recv(int.high) causes a SIGSEGV (I'm guessing because it tries to allocate a buffer of int.high size which fails and then tries to write to the null pointer of that allocation) |
13:04:00 | PMunch | What is the correct way of read as much as you can, don't really care how much? |
13:04:57 | PMunch | `recv` docs says: "Reads *up to* size bytes from socket." so I assumed that would work.. |
13:05:35 | FromGitter | <Araq> we cannot detect OOM reliably on unix because of `fork` |
13:05:53 | PMunch | Because of fork? |
13:06:12 | FromGitter | <Araq> yeah, unix needs memory overcommits because of fork |
13:07:30 | FromGitter | <Araq> it's full of design bugs like that but it's not from evil M$ so let's never talk about it. Worked well for the last 40 years. |
13:09:08 | PMunch | Aah, I see |
13:10:52 | * | mmohammadi9812 quit (Ping timeout: 265 seconds) |
13:11:06 | PMunch | I don't really mind that it crashed though, was pretty easy to realise what went wrong |
13:11:10 | * | sacredfr- quit (Quit: ZNC 1.8.2 - https://znc.in) |
13:11:22 | * | mmohammadi9812 joined #nim |
13:11:30 | PMunch | Well, if you know how a computer works. I guess this is why people don't like some of the Nim error messages. |
13:11:33 | * | ryanhowe joined #nim |
13:11:39 | PMunch | They see SIGSEGV and get scared |
13:12:01 | FromGitter | <Araq> rightly so, but there is a limit for us, we cannot fix OS bugs. |
13:12:06 | PMunch | Anyways, what would be the correct way of getting "some chunk of data" from an async socket? |
13:12:46 | FromGitter | <Araq> I don't know, use a buffered socket or look how it's implemented |
13:13:10 | PMunch | I mean detecting the SIGSEGV and just outputting some canned message as to what might be your issue could help |
13:13:28 | PMunch | Even GCC has "Illegal storage access. (Attempt to read from nil?)" |
13:14:01 | FromGitter | <Araq> in general sockets lack the notion of "hey, N bytes have arrived, maybe you want to do something with these", instead every protocol reinvents `content-length` |
13:14:37 | PMunch | Wait, attempt to read from nil is a Nim message isn't it? |
13:15:57 | qwr | imho overcommit shouldn't result in SIGSEGV - instead it causes SIGKILL by kernel oom killer |
13:17:14 | FromGitter | <Araq> PMunch: yes, it is |
13:17:55 | PMunch | Yeah I'm not sure if this is actually overcommit. It seems like it's just the equivalent of `char * myptr = calloc(int.high); myptr[0] = 'h';` and that calloc call fails |
13:18:33 | PMunch | @Araq, so we could add some more causes there? Attempting to read from nil is something the user very rarely ends up doing in modern Nim |
13:19:23 | PMunch | Used to be more common when strings and seqs where nil, but something like "Trying to access uninitialised `ref` object or accidentally allocating too much memory?" would probably be a more helpful message |
13:20:24 | PMunch | I'm guessing there's no way of knowing what exactly triggered the error? So we can't check whether we actually where trying to do `uninitialised.somefield = 100` |
13:20:48 | FromGitter | <Araq> we do try to detect OOM |
13:21:33 | PMunch | Yeah I know |
13:21:53 | PMunch | TBH I still think the underlying issue there is that it fails to allocate memory and then tries to access it |
13:24:14 | qwr | mmap or brk can return allocation error to program, but with overcommit they give memory pages with no physical memory assigned, that can result in some process being killed if kernel won't find enough physical memory |
13:25:13 | qwr | PMunch: could you debug, what exactly happens and causes the SIGSEGV? |
13:25:50 | PMunch | int32.high actually works. Quickly consumes about 2Gb of data and then sits idly by waiting for that buffer to fill up :P |
13:26:48 | PMunch | http://ix.io/2O6j |
13:27:36 | qwr | if calloc() gets very big value as argument, then returning NULL is normal (and the return value should be checked) |
13:27:44 | krux02 | PMunch: info locals, info args, list |
13:28:00 | FromGitter | <Araq> qwr: we don't use `calloc`, we use `mmap` |
13:28:19 | FromGitter | <Araq> and yeah, we do check its return value |
13:28:37 | qwr | On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the cause of the error. |
13:29:27 | qwr | PMunch: could you strace whether there is mmap error? |
13:30:46 | PMunch | @krux02, http://ix.io/2O6m |
13:32:54 | PMunch | Hmm, is that negative number because it tries to allocate a string with len = int.high so it tries to add the size of the len and capacity fields to int.high making it wrap around? |
13:33:55 | krux02 | that could be the case |
13:34:24 | PMunch | Interesting |
13:34:33 | krux02 | the requested size is already negative |
13:34:51 | PMunch | Not in the call to rawNewString |
13:35:02 | FromGitter | <Araq> usually arithmetic overflow checks are active in these code path though |
13:35:02 | PMunch | It only goes negative when that calls newObj |
13:35:37 | PMunch | I don't have any fancy switches on: nim c --debugger:native loadtester.nim |
13:35:42 | * | vicfred quit (Quit: Leaving) |
13:35:42 | PMunch | And no nim.cfg |
13:36:31 | * | nc-x quit (Quit: Connection closed) |
13:38:02 | * | vicfred joined #nim |
13:41:10 | PMunch | Changing it to int.high-65 makes it error out with "out of memory" |
13:41:26 | PMunch | But now with no kind of error message, which is arguably less helpful.. |
13:41:47 | PMunch | Or no kind of stack trace rather |
13:43:33 | krux02 | yea I complained about this type of behavior several times. Catching an error and printing a message and quitting the program is much less helpful than letting it crash. |
13:46:11 | FromGitter | <Araq> there is `-d:noSignalHandler` that you can use |
13:47:19 | PMunch | That switch didn't seem to do anything |
13:47:37 | PMunch | Still just got the "out of memory" message |
13:48:06 | PMunch | I mean I don't mind it telling me that it's out of memory, but having the stack trace as well would be nice.. |
13:48:09 | FromGitter | <Araq> yeah of course. "out of memory" isn't triggered from a signal handler |
13:51:01 | * | mmohammadi9812 quit (Read error: Connection reset by peer) |
13:51:28 | * | mmohammadi9812 joined #nim |
14:01:59 | PMunch | Uhm, I just added rate-limiting by adding a `if queriesPerSecond != 0: await sleepAsync(1000/queriesPerSecond)` and it just quits immediately |
14:02:07 | PMunch | Is this a bug in async? |
14:03:07 | FromGitter | <Araq> I doubt it, `await sleepAsync` is pretty common |
14:03:58 | PMunch | I know, I'm confused |
14:04:31 | narimiran | PMunch: should this be `1000 div queriesPerSecond`? or do we have a float version too? |
14:04:52 | narimiran | ah, we have float version too |
14:05:01 | narimiran | `proc sleepAsync*(ms: int | float): owned(Future[void]) = |
14:05:01 | narimiran | ` |
14:05:19 | FromGitter | <Araq> yeah it's bad |
14:05:26 | PMunch | Yeah sleepAsync has a float version |
14:05:30 | PMunch | os.sleep doesn't |
14:05:34 | FromGitter | <Araq> why have the 'int' version when it does support floats |
14:06:17 | PMunch | Ah, nvm.. |
14:06:22 | PMunch | I was just being a dummy |
14:16:36 | * | hmmm joined #nim |
14:16:40 | hmmm | hallo! |
14:19:26 | PMunch | Hi hmmm |
14:20:07 | hmmm | Muuunchie |
14:20:40 | hmmm | how is not a fisher going? I am on linux now so I'm eager to try it :3 |
14:21:10 | PMunch | Well it should work fine :) |
14:21:27 | PMunch | Haven't worked a whole lot on it lately |
14:21:38 | hmmm | is in beta shape? can I trust all my notifications to it? |
14:22:24 | PMunch | Depends how important your notifications are |
14:22:35 | PMunch | I wouldn't use it for a cardiac arrest alarm |
14:22:49 | hmmm | not much, I have some api meteo that is comfy and hmm I think that's it lol :D |
14:23:05 | PMunch | Should be fie |
14:23:07 | PMunch | fine* |
14:23:13 | hmmm | gimme link :3 |
14:23:23 | PMunch | https://github.com/PMunch/notifishower |
14:23:40 | hmmm | HAHAHAHA |
14:23:40 | PMunch | And you'll probably need notificatcher as well |
14:23:40 | hmmm | that awesome icon :DDD |
14:24:03 | hmmm | munchie u have gud sense of humor, praise to u |
14:24:37 | PMunch | Haha, thanks :P I think it was Zevv who created the showerhead though. Mine didn't look very nice.. |
14:25:27 | hmmm | am I supposed to nimble install it? |
14:26:06 | PMunch | I don't think they're in Nimble |
14:26:18 | PMunch | Clone the repos and `nimble build` |
14:26:33 | * | vicfred quit (Quit: Leaving) |
14:26:51 | ForumUpdaterBot | New post on r/nim by doggertron_: Magic has been done., see https://i.redd.it/djvzqsblq2f61.png |
14:26:52 | hmmm | what am I supposed to do with dunst? they can work toghether? |
14:27:38 | PMunch | Nope |
14:27:47 | PMunch | Dunst catches notifications, same as notificatcher |
14:27:52 | PMunch | You need to disable it |
14:27:59 | PMunch | Or uninstall I guess |
14:28:09 | hmmm | ok |
14:28:14 | hmmm | where do I get notificatcher |
14:29:50 | PMunch | https://github.com/PMunch/notificatcher |
14:29:55 | Prestige | I think just disabling it is fine? |
14:30:21 | hmmm | zevv pro artist |
14:30:22 | PMunch | Yeah that should be enough |
14:31:06 | PMunch | I mean just `killall dunst && ./notificatcher` should work |
14:31:15 | PMunch | But if notificatcher crashes then dunst will be restarted |
14:31:28 | PMunch | Which might be what you want to be honest :P |
14:31:42 | hmmm | ok will report to you when it's done, if I don't report back my pc took fire and I'm running for my life |
14:31:56 | * | Vladar joined #nim |
14:33:46 | PMunch | Pfft, it's a shower, how is it going to catch fire! |
14:35:03 | narimiran | "not if i catch 'er"? |
14:35:06 | * | FromDiscord quit (Remote host closed the connection) |
14:35:23 | * | FromDiscord joined #nim |
14:35:31 | PMunch | That sounds a bit, uhm, aggressive |
14:35:32 | hmmm | no .tif cache her(e) |
14:37:16 | FromDiscord | <Bimbo> Hello everyone, i'm trying to implement the hmac-sha1 algorithm in nim by following the specification and pseudocode from the wikipedia page (https://en.wikipedia.org/wiki/HMAC). Even though i think i got it right it produces wrong results. Any help would be appreciatedβ΅β΅code: https://play.nim-lang.org/#ix=2O6H |
14:39:44 | FromDiscord | <mratsim> good luck debugging crypto code |
14:41:06 | FromDiscord | <Bimbo> sigh. and i'm just begginning to learn crypto by implementing it |
14:41:15 | FromDiscord | <mratsim> that's how you learn |
14:41:20 | Prestige | PMunch: I need to keep working on Nimdow, been slacking... I want to change how floating windows are handled, but it's going to be a bit of a rewrite :x |
14:41:22 | FromDiscord | <Zachary Carter> `$secureHash(outPadKey or $secureHash(inPadKey or message))` well |
14:41:25 | FromDiscord | <Zachary Carter> that doesn't jive with |
14:41:35 | FromDiscord | <Zachary Carter> `return hash(o_key_pad β₯ hash(i_key_pad β₯ message))` |
14:41:36 | Prestige | looking at how dwm does it, is a bit hacky. But at least it works I guess |
14:41:36 | FromDiscord | <Zachary Carter> for one |
14:41:38 | FromDiscord | <konsumlamm> when you just say crypto, do you mean cryptography or cryptocurrencies? |
14:41:57 | FromDiscord | <Zachary Carter> (edit) "or" => "and" | "or" => "and" | removed "well" |
14:41:58 | FromDiscord | <mratsim> yes, in crypto spec || is equivalent to append |
14:42:01 | FromDiscord | <Zachary Carter> sorry I fixed my message |
14:42:03 | FromDiscord | <mratsim> not binary "or" |
14:42:05 | FromDiscord | <Zachary Carter> oh |
14:42:08 | FromDiscord | <Zachary Carter> dafuq |
14:42:17 | FromDiscord | <mratsim> so "add" is correct |
14:42:34 | FromDiscord | <mratsim> @konsumlamm depends on the context, I work in both :p |
14:43:46 | hmmm | ok the catcher works it's sending stuff |
14:43:53 | hmmm | the fisher is silent |
14:43:53 | FromDiscord | <mratsim> std/sha1 has broken interface :/ you shouldn't use `$` it converts to hex |
14:44:00 | hmmm | maybe I need to configure it? |
14:44:08 | PMunch | Prestige, how does it work now? |
14:45:00 | PMunch | hmmm, probably |
14:45:12 | FromDiscord | <Bimbo> Since sha1digest is a seq[uint8] should i convert it manually instead of using `$`? |
14:45:41 | FromDiscord | <mratsim> you create your own seq[uint8] and append directly as uint8 inside |
14:45:49 | FromDiscord | <mratsim> and only at the end for display you convert to byte |
14:46:14 | PMunch | hmmm, did you just do `notificatcher --run notifishower`? |
14:46:29 | Prestige | PMunch: atm floating windows are stacked based on how recently they were focused, so if your mouse hovers a floating window, it's brought to the top (you can't click a window to focus it, is the main issue I need to resolve, to change this behavior) |
14:46:45 | PMunch | Aah |
14:46:48 | PMunch | I see |
14:46:52 | FromDiscord | <mratsim> @Bimbo if you want to play with a well tested and proper interface for crypto in Nim I suggest you use this file for SHA2: https://github.com/mratsim/constantine/blob/master/constantine/hashes/h_sha256.nim#L214 |
14:47:06 | Prestige | Essentially https://github.com/avahe-kellenberger/nimdow/issues/127 |
14:47:18 | PMunch | Damn 127 issues already, not bad |
14:47:23 | FromDiscord | <mratsim> testing vs OpenSSL is here: https://github.com/mratsim/constantine/blob/master/tests/t_hash_sha256_vs_openssl.nim |
14:47:37 | Prestige | PMunch: thanks, lol. Only 13 open, mostly by myself iirc |
14:47:41 | FromDiscord | <Bimbo> I'll look into it, thanks! |
14:47:45 | FromDiscord | <mratsim> it also uses byte instead of uint8 |
14:48:08 | FromDiscord | <mratsim> I suggest you implement hex<-> string conversion yourself as a learning experience |
14:48:35 | PMunch | I guess you should also take into account parent windows |
14:48:46 | PMunch | Or TRANSIENT_FOR or whatever it's called in X11 terms |
14:49:00 | PMunch | So a dialog box is never rendered behind its parent |
14:49:12 | Prestige | hm true |
14:49:13 | FromDiscord | <Bimbo> Will probably do, for the time being i'm trying to learn how HOTP/TOTP works |
14:49:30 | Prestige | I could handle that with out the rewrite |
14:49:30 | FromDiscord | <mratsim> otherwise I have them here: https://github.com/mratsim/constantine/blob/master/constantine/io/io_bigints.nim#L309-L408β΅β΅or you can nimble install stew and use import stew/byteutils |
14:49:46 | FromDiscord | <Bimbo> since small projects are ideal for learning i'm making a totp generator for the time being, that's how i stumbled upon hmac_sha1 |
14:49:50 | Prestige | I forget why click to focus was going to be a PITA |
14:50:02 | FromDiscord | <Bimbo> thanks for the resources |
14:59:19 | PMunch | Hmm, can I run async stuff in one thread? |
14:59:31 | FromDiscord | <konsumlamm> suddenly everyone is starting to follow me on github lol |
15:01:25 | FromGitter | <Araq> you're a wizard arry |
15:04:40 | FromDiscord | <konsumlamm> are you french now? |
15:05:19 | FromDiscord | <inv> Hello, hello,β΅β΅Can someone please remind how to make optimization by template? Example: https://play.nim-lang.org/#ix=2O6V |
15:05:20 | FromGitter | <Araq> no, it was a typo |
15:06:01 | FromDiscord | <inv> (edit) "Hello, hello,β΅β΅Can someone please remind how to make optimization by template? ... Example:" added "- Cannot find example except in experimental, but it does not work." |
15:06:47 | * | PMunch quit (Quit: leaving) |
15:07:10 | FromDiscord | <Bimbo> how do i convert a byte array to a string correctly, is casting to string a good idea? i tend to avoid it |
15:08:28 | FromDiscord | <inv> I remember copyMem helps here |
15:09:19 | FromGitter | <Araq> inv: pattern matching against the bracket access won't work anytime soon |
15:09:31 | FromDiscord | <Bimbo> oops, for clarification i mean seq[byte] if that makes any difference |
15:10:03 | FromGitter | <Araq> Bimbo: casting between seqs and string is so common that even the new runtime supports it out of the box |
15:10:19 | FromGitter | <Araq> ideally we would have a builtin for that though |
15:11:39 | FromDiscord | <Bimbo> ah i see, that's good |
15:13:07 | FromDiscord | <inv> if the problem is in [idx], let me create pattern without it: https://play.nim-lang.org/#ix=2O72 but I see it calls "asc" again |
15:13:42 | * | icebattle joined #nim |
15:14:51 | * | hmmm quit (Quit: WeeChat 3.0) |
15:15:26 | FromDiscord | <inv> I changed template from ``x: openArray`` to ``untyped`` and it works now. yeehoo! |
15:17:26 | FromDiscord | <mratsim> byte array to string: https://github.com/status-im/nim-http-utils/blob/5dfbe9ba68e97bce01a41096b764bd5a8d6fb011/httputils.nim#L546-L557 |
15:18:04 | FromDiscord | <mratsim> casting will cause problem if you interop with C because the original byte array isn't `\0` terminated |
15:18:14 | FromDiscord | <mratsim> while Nim strings should be |
15:18:24 | * | mbomba joined #nim |
15:19:36 | FromGitter | <Araq> very good point but not every string interops with C |
15:19:40 | FromDiscord | <Bimbo> It's nim only so i should be safe when casting right? |
15:20:13 | FromDiscord | <mratsim> you never know when what you write, especially for protocols, need to interop with C for say IO |
15:21:08 | FromDiscord | <mratsim> if you use stdout.write for example I think you will read past the buffer |
15:21:27 | FromDiscord | <mratsim> though stdout.write shouldn't be used for crypto because crypto strings can be \0 |
15:22:08 | FromDiscord | <Bimbo> well yeah that's true. I'll use the proc you referenced. |
15:22:31 | FromDiscord | <Bimbo> stdout.write removes the trailing `\0`? |
15:22:59 | FromDiscord | <mratsim> it calls libc/glibc underneath that uses C strings |
15:23:05 | FromDiscord | <mratsim> and C strings are terminated by \0 |
15:23:17 | FromDiscord | <mratsim> so if your hashing creates a \0 somewhere |
15:23:31 | FromDiscord | <mratsim> it will interrupt printing for C lib π |
15:23:47 | FromDiscord | <mratsim> Nim `echo` is fine |
15:24:06 | FromDiscord | <mratsim> but for printing I just use stew/byteutils |
15:24:37 | FromDiscord | <mratsim> I recommend you de everything as seq[byte] and only use "toHex" at the end for debugging. |
15:24:43 | FromDiscord | <mratsim> (edit) "de" => "do" |
15:25:24 | FromDiscord | <mratsim> if you're stuck here is a production-grade hmac implementation: https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/hmac.nim |
15:26:15 | FromDiscord | <mratsim> and here is how to use it to implement HKDF: https://github.com/status-im/nim-blscurve/blob/master/blscurve/eth2_keygen/hkdf.nim |
15:26:32 | FromDiscord | <mratsim> Those were reviewed by security auditors |
15:26:47 | FromDiscord | <mratsim> and cryptographers |
15:28:59 | FromDiscord | <mratsim> if you're still stuck after a couple of hours, ping me, I can help check @Bimbo |
15:31:36 | * | hmmm joined #nim |
15:33:35 | FromDiscord | <Bimbo> Thanks a lot! will do if i need help. Also on another note before i tried making an otp implementation i searched on https://nimble.directory for hmac/otp libs and found some that were somewhat difficult to understand since i'm a begginner in cryptography. |
15:34:17 | * | fanta1 quit (Quit: fanta1) |
15:37:15 | FromDiscord | <Bimbo> i could try to contribute libraries for crypto in this area that people could use like python/go has base32/hmac/otp |
15:46:12 | FromDiscord | <mratsim> I want to do an OTP app as well because I don't really like google authenticator and authy. |
15:46:56 | FromDiscord | <mratsim> but I'm too busy :p |
15:47:59 | FromDiscord | <Bimbo> Same here, i'd prefer a cli tool for it, and that's what i'm trying to make right now since i have some time in my hands. |
15:48:04 | FromDiscord | <mratsim> Maybe you could have a look at this book: https://web.engr.oregonstate.edu/~rosulekm/crypto/ |
15:48:15 | FromDiscord | <mratsim> This is a WIP book on crypto for undergraduate student |
15:48:21 | FromDiscord | <mratsim> I've heard good review |
15:49:30 | * | vicfred joined #nim |
15:49:55 | FromDiscord | <Bimbo> I've heard of this book before. Since it's a good opportunity I'll probably give it a read |
15:51:46 | FromDiscord | <Zachary Carter> Speaking of books - has anyone ever read https://beginners.re/main.html ? |
15:55:22 | FromDiscord | <mratsim> no |
15:55:46 | FromDiscord | <mratsim> for understanding assembly I read the hardware manual though (6502, ARM or Intel) |
15:58:59 | FromDiscord | <Bimbo> haven't done much assembly nor read books about it except that one uni course i had about RISCV assembly |
15:59:35 | FromDiscord | <mratsim> it's strange but low-level crypto requires assembly |
15:59:39 | FromDiscord | <mratsim> for both security and speed |
15:59:55 | FromDiscord | <Zachary Carter> yeah - I think that might be a bit too hardcore for me @mratsim I need something to fill knowledge gaps |
15:59:58 | FromDiscord | <Zachary Carter> maybe this book will be good |
16:00:03 | FromDiscord | <mratsim> https://github.com/mratsim/constantine/wiki/Constant-time-arithmetics |
16:00:29 | FromDiscord | <mratsim> when you're tired of coding crypto, I've collected fun crypto attacks/vulnerabilities ^ |
16:01:47 | FromDiscord | <haxscramper> Right now I'm not working on error messages in any way except for maybe thinking it over. There is no shortage of ideas of how they could be made nicer, but what I'm lacking is general understanding of how to actually implement them. |
16:02:05 | FromDiscord | <haxscramper> So I'm waiting on `nkError` RFC from @Araq |
16:02:16 | FromDiscord | <mratsim> My point is that a single architect is good for errors |
16:04:17 | FromDiscord | <haxscramper> The biggest problem is (in general) beating more information out of compiler and making it think more when something is not working. Type mismatch errors are the most notable ones though |
16:04:38 | FromDiscord | <Avatarfighter> o7 nice to see you all |
16:05:13 | FromDiscord | <Zachary Carter> o/ |
16:11:37 | * | waleee-cl joined #nim |
16:17:36 | FromDiscord | <Clyybber> o/ |
16:19:35 | FromDiscord | <haxscramper> But if I understand correctly it won't be a priority really until IC is done, and there are still more important things to implement |
16:32:06 | FromDiscord | <Clyybber> @mratsim Do you have an example of a proc not working in a generic thats similar to https://github.com/nim-lang/Nim/issues/7632 ? |
16:36:02 | * | mmohammadi9812 quit (Remote host closed the connection) |
16:36:25 | * | mmohammadi9812 joined #nim |
16:36:33 | * | irchaxwell_zzz joined #nim |
16:37:30 | * | a_chou joined #nim |
16:37:58 | FromDiscord | <Clyybber> ah, managed to repro by reverting the changes |
16:41:01 | * | irchaxwell_ quit (Ping timeout: 272 seconds) |
16:51:21 | FromDiscord | <Clyybber> Araq: To fix generic symbol resolution: WDYT about attaching the declaration scope to the generic? Then when a generic is instantiated we mix can lookup symbols from both the declaration scope and the instatitation scope. |
16:55:06 | * | a_chou quit (Remote host closed the connection) |
16:55:23 | * | a_chou joined #nim |
16:55:30 | FromDiscord | <konsumlamm> if a parameter `d` is of type `T` (where `T: float32 | float64`), doing `T(d)` should have no effect, right? |
16:57:03 | planetis[m] | it might output a warning but afaik not for generics |
16:57:39 | FromGitter | <Araq> haxscramper: no need to wait, we already use `nkEmpty` for this purpose |
16:58:09 | * | mmohammadi9812 quit (Ping timeout: 264 seconds) |
16:59:58 | FromDiscord | <konsumlamm> specifically, this line: https://github.com/nim-lang/Nim/blob/1d1c831efa7f9bfcc739b2d38a3a839187bc39c6/lib/pure/math.nim#L1085 |
17:01:05 | FromDiscord | <haxscramper> @Araq from what you said earlier I though `nkError` could be a new way of handing errors |
17:01:59 | FromGitter | <Araq> sorry, you need nkError indeed |
17:02:00 | planetis[m] | lol good catch, it should have been T(RadPerDeg) instead |
17:02:23 | planetis[m] | imo |
17:02:25 | FromGitter | <Araq> but it's a one line addition plus some plumbing code |
17:02:36 | FromGitter | <Araq> I can guide you if you want |
17:06:07 | FromDiscord | <konsumlamm> planetis: sounds right |
17:06:52 | * | irchaxwell_ joined #nim |
17:07:22 | FromGitter | <haxscramper> First I need to finally study compiler implementation instead of just poking at random places. But if you could share your ideas on how `nkError` should be working (in cases of type mismatch, user-defined errors in macros (or however else it might be called)) I could probably take it from there. β β I've discussed this with saem in `#internals` yesterday, and for now my general understanding is β β > So |
17:07:22 | FromGitter | ... for example if I have type mismatch, instead of reporting it almost immediately with liMessage it would create nkError with necessary information, like symbols that were considered for overload resolution [https://gitter.im/nim-lang/Nim?at=601986ca0eed905f18897eb0] |
17:07:44 | FromDiscord | <Clyybber> @Araq To fix generic symbol resolution: WDYT about attaching the declaration scope to the generic? Then when a generic is instantiated we mix can lookup symbols from both the declaration scope and the instatitation scope. |
17:08:28 | FromGitter | <Araq> Clyybber: that was @zah's solution too but we don't have "scope as first class entity" in Nim |
17:08:37 | FromGitter | <haxscramper> I could probably figure out plumbing code myself, but I'm more concerned with staying in sync with your current vision how to build error handling on top of `nkError` |
17:08:38 | * | mmohammadi9812 joined #nim |
17:08:52 | FromGitter | <Araq> only now after my IC refactorings we can define what "scope" should be |
17:09:04 | FromDiscord | <Clyybber> Araq: Cool |
17:09:13 | FromGitter | <Araq> only now I can estimate the costs |
17:09:16 | * | irchaxwell joined #nim |
17:09:57 | FromGitter | <Araq> @haxscramper dinner here, will tell you afterwards |
17:10:14 | FromGitter | <Araq> but yes, patching liMessage is the general idea |
17:11:25 | * | irchaxwell_zzz quit (Ping timeout: 272 seconds) |
17:11:47 | * | irchaxwell_zzz joined #nim |
17:12:03 | * | irchaxwell_ quit (Ping timeout: 272 seconds) |
17:13:23 | * | irchaxwell_ joined #nim |
17:14:35 | * | irchaxwell quit (Ping timeout: 272 seconds) |
17:17:07 | * | irchaxwell_zzz quit (Ping timeout: 272 seconds) |
17:23:27 | ForumUpdaterBot | New question by Juergen: Nim: work with read-only memory mapped files, see https://stackoverflow.com/questions/66014574/nim-work-with-read-only-memory-mapped-files |
17:54:04 | Oddmonger | i have a function which search and return an object, but i's like to return null object when nothing is found |
17:54:12 | Oddmonger | should i use a ref ? |
17:54:41 | FromDiscord | <Recruit_main707> afaik it doesnt really matter |
17:55:13 | FromDiscord | <Recruit_main707> its as unsafe as a pointer if you use nil |
17:56:58 | Oddmonger | what i mean is i cannot Β« return nil Β» as :Object is expected |
17:57:18 | FromDiscord | <InventorMatt> this sounds like something you could use the options module for |
17:57:57 | FromDiscord | <zetashift> Options or make a Variant? |
17:58:44 | FromDiscord | <Recruit_main707> doesnt Option use refs under the hood |
17:58:59 | leorize | no, Option is a variant object |
17:59:04 | Oddmonger | or may be :ref Object , with nil that could be returned ? |
17:59:20 | leorize | use Option unless you want it to be on the heap |
17:59:49 | Oddmonger | i try with nim playground |
18:02:51 | FromDiscord | <mratsim> Option has an optimization for ref object which avoids having an extra field |
18:02:56 | FromDiscord | <mratsim> but it doesn't use refs |
18:10:43 | Oddmonger | well i was thinking of something like this: |
18:10:45 | Oddmonger | https://play.nim-lang.org/#ix=2O7Z |
18:12:29 | * | tiorock joined #nim |
18:12:29 | * | rockcavera is now known as Guest36965 |
18:12:30 | * | Guest36965 quit (Killed (card.freenode.net (Nickname regained by services))) |
18:12:30 | * | tiorock is now known as rockcavera |
18:12:36 | FromDiscord | <dom96> hello all |
18:12:42 | FromDiscord | <zetashift> Hiya dom |
18:14:33 | * | rockcavera quit (Read error: Connection reset by peer) |
18:15:00 | FromDiscord | <mratsim> you need either `new result; result[] = foo` or `result = (ref Foo)(); result[] = foo` @Oddmonger |
18:15:04 | * | rockcavera joined #nim |
18:15:27 | FromDiscord | <mratsim> but using Ref shouldn't be about allowing Nils |
18:15:32 | FromDiscord | <mratsim> use options for that |
18:15:49 | FromGitter | <timotheecour> @Araq β β > Clyybber: that was @zah's solution too but we don't have "scope as first class entity" in Nim β β we do, with https://github.com/nim-lang/Nim/pull/11754 [https://gitter.im/nim-lang/Nim?at=601996d5063b6c68d5348924] |
18:15:53 | FromDiscord | <mratsim> ref is about modeling unique values that are not copied |
18:16:17 | FromDiscord | <mratsim> non-fungible to be precise |
18:16:23 | Oddmonger | ok i look options then, thank you |
18:16:32 | FromDiscord | <mratsim> like you can't replace a person by another, even if they have the same number of arms and legs |
18:16:42 | FromDiscord | <mratsim> but you can replace a dollar by another |
18:16:59 | FromDiscord | <mratsim> and in programming you can't replace a session by another |
18:17:06 | Oddmonger | because they have no legs ? |
18:17:12 | * | Oddmonger is not sure to understand |
18:17:14 | FromDiscord | <mratsim> or a database handle by another. |
18:17:21 | FromDiscord | <mratsim> because they are unique |
18:17:31 | Oddmonger | ah ok with the handle i understand |
18:18:28 | FromDiscord | <dom96> So today I learned that my game can be played on a watch. How crazy is that? https://media.discordapp.net/attachments/371759389889003532/806227037647142947/image0.jpg |
18:18:54 | FromDiscord | <lqdev> welcome to 2021 |
18:20:18 | Oddmonger | i wish i had such a watch when i was a kid β¦ or maybe not, i would have waste my time in playing :) |
18:21:44 | Oddmonger | haha i like the sample for options module in the doc, with the needle lost in a haystack |
18:22:15 | FromDiscord | <Recruit_main707> cyberpunk music starts playing |
18:22:18 | FromDiscord | <IndianGoldSmith> Hi, How to return a named tuple from a proc ? |
18:24:12 | FromGitter | <Araq> @timotheecour yeah well. IMO it was a good decision to see how the lazy scope module imports work out before we reify scopes further |
18:25:43 | FromGitter | <Araq> you can blame me for being too cautious, I don't mind |
18:27:16 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
18:27:50 | * | mmohammadi9812 joined #nim |
18:31:05 | * | haxscram` joined #nim |
18:31:08 | FromGitter | <timotheecour> FWIW Iβve implemented in a private branch a lazy import scheme where symbols are just populated in a symbol table but not semchecked until used, which allows cyclic imports and faster compilation, it was working at the time but that branch would need to be revived. |
18:31:36 | * | haxscram` quit (Remote host closed the connection) |
18:32:00 | * | haxscram` joined #nim |
18:32:20 | FromGitter | <Araq> cyclic imports are still hell for me regarding IC |
18:32:24 | * | haxscram` left #nim (#nim) |
18:32:36 | FromGitter | <Araq> I think I figured it out but we'll see about that |
18:33:05 | FromGitter | <Araq> lazy sem'checking is not correct, it's crucial that you sem'check the proc *header* independently from the proc body |
18:33:39 | FromDiscord | <mratsim> @dom96 there is a Facebook team just for you: https://facebookresearch.github.io/CompilerGym/getting_started.html |
18:33:57 | FromGitter | <Araq> once you do that, the design is quite decent but needs to nail down cases like |
18:33:59 | FromGitter | <timotheecour> but if the symbol isnβt used, there is no inconsistency in not semchecking proc header |
18:33:59 | FromDiscord | <mratsim> optimizing compiler "Gym" to train optimizations π |
18:34:13 | FromGitter | <Araq> proc p(a: typeof(q)); proc q(b: typeof(p)) |
18:34:59 | FromGitter | <Araq> and that's an easy case. |
18:35:13 | FromGitter | <timotheecour> but if no code uses `p`, which does it matter? |
18:35:27 | FromDiscord | <Recruit_main707> @IndianGoldSmith like this: `proc divmod(a, b: int): tuple[res, remainder: int] =` |
18:35:28 | FromGitter | <Araq> you also need to specify how polyfills can work: β β ```when not declared(foo): proc foo ...``` [https://gitter.im/nim-lang/Nim?at=60199b70a0246860dc28b3c2] |
18:36:29 | FromGitter | <Araq> > but if no code uses `p`, which does it matter? β well it's an illegal recursion either way, no matter if used or not |
18:37:06 | FromGitter | <haxscramper> @Araq I'm ready to hear your ideas on `nkError` when you have time |
18:37:07 | FromGitter | <timotheecour> `declared(foo)` doesntβ require semchecking `foo`, it only requires knowing that `foo` is in scope |
18:37:18 | FromDiscord | <dom96> @mratsim epic, don't think I have the AI chops for it though |
18:37:49 | FromDiscord | <mratsim> meh, RL can be learned |
18:37:57 | FromDiscord | <mratsim> I don't think it's harder than learning how to program |
18:38:02 | FromDiscord | <mratsim> it all begin with a CartPole |
18:38:05 | * | rockcavera quit (Ping timeout: 265 seconds) |
18:38:17 | FromDiscord | <mratsim> https://gym.openai.com/ |
18:38:19 | FromGitter | <Araq> @haxscramper I'm preparing a PR instead |
18:38:23 | FromGitter | <timotheecour> > illegal recursion either way, β β Iβm not checking against illegal recursion, such errors would be caught on 1st use; thatβs crucial to make the lazy scheme indeed lazy, efficient, and cyclic |
18:39:02 | FromDiscord | <Clyybber> @timotheecour I think it's best if that happened behind the scenes |
18:39:45 | FromDiscord | <Clyybber> So that every generic has an attached scope of its declaration context |
18:40:03 | FromDiscord | <IndianGoldSmith> @Recruit_main707 Thank you for the reply |
18:40:22 | * | a_chou quit (Ping timeout: 256 seconds) |
18:40:40 | stefantalpalaru | I'm trying to cross-compile from Linux to Windows, and I need different path separators at compile time and at runtime. Did anyone solve this problem? |
18:40:53 | FromGitter | <Araq> well I'm only bringing up examples that an RFC should address. There are phase ordering problems. These plague D's implementation or have plagued it. We should be as clear as possible how it works. I do mind hiding everything as "implementation details" |
18:43:05 | FromGitter | <Araq> stefantalpalaru: x.replace("\\", "/") |
18:44:51 | FromDiscord | <Recruit_main707> \ also works in windows, what happens if you use a raw string (`r""`) |
18:48:56 | * | rockcavera joined #nim |
18:52:38 | * | a_chou joined #nim |
18:53:42 | * | rockcavera quit (Ping timeout: 258 seconds) |
18:59:50 | FromDiscord | <Bimbo> @mratsim (sorry for the ping) Thanks for the tips and resources, i managed to get it working but i had to modify the assertions in the `toString` proc i got from nim-http-utils as it couldn't parse the whole string otherwise. This is probably an error on my part but i'm not sure yet.β΅β΅Code: https://play.nim-lang.org/#ix=2O8i |
19:00:06 | FromDiscord | <Bimbo> (edit) "string" => "byte seq" |
19:00:39 | FromDiscord | <mratsim> the assertions seem correct |
19:00:47 | FromDiscord | <mratsim> maybe mine were wrong I don't see the difference |
19:00:51 | FromDiscord | <dom96> @mratsim did you have any notes on cancellation from your research into CPS/async? |
19:00:58 | FromDiscord | <dom96> (edit) "did" => "do" |
19:01:20 | FromDiscord | <mratsim> like Rust, don't run a continuation and your code is cancelled |
19:01:28 | FromDiscord | <dom96> The context is https://github.com/nim-lang/Nim/pull/16769 |
19:01:41 | FromDiscord | <dom96> I want to learn more so I'm not reviewing this blindly |
19:01:57 | FromDiscord | <mratsim> if there are resources to free, like Go it's cooperative, you need a channel after sync point that the routine will check to know if it should give up |
19:02:30 | FromDiscord | <mratsim> best resource on Async cancllation i found is here: https://github.com/weavers-guild/weave-io/blob/master/research/async_await_cancellation_rust_matthias247.md |
19:02:50 | FromDiscord | <mratsim> https://gist.github.com/Matthias247/ffc0f189742abf6aa41a226fe07398a8 |
19:02:56 | FromDiscord | <dom96> nice, thanks |
19:03:15 | FromDiscord | <mratsim> Note that it's for Rust readiness model so current async doesnt have the same challenges |
19:03:54 | FromDiscord | <mratsim> but basically, anything beyond cooperative cancellation will create difficulties |
19:04:21 | FromDiscord | <mratsim> and I think the best way forward is having nice syntax sugar to create an async proc with a channel to communicate a cancellation token if needed |
19:04:22 | FromDiscord | <dom96> would love your thoughts on that PR as well if you have the time |
19:07:13 | FromDiscord | <mratsim> My main question is: suppose I have a handle to some special resource (database, socker, GPU memory, file). I cancel a future read. |
19:07:23 | FromDiscord | <mratsim> What happens with this PR? |
19:07:30 | FromDiscord | <mratsim> (edit) "socker," => "socket," |
19:08:13 | * | hmmm quit (Quit: WeeChat 2.8) |
19:10:28 | FromDiscord | <inv> question: As soon as I move my optimization template template t{first asc x} - it stops to work. Why? |
19:10:45 | FromDiscord | <inv> (edit) "question: As soon as I move my optimization template template t{first asc x} ... -" added "into module" |
19:11:43 | FromDiscord | <dom96> @mratsim good question, I'm not 100% sure but I think it depends on what platform you're on. On Windows the read operation won't get cancelled, on everything else it will but some of it may have already partially completed. |
19:12:00 | FromGitter | <Araq> @haxscramper https://github.com/nim-lang/Nim/pull/16915/files |
19:13:51 | FromDiscord | <mratsim> It's mostly what do we do with the resource that the future was managing, if they had a finalizer, we're good, but in many cases the application might have some kind of ceremony even just logging "shutting down". And we need some way to tell the API to do that ceremony |
19:13:55 | FromDiscord | <dom96> To be fair, this PR seems to be more about just making sure if you have a chain of futures, and they're all waiting on a future that is next in the chain, that if the last in the chain is cancelled that the whole chain gets cancelled |
19:13:59 | FromDiscord | <mratsim> it can be a channel or a cancellation callback |
19:14:07 | FromDiscord | <mratsim> I see |
19:14:38 | FromDiscord | <mratsim> then that's OK, but cancellation in general is 80% design, 20% tech |
19:15:09 | FromDiscord | <mratsim> note: I didn't implement cancellation, neither in Weave, nor in an async framework so I might be wrong. |
19:15:19 | FromDiscord | <mratsim> but that's what I'm concluding from my research |
19:19:55 | FromGitter | <Araq> @haxscramper and then you need to replace `liMessage` etc calls with `errorhandling.newError` |
19:21:10 | FromGitter | <Araq> my sempass2.nim addition will pick up the errors |
19:21:26 | FromDiscord | <Goel> So Nim uses 'Nil' for my understanding, but is that the same as 'Null' in C and C++? |
19:21:45 | FromDiscord | <lqdev> yes. |
19:22:47 | FromGitter | <haxscramper> @Araq got it. Now more specific use-case: for example I have failed type mismatch for a node: when `semOverloadedCall` fails (after all re-tries) it is now calling `notFoundError` which collects all necessary signatures and then passes everything to `localError()`. With new style I instead should replace the failed call with `nkError()` - how exactly all type mismatches would be reported in the end then? E.g. I just |
19:22:47 | FromGitter | ... don't exactly follow where do I need to store all information about particular error that happened |
19:23:05 | FromDiscord | <Goel> Why a different name though? If they are the same thing, i don't understand |
19:23:47 | leorize | nim has a writh's language heritage, and the name `nil` is used in those |
19:23:52 | leorize | that would be my guess |
19:23:54 | FromGitter | <haxscramper> Because for better diagnostics I think I need to have access to all scopes/identifiers, original node with error etc. |
19:26:54 | FromDiscord | <mratsim> With nil we can say that Nim has no null pointers :p |
19:28:41 | FromDiscord | <haxscramper> gitter -> discord messages are not fully transferred (works in IRC though) |
19:29:57 | * | icebattle quit (Ping timeout: 264 seconds) |
19:33:11 | * | irchaxwell_zzz joined #nim |
19:37:02 | * | opal quit (Remote host closed the connection) |
19:37:05 | * | irchaxwell_ quit (Ping timeout: 272 seconds) |
19:37:41 | * | opal joined #nim |
19:37:56 | * | tane joined #nim |
19:45:45 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
19:48:35 | FromGitter | <haxscramper> The same goes for all other errors - things like effect annotation tracking, field assigns etc. - IIUC they have different contexts that are important to provide good messages. |
19:51:26 | * | mmohammadi9812 joined #nim |
19:52:27 | saem | Hax: one option for storing the info is in the error node, or hanging off of it, but I'm not sure that's a great way to do it with packed AST. I'd personally try the change and see how painful it is and what the results imply. It presently makes sense as a ill formed AST is still useful if that's what the state of a module is presently, for intermediate states that nimsuggest and friends encounter. |
19:54:18 | FromGitter | <haxscramper> My original idea was to patch `liMessage` with separate 'error object' that has all necessary references, but does not modify AST itself |
19:55:13 | FromGitter | <haxscramper> With `nkError` I can just store new `ErrorDescription` in AST (variant object for different error kinds/contexts) |
19:56:25 | * | hmmm joined #nim |
19:56:30 | FromGitter | <haxscramper> But basically the goal is to have zero context/information loss between `semOverloadedCall` and `errorToString` |
19:56:40 | saem | The latter sounds better but I'm out on a limb. As the AST is what "everything" works on. |
19:57:19 | FromGitter | <haxscramper> And then in `errorToString` I can just plug in all my diagnostic smartness |
19:58:15 | saem | Tying it to the pass context or anything like that seems off because where it occurs and when you report are plenty far apart. |
19:58:30 | * | icebattle joined #nim |
19:59:19 | FromGitter | <haxscramper> As I understand now there are only two options - deal with error immediately (and maybe ignore almost all context as it is done now) |
19:59:27 | FromGitter | <haxscramper> Or deal it somewhere else while passing context |
20:00:00 | * | icebattle quit (Client Quit) |
20:00:44 | saem | My instinct and I can't think of anything to the contrary not recall conversations suggesting otherwise is: nkError AST node, old busted AST under it and error information too. |
20:03:45 | * | wgetch joined #nim |
20:04:10 | FromGitter | <haxscramper> This is close enough to what I'm suggesting, isn't it? "and error information too." is basically `ErrorDescription`. Maybe it wasn't clear, but I wanted to do something like `of nkError: description: ErrorDescription` - additional branch in `TNode` |
20:04:26 | FromGitter | <haxscramper> And old node can be added too of course |
20:09:29 | saem | That works, I don't remember if there is much consequence to adding another variant vs say a flag. But another option would be error node has first son as the old tree and the rest of the sons as details nodes, marked with a flag. That could ask be silly and a later refactor. |
20:09:47 | saem | s/ask/all |
20:10:28 | saem | I don't have a great intuition about performance (mostly memory) in this case. |
20:11:26 | saem | Your approach sounds good and this could be sorted in a PR. |
20:12:51 | FromGitter | <haxscramper> I have absolutely no idea how to shove all information that I need into "detail nodes" - for example type mismatch: I can put all candidates into sons, no problem. But how do I know type mismatch actually happened? Or what scope it was in - I want to show MCS-related errors |
20:13:44 | FromGitter | <haxscramper> Or mutability annotations - if I have high level of confidence that type mismatch is caused by var annotation |
20:15:09 | FromDiscord | <inv> Can I ask about type inference for lambdas or it is immediate ban here? π |
20:16:06 | FromDiscord | <inv> I heard about some kind of new type-system in the future, but not so sure about it |
20:17:00 | saem | Hax variant seems much better |
20:17:44 | FromGitter | <haxscramper> Thoug at the second though it might work as a starting solution |
20:19:19 | FromGitter | <haxscramper> Since I will be basically running my own semcheck again to score all candidates |
20:19:46 | FromDiscord | <haxscramper> IIRC There is a limited type inference for lambdas in form of `any` |
20:20:08 | FromDiscord | <haxscramper> No, there are not plans to change type system AFAIK now or ever |
20:20:25 | FromGitter | <krux02> haxscramper: what exactly do you want to do? |
20:20:32 | FromGitter | <krux02> own semantic checking? |
20:21:08 | FromDiscord | <inv> Do you mean typeinfo? Could you please explain how it goes into lambdas? I would like to avoid some typed in lambdas |
20:21:25 | FromGitter | <haxscramper> https://github.com/nim-lang/RFCs/issues/325 - Scored type mismatch listing |
20:21:34 | FromGitter | <haxscramper> @krux02 ^ |
20:21:45 | saem | Scoring candidates is already done isn't it? I might be remembering bits of scoring from suggest vs overload resolution |
20:22:36 | saem | Oh, maybe it's a matter of leveraging that info/analysis again or faulty memory on my part |
20:22:47 | FromGitter | <haxscramper> I don't think it is done now |
20:23:01 | FromGitter | <haxscramper> Maybe it is, but so badly it is barely noticeable |
20:24:11 | FromGitter | <haxscramper> And yes, it is about re-using mismatch information for better error messages (like "first argument is mutable, make your variable declared <here> a `var` (currently declared as `let`)" |
20:27:37 | * | hmmm quit (Quit: WeeChat 3.0) |
20:30:31 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2O8Z |
20:31:00 | FromDiscord | <haxscramper> I also realized `nkError` could be used to make `expandMacros` work even with failed semcheck |
20:31:11 | FromDiscord | <inv> But the issue is open - do you mean I can expect it will change in the future? |
20:31:26 | FromDiscord | <haxscramper> Which is an absolute game changer for usability of it |
20:31:37 | FromDiscord | <haxscramper> What issue? |
20:31:53 | FromDiscord | <inv> RFCs/issues/325 |
20:31:55 | FromDiscord | <konsumlamm> it uses `auto`, not `any` afaik |
20:32:37 | FromDiscord | <inv> I thought the same |
20:33:31 | FromDiscord | <haxscramper> Maybe they are interchangeable for this use case - https://nim-lang.org/docs/manual.html#types-auto-type "For parameters it currently creates implicitly generic routines:" |
20:35:08 | FromDiscord | <haxscramper> It is not really related to type system/`auto`/`any` |
20:35:38 | * | letto quit (Quit: Konversation terminated!) |
20:35:56 | FromDiscord | <inv> auto works perfect, but lambdas want types for params also |
20:36:12 | FromDiscord | <mratsim> Is there even a use-case for Any? |
20:36:31 | FromDiscord | <mratsim> it requires RTTI so is incompatible with --gc:arc no? |
20:37:39 | * | letto joined #nim |
20:39:38 | FromDiscord | <inv> Cannot make it work with any, or auto or generic: https://play.nim-lang.org/#ix=2O90 |
20:40:18 | FromDiscord | <inv> And I did not expect it work, but a bit unclear will RFC 325 change it somehow or not |
20:41:02 | FromDiscord | <haxscramper> No it won't |
20:41:54 | * | NimBot joined #nim |
20:42:29 | FromDiscord | <haxscramper> It is strictly concerned with improving representation of type mismatch errors under current implementation of the type system. |
20:48:49 | * | Prestige quit (Quit: Prestige) |
20:49:15 | * | Prestige joined #nim |
20:54:59 | FromDiscord | <haxscramper> I just imagined how cool it would be to just use `expandMacros` on something like https://play.nim-lang.org/#ix=2O95 and immediately see which generated node produces error |
20:57:04 | FromDiscord | <Clyybber> saem, @haxscramper scoring is done for nimsuggest only |
20:57:35 | FromDiscord | <Clyybber> But it should be relatively easy to do it in call mismatch messages too |
20:57:48 | FromDiscord | <Clyybber> We already sort these for easier testing |
20:57:48 | FromGitter | <timotheecour> @mratsim β β > *<FromDiscord>* <mratsim> Is there even a use-case for Any? β β see https://github.com/nim-lang/RFCs/issues/281, looks like itβs uninamously going the way of the dodo [https://gitter.im/nim-lang/Nim?at=6019bccb32e01b4f716e53f5] |
20:59:12 | FromDiscord | <mratsim> voted as well |
21:10:09 | FromGitter | <Araq> @haxscramper I'll patch 'notFound' so that you can see how it works |
21:12:09 | * | liblq-dev quit (Ping timeout: 246 seconds) |
21:18:30 | * | i_use_arch_btw[m joined #nim |
21:18:43 | FromDiscord | <brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=2O9g |
21:19:15 | FromGitter | <Araq> in general you use the nkError's children to encode whatever you need to encode much like PNode would be a JsonNode |
21:22:35 | FromDiscord | <Recruit_main707> @brainproxy use parenthesis? |
21:23:11 | FromDiscord | <Recruit_main707> Unless you want they actual proc |
21:25:53 | FromDiscord | <brainproxy> yes, actual proc |
21:26:08 | FromDiscord | <brainproxy> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2O9l |
21:26:21 | * | hmmm joined #nim |
21:30:11 | FromDiscord | <zidsal> I'm writing a unit test that asserts an exception is thrown. Is ther a way for my to capture the exception using the expect macro so I can check the msg e.t.c is what I expect |
21:35:12 | * | rockcavera joined #nim |
21:35:45 | leorize | Araq: can I make a converter so that only non-mutating functions can operate on the type? |
21:35:57 | leorize | ie. I'm making a special string type that doesn't contain certain characters |
21:37:14 | leorize | it should be compatible with read-only string operations |
21:38:20 | FromDiscord | <konsumlamm> i'd be happy if someone could take a look at my PR: https://github.com/nim-lang/Nim/pull/16820 |
21:47:44 | FromDiscord | <mratsim> Need dialisis |
21:48:03 | FromDiscord | <mratsim> (edit) "dialisis" => "dialysis" |
21:48:43 | FromDiscord | <konsumlamm> ? |
21:51:05 | FromDiscord | <mratsim> sugar -> dialysis |
21:51:13 | * | tane quit (Quit: Leaving) |
21:52:59 | FromDiscord | <konsumlamm> is that just a joke? |
21:55:29 | * | a_chou quit (Quit: a_chou) |
21:59:08 | FromDiscord | <mratsim> yes |
22:02:22 | * | evbo quit (Quit: Leaving) |
22:06:50 | FromDiscord | <konsumlamm> good |
22:06:56 | FromDiscord | <konsumlamm> feel free to review it anyway :p |
22:09:54 | FromDiscord | <rev> How to echo a value in Nim? |
22:10:04 | FromDiscord | <rev> (edit) "How to echo a value ... in" added "of something" |
22:11:01 | FromDiscord | <Avatarfighter> I highly recommend checking out the tutorial @rev <https://nim-lang.org/docs/tut1.html> |
22:11:28 | FromDiscord | <Avatarfighter> `echo` is the keyword you are looking for and the tutorial goes over it, its pretty complete and should answer a lot of questions |
22:13:04 | FromDiscord | <Avatarfighter> So if you have a variable named `variable` you can do `echo variable` or `echo $variable`. As you may have noticed I added the `$` in front of the variable, it acts as ni |
22:13:08 | FromDiscord | <Avatarfighter> (edit) "ni" => "Nim's toString" |
22:13:33 | FromDiscord | <Avatarfighter> If the object you are trying to echo doesn't have a `$` proc you will have to implement one. |
22:13:53 | FromDiscord | <Avatarfighter> (edit) "So if you have a variable named `variable` you can do `echo variable` or `echo $variable`. As you may have noticed I added the `$` in front of the variable, it acts as Nim's toString ... " added "method" |
22:26:56 | * | narimiran quit (Ping timeout: 240 seconds) |
22:46:39 | * | opal quit (Ping timeout: 268 seconds) |
22:49:05 | * | opal joined #nim |
22:50:51 | * | Vladar quit (Quit: Leaving) |
22:50:57 | * | abm quit (Quit: Leaving) |
22:51:16 | * | abm joined #nim |
22:53:37 | leorize | API review request :) https://github.com/alaviss/nim-sys/pull/5 |
22:54:24 | leorize | just hoping that this looks sane and I don't open any cans of worms :p |
22:54:29 | FromDiscord | <mratsim> Strings 2, tainted strings strike back |
22:54:52 | leorize | tainted string is dumb, all strings are tainted :) |
22:55:00 | FromDiscord | <mratsim> static set, wow, even i didn't dare. |
22:55:45 | FromDiscord | <Recruit_main707> wtf happened to :disruptek: |
22:55:57 | FromDiscord | <Avatarfighter> mood |
22:56:07 | FromDiscord | <Recruit_main707> The emotes too? |
22:56:15 | FromDiscord | <Avatarfighter> yeah everything I think |
22:56:23 | FromDiscord | <Avatarfighter> I'm sad about the emote though that was pure humor |
22:56:55 | FromDiscord | <Avatarfighter> but its not like the emote added anything so I can't blame the removal of it |
22:57:39 | FromDiscord | <Recruit_main707> So its a permaban |
22:57:47 | FromDiscord | <Avatarfighter> I believe so |
22:59:28 | leorize | mratsim: treading in crazy territory :) it does compile though |
23:00:36 | FromDiscord | <mratsim> and @Araq was asking me just yesterday what I was using static enums for |
23:00:52 | FromDiscord | <mratsim> it might compile because I opened the path π https://github.com/nim-lang/Nim/issues/11142 |
23:01:19 | FromDiscord | <mratsim> I tried to have static BigInt |
23:03:15 | leorize | all thanks to you for testing all the weird stuff |
23:21:03 | * | abm quit (Quit: Leaving) |
23:40:58 | FromDiscord | <konsumlamm> with testament, when no targets are specified, does it test all targets? or only c? |
23:42:26 | FromGitter | <timotheecour> c |
23:42:46 | FromGitter | <timotheecour> or cpp depending on NIM_COMPILE_TO_CPP |
23:42:56 | FromDiscord | <konsumlamm> there you are xd |
23:43:39 | FromGitter | <timotheecour> (refs https://github.com/nim-lang/Nim/pull/16820#issuecomment-772087369) |
23:43:46 | * | zedeus quit (Quit: zedeus) |
23:44:10 | FromDiscord | <konsumlamm> the testament docs (i could find) at https://nim-lang.github.io/Nim/testament.html say "Run tests for specified targets (default: all)", so i assumed that by default all targets are run |
23:44:56 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
23:45:45 | FromGitter | <timotheecour> PR welcome to make docs reflect reality |
23:46:36 | FromDiscord | <konsumlamm> regarding the inject bug: what exactly did you try? |
23:47:45 | FromDiscord | <konsumlamm> when i put the `dump` tests (with `inject`) in the big `main` template, just like the other tests, it gives me a bunch of "undeclared variable" errors |
23:47:55 | * | mmohammadi9812 joined #nim |
23:48:23 | FromDiscord | <konsumlamm> for every time another variable with the same name is used |
23:48:46 | * | hmmm quit (Quit: WeeChat 3.0) |
23:49:15 | * | rockcavera quit (Remote host closed the connection) |
23:52:11 | * | krux02 quit (Quit: Leaving) |
23:54:30 | FromGitter | <timotheecour> see https://github.com/nim-lang/Nim/pull/16919 |
23:54:31 | FromDiscord | <konsumlamm> @timotheecour |
23:54:44 | FromDiscord | <konsumlamm> lol, i pinged you the exact moment you responded |
23:54:57 | FromGitter | <timotheecour> :) |
23:55:15 | FromGitter | <timotheecour> we can merge your PR as is then continue with https://github.com/nim-lang/Nim/pull/16919 |
23:55:52 | FromDiscord | <konsumlamm> so, what about the inject stuff? |
23:56:25 | FromGitter | <timotheecour> what does it give with https://github.com/nim-lang/Nim/pull/16919 ? it works for me |
23:56:57 | * | mbomba quit (Quit: WeeChat 3.0) |
23:57:14 | FromDiscord | <konsumlamm> lemme see |