00:06:18 | * | leorize quit (Quit: WeeChat 2.8) |
00:30:57 | FromDiscord | <Varriount> disruptek: Cream of bacon sounds... suspicious. |
00:31:58 | FromDiscord | <Varriount> I guess you might make such a thing by mixing cream and bacon, and cooking them together? |
00:34:31 | FromDiscord | <Rosen> found a recipe for cream of bacon soup and it actually looks great |
00:34:32 | FromDiscord | <Rosen> at least to me |
00:34:40 | disruptek | i'll let you know how it comes out in a few minutes. |
00:37:16 | * | arecacea1 quit (Remote host closed the connection) |
00:38:02 | * | arecacea1 joined #nim |
00:54:18 | disruptek | better than expected and worse than i'd hoped. |
01:09:32 | * | FromGitter quit (Ping timeout: 260 seconds) |
01:10:07 | * | oprypin quit (Ping timeout: 260 seconds) |
01:43:20 | * | apahl quit (Ping timeout: 244 seconds) |
01:45:19 | * | apahl joined #nim |
01:46:39 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
01:50:08 | * | FromGitter joined #nim |
01:53:03 | * | endragor joined #nim |
02:09:42 | FromGitter | <gogolxdong> Is Nim memory safe for now? |
02:10:41 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
02:12:17 | FromDiscord | <Varriount> It always has been? |
02:12:39 | FromDiscord | <Varriount> Or rather, it depends on what you call "memory safe" |
02:15:41 | FromDiscord | <Elegant Beef> If you turn off the GC it's up to you to make it memory safe 😛 |
02:17:08 | FromDiscord | <Elegant Beef> But that's if we're just talking about leaking of course |
02:24:59 | * | muffindrake quit (Ping timeout: 246 seconds) |
02:27:19 | * | muffindrake joined #nim |
02:28:33 | FromDiscord | <Varriount> @Elegant Beef Or you can use this garbage collection scheme: https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98125 |
02:29:58 | * | sagax quit (Remote host closed the connection) |
02:30:13 | FromDiscord | <Elegant Beef> That's beautiful |
02:33:14 | * | awe00 quit (Ping timeout: 258 seconds) |
02:33:16 | * | pbb quit (Remote host closed the connection) |
02:33:27 | FromDiscord | <Varriount> Destroying the hardware: The ultimate garbage collection method. |
02:33:39 | FromDiscord | <Elegant Beef> And the memory cant be read, so it's safe |
02:36:30 | * | pbb joined #nim |
02:41:16 | FromDiscord | <Rosen> one of the only programs that *creates* garbage when it halts perhaps? |
02:42:51 | FromDiscord | <Elegant Beef> Those missles probably kill civilians and you're saying they're garbage... tsk tsk 😛 |
02:45:37 | * | vicfred joined #nim |
03:02:12 | * | thomasross quit (Ping timeout: 256 seconds) |
03:08:46 | * | sagax joined #nim |
03:22:32 | * | endragor quit (Remote host closed the connection) |
03:22:49 | * | endragor joined #nim |
03:23:35 | * | endragor quit (Remote host closed the connection) |
03:24:01 | * | endragor joined #nim |
03:29:01 | * | endragor quit (Ping timeout: 264 seconds) |
03:32:48 | * | endragor joined #nim |
03:47:26 | * | pbb quit (Remote host closed the connection) |
03:50:49 | * | pbb joined #nim |
03:57:23 | * | rockcavera quit (Remote host closed the connection) |
04:02:01 | * | tsujp quit (Ping timeout: 246 seconds) |
04:04:40 | * | tsujp joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:37 | * | supakeen joined #nim |
04:38:13 | * | arecacea1 quit (Remote host closed the connection) |
04:38:32 | * | arecacea1 joined #nim |
04:43:20 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
04:43:27 | * | njoseph joined #nim |
04:58:07 | * | hyiltiz quit (Ping timeout: 244 seconds) |
05:01:51 | * | hyiltiz joined #nim |
05:01:51 | * | hyiltiz quit (Changing host) |
05:01:51 | * | hyiltiz joined #nim |
05:13:32 | * | njoseph quit (Quit: No Ping reply in 180 seconds.) |
05:14:37 | * | njoseph joined #nim |
05:35:32 | * | solitudesf joined #nim |
05:36:06 | * | narimiran joined #nim |
05:41:12 | silvernode[m] | Good morning. I have been on vacation for a week already and haven't really hung out with everyone here. Why is it, that when I finally get a vacation to actually catch up on hobbies and learning stuff, I procrastinate nearly the entire vacation? |
05:41:28 | silvernode[m] | ha |
05:41:43 | silvernode[m] | I suspect I am not alone in that. |
05:42:47 | narimiran | silvernode[m]: because your vacation is too short |
05:43:38 | silvernode[m] | <narimiran "silvernode: because your vacatio"> I I think you are correct. I usually get the drive and motivation to do stuff at the end of it. |
05:47:42 | * | arecacea1 quit (Remote host closed the connection) |
05:48:26 | * | arecacea1 joined #nim |
05:54:23 | * | maier joined #nim |
05:54:29 | * | maier is now known as kenran |
05:54:40 | * | arecacea1 quit (Remote host closed the connection) |
05:55:01 | * | arecacea1 joined #nim |
06:00:37 | * | bung quit (Ping timeout: 258 seconds) |
06:06:29 | * | NimBot joined #nim |
06:12:35 | * | oprypin joined #nim |
06:29:52 | * | bung joined #nim |
06:34:25 | * | bung quit (Ping timeout: 264 seconds) |
06:48:37 | * | PMunch joined #nim |
06:55:17 | Zevv | i had the same. big plans but a total mental cresh, just porridge for brains in the first week |
06:55:22 | Zevv | eb |
06:55:28 | Zevv | embrace that |
07:13:59 | * | Vladar joined #nim |
07:14:41 | PMunch | silvernode[m], sounds like all of my vacations ever <_< |
07:15:25 | silvernode[m] | yeah I think we all just want to rest. |
07:17:19 | PMunch | I wonder how productive I would be if I had all the wealth I would need |
07:17:43 | PMunch | I.e. if the incentive to work for money was completely gone |
07:18:17 | * | bung joined #nim |
07:32:41 | silvernode[m] | <PMunch "I wonder how productive I would "> I have thought deep about this on many occasions and I think after awhile, most of us would absolutely need to be productive. Hungry to get something done and kill the boredem. |
07:33:05 | PMunch | Exactly |
07:33:28 | PMunch | But I wouldn't feel the pressure to get up super early in the morning and sit around being an unproductive zombie :P |
07:34:12 | silvernode[m] | Once you realize that months have gone by and you are free of the shackles, and that you can really work on whatever you want and at your own pace...hobbies would go into overdrive. |
07:34:44 | silvernode[m] | unless you have a soul sucking spouse. of course. |
07:35:07 | * | krux02 joined #nim |
07:35:11 | * | fredrikhr8 joined #nim |
07:35:41 | PMunch | Well, now you have the energy to get rid of them :P |
07:36:37 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
07:38:45 | * | fredrikhr quit (Ping timeout: 258 seconds) |
07:38:45 | * | fredrikhr8 is now known as fredrikhr |
07:45:05 | FromDiscord | <Varriount> I would like to both spend time on my hobbies and be paid for it... |
07:46:25 | PMunch | We should convince some Russian oligarch or something to sponsor development of random Nim projects :P |
07:46:45 | PMunch | Just give us a couple million and we'll divide us amongst anyone who wants to write Nim |
07:48:12 | FromDiscord | <Elegant Beef> What is this a work based ponzi scheme |
07:48:53 | PMunch | Well, not really a ponzi scheme |
08:03:40 | * | Kaivo quit (Ping timeout: 258 seconds) |
08:05:58 | * | Kaivo joined #nim |
08:18:09 | * | Zectbumo quit (Remote host closed the connection) |
08:30:35 | * | zedeus quit (Ping timeout: 240 seconds) |
08:32:54 | * | zedeus joined #nim |
08:38:28 | silvernode[m] | I wan to start a network of audio/video media around Nim and dub them "NimCasts". The network can have a website, and a list of partner Nim programmers that also have audio/media episodes. |
08:39:14 | silvernode[m] | Anyone who would want to start a show can because part of the network of shows about Nim. This includes live streams too. |
08:39:42 | FromDiscord | <vieru> is there a way to unallocate a constant ? |
08:40:07 | PMunch | vieru, nope |
08:40:19 | PMunch | Constants are a compiler thing, they don't exist on runtime |
08:40:33 | PMunch | They just get subbed in wherever you use them |
08:40:35 | FromDiscord | <vieru> sent a code paste, see https://play.nim-lang.org/#ix=2vaO |
08:40:39 | FromDiscord | <vieru> yeah but they do ocupy memory |
08:40:52 | PMunch | So `const x = 100; echo x` just gets rewritten to `echo 100` |
08:41:27 | Oddmonger | yes it's not allocation, it's just pre-computation |
08:41:30 | PMunch | Yeah, that just gets rewritten to `writeFile("file2", "whatever the contents of 'file' was")` |
08:41:55 | FromDiscord | <vieru> idk man my file memory usage is 1mb without that code↵and with that code is 7mb |
08:42:12 | FromDiscord | <vieru> (edit) 'file' => 'executable' |
08:42:30 | PMunch | Probably because writeFile must allocate that string in memory |
08:42:42 | PMunch | But it will get collected by the garbage collector as soon as the file writing is done |
08:42:43 | Oddmonger | the file is included in your exe |
08:43:16 | PMunch | Is there a built-in way in Nim of echoing variables with their names? |
08:43:34 | PMunch | I want something like `dump x` to output "x: <value of x>" |
08:43:35 | krux02 | PMunch, not that I know |
08:43:45 | FromDiscord | <vieru> so you're saying i shoudnt worry about this stuff |
08:43:51 | krux02 | would be very helpful, I agree |
08:43:52 | FromDiscord | <vieru> gc will do its job ? |
08:43:57 | PMunch | vieru, exactly |
08:43:59 | Araq | PMunch, there is macros.dump |
08:44:16 | FromDiscord | <vieru> thanks |
08:44:27 | PMunch | I just get undeclared identifier even after importing macros.. |
08:44:31 | Araq | no, there is now strformat |
08:45:14 | Araq | echo fmt"{expr=}" |
08:45:15 | * | awe00 joined #nim |
08:45:24 | PMunch | Eh, that's too terse |
08:46:11 | Araq | huh? |
08:48:27 | silvernode[m] | Now that Araq is here, I should ask about official LLVM support and whether or not it is a planned endeavor. I think I saw the ability to use clang somewhere so I guess that counts. |
08:50:52 | silvernode[m] | I have been looking into LLVM lately and discovered how amazing it is, so naturally I came here to see if my favorite programming language can use it. |
08:51:47 | FromDiscord | <Clyybber> PMunch: Its sugar.dump |
08:52:12 | FromDiscord | <Clyybber> silvernode: Theres NLVM |
08:52:23 | FromDiscord | <Clyybber> which is a LLVM backend for Nim |
08:52:36 | silvernode[m] | I saw that but it's not official right? |
08:53:35 | silvernode[m] | <FromDiscord "<Clyybber> which is a LLVM backe"> have you tried it? |
08:54:46 | FromDiscord | <Clyybber> yeah |
08:55:13 | FromDiscord | <Clyybber> to both questions :) |
08:55:19 | silvernode[m] | <FromDiscord "<Clyybber> yeah"> What was you impression of it? |
08:55:25 | silvernode[m] | oh ok |
08:55:33 | silvernode[m] | if it's official then I'm in |
08:55:40 | FromDiscord | <Clyybber> It works :) |
08:55:46 | FromDiscord | <Clyybber> no, its *not* official |
08:55:55 | silvernode[m] | aw |
08:56:07 | silvernode[m] | It would be cool if it was default |
08:56:23 | FromDiscord | <Clyybber> maybe in the future |
08:56:51 | FromDiscord | <Clyybber> keep in mind you can still get llvm out of Nim without NLVM |
08:57:01 | silvernode[m] | The error messages and debugging was awesome with it when I used Rust a few times. |
08:57:19 | silvernode[m] | <FromDiscord "<Clyybber> keep in mind you can "> is that because of how diverse LLVM is? |
08:57:20 | FromDiscord | <Clyybber> thats probably unrelated to LLVM |
08:57:31 | FromDiscord | <Clyybber> its because you can compile C to LLVM |
08:58:24 | silvernode[m] | yeah I was old by someone (who probably didn' know wha they were talking about) that the error messages in rust were from LLVM. I guess that's BS |
08:59:19 | silvernode[m] | If we can get that level of detail with our error messages in Nim, it would be fantastic. |
08:59:50 | silvernode[m] | That's one of the biggest hurdles I have faced while learning Nim. |
09:00:49 | FromDiscord | <Elegant Beef> Yea i just ran into a pretty annoying problem i feel an error message would've been nice, trying to use methods without the base type imported should tell you, import the god damned base type 😄 |
09:02:14 | FromDiscord | <Elegant Beef> I spent vastly more time than i'd like to admit trying to figure out why that happen, eventually i just tried include and realize that the only difference with the include vs import is that a single type wasnt present |
09:02:48 | PMunch | Aah, thanks @Clyybber |
09:05:55 | silvernode[m] | <FromDiscord "<Elegant Beef> I spent vastly mo"> Yeah disruptek asked me back in Feb when I first started using Nim what I think is the biggest problem for adoption of Nim. I said whitespace, but after programming with Nim for the better part of a year now, I think the error messages are a actual issue. |
09:06:19 | silvernode[m] | Whitespace it not a problem |
09:06:52 | Araq | error messages are generally good these days, what in particular did you encounter? |
09:08:07 | FromDiscord | <haxscramper> Error messages are not that good when it comes to errors in template-generated code. It takes just couple of `mapIt().filterIt()` to generate several screens worth of text. Type mismatches on function types are also could be improved |
09:08:20 | silvernode[m] | I would trade anything to have detailed error messages. I otherwise we spend hours going crazy just like you did |
09:08:37 | FromDiscord | <haxscramper> I checked how error messages in compiler are passed to the user - right now everything is basically squeezed into single string and passed over to message printer. Well, except for type mismatch errors where it first collects all alternatives and then prints them. |
09:08:50 | Zevv | hexscramper: can you come up with concrete examples of bad error messages? |
09:08:52 | FromDiscord | <Elegant Beef> If that is to me I had sub types declared in seperate files and the master type in a file i didnt import in the main module where the method call was happening so the conversion from Controller -> AiController or Controller -> PlayerController needed to be explicit |
09:09:05 | silvernode[m] | <Araq "error messages are generally goo"> Usually it's "instantiation of fmt from here" messages |
09:09:32 | FromDiscord | <Elegant Beef> And ther was no indication that the base class needed to be imported for the methods to work |
09:09:40 | silvernode[m] | I think that messages in particular needs work |
09:09:58 | silvernode[m] | * I think that message in particular needs work |
09:10:37 | silvernode[m] | Araq: Overall though, the error messages are pretty good. |
09:10:42 | Araq | <Elegant Beef> I think that's a language wart moreso than a problem of error messages |
09:11:04 | Araq | I keep asking for attaching procs to types, not many are too happy about it |
09:11:08 | FromDiscord | <haxscramper> Zevv: https://play.nim-lang.org/#ix=2vb3 |
09:11:22 | FromDiscord | <haxscramper> It approaches C++ level of template-error-maddness |
09:11:32 | FromDiscord | <Elegant Beef> Well either way it was unclear the problem and how to resolve it, what do you mean attaching procs to type, like member functions? |
09:11:40 | FromDiscord | <haxscramper> Yes, not everyone writes tonts of templates like that |
09:12:05 | silvernode[m] | <FromDiscord "<haxscramper> Zevv: ">https://play"> I didn't know you could put discard there 🙂 |
09:12:12 | FromDiscord | <haxscramper> But showing /original/ source code is much better than generated-one |
09:12:33 | FromDiscord | <Elegant Beef> I was actually originally using a proc on the base type and converting to the required type inside the proc, which works equally well as methods i feel, just since methods were there though they were "more proper" for this type of inheritance OOP |
09:12:50 | FromDiscord | <Elegant Beef> thought* |
09:14:15 | Zevv | hexscramper: there is a lot of noise in there, but the first line is spot on, right? |
09:14:22 | * | Trustable joined #nim |
09:15:13 | Zevv | but you're right, having expanded code in the error messages is not helpful here |
09:15:46 | FromDiscord | <haxscramper> Yes. Like, /technically/ this is not an issue whatsoever. Just there is too much noise |
09:15:49 | Zevv | it approaches C++ level of template-error-madness |
09:16:08 | FromDiscord | <haxscramper> Actually, I looked how messages are dealt with in compiler |
09:16:26 | Zevv | they're pretty flat |
09:16:39 | FromDiscord | <haxscramper> And maybe I will try to do something with it? I'm not sure if I can pull that off, but I want to at least try |
09:17:02 | Zevv | but what is the root problem then |
09:17:49 | FromDiscord | <haxscramper> Ideally I want to have at least something like that - https://github.com/haxscramper/hmisc#hmischexceptions-documentation - pretty hacky right now, but works somewhat |
09:19:44 | Zevv | its cool for some, but not for others. I can't stand the "modern" gcc errors with soo much arrows and white space and colors |
09:20:19 | FromDiscord | <Elegant Beef> Yea just tell me why im a dullard and get on with it |
09:21:04 | FromDiscord | <Elegant Beef> Like do we really need arrows to say "You fucked up here" |
09:21:17 | FromDiscord | <haxscramper> If there is concrete type for reporting errors in code (~CodeError~) it is just a matter of representation - pretty-pring everying in the terminal, output old-style errors in cases where it is necessary, generate json ouput for automatic processing etc. |
09:22:27 | FromDiscord | <haxscramper> Right now it all happens using strings which means there is no configuration possible at all. |
09:22:37 | FromDiscord | <haxscramper> I' |
09:23:34 | FromDiscord | <haxscramper> I'm not really sure if I understood the logic of error handling in compiler, but from what I saw - various procedures just call 'handle error' proc that prints things, and optionally quits. |
09:24:31 | FromDiscord | <Clyybber> also are we talking compile error messages or runtime? |
09:24:37 | FromDiscord | <Clyybber> silvernode ^ |
09:25:43 | FromDiscord | <haxscramper> Why not raise exception for fatal compilation errors with absolutely all information necessary. This is personal preference of course, but when error happens I usually don't even think about how expensive it would be to print nice message - there is nothing else to do anyway. |
09:27:27 | FromDiscord | <Rika> i like the error arrows, otherwise i wouldnt notice that i was looking at the wrong line |
09:27:33 | FromDiscord | <Rika> or the wrong portion or the line |
09:27:44 | FromDiscord | <Rika> colors on errors are eh, they look cool but thats it |
09:28:46 | FromDiscord | <Elegant Beef> I'd rather just capture the snippet of the error and display it in one line with line number/file on the side |
09:29:00 | Zevv | we can ask disruptek to do it, sure he'll find a matching rainbow colored animated dingbat for each possible error |
09:29:16 | FromDiscord | <Elegant Beef> Well it might make his balls hurt though |
09:29:20 | FromDiscord | <Elegant Beef> Cant think with throbbing balls |
09:30:05 | * | zedeus quit (Ping timeout: 240 seconds) |
09:30:12 | FromDiscord | <haxscramper> > I'd rather just capture the snippet of the error and display it in one line with line number/file on the side |
09:30:25 | FromDiscord | <Elegant Beef> No too much noise imo |
09:31:10 | FromDiscord | <haxscramper> If I remove errors it would be better? Just leave upper part of the message + source code |
09:31:46 | FromDiscord | <Rika> that's too vertically long for me |
09:31:53 | FromDiscord | <Elegant Beef> `file.nim line# (wrong code)`↵`optional arrow`↵`Error description` |
09:32:00 | FromDiscord | <Elegant Beef> That's somethin i can get behind |
09:32:08 | * | zedeus joined #nim |
09:32:14 | FromDiscord | <Elegant Beef> at minimum 2-3 lines of error |
09:33:20 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2vb7 |
09:33:38 | FromDiscord | <haxscramper> AFAIK rust has all possible compiler errors indexed - compiler just shows simple error and there is a webiste with long description. Is it a good idea? |
09:33:40 | FromDiscord | <Elegant Beef> I dont like the multiple erros in one area |
09:33:50 | FromDiscord | <Rika> its not, its part of the same error |
09:33:53 | FromDiscord | <Rika> just more context |
09:34:28 | FromDiscord | <Elegant Beef> So... it's noise |
09:34:33 | FromDiscord | <Rika> > AFAIK rust has all possible compiler errors indexed - compiler just shows simple error and there is a webiste with long description. Is it a good idea?↵@haxscramper no, unless they also link to the (local installation of the) site in the error |
09:34:46 | FromDiscord | <Rika> i sometimes program in no-internet situations |
09:35:02 | FromDiscord | <Elegant Beef> `$a` isnt the issue `@a` is the way i see it in their example |
09:35:03 | FromDiscord | <Rika> > So... it's noise↵@Elegant Beef everything is noise to you it feels |
09:35:14 | FromDiscord | <haxscramper> But if there was such installation it is acceptable? |
09:35:37 | FromDiscord | <Rika> i think so, as long as the link is there too |
09:36:11 | FromDiscord | <Elegant Beef> it sincerely took me like 5 seconds to extract information from that screenshot, although it's 3:30am here |
09:36:41 | FromDiscord | <haxscramper> > `$a` isnt the issue `@a` is the way i see it in their example↵@Elegant Beef Need more colors!!! :) |
09:36:46 | FromDiscord | <Rika> i think the indentation is important, makes it easier for us humans to determine what lines are related to each other |
09:36:52 | FromDiscord | <Elegant Beef> I went to the arrows first, and went nope, then went to to the top and nope, then went to the error finally |
09:37:20 | FromDiscord | <haxscramper> Oh, yes, arrows like x3 times more flashy then the error itself. |
09:37:23 | FromDiscord | <Elegant Beef> It needs the actual error looking like an error being red and the context arrows being white unless it's error |
09:37:46 | FromDiscord | <Elegant Beef> Multiple arrows made the error ambigious to where it was |
09:37:57 | FromDiscord | <Elegant Beef> `$a` isnt the error, `@a` is |
09:39:57 | FromDiscord | <Elegant Beef> Anywho i sleep forward all my hatemail to your least favourite person |
09:40:18 | FromDiscord | <haxscramper> To sum up: actual error message should be red, arrow annotations white/dim. Don't put too many arrows all over the place |
09:40:19 | FromDiscord | <Rika> what if that person is you |
09:40:43 | FromDiscord | <Elegant Beef> Rika at this point i'd just be happy i made an impression on someone |
09:40:45 | FromDiscord | <Rika> hax: not always possible when using older terminal |
09:40:45 | FromDiscord | <Elegant Beef> 😄 |
09:41:06 | FromDiscord | <Rika> dont recognize beef as a human, got it |
09:42:25 | FromDiscord | <haxscramper> There should be like 600+ page book on 'error printing best practices' or something and seems like I need to read it |
09:43:33 | FromDiscord | <Rika> if we're gonna go all in with color why even bother with arrows; color the bg red for errors or something |
09:43:44 | FromDiscord | <--HA--> sent a long message, see http://ix.io/2vb9 |
09:44:33 | FromDiscord | <Rika> isnt `void*` == `pointer` |
09:45:25 | FromDiscord | <Rika> i dont see how the `type pointer with calling it with nimstrvar[0].addr` would fail |
09:45:35 | FromDiscord | <--HA--> That is what I found in a forum post, too. I tried this basically <https://forum.nim-lang.org/t/3045> |
09:46:47 | FromDiscord | <--HA--> sent a code paste, see https://play.nim-lang.org/#ix=2vba |
09:48:36 | FromDiscord | <Rika> perhaps? also i think you dont need to convert to cstring |
09:58:55 | FromDiscord | <--HA--> That also happens implicitly, yes. I tried some variations but never got a positive result. |
10:04:50 | FromDiscord | <Rika> maybe check if magick is "returning an exception" via its exceptions api |
10:06:51 | FromDiscord | <--HA--> That is a good idea, thanks @Rika |
10:14:11 | * | zielmicha__ quit (Read error: Connection reset by peer) |
10:14:43 | * | rayman22201 quit (Read error: Connection reset by peer) |
10:14:43 | * | alehander92 quit (Read error: Connection reset by peer) |
10:15:20 | * | l1x quit (Read error: Connection reset by peer) |
10:15:33 | * | rayman22201 joined #nim |
10:15:34 | * | zielmicha__ joined #nim |
10:15:39 | FromDiscord | <krisppurg> Is Nim beginner friendly for new programmers? |
10:15:46 | * | l1x joined #nim |
10:15:46 | * | alehander92 joined #nim |
10:16:56 | FromDiscord | <ache of head> Hmm |
10:17:04 | FromDiscord | <ache of head> I'd say there are languages more suited for beginners |
10:17:38 | FromDiscord | <ache of head> But, for example, I'd say I'd learn Nim as a beginner more easily than, say, Java |
10:18:46 | FromDiscord | <Rika> Not as much as python and javascript is |
10:18:55 | FromDiscord | <Rika> Documentation is everything for beginners |
10:19:12 | FromDiscord | <Rika> And nim is fairly lacking there |
10:19:29 | FromDiscord | <Rika> (I mean Documentation in the sense of tutorials guides and stuff as well( |
10:20:05 | * | awe00_ joined #nim |
10:20:09 | silvernode[m] | <FromDiscord "<krisppurg> Is Nim beginner frie"> I think it could be good for beginners since they don't have expectations but on the other hand, there are easier languages they could start with. In the end it depends on the person and their intention. Everyone's brain works differently. |
10:20:15 | FromDiscord | <haxscramper> I think nim is a good language for beginners in programming actually. Documentation is lacking when it comes to relatively high-level stuff. Things like types/iterations etc. are described good enough in the manual |
10:20:18 | PMunch | Ugh, I think I need some sleep... Really can't do math today |
10:21:15 | PMunch | I'd say Nim is very beginner friendly because of the helpful community |
10:21:23 | silvernode[m] | <PMunch "Ugh, I think I need some sleep.."> 1 sheep x 10 sheep x 50 sheep x 100 sheep. |
10:21:25 | * | awe00 quit (Ping timeout: 240 seconds) |
10:21:32 | PMunch | If you're stuck on something you can almost always just ask and get a good reply |
10:21:55 | FromDiscord | <haxscramper> And there is like, close to zero of things like `__name__ == 'main'`, special variables end things when you need to keep in mind when starting in python. At least for me it is somewhat confusing |
10:22:02 | FromDiscord | <Rika> Beware of dis___tek though ;) |
10:22:09 | PMunch | Haha :P |
10:22:30 | silvernode[m] | <PMunch "If you're stuck on something you"> yeah I think that is the best point yet. I have seen beginners give up because they go into the python irc and there are just so much going on that they get ignored. |
10:22:33 | FromDiscord | <Rika> Ah yeah I always have to search the proper magic variable or method in python |
10:22:51 | FromDiscord | <Clyybber> you ask disruptek how to echo a variable and you get back a reflection on the nature of the universe, data and mutations |
10:23:51 | FromDiscord | <Clyybber> what more is disruptek than an abstract entity thinking about abstract entities with throbbing balls? |
10:24:55 | FromDiscord | <haxscramper> To check if `distinct ptr[T]` is non-nil I first need to cast it back to `ptr`, right? |
10:25:14 | silvernode[m] | Maybe beginners should start with assembly and move to Nim once they can't take the pain. That way they appreciate it and stick with it when they have problems. 🙂 |
10:25:59 | FromDiscord | <Recruit_main707> haxcramper, maybe you can borrow the isNil function |
10:26:24 | PMunch | Anyone wants to help me write my simple iterator? Basically I have an array that I want to use as a circular buffer. By passing in two exclusively increasing indices (stop always larger than start) I want to essentially get all the values for that range mod the sequence. I had it working just fine, but I'm struggling with if you give a sequence like 0..15 on a buffer of size 10, that should repeat the first five elements again.. |
10:26:49 | FromDiscord | <Recruit_main707> or create a template `==` that casts itfor you at least |
10:27:28 | FromDiscord | <Rika> disruptek is great but newbies must not interact with them or they may face severe consequences |
10:29:26 | silvernode[m] | <PMunch "Anyone wants to help me write my"> "circular buffer", I don't think I'd be of much use there. That must be deeper into programming than I have gone yet. |
10:29:55 | PMunch | God damn it... |
10:30:09 | PMunch | I've spent hours writing this thing, and just realised how to do it in three lines.. |
10:30:18 | PMunch | Nvm, two lines.. |
10:30:19 | FromDiscord | <Rika> lol |
10:30:33 | FromDiscord | <Rika> using a modulo |
10:30:48 | FromDiscord | <Rika> and a for loop over a range |
10:30:50 | silvernode[m] | <PMunch "I've spent hours writing this th"> That's good though, since you get a valuable lesson. |
10:30:55 | PMunch | for i in start..stop: field buffer[i mod array.len] |
10:31:29 | silvernode[m] | I love it when that kind of stuff happens to me. It makes me a better programmer. |
10:31:33 | PMunch | @Rika, exactly... |
10:31:46 | FromDiscord | <Rika> rip lol |
10:31:57 | PMunch | I had all this complex logic about splitting the range into subranges and such |
10:32:00 | PMunch | A complete mess |
10:32:17 | silvernode[m] | I always do that to myself |
10:32:29 | silvernode[m] | that's why I come here and ask dumb questions all the time. |
10:32:51 | PMunch | Even struggled so much that I wrote an auto-test procedure to test a bunch of different combinations |
10:33:35 | silvernode[m] | <PMunch "Even struggled so much that I wr"> and this is why my text game is going to be a complete mess. |
10:33:48 | PMunch | Haha :P |
10:34:07 | silvernode[m] | over thinking is one of my biggest problems as a programmer. |
10:34:45 | silvernode[m] | when you spend days on something only to have someone look at your code and point out the solution in 5 seconds. |
10:42:07 | * | abm joined #nim |
10:47:19 | * | stisa[m] joined #nim |
10:58:00 | FromGitter | <alehander92> haxscramper |
10:58:03 | FromGitter | <alehander92> i love this |
10:58:19 | FromGitter | <alehander92> i also want to work on elm-like errors in some of my own projects |
10:58:27 | FromGitter | <alehander92> so i might follow this |
10:58:31 | FromDiscord | <haxscramper> Error message i pasted? |
10:58:48 | FromGitter | <alehander92> the idea of having more "fancy" messages* |
11:00:08 | FromDiscord | <haxscramper> Right now I'm just using quickly hacked together library, but I will probably move it into separate one + add suggestions from discussion above - configurable printing of error messages. |
11:10:52 | * | theelous3 joined #nim |
11:12:14 | FromDiscord | <--HA--> @Rika The image magick error is NoDecodeDelegateForThisImageFormat and it gave me a line in the c code. If I pass in an empty string I get the ZeroLengthBlobNotPermitted error I could see existed from the c source. So something is being passed to the function but no matter what I put in there the image format is not recognized. Read from a file directly works. Reading that same file into a string and passing it to MagickReadImageBlob doesn |
11:14:15 | FromDiscord | <Rika> prolly the magic header is unrecognized? |
11:14:31 | FromDiscord | <Rika> let me read the docs one moment |
11:16:13 | FromDiscord | <--HA--> It looks more like it is empty. I'm not very familiar with c but it seems like the magic header should be included in the error message and there is just nothing. And using the function MagickReadImage recognizes it fine. My best guess atm is that somehow I pass the data in a wrong way. |
11:16:27 | FromDiscord | <Rika> maybe |
11:16:52 | FromDiscord | <--HA--> I got MagickGetImageBlob working and passing that blob back to MagickReadImageBlob also doesn't work |
11:17:33 | FromDiscord | <Rika> i dont know what the issue would be, sorry |
11:18:21 | FromDiscord | <--HA--> Thank you for looking into it! |
11:19:44 | shashlick | Which wrapper are you using |
11:20:21 | shashlick | Also snippet may help |
11:21:57 | FromDiscord | <--HA--> It's posted above a bit. The discord link to the message probably does not help for IRC. No wrapper, if I understand the question correctly. I wrote a few proc with importc pragma. |
11:26:46 | * | lritter joined #nim |
11:35:03 | FromDiscord | <--HA--> I've been looking a lot at <https://github.com/zedeus/nimagemagick> but there is no read blob function there yet. |
11:45:01 | * | rockcavera joined #nim |
11:45:37 | PMunch | Ugh, another math thing that's taking me waay to long to figure out |
11:46:24 | PMunch | I'm creating a particle system |
11:46:55 | PMunch | Particles should be able to move fast or slow, their x and y speed is stored as two int8s |
11:47:11 | PMunch | I want the slowest speed to be sub 1 pixel per frame |
11:47:27 | FromDiscord | <lqdev> make the velocity fixed point? |
11:47:37 | PMunch | Let's say minimum speed is one pixel every four frames or something |
11:47:37 | FromDiscord | <lqdev> and position ofc |
11:47:48 | PMunch | Hmm, how would that work? |
11:48:02 | FromDiscord | <lqdev> then you shift whole numbers two bits to the right |
11:48:24 | FromDiscord | <lqdev> the two least-significant bits are then your representations of .0, .25, .5, and .75 |
11:48:30 | PMunch | I was thinking just calculate the "I need to move x pixels every n frames" and then do a "if frame mod n: pos + x" |
11:48:35 | FromDiscord | <Rika> @--HA-- well because the wrapper is generated automatically, the code isnt there |
11:48:41 | FromDiscord | <lqdev> PMunch: mod is slow |
11:48:41 | FromDiscord | <Rika> but it will be when you use the library |
11:48:50 | FromDiscord | <lqdev> if you're using ints for speeds you're likely constrained |
11:48:57 | FromDiscord | <lqdev> so do not use mod |
11:49:01 | FromDiscord | <lqdev> unless you're not constrained |
11:49:07 | FromDiscord | <lqdev> then i don't see a reason for not using floats |
11:49:46 | PMunch | Well I'm mostly constrained in program space |
11:50:00 | PMunch | As in the size of the program and the amount of stuff I can keep in RAM |
11:50:08 | FromDiscord | <lqdev> what about clock speeds? |
11:50:34 | FromDiscord | <lqdev> because `mod` is like, suuuuuuuper slow, esp. if your processor doesn't have an instruction for it |
11:50:40 | FromDiscord | <lqdev> same with division |
11:50:54 | shashlick | @--HA-- cstring is already a pointer |
11:51:53 | PMunch | It's a 16Mhz chip |
11:51:56 | shashlick | You could just pass blob.cstring |
11:51:59 | FromDiscord | <lqdev> hm |
11:52:04 | PMunch | But I'm not 100% sure if I'm running it at that speed atm |
11:52:10 | FromDiscord | <lqdev> and is this in a tight loop? |
11:52:28 | PMunch | Ah, yes it's running at 16Mhz |
11:52:40 | PMunch | Yeah, but I'm already using mod and div all over the place |
11:52:44 | FromDiscord | <lqdev> oof |
11:52:46 | PMunch | Speed doesn't seem to be much of an issue |
11:53:07 | PMunch | It's just the images and level data that's filling up the puny amount of memory on this thing |
11:53:42 | PMunch | 28672 bytes of program memory, and 2560 bytes of data memory |
11:56:06 | FromDiscord | <lqdev> fixed-point numbers are really simple: instead of representing your values as whole units, you represent it as 1/4 units (you assign two bits to the fractional part, so the format is 6.2 fixed-point, as in integer_bits.fractional_bits) |
11:56:15 | FromDiscord | <lqdev> well 1/4th |
11:56:18 | FromDiscord | <lqdev> it can be any fraction |
11:56:24 | FromDiscord | <lqdev> as long as the denominator is a power of two |
12:05:37 | FromDiscord | <--HA--> I just got it working with the inbuilt "logo:" image and using a different format. Thanks everyone for your help! Turns out the issues seems to be just with detection of the image type I'm working with, which is TGA. But I know it generally works now and my wrapper code is not the issue. |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:22 | * | pbb quit (Ping timeout: 260 seconds) |
12:06:24 | FromDiscord | <Rika> nice |
12:06:37 | * | supakeen joined #nim |
12:08:53 | * | waleee-cl joined #nim |
12:12:06 | PMunch | lqdev, this is very promising! |
12:14:01 | * | pbb joined #nim |
12:14:56 | Zevv | make sure to shift back after multiplying :) |
12:16:33 | PMunch | Shift back? |
12:16:43 | FromDiscord | <lqdev> when rendering i guess |
12:16:56 | PMunch | I need to use everything <1 as every n frames add another pixel |
12:16:59 | FromDiscord | <lqdev> you have to be careful 'cause now 1 means 1/4th of a pixel and not a single pixel |
12:17:45 | PMunch | I guess I could create a procedure that takes a static[float] and converts it automatically |
12:18:39 | FromDiscord | <lqdev> distinct types to the rescue! |
12:29:45 | * | Vladar quit (Remote host closed the connection) |
12:36:11 | Zevv | pmunch: you can just add or sub your 6.2s, but if you multiply then, you get a 12.4, which you have to shr by 2 to make it a .2 again |
12:40:01 | PMunch | Uhm.. |
12:40:49 | Zevv | for example, 3.25*5.75 would be 13*23=299. you do 299 shr 2 to get your answer = 75, meaning 18.75 in 6.2 |
12:40:52 | Zevv | does that make sense? |
12:41:10 | Zevv | but maybe you dont ever need to multiply, so then it doesnt matter :) |
12:41:35 | PMunch | Ah right, I see |
12:41:43 | PMunch | No I don't think I need to multiply :P |
12:41:51 | Zevv | until you do! |
12:41:53 | PMunch | But having a fixed-point library for Nim would be cool |
12:42:18 | Zevv | there must be a few |
12:43:50 | * | FromDiscord quit (Remote host closed the connection) |
12:44:06 | * | FromDiscord joined #nim |
12:44:09 | Zevv | well, there seem to be none. pmunch to the rescue! |
12:44:48 | PMunch | I'm barely awake enough to make myself coffee, let alone writing complex bit-shift mathy libraries! |
12:45:41 | FromDiscord | <Rika> speaking of weird decimal math, i think i made a float16 library some time ago |
12:46:53 | PMunch | Hmmmm |
12:47:10 | PMunch | I guess I could also store the positions as fixed-point.. |
12:47:18 | PMunch | That would solve a lot of my issues.. |
12:47:40 | Zevv | well, if you want your positions to increment sub-int, I guess you should right |
12:47:47 | PMunch | Yeah |
12:48:28 | PMunch | My plan was to use a scheme of adding another pixel every N frames to simulate it |
12:48:36 | Zevv | but with 6.2 you can only go up to 63.75 |
12:48:38 | PMunch | And keeping the position an integer |
12:48:49 | Zevv | nah way too complex |
12:49:11 | PMunch | I store the position as an int16 at the moment |
12:49:28 | PMunch | So that would be a 14.2 |
12:49:29 | Zevv | so that would be a 14.2 |
12:49:40 | Zevv | dude will you marry my. disruptek refused |
12:49:43 | PMunch | Haha, exactly |
12:50:29 | PMunch | Oof, long distance marriage? |
12:50:52 | Zevv | who cares, it's 2020 and we have irc |
12:50:57 | PMunch | Haha :P |
12:51:16 | Zevv | let me see how nice generic fixedpoint can be put in some type system |
12:52:09 | PMunch | I mean this project is part of a gamejam to make a pretty and simple game. With extra points for simple source code |
12:52:29 | PMunch | I'm going hard for the simple source code thing with some crazy Nim macros |
12:52:44 | Zevv | hehe |
12:52:55 | PMunch | Showing them generic fixed point numbers would definitely be cool |
12:56:02 | PMunch | Hmm, what's the best way to do rounding? |
13:02:54 | Zevv | to whole numers? |
13:02:58 | PMunch | Yeah |
13:03:02 | Zevv | just like normal floats. add 0.5 and truncate |
13:03:08 | PMunch | Aaah |
13:03:10 | PMunch | Ofc |
13:03:12 | Zevv | assuming > 0 of c |
13:03:47 | PMunch | Are you making a library now by the way? |
13:05:26 | Zevv | fiddling a bit |
13:05:34 | Zevv | to see if I can make something generic |
13:05:38 | PMunch | Nice |
13:05:44 | Zevv | so you can say, my T is a 6.2 |
13:05:49 | Zevv | change that to 5.3 |
13:05:52 | Zevv | and everything just works |
13:06:59 | Zevv | I made a few in C over the years for customers |
13:07:03 | Zevv | but I can't find any in my own repos |
13:07:32 | PMunch | That's amazing! |
13:07:49 | PMunch | Wait, not on runtime? |
13:08:04 | Zevv | ? |
13:08:18 | PMunch | You can't change a 6.2 to a 5.3 on runtime |
13:08:38 | Zevv | well, you could convert between them. but I'm trhing to make types for those |
13:08:45 | PMunch | Yeah okay |
13:08:51 | Zevv | so you define your speed as a FixedPoint[uint8, 2] |
13:08:56 | PMunch | Yeah |
13:08:59 | Zevv | and your location as a FixedPoint[16, 2] |
13:09:12 | PMunch | And then just location += speed |
13:09:27 | Zevv | right. But that's already where the complexity lies - mixing them |
13:09:40 | Zevv | what if I add a 16.4 to a 8.2. what should the output be? |
13:09:43 | PMunch | Add a round function and a compile-time float -> fixed converter and that's pretty much everything I need :P |
13:10:05 | PMunch | I'd say that's not possible |
13:10:12 | PMunch | Without a converter |
13:10:17 | Zevv | well, `+=` should work of course |
13:10:21 | FromDiscord | <mratsim> I have some fixed point arithmetic hidden |
13:10:25 | PMunch | Yeah, but only with the same base |
13:10:36 | PMunch | Well, same fix point |
13:10:45 | FromDiscord | <mratsim> https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/color_conversions.nim#L105-L106 |
13:10:59 | PMunch | So taking a 14.2 and adding a 6.2 should work |
13:11:42 | Zevv | I guess so |
13:12:10 | Zevv | Oh I thought mratsim already came spoiling our fun with a complete fp math lib |
13:12:11 | Zevv | but no :) |
13:12:16 | * | Zevv waves to mratsim |
13:12:30 | PMunch | Well I guess that could also require conversion. But it would be the same as just doing int16(7'u8) |
13:12:58 | FromDiscord | <mratsim> Nah, I don't have enough time for that |
13:13:11 | Zevv | ain't nobody got time for that! |
13:13:20 | FromDiscord | <mratsim> I want to wrap up my crypto lib so that it starts being useful and then I want to explore multithreaded async |
13:13:36 | Zevv | ain't nobody got time for that either! |
13:14:17 | FromDiscord | <mratsim> Luckily there is a very fresh article on Rust futures which I find quite elegant and actually "zero cost abstraction": https://axelforsman.tk/2020/08/24/rust-style-futures-in-c.html |
13:14:26 | FromDiscord | <mratsim> the article is on how to implement them in C |
13:15:02 | Zevv | Aw don't let disruptek hear, he's all set to make CPS the next big thing |
13:15:09 | FromDiscord | <mratsim> Also those futures doesn't involve the GC which makes them threading friendly |
13:15:40 | Zevv | ooh that looks interesting indeed |
13:15:51 | FromDiscord | <mratsim> I don't mind exploring CPS either but before that I need a good handle on the high level problem |
13:15:56 | FromDiscord | <mratsim> threading done. |
13:16:01 | Zevv | \o/ |
13:16:03 | FromDiscord | <mratsim> Next is async and iterators |
13:16:29 | Zevv | also cps! |
13:18:00 | FromDiscord | <mratsim> I mean, the 3 use cases of CPS is unifying threading, async, iterators and in general everything that uses callbacks |
13:18:25 | Zevv | coroutines |
13:18:32 | Zevv | but, yes |
13:18:46 | FromDiscord | <mratsim> once I have an idea of how to write those libraries, I would have a better idea on the magical solution 😉 |
13:19:10 | FromDiscord | <mratsim> if it is the magical solution* |
13:19:28 | FromDiscord | <mratsim> ah yes macro composition as well. But I think I'm OK on the macro front |
13:19:31 | Zevv | disruptek got CPS to a kind-of-working state. We can do async like stuff already, implement iterators and coroutines, implement longjmp style gotos, exception handling, etc |
13:19:35 | FromDiscord | <Admin> How would i change the available elliptic curves for a http client ? |
13:21:19 | FromDiscord | <stisa> Pmunch I just saw this for fixed point numbers https://gitlab.com/lbartoletti/fpn not sure how complete it is tho |
13:22:10 | PMunch | Hmm, not the prettiest solution |
13:22:11 | Zevv | it's not very generic, comes with a few predefined types only |
13:22:16 | Zevv | and it has a sucky api |
13:22:24 | PMunch | Yeah, was about to say |
13:22:48 | PMunch | Seems almost like a port of some C library |
13:26:11 | FromDiscord | <Admin> > How would i change the available elliptic curves for a http client ?↵anyone have a clue ? |
13:26:17 | Zevv | bwah, my converter does not like to be [T, W] generic |
13:26:59 | Zevv | don't know Admin, if it's possible it should probably in the 'net' docs |
13:27:14 | Zevv | not sure how much of openssl is actually exported into Nim land at this time |
13:29:09 | FromDiscord | <mratsim> genotrance / shashlick has a full export in nimssl |
13:29:39 | Zevv | is that mixable with the normal (async) net? |
13:30:30 | FromDiscord | <mratsim> I think it's all setup in the sslcontext and one of the init function accepts that context |
13:30:38 | Zevv | ah right |
13:30:39 | FromDiscord | <mratsim> but you might need a cast |
13:31:04 | FromDiscord | <mratsim> because the highlevel type name probably differ |
13:32:45 | shashlick | i don't think nimssl is functional yet |
13:33:45 | shashlick | i just point those who ask to my rsa.nim test in nimterop or the pkcs7 wrapper here - https://gist.github.com/genotrance/53d3ae50434ad73365d45bdd6a0ff97d |
13:36:32 | shashlick | i felt openssl was too large to wrap everything but now that you can generate an output file, maybe it's worth it |
13:37:21 | Zevv | openssl is hell. all of it. |
13:37:52 | Zevv | mratsim should just put the crown on his crypto lib by making us a nice nim native TLS1.[23] implementation |
13:38:34 | FromDiscord | <mratsim> Note that we are undergoing security audit and are using BearSSL for basic crypto: https://github.com/status-im/nim-bearssl↵- https://github.com/status-im/nim-libp2p/tree/master/libp2p/crypto |
13:39:48 | Zevv | excellent choice |
13:40:01 | FromDiscord | <mratsim> I don't know if I want to implement TLS. It's a super complex beast, it's been done to death, it's unlikely to attract people to Nim because of BoringSSL, BearSSL, WolfSSL, mbedTLS, ... |
13:40:35 | Zevv | true, I was not being serious. But I *do* feel that it might pay to take a secure and compact SSL lib and make it part of the nim stdlib |
13:40:46 | FromDiscord | <mratsim> i.e. underexplored crypto with no big libs that is complex to implement and complex to optimize is a better way to attract people to Nim |
13:40:53 | FromDiscord | <mratsim> ah yes sure. |
13:41:15 | FromDiscord | <mratsim> But I don't see how that's possible. |
13:41:33 | Zevv | I also think that good crypto primitives with a a solid API should be part of the core stdlib, but so many people with so many opinions on that |
13:42:11 | Zevv | well, as long as we target C/C++ we could just move any lib into the stdlib as long as the license agrees? |
13:42:28 | FromDiscord | <mratsim> The issue with crypto is that we want it to be both fast (HTTP server bottlenecked by crypto) and secure. |
13:43:07 | FromDiscord | <mratsim> A pure Nim one would need assembly for both to ensure the compiler doesn't introduce branches that would leak secrets |
13:43:15 | FromDiscord | <mratsim> Assembly like this: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/limbs_asm_montmul_x86.nim#L127-L188 |
13:43:21 | Zevv | no but pure nim is not soemthing we would want I think |
13:43:30 | FromDiscord | <mratsim> and this is totally contrary to the stdlib philosophy so far |
13:43:37 | Zevv | let the security people do their security thing in their libs |
13:43:46 | FromDiscord | <mratsim> and I don't see how many people would be willing to maintain this |
13:43:49 | Zevv | we could pull bearssl into the stdlib, technically? |
13:43:54 | FromDiscord | <mratsim> yes |
13:43:59 | Zevv | I would so vote or that |
13:44:01 | Zevv | /for/ |
13:44:41 | FromDiscord | <mratsim> but a crypto API in the stdlib is actually simple |
13:45:05 | Zevv | sure, but if we have something like bearssl, any crypo primitives could lie on top of that as well |
13:45:13 | Zevv | no need to have nim implementations? |
13:45:23 | FromDiscord | <mratsim> you need "newContext" "generateSecretKey", "derivePublickey", "sign", "verify" |
13:45:43 | FromDiscord | <mratsim> and you can use OpenSSL or BearSSL behind |
13:45:43 | Zevv | and some things for symmetrical cryoto of course and hashes |
13:45:46 | Zevv | right |
13:46:21 | Zevv | but still nothing like that exists, it seems |
13:46:38 | Zevv | there's 23 differetn nim crypto libs that all do just one or two things, and all have different APIs and most are not maintained |
13:46:46 | Zevv | I don't dare touch any of them and just bind EVP |
13:47:20 | FromDiscord | <mratsim> This is what we are doing there:↵- https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/bls_sig_min_pubkey_size_pop.nim↵- https://github.com/status-im/nim-blscurve/blob/master/blscurve/miracl/bls_signature_scheme.nim |
13:47:39 | FromDiscord | <mratsim> 2 backends, same API |
13:47:59 | Zevv | right. all that stuff would look so nice in nims stdlib |
13:48:02 | shashlick | so is there value in a full openssl wrapper |
13:48:44 | FromDiscord | <mratsim> only if it can be used in Async net I think |
13:49:02 | PMunch | Argh, why can't I use a procedure that takes a static[float] inside a macro.. |
13:49:04 | FromDiscord | <mratsim> if you also need to rewrite async net, I don't think there is that much value, too much friction anyway |
13:49:27 | shashlick | well, I don't know what is missing in async net ssl wise so no idea |
13:49:40 | FromDiscord | <mratsim> @PMunch, remove static and tag {.compileTime.} |
13:49:56 | shashlick | i'm just not sure we need a 10mb nim wrapper that covers all of ssl |
13:49:58 | FromDiscord | <mratsim> it's like const in macros |
13:50:21 | PMunch | Hmm, that works |
13:52:07 | * | WilhelmVonWeiner joined #nim |
13:52:20 | FromDiscord | <mratsim> in a VM context, there is no const or static, just let and plain values. |
13:53:02 | FromDiscord | <mratsim> This is annoying when you want to do `static: debugEcho ...` in a proc that is called at both runtime and compile-time |
13:53:03 | PMunch | Hmm, negative values doesn't seem to work very well with my fixed point implementation.. |
13:53:52 | FromDiscord | <mratsim> Floats are sign-and-magnitude based and ints are two-complement |
13:54:08 | WilhelmVonWeiner | should one use `proc main = ` over writing their code at the top level of a file? |
13:56:18 | FromDiscord | <ache of head> AFAIK Nim uses `when isMainModule:` |
13:57:54 | PMunch | WilhelmVonWeiner, it gives a very slight performance boost, but it won't be called implicitly |
13:58:25 | PMunch | `when isMainModule` is used to run code only when that file is the main module being compiled |
13:58:34 | PMunch | So you can have a tool and a library in the same file |
13:58:37 | shashlick | i might enable nimterop to split wrapper output into multiple files - only seems warranted for complex libs though |
13:59:04 | PMunch | If you compile the file you get the tool, but if you import it you won't get the tool included |
14:01:05 | WilhelmVonWeiner | that's pretty cool |
14:01:22 | WilhelmVonWeiner | I think I will get into the habit of writing proc main |
14:03:27 | FromDiscord | <mratsim> You can also do "when isMainModule: proc main() = " |
14:06:13 | Zevv | bwah. `converter fromFloat*[T, W](v: float): FixedPoint[T, W] =`: cannot instantiate `T` |
14:07:47 | * | liblq-dev joined #nim |
14:09:15 | FromDiscord | <mratsim> yep, need proc and typedesc (https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/color_conversions.nim#L105-L106) |
14:09:54 | Zevv | yeah yeah but that sucks. I have my type for that |
14:10:11 | Zevv | my type `Speed` is `FixedPoint[uint8, 2]` |
14:10:17 | Zevv | and I just want to work with `Speed` |
14:10:22 | Zevv | and never have to refer to the definition |
14:10:57 | FromDiscord | <Recruit_main707> Generics can’t get their type from return types |
14:11:28 | FromDiscord | <Rika> you must explicitly define the generic types |
14:11:34 | FromDiscord | <Rika> since converters are implicit |
14:11:41 | Zevv | Yeah I know. but I hate it :) |
14:11:44 | FromDiscord | <Rika> its not really possible |
14:12:22 | Zevv | I'll make a `proc set[T, W](f: var FixedPoint[T, W], val: float)` then |
14:15:02 | Zevv | but I don't want to have floats at run time |
14:15:06 | Zevv | that should all be magiced away |
14:25:11 | * | narimiran quit (Ping timeout: 256 seconds) |
14:25:49 | FromDiscord | <mratsim> > its not really possible↵@Rika You never tried to break the law of causality. parameter (cause) -> return type (consequence) is such an outdated concept. |
14:26:11 | FromDiscord | <ache of head> 🤣 |
14:26:16 | FromDiscord | <ache of head> Or…? |
14:26:19 | FromDiscord | <ache of head> Was this serious? |
14:27:08 | FromDiscord | <ache of head> My sarcasm and humor sensors are pretty bad compared to other people. |
14:27:24 | FromDiscord | <mratsim> Depends on the field, seems like in geopolitics and sociology, causality is walking on its head. |
14:27:28 | planetis[m] | you can try my fixed point lib https://gist.github.com/planetis-m/c13529cac44b4a9de3f073de502315ee |
14:28:00 | planetis[m] | there is another one in gitlab https://gitlab.com/lbartoletti/fpn |
14:28:15 | FromDiscord | <mratsim> I'm surprised you only have 16 gists @planetis, it feels like you have gist for everything to me |
14:29:13 | planetis[m] | well not everything, just simple stuff |
14:29:28 | PMunch | That looks promising, but I need to add a 6.2 to a 14.2 |
14:30:30 | Zevv | PMunch: http://ix.io/2vct |
14:30:39 | planetis[m] | multithreading ie seems like rocket science to me |
14:30:46 | Zevv | it's a start, but it's cumbersome to make good mix & match possible between types |
14:31:04 | Zevv | this allows adding types with the same precision, assuming the first is larger or the same then the second |
14:31:10 | Zevv | so you can do Pos += Speed |
14:31:45 | FromDiscord | <mratsim> @planetis: start by a threadpool (which I didn't do :D) |
14:31:55 | FromDiscord | <mratsim> you can go far with a threadpool |
14:32:05 | FromGitter | <alehander92> zevv |
14:32:09 | FromGitter | <alehander92> i started with my ir/assembly stuff |
14:32:42 | FromGitter | <alehander92> can you give an example of an useful small thing to target: i want to target x86_64, maybe raspberry and 1 more |
14:33:00 | FromGitter | <alehander92> to have different things to make sure it's more general |
14:36:47 | FromDiscord | <mratsim> What do you want to use your IR / assembly for? Are you writing a compiler/code generator? |
14:39:37 | Zevv | yeah i don't know. he says its for "fun" |
14:39:40 | Zevv | "fun", he says |
14:40:02 | FromDiscord | <mratsim> I have "fun" writing bigints and crypto in pure assembly |
14:40:08 | Zevv | alehander: if you want to go extreme, target at least one 64 bit and one 8 bit device. |
14:40:17 | FromDiscord | <mratsim> I have even more "fun" debugging carry bugs/off-by-one |
14:40:59 | FromGitter | <alehander92> mratsim yeah a small subset of c one |
14:41:08 | FromDiscord | <mratsim> It's actually one area where the current compilers are broken |
14:41:30 | Zevv | alehander92: but making it 'generic' is not easy - different cpu's have different address modes, different numbers of registers, etc |
14:41:36 | FromGitter | <alehander92> mostly wanting to improve syntax errors / learn more about optimizations / start going deeper into c/asm for cv |
14:41:40 | FromDiscord | <mratsim> so, you can start with bigint addition on fixed sized bigint, sayd uint256 |
14:41:40 | Zevv | so I'd be surprised if you could whip up something that would just work on x86 and arm |
14:41:53 | FromGitter | <alehander92> zevv yeah but this is good |
14:41:56 | FromDiscord | <mratsim> and then multiplication |
14:42:23 | FromGitter | <alehander92> that's the point, to make me think of what is abstract optimization and what is arch-specific |
14:42:42 | FromGitter | <alehander92> well, 8bit .. might be a bit strange |
14:42:56 | FromGitter | <alehander92> how easy can i find such a device/emulator, chip8? |
14:43:12 | Zevv | pick avr, so much available for that |
14:43:18 | Zevv | they call it 'arduino' these days |
14:43:43 | FromGitter | <alehander92> what other things are "strange" |
14:43:57 | FromGitter | <alehander92> are there common cpus without registers |
14:43:59 | FromGitter | <alehander92> or without heap |
14:44:19 | FromGitter | <alehander92> (ok the last thing is probably userland-specific) |
14:44:40 | FromGitter | <alehander92> ok, with 4bit words or 10bit |
14:44:44 | FromGitter | <alehander92> or something like that |
14:44:48 | Zevv | don't exist anymore these days |
14:45:02 | Zevv | but really man, just target 1 first |
14:45:05 | Zevv | that's hard enough as it is |
14:45:19 | FromGitter | <alehander92> yeah, but i want 2 |
14:45:21 | FromGitter | <alehander92> otherwise my ir |
14:45:25 | FromGitter | <alehander92> would fit the 1 too much |
14:46:10 | Zevv | arm thumb |
14:49:52 | FromDiscord | <mratsim> 12-bit and 24-bit are likely to be audio DSP |
14:49:54 | * | hnOsmium0001 joined #nim |
14:50:24 | FromDiscord | <mratsim> AVR has a lot of crypto/bigint implementation |
14:50:38 | FromDiscord | <mratsim> so big int multiplication on it is interesting |
14:50:51 | FromDiscord | <mratsim> also ARM book as a big int in assembly section |
14:50:57 | Zevv | well, interesting. it's just carrying and carrying and carrying |
14:51:08 | Zevv | "do stuff lots of times" |
14:51:52 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/747830605236142141/unknown.png |
14:52:06 | FromGitter | <alehander92> hm, i am more interested in non-math opt |
14:52:26 | FromGitter | <alehander92> math ones are very cool, but :D I mostly wanted to go through gcc flags |
14:52:30 | FromGitter | <alehander92> and see what is easy to learn |
14:52:59 | Zevv | PMunch: ping |
14:53:02 | FromGitter | <alehander92> i mostly want something that i can easily tst on |
14:53:05 | PMunch | Pong |
14:53:08 | FromDiscord | <mratsim> My advice, pick something that you can show |
14:53:16 | FromDiscord | <mratsim> like raytracing *cough* |
14:53:21 | FromGitter | <alehander92> so i should either get it from a friend/buy or find an emulator |
14:53:21 | Zevv | PMunch: that ix I just posted |
14:53:35 | PMunch | Oooh |
14:53:36 | Zevv | can you think of a way to make the `set()` compile time |
14:53:38 | FromGitter | <alehander92> mratsim haha, well i prefer parsing |
14:54:01 | disruptek | alehander92: pick some gameboy stuff or whatever, then you'll have lots of roms to test with. |
14:54:04 | FromDiscord | <mratsim> parse a demo scene file and transform it to many arch |
14:54:13 | FromDiscord | <mratsim> or a mandelbrot fractal |
14:54:26 | FromGitter | <alehander92> i should look at common benchmarks |
14:54:41 | FromGitter | <alehander92> but i am far away from this |
14:54:56 | FromDiscord | <mratsim> Are compile brainfuck to multiple arch |
14:55:04 | PMunch | Make a toFixed compileTime procedure and make set a template that expands to "f = toFixed[T, W](val)"? |
14:55:10 | FromGitter | <alehander92> no i dislike it |
14:55:59 | FromGitter | <alehander92> but thanks man |
14:56:08 | FromGitter | <alehander92> i should keep in mind some math usecases |
14:56:23 | FromGitter | <alehander92> but this is not really a super serious project |
14:57:10 | FromGitter | <alehander92> disruptek thanks |
14:57:44 | Zevv | PMunch: but I want to be able to make arrays and seqs as well, without havinc to specify for each element |
14:57:56 | FromGitter | <alehander92> i think i might target rpi / arduino / something very old like chip8 just for ease of test first |
14:57:57 | PMunch | Ah.. |
14:58:09 | FromGitter | <alehander92> (and x86_64) later more, thanks for the tips |
14:58:14 | PMunch | And I guess converters can't be {.compileTime.}? |
14:58:24 | Zevv | I can't even convert this because the type is generic |
15:00:06 | * | MarderIII joined #nim |
15:02:50 | Zevv | bah that would have been nice if converters worked |
15:03:18 | disruptek | when you have the money you need, it doesn't matter how productive you are because what is production at that point? |
15:04:07 | disruptek | i started three different businesses, and was busy inventing shit all the time. but for what? |
15:04:21 | Zevv | well, did you do it for the money? |
15:04:50 | Zevv | I asked my accountant once what I would need to do to get rich. "Well, not what you're doing now" was the answer |
15:05:20 | disruptek | that's the point; you have to look at this from the other perspective. |
15:05:25 | disruptek | it's like star trek. |
15:05:40 | disruptek | once you can just hit a button and get food, you need new goals. |
15:05:56 | Zevv | and once you're the ADHD entrepreneur type of person, you need new goals |
15:06:05 | Zevv | all the time |
15:09:25 | disruptek | if you combine that person with a button that doesn't produce food, you have a real problem. |
15:10:11 | Zevv | what's the name of the function that should be called "sign" that does if v < 0.0: -1.0 else: 1.0 |
15:10:33 | Zevv | oooh. `sgn` |
15:11:03 | disruptek | just use ndoc |
15:11:17 | disruptek | `ndoc sign` it's the second hit. |
15:11:36 | Zevv | ndoc |
15:11:37 | Zevv | wut |
15:11:50 | disruptek | alehander92's new project. |
15:11:53 | disruptek | !repo disruptek/ndoc |
15:11:54 | disbot | https://github.com/disruptek/ndoc -- 9ndoc: 11like pydoc but for nim 15 0⭐ 0🍴 |
15:12:00 | Zevv | dude |
15:12:03 | Zevv | talking about productivity |
15:12:26 | FromDiscord | <ache of head> Hey, what was the operator for explicitly indicating types of number literals? Like, I have a 1 that I want to be a uint8. I think there was something like an apostrophe…? |
15:12:26 | Zevv | you're not the ADHD entrepreneur type, are you |
15:12:45 | * | kenran quit (Ping timeout: 240 seconds) |
15:12:46 | disruptek | 1.uint8 or 1'u8 |
15:12:56 | Zevv | or uint8(1) |
15:12:57 | FromDiscord | <ache of head> thank you very much! |
15:12:57 | * | Vladar joined #nim |
15:13:24 | disruptek | 1'u8 is annotation, the others are conversion. |
15:13:44 | FromDiscord | <ache of head> I see |
15:13:44 | FromDiscord | <ache of head> Thanks! |
15:14:27 | disruptek | what i've learned about ADHD is that it manifests in mysterious ways. |
15:15:10 | Zevv | it does, it does |
15:17:50 | FromDiscord | <Rebel> Let's say hypothetically someone wanted to do inbranch llvm obfuscation such as with YANSOllvm↵how hard would that be to do with Nim? Would the easiest way just be using clang with the c files↵that are produced? |
15:18:00 | Zevv | eh disruptek you're smart. think for me. |
15:18:11 | Zevv | https://github.com/zevv/nimfix/blob/master/fixedpoint.nim |
15:18:36 | Zevv | I have a type `FixedPoint[T, W]`. to be used like `type Speed = FixedPoint[uint8, 2]` |
15:18:56 | FromDiscord | <Rebel> (edit) 'inbranch' => 'in tree' |
15:19:13 | Zevv | I want to be able to say something like "var s: Speed = 1.25" and `var s: seq[Speed] = @[ 1,25, 3.5 ]` |
15:19:13 | disruptek | rebel: yes, just use clang. it works fine. |
15:19:22 | Zevv | but converters don't fly beause of the generics it seems |
15:19:40 | Zevv | how would you make this so that its both consice, and that the floats don't survive to run time |
15:19:53 | disruptek | you can run the converter to instantiate the generics, right? |
15:20:00 | disruptek | prime the pump. |
15:20:01 | Zevv | converter says no. |
15:20:05 | Zevv | can't innstatitate T |
15:20:28 | disruptek | are you sure you know what i'm saying? |
15:20:43 | Zevv | I have no clue |
15:20:46 | Zevv | really |
15:20:57 | FromDiscord | <mratsim> welcome to low level programming "I have no clue" 😛 |
15:21:25 | Zevv | I hardly ever do |
15:21:30 | Zevv | it's mostly talk |
15:21:40 | Zevv | I got a way for that for many years |
15:22:05 | Zevv | and the fun part is: the further I get in my career, the more often I say "dude I have no clue what that is". and people kind of respect that. really. |
15:23:56 | disruptek | so the way generics work is, basically, once they've been called with types, they can be called without types. |
15:24:20 | Zevv | sure. but how does one "prime the pump" |
15:24:38 | Zevv | I have ideas, but these dont apply to nim |
15:25:56 | disruptek | put the values in the box[](somevar) |
15:26:50 | disruptek | conv[int8, 3](dx) looks like |
15:30:37 | Zevv | hmm first I shell cook dinner, so I have been told |
15:30:58 | disruptek | we need a trampoline that lets you register into different stages. |
15:31:15 | disruptek | so you can catch continuations pre-bounce, post-bounce. |
15:32:08 | Zevv | why "need" |
15:32:12 | Zevv | i think we need tons of stff |
15:32:43 | disruptek | i mean, it needs to come in the box. |
15:34:01 | disruptek | this is basically what our tubes are built on, but it's so generic a concept that it should be available outside of tubes. |
15:34:45 | disruptek | i have to get coffee and shoot a horse, but i'll look at your converter when i get back. |
15:35:02 | FromDiscord | <ache of head> Oof |
15:35:09 | FromDiscord | <ache of head> I figured that the static seq doesn't work |
15:35:11 | FromDiscord | <ache of head> cause it's not static xD |
15:52:06 | * | dddddd quit (Remote host closed the connection) |
15:53:46 | * | dddddd joined #nim |
15:58:24 | Zevv | yeah sure butem in the box, but i dont want to dry |
15:58:40 | Zevv | theres a type like Speed that is already [uint8, 2] |
15:58:50 | Zevv | hm this smells so gooood |
15:59:10 | disruptek | this is bullshit. |
15:59:44 | Zevv | its hard to put pig in things and make'm smell bad |
16:00:03 | disruptek | i beg to differ. |
16:00:15 | disruptek | witness aged cream of bacon soup. |
16:00:35 | disruptek | "it's raining too hard to shoot horses" |
16:00:42 | disruptek | how is this even a fucking thing? |
16:00:47 | Zevv | it si, it is, so says the horse |
16:00:53 | disruptek | damnit vermont sucks. |
16:01:30 | Zevv | try vermouth |
16:01:59 | FromDiscord | <lqdev> Zevv: https://github.com/zevv/nimfix/blob/master/fixedpoint.nim#L40 |
16:01:59 | FromDiscord | <lqdev> lol |
16:02:11 | disruptek | okay, i ran your file. |
16:02:13 | * | dsrw joined #nim |
16:02:15 | disruptek | what am i supposed to get? |
16:02:36 | * | liblq-dev quit (Quit: WeeChat 2.9) |
16:06:09 | disruptek | your converter converts the wrong way. |
16:08:38 | Zevv | no this is the other way |
16:08:44 | Zevv | the right one is not in here yet |
16:09:22 | Zevv | pull, line #13 |
16:10:47 | Zevv | its not the usage that is erroring, its the definition of the converter itself |
16:11:43 | disruptek | i guess my last lady visitor drank up the vermouth. |
16:12:03 | Zevv | next time, shoot her, rain or not |
16:12:34 | Zevv | but what about the converter. what do i put in whose box |
16:12:48 | Zevv | because I tried putting thing in boxes |
16:12:52 | Zevv | but that didn't work out |
16:13:25 | Zevv | these are pretty nasty generics like this |
16:13:31 | Zevv | [T1, T2, W1, W2] |
16:13:32 | Zevv | brr |
16:14:26 | * | dsrw quit (Quit: Textual IRC Client: www.textualapp.com) |
16:14:43 | * | dsrw joined #nim |
16:14:54 | disruptek | i dunno how this can work. |
16:15:07 | Zevv | but I still respect you |
16:15:15 | disruptek | weird. |
16:15:22 | Zevv | yes, I should loathe you |
16:15:37 | disruptek | well, let's not go overboard. |
16:15:58 | Zevv | but as always the question arises: is this a bug, and/or am I plain stupid? |
16:16:28 | Zevv | the prefered answer on #nim is "generics cant instantiate on return type" |
16:16:50 | disruptek | nah. |
16:17:03 | disruptek | this isn't that. you aren't providing types anywhere. |
16:17:16 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
16:17:23 | disruptek | it's like an equation it cannot solve because there are too many variables. |
16:17:29 | Zevv | sure. I know that. |
16:17:41 | disruptek | make it work as procs, first. i'm wary of the converter interaction. |
16:17:47 | Zevv | Thus came my original question: would you know some way to do this consise and neat |
16:17:57 | Zevv | I normally don't use converters. |
16:18:01 | Zevv | but when I do |
16:18:03 | Zevv | I do it for PMunch |
16:18:17 | disruptek | they have such limited use. |
16:18:41 | Zevv | My problem is that I have a type that is a "specified" FixedPoint type |
16:18:48 | Zevv | like Speed being a FixedPoint[int8, 2] |
16:18:57 | Zevv | Now I want to assign a variable of type Speed with a float |
16:19:03 | Zevv | and this float should only exist a compile time |
16:19:12 | Zevv | and even better, I want to do that with arrays or seqs as well |
16:19:23 | Zevv | that was my original intent. The converters came in as a side effect when I wasn't looking |
16:19:32 | disruptek | yeah, it doesn't work as a converter but it works as a proc. |
16:20:07 | Zevv | yeah, but then you have to repeat your type. Like 'uint8, 2' |
16:20:11 | Zevv | but I want to talk about Speed |
16:20:58 | disruptek | seems to be due to interaction with other stuff. |
16:21:07 | Zevv | it's like life |
16:21:19 | disruptek | messy. |
16:21:23 | Zevv | messy. |
16:21:54 | disruptek | i tried to get into a house last night and there was a huge spider on the handle of the door. |
16:22:01 | disruptek | i was like, "not tonight, motherfucker!" |
16:22:08 | * | snowolf quit (Remote host closed the connection) |
16:22:26 | Zevv | and who's house was that |
16:22:30 | * | dsrw_ joined #nim |
16:22:30 | disruptek | knocked him off and go inside. then when i went to leave, i slipped on the steps and fell on my ass. |
16:22:39 | disruptek | the door hit me in the face twice. |
16:22:46 | Zevv | and the spider? |
16:22:51 | disruptek | if they don't get me comin', they get me goin'. |
16:23:01 | disruptek | dunno what happened to the spider. |
16:23:03 | Zevv | messy. |
16:23:06 | disruptek | messy. |
16:23:12 | * | dsrw quit (Quit: Textual IRC Client: www.textualapp.com) |
16:23:16 | * | snowolf joined #nim |
16:23:25 | Zevv | ok, I'll see if I can macro this somehow |
16:23:33 | disruptek | holdon, i'm not done with it. |
16:23:41 | Zevv | neither am I |
16:24:37 | disruptek | its fundamentally never going to work because it has no idea what you're trying to create. |
16:25:25 | Zevv | well, the converter ist |
16:25:32 | Zevv | what I want to do is basicalyl this: |
16:25:34 | disruptek | you need a converter that converts to Speed. |
16:25:35 | Zevv | var a: Speed = 3.1415 |
16:25:39 | * | dsrw_ is now known as dsrw |
16:25:45 | Zevv | yes, but I don't want to make a converter for every thing |
16:25:46 | disruptek | or, make Speed.set. |
16:25:48 | Zevv | Nim knows what Speed is |
16:25:58 | Zevv | Speed is a FixedPoint[int8, 2] |
16:26:06 | Zevv | so I don't want to have to say that twice |
16:26:10 | Zevv | I have kids for that |
16:26:40 | disruptek | where do you need the converter? |
16:26:55 | Zevv | var dx: Speed = -1.3 |
16:27:04 | Zevv | Initialization stuff. I want to talk human floats in my source |
16:27:12 | disruptek | ahhh, okay, lemme see. |
16:27:36 | Zevv | or var ss: seq[Speed] = @[ -1.3, 2.4 ] |
16:29:22 | disruptek | seems like this should be possible, then. |
16:30:11 | FromGitter | <cloudhan> `var a = 1 -2` triggers a compiling error, is the space significant or it is a compiler bug? |
16:30:20 | disruptek | stupid return value dispatch. |
16:31:19 | disruptek | cloudhan: - is a unary operator. |
16:31:31 | Zevv | space is significant. This parses as `var a = (1) (-2)` |
16:31:38 | Zevv | it's deliberate |
16:33:40 | disruptek | the irony is that converters are by their very nature "dispatch on return type." |
16:34:31 | Zevv | until they don't |
16:34:49 | Zevv | they are like generic methods. The work. Sometimes. |
16:35:22 | disruptek | we need to prime the pump. |
16:37:46 | disruptek | #2869 |
16:37:48 | disbot | https://github.com/nim-lang/Nim/issues/2869 -- 3Generic converter with no generic param doesn't compile when there is another generic converter with the same name ; snippet at 12https://play.nim-lang.org/#ix=2vd8 |
16:41:43 | Zevv | not sure if this is my problem, is it? |
16:42:00 | disruptek | no, just funny coincidence. |
16:42:00 | Zevv | hm it is |
16:42:05 | disruptek | nah. |
16:42:13 | Zevv | n't |
16:42:24 | Zevv | i wasn't done typing |
16:42:27 | Zevv | have patience |
16:42:36 | disruptek | lol |
16:43:33 | disruptek | #4554 |
16:43:34 | disbot | https://github.com/nim-lang/Nim/issues/4554 -- 3converter fails to work with multiple generic types |
16:44:44 | Zevv | "showstopper" |
16:44:47 | Zevv | ha. ha. |
16:45:08 | disruptek | zah is working on it. |
16:45:16 | Zevv | since 2017 |
16:45:23 | disruptek | these things take time. |
16:45:30 | disruptek | you want it done right, don't you? |
16:46:56 | disruptek | some day i'm going to have to learn the frontend. |
16:49:47 | FromDiscord | <Rika> how do i increase the buffer size of stdio (and is this even a good idea?)a |
16:49:51 | FromDiscord | <Rika> (edit) 'idea?)a' => 'idea?)' |
16:50:18 | leorize[m] | why would you want to increase the buffer size? |
16:51:42 | FromDiscord | <Rika> i feel like the flickering when i write to the same line is because the buffer is flushed out before i manually flush it |
16:53:16 | disruptek | are you using a single write? |
16:53:42 | FromDiscord | <Rika> no |
16:53:44 | disruptek | Zevv: use a macro. |
16:53:48 | FromDiscord | <Rika> let me try that |
16:55:16 | FromDiscord | <Rika> seems to be better yeah |
17:00:16 | * | vsantana joined #nim |
17:04:30 | * | vsantana quit (Client Quit) |
17:08:29 | Oddmonger | does «const» belong to macros ? |
17:08:40 | Oddmonger | i think so, but not sure |
17:09:12 | dsrw | I'm trying to better understand how procs returning `var string` are supposed to work, specifically https://github.com/nim-lang/Nim/blob/devel/lib/pure/parsecsv.nim#L336. It seems like a `var string` proc doesn't have to return anything, but, if it doesn't, there's no way to check for `nil`, so it's basically a guaranteed SIGSEGV. |
17:09:14 | * | kenran joined #nim |
17:10:59 | dsrw | Do I have that right? Is this behaviour something that may change in the future? |
17:11:47 | FromDiscord | <Rika> wdym? strings arent nilable? |
17:12:22 | FromDiscord | <Rika> ah wait |
17:12:33 | leorize[m] | dsrw: that example is two years old |
17:12:56 | leorize[m] | I'm pretty sure a lot have changed since :P |
17:13:31 | dsrw | Agreed, but in this case you still get the SIGSEGV, at least on 1.2.6. |
17:14:05 | * | kenran quit (Ping timeout: 240 seconds) |
17:14:24 | leorize[m] | ah yea, the compiler should enforce a return value for `var T` |
17:14:56 | leorize[m] | the fix for that module in particular is to just throw a KeyError exception |
17:16:00 | dsrw | Ok. That's what I thought. I'll check github for a similar issue, and file one if it doesn't exist. Thanks! |
17:16:27 | dsrw | (and maybe submit a fix for parsecsv while I'm at it) |
17:18:27 | disruptek | there are a few cases like that in stdlib. |
17:20:09 | Zevv | so, I use a macro, right |
17:20:12 | Zevv | the pain |
17:20:13 | Zevv | the agony |
17:20:51 | dsrw | Any thoughts on why that proc is using `var string` to begin with? |
17:22:44 | dsrw | It seems like `string` would be fine. I can't think of why you'd need to mutate the result. |
17:24:20 | PMunch | Zevv, aaw you're even using converters for me :) I guess I have to seriously consider your marriage proposal :P |
17:24:34 | Zevv | nope, converters are out. broken, so broken |
17:24:41 | Zevv | I now need to do macros with types |
17:24:44 | Zevv | the things I do for love |
17:25:00 | Zevv | How the *Hell* do I get to the generics passed to my FixedPoint from inside the macro |
17:25:16 | Zevv | Usually I try all permutations of getType, getTypeImpl and getTypeInst until I get something that looks ok |
17:25:17 | FromDiscord | <Clyybber> Zevv: Whats the W generic param for? |
17:25:19 | Zevv | but it's not coming out today |
17:25:31 | Zevv | Bits after the comma |
17:25:32 | FromDiscord | <Clyybber> oh, I see it now |
17:25:34 | FromDiscord | <Clyybber> yeah |
17:25:35 | Zevv | static(int) |
17:25:56 | Zevv | making fixed point libs with fixed sizes is for sissies |
17:25:59 | Zevv | real men do this fully generic |
17:26:07 | FromDiscord | <Clyybber> yeah |
17:26:09 | Zevv | and run into compiler bugs on the road |
17:26:18 | Zevv | then we summon our knight |
17:26:23 | Zevv | may he slay these monsters for us |
17:26:29 | FromDiscord | <Clyybber> and scream NIM NIM NIM |
17:26:47 | Zevv | no, we just *say* that |
17:27:11 | Zevv | so are there more getTypeThings I can do |
17:27:20 | PMunch | Haha, I seriously need to order one of those tshirts |
17:27:23 | Zevv | I know my S is a FixedPoint |
17:27:28 | Zevv | but I don't know what's in the box |
17:27:29 | PMunch | I wonder if FOSDEM 2021 will happen.. |
17:27:36 | PMunch | Oh well, got to go |
17:27:38 | * | PMunch quit (Quit: leaving) |
17:27:45 | Zevv | PMunch: until we meet again! |
17:28:47 | disruptek | stupid concepts. |
17:29:52 | Zevv | stupid macros |
17:29:57 | Zevv | can't get to my genericParams |
17:32:21 | Zevv | How the *hell* was I supposed to know that there is a `symbol` field in my getTypeInst[1] that I can do getImpl on |
17:32:25 | Zevv | how. how?! |
17:47:39 | disruptek | leorize[m]: i'm attempting to adapt your ci. naively edited the file and pushed it. |
17:48:13 | disruptek | far superior to travis so far. |
17:48:31 | disruptek | if it's really this easy, i will integrate it into nimph asap. |
17:54:56 | disruptek | leorize[m]: if this stuff only looks at changes to src/ or tests/ then that's a problem; it should track .cfg, .nimble, .nims files, too, and any .nim that isn't in src/ as well. |
17:54:57 | * | narimiran joined #nim |
17:57:05 | Zevv | https://github.com/nim-lang/Nim/issues/15225 |
17:57:07 | disbot | ➥ Generic converter: cannot instantiate ; snippet at 12https://play.nim-lang.org/#ix=2vdA |
17:57:29 | Zevv | I must just be doing something wrong. This is a very simple thing. |
17:57:41 | Zevv | disruptek: what's "leorize's ic" ? |
17:58:01 | * | bra-ket joined #nim |
17:58:23 | disruptek | that repro crashes dust. |
17:58:52 | FromDiscord | <Clyybber> Zevv: Why would that work |
17:58:54 | disruptek | leorize has been developing github actions for nim test matrices. |
17:58:57 | FromDiscord | <Clyybber> Your T is floating in the air |
17:59:17 | * | zyklon quit (Ping timeout: 260 seconds) |
17:59:23 | Zevv | clyybber: I must be stupid today. 's' has a type, right? |
17:59:27 | disruptek | because it's typed. |
17:59:27 | Zevv | T is 'uint8' for s |
17:59:27 | FromDiscord | <Clyybber> because nim doesn't have return type overloading |
17:59:37 | FromDiscord | <Clyybber> yeah, but nim doesn't have that feature |
17:59:42 | Zevv | but isn't that the whole thing for converters? |
17:59:42 | FromDiscord | <Clyybber> *yet* |
17:59:49 | Zevv | isn't that what converters *are* |
17:59:52 | FromDiscord | <Clyybber> fair point |
17:59:55 | FromDiscord | <Clyybber> lol |
18:00:53 | disruptek | the irony is that converters are by their very nature "dispatch on return type." |
18:00:57 | Zevv | so, should i delete the issue then? |
18:01:02 | disruptek | no. |
18:01:10 | Zevv | but now everybody will think I am stupid |
18:01:14 | Zevv | s/think/know/ |
18:01:16 | disruptek | nah. |
18:01:18 | Zevv | we can't have that |
18:01:43 | disruptek | hey i fixed my stupid macro exception issue. |
18:01:59 | Zevv | which one of your stupid macro exception issues is that |
18:02:03 | FromDiscord | <Clyybber> nah everybody will say, you stupid |
18:02:08 | FromDiscord | <Clyybber> and then realize me stupid |
18:02:18 | Zevv | and then realize clyybber stupid? |
18:02:26 | FromDiscord | <Clyybber> disruptek: Fixed as in fixed in nim? |
18:02:30 | FromDiscord | <Clyybber> Zevv: ye |
18:02:36 | Zevv | hehe |
18:03:07 | disruptek | nah. |
18:03:31 | disruptek | #15160 |
18:03:33 | disbot | https://github.com/nim-lang/Nim/issues/15160 -- 5exceptions codegen broken inside macros ; snippet at 12https://play.nim-lang.org/#ix=2vdJ |
18:03:52 | disruptek | someone might decide that it's still a bug, but i'm okay with separate symbols. |
18:04:10 | FromDiscord | <Clyybber> Can you explain what symbols you mean? |
18:04:21 | disruptek | except Foo as bar: # symbol bar |
18:04:37 | FromDiscord | <Clyybber> and you can't have an except Bar as bar after that? |
18:04:42 | disruptek | right. |
18:04:45 | FromDiscord | <Clyybber> Thats a bug |
18:04:46 | Zevv | that's funny |
18:04:49 | disruptek | not with the same gensym'd bar. |
18:04:57 | FromDiscord | <Clyybber> well |
18:04:58 | Zevv | it's a different scope, isn't it? |
18:05:01 | disruptek | it is. |
18:05:02 | FromDiscord | <Clyybber> hmm |
18:05:10 | * | myphs joined #nim |
18:05:16 | FromDiscord | <Clyybber> you using the same sym is weird for sure |
18:05:34 | FromDiscord | <Clyybber> so yeah, not a bug, but could have a nicer error message I suppose |
18:05:38 | * | vsantana joined #nim |
18:06:03 | disruptek | if you could do that, you could probably solve the bug. |
18:06:24 | Zevv | hehe |
18:06:24 | * | kungtotte quit (Read error: Connection reset by peer) |
18:09:53 | * | kungtotte joined #nim |
18:11:04 | leorize[m] | "disruptek" (https://matrix.to/#/@freenode_disruptek:matrix.org): I only track those folder due to how my project structure work |
18:11:27 | disruptek | yep. |
18:11:36 | leorize[m] | you can use a generic "on: [push, pull_request]" and it will run on those events unconditionally |
18:12:08 | Zevv | disruptek: https://axelforsman.tk/2020/08/24/rust-style-futures-in-c.html |
18:12:21 | disruptek | yeah, i haven't read it yet. |
18:12:26 | Zevv | neither have I :) |
18:12:40 | FromDiscord | <Clyybber> wait, I'm not crazy right. defined and declared is not the same |
18:12:49 | * | hyiltiz quit (Ping timeout: 264 seconds) |
18:13:17 | disruptek | i dunno what declared is. |
18:13:31 | FromDiscord | <Clyybber> it checks if a symbol is declared |
18:13:38 | FromDiscord | <Clyybber> and defined checks if its defined |
18:13:54 | FromDiscord | <Clyybber> via -d and the like |
18:13:59 | FromDiscord | <Clyybber> the weird thing is |
18:14:02 | FromDiscord | <Clyybber> they share a magic |
18:14:09 | disruptek | lol |
18:14:33 | disruptek | maybe declared works on defines. |
18:14:42 | * | Zectbumo joined #nim |
18:14:44 | Zevv | ok I read it. it sucks |
18:14:49 | disruptek | Zevv: that's the kind of article dom96 will like. |
18:14:53 | FromDiscord | <Clyybber> not really, their implementation simply branches on the name of your invocation |
18:15:02 | disruptek | he loves to use other language designs as justification. |
18:15:05 | Zevv | it's duffs fake coroutines with futures |
18:15:15 | * | tane joined #nim |
18:15:29 | Zevv | the do the duffs thing because they must in C. Rust knows how to do the cps |
18:15:34 | Zevv | "turn the code into a state machine" |
18:15:37 | Zevv | hell yeah |
18:15:58 | Zevv | once you did that properly, you can drop the futures |
18:16:19 | Zevv | "The coroutines for implementing the future state machine we have described are stackless," |
18:16:44 | Zevv | "CPS is just about moving the stack to the heap" - Zevv |
18:16:55 | disruptek | not just that. |
18:17:03 | disruptek | the stack becomes dynamic. |
18:17:06 | Zevv | anyway, PMunch, you can do that fixedpoint stuff yourself. I hate this |
18:17:09 | disruptek | you can resize it, retype it, etc. |
18:17:19 | FromDiscord | <Clyybber> Zevv: :( |
18:17:22 | Zevv | daft punk should make a song about that |
18:17:27 | FromDiscord | <Clyybber> lol |
18:17:32 | disruptek | i don't know how to do things like clone stacks without cps. |
18:17:54 | Zevv | clone where to? there is only one stack |
18:17:58 | Zevv | so yes |
18:18:40 | * | vicfred quit (Read error: Connection reset by peer) |
18:18:47 | * | vicfred_ joined #nim |
18:30:29 | Zevv | so now instead of doing smart things with generic converters |
18:30:38 | Zevv | I now create a template that defines the type and also makes a converter |
18:30:46 | FromDiscord | <Clyybber> why though |
18:30:50 | FromDiscord | <Clyybber> why all this stuff |
18:30:56 | Zevv | because of love |
18:31:07 | FromDiscord | <Clyybber> why not simply say make your conversions explicit |
18:31:12 | * | disruptek will eat for food. |
18:31:14 | FromDiscord | <Clyybber> nobody likes implicit conversions anyways |
18:31:19 | Zevv | Clyybber: it's *too* explicit |
18:31:29 | Zevv | No I don't need *converters* perse |
18:31:35 | Zevv | but I need functions to work with my 'friendly' types |
18:31:37 | * | vsantana quit (Read error: Connection reset by peer) |
18:31:37 | FromDiscord | <Clyybber> Zevv: what is |
18:31:38 | disruptek | i think he lost a bet with pmunch. |
18:31:46 | FromDiscord | <Clyybber> what is too explicit |
18:31:46 | * | vsantana joined #nim |
18:31:50 | Zevv | I have a type 'Speed' which is 'FixedPoint[int16, 4]' |
18:31:55 | Zevv | I want to be able to convert 3.5 to Speed |
18:31:56 | FromDiscord | <Clyybber> yeah |
18:32:01 | FromDiscord | <Clyybber> Speed(3.5) |
18:32:06 | FromDiscord | <Clyybber> is what should be possible |
18:32:07 | Zevv | No, that's wrong |
18:32:19 | * | andinus quit (Remote host closed the connection) |
18:32:20 | Zevv | speed is a distinct int type |
18:32:24 | Zevv | so that will just assign 3 |
18:32:41 | FromDiscord | <Clyybber> overwrite the explicit conversion |
18:32:47 | Zevv | how |
18:32:54 | Zevv | `=` ? |
18:33:05 | FromDiscord | <Clyybber> define a proc with the same name |
18:33:10 | Zevv | dude |
18:33:12 | FromDiscord | <Clyybber> I'm not sure that will overwrite it tho |
18:33:14 | Zevv | really |
18:33:14 | disruptek | leorize[m]: why does this ci build nim instead of using your nightlies artifacts? |
18:33:33 | * | hyiltiz joined #nim |
18:33:33 | * | hyiltiz quit (Changing host) |
18:33:33 | * | hyiltiz joined #nim |
18:33:47 | Zevv | Clyybber: you're just making this up, are you |
18:33:51 | FromDiscord | <Clyybber> nah |
18:34:28 | Zevv | redefinition of 'Speed', previous declaration here |
18:34:45 | FromDiscord | <Clyybber> ah, damnit. |
18:34:55 | FromDiscord | <Clyybber> Then it must have worked because I had the original type not exported |
18:35:03 | FromDiscord | <Clyybber> well, I think we should make it work |
18:35:06 | FromDiscord | <Clyybber> make it an idiom |
18:35:09 | disruptek | honestly, this is the sort of abstraction that we need to get right. |
18:35:21 | disruptek | it has to be easier than this to hide stuff. |
18:35:34 | Zevv | but then again: `Speed` is a derived type. I don't want to create a proc to make a Speed every time I define the type |
18:35:44 | Zevv | the user makes his type, and then should be able to work with it |
18:35:54 | Zevv | you can't ask the user to define the type as a specific FixedPoint |
18:36:00 | Zevv | and then also create a proc to do the conversion |
18:36:01 | disruptek | point made, zevv, just need to decide which bugs you must fix to achieve it. |
18:36:23 | Zevv | just let me make my point, damnit! |
18:37:45 | * | hyiltiz quit (Ping timeout: 240 seconds) |
18:40:22 | leorize[m] | disruptek: scripting to get the latest artifact is a PITA, not to mention that my new nightlies still hasn't been merged |
18:40:37 | leorize[m] | I've an idea on how to solve the former, so there's that |
18:40:46 | disruptek | hmm, lemme know if i can write something. |
18:41:23 | disruptek | this stuff should be much easier once king's graphql is ready. |
18:42:27 | * | hyiltiz joined #nim |
18:42:27 | * | hyiltiz quit (Changing host) |
18:42:27 | * | hyiltiz joined #nim |
18:43:42 | * | Jesin quit (Quit: Leaving) |
18:43:44 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
18:44:17 | * | pbb joined #nim |
18:49:40 | * | pbb quit (Remote host closed the connection) |
18:50:54 | * | pbb joined #nim |
18:51:10 | * | Jesin joined #nim |
18:51:45 | * | Zectbumo quit (Read error: Connection reset by peer) |
18:55:38 | * | a_b_m joined #nim |
18:55:56 | * | waleee-cl joined #nim |
18:57:42 | FromGitter | <kingramx> I searched whole the internet including deepweb and darkweb :/ and couldn't find anything about how retrieve json-data from .json file and use them in .nim file ⏎ could someone please help ??? |
18:59:06 | * | abm quit (Ping timeout: 260 seconds) |
19:00:17 | krux02 | disruptek, I have a question about math.round, why was it undeprecated? |
19:00:27 | Zevv | I'm pretty sure the darkweb should have that info kingramx |
19:00:31 | FromDiscord | <özgürlük> I'd like to ask a question, is there a library for making discord bots in nim? |
19:00:39 | disruptek | did i undeprecate math.round? |
19:00:50 | FromDiscord | <Rosen> json parsing is a dark art |
19:00:56 | krux02 | oh sorry, you did not it was narimiran |
19:00:59 | FromDiscord | <Rika> @özgürlük `dimscord` |
19:01:03 | krux02 | not you |
19:01:05 | disruptek | okay. |
19:01:24 | krux02 | narimiran, why did you undeprecate math.round? |
19:01:32 | krux02 | https://github.com/nim-lang/Nim/pull/15224 |
19:01:33 | disbot | ➥ remove deprecation from `math.round` |
19:01:42 | Zevv | kingramx: did you also happen to read the 'json' library page of the nim stdlib documentation? |
19:02:06 | FromDiscord | <özgürlük> @Rika thanks, the discord library i searched was super outdated |
19:02:20 | narimiran | krux02: yes, i did it, because we decided it is the best to de-deprecate it |
19:02:29 | krux02 | best for what? |
19:02:45 | krux02 | I deprecated it, because it should be removed without substitution. |
19:02:51 | narimiran | IYO |
19:02:59 | krux02 | ? |
19:03:34 | krux02 | what does IYO mean? |
19:03:38 | narimiran | in your opinion |
19:03:54 | FromDiscord | <Clyybber> If we deprecate it we should replace it with quantize |
19:04:05 | disruptek | lol |
19:04:07 | FromDiscord | <Clyybber> but not this weird "drop your round in" implementation of quantize |
19:04:11 | krux02 | why replace it with anything? |
19:04:24 | FromDiscord | <Clyybber> because a stdlib should provide stuff you often need |
19:04:30 | FromDiscord | <Rika> because many programmers use round? |
19:04:34 | FromGitter | <alehander92> krux02 there is a quantize pr |
19:04:35 | FromDiscord | <Rika> and think of using round? |
19:04:40 | FromGitter | <alehander92> maybe he's not aware of it |
19:04:48 | FromDiscord | <Clyybber> alehander92: That one was closed, he's talking about that pr |
19:04:55 | krux02 | I argued that decimal rounding in a math library for binary numbers doesn't make sense and serves no purpose. |
19:04:56 | FromGitter | <alehander92> ah sorry |
19:05:11 | FromGitter | <kingramx> @Zevv yeah, I read that doc but u know document does not contain anything about how to retrieve data from json file and only talks about how to parse our data into json |
19:05:45 | narimiran | "serves no purpose" -- citation needed |
19:05:45 | krux02 | decimal rounding does make sense if you have a decimal floating point number type (they do exist) |
19:05:48 | FromDiscord | <Rika> the math library works on binary-represented numbers but they process in decimal |
19:06:11 | disruptek | kingramx: let js = parseJson(readFile("somefilename.json")) |
19:07:29 | krux02 | narimiran, "decimal rounding [...] serves no purpose", krux02:21:04:55 |
19:07:38 | krux02 | there, I cited myself :P |
19:07:44 | disruptek | makes sense to me. |
19:07:53 | disruptek | i mean, krux02's argument. |
19:08:01 | narimiran | great, now i'm going to enjoy my evening. ping me tomorrow if you want to argue some more |
19:08:54 | krux02 | narimiran, I read the issue that is linked to the PR that you made, but I don't see the use case for the rounding function that you want to preserve. |
19:09:10 | krux02 | The only use case originally was for printing and there it didn't work reliably. |
19:09:17 | * | quetzalb quit (Remote host closed the connection) |
19:09:26 | krux02 | therefore there was the message to use strutils instead |
19:09:35 | krux02 | the message that you gracefully removed. |
19:10:04 | * | kenran joined #nim |
19:10:26 | disruptek | narimiran: is it a bad idea to backport exitprocs? |
19:10:55 | krux02 | narimiran, did you leave? |
19:11:00 | narimiran | disruptek: link? |
19:11:03 | narimiran | krux02: trying to |
19:11:06 | FromDiscord | <Lod> clear |
19:11:07 | FromGitter | <kingramx> @disruptek Really thanks for this |
19:11:23 | disruptek | narimiran: it's a module in std? |
19:11:25 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
19:11:39 | FromDiscord | <haxscramper> When I use `{.byaddr.}` in macro I get `Error: invalid pragma: byaddr` error. Example: https://play.nim-lang.org/#ix=2ve5 . What can cause this? |
19:11:55 | FromDiscord | <haxscramper> Using it for regular variables works as expected |
19:11:59 | krux02 | narimiran, I am trying to get an explanation from you. |
19:12:16 | krux02 | I would really like to know about the use case for the deprecated round function. |
19:12:31 | disruptek | kingramx: hope it helps. |
19:13:01 | narimiran | disruptek: i'll see tomorrow about it |
19:13:01 | krux02 | I can only think of use cases where `round` would be an false friend that provides you with something that doesn't work |
19:13:25 | disruptek | narimiran: i have no opinion. just noticed tests failing. 😉 |
19:13:50 | krux02 | and that is why I wanted the function to be gone. |
19:14:18 | * | pbb joined #nim |
19:14:34 | disruptek | krux02: maybe it's enough just to provide a compile-time warning. |
19:15:03 | krux02 | like one that {.deprecated.} would provide? |
19:15:17 | * | kenran quit (Ping timeout: 265 seconds) |
19:15:38 | disruptek | like that, but without intimating that the procedure will be removed. |
19:16:09 | krux02 | I think it should be removed. |
19:16:35 | krux02 | And in fork of Nim it is already removed, and it won't come back. |
19:17:49 | FromDiscord | <Rika> then do you propose division be removed as it isnt exact for floats either |
19:18:03 | disruptek | huh? |
19:18:19 | FromDiscord | <Rika> wasnt that the argument |
19:18:27 | krux02 | No |
19:19:15 | FromGitter | <kingramx> > *<disruptek>* @kingramx: hope it helps. ⏎ ⏎ It helped a lot ⏎ but I have another silly question: ⏎ Why retrieved data is surrounded by " " ? ... [https://gitter.im/nim-lang/Nim?at=5f4564334823780937418fd9] |
19:19:43 | krux02 | Rika: The argument is: Decimal rounding for binary floating point numbers is actually no rounding at all. |
19:21:12 | FromDiscord | <Rika> why so |
19:21:52 | krux02 | if you round 0.123 to 0.1 then it is the rounding that this function provides. |
19:22:00 | krux02 | but actually it isn't |
19:22:06 | krux02 | because 0.1 doesn't exist |
19:22:29 | krux02 | and the result of the rounding will use the full internal mantissa to try to represent 0.1 as precise as possible. |
19:23:08 | krux02 | In other words, you loose precision, yes, but you don't shorten the internal representation at all. |
19:23:33 | krux02 | a rounded is supposed to require fewer byets to represent it, but the opposite is the case |
19:24:06 | disruptek | kingramx: surrounded by " "? |
19:24:09 | disruptek | ~paste |
19:24:10 | disbot | paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek |
19:24:34 | FromDiscord | <lqdev> @haxscramper that pragma… doesn't exist |
19:24:44 | FromDiscord | <lqdev> did you mean {.byref.}? |
19:24:55 | FromDiscord | <lqdev> it's used to annotate _object types_ tho and not variables |
19:25:41 | FromDiscord | <haxscramper> https://nim-lang.org/docs/decls.html |
19:26:21 | FromGitter | <kingramx> > *<disruptek>* @kingramx: surrounded by " "? ⏎ ⏎ yes, surrounded by " " |
19:26:26 | FromDiscord | <haxscramper> It worked beautifully until I tried to put in macro |
19:27:03 | disruptek | kingramx: what does that mean? whitespace you didn't expect? paste the code into the playground or ix. |
19:27:24 | FromDiscord | <Kaynato> A question about template/macro appropriateness for code substitution: |
19:28:24 | FromDiscord | <haxscramper> > did you mean {.byref.}?↵@lqdev Actually I get the same error with `{.byref.}`, which means the question now is: "I get 'invalid pragma error' each time I try to use pragma on variable in `quote do`' |
19:28:39 | FromDiscord | <lqdev> that's odd |
19:28:51 | FromDiscord | <lqdev> maybe `quote` is doing some funny business with idents |
19:29:32 | FromDiscord | <Kaynato> More or less, I'm thinking about something to take in `proc(...): T`, a list of args to pass into that proc to fill some preceding argument spots, and do some things with calling the proc with that arg and some local variables, and then returning a `seq[T]` |
19:29:42 | FromDiscord | <Lod> Is there any nimble tutorial? |
19:30:56 | FromDiscord | <Kaynato> Would something like `template findInfo*[T](fun: proc(varargs[auto]): T, args: varargs[auto]): seq[T]` be possible/appropriate? Or would a macro be suggested? |
19:31:52 | FromDiscord | <lqdev> `proc(varargs[auto])` isn't valid syntax |
19:32:47 | FromDiscord | <Kaynato> I'm guessing that there's no good way to pass-through-distribute varargs from template to function? |
19:33:19 | FromDiscord | <Kaynato> And/or that there are ways but that they are discouraged vs using macro in this sort of use case? |
19:33:32 | FromDiscord | <haxscramper> Yes, it was due to `quote do:`. Interpolating `byaddr` as variable into pragma solved the issue. |
19:34:04 | FromGitter | <kingramx> > *<disruptek>* @kingramx: what does that mean? whitespace you didn't expect? paste the code into the playground or ix. ⏎ ⏎ https://play.nim-lang.org/#ix=2ved |
19:35:10 | planetis[m] | krux02: to be clear, the math module has two round procs, one with a ``places`` argument, the other without, would you remove both? |
19:36:50 | planetis[m] | i have a use case for round(x: float): float but not for the other one |
19:46:37 | * | superbia joined #nim |
19:52:35 | * | quetzalb joined #nim |
20:04:28 | * | vsantana quit (Quit: leaving) |
20:10:05 | * | myphs quit (Ping timeout: 258 seconds) |
20:13:29 | * | natrys joined #nim |
20:15:10 | * | drewr` quit (Remote host closed the connection) |
20:16:40 | * | drewr` joined #nim |
20:18:23 | * | Vladar quit (Quit: Leaving) |
20:18:54 | * | drewr` quit (Client Quit) |
20:19:43 | * | drewr joined #nim |
20:22:25 | disruptek | !requires gram |
20:22:26 | disbot | gram: 11disruptek/ram 71 total |
20:22:30 | * | narimiran quit (Quit: leaving) |
20:23:01 | * | MarderIII quit (Ping timeout: 264 seconds) |
20:23:18 | disruptek | kingramx: https://play.nim-lang.org/#ix=2vev |
20:24:00 | disruptek | (you wanna getStr() on the JsonNode to retrieve its string value as opposed to merely rendering it) |
20:26:27 | Zevv | well PMunch, for what it's worth: https://github.com/zevv/nimfix |
20:26:33 | Zevv | it might or might not be usable, I dunno |
20:29:25 | * | apahl quit (Ping timeout: 240 seconds) |
20:30:32 | * | apahl joined #nim |
20:31:15 | * | awe00 joined #nim |
20:32:25 | * | awe00_ quit (Ping timeout: 240 seconds) |
20:35:52 | krux02 | planetis[m]: Initially when I stumbled upon it, there was only the version with the two arguments (second argument with default value). I introduced the one argument round function, becaues it would make sense to have it and tagged the other one as deprecated. |
20:36:09 | krux02 | so to answer your question, round with one argument is fine. |
20:50:03 | FromGitter | <iffy> How do I fix this concept/type error? https://play.nim-lang.org/#ix=2veB Error: invalid type: 'var AsyncSocket' in this context: 'StringSocket[asyncnet.AsyncSocket]' for var |
20:52:59 | FromDiscord | <dom96> You can't have an `Option[var T]` |
20:53:11 | FromDiscord | <dom96> You can't even have an `Option[var string]` |
20:53:26 | FromGitter | <kingramx> > *<disruptek>* (you wanna getStr() on the JsonNode to retrieve its string value as opposed to merely rendering it) ⏎ ⏎ TNX A LOT |
20:53:33 | FromDiscord | <dom96> `var` can only be used in the context of proc parameter types |
20:55:14 | FromDiscord | <Varriount> (for now) |
20:58:44 | FromDiscord | <dom96> @Varriount oh? How so? |
20:59:32 | FromDiscord | <Varriount> dom96: I believe @timotheecour had plans to do stack escape analysis |
20:59:48 | FromDiscord | <Varriount> To allow using `var` in structures |
21:03:35 | * | NimBot joined #nim |
21:04:54 | FromDiscord | <dom96> cool |
21:04:54 | FromDiscord | <dom96> With `ref` it's not a big deal not to have this feature though |
21:04:55 | * | ForumUpdaterBot quit (Read error: Connection reset by peer) |
21:04:55 | * | ForumUpdaterBot joined #nim |
21:05:54 | disruptek | 🏀⚽ |
21:08:29 | disruptek | leorize[m]: actions looks really good, thanks. found my first matrix snafu, too. |
21:09:58 | disruptek | we don't care about backporting arc fixes that are fixed in devel, right? |
21:10:56 | * | kenran joined #nim |
21:11:23 | * | thomasross joined #nim |
21:15:55 | * | kenran quit (Ping timeout: 240 seconds) |
21:22:06 | * | lritter quit (Quit: Leaving) |
21:22:57 | * | tane quit (Quit: Leaving) |
21:23:51 | * | Jesin quit (Quit: Leaving) |
21:25:11 | * | natrys quit (Quit: natrys) |
21:26:04 | * | Jesin joined #nim |
21:33:47 | * | Sembei joined #nim |
21:51:51 | FromGitter | <alehander92> wow dude |
21:51:55 | FromGitter | <alehander92> i like football |
21:52:25 | * | solitudesf quit (Ping timeout: 240 seconds) |
21:52:26 | disruptek | where's my password generator? |
22:24:52 | FromDiscord | <Kaynato> Is there a sane way to extract one arg type of a function referred to by a compile-time generated identifier in a macro? |
22:25:47 | disruptek | sure; you can get the type of the symbol if the macro takes a typed input. |
22:27:07 | FromDiscord | <Kaynato> The proc's symbol is generated at compile-time - would it be possible to, after generating the identifier, to pass it into another macro that takes in typed? Or, since those would all be NimNodes, would it be already wrong |
22:27:20 | disruptek | nah, it'll work fine. |
22:28:00 | disruptek | you can write procs that operate on nodes, too, of course. |
22:28:07 | disruptek | they will be compile-time procs. |
22:37:10 | FromDiscord | <Kaynato> Hmm, so trying to inspect the proc directly after `let procName = newIdentNode(prefix & suffix.strVal)` doesn't work, since at that point it's only an Ident and not an actual typed proc |
22:37:40 | FromDiscord | <Kaynato> But if I first return it from this macro, and then, through the template, pass it into another macro, then I can treat it as typed? |
22:37:47 | disruptek | sure. |
22:38:33 | FromDiscord | <Kaynato> There's no way to directly bind the ident in the local scope? |
22:38:45 | disruptek | there is, but it's not /in/ local scope. |
22:38:53 | disruptek | it's just data at this point. |
22:39:13 | FromDiscord | <Kaynato> Ahh, that tracks. So I have to dip it through the actual scope to actualize it. |
22:39:28 | disruptek | you have to dip it through semantic analysis. |
22:39:50 | disruptek | the compiler has to get hold of it and figure out what it means before it can answer questions about it. |
22:40:27 | FromDiscord | <Kaynato> Right. Node manipulation / AST work is done before imports? |
22:40:51 | disruptek | i dunno what that means. |
22:42:22 | FromDiscord | <Kaynato> Ahhh. Ok. So the problem itself is that I'm constructing a macro to wrap certain vk calls so I eventually get a seq[T] out of it. |
22:42:24 | disruptek | you can produce your own ast nodes that import. that should probably answer your question. |
22:42:59 | FromDiscord | <Kaynato> The type T is not defined by the vk proc's return type but is rather in `ptr T` as the last arg to the function, which itself I am generating the ident of in the macro |
22:43:42 | disruptek | you're not generating the proc, only the ident of it? |
22:43:50 | FromDiscord | <Kaynato> Yes. |
22:44:04 | FromDiscord | <Kaynato> I'm trying to sidestep the current clunky temp of just passing the desired return type into the template itself and have it infer the return type from the argtype of the proc to which the ident refers |
22:44:35 | disruptek | sounds doable. |
22:45:05 | * | awe00 quit (Ping timeout: 240 seconds) |
22:45:29 | disruptek | it might be easier to just use a compile-time lookup table. |
22:46:55 | FromDiscord | <Kaynato> Something like finding all the procs of that pattern from vulkan and generate a table mapping their names to their ostensible return types, right? |
22:47:30 | disruptek | yeah; consider that you can do this at compile-time and have a table with nodes, etc. |
22:48:04 | FromDiscord | <Kaynato> https://pastebin.com/raw/Y7GCuhL6 |
22:49:16 | FromDiscord | <Kaynato> Currently broken pending edits to get rType from vkFuncName. I'm thinking that I have to first produce vkFuncName outside of vkGetMacro, get the lastArgType, and then pass that into vkGetMacro....? |
22:49:34 | disruptek | you've ruled out using the existing vulkan stuff made in nim? |
22:49:42 | disruptek | 'cause there are a few... |
22:49:55 | FromDiscord | <Kaynato> I'm working off clybber's |
22:50:09 | FromDiscord | <Kaynato> Frag as far as I can tell is still WIP |
22:51:23 | disruptek | you're using untyped nodes which probably won't have what you need to actually compose the proc name. |
22:51:29 | disruptek | unless i'm missing something. |
22:52:03 | FromDiscord | <Kaynato> I've been using it like `vkEnumerate[VkPhysicalDevice](PhysicalDevices, state.instance)` with the previous pass-in-return-type scheme |
22:52:48 | FromDiscord | <Kaynato> Works perfectly fine - the template passes the nodes into the macro and generates the code |
22:53:13 | FromDiscord | <Kaynato> I could possibly compromise with something like `vkGet(vkEnumeratePhysicalDevices, state.instance)`? |
22:53:39 | FromDiscord | <Kaynato> That way I'd be passing the proc as-is directly to the macro. Hm. |
22:54:11 | disruptek | well, i'd want to get stuff typed as early as possible. |
22:54:39 | disruptek | it's hard to do much untyped. to put that another way, it's easier to write bugs. |
22:55:15 | FromDiscord | <Kaynato> First mode is probably just a little redundant. I'll probably settle for passing in the vk function as-is instead of cutting corners with composing names |
22:57:19 | * | awe00 joined #nim |
22:57:26 | FromDiscord | <Kaynato> Thank you! |
22:58:21 | disruptek | sure; i think you have a better sense of where you're going than i do. 😉 |
22:59:26 | * | a_b_m quit (Read error: Connection reset by peer) |
23:05:30 | FromGitter | <alehander92> disruptek |
23:05:40 | FromGitter | <alehander92> dude i found my photos from hackathons in uni |
23:05:46 | FromGitter | <alehander92> i've had yellow-ish hair |
23:05:57 | FromGitter | <alehander92> we were all so naive |
23:05:58 | disruptek | lets see. |
23:08:52 | disruptek | at least your /went/ to uni. |
23:09:09 | disruptek | the only yellow hair i had was a girl named candy. |
23:10:25 | FromGitter | <alehander92> https://scontent-sof1-1.xx.fbcdn.net/v/t1.0-9/1003829_461438437310227_1085524231_n.jpg?_nc_cat=102&_nc_sid=e007fa&_nc_ohc=jbEY0PrJCKMAX9iNVrs&_nc_ht=scontent-sof1-1.xx&oh=5857183aa49e09703da176324c6e0936&oe=5F6A874D |
23:10:38 | disruptek | haha |
23:10:47 | disruptek | that's pretty bad. |
23:11:10 | disruptek | where's the hackathon code? |
23:11:27 | FromDiscord | <Clyybber> there is no code, it was all yellow hair |
23:11:45 | FromDiscord | <Clyybber> always has been |
23:11:46 | disruptek | oh, it was beautician's school. |
23:11:49 | * | kenran joined #nim |
23:12:14 | disruptek | yes, i realize 10 people are furiously paging through dictionaries now. |
23:13:12 | FromGitter | <alehander92> https://scontent-sof1-1.xx.fbcdn.net/v/t31.0-8/1404916_461722333948504_66767065_o.jpg?_nc_cat=105&_nc_sid=e007fa&_nc_ohc=kfXKWvLIKCIAX8p5U_0&_nc_ht=scontent-sof1-1.xx&oh=ed399fc86a2cbe173b1ba17b43d67180&oe=5F6BDEC2 |
23:13:17 | FromGitter | <alehander92> here i am on a computer! |
23:13:45 | FromGitter | <alehander92> with probably free food |
23:13:53 | disruptek | those were the days. |
23:14:02 | FromGitter | <alehander92> in an incredibly technological env |
23:14:10 | FromGitter | <alehander92> i wanted |
23:14:11 | FromGitter | <alehander92> dude |
23:14:19 | FromGitter | <alehander92> i failed my team and my friend |
23:14:30 | FromGitter | <alehander92> i finally i wanted to combine music with auto code linting |
23:14:43 | disruptek | wut |
23:14:54 | disruptek | clyybber: where is your skiplists pr? |
23:14:54 | FromGitter | <alehander92> so while you read your code and you're on a bad section it starts some heavy dramatic music |
23:14:57 | FromGitter | <alehander92> iirc |
23:15:16 | disruptek | hmm, code smell as a service. |
23:15:18 | disruptek | it's not crazy. |
23:15:37 | disruptek | to quote duran duran, "i smell like a sound" |
23:15:50 | disruptek | so surely we can hear a smell. |
23:15:56 | disruptek | a code smell. |
23:16:04 | FromGitter | <alehander92> https://www.facebook.com/media/set/?set=ms.c.eJxFk8dtQDEMQzcK1Mv~_iwURP53jA0VZzVHaJmW~_MdX5E2AHBznaxkTq4xawkENK0~%3B1xtY3u0t97~_XI~_Hjt9Hvv5Tcl9rP3xyvnjcYCdnJfv1b9zui9YRcFFTrCRGyzk~%3BXvf9sunamDGK~_ZjQa7T2Y~%3BqXj359aMG~%3B9BvcXqwHkN8MN4R34x35C~%3Bm9~_svl~%3B2FQndyQWe~_vP1Ysr~_Ye8~_YP~%3BtY6a~_bVzbrqzz~%3Bm2cNmHrffrKabGDOrxPM9xrzNeq4h3nzGwcz38Cf9OMekvegi~%3Bj~_Z~_jczw70z2~_ix7V |
23:16:04 | FromGitter | ... k5PenI571~%3Bh3IsZBvHjr0K~%3BahZMP8tMioR4N8~_9T~_~_jUXMHVHvDxuMN~%3B3~_0~_x9GP~%3Byv1bBJjxcfvSZD2Jfox6Xv~%3BB~_7RE~%3B0ou7Ef4XmHe0mTk5z1Yox9n~%3BX3~_fvX23WeUkm9~_kZzf3H569hfflO~_G.bps.a.461720503948687&type=1&__tn__=HH-R |
23:16:09 | FromGitter | <alehander92> oh no those links |
23:16:11 | FromGitter | <alehander92> ok i am stopping |
23:16:16 | Yardanico | just mirror it to imgur :) |
23:16:26 | FromGitter | <alehander92> sorry |
23:16:30 | Yardanico | that link looks like it'll take all my data |
23:16:38 | FromGitter | <alehander92> yeah i prefer my linters normal |
23:16:40 | FromGitter | <alehander92> and textual |
23:16:46 | * | kenran quit (Ping timeout: 258 seconds) |
23:17:00 | disruptek | why are you on gitter, anyway? |
23:17:06 | FromGitter | <alehander92> it's a bit eastern european |
23:17:12 | FromGitter | <alehander92> i cant pay my irc cloud service |
23:17:14 | disruptek | i can't find my can opener. |
23:17:21 | FromGitter | <alehander92> i know this is an absolute blast for normal people |
23:17:29 | disruptek | irc cloud service? |
23:17:31 | FromGitter | <alehander92> they would be like "paying .. your irc .. cloud .. dude " |
23:17:42 | disruptek | you can use my bouncer if you want. |
23:17:46 | FromGitter | <alehander92> but i am too lazy to setup my bouncer |
23:18:05 | FromGitter | <alehander92> and irccloud is just a very ok app and i was like ok give them money |
23:18:21 | FromGitter | <alehander92> how does this bouncer reuse work |
23:18:31 | disruptek | what? |
23:18:57 | FromGitter | <alehander92> "you can use my bouncer if you want" |
23:19:01 | disruptek | didn't i just open an old can of something yesterday? |
23:19:38 | disruptek | i can make you an account and then you can connect to it. |
23:19:40 | disruptek | what else? |
23:19:56 | FromGitter | <alehander92> ok, sounds .. good? |
23:20:01 | FromGitter | <alehander92> i have no idea how it all works |
23:20:15 | FromGitter | <alehander92> but it sounds legal |
23:20:17 | disruptek | lemme try to figure out my password. |
23:20:30 | disruptek | it's not the least legal thing i do. |
23:21:10 | disruptek | i just found a file named ruptek\u{17}u |
23:21:44 | disruptek | i think this is a bad sign. |
23:22:13 | disruptek | oh wait, do you have a static ip? |
23:26:21 | * | awe00 quit (Ping timeout: 256 seconds) |
23:31:16 | FromGitter | <alehander92> i |
23:31:22 | FromGitter | <alehander92> do i |
23:31:40 | FromGitter | <alehander92> how do i find out |
23:32:06 | disruptek | does your ip ever change? |
23:32:22 | FromGitter | <alehander92> i dont know man |
23:32:25 | disruptek | 'cause if it does, i have to teach the bot how to let you in or something. |
23:37:09 | * | krux02_ joined #nim |
23:39:25 | * | krux02 quit (Ping timeout: 240 seconds) |
23:41:26 | disruptek | what's good about microwaves is they kill most of the bugs. |
23:42:00 | FromGitter | <alehander92> yeah i am trying to figure it out |
23:42:05 | FromGitter | <alehander92> but not quite sure |
23:42:28 | FromGitter | <alehander92> it's not a big thing right now |
23:43:08 | disruptek | good, 'cause it's sounding complicated. |
23:43:30 | FromGitter | <alehander92> :) no |
23:46:11 | * | ptdel joined #nim |