00:00:04 | FromDiscord_ | <Zachary Carter> the only reason anyone looks at the generated JS / C source of Nim generally, is to figure out problems in the codegen |
00:00:04 | shashlick | cool o |
00:00:15 | shashlick | i'll check but its like using a global in a macro |
00:00:33 | FromDiscord_ | <Zachary Carter> shashlick - I'm reading: https://en.wikipedia.org/wiki/Hygienic_macro |
00:00:43 | xace | Zachary, my concern is a 80kb file generated for a hello world, but I do understand the circumstances |
00:01:02 | FromDiscord_ | <Zachary Carter> not sure if you were already familiar with this concept or not - I ran into it before when working on my web components lib |
00:01:07 | FromDiscord_ | <Zachary Carter> but I still don't fully understand it |
00:01:17 | xace | Zachary: nah I find a problem with having every client pull a large JS file which really shouldn't be that big |
00:01:42 | FromDiscord_ | <Zachary Carter> xace: yes - there is some boilerplate JS that gets created by Nim - but this is mostly (I think) to enable interop b/w Nim and JS |
00:02:13 | * | Jesin joined #nim |
00:02:22 | FromDiscord_ | <Zachary Carter> also - are you compiling with -d:release |
00:02:23 | FromDiscord_ | <Zachary Carter> ? |
00:02:33 | xace | possibly, I just wanted to look at the karax examples, I think I will give it a try for some project in a future, but my expectations will be set low for actual production |
00:02:43 | xace | yessir, karax -d:release |
00:02:49 | xace | karun* |
00:02:49 | FromDiscord_ | <Zachary Carter> either way - if you just want to write JS and keep it as slim as possible - you're not authoring JS with Nim anyway |
00:02:56 | FromDiscord_ | <Zachary Carter> nor are you using TypeScript or Flow |
00:03:22 | FromDiscord_ | <Zachary Carter> JS is flawed to begin with - everyone clamors for dynamic languages and bashes C/C++ for their terrible build systems |
00:03:28 | FromDiscord_ | <Zachary Carter> and then we end up with webpack - which is a linker |
00:03:50 | FromDiscord_ | <Zachary Carter> and half of the ecosystem revolves around adding type safety back into the language |
00:04:04 | xace | if i was the benevolent dictator, i would kill the web as it is today |
00:04:18 | FromDiscord_ | <Zachary Carter> many of us I think share the same sentiment |
00:04:26 | FromDiscord_ | <Zachary Carter> but do you try to keep up with the madness or just say eff it? |
00:04:38 | FromDiscord_ | <Zachary Carter> maybe we should just go back to JS and jquery |
00:04:47 | FromDiscord_ | <Zachary Carter> and put effort into not writing spaghetti code |
00:04:57 | xace | i avoid the web at all costs, and if I use it, i keep it very simple |
00:05:18 | FromDiscord_ | <Zachary Carter> yeah - but definitions of simplicity amongst web devs differ too |
00:05:36 | FromDiscord_ | <Zachary Carter> my general finding is that as soon as you escape the world of system programming |
00:05:51 | FromDiscord_ | <Zachary Carter> which I'm not very involved in / don't have a lot of knowledge about |
00:06:01 | FromDiscord_ | <Zachary Carter> opinions regarding software and quality tend to swing wildly |
00:06:21 | FromDiscord_ | <Zachary Carter> everyone in the systems programming world seems to agree on certain truths |
00:07:02 | FromDiscord_ | <Zachary Carter> folks in the web world will debate the most seemingly asinine of topics and act like it is the most important subject matter to ever be debated |
00:07:19 | FromDiscord_ | <Zachary Carter> like how to optimize CSS rules and shit |
00:08:16 | FromDiscord_ | <Zachary Carter> when they might as well be shipping an operating system with the amount of bandwidth you need to visit their website |
00:08:59 | FromGitter | <rayman22201> Nim isn't really designed to produce idiomatic JS output (nor idiomatic C in the C backend for that matter). It treats the back ends like "high level assembly" languages. Arguably the JS backend could be optimized but Nim is a small community, and it's not a high priority atm. |
00:10:18 | FromDiscord_ | <Zachary Carter> exactly |
00:10:27 | xace | yeah, I understand that. |
00:10:38 | FromDiscord_ | <Zachary Carter> I don't think the JS backend is bad - optimization wise anyway |
00:11:39 | * | sagax quit (Quit: Konversation terminated!) |
00:16:11 | FromGitter | <rayman22201> I do wonder how well the Nim JS backend would fare when put through a JS optimizer / tree shaker like Webpack: https://webpack.js.org/guides/tree-shaking/ |
00:16:41 | FromGitter | <timotheecour> good idea; this could be automated in nim js backend |
00:17:44 | FromGitter | <rayman22201> webpack is just so annoying / complex to setup... |
00:18:56 | FromGitter | <rayman22201> @timotheecour sorry for lagging on the js index thing. All my free time has been taken up with family stuff. |
00:19:11 | FromGitter | <rayman22201> I'm only on the chat as a sly distraction at work lol |
00:19:38 | FromGitter | <rayman22201> I haven't forgotten abut it though. I just wanted to let you know |
00:20:34 | FromGitter | <timotheecour> ok there’s still hope i goess ;-) |
00:20:48 | FromGitter | <rayman22201> lol |
00:21:02 | FromGitter | <timotheecour> btw the new `nimfind` gave me an idea of a non-static (real) webserver to backup docs |
00:21:04 | krux02 | @rayman22201 I don't think that the generated js code can be reduced a lot. Nim already generates the code in a lazy way. |
00:21:55 | FromGitter | <rayman22201> This is true. idk. It would be an interesting experiment |
00:21:57 | FromGitter | <rayman22201> Also, @zacharycarter I think you mentioned this, but getting Nim modules to map to JS modules would help. |
00:22:25 | FromGitter | <timotheecour> that webserver could be hosted locally ; and could support more interesting queries (eg based on argument types of a proc etc) |
00:23:12 | FromGitter | <timotheecour> right, ES6 modules could be used for that; in support of separate compilation (there was a forum post on this) |
00:23:48 | FromDiscord_ | <Zachary Carter> no |
00:23:50 | FromDiscord_ | <Zachary Carter> please no webpack |
00:24:15 | krux02 | rayman22201: what should the mapping to js modules bring? |
00:24:16 | FromDiscord_ | <Zachary Carter> use Parcel JS if you need a bundler |
00:24:30 | FromDiscord_ | <Zachary Carter> and again - webpack and parceljs etc are essentially just linkers for JSs |
00:24:45 | FromGitter | <timotheecour> the mapping could bring separate compilation, potentially for speedup |
00:24:46 | FromDiscord_ | <Zachary Carter> you can just use a CDN and tooling to accomplish a lot of this |
00:25:00 | FromDiscord_ | <Zachary Carter> use google closure compiler |
00:25:32 | FromDiscord_ | <Zachary Carter> there is a ton of nonsense in the webdev world - webpack is a major example of it |
00:26:17 | FromDiscord_ | <Zachary Carter> it's more difficult to use than gcc / clang |
00:26:29 | krux02 | timotheecour: I don't get that advantage for an interpreted language |
00:26:46 | FromGitter | <timotheecour> compilation time? |
00:26:47 | krux02 | nim has to touch every nim file on compilation |
00:26:56 | krux02 | yes |
00:27:23 | FromDiscord_ | <Zachary Carter> well ES6 modules are a different subject I think |
00:27:35 | krux02 | @zacharycarter there is a lot of nonsense in every topic when it becoms too popular |
00:27:41 | FromDiscord_ | <Zachary Carter> agreed |
00:27:50 | FromDiscord_ | <Zachary Carter> http://exploringjs.com/es6/ch_modules.html |
00:27:53 | FromGitter | <timotheecour> but if i modify foo.nim which is only imported by subset of nim files (modulo transitive closure), we don’t have to regenerate / recompile everythng |
00:27:55 | FromDiscord_ | <Zachary Carter> if you really want to understand the topic |
00:28:10 | FromDiscord_ | <Zachary Carter> isn't this the whole incremental compilation feature? |
00:28:18 | FromDiscord_ | <Zachary Carter> or is that only for the C backend? |
00:29:06 | FromDiscord_ | <Zachary Carter> https://twitter.com/JamesMcNellis/status/1063000460280377344 - has my interest |
00:29:15 | krux02 | when people who are certainly no experts are getting together and form groups and cheer each other in their non knowledge and nobody is there to say "no this is bullshit, stop doing it", then stese stupid solutions establish |
00:30:41 | FromDiscord_ | <Zachary Carter> this sounds like my job |
00:30:50 | krux02 | timotheecour: for the C backend the c files are generated every time, only the generated c files are generated in a stable way, so they don't need to processed further |
00:30:50 | FromGitter | <timotheecour> well point is single js output file definitely prevents incremental compilation |
00:30:58 | FromDiscord_ | <Zachary Carter> but when I say that - I almost get fired |
00:31:03 | krux02 | but compiling is always a complete rebuild of the project |
00:31:18 | FromDiscord_ | <Zachary Carter> timotheecour: I see what you mean |
00:31:21 | krux02 | there is effort to get incremental compilation in Nim, but nim isn't there yet. |
00:31:51 | FromDiscord_ | <Zachary Carter> the thing is |
00:31:57 | FromDiscord_ | <Zachary Carter> if you're really leveraging the modern webs tack |
00:32:08 | FromDiscord_ | <Zachary Carter> you're not just using Nim and compiling to JS - you're probably using babel |
00:32:11 | FromDiscord_ | <Zachary Carter> and then you're probably using a bundler |
00:32:29 | krux02 | @timotheecour: a single js output file is certainly not a blocker for incremental compilation. |
00:32:37 | FromGitter | <timotheecour> @krux02 actually is there some way to read more on that topic? there’s a nondocumented —incremental flag in nim but I’d like to understand it more what’s feasible today and what’s planned/doable soon |
00:32:48 | FromDiscord_ | <Zachary Carter> and then on top of that you're probably adding in hot reloading and all sorts of other complexity that the ecosystem has baked into it at this point |
00:33:09 | FromDiscord_ | <Zachary Carter> nothing about JS is lean or efficient |
00:33:17 | krux02 | well you have to hope Araq is online and chat with him about it |
00:33:22 | krux02 | but the feature is not ready yet |
00:33:34 | krux02 | the idea is to have a prototypec that works with a database |
00:33:49 | FromGitter | <timotheecour> ok so blurb / scratch docs yet? |
00:33:56 | krux02 | and there are changes in the language (restrictions) to even out the way for incremental compilation |
00:35:06 | krux02 | incremental compilation is in development, definitively to document anything, because it is not 100 decided on how it will work eventually. |
00:35:23 | FromDiscord_ | <Zachary Carter> what is 100% decided upon at this point haha? |
00:35:27 | krux02 | but to enable incremental compilation static vars have been restricted. |
00:35:36 | FromDiscord_ | <Zachary Carter> I mean - it's somewhat of a jab but it's also almost like wandering in a desert at this point when using Nim |
00:35:39 | FromDiscord_ | <Zachary Carter> and knowing what to expect next |
00:36:00 | FromDiscord_ | <Zachary Carter> or what will be formalized and hit prime time vs what is just experimental |
00:36:15 | FromGitter | <timotheecour> well that’s the point of early documentation, so ppl can give early feedback; but ok i guess it’s just not documented yet |
00:37:10 | krux02 | the problem Nim certainly has is, the community wants features, for example constructors, but they don't see the conflics and maintainance problems to actually implement these feauters. |
00:37:32 | krux02 | that delays a final v1 more and more. |
00:37:51 | krux02 | I see my job here to say No more often, so that a v1 can be reached |
00:39:09 | krux02 | For example, I want to exclude concepts from V1, because they are not necessary and cause problems. |
00:39:22 | krux02 | they should be there, but only behind an experimental flag. |
00:39:38 | FromGitter | <timotheecour> i mean they already kinda exist and r used in the wild |
00:39:54 | FromGitter | <timotheecour> (and yes, exponential CT time shd be fixed) |
00:40:08 | krux02 | it isn't even sure if it can be fixed |
00:40:27 | * | darithorn quit (Ping timeout: 250 seconds) |
00:40:51 | FromGitter | <timotheecour> ah 1st time i heard that; is there a post on that? |
00:41:50 | FromGitter | <timotheecour> I’d actually be in favor of https://github.com/nim-lang/Nim/issues/8774 as used in D; no exponential cost there, more flexibility |
00:42:24 | FromDiscord_ | <Zachary Carter> speaking of concepts - something I linked earlier - https://twitter.com/JamesMcNellis/status/1063000460280377344 |
00:42:25 | krux02 | as long as I don't know for sure that concepts won't introduce exponential compilation times or other compile time explosions I will fight them. |
00:42:26 | FromGitter | <timotheecour> and I don’t think it’d even be all that hard to implement |
00:42:42 | krux02 | I think it is no secret that I don't like them |
00:42:52 | FromDiscord_ | <Zachary Carter> I think Nim is bowing to community pressure to a degree and straying from its design goals |
00:43:12 | FromDiscord_ | <Zachary Carter> not that I find any fault in that - because I can only imagine how difficult it is not to want to satisfy your user base |
00:43:23 | FromDiscord_ | <Zachary Carter> but features need to be fully baked before new features are added |
00:43:38 | FromDiscord_ | <Zachary Carter> and when the language is billed as a language for game development and systems programming |
00:43:48 | FromDiscord_ | <Zachary Carter> we need to be feature complete in comparison to competitors |
00:43:51 | FromDiscord_ | <Zachary Carter> or at least offer alternatives |
00:43:53 | FromGitter | <timotheecour> well it’s chicken egg; that’s why we have —experimental flags |
00:43:56 | krux02 | yea, listening to the community is important. They really sense when something doesn't work, but they don't know how to fix the problems |
00:44:02 | FromDiscord_ | <Zachary Carter> well right |
00:44:24 | FromDiscord_ | <Zachary Carter> I guess my sentiment is - they shouldn't drive development - and they probably haven't |
00:44:30 | krux02 | the community has no idea how the compiler works internally, they often have ideas that sound great (if you don't know about any internals) |
00:44:31 | FromDiscord_ | <Zachary Carter> but there's so much in flight / flux that it's hard to keep up with it all |
00:44:57 | krux02 | I understand |
00:44:59 | FromDiscord_ | <Zachary Carter> I think getting the memory management stuff down pat - figuring out destructors and the new runtime are the most important |
00:45:05 | FromDiscord_ | <Zachary Carter> and it sounds like that's the current focus |
00:45:07 | * | V-X quit (Remote host closed the connection) |
00:45:08 | FromDiscord_ | <Zachary Carter> so I'm 100% on board |
00:45:09 | krux02 | I hate when things are in flux |
00:45:32 | FromDiscord_ | <Zachary Carter> and while I think zahary did amazing work on destruuuctors |
00:45:36 | FromDiscord_ | <Zachary Carter> err sorry - concepts |
00:46:00 | FromDiscord_ | <Zachary Carter> I still never found them practical and only saw one or two libraries that figured out how to use them to the benefit of the author |
00:46:16 | krux02 | I just have a nice idea, I wonder if I can implement all important features of concepts via macros. |
00:46:18 | FromDiscord_ | <Zachary Carter> but I don't know the background on how that was prioritize |
00:46:27 | FromDiscord_ | <Zachary Carter> but I don't know the background on how that was prioritized |
00:46:27 | krux02 | so that a big language feature can be dropped in favor of a library. |
00:46:50 | FromGitter | <zetashift> Isn't that partly because they are not stable yet and there is little documentation about it? |
00:47:06 | FromDiscord_ | <Zachary Carter> maybe - but concepts apparently aren't unique to Nim |
00:47:16 | FromDiscord_ | <Zachary Carter> that's another issue I've had - like when a I hear about a concept in Nim |
00:47:34 | FromDiscord_ | <Zachary Carter> I'm not sure if it's specific to Nim or implemented in another language or analogous to another feature in another language |
00:47:42 | FromDiscord_ | <Zachary Carter> and that's my lack of formal CS background - but it still sucks sometimes |
00:47:43 | krux02 | I haven't found a conccpts implementation in any language that I would want to use. |
00:48:12 | krux02 | there is interfaces in Java, and that is based on inheritance |
00:48:17 | FromDiscord_ | <Zachary Carter> Krux02: I'm glad you're on board tbh |
00:48:18 | FromGitter | <timotheecour> @krux02 but it’d still need some compiler support of course, correct? |
00:48:25 | FromDiscord_ | <Zachary Carter> mostly because you and Araq don't see eye to eye on everything |
00:48:32 | FromDiscord_ | <Zachary Carter> and it's going to be good to have another opinion in the house |
00:48:52 | FromDiscord_ | <Zachary Carter> especially one that is familiar with gfx programming |
00:49:34 | krux02 | thanks |
00:49:56 | krux02 | it was my idea to drop the math library from the standard library |
00:50:17 | FromDiscord_ | <Zachary Carter> yes - and if we still have those color libs |
00:50:19 | FromDiscord_ | <Zachary Carter> let's get rid of those too |
00:50:27 | FromDiscord_ | <Zachary Carter> 😛 |
00:50:40 | krux02 | never used them |
00:50:52 | FromDiscord_ | <Zachary Carter> likewise |
00:50:58 | FromGitter | <zetashift> Wait what math is getting dropped? |
00:51:03 | krux02 | they are more harmful than useful? |
00:51:15 | FromDiscord_ | <Zachary Carter> I'm not sure if the colors module is harmful |
00:51:20 | FromDiscord_ | <Zachary Carter> but I'd also question how useful it is |
00:51:26 | krux02 | zetashift: years ago there was some vector math for graphcis |
00:51:27 | FromGitter | <timotheecour> one conservative way to decide what goes in stdlib is : whatever’s used in stdlib goes in stdlib; the rest goes in nimble package |
00:51:29 | FromDiscord_ | <Zachary Carter> or if anyone is actually using it |
00:51:58 | krux02 | but nothing is missing, nim_glm is much better |
00:52:00 | FromGitter | <zetashift> oh yea that doesn't seem something you'd include like that in a stdlib |
00:52:16 | FromGitter | <zetashift> I thought the math module was getting dropped which seemed weird |
00:52:18 | FromDiscord_ | <Zachary Carter> nor do random hex color codes |
00:52:22 | FromDiscord_ | <Zachary Carter> https://nim-lang.org/docs/colors.html |
00:52:43 | FromDiscord_ | <Zachary Carter> like - the entire graphics module can go IMO |
00:52:54 | FromDiscord_ | <Zachary Carter> if it hasn't already |
00:53:04 | krux02 | another problem I would like to mention is, people constantly make PR's on strutils and math and add some functions they want to have |
00:54:05 | FromDiscord_ | <Zachary Carter> you need a robust string manipulation library |
00:54:26 | FromGitter | <zetashift> well that isn't bad on it's own, that be dependent on how solid the PR is no? |
00:54:26 | FromDiscord_ | <Zachary Carter> but I think it's enough to find a solid implementation in whatever language |
00:54:28 | FromDiscord_ | <Zachary Carter> mirror that |
00:54:35 | FromDiscord_ | <Zachary Carter> and then draw a line in the sand |
00:54:35 | krux02 | constantly increasing the weight of those libraries, and taking away names in those libraries often for suboptimal solutions that is often useful only for the original auther in that moment of writing it. |
00:54:59 | FromDiscord_ | <Zachary Carter> so - say we have the equivalent of Python 3's string manipulation |
00:55:01 | FromDiscord_ | <Zachary Carter> or whatever language |
00:55:06 | FromDiscord_ | <Zachary Carter> and say - we're not doing anything else |
00:55:20 | FromDiscord_ | <Zachary Carter> drop the math library - it's not needed |
00:55:24 | FromGitter | <rayman22201> Wow, I went afk and the topic changed quite a bit lol. @zacharycarter my point wasn't "use webpack", it was "use tree shaking". but as @krux02 was saying, Nim has some form of this already, so idk if it would actually help the JS backend or not. Similar answer to mapping Nim modules to ES6 modules, it may allow for some JS specific optimizations (may also hurt, idk). ES6 modules also allow for lazy loading on the |
00:55:24 | FromGitter | ... client, which is used for larger JS projects. |
00:56:08 | krux02 | lazy loading is stupid |
00:56:21 | FromDiscord_ | <Zachary Carter> I like timotheecour's suggestion |
00:56:25 | FromGitter | <rayman22201> lol |
00:56:35 | FromGitter | <timotheecour> which one |
00:56:38 | FromDiscord_ | <Zachary Carter> limit the stdlib to what is needed for the stdlib |
00:56:54 | FromDiscord_ | <Zachary Carter> don't include any extraneous modules |
00:57:02 | krux02 | lazy loading is the reason the github web interface is so horribly slow |
00:57:07 | FromDiscord_ | <Zachary Carter> otherwise we're just inventing shit that people might use |
00:57:14 | FromDiscord_ | <Zachary Carter> but definitely won't help to maintain / extend |
00:57:28 | krux02 | everything is with indirections causing server requests and slowing everything down |
00:57:29 | FromDiscord_ | <Zachary Carter> and they'll most likely build or seek out more optimal solutions to their problems |
00:57:43 | FromDiscord_ | <Zachary Carter> okay |
00:57:52 | FromDiscord_ | <Zachary Carter> lazy loading is useful in certain scenarios |
00:58:00 | FromDiscord_ | <Zachary Carter> like if you have an infinite scroll experience |
00:58:10 | FromDiscord_ | <Zachary Carter> lazy loading is ideal |
00:58:21 | krux02 | infinite scrolling is horrible |
00:58:27 | krux02 | I hate when websites do that |
00:58:33 | FromDiscord_ | <Zachary Carter> would you rather have that than a wizard / stepper? |
00:58:43 | FromDiscord_ | <Zachary Carter> or multiple pages? |
00:58:45 | FromGitter | <timotheecour> keeping stdlib as minimial as it can, can be done once https://github.com/nim-lang/Nim/issues/8638 is fully supported so we have a useable ecosystem without tons of regressions on essential modules |
00:58:47 | FromGitter | <rayman22201> I make no value judgements. It's a tool like everything else, some projects may call for it |
00:58:49 | FromDiscord_ | <Zachary Carter> with browser relaods? |
00:59:05 | krux02 | multiple pages, yes, or one page with everything |
00:59:22 | FromDiscord_ | <Zachary Carter> that's infinite scroll |
00:59:26 | FromDiscord_ | <Zachary Carter> one page with everything |
00:59:35 | krux02 | no |
00:59:39 | FromDiscord_ | <Zachary Carter> would you rather wait for anything to be painted before something is painted? |
00:59:47 | FromDiscord_ | <Zachary Carter> err everything to be loaded rather |
00:59:57 | FromDiscord_ | <Zachary Carter> that's what the problem solves really |
01:00:08 | FromDiscord_ | <Zachary Carter> if you have 1mb of content to load but can load only what's needed to render the frame |
01:00:17 | krux02 | the best solution is to have a single file that contains everything |
01:00:35 | krux02 | the browser already streams in the data from big files |
01:00:50 | krux02 | there is no need to build anything is javascript do load dynamically |
01:01:06 | FromDiscord_ | <Zachary Carter> yeah but I'm not quite sure the dom works the same way |
01:01:28 | FromDiscord_ | <Zachary Carter> like - I don't think you can start rendering content when only half of JS has made it to the client |
01:01:28 | FromGitter | <kdheepak> nimble build doesn't seem to be using config.nims, any suggestions on what I might be missing? |
01:01:35 | krux02 | well my ideas are mostly for static content |
01:01:48 | FromDiscord_ | <Zachary Carter> yeah - well static content is under-used |
01:01:57 | FromDiscord_ | <Zachary Carter> everyone should be opting for static sites whenever they can |
01:02:10 | krux02 | yes |
01:02:12 | FromGitter | <timotheecour> @kdheepak please report this in nimble issues |
01:02:18 | FromDiscord_ | <Zachary Carter> but the whole SEO thing and framework reliance has made this goal seemingly impossible |
01:02:25 | FromDiscord_ | <Zachary Carter> so now everyone is obsessed with SSR and shit like that |
01:03:00 | FromDiscord_ | <Zachary Carter> make the most complicated monstrosity you can, and then figure out how to serve it optimally via the browser |
01:03:17 | FromDiscord_ | <Zachary Carter> it's like people who don't know what they're doing - are guiding us in what to do 😛 |
01:03:19 | xace | wait, is math going to be moved to the nimble packages? |
01:03:20 | krux02 | best would be if even the images would be embedded in the file, so that no browser no matter how stupid it is, needs to send requests to load the images in the website |
01:03:41 | krux02 | xace, no |
01:05:12 | FromGitter | <rayman22201> lol. the math thing got taken out of context. |
01:05:51 | xace | i was afk for a little while and the conversation just exploded, trying to skim through it |
01:06:18 | xace | i find it really hard to keep track of the chat especially with the FromGitter and FromDiscord bots offsetting yournames |
01:06:27 | xace | (from irc atleast) |
01:06:34 | FromGitter | <rayman22201> I think they are referring to an older version that had a more specialized Math library that was since removed a long time ago |
01:06:34 | krux02 | the discussion was about that my priority is to shrink the standard library whenever that is possible |
01:06:37 | FromGitter | <timotheecour> btw to make nim repo slimmer, I suggest that things used in tools but not in compiler/stdlib can be nimble dependencies themselves |
01:07:13 | krux02 | the concept behind it was invented by Caesar, divide and conquer |
01:07:33 | FromGitter | <rayman22201> I agree with both of you @timotheecour and @krux02 |
01:08:12 | FromDiscord_ | <Zachary Carter> none of the db stuff - if it still is - should be in the stdlib |
01:08:15 | FromGitter | <timotheecour> there’s already for eg: `tests/deps/jester-#head/jester/patterns.nim`; this pattern could be generalized |
01:08:38 | xace | im atleast happy that nim has a fairly large stdlib, it helps with consistency when reading the code. one problem i had in python was multiple libraries with same functionality, with fuzzy reasons to why you should pick one over the other... |
01:08:39 | FromGitter | <timotheecour> wasn’t db stuff used for incremental compilation? |
01:08:47 | FromDiscord_ | <Zachary Carter> oh - in that case |
01:08:48 | FromDiscord_ | <Zachary Carter> nevermind |
01:09:00 | krux02 | timotheecour: maintaining several git projects is also not great. splitting up in different projects only makes sense, when the spit matches the split of the maintainers as well. |
01:09:16 | FromDiscord_ | <Zachary Carter> you can use git subtrees |
01:09:22 | FromDiscord_ | <Zachary Carter> but they're not 100% ideal either |
01:09:32 | krux02 | I know |
01:09:37 | krux02 | I think I told you about them |
01:09:43 | FromDiscord_ | <Zachary Carter> probably |
01:09:50 | FromDiscord_ | <Zachary Carter> learned a lot of stuff from you 😛 |
01:10:00 | krux02 | you are welcome |
01:10:45 | FromDiscord_ | <Zachary Carter> lol at work we used them - and I didn't know how to maintain them properly yet |
01:10:55 | FromDiscord_ | <Zachary Carter> and every push was going through the entire commit history |
01:11:00 | FromDiscord_ | <Zachary Carter> so pushes started taking minutes |
01:11:20 | FromGitter | <timotheecour> (or git submodules; which could be used for eg to track sources repo, as was already mentioned) |
01:11:21 | FromDiscord_ | <Zachary Carter> now I'm disassembling my git tree until I understand how to properly use it 😛 |
01:11:45 | FromDiscord_ | <Zachary Carter> yeah - submodules are very useful too - subtrees are a little bit better for top-down organization I think |
01:11:51 | FromDiscord_ | <Zachary Carter> but I'm not a master in either |
01:12:13 | FromDiscord_ | <Zachary Carter> I can certainly screw up your project with both though 😛 |
01:12:51 | krux02 | I don't like the mental overhead of using git |
01:13:00 | FromDiscord_ | <Zachary Carter> I agree - I prefer mercurial |
01:13:02 | krux02 | it really takes a lot of time managing git commits |
01:13:11 | krux02 | never used hg |
01:15:56 | * | zachk quit (Quit: Leaving) |
01:18:14 | FromGitter | <timotheecour> @krux02 it depends how tight is coupling; in D, the split dmd/phobos/druntime seemed like a mistake (lots of ppl would agree with that); but things like `nimfind` could really be split off as separate nimble pkg |
01:18:32 | FromGitter | <timotheecour> (low coupling) |
01:20:20 | krux02 | as far as I know nimfind uses internal structures of the compiler |
01:20:27 | * | leorize quit (Quit: WeeChat 2.3) |
01:21:14 | FromGitter | <timotheecour> actually u may be right; but compiler is a nimble package though? |
01:21:43 | FromGitter | <timotheecour> but ya, nimfind was a bad example, scratch that. |
01:21:48 | krux02 | compiler a nimble package? |
01:22:09 | FromGitter | <rayman22201> Isn't the point of "compiler as a library" mean that isn't a problem? |
01:22:30 | FromGitter | <timotheecour> yes, it’s a nimble package: see compiler.nimble |
01:22:31 | krux02 | if have no idea what you are talking about |
01:23:47 | * | xace quit (Ping timeout: 240 seconds) |
01:23:55 | * | darithorn joined #nim |
01:24:01 | FromGitter | <rayman22201> It was a refactor initiative that Araq had worked on. trying to find the github issues for it. hold on |
01:24:25 | krux02 | I go to bed now |
01:24:29 | krux02 | it is really late for me |
01:24:49 | FromGitter | <rayman22201> goodnight! @krux02 |
01:25:00 | krux02 | good night |
01:25:12 | * | krux02 quit (Remote host closed the connection) |
01:25:46 | * | xace joined #nim |
01:32:30 | FromDiscord_ | <Zachary Carter> heh |
01:32:37 | FromDiscord_ | <Zachary Carter> I think Araq was basically saying this earlier - https://pbs.twimg.com/media/DsFlk4ZVsAAMbpz.jpg:large |
01:32:52 | FromDiscord_ | <Zachary Carter> with nimsuggest and json output and all of that |
01:34:18 | FromGitter | <timotheecour> Hah; fun diagram indeed; what’s your point though out of curiosity |
01:35:10 | FromGitter | <timotheecour> my point was clear: custom format for inter-process communication is not good; we need standard format (json, or even protobuf (which can convert to json, mostly)) |
01:36:25 | FromGitter | <timotheecour> things inevitably grow more complex, with more features added; a std format allows for evolution in a sane way, unlike custom formats |
01:37:43 | FromGitter | <rayman22201> I can't find the github artifacts, and I don't think Araq ever made an RFC for the "compiler as a library" thing. I know I'm not crazy lol! Araq refactored the compiler to make it more usable as a library. Specifically removing a lot of global state from the compiler internals. |
01:38:43 | FromGitter | <timotheecour> tests/compilerapi/tcompilerapi.nim |
01:38:57 | FromGitter | <timotheecour> shows basic use of compiler as a library |
01:39:42 | FromGitter | <rayman22201> true, but there is no documentation about the work that was done to get to there. |
01:44:31 | FromGitter | <rayman22201> meh. oh well. My point was that I have no preference over how the version control is done / project is split up. Those kinds of decisions are very subjective and depend on the preferences of the maintainers (they have to do the management work after all, might as well do it in a way they prefer). I am very much for strong module boundaries and loose coupling around the compiler tools. |
01:47:34 | * | ftsf joined #nim |
02:11:28 | FromDiscord_ | <Zachary Carter> timotheecour: I don't have any overall point tbh |
02:11:45 | FromDiscord_ | <Zachary Carter> it seemed somewhat tangental to what you and Araq were discussing earlier - and I saw it tweeted |
02:11:47 | FromDiscord_ | <Zachary Carter> so I figured i'd share |
02:12:08 | FromGitter | <timotheecour> i c i c…. i like the diagram :) |
02:12:10 | FromDiscord_ | <Zachary Carter> I'm in the middle - I agree that the simpler things are to use / the more we can embrace the better off Nim will be |
02:12:35 | FromDiscord_ | <Zachary Carter> but I can also understand that all this customization leads to more maintenance and potential problems to take into consideration |
02:12:44 | FromDiscord_ | <Zachary Carter> so I appreciate both sides of the proverbial coin |
02:13:01 | FromDiscord_ | <Zachary Carter> I think the image is well done though 😛 I can at least state that case with confidence haha |
02:13:13 | FromDiscord_ | <Zachary Carter> I think the image is well done though 😛 I can at least state that opinion with confidence haha |
02:13:43 | FromGitter | <timotheecour> its kinda related to Zawinski's law of software envelopment : ⏎ ⏎ > Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can. |
02:14:31 | FromDiscord_ | <Zachary Carter> I'm not familiar with most of these - not coming from a CS background - but I do find them very enlightening |
02:14:46 | FromDiscord_ | <Zachary Carter> going to add that name to my growing collection |
02:15:22 | FromDiscord_ | <Zachary Carter> but I do find it apt |
03:05:34 | * | banc quit (Quit: ZNC - http://znc.in) |
03:08:37 | * | vlad1777d quit (Ping timeout: 252 seconds) |
03:21:44 | * | dddddd quit (Remote host closed the connection) |
03:23:39 | * | banc joined #nim |
03:36:10 | * | smt quit (Read error: Connection reset by peer) |
04:04:35 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bee41d3d001b9172069acf8] |
04:13:00 | shashlick | What kind of data format can be parsed in the vm today? I don't think json can |
04:16:07 | FromDiscord_ | <Zachary Carter> yeah - pretty sure the JSON module doesn't work at compiletime |
04:16:14 | FromDiscord_ | <Zachary Carter> ini maybe? |
04:18:54 | FromGitter | <gogolxdong> How to fix this for nimble? |
04:20:20 | FromDiscord_ | <Zachary Carter> https://nim-lang.org/docs/parsecfg.html |
04:23:24 | FromGitter | <gogolxdong> I think you can nimble install nimdata, but I cannot, as the error above. |
04:26:07 | FromDiscord_ | <Zachary Carter> yes |
04:26:12 | FromDiscord_ | <Zachary Carter> Nimdata doesn't work with latest Nim |
04:26:43 | FromDiscord_ | <Zachary Carter> err wait |
04:26:55 | FromDiscord_ | <Zachary Carter> maybe it does - I don't know - I know it didn't a while back and I submitted a PR |
04:27:32 | FromDiscord_ | <Zachary Carter> it was definitely merged and now I have no idea what the problem is - my bad |
04:27:43 | shashlick | Need something hierarchical |
04:27:57 | shashlick | Cfg is too simple |
04:29:03 | FromGitter | <gogolxdong> I can install from server while cannot install on my windows 10 WSL. |
04:30:55 | FromGitter | <gogolxdong> by cannot install I mean cannot install anything, I think something went wrong without awareness . |
04:34:26 | FromDiscord_ | <Zachary Carter> shashlick: I dunno then - only thing I can think of is YAML / TOML |
04:34:44 | FromDiscord_ | <Zachary Carter> not sure there are any libs for those formats that will allow you to leverage them at compile time |
04:34:50 | FromDiscord_ | <Zachary Carter> you might be in the realm of inventing your own solution |
04:34:55 | FromDiscord_ | <Zachary Carter> don't want to assert that though |
04:35:04 | FromDiscord_ | <Zachary Carter> https://arxiv.org/pdf/1208.1176.pdf - might be interesting to the crypto heads in here |
04:35:26 | FromDiscord_ | <Zachary Carter> or anyone interested in ciphers |
05:10:43 | shashlick | I'll try both tomorrow and see, seems unlikely though since people tend to use streams which won't work in vm |
05:28:21 | * | narimiran joined #nim |
05:32:54 | * | nsf joined #nim |
05:48:45 | * | stefanos82 joined #nim |
06:23:17 | * | NimBot joined #nim |
06:23:19 | * | darithorn quit (Quit: Leaving) |
06:31:03 | * | leorize joined #nim |
06:39:37 | * | narimiran quit (Remote host closed the connection) |
06:50:51 | * | cyraxjoe quit (Ping timeout: 260 seconds) |
06:51:32 | * | cyraxjoe joined #nim |
06:59:24 | * | mech422__ joined #nim |
07:03:05 | * | mech422_ quit (Ping timeout: 268 seconds) |
07:19:39 | FromGitter | <alehander42> @rayman22201 @zacharycarter I planned on eventually including optional support for es6 modules in my jsgen refactoring(I am refactoring it to do ast->ast to ease support for sourcemaps, but I got not a lot of time last weeks :( ) |
07:21:50 | FromGitter | <gogolxdong> @PMunch http://ix.io/1s56 |
07:22:31 | FromGitter | <alehander42> @krux02 I really doubt you can implement full concepts just with macros, I can't even imagine how would this work: how would macros for A apply in `proc (a: A)` at all? |
07:25:25 | FromGitter | <alehander42> what are the concept exponential time examples? after all they let you literally execute code on compile time, it's the same as saying "you can get exponential time if you use macros in a certain way": probably there needs to be some kind of step limit as with macros |
07:28:51 | FromGitter | <gogolxdong> http://ix.io/1s59 |
07:34:15 | FromGitter | <alehander42> "they are not necessary" Well, I can't express some type restrictions without them. Do you mean the builtin impl is not necessary, because they are certainly useful |
07:36:18 | FromGitter | <alehander42> the feature itself* |
07:40:36 | FromGitter | <alehander42> wow what is git subtrees :D I've been living a submodule-only life lately |
07:44:34 | * | krux02 joined #nim |
08:06:33 | FromGitter | <alehander42> btw, how hard would it be to add a flag e.g. `strictNotNil` which accepts some uses of `ref` , e.g. `.field` (not `.method`) as type errors, forcing one to do `if a.isNil` or `not nil` types |
08:06:46 | FromGitter | <alehander42> I know that doing this by default will break everything(I guess) |
08:07:48 | FromGitter | <alehander42> but at least an option for it might make it easier to have a safer code in certain portions of a codebase |
08:08:05 | FromGitter | <alehander42> Araq ? ^ |
08:21:23 | Araq | sounds like a good idea, {.push strictRefs: on.} ? |
08:27:17 | FromGitter | <alehander42> yeah, something like this |
08:27:32 | * | dddddd joined #nim |
08:27:49 | FromGitter | <alehander42> can it be easily applied to a whole module? e.g. if I put it on the top, would having stuff that is not proc-s break it |
08:30:25 | Araq | adding a module-wide switch is easy |
08:31:02 | Araq | it's the analysis itself that is hard :P |
08:31:28 | Araq | and what should 'ref T' mean? nilable or not? |
08:31:36 | FromGitter | <alehander42> well, I was afraid of that, yeah :D |
08:32:16 | FromGitter | <cyberlis> Araq, i thought any ref object is nilable |
08:32:29 | FromGitter | <alehander42> I guess ref T should continue to mean nilable, the spirit of strictRefs is that it checks nilable refs, not that it changes the default |
08:33:57 | FromGitter | <alehander42> my point was more that if I want to check all proc-s/top level code in a module, would it be possible with `push` |
08:34:43 | FromGitter | <alehander42> about the analysis: is it easy to determine if `.field` / `[]` is being overloaded by a function somewhere |
08:34:48 | Araq | cyberlis: we're discussing a language dialect where 'ref' is stricter |
08:35:45 | FromGitter | <cyberlis> oh, i see |
08:35:54 | Araq | huh? the analysis would work on the analysed AST, there are no "overloaded" fields, they have been replaced by nkCall |
08:36:18 | FromGitter | <alehander42> ah, that's great |
08:36:46 | * | floppydh joined #nim |
08:36:53 | FromGitter | <timotheecour> @araq just FYI I reimplemented nimfind using mongo (instead of sql) (via nimongo); it results in much cleaner code; and also fixes some of the issues i was having with nimfind (not ready to be publishable becaus of internal dependencies) as well as making it easy to support more complex queries out of the box thanks to mongodb’s schema-free flexibility |
08:37:58 | FromGitter | <cyberlis> @timotheecour to use the tool, I have to install mongodb? |
08:38:03 | * | cavariux quit (Quit: Ping timeout (120 seconds)) |
08:38:08 | Araq | how is 'mongo' not a dependency? |
08:38:25 | FromGitter | <alehander42> so what would be the hard part of the analysis? it seems to me that accessing a field or a `[]` should be a type error, and calls should not, as they should decide what to do with nil themselves |
08:38:32 | * | cavariux joined #nim |
08:38:58 | Araq | alehander42: if n != nil and n.typ != nil: |
08:39:04 | FromGitter | <timotheecour> nimongo is a pure nim mongodb driver (unlike other mango wrapper that needs libmongo, libbson) |
08:39:07 | Araq | n.typ = nil # fool the analyser |
08:39:23 | Araq | echo n.typ.field # valid? |
08:40:16 | Araq | it's hard because it's a control flow dependent analysis |
08:40:43 | FromGitter | <timotheecour> > how is 'mongo' not a dependency? ⏎ ⏎ i meant the lib I’m working on is not yet ready to be a nimble package because of internal stuff i’m using; but that’s costmetic; the only dependency is `nimongo` which itself seems free of depdency |
08:41:08 | Araq | with some dataflow aspects and depending on how hard you wanna make it you also need alias analysis |
08:41:08 | leorize | so now you'd need to run a mongodb server to use it? |
08:41:35 | FromGitter | <timotheecour> well it’s all transparent, really |
08:41:45 | FromGitter | <alehander42> maybe we can assume that each usage of a ref value which possibly mutates it making it nilable again(except if it's using a not nil annotation) e.g. typ = callToNotNil() |
08:43:42 | Araq | timotheecour, well it's cool that it works for you but that's not 'nimfind' anymore :-) |
08:43:48 | FromGitter | <alehander42> https://gist.github.com/alehander42/fad2707f7602e59b4e30bd6231cc450c |
08:44:47 | FromGitter | <alehander42> well, how does the compiler currently deal with `n.typ = nil` if `typ` is not nil |
08:45:01 | FromGitter | <alehander42> doesn't it need to prove the same things |
08:45:41 | Araq | if typ is not nil the assignment is invalid |
08:46:12 | FromGitter | <alehander42> exactly |
08:46:16 | FromGitter | <alehander42> and we just need to change the logic |
08:46:21 | Araq | but I thought we're talking about strict refs that enforce the nil check |
08:46:34 | FromGitter | <alehander42> so if it's "potentiallyStillNilable" it just makes it nilable again |
08:46:42 | FromGitter | <alehander42> yes |
08:46:56 | FromGitter | <alehander42> and on the next line, echo n.typ.field will lead to an error |
08:47:20 | FromGitter | <alehander42> it's more like, n.typ = nil will act as creating(chaning) a new flow |
08:47:22 | Araq | "every usage of 'obj.field' must be dominated by an 'obj != nil' check" |
08:47:55 | Araq | two problems here: |
08:48:02 | FromGitter | <alehander42> every usage of obj.field must be on a obj which is currently notNilable |
08:48:12 | Araq | 1. 'obj' might be a complex expression |
08:48:23 | Araq | 2. 'obj' can be mutable |
08:49:08 | FromGitter | <alehander42> well, the first one shouldn't matter: we care only about the type and nilability of that expression |
08:49:29 | FromGitter | <alehander42> about the second one: currently if obj is `not Nil` |
08:49:40 | Araq | but the type is 'ref T', not 'ref T not nil' |
08:49:42 | FromGitter | <alehander42> does nim ensure that `call(obj)` can't mutate it to nil |
08:49:56 | FromGitter | <alehander42> ok, what I imagine is probably different |
08:50:29 | FromGitter | <alehander42> aah I see what you mean |
08:51:25 | FromGitter | <alehander42> e.g. |
08:51:40 | FromGitter | <alehander42> if a(e) != nil: # is a(e) still not nil |
08:51:53 | FromGitter | <yglukhov> @iffy, right. I was thinking about not using `ndk-build` at all. But using `nim` instead. |
08:53:36 | FromGitter | <alehander42> Araq, well one more conservative solution is to just limit this to variables and field chains |
08:57:12 | FromGitter | <alehander42> which solves 1: in other cases the expressions will remain nilable, better make the user do some more work(assign to a variable) then generating incorrect code |
08:58:04 | FromGitter | <alehander42> that's even easy to hint in the error message |
09:00:21 | Araq | look at my example again |
09:00:36 | Araq | you can make me write instead |
09:00:51 | Araq | if n != nil and (let t = n.typ; t != nil): |
09:00:54 | Araq | n.typ = nil |
09:00:58 | Araq | echo t.field |
09:01:03 | Araq | but I won't like it |
09:01:44 | FromGitter | <alehander42> ok, I have a plan for this |
09:01:49 | FromGitter | <alehander42> but first, I want to say that |
09:02:07 | FromGitter | <alehander42> one of the problems should be fixed with bot strictRefs and notnil |
09:02:24 | FromGitter | <alehander42> var a = T() ⏎ if a != nil: ⏎ makeNil(a) ⏎ echoNotNil(a) [https://gitter.im/nim-lang/Nim?at=5bee87a09f5a9e6e41f2c88b] |
09:02:32 | FromGitter | <alehander42> I can trigger a segfault easily here |
09:02:42 | FromGitter | <alehander42> even if echoNotNil expects not nil |
09:02:48 | FromGitter | <alehander42> and nim thinks a is not nil |
09:03:17 | FromGitter | <alehander42> and I've turned notnil on |
09:03:33 | leorize | notnil is generally broken afaik, which is why it was moved to experimental |
09:03:49 | FromGitter | <alehander42> so my idea is: != nil is not enough as a check |
09:04:14 | FromGitter | <alehander42> but instead, we need a way to track both type & "nilability" of a variable/field in each branch |
09:04:39 | FromGitter | <alehander42> and != nil just sets the nilability of `a` to false in the first branch |
09:05:36 | FromGitter | <alehander42> but then other usages mostly set it to true again, if they are not just "reading" from it (or assigning notnil value to it) |
09:05:48 | FromGitter | <alehander42> so the analysis goes like |
09:06:18 | FromGitter | <alehander42> var a = T() # T Nilable ⏎ ⏎ if a != nil # open a new branch with new "nilability table" for it |
09:06:38 | FromGitter | <alehander42> #set a as NotNilable in this branch |
09:06:54 | FromGitter | <alehander42> ugh gitter, this should be just a comment |
09:07:33 | FromGitter | <alehander42> makeNil(a) # this is a call that might write to a as it accepts `var`, so it's unsafe: set a as Nilable again |
09:07:49 | FromGitter | <alehander42> echoNotNil(a) # well, it expects not nil, so this is a type error |
09:08:41 | FromGitter | <alehander42> basically each line in a branch can change the "branch-level" nilability of a variable/field |
09:08:54 | FromGitter | <alehander42> does this seem viable |
09:09:57 | FromGitter | <alehander42> (in the same way, you'll be able to write echo n.typ.field and be sure it's correct) |
09:10:49 | Araq | I'm not sure why we're having this conversation |
09:11:10 | Araq | I told you months ago to study "abstract interpretation" :P |
09:12:08 | FromGitter | <gogolxdong> @PMunch , haven't figured out how to make it in bit unit. Generally a byte or char is the minimal unit to operate on. |
09:12:15 | Araq | you translate the program into an abstract machine that captures the nil-ness |
09:12:25 | Araq | of local variables |
09:13:10 | Araq | you may re-label obj.field to obj_field (but watch out to do this properly) to have more locals to work with |
09:13:33 | Araq | you run a fixpoint analysis on the abstract machine |
09:17:13 | FromGitter | <gogolxdong> ah, use getBitInfo, so esentially it's bitwise shift operation. |
09:22:05 | FromGitter | <alehander42> well, my idea seems kinda similar to the abstract interpretation methods to me :D just explained in a way less correct way |
09:22:27 | FromGitter | <alehander42> except for the fixpoint thing, this is pretty important |
09:22:57 | FromGitter | <alehander42> for loops, I forgot that part |
09:33:22 | Araq | what about plan B? |
09:33:44 | Araq | enforce explicit initialization for every 'nilable' field. |
09:33:54 | Araq | then nil bugs can only come from 'nil' in the source code |
09:34:33 | Araq | easy backwards compat, easy solution, gives you 80% of the safety of the complete solution, maybe |
09:36:38 | FromGitter | <alehander42> what about variables? require explicit initialization for the nilable ones too? |
09:38:01 | FromGitter | <alehander42> I actually think it's a great idea, but I don't see how it's very backwards compatible |
09:38:20 | FromGitter | <alehander42> wouldn't my code which doesn't initialize nilable fields break after it? |
09:38:40 | Araq | well yes, but the error would first be a warning |
09:39:02 | Araq | and yes, variables need to be initialized |
09:39:05 | FromGitter | <alehander42> well, the other error can be a warning first too |
09:39:31 | Araq | sure but it's unclear if the resulting language is bearable |
09:39:48 | Araq | whereas with plan B it's pretty obviously bearable, ymmv |
09:39:59 | FromGitter | <alehander42> why? I think the implementation might be harder |
09:40:06 | FromGitter | <alehander42> but it will change the language even less |
09:40:26 | FromGitter | <alehander42> plan B requires people to change all their initializations |
09:40:48 | FromGitter | <alehander42> the other plan wants them to just check the cases where it might actually lead to an error |
09:41:02 | FromGitter | <alehander42> which would be still a posibility with plan B |
09:41:26 | FromGitter | <alehander42> also, I am not sure about the C backend, but plan B doesn't really help the js backend |
09:41:52 | FromGitter | <alehander42> you can have a `ref` type which describes some external JS object and you can't force it to be initialized correctly |
09:42:24 | Araq | huh? |
09:42:26 | Araq | instead of |
09:42:29 | Araq | var x: Foo |
09:42:33 | Araq | you need to write |
09:42:38 | Araq | var x: Foo = nil |
09:42:47 | FromGitter | <alehander42> and how does this help? |
09:43:04 | FromGitter | <alehander42> you still need to manually go back and find all nil usages |
09:43:08 | * | vlad1777d joined #nim |
09:43:13 | Araq | then you get a 'nil' bug, and you wonder where the fuck the nil crept into |
09:43:26 | Araq | and it's when you wrote 'nil' |
09:43:34 | FromGitter | <alehander42> but I want the compiler to simply stop me from having a nil bug at all |
09:43:43 | FromGitter | <alehander42> after all that's why I don't use a dynamic lang |
09:43:47 | Araq | ok, so you don't want plan B at all then |
09:44:12 | Araq | because there is nothing more to it |
09:44:18 | FromGitter | <alehander42> I thought plan B requires people to assign non-nil values |
09:44:24 | FromGitter | <alehander42> but it doesn't make a lot of sense, I agree |
09:44:45 | Araq | no, it requires people to assign a value, but nil is allowed |
09:44:49 | FromGitter | <alehander42> (my initial assumption doesnt make sense0 |
09:45:21 | FromGitter | <alehander42> well, I don't think it comes close to proper nil checking |
09:45:40 | FromGitter | <alehander42> it still requires you to find a runtime nil error and debug it |
09:46:19 | FromGitter | <alehander42> and currently you can still put a watchpoint in gdb or something |
09:48:55 | FromGitter | <alehander42> I think plan B is useful as a code discipline thing and making people think more about default values |
09:50:45 | * | krux02_ joined #nim |
09:51:02 | * | voice_ftp joined #nim |
09:53:54 | * | krux02 quit (Ping timeout: 268 seconds) |
09:53:54 | * | deepend quit (Ping timeout: 268 seconds) |
09:53:55 | * | voiceftp quit (Ping timeout: 268 seconds) |
09:54:11 | * | deepend joined #nim |
09:55:28 | * | krux02_ is now known as krux02 |
10:19:33 | FromGitter | <alehander42> ha, I was just about to write about https://link.springer.com/chapter/10.1007%2F3-540-45937-5_6 and I saw a comment about it in dfa.nim |
10:25:41 | Araq | the paper is quite broken as far as I understand it |
10:26:15 | FromGitter | <alehander42> if I decide to try this in my own branch, I guess I should use a similar scheme (invoking nil check analysis for each procedure and doing the cfg building / analysis in its own module)) |
10:26:49 | Araq | most analyses are *hard* without a 'join' opcode |
10:27:13 | FromGitter | <alehander42> so did it work for the use/def case ? |
10:27:25 | Araq | no. |
10:31:51 | Araq | it doesn't work for anything |
10:32:41 | FromGitter | <alehander42> well, I'll try to implement a very basic version of your abs machine idea and see if it seems very hard |
10:35:28 | Araq | the abs machine is usually simple, you can adapt dfa.nim |
10:35:56 | Araq | the analysis on the DFA is hard |
10:36:25 | FromGitter | <alehander42> yeah, that's what I meant |
10:37:30 | Araq | the analysis is simpler with a join opcode which we don't generate yet |
10:37:49 | FromGitter | <alehander42> if I have a `strictRefs` pragma, does this mean I should generate a sfStrictRefs flag from it for the proc symbol? |
10:38:34 | Araq | I would attach it to the PContext and avoid a proc-wise flag |
10:38:46 | Araq | but whatever works for you |
10:41:14 | FromGitter | <alehander42> ah I see, well I'll take a better look at dfa.nim in the weekend and see |
11:44:06 | FromGitter | <alehander42> btw should I include initializing seq-s and strings with [] , "" in my jsgen refactoring |
11:53:14 | Araq | I dunno, there is also a pending PR for it |
11:53:43 | Araq | I don't understand the bugs, 'null' is [] or "" for Nim |
12:13:32 | FromGitter | <alehander42> which PR? I found only https://github.com/nim-lang/Nim/pull/9411 |
12:15:12 | Araq | that one |
12:15:27 | Araq | oh it's not WIP anymore, seems I need even more github notifications |
12:17:52 | FromGitter | <alehander42> hm, nulls/undefined are s a little bit weird for debugging/interop, but it's not a dealbreaker indeed |
12:18:37 | FromGitter | <alehander42> maybe we can add something like that for JsAssoc too, `[]=` and `[]` able to deal with null/undefined |
12:22:07 | * | smt joined #nim |
12:29:41 | Araq | sure |
12:35:28 | * | vlad1777d quit (Ping timeout: 245 seconds) |
12:41:04 | * | platoff_ joined #nim |
12:43:25 | FromGitter | <dawkot> can you get a `var T` out of a `ptr T`? |
12:45:24 | leorize | dawkot: assuming `a` is of type `ptr T`, `a[]` will dereference into variable `T` |
12:52:29 | * | dddddd quit (Remote host closed the connection) |
12:57:43 | * | ltr_ left #nim (#nim) |
13:08:59 | FromGitter | <dawkot> @leorize: Not really what I meant. Maybe this will make it more clear what I was asking for: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5beec16a4720c11e0e76920b] |
13:14:16 | leorize | no |
13:14:21 | leorize | that'd be a really bad idea |
13:40:43 | * | lukd quit (Quit: WeeChat 2.3) |
13:44:44 | * | platoff_ quit (Read error: Connection reset by peer) |
13:45:11 | * | lukd joined #nim |
13:46:51 | * | Aareon_ quit (Remote host closed the connection) |
14:16:02 | * | smt quit (Read error: Connection reset by peer) |
14:19:43 | FromGitter | <Varriount> @dawkot : The best you can do is use `when` or generics to handle such variations |
14:24:26 | shashlick | Araq: do you think you are open to allowing enums that are out of order? |
14:35:43 | Araq | meh... why ... |
14:53:53 | * | narimiran joined #nim |
15:10:40 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5beeddf0b86c70503f3e6627] |
15:10:49 | FromGitter | <gogolxdong> nimble refresh failed. |
15:39:25 | FromDiscord_ | <PusiteGA> dumb qestion i can do for i in 0..27 but 27...0 wont work how to reverese loop |
15:39:40 | narimiran | `countdown` |
15:39:45 | FromDiscord_ | <PusiteGA> ty |
15:40:10 | narimiran | `a..b` is basically a shorthand for `countup(a, b, 1)` |
15:42:14 | FromDiscord_ | <PusiteGA> would be nice if tehere was short for coutdown too |
15:42:35 | narimiran | i agree but i think we're in the minority |
15:43:29 | FromDiscord_ | <PusiteGA> woudent it be a simple check if first number biger then one after ... |
15:43:59 | narimiran | but there are situations where using `..` for countdown too would break the code |
15:44:07 | narimiran | there should be another symbol for it |
15:44:16 | narimiran | something like `..-` |
15:44:59 | FromGitter | <alehander42> most languages don't have this |
15:45:03 | narimiran | "implementing `..-` is left as an exercise for the reader" :) |
15:45:07 | FromGitter | <alehander42> ruby's `..` also works only up |
15:45:39 | FromGitter | <alehander42> in python you need range which is similar to type to countdown |
15:46:34 | narimiran | ...but notice that `range(10, 0, -1)` is in nim: `countdown(10, 1, 1)` |
15:46:42 | FromGitter | <alehander42> I agree that a different symbol might be fine, but `..-a` might be confusing |
15:47:12 | FromGitter | <alehander42> maybe `..>` and `..>=` ? |
15:47:52 | shashlick | Araq: ordered enums are a nightmare for wrapping |
15:47:56 | narimiran | i doubt we will see any of these officially |
15:48:15 | shashlick | Especially when you have bitmasks |
15:48:36 | shashlick | Have to rewrite the entire thing manually |
15:48:40 | * | nsf quit (Quit: WeeChat 2.3) |
15:49:03 | FromGitter | <alehander42> distinct int? |
15:49:35 | shashlick | Cannot cimport, will have to test the effective value of each and verify they are in the right order |
15:50:53 | * | Trustable joined #nim |
15:54:49 | FromDiscord_ | <PusiteGA> hmm duno what part i dont get, but cant compiler just check if for i in 0....5 checks if 0>5 then its countup and if its not then is countdown, dont get how would that brake code |
15:55:47 | narimiran | you want to have 5 things of something, and you start with x amount |
15:56:07 | FromGitter | <alehander42> because if you have expressions instead of numbers, you might want the loop to run only when the second >= the first one |
15:56:07 | narimiran | now you do `for i in x..5` |
15:56:22 | narimiran | and that works if x is <= 5 |
15:56:36 | narimiran | but what if x was 9? |
15:56:44 | narimiran | you don't want to add anything |
15:56:59 | narimiran | and in your case you would add 5 more things |
15:59:22 | FromDiscord_ | <PusiteGA> if x is 9 it should trow error out of bounds and crash |
15:59:36 | FromDiscord_ | <PusiteGA> oh |
15:59:39 | narimiran | !?! |
15:59:58 | FromDiscord_ | <PusiteGA> you mean then 9...5 and would go rewers down and that i dont wnat |
15:59:59 | narimiran | 5 minutes ago you wanted it to work :D :D |
16:00:00 | FromDiscord_ | <PusiteGA> yep sorry |
16:01:09 | FromDiscord_ | <PusiteGA> hmm, x..n5 |
16:01:31 | FromDiscord_ | <PusiteGA> yep ulgy xD |
16:01:43 | narimiran | keep calm and use `countdown` ;) |
16:14:59 | * | floppydh quit (Quit: WeeChat 2.3) |
16:17:19 | * | dddddd joined #nim |
16:17:35 | FromDiscord_ | <PusiteGA> does nim not have int++ |
16:17:48 | FromDiscord_ | <PusiteGA> var num:int |
16:17:53 | FromDiscord_ | <PusiteGA> num=num+1 |
16:17:57 | FromDiscord_ | <PusiteGA> or num++ |
16:18:34 | FromGitter | <coffeepots> num += 1 or nim.inc or inc(num) |
16:18:46 | narimiran | inc num |
16:19:56 | * | banc quit (Ping timeout: 268 seconds) |
16:27:38 | FromDiscord_ | <PusiteGA> ty 😃 |
16:29:40 | * | banc joined #nim |
17:17:21 | * | krux02 quit (Ping timeout: 260 seconds) |
17:21:34 | * | krux02 joined #nim |
17:32:05 | krux02 | shashlick, what do you mean with enums that are out of order? |
17:36:26 | FromGitter | <Clyybber> krux02 Is it intended for int literals to not be implicitly converted to distinct int types? |
17:36:27 | * | krux02 quit (Remote host closed the connection) |
17:40:24 | shashlick | krux02: when you wrap C/C++ libs, often you run into enums which are out of order numerically |
17:41:24 | shashlick | straight conversion from c2nim doesn't work since Nim expects enums to be in order |
17:42:11 | * | vegax87 quit (Changing host) |
17:42:12 | * | vegax87 joined #nim |
17:42:12 | * | vegax87 quit (Changing host) |
17:42:12 | * | vegax87 joined #nim |
17:42:36 | shashlick | you get an error - invalid order in enum |
17:43:04 | FromGitter | <Clyybber> shashlick Funny, this is the problem im currently trying to solve |
17:43:09 | FromGitter | <Clyybber> By using distinct ints |
17:43:13 | FromGitter | <Clyybber> instead of enums |
17:46:16 | shashlick | check out https://github.com/tboox/tbox/blob/master/src/tbox/platform/socket.h#L45 for example |
17:46:47 | shashlick | @Clyybber: we can work around it - in nimgen I have to reorder things and it's a pain |
17:47:10 | FromGitter | <Clyybber> For some things it is impossible to work around, |
17:47:22 | FromGitter | <Clyybber> for example the vulkan API uses duplicate enum values |
17:47:25 | shashlick | using distinct ints means we will need to make changes to c2nim |
17:47:31 | FromGitter | <Clyybber> I did |
17:47:36 | FromGitter | <Clyybber> it is very hacky tho |
17:47:47 | FromGitter | <Clyybber> So I didn't open a PR yet |
17:47:51 | shashlick | my main question to Araq is why enums need to be in order in the first place |
17:48:30 | FromGitter | <Clyybber> Do string enums have to be in order as well? |
17:49:13 | leorize | how can you order strings? ;) |
17:49:21 | shashlick | https://nim-lang.org/docs/manual.html#types-enumeration-types |
17:49:23 | FromGitter | <Clyybber> Alphabetically |
17:49:32 | leorize | no, only the index matters |
17:49:47 | leorize | string enum is just a fancy way to prevent you from writing your own `$` |
17:49:59 | FromGitter | <Clyybber> Yeah, I see |
17:50:40 | shashlick | @Clyybber: what does your PR look like |
17:50:46 | shashlick | c2nim is currently broken for me |
17:50:48 | FromGitter | <Clyybber> It doesnt exist yet |
17:51:08 | FromGitter | <Clyybber> To give you an idea of how hacky it is currently |
17:51:27 | shashlick | see my comment - https://github.com/nim-lang/c2nim/commit/be3e8b9ab81c25cc0cb10b1ae117da57f71560e3 |
17:51:31 | FromGitter | <Clyybber> I use sed to fix up the file after generating |
17:51:51 | shashlick | you should check out nimgen at some point 😄 |
17:52:09 | FromGitter | <Clyybber> It would be overkill for my use case |
17:52:28 | FromGitter | <Clyybber> And i gotta finish that distinct int thing |
17:52:49 | shashlick | fair |
17:52:54 | FromGitter | <Clyybber> but for that I need a way to generate a proc that takes int literals |
17:52:59 | shashlick | it has a cli too in case it helps - feedback is always great |
17:53:30 | FromGitter | <Clyybber> Yeah, will try it out in the future |
17:53:52 | FromGitter | <Clyybber> Btw, do you know how I can write a proc that takes int literals as arguments? |
17:54:05 | shashlick | what are you wrapping |
17:54:10 | FromGitter | <Clyybber> Vulkan |
17:54:19 | FromGitter | <Clyybber> C Headers |
17:55:20 | shashlick | what do you mean int literal? shouldn't a parameter type of int not work |
17:55:36 | FromGitter | <Clyybber> Oh, fuck me |
17:55:38 | FromGitter | <Clyybber> yeah |
17:55:50 | FromGitter | <Clyybber> thanks |
17:56:51 | leorize | Clyybber: if you want something that only takes literal int, then use `int{lit}` as the param type |
17:57:07 | FromGitter | <Clyybber> Ah, thanks |
17:57:17 | FromGitter | <Clyybber> Btw, where is this documented? |
17:57:21 | FromGitter | <Clyybber> I couldnt find it? |
17:57:39 | leorize | somewhere in the manual |
17:57:56 | leorize | it was written for templates, but you can use them for procs as well afaik |
17:58:19 | FromGitter | <Clyybber> Can I overload `+` with a template? |
17:58:54 | leorize | see overloading resolution in the manual |
18:14:06 | FromGitter | <Varriount> Has anyone created anything actor-based in Nim? |
18:15:44 | FromGitter | <Clyybber> Not that I know of |
18:16:30 | FromGitter | <Clyybber> shashlick This is madness: https://github.com/KhronosGroup/Vulkan-Docs/blob/master/include/vulkan/vulkan_core.h#L492 |
18:17:28 | shashlick | wow that's an even better example |
18:24:39 | FromGitter | <Clyybber> Oh nice, nim is asking me for an implementation of a `{.cdecl.}` proc |
18:30:18 | shashlick | did you {.compile.} in a .c file? |
18:30:33 | shashlick | i'm still stuck on using a global variable in a macro |
18:30:35 | shashlick | any tips |
18:34:33 | FromGitter | <Clyybber> Sry I cant help you with that |
18:34:45 | FromGitter | <Clyybber> And nope, i did not use {.compile.} |
18:34:56 | FromGitter | <Clyybber> The problem is because of the reorder pragma |
18:34:58 | FromGitter | <Clyybber> i think |
18:36:08 | shashlick | okay I had to use {.compiletime.} for the var |
18:43:42 | * | ftsf quit (Ping timeout: 272 seconds) |
18:45:17 | FromDiscord_ | <Zachary Carter> Varriount: there is this library |
18:45:38 | FromDiscord_ | <Zachary Carter> https://github.com/vegansk/nimactors |
18:45:39 | FromDiscord_ | <Zachary Carter> and then there is |
18:45:51 | FromDiscord_ | <Zachary Carter> https://github.com/evacchi/nimoy |
18:51:30 | shashlick | how do you print the output ast of a macro |
18:53:32 | FromDiscord_ | <Zachary Carter> dumpTree |
18:54:03 | FromDiscord_ | <Zachary Carter> or treeRepr |
18:54:06 | shashlick | that just prints the tree of the macro being invoked |
18:54:12 | shashlick | not the ast generated by the macro |
18:54:15 | FromDiscord_ | <Zachary Carter> oh |
18:54:41 | FromDiscord_ | <Zachary Carter> I think the other one is - dumpAstGen / astGenRepr |
19:02:44 | * | deepend quit (Quit: bye) |
19:03:01 | * | deepend joined #nim |
19:03:36 | shashlick | None of them work |
19:04:01 | shashlick | There's expandMacros but not working either |
19:08:11 | narimiran | shashlick: echo result.repr ? |
19:08:51 | FromGitter | <Clyybber> shashlick Do you mean like the ast as used in the compiler? |
19:08:57 | FromGitter | <Clyybber> Or as in macros? |
19:11:53 | shashlick | My macro is generating ast |
19:11:57 | shashlick | How do I print that |
19:13:49 | narimiran | so you want to print the result of your macro? |
19:15:51 | shashlick | yes |
19:16:10 | narimiran | and my solution posted above didn't work for you? |
19:16:57 | shashlick | it worked! |
19:17:53 | shashlick | if you have var name: NimNode - what's the initial value? |
19:18:58 | shashlick | okay name != nil seems to work |
19:28:46 | FromGitter | <kdheepak> How do I get the C file output when building a lib in Nim? |
19:29:33 | narimiran | @kdheepak you want to see the generated .c file? |
19:29:53 | FromGitter | <kdheepak> Yes that is correct |
19:30:31 | narimiran | take a look at ~/.cache/nim |
19:32:41 | FromGitter | <kdheepak> Thanks! |
19:35:24 | FromGitter | <kdheepak> Can the nimcompiler return the location of nimbase.h? |
19:36:15 | FromGitter | <kdheepak> nimbase.h doesn't seem to be in ~/.cache/nim |
19:41:12 | FromDiscord_ | <PusiteGA> do nim arreys count from 1 or did some dude posted worng |
19:41:14 | shashlick | can you have a proc return different types |
19:41:23 | FromGitter | <kdheepak> I guess I'm looking for the exact commands nim is running to generate a library. |
19:41:24 | shashlick | int or float etc |
19:41:33 | FromDiscord_ | <PusiteGA> as i know seq are counted from 0 i think |
19:41:36 | narimiran | @PusiteGA they can start from any number you like, but the default is 0 |
19:41:39 | FromGitter | <kdheepak> Because I might have to replicate it without using the nim compiler. |
19:42:07 | FromDiscord_ | <PusiteGA> yep was talking about default |
19:42:08 | narimiran | you can do `var myArray = array[123..127, char]` |
19:42:28 | narimiran | shashlick: no can do |
19:43:04 | narimiran | btw, @PusiteGA, where are you from? |
19:48:16 | * | kapil____ joined #nim |
19:51:17 | shashlick | thanks for the help guys |
19:52:28 | shashlick | don't we have a proc to convert an identifier into the nim format? |
20:17:29 | shashlick | i'm trying to write a template that has two variable portions - once is the body I want to pass, but i also declare variables at the top - any ideas on how to send 2 variable portions to a template? |
20:23:58 | FromDiscord_ | <Generic> https://nim-lang.org/docs/manual.html#procedures-do-notation ? |
20:30:55 | * | theelous3 joined #nim |
20:34:03 | * | wildlander joined #nim |
20:44:24 | FromDiscord_ | <PusiteGA> from Serbia |
20:44:41 | FromDiscord_ | <PusiteGA> why |
20:57:04 | * | zachk joined #nim |
20:57:39 | * | zachk quit (Changing host) |
20:57:39 | * | zachk joined #nim |
21:18:06 | FromDiscord_ | <PusiteGA> how to write varargs |
21:21:30 | FromDiscord_ | <PusiteGA> am trying to use var wrdp:string = wrd.multiReplace tuple["A","U"], tuple["T","A"] |
21:21:52 | FromDiscord_ | <PusiteGA> duno how to pass arugments to multiReplace proc |
21:22:44 | narimiran | because i wanted to check if your nick means what i thought it means ;) |
21:22:48 | shashlick | @PusiteGA: https://github.com/genotrance/nimgen/blob/master/src/nimgen/external.nim#L6 |
21:22:51 | narimiran | (hello from croatia ;)) |
21:23:14 | * | shashlick quit (Remote host closed the connection) |
21:23:55 | FromDiscord_ | <PusiteGA> yep its my nick from playing Fonline so it stick , hello 😃 |
21:26:35 | FromDiscord_ | <PusiteGA> ty shashlick |
21:29:28 | * | dddddd quit (Ping timeout: 264 seconds) |
21:31:37 | * | dddddd joined #nim |
21:43:02 | * | narimiran quit (Remote host closed the connection) |
21:50:25 | * | rlr quit (Quit: quitting) |
21:54:01 | * | Snircle joined #nim |
21:55:42 | * | dddddd quit (Remote host closed the connection) |
21:57:27 | * | dddddd joined #nim |
22:00:02 | * | Trustable quit (Remote host closed the connection) |
22:05:35 | * | dddddd quit (Remote host closed the connection) |
22:05:42 | * | Jesin quit (Quit: Leaving) |
22:07:07 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
22:16:42 | * | dddddd joined #nim |
22:23:02 | * | deech joined #nim |
22:26:17 | deech | I'm using Nim as a nice alternative to C for wrapping C++ libs. Is there a way to statically ensure that nothing allocates, eg. throw a error at compile time a Nim string is used? |
22:37:06 | * | stefanos82 quit (Quit: Quitting for now...) |
22:51:49 | * | vlad1777d joined #nim |
23:27:27 | * | kapil____ quit (Quit: Connection closed for inactivity) |
23:30:38 | * | theelous3 quit (Ping timeout: 244 seconds) |
23:38:07 | FromGitter | <rayman22201> @deech I think using --gc:none should do what you want, but there are bugs unfortunately https://github.com/nim-lang/Nim/issues/8373 |
23:46:29 | cavariux | In newer versions Araq is pushing more towars --gc:stack https://forum.nim-lang.org/t/2489 |
23:52:21 | * | beatmox joined #nim |
23:52:34 | * | Snircle joined #nim |
23:56:10 | FromGitter | <rayman22201> --gc:stack is deprecated. It's called --gc:regions now I believe |
23:56:27 | FromGitter | <rayman22201> that would also work, but it's not quite the same thing |
23:57:55 | FromGitter | <rayman22201> yeah, see here, they are synonyms now: https://github.com/nim-lang/Nim/blob/73c306258b6e0e82cc977a8a5ce3e21c32ea8942/compiler/commands.nim#L233 |
23:58:55 | deech | rayman22201: So you're saying that gc:none will catch allocations at compile time on the Nim side? Even if it's buggy now it's fine so long as it's usable and will be less buggy in the future. |