<< 16-11-2018 >>

00:00:04FromDiscord_<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:04shashlickcool o
00:00:15shashlicki'll check but its like using a global in a macro
00:00:33FromDiscord_<Zachary Carter> shashlick - I'm reading: https://en.wikipedia.org/wiki/Hygienic_macro
00:00:43xaceZachary, my concern is a 80kb file generated for a hello world, but I do understand the circumstances
00:01:02FromDiscord_<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:07FromDiscord_<Zachary Carter> but I still don't fully understand it
00:01:17xaceZachary: nah I find a problem with having every client pull a large JS file which really shouldn't be that big
00:01:42FromDiscord_<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:22FromDiscord_<Zachary Carter> also - are you compiling with -d:release
00:02:23FromDiscord_<Zachary Carter> ?
00:02:33xacepossibly, 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:43xaceyessir, karax -d:release
00:02:49xacekarun*
00:02:49FromDiscord_<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:56FromDiscord_<Zachary Carter> nor are you using TypeScript or Flow
00:03:22FromDiscord_<Zachary Carter> JS is flawed to begin with - everyone clamors for dynamic languages and bashes C/C++ for their terrible build systems
00:03:28FromDiscord_<Zachary Carter> and then we end up with webpack - which is a linker
00:03:50FromDiscord_<Zachary Carter> and half of the ecosystem revolves around adding type safety back into the language
00:04:04xaceif i was the benevolent dictator, i would kill the web as it is today
00:04:18FromDiscord_<Zachary Carter> many of us I think share the same sentiment
00:04:26FromDiscord_<Zachary Carter> but do you try to keep up with the madness or just say eff it?
00:04:38FromDiscord_<Zachary Carter> maybe we should just go back to JS and jquery
00:04:47FromDiscord_<Zachary Carter> and put effort into not writing spaghetti code
00:04:57xacei avoid the web at all costs, and if I use it, i keep it very simple
00:05:18FromDiscord_<Zachary Carter> yeah - but definitions of simplicity amongst web devs differ too
00:05:36FromDiscord_<Zachary Carter> my general finding is that as soon as you escape the world of system programming
00:05:51FromDiscord_<Zachary Carter> which I'm not very involved in / don't have a lot of knowledge about
00:06:01FromDiscord_<Zachary Carter> opinions regarding software and quality tend to swing wildly
00:06:21FromDiscord_<Zachary Carter> everyone in the systems programming world seems to agree on certain truths
00:07:02FromDiscord_<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:19FromDiscord_<Zachary Carter> like how to optimize CSS rules and shit
00:08:16FromDiscord_<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:59FromGitter<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:18FromDiscord_<Zachary Carter> exactly
00:10:27xaceyeah, I understand that.
00:10:38FromDiscord_<Zachary Carter> I don't think the JS backend is bad - optimization wise anyway
00:11:39*sagax quit (Quit: Konversation terminated!)
00:16:11FromGitter<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:41FromGitter<timotheecour> good idea; this could be automated in nim js backend
00:17:44FromGitter<rayman22201> webpack is just so annoying / complex to setup...
00:18:56FromGitter<rayman22201> @timotheecour sorry for lagging on the js index thing. All my free time has been taken up with family stuff.
00:19:11FromGitter<rayman22201> I'm only on the chat as a sly distraction at work lol
00:19:38FromGitter<rayman22201> I haven't forgotten abut it though. I just wanted to let you know
00:20:34FromGitter<timotheecour> ok there’s still hope i goess ;-)
00:20:48FromGitter<rayman22201> lol
00:21:02FromGitter<timotheecour> btw the new `nimfind` gave me an idea of a non-static (real) webserver to backup docs
00:21:04krux02@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:55FromGitter<rayman22201> This is true. idk. It would be an interesting experiment
00:21:57FromGitter<rayman22201> Also, @zacharycarter I think you mentioned this, but getting Nim modules to map to JS modules would help.
00:22:25FromGitter<timotheecour> that webserver could be hosted locally ; and could support more interesting queries (eg based on argument types of a proc etc)
00:23:12FromGitter<timotheecour> right, ES6 modules could be used for that; in support of separate compilation (there was a forum post on this)
00:23:48FromDiscord_<Zachary Carter> no
00:23:50FromDiscord_<Zachary Carter> please no webpack
00:24:15krux02rayman22201: what should the mapping to js modules bring?
00:24:16FromDiscord_<Zachary Carter> use Parcel JS if you need a bundler
00:24:30FromDiscord_<Zachary Carter> and again - webpack and parceljs etc are essentially just linkers for JSs
00:24:45FromGitter<timotheecour> the mapping could bring separate compilation, potentially for speedup
00:24:46FromDiscord_<Zachary Carter> you can just use a CDN and tooling to accomplish a lot of this
00:25:00FromDiscord_<Zachary Carter> use google closure compiler
00:25:32FromDiscord_<Zachary Carter> there is a ton of nonsense in the webdev world - webpack is a major example of it
00:26:17FromDiscord_<Zachary Carter> it's more difficult to use than gcc / clang
00:26:29krux02timotheecour: I don't get that advantage for an interpreted language
00:26:46FromGitter<timotheecour> compilation time?
00:26:47krux02nim has to touch every nim file on compilation
00:26:56krux02yes
00:27:23FromDiscord_<Zachary Carter> well ES6 modules are a different subject I think
00:27:35krux02@zacharycarter there is a lot of nonsense in every topic when it becoms too popular
00:27:41FromDiscord_<Zachary Carter> agreed
00:27:50FromDiscord_<Zachary Carter> http://exploringjs.com/es6/ch_modules.html
00:27:53FromGitter<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:55FromDiscord_<Zachary Carter> if you really want to understand the topic
00:28:10FromDiscord_<Zachary Carter> isn't this the whole incremental compilation feature?
00:28:18FromDiscord_<Zachary Carter> or is that only for the C backend?
00:29:06FromDiscord_<Zachary Carter> https://twitter.com/JamesMcNellis/status/1063000460280377344 - has my interest
00:29:15krux02when 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:41FromDiscord_<Zachary Carter> this sounds like my job
00:30:50krux02timotheecour: 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:50FromGitter<timotheecour> well point is single js output file definitely prevents incremental compilation
00:30:58FromDiscord_<Zachary Carter> but when I say that - I almost get fired
00:31:03krux02but compiling is always a complete rebuild of the project
00:31:18FromDiscord_<Zachary Carter> timotheecour: I see what you mean
00:31:21krux02there is effort to get incremental compilation in Nim, but nim isn't there yet.
00:31:51FromDiscord_<Zachary Carter> the thing is
00:31:57FromDiscord_<Zachary Carter> if you're really leveraging the modern webs tack
00:32:08FromDiscord_<Zachary Carter> you're not just using Nim and compiling to JS - you're probably using babel
00:32:11FromDiscord_<Zachary Carter> and then you're probably using a bundler
00:32:29krux02@timotheecour: a single js output file is certainly not a blocker for incremental compilation.
00:32:37FromGitter<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:48FromDiscord_<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:09FromDiscord_<Zachary Carter> nothing about JS is lean or efficient
00:33:17krux02well you have to hope Araq is online and chat with him about it
00:33:22krux02but the feature is not ready yet
00:33:34krux02the idea is to have a prototypec that works with a database
00:33:49FromGitter<timotheecour> ok so blurb / scratch docs yet?
00:33:56krux02and there are changes in the language (restrictions) to even out the way for incremental compilation
00:35:06krux02incremental compilation is in development, definitively to document anything, because it is not 100 decided on how it will work eventually.
00:35:23FromDiscord_<Zachary Carter> what is 100% decided upon at this point haha?
00:35:27krux02but to enable incremental compilation static vars have been restricted.
00:35:36FromDiscord_<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:39FromDiscord_<Zachary Carter> and knowing what to expect next
00:36:00FromDiscord_<Zachary Carter> or what will be formalized and hit prime time vs what is just experimental
00:36:15FromGitter<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:10krux02the 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:32krux02that delays a final v1 more and more.
00:37:51krux02I see my job here to say No more often, so that a v1 can be reached
00:39:09krux02For example, I want to exclude concepts from V1, because they are not necessary and cause problems.
00:39:22krux02they should be there, but only behind an experimental flag.
00:39:38FromGitter<timotheecour> i mean they already kinda exist and r used in the wild
00:39:54FromGitter<timotheecour> (and yes, exponential CT time shd be fixed)
00:40:08krux02it isn't even sure if it can be fixed
00:40:27*darithorn quit (Ping timeout: 250 seconds)
00:40:51FromGitter<timotheecour> ah 1st time i heard that; is there a post on that?
00:41:50FromGitter<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:24FromDiscord_<Zachary Carter> speaking of concepts - something I linked earlier - https://twitter.com/JamesMcNellis/status/1063000460280377344
00:42:25krux02as 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:26FromGitter<timotheecour> and I don’t think it’d even be all that hard to implement
00:42:42krux02I think it is no secret that I don't like them
00:42:52FromDiscord_<Zachary Carter> I think Nim is bowing to community pressure to a degree and straying from its design goals
00:43:12FromDiscord_<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:23FromDiscord_<Zachary Carter> but features need to be fully baked before new features are added
00:43:38FromDiscord_<Zachary Carter> and when the language is billed as a language for game development and systems programming
00:43:48FromDiscord_<Zachary Carter> we need to be feature complete in comparison to competitors
00:43:51FromDiscord_<Zachary Carter> or at least offer alternatives
00:43:53FromGitter<timotheecour> well it’s chicken egg; that’s why we have —experimental flags
00:43:56krux02yea, 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:02FromDiscord_<Zachary Carter> well right
00:44:24FromDiscord_<Zachary Carter> I guess my sentiment is - they shouldn't drive development - and they probably haven't
00:44:30krux02the 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:31FromDiscord_<Zachary Carter> but there's so much in flight / flux that it's hard to keep up with it all
00:44:57krux02I understand
00:44:59FromDiscord_<Zachary Carter> I think getting the memory management stuff down pat - figuring out destructors and the new runtime are the most important
00:45:05FromDiscord_<Zachary Carter> and it sounds like that's the current focus
00:45:07*V-X quit (Remote host closed the connection)
00:45:08FromDiscord_<Zachary Carter> so I'm 100% on board
00:45:09krux02I hate when things are in flux
00:45:32FromDiscord_<Zachary Carter> and while I think zahary did amazing work on destruuuctors
00:45:36FromDiscord_<Zachary Carter> err sorry - concepts
00:46:00FromDiscord_<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:16krux02I just have a nice idea, I wonder if I can implement all important features of concepts via macros.
00:46:18FromDiscord_<Zachary Carter> but I don't know the background on how that was prioritize
00:46:27FromDiscord_<Zachary Carter> but I don't know the background on how that was prioritized
00:46:27krux02so that a big language feature can be dropped in favor of a library.
00:46:50FromGitter<zetashift> Isn't that partly because they are not stable yet and there is little documentation about it?
00:47:06FromDiscord_<Zachary Carter> maybe - but concepts apparently aren't unique to Nim
00:47:16FromDiscord_<Zachary Carter> that's another issue I've had - like when a I hear about a concept in Nim
00:47:34FromDiscord_<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:42FromDiscord_<Zachary Carter> and that's my lack of formal CS background - but it still sucks sometimes
00:47:43krux02I haven't found a conccpts implementation in any language that I would want to use.
00:48:12krux02there is interfaces in Java, and that is based on inheritance
00:48:17FromDiscord_<Zachary Carter> Krux02: I'm glad you're on board tbh
00:48:18FromGitter<timotheecour> @krux02 but it’d still need some compiler support of course, correct?
00:48:25FromDiscord_<Zachary Carter> mostly because you and Araq don't see eye to eye on everything
00:48:32FromDiscord_<Zachary Carter> and it's going to be good to have another opinion in the house
00:48:52FromDiscord_<Zachary Carter> especially one that is familiar with gfx programming
00:49:34krux02thanks
00:49:56krux02it was my idea to drop the math library from the standard library
00:50:17FromDiscord_<Zachary Carter> yes - and if we still have those color libs
00:50:19FromDiscord_<Zachary Carter> let's get rid of those too
00:50:27FromDiscord_<Zachary Carter> 😛
00:50:40krux02never used them
00:50:52FromDiscord_<Zachary Carter> likewise
00:50:58FromGitter<zetashift> Wait what math is getting dropped?
00:51:03krux02they are more harmful than useful?
00:51:15FromDiscord_<Zachary Carter> I'm not sure if the colors module is harmful
00:51:20FromDiscord_<Zachary Carter> but I'd also question how useful it is
00:51:26krux02zetashift: years ago there was some vector math for graphcis
00:51:27FromGitter<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:29FromDiscord_<Zachary Carter> or if anyone is actually using it
00:51:58krux02but nothing is missing, nim_glm is much better
00:52:00FromGitter<zetashift> oh yea that doesn't seem something you'd include like that in a stdlib
00:52:16FromGitter<zetashift> I thought the math module was getting dropped which seemed weird
00:52:18FromDiscord_<Zachary Carter> nor do random hex color codes
00:52:22FromDiscord_<Zachary Carter> https://nim-lang.org/docs/colors.html
00:52:43FromDiscord_<Zachary Carter> like - the entire graphics module can go IMO
00:52:54FromDiscord_<Zachary Carter> if it hasn't already
00:53:04krux02another 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:05FromDiscord_<Zachary Carter> you need a robust string manipulation library
00:54:26FromGitter<zetashift> well that isn't bad on it's own, that be dependent on how solid the PR is no?
00:54:26FromDiscord_<Zachary Carter> but I think it's enough to find a solid implementation in whatever language
00:54:28FromDiscord_<Zachary Carter> mirror that
00:54:35FromDiscord_<Zachary Carter> and then draw a line in the sand
00:54:35krux02constantly 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:59FromDiscord_<Zachary Carter> so - say we have the equivalent of Python 3's string manipulation
00:55:01FromDiscord_<Zachary Carter> or whatever language
00:55:06FromDiscord_<Zachary Carter> and say - we're not doing anything else
00:55:20FromDiscord_<Zachary Carter> drop the math library - it's not needed
00:55:24FromGitter<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:24FromGitter... client, which is used for larger JS projects.
00:56:08krux02lazy loading is stupid
00:56:21FromDiscord_<Zachary Carter> I like timotheecour's suggestion
00:56:25FromGitter<rayman22201> lol
00:56:35FromGitter<timotheecour> which one
00:56:38FromDiscord_<Zachary Carter> limit the stdlib to what is needed for the stdlib
00:56:54FromDiscord_<Zachary Carter> don't include any extraneous modules
00:57:02krux02lazy loading is the reason the github web interface is so horribly slow
00:57:07FromDiscord_<Zachary Carter> otherwise we're just inventing shit that people might use
00:57:14FromDiscord_<Zachary Carter> but definitely won't help to maintain / extend
00:57:28krux02everything is with indirections causing server requests and slowing everything down
00:57:29FromDiscord_<Zachary Carter> and they'll most likely build or seek out more optimal solutions to their problems
00:57:43FromDiscord_<Zachary Carter> okay
00:57:52FromDiscord_<Zachary Carter> lazy loading is useful in certain scenarios
00:58:00FromDiscord_<Zachary Carter> like if you have an infinite scroll experience
00:58:10FromDiscord_<Zachary Carter> lazy loading is ideal
00:58:21krux02infinite scrolling is horrible
00:58:27krux02I hate when websites do that
00:58:33FromDiscord_<Zachary Carter> would you rather have that than a wizard / stepper?
00:58:43FromDiscord_<Zachary Carter> or multiple pages?
00:58:45FromGitter<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:47FromGitter<rayman22201> I make no value judgements. It's a tool like everything else, some projects may call for it
00:58:49FromDiscord_<Zachary Carter> with browser relaods?
00:59:05krux02multiple pages, yes, or one page with everything
00:59:22FromDiscord_<Zachary Carter> that's infinite scroll
00:59:26FromDiscord_<Zachary Carter> one page with everything
00:59:35krux02no
00:59:39FromDiscord_<Zachary Carter> would you rather wait for anything to be painted before something is painted?
00:59:47FromDiscord_<Zachary Carter> err everything to be loaded rather
00:59:57FromDiscord_<Zachary Carter> that's what the problem solves really
01:00:08FromDiscord_<Zachary Carter> if you have 1mb of content to load but can load only what's needed to render the frame
01:00:17krux02the best solution is to have a single file that contains everything
01:00:35krux02the browser already streams in the data from big files
01:00:50krux02there is no need to build anything is javascript do load dynamically
01:01:06FromDiscord_<Zachary Carter> yeah but I'm not quite sure the dom works the same way
01:01:28FromDiscord_<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:28FromGitter<kdheepak> nimble build doesn't seem to be using config.nims, any suggestions on what I might be missing?
01:01:35krux02well my ideas are mostly for static content
01:01:48FromDiscord_<Zachary Carter> yeah - well static content is under-used
01:01:57FromDiscord_<Zachary Carter> everyone should be opting for static sites whenever they can
01:02:10krux02yes
01:02:12FromGitter<timotheecour> @kdheepak please report this in nimble issues
01:02:18FromDiscord_<Zachary Carter> but the whole SEO thing and framework reliance has made this goal seemingly impossible
01:02:25FromDiscord_<Zachary Carter> so now everyone is obsessed with SSR and shit like that
01:03:00FromDiscord_<Zachary Carter> make the most complicated monstrosity you can, and then figure out how to serve it optimally via the browser
01:03:17FromDiscord_<Zachary Carter> it's like people who don't know what they're doing - are guiding us in what to do 😛
01:03:19xacewait, is math going to be moved to the nimble packages?
01:03:20krux02best 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:41krux02xace, no
01:05:12FromGitter<rayman22201> lol. the math thing got taken out of context.
01:05:51xacei was afk for a little while and the conversation just exploded, trying to skim through it
01:06:18xacei find it really hard to keep track of the chat especially with the FromGitter and FromDiscord bots offsetting yournames
01:06:27xace(from irc atleast)
01:06:34FromGitter<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:34krux02the discussion was about that my priority is to shrink the standard library whenever that is possible
01:06:37FromGitter<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:13krux02the concept behind it was invented by Caesar, divide and conquer
01:07:33FromGitter<rayman22201> I agree with both of you @timotheecour and @krux02
01:08:12FromDiscord_<Zachary Carter> none of the db stuff - if it still is - should be in the stdlib
01:08:15FromGitter<timotheecour> there’s already for eg: `tests/deps/jester-#head/jester/patterns.nim`; this pattern could be generalized
01:08:38xaceim 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:39FromGitter<timotheecour> wasn’t db stuff used for incremental compilation?
01:08:47FromDiscord_<Zachary Carter> oh - in that case
01:08:48FromDiscord_<Zachary Carter> nevermind
01:09:00krux02timotheecour: 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:16FromDiscord_<Zachary Carter> you can use git subtrees
01:09:22FromDiscord_<Zachary Carter> but they're not 100% ideal either
01:09:32krux02I know
01:09:37krux02I think I told you about them
01:09:43FromDiscord_<Zachary Carter> probably
01:09:50FromDiscord_<Zachary Carter> learned a lot of stuff from you 😛
01:10:00krux02you are welcome
01:10:45FromDiscord_<Zachary Carter> lol at work we used them - and I didn't know how to maintain them properly yet
01:10:55FromDiscord_<Zachary Carter> and every push was going through the entire commit history
01:11:00FromDiscord_<Zachary Carter> so pushes started taking minutes
01:11:20FromGitter<timotheecour> (or git submodules; which could be used for eg to track sources repo, as was already mentioned)
01:11:21FromDiscord_<Zachary Carter> now I'm disassembling my git tree until I understand how to properly use it 😛
01:11:45FromDiscord_<Zachary Carter> yeah - submodules are very useful too - subtrees are a little bit better for top-down organization I think
01:11:51FromDiscord_<Zachary Carter> but I'm not a master in either
01:12:13FromDiscord_<Zachary Carter> I can certainly screw up your project with both though 😛
01:12:51krux02I don't like the mental overhead of using git
01:13:00FromDiscord_<Zachary Carter> I agree - I prefer mercurial
01:13:02krux02it really takes a lot of time managing git commits
01:13:11krux02never used hg
01:15:56*zachk quit (Quit: Leaving)
01:18:14FromGitter<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:32FromGitter<timotheecour> (low coupling)
01:20:20krux02as far as I know nimfind uses internal structures of the compiler
01:20:27*leorize quit (Quit: WeeChat 2.3)
01:21:14FromGitter<timotheecour> actually u may be right; but compiler is a nimble package though?
01:21:43FromGitter<timotheecour> but ya, nimfind was a bad example, scratch that.
01:21:48krux02compiler a nimble package?
01:22:09FromGitter<rayman22201> Isn't the point of "compiler as a library" mean that isn't a problem?
01:22:30FromGitter<timotheecour> yes, it’s a nimble package: see compiler.nimble
01:22:31krux02if 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:01FromGitter<rayman22201> It was a refactor initiative that Araq had worked on. trying to find the github issues for it. hold on
01:24:25krux02I go to bed now
01:24:29krux02it is really late for me
01:24:49FromGitter<rayman22201> goodnight! @krux02
01:25:00krux02good night
01:25:12*krux02 quit (Remote host closed the connection)
01:25:46*xace joined #nim
01:32:30FromDiscord_<Zachary Carter> heh
01:32:37FromDiscord_<Zachary Carter> I think Araq was basically saying this earlier - https://pbs.twimg.com/media/DsFlk4ZVsAAMbpz.jpg:large
01:32:52FromDiscord_<Zachary Carter> with nimsuggest and json output and all of that
01:34:18FromGitter<timotheecour> Hah; fun diagram indeed; what’s your point though out of curiosity
01:35:10FromGitter<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:25FromGitter<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:43FromGitter<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:43FromGitter<timotheecour> tests/compilerapi/tcompilerapi.nim
01:38:57FromGitter<timotheecour> shows basic use of compiler as a library
01:39:42FromGitter<rayman22201> true, but there is no documentation about the work that was done to get to there.
01:44:31FromGitter<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:28FromDiscord_<Zachary Carter> timotheecour: I don't have any overall point tbh
02:11:45FromDiscord_<Zachary Carter> it seemed somewhat tangental to what you and Araq were discussing earlier - and I saw it tweeted
02:11:47FromDiscord_<Zachary Carter> so I figured i'd share
02:12:08FromGitter<timotheecour> i c i c…. i like the diagram :)
02:12:10FromDiscord_<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:35FromDiscord_<Zachary Carter> but I can also understand that all this customization leads to more maintenance and potential problems to take into consideration
02:12:44FromDiscord_<Zachary Carter> so I appreciate both sides of the proverbial coin
02:13:01FromDiscord_<Zachary Carter> I think the image is well done though 😛 I can at least state that case with confidence haha
02:13:13FromDiscord_<Zachary Carter> I think the image is well done though 😛 I can at least state that opinion with confidence haha
02:13:43FromGitter<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:31FromDiscord_<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:46FromDiscord_<Zachary Carter> going to add that name to my growing collection
02:15:22FromDiscord_<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:35FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bee41d3d001b9172069acf8]
04:13:00shashlickWhat kind of data format can be parsed in the vm today? I don't think json can
04:16:07FromDiscord_<Zachary Carter> yeah - pretty sure the JSON module doesn't work at compiletime
04:16:14FromDiscord_<Zachary Carter> ini maybe?
04:18:54FromGitter<gogolxdong> How to fix this for nimble?
04:20:20FromDiscord_<Zachary Carter> https://nim-lang.org/docs/parsecfg.html
04:23:24FromGitter<gogolxdong> I think you can nimble install nimdata, but I cannot, as the error above.
04:26:07FromDiscord_<Zachary Carter> yes
04:26:12FromDiscord_<Zachary Carter> Nimdata doesn't work with latest Nim
04:26:43FromDiscord_<Zachary Carter> err wait
04:26:55FromDiscord_<Zachary Carter> maybe it does - I don't know - I know it didn't a while back and I submitted a PR
04:27:32FromDiscord_<Zachary Carter> it was definitely merged and now I have no idea what the problem is - my bad
04:27:43shashlickNeed something hierarchical
04:27:57shashlickCfg is too simple
04:29:03FromGitter<gogolxdong> I can install from server while cannot install on my windows 10 WSL.
04:30:55FromGitter<gogolxdong> by cannot install I mean cannot install anything, I think something went wrong without awareness .
04:34:26FromDiscord_<Zachary Carter> shashlick: I dunno then - only thing I can think of is YAML / TOML
04:34:44FromDiscord_<Zachary Carter> not sure there are any libs for those formats that will allow you to leverage them at compile time
04:34:50FromDiscord_<Zachary Carter> you might be in the realm of inventing your own solution
04:34:55FromDiscord_<Zachary Carter> don't want to assert that though
04:35:04FromDiscord_<Zachary Carter> https://arxiv.org/pdf/1208.1176.pdf - might be interesting to the crypto heads in here
04:35:26FromDiscord_<Zachary Carter> or anyone interested in ciphers
05:10:43shashlickI'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:39FromGitter<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:50FromGitter<gogolxdong> @PMunch http://ix.io/1s56
07:22:31FromGitter<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:25FromGitter<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:51FromGitter<gogolxdong> http://ix.io/1s59
07:34:15FromGitter<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:18FromGitter<alehander42> the feature itself*
07:40:36FromGitter<alehander42> wow what is git subtrees :D I've been living a submodule-only life lately
07:44:34*krux02 joined #nim
08:06:33FromGitter<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:46FromGitter<alehander42> I know that doing this by default will break everything(I guess)
08:07:48FromGitter<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:05FromGitter<alehander42> Araq ? ^
08:21:23Araqsounds like a good idea, {.push strictRefs: on.} ?
08:27:17FromGitter<alehander42> yeah, something like this
08:27:32*dddddd joined #nim
08:27:49FromGitter<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:25Araqadding a module-wide switch is easy
08:31:02Araqit's the analysis itself that is hard :P
08:31:28Araqand what should 'ref T' mean? nilable or not?
08:31:36FromGitter<alehander42> well, I was afraid of that, yeah :D
08:32:16FromGitter<cyberlis> Araq, i thought any ref object is nilable
08:32:29FromGitter<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:57FromGitter<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:43FromGitter<alehander42> about the analysis: is it easy to determine if `.field` / `[]` is being overloaded by a function somewhere
08:34:48Araqcyberlis: we're discussing a language dialect where 'ref' is stricter
08:35:45FromGitter<cyberlis> oh, i see
08:35:54Araqhuh? the analysis would work on the analysed AST, there are no "overloaded" fields, they have been replaced by nkCall
08:36:18FromGitter<alehander42> ah, that's great
08:36:46*floppydh joined #nim
08:36:53FromGitter<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:58FromGitter<cyberlis> @timotheecour to use the tool, I have to install mongodb?
08:38:03*cavariux quit (Quit: Ping timeout (120 seconds))
08:38:08Araqhow is 'mongo' not a dependency?
08:38:25FromGitter<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:58Araqalehander42: if n != nil and n.typ != nil:
08:39:04FromGitter<timotheecour> nimongo is a pure nim mongodb driver (unlike other mango wrapper that needs libmongo, libbson)
08:39:07Araq n.typ = nil # fool the analyser
08:39:23Araq echo n.typ.field # valid?
08:40:16Araqit's hard because it's a control flow dependent analysis
08:40:43FromGitter<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:08Araqwith some dataflow aspects and depending on how hard you wanna make it you also need alias analysis
08:41:08leorizeso now you'd need to run a mongodb server to use it?
08:41:35FromGitter<timotheecour> well it’s all transparent, really
08:41:45FromGitter<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:42Araqtimotheecour, well it's cool that it works for you but that's not 'nimfind' anymore :-)
08:43:48FromGitter<alehander42> https://gist.github.com/alehander42/fad2707f7602e59b4e30bd6231cc450c
08:44:47FromGitter<alehander42> well, how does the compiler currently deal with `n.typ = nil` if `typ` is not nil
08:45:01FromGitter<alehander42> doesn't it need to prove the same things
08:45:41Araqif typ is not nil the assignment is invalid
08:46:12FromGitter<alehander42> exactly
08:46:16FromGitter<alehander42> and we just need to change the logic
08:46:21Araqbut I thought we're talking about strict refs that enforce the nil check
08:46:34FromGitter<alehander42> so if it's "potentiallyStillNilable" it just makes it nilable again
08:46:42FromGitter<alehander42> yes
08:46:56FromGitter<alehander42> and on the next line, echo n.typ.field will lead to an error
08:47:20FromGitter<alehander42> it's more like, n.typ = nil will act as creating(chaning) a new flow
08:47:22Araq"every usage of 'obj.field' must be dominated by an 'obj != nil' check"
08:47:55Araqtwo problems here:
08:48:02FromGitter<alehander42> every usage of obj.field must be on a obj which is currently notNilable
08:48:12Araq1. 'obj' might be a complex expression
08:48:23Araq2. 'obj' can be mutable
08:49:08FromGitter<alehander42> well, the first one shouldn't matter: we care only about the type and nilability of that expression
08:49:29FromGitter<alehander42> about the second one: currently if obj is `not Nil`
08:49:40Araqbut the type is 'ref T', not 'ref T not nil'
08:49:42FromGitter<alehander42> does nim ensure that `call(obj)` can't mutate it to nil
08:49:56FromGitter<alehander42> ok, what I imagine is probably different
08:50:29FromGitter<alehander42> aah I see what you mean
08:51:25FromGitter<alehander42> e.g.
08:51:40FromGitter<alehander42> if a(e) != nil: # is a(e) still not nil
08:51:53FromGitter<yglukhov> @iffy, right. I was thinking about not using `ndk-build` at all. But using `nim` instead.
08:53:36FromGitter<alehander42> Araq, well one more conservative solution is to just limit this to variables and field chains
08:57:12FromGitter<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:04FromGitter<alehander42> that's even easy to hint in the error message
09:00:21Araqlook at my example again
09:00:36Araqyou can make me write instead
09:00:51Araqif n != nil and (let t = n.typ; t != nil):
09:00:54Araq n.typ = nil
09:00:58Araq echo t.field
09:01:03Araqbut I won't like it
09:01:44FromGitter<alehander42> ok, I have a plan for this
09:01:49FromGitter<alehander42> but first, I want to say that
09:02:07FromGitter<alehander42> one of the problems should be fixed with bot strictRefs and notnil
09:02:24FromGitter<alehander42> var a = T() ⏎ if a != nil: ⏎ makeNil(a) ⏎ echoNotNil(a) [https://gitter.im/nim-lang/Nim?at=5bee87a09f5a9e6e41f2c88b]
09:02:32FromGitter<alehander42> I can trigger a segfault easily here
09:02:42FromGitter<alehander42> even if echoNotNil expects not nil
09:02:48FromGitter<alehander42> and nim thinks a is not nil
09:03:17FromGitter<alehander42> and I've turned notnil on
09:03:33leorizenotnil is generally broken afaik, which is why it was moved to experimental
09:03:49FromGitter<alehander42> so my idea is: != nil is not enough as a check
09:04:14FromGitter<alehander42> but instead, we need a way to track both type & "nilability" of a variable/field in each branch
09:04:39FromGitter<alehander42> and != nil just sets the nilability of `a` to false in the first branch
09:05:36FromGitter<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:48FromGitter<alehander42> so the analysis goes like
09:06:18FromGitter<alehander42> var a = T() # T Nilable ⏎ ⏎ if a != nil # open a new branch with new "nilability table" for it
09:06:38FromGitter<alehander42> #set a as NotNilable in this branch
09:06:54FromGitter<alehander42> ugh gitter, this should be just a comment
09:07:33FromGitter<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:49FromGitter<alehander42> echoNotNil(a) # well, it expects not nil, so this is a type error
09:08:41FromGitter<alehander42> basically each line in a branch can change the "branch-level" nilability of a variable/field
09:08:54FromGitter<alehander42> does this seem viable
09:09:57FromGitter<alehander42> (in the same way, you'll be able to write echo n.typ.field and be sure it's correct)
09:10:49AraqI'm not sure why we're having this conversation
09:11:10AraqI told you months ago to study "abstract interpretation" :P
09:12:08FromGitter<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:15Araqyou translate the program into an abstract machine that captures the nil-ness
09:12:25Araqof local variables
09:13:10Araqyou may re-label obj.field to obj_field (but watch out to do this properly) to have more locals to work with
09:13:33Araqyou run a fixpoint analysis on the abstract machine
09:17:13FromGitter<gogolxdong> ah, use getBitInfo, so esentially it's bitwise shift operation.
09:22:05FromGitter<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:27FromGitter<alehander42> except for the fixpoint thing, this is pretty important
09:22:57FromGitter<alehander42> for loops, I forgot that part
09:33:22Araqwhat about plan B?
09:33:44Araqenforce explicit initialization for every 'nilable' field.
09:33:54Araqthen nil bugs can only come from 'nil' in the source code
09:34:33Araqeasy backwards compat, easy solution, gives you 80% of the safety of the complete solution, maybe
09:36:38FromGitter<alehander42> what about variables? require explicit initialization for the nilable ones too?
09:38:01FromGitter<alehander42> I actually think it's a great idea, but I don't see how it's very backwards compatible
09:38:20FromGitter<alehander42> wouldn't my code which doesn't initialize nilable fields break after it?
09:38:40Araqwell yes, but the error would first be a warning
09:39:02Araqand yes, variables need to be initialized
09:39:05FromGitter<alehander42> well, the other error can be a warning first too
09:39:31Araqsure but it's unclear if the resulting language is bearable
09:39:48Araqwhereas with plan B it's pretty obviously bearable, ymmv
09:39:59FromGitter<alehander42> why? I think the implementation might be harder
09:40:06FromGitter<alehander42> but it will change the language even less
09:40:26FromGitter<alehander42> plan B requires people to change all their initializations
09:40:48FromGitter<alehander42> the other plan wants them to just check the cases where it might actually lead to an error
09:41:02FromGitter<alehander42> which would be still a posibility with plan B
09:41:26FromGitter<alehander42> also, I am not sure about the C backend, but plan B doesn't really help the js backend
09:41:52FromGitter<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:24Araqhuh?
09:42:26Araqinstead of
09:42:29Araqvar x: Foo
09:42:33Araqyou need to write
09:42:38Araqvar x: Foo = nil
09:42:47FromGitter<alehander42> and how does this help?
09:43:04FromGitter<alehander42> you still need to manually go back and find all nil usages
09:43:08*vlad1777d joined #nim
09:43:13Araqthen you get a 'nil' bug, and you wonder where the fuck the nil crept into
09:43:26Araqand it's when you wrote 'nil'
09:43:34FromGitter<alehander42> but I want the compiler to simply stop me from having a nil bug at all
09:43:43FromGitter<alehander42> after all that's why I don't use a dynamic lang
09:43:47Araqok, so you don't want plan B at all then
09:44:12Araqbecause there is nothing more to it
09:44:18FromGitter<alehander42> I thought plan B requires people to assign non-nil values
09:44:24FromGitter<alehander42> but it doesn't make a lot of sense, I agree
09:44:45Araqno, it requires people to assign a value, but nil is allowed
09:44:49FromGitter<alehander42> (my initial assumption doesnt make sense0
09:45:21FromGitter<alehander42> well, I don't think it comes close to proper nil checking
09:45:40FromGitter<alehander42> it still requires you to find a runtime nil error and debug it
09:46:19FromGitter<alehander42> and currently you can still put a watchpoint in gdb or something
09:48:55FromGitter<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:33FromGitter<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:41Araqthe paper is quite broken as far as I understand it
10:26:15FromGitter<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:49Araqmost analyses are *hard* without a 'join' opcode
10:27:13FromGitter<alehander42> so did it work for the use/def case ?
10:27:25Araqno.
10:31:51Araqit doesn't work for anything
10:32:41FromGitter<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:28Araqthe abs machine is usually simple, you can adapt dfa.nim
10:35:56Araqthe analysis on the DFA is hard
10:36:25FromGitter<alehander42> yeah, that's what I meant
10:37:30Araqthe analysis is simpler with a join opcode which we don't generate yet
10:37:49FromGitter<alehander42> if I have a `strictRefs` pragma, does this mean I should generate a sfStrictRefs flag from it for the proc symbol?
10:38:34AraqI would attach it to the PContext and avoid a proc-wise flag
10:38:46Araqbut whatever works for you
10:41:14FromGitter<alehander42> ah I see, well I'll take a better look at dfa.nim in the weekend and see
11:44:06FromGitter<alehander42> btw should I include initializing seq-s and strings with [] , "" in my jsgen refactoring
11:53:14AraqI dunno, there is also a pending PR for it
11:53:43AraqI don't understand the bugs, 'null' is [] or "" for Nim
12:13:32FromGitter<alehander42> which PR? I found only https://github.com/nim-lang/Nim/pull/9411
12:15:12Araqthat one
12:15:27Araqoh it's not WIP anymore, seems I need even more github notifications
12:17:52FromGitter<alehander42> hm, nulls/undefined are s a little bit weird for debugging/interop, but it's not a dealbreaker indeed
12:18:37FromGitter<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:41Araqsure
12:35:28*vlad1777d quit (Ping timeout: 245 seconds)
12:41:04*platoff_ joined #nim
12:43:25FromGitter<dawkot> can you get a `var T` out of a `ptr T`?
12:45:24leorizedawkot: 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:59FromGitter<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:16leorizeno
13:14:21leorizethat'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:43FromGitter<Varriount> @dawkot : The best you can do is use `when` or generics to handle such variations
14:24:26shashlickAraq: do you think you are open to allowing enums that are out of order?
14:35:43Araqmeh... why ...
14:53:53*narimiran joined #nim
15:10:40FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5beeddf0b86c70503f3e6627]
15:10:49FromGitter<gogolxdong> nimble refresh failed.
15:39:25FromDiscord_<PusiteGA> dumb qestion i can do for i in 0..27 but 27...0 wont work how to reverese loop
15:39:40narimiran`countdown`
15:39:45FromDiscord_<PusiteGA> ty
15:40:10narimiran`a..b` is basically a shorthand for `countup(a, b, 1)`
15:42:14FromDiscord_<PusiteGA> would be nice if tehere was short for coutdown too
15:42:35narimirani agree but i think we're in the minority
15:43:29FromDiscord_<PusiteGA> woudent it be a simple check if first number biger then one after ...
15:43:59narimiranbut there are situations where using `..` for countdown too would break the code
15:44:07narimiranthere should be another symbol for it
15:44:16narimiransomething like `..-`
15:44:59FromGitter<alehander42> most languages don't have this
15:45:03narimiran"implementing `..-` is left as an exercise for the reader" :)
15:45:07FromGitter<alehander42> ruby's `..` also works only up
15:45:39FromGitter<alehander42> in python you need range which is similar to type to countdown
15:46:34narimiran...but notice that `range(10, 0, -1)` is in nim: `countdown(10, 1, 1)`
15:46:42FromGitter<alehander42> I agree that a different symbol might be fine, but `..-a` might be confusing
15:47:12FromGitter<alehander42> maybe `..>` and `..>=` ?
15:47:52shashlickAraq: ordered enums are a nightmare for wrapping
15:47:56narimirani doubt we will see any of these officially
15:48:15shashlickEspecially when you have bitmasks
15:48:36shashlickHave to rewrite the entire thing manually
15:48:40*nsf quit (Quit: WeeChat 2.3)
15:49:03FromGitter<alehander42> distinct int?
15:49:35shashlickCannot 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:49FromDiscord_<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:47narimiranyou want to have 5 things of something, and you start with x amount
15:56:07FromGitter<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:07narimirannow you do `for i in x..5`
15:56:22narimiranand that works if x is <= 5
15:56:36narimiranbut what if x was 9?
15:56:44narimiranyou don't want to add anything
15:56:59narimiranand in your case you would add 5 more things
15:59:22FromDiscord_<PusiteGA> if x is 9 it should trow error out of bounds and crash
15:59:36FromDiscord_<PusiteGA> oh
15:59:39narimiran!?!
15:59:58FromDiscord_<PusiteGA> you mean then 9...5 and would go rewers down and that i dont wnat
15:59:59narimiran5 minutes ago you wanted it to work :D :D
16:00:00FromDiscord_<PusiteGA> yep sorry
16:01:09FromDiscord_<PusiteGA> hmm, x..n5
16:01:31FromDiscord_<PusiteGA> yep ulgy xD
16:01:43narimirankeep calm and use `countdown` ;)
16:14:59*floppydh quit (Quit: WeeChat 2.3)
16:17:19*dddddd joined #nim
16:17:35FromDiscord_<PusiteGA> does nim not have int++
16:17:48FromDiscord_<PusiteGA> var num:int
16:17:53FromDiscord_<PusiteGA> num=num+1
16:17:57FromDiscord_<PusiteGA> or num++
16:18:34FromGitter<coffeepots> num += 1 or nim.inc or inc(num)
16:18:46narimiraninc num
16:19:56*banc quit (Ping timeout: 268 seconds)
16:27:38FromDiscord_<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:05krux02shashlick, what do you mean with enums that are out of order?
17:36:26FromGitter<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:24shashlickkrux02: when you wrap C/C++ libs, often you run into enums which are out of order numerically
17:41:24shashlickstraight 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:36shashlickyou get an error - invalid order in enum
17:43:04FromGitter<Clyybber> shashlick Funny, this is the problem im currently trying to solve
17:43:09FromGitter<Clyybber> By using distinct ints
17:43:13FromGitter<Clyybber> instead of enums
17:46:16shashlickcheck out https://github.com/tboox/tbox/blob/master/src/tbox/platform/socket.h#L45 for example
17:46:47shashlick@Clyybber: we can work around it - in nimgen I have to reorder things and it's a pain
17:47:10FromGitter<Clyybber> For some things it is impossible to work around,
17:47:22FromGitter<Clyybber> for example the vulkan API uses duplicate enum values
17:47:25shashlickusing distinct ints means we will need to make changes to c2nim
17:47:31FromGitter<Clyybber> I did
17:47:36FromGitter<Clyybber> it is very hacky tho
17:47:47FromGitter<Clyybber> So I didn't open a PR yet
17:47:51shashlickmy main question to Araq is why enums need to be in order in the first place
17:48:30FromGitter<Clyybber> Do string enums have to be in order as well?
17:49:13leorizehow can you order strings? ;)
17:49:21shashlickhttps://nim-lang.org/docs/manual.html#types-enumeration-types
17:49:23FromGitter<Clyybber> Alphabetically
17:49:32leorizeno, only the index matters
17:49:47leorizestring enum is just a fancy way to prevent you from writing your own `$`
17:49:59FromGitter<Clyybber> Yeah, I see
17:50:40shashlick@Clyybber: what does your PR look like
17:50:46shashlickc2nim is currently broken for me
17:50:48FromGitter<Clyybber> It doesnt exist yet
17:51:08FromGitter<Clyybber> To give you an idea of how hacky it is currently
17:51:27shashlicksee my comment - https://github.com/nim-lang/c2nim/commit/be3e8b9ab81c25cc0cb10b1ae117da57f71560e3
17:51:31FromGitter<Clyybber> I use sed to fix up the file after generating
17:51:51shashlickyou should check out nimgen at some point 😄
17:52:09FromGitter<Clyybber> It would be overkill for my use case
17:52:28FromGitter<Clyybber> And i gotta finish that distinct int thing
17:52:49shashlickfair
17:52:54FromGitter<Clyybber> but for that I need a way to generate a proc that takes int literals
17:52:59shashlickit has a cli too in case it helps - feedback is always great
17:53:30FromGitter<Clyybber> Yeah, will try it out in the future
17:53:52FromGitter<Clyybber> Btw, do you know how I can write a proc that takes int literals as arguments?
17:54:05shashlickwhat are you wrapping
17:54:10FromGitter<Clyybber> Vulkan
17:54:19FromGitter<Clyybber> C Headers
17:55:20shashlickwhat do you mean int literal? shouldn't a parameter type of int not work
17:55:36FromGitter<Clyybber> Oh, fuck me
17:55:38FromGitter<Clyybber> yeah
17:55:50FromGitter<Clyybber> thanks
17:56:51leorizeClyybber: if you want something that only takes literal int, then use `int{lit}` as the param type
17:57:07FromGitter<Clyybber> Ah, thanks
17:57:17FromGitter<Clyybber> Btw, where is this documented?
17:57:21FromGitter<Clyybber> I couldnt find it?
17:57:39leorizesomewhere in the manual
17:57:56leorizeit was written for templates, but you can use them for procs as well afaik
17:58:19FromGitter<Clyybber> Can I overload `+` with a template?
17:58:54leorizesee overloading resolution in the manual
18:14:06FromGitter<Varriount> Has anyone created anything actor-based in Nim?
18:15:44FromGitter<Clyybber> Not that I know of
18:16:30FromGitter<Clyybber> shashlick This is madness: https://github.com/KhronosGroup/Vulkan-Docs/blob/master/include/vulkan/vulkan_core.h#L492
18:17:28shashlickwow that's an even better example
18:24:39FromGitter<Clyybber> Oh nice, nim is asking me for an implementation of a `{.cdecl.}` proc
18:30:18shashlickdid you {.compile.} in a .c file?
18:30:33shashlicki'm still stuck on using a global variable in a macro
18:30:35shashlickany tips
18:34:33FromGitter<Clyybber> Sry I cant help you with that
18:34:45FromGitter<Clyybber> And nope, i did not use {.compile.}
18:34:56FromGitter<Clyybber> The problem is because of the reorder pragma
18:34:58FromGitter<Clyybber> i think
18:36:08shashlickokay I had to use {.compiletime.} for the var
18:43:42*ftsf quit (Ping timeout: 272 seconds)
18:45:17FromDiscord_<Zachary Carter> Varriount: there is this library
18:45:38FromDiscord_<Zachary Carter> https://github.com/vegansk/nimactors
18:45:39FromDiscord_<Zachary Carter> and then there is
18:45:51FromDiscord_<Zachary Carter> https://github.com/evacchi/nimoy
18:51:30shashlickhow do you print the output ast of a macro
18:53:32FromDiscord_<Zachary Carter> dumpTree
18:54:03FromDiscord_<Zachary Carter> or treeRepr
18:54:06shashlickthat just prints the tree of the macro being invoked
18:54:12shashlicknot the ast generated by the macro
18:54:15FromDiscord_<Zachary Carter> oh
18:54:41FromDiscord_<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:36shashlickNone of them work
19:04:01shashlickThere's expandMacros but not working either
19:08:11narimiranshashlick: echo result.repr ?
19:08:51FromGitter<Clyybber> shashlick Do you mean like the ast as used in the compiler?
19:08:57FromGitter<Clyybber> Or as in macros?
19:11:53shashlickMy macro is generating ast
19:11:57shashlickHow do I print that
19:13:49narimiranso you want to print the result of your macro?
19:15:51shashlickyes
19:16:10narimiranand my solution posted above didn't work for you?
19:16:57shashlickit worked!
19:17:53shashlickif you have var name: NimNode - what's the initial value?
19:18:58shashlickokay name != nil seems to work
19:28:46FromGitter<kdheepak> How do I get the C file output when building a lib in Nim?
19:29:33narimiran@kdheepak you want to see the generated .c file?
19:29:53FromGitter<kdheepak> Yes that is correct
19:30:31narimirantake a look at ~/.cache/nim
19:32:41FromGitter<kdheepak> Thanks!
19:35:24FromGitter<kdheepak> Can the nimcompiler return the location of nimbase.h?
19:36:15FromGitter<kdheepak> nimbase.h doesn't seem to be in ~/.cache/nim
19:41:12FromDiscord_<PusiteGA> do nim arreys count from 1 or did some dude posted worng
19:41:14shashlickcan you have a proc return different types
19:41:23FromGitter<kdheepak> I guess I'm looking for the exact commands nim is running to generate a library.
19:41:24shashlickint or float etc
19:41:33FromDiscord_<PusiteGA> as i know seq are counted from 0 i think
19:41:36narimiran@PusiteGA they can start from any number you like, but the default is 0
19:41:39FromGitter<kdheepak> Because I might have to replicate it without using the nim compiler.
19:42:07FromDiscord_<PusiteGA> yep was talking about default
19:42:08narimiranyou can do `var myArray = array[123..127, char]`
19:42:28narimiranshashlick: no can do
19:43:04narimiranbtw, @PusiteGA, where are you from?
19:48:16*kapil____ joined #nim
19:51:17shashlickthanks for the help guys
19:52:28shashlickdon't we have a proc to convert an identifier into the nim format?
20:17:29shashlicki'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:58FromDiscord_<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:24FromDiscord_<PusiteGA> from Serbia
20:44:41FromDiscord_<PusiteGA> why
20:57:04*zachk joined #nim
20:57:39*zachk quit (Changing host)
20:57:39*zachk joined #nim
21:18:06FromDiscord_<PusiteGA> how to write varargs
21:21:30FromDiscord_<PusiteGA> am trying to use var wrdp:string = wrd.multiReplace tuple["A","U"], tuple["T","A"]
21:21:52FromDiscord_<PusiteGA> duno how to pass arugments to multiReplace proc
21:22:44narimiranbecause i wanted to check if your nick means what i thought it means ;)
21:22:48shashlick@PusiteGA: https://github.com/genotrance/nimgen/blob/master/src/nimgen/external.nim#L6
21:22:51narimiran(hello from croatia ;))
21:23:14*shashlick quit (Remote host closed the connection)
21:23:55FromDiscord_<PusiteGA> yep its my nick from playing Fonline so it stick , hello 😃
21:26:35FromDiscord_<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:17deechI'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:07FromGitter<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:29cavariux 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:10FromGitter<rayman22201> --gc:stack is deprecated. It's called --gc:regions now I believe
23:56:27FromGitter<rayman22201> that would also work, but it's not quite the same thing
23:57:55FromGitter<rayman22201> yeah, see here, they are synonyms now: https://github.com/nim-lang/Nim/blob/73c306258b6e0e82cc977a8a5ce3e21c32ea8942/compiler/commands.nim#L233
23:58:55deechrayman22201: 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.