<< 09-01-2019 >>

00:03:32rayman22201@exelotl?
00:04:12FromDiscord_<exelotl> wow, yeah that works!
00:04:22rayman22201sweet!
00:04:22FromDiscord_<exelotl> but I'm sure I tried so many things that were so close to this
00:05:57rayman22201hrmmm. idk. I'm happy to know that Nim is actually smart after all when it comes to this stuff :-P
00:06:31FromDiscord_<exelotl> I think it's just that I was trying to put it in a let variable because I assumed const would always be 'substituted' in the place where you use it (like how it is with strings)
00:06:48FromDiscord_<moerm> @rayman Cool solution. Did you actually look at the C code generated?
00:07:00rayman22201I did indeed look at the C to verify.
00:07:06rayman22201it does the right thing
00:07:12FromDiscord_<moerm> Nice. Well done!
00:08:22rayman22201Yeah, you can't rely on let always going to const. Let has slightly different semantics than true C const. This allows Nim some leeway with optimizations, but you can't rely on it.
00:08:39FromDiscord_<moerm> @exelotl Nope. Let is a) "immutable" and b (and de facto) a hint to the compiler (SSA) as I understand it. So let is *not* just another "const"
00:10:05rayman22201arguably that is another tip that should go into the docs or faq. People seem to get this confused too often.... hrmmm
00:11:05FromDiscord_<moerm> Yes. let should be considered as a "use once var". clang, in particular is quite good on making use of that
00:11:31FromDiscord_<exelotl> the thing is, I would possibly like to get the address of the generated data (e.g. fast memcpy some graphics into video memory)
00:11:45FromDiscord_<moerm> Many though see it as a "const whose value I don't know at compile time" - which it is not
00:12:33FromDiscord_<exelotl> oh it is possible!
00:12:55FromDiscord_<exelotl> just has to be done in a function scope
00:13:14FromDiscord_<moerm> Funny day here with quite some interesting questions. We know that Nim doesn't like to hand out "let" addresses (but does if you insist via unsafeAddr). But the address of a const is something I never looked at
00:15:14FromDiscord_<exelotl> so basically this works: https://hastebin.com/raw/ijuhavutil
00:15:40FromDiscord_<exelotl> but not if you don't wrap it in a main proc
00:16:01FromDiscord_<exelotl> (with --os:standalone --gc:none)
00:16:24FromDiscord_<moerm> does it really? Your ``c`` is a pointer
00:16:51FromDiscord_<exelotl> yeah, nim dereferences for you
00:18:17FromDiscord_<exelotl> but the generated code isn't good though, because it copies a into b
00:20:33FromDiscord_<exelotl> maybe I could write some cursed C macro to do it, though it would be super unsafe
00:20:33*zyklon quit (Read error: Connection reset by peer)
00:20:43rayman22201hrmmm. thinking about it
00:21:44rayman22201Yeah, what you did doesn't really do what you want. C is the address of b, which was a local copy made of a.
00:25:54*theelous3 joined #nim
00:30:11FromGitter<timotheecour> if anyone wants to finally pass below the bar of 1400 issues, https://github.com/nim-lang/Nim/pull/10141 is up for review
00:30:46FromDiscord_<exelotl> rayman: this does the trick! https://hastebin.com/raw/birafabaza >:)
00:31:42rayman22201exelotl very nice!
00:32:03FromDiscord_<exelotl> in fact you can just do this: proc GetAddr():pointer {.varargs, importc:"&", nodecl.}
00:32:16rayman22201that is a "use with great caution" function though lol
00:32:23FromDiscord_<exelotl> lmao yes it is xD
00:32:54FromDiscord_<exelotl> `uberUnsafeAddr`
00:33:04rayman22201lol. yes. basically
00:33:50FromDiscord_<exelotl> idk if there's a more proper way to do it than varargs
00:34:14FromDiscord_<exelotl> but it was the easiest way I could see to bind a function that takes anything
00:34:29rayman22201You have to be aware that depending on what the const is, it might just end up being copied into the program and won't actually have an address.
00:34:39rayman22201I think varargs is correct here
00:38:12*zyklon joined #nim
00:43:47*Ven`` quit (Ping timeout: 258 seconds)
00:58:47*Tyresc quit (Quit: WeeChat 2.4-dev)
00:58:47*abm quit (Ping timeout: 240 seconds)
01:06:32*d10n-work quit (Quit: Connection closed for inactivity)
01:34:41*leorize joined #nim
01:37:09*zachk quit (Read error: Connection reset by peer)
01:45:20*zyklon quit (Ping timeout: 250 seconds)
01:59:52*zyklon joined #nim
02:02:45*theelous3 quit (Ping timeout: 258 seconds)
02:17:45FromGitter<kaushalmodi> @timotheecour It crazy seeing how many bugs you fix almost every day. Keep up the work! I cannot fathom how to comfortav
02:18:03FromGitter<kaushalmodi> *comfortably touch and fix so many different parts of Nim
02:19:22FromGitter<timotheecour> really happy to hear some people appreciate it, thanks! I also apperciate your work btw :)
02:22:49FromGitter<timotheecour> I think the *number 1* thing nim needs is a fast pace PR/review/fix/merge cycle. That’ll encourage more ppl to send PR’s, or rather not discourage ppl who have PR’s
02:43:23FromGitter<arnetheduck> sounds like a reason not to use `devel` - testing other peoples quantity-over-quality patches..
02:44:22*Marumoto joined #nim
02:45:39FromGitter<kaushalmodi> @arnetheduck What are you referring to>
02:45:57FromGitter<arnetheduck> fast pace merge-and-fix cycle
02:46:17FromGitter<kaushalmodi> fast doesn't mean "quantity over quality"
02:46:28FromGitter<kaushalmodi> look at the last commit by @timotheecour
02:46:29*zyklon quit (Read error: Connection reset by peer)
02:46:34FromGitter<kaushalmodi> he makes exemplary commits
02:46:40FromGitter<kaushalmodi> fix + test cases
02:46:43FromGitter<kaushalmodi> https://github.com/nim-lang/Nim/commit/6ce3949c8aa489d268f272829d03edab175bfc7a
02:47:17FromGitter<kaushalmodi> fast means reducing the PR queue, and committing them as soon as someone reviews them and approves them
02:49:59FromGitter<timotheecour> @arnetheduck I have to disagree. That’s what stable is for. As for quantity of quality, that’s subjective. So long stable is, well, stable, and devel has good CI (including planned nimble-wide CI) as a sanity check, I much prefer the occasional breakage-on-devel than having PR’s languishing forever waiting for review comments. Note that slower reviews doesn’t mean higher quality at all, it just means
02:49:59FromGitter... PR’s are waiting for reviewer for comments or a merge (only referring to ones that are green+all comments addressed, if any)
02:52:35shashlickfor those online - do you know how to raise exceptions that can be caught at CT / nimscript
02:53:05shashlicki'm getting EOFError for stdin.readAll() but it cannot be caught in a nims file
02:53:39shashlickif i catch it in scriptconfig.nim then there's no way to inform consumer that EOF has occurrsed
02:54:38FromGitter<timotheecour> this is relevant: https://github.com/nim-lang/Nim/commit/cfbf9dcc597a1465c106975f506e7f6221bb99e6
02:54:45FromGitter<arnetheduck> didn't say anything different.. merely that it's incentive to stay off devel / many people presently use devel get affected when the churn rate is high.. also, a pr that doesn't immediately feel so good that you want to press the merge button generally might be good locally but not fit the grander scheme of things and might need a bit of thought
02:56:18shashlick@timotheecour: i saw that but don't think that's relevant
02:56:29shashlickperhaps it still fails in nim e file.nims case
02:56:42MarumotoDoes nim idetools work?
02:56:55leorizenim idetools is deprecated
02:56:57FromGitter<zetashift> Isn't it natural if Nim grows that the PR/issues flow gets messier? I think it's a good strategy at handling them is needed but not sure if it's the number 1 thing Nim needs :P
02:57:03leorizeMarumoto: the replacement tool is nimsuggest
02:57:03FromGitter<timotheecour> if a PR doesn’t feel so good, write a comment as to why it doesn’t feel so good. What shouldn’t happen is days with no review comments and no merge whatsoever.
02:57:06*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
02:59:54FromGitter<timotheecour> @shashlick I’ve had a similar issue with try `switch(“something_new", "10”) except: discard` in which exception is thrown but not caught
03:00:28FromGitter<timotheecour> (in nimscript); i was hoping that commit could be adapted to help w ur case, but idk
03:00:31shashlicknope - even at CT it fails
03:00:34shashlick..\lib\system.nim(2997) sysFatal
03:00:35shashlickError: unhandled exception: EOF reached [EOFError]
03:00:35*banc quit (Quit: Bye)
03:00:41FromGitter<zetashift> I think I read that D even did a fundraiser for a PR maintainer, however with limited resources things are hard
03:00:42shashlicknot able to catch it, base or specific class
03:00:42*theelous3_ joined #nim
03:01:56shashlickhttp://ix.io/1xRu - i've added a new proc to scriptconfig.nim but cannot catch EOFError when raised
03:02:35FromGitter<timotheecour> open a bug :)
03:02:36shashlickif i catch it in scriptconfig.nim, i cannot convey to the user that there's nothing left since you could have a blank line read
03:02:45shashlickbut is it a bug?
03:03:22leorizeI think it's a bug
03:04:22*zyklon joined #nim
03:04:26shashlickso if EOFError is raised in the VM, i should be able to catch it in nimscript?
03:04:47shashlickcbconf readAllFromStdin:
03:04:48shashlick setResult(a, stdin.readAll())
03:04:49FromGitter<timotheecour> yes, see https://github.com/nim-lang/Nim/issues/8740
03:04:54shashlickthat's what i've added to it
03:07:30FromGitter<arnetheduck> well, I know from experience that can be hard sometimes, because the asymmetry of the return on a small fix vs the amount of thinking it takes to explain why it's bad.. in part, git is distributed so that people can work at their own pace - that's what the whole pull model is about - you generally shouldn't be hindered by the fact that upstream hasn't pulled your request, you can keep working on your own branch -
03:07:30FromGitter... there are really two outcomes here: your patch will get merged because it's good, or it won't.. if you don't believe in your patch enough that you're unwilling to base subsequent work on it, it's generally not a good sign either
03:09:27shashlickwell i've made it a habit to check with the module owner before even starting to work on something
03:10:05shashlicki've been demotivated when PRs sit around too
03:10:21shashlickso i make it a point to evangelize before doing any work
03:10:42shashlicksecond, i make my PRs as simple as possible
03:10:50shashlickthat way reviews are easier on the eyes
03:11:02shashlickof course that means i cannot do big refactors but such is life
03:11:06FromGitter<arnetheduck> shashlick, yeah, that's a good one also - grounding the work before you start is an excellent way to start the thought process before the patch lands, so that when it lands, it's easy to review - though for small fixes, it's usually over the top
03:11:57shashlickwell unfortunately, reviewers are quite picky so i have become very cautious with how i use my time
03:12:51FromGitter<timotheecour> the problem of nim is not too many contributors and too fast pace; it’s too few contributors. In companies such as google/facebook, code evolves at a much higher pace; in part because it’s 1 mono-repo, but more importantly because of 1: delegation and 2: review process is much more efficient.
03:14:54FromGitter<arnetheduck> how many employees does google have, again? or even better - how many people does google have that write down rules for the review process, analyzing it in minute detail? what's the return on that kind of work, in a very small project?
03:17:01*banc joined #nim
03:17:02*zyklon quit (Read error: Connection reset by peer)
03:17:51shashlickokay this EOFError thing isn't an issue - need to handle it in nimscript.nim like OSError is
03:19:27FromGitter<timotheecour> Lots of projects are actually staffed by small teams actually, but everyone gets strong ownership based on their skill level/past experience which allows delegation to work, whether it’s small scale or large scale. They’re facing a much bigger problem in fact (different languages, complex depenencies bw projects including ones that are tied to ads and cannot ever go down). Yet, there’s never been a “slow is
03:19:27FromGitter... better/safer” attitude
03:19:48*theelous3_ quit (Read error: Connection reset by peer)
03:19:53shashlickI think nim is too big and very few people have wide experience
03:20:11shashlicki should start reviewing PRs but not in a position to merge
03:20:42FromGitter<timotheecour> review comments on any PR are always welcome
03:22:43FromGitter<arnetheduck> ah, now we're talking.. delegation, sure - better guidelines (whether through well-established culture or written rules), sure.. but "faster" as an explicit objective? sounds like attacking the symptom, not the cause
03:25:16FromGitter<timotheecour> actually I’d be all in favor of guidelines. I never care about style issues (because that’s what tooling eg nimpretty / `--styleCheck:on` is for) but some ppl seem to care, so their decisions should be in a document (OR , better, in a linter, so it’s automated away from PR review); stuff like: block comments vs doc comments for eg.
03:26:21FromGitter<timotheecour> edit: I never care : so long that rule wasn’t already written down, in which case i just follow it.
03:28:31FromGitter<timotheecour> and yes, faster is essential. It makes difference bw attracting new repeat contributors vs turning them away in future after a couple bad experiences. Faster doesn’t mean less quality, I have 0 complaint about good review nits/feedbacks.
03:33:57*zyklon joined #nim
03:38:19FromGitter<arnetheduck> well, technically it only turns away the category of contributors that demand real-time attention and can't adapt.. only you control whether you get discouraged or demotivated by your patch not immediately receiving feedback, nobody else.
03:40:30*endragor joined #nim
03:41:16FromGitter<arnetheduck> so just to be clear, I generally agree that short reviews times are a sign of good health in a project and a good thing for everyone involved, but it's a correlation, not a causation, as far as I'm concerned...
03:42:43shashlickwell, fact is that very few people have wide knowledge of the nim codebase which is huge
03:43:34shashlicki disagree though - if my patch sits around for weeks, i myself forget what it was and might even lose the test setup in the interim
03:44:56*endragor quit (Ping timeout: 250 seconds)
03:47:07FromGitter<timotheecour> yes, that leads to fragmentation; I have > 150 active local branches in Nim repo, because each branch is 1 PR and each PR should remain focused on 1 fix. slow PR cycle makes it hard; not that araq doesn’t have that problem since he’s not working from PR’s so that rule doesn’t apply to him and he’s able to do larger refactorings ; (not saying that’s a bad thing btw, whatever makes him more efficient is
03:47:07FromGitter... good)
03:48:09leorizewe need more core devs to review PRs, that is
03:48:55leorizethe bad thing is only Araq know enough about the compiler to review PRs related to it.
03:50:24shashlickthat's my state - i can merge but easier said than done
03:55:18FromGitter<timotheecour> 1 concrete step I’d like us to adopt that could speed things up a lot: ⏎ a reviewer sends LGTM with a note on minor nits; the PR author is expected and trusted to address those nits and the PR can be merged without further review needed. Instead of adding 1 more layer of back and forth. reviewer discretion is used as to what’s a minor nit.
03:55:28*nsf joined #nim
03:56:29*darithorn joined #nim
03:56:43FromGitter<arnetheduck> well, comparatively, the nim codebase is not that big, really.. it's a bit tangled though, so it's easy to mess up a completely unrelated part / you need to know a large percentage of it to be efficient
04:20:14*endragor joined #nim
04:24:33*endragor quit (Ping timeout: 244 seconds)
04:33:46*vlad1777d_ quit (Ping timeout: 246 seconds)
04:43:52*dddddd quit (Ping timeout: 250 seconds)
04:53:09*Marumoto1 joined #nim
04:56:37*avsej_ joined #nim
04:56:37*avsej_ quit (Changing host)
04:56:38*avsej_ joined #nim
05:02:09*zyklon quit (*.net *.split)
05:02:09*Marumoto quit (*.net *.split)
05:02:09*avsej quit (*.net *.split)
05:02:09*synthmeat quit (*.net *.split)
05:02:09*Geezus42 quit (*.net *.split)
05:02:09*Jesin quit (*.net *.split)
05:02:09*ofelas quit (*.net *.split)
05:02:09*avsej_ is now known as avsej
05:04:17*Geezus42 joined #nim
05:08:25*Jesin joined #nim
05:08:59*ofelas joined #nim
05:09:19*zyklon joined #nim
05:09:58*synthmeat joined #nim
05:17:15*leorize quit (Quit: WeeChat 2.3)
05:33:10*krux02 joined #nim
05:43:49*narimiran joined #nim
05:44:54*Marumoto1 quit (Quit: Leaving)
05:46:43*BigEpsilon joined #nim
06:36:33*darithorn quit (Quit: Leaving)
06:43:02*BigEpsilon quit (Ping timeout: 250 seconds)
06:48:46*leorize joined #nim
07:05:25Araqothers can also merge compiler PRs but they tend to be more busy. And many PRs that I am asked to review have rather obvious issues. It's like "the CIs are green, must be good code, merge it already"
07:06:12AraqOthers don't even keep the CIs green.
07:08:21*absolutejam joined #nim
07:08:33absolutejammorning all
07:09:11absolutejamis there any functionality like python's prompt-toolkit?
07:10:56absolutejamwant to create an interactive shell for my app
07:11:00FromGitter<timotheecour> i only know of https://github.com/h3rald/nimline in that category
07:11:44absolutejamI'll take a look, thanks
07:12:07absolutejamI'm currently writing it in Python but also copy parts to Nim to get a feel for the language
07:13:51FromGitter<timotheecour> would be a good addition to a nim repl (which are currently based on readline/lineedit) or lldb/gdb frontend for nim
07:17:30FromGitter<timotheecour> @araq can i merge other ppl's PR (obivously after proper review and when I feel it’s not gonna be controversial)
07:20:33FromGitter<alehander42> Araq, often the CI's are red because of unrelated errors
07:20:44FromGitter<alehander42> at least this happened for several of my previous PR-s
07:33:43*pwntus quit (Remote host closed the connection)
07:33:45*BigEpsilon joined #nim
07:38:49*absolutejam quit (Ping timeout: 244 seconds)
07:56:38Araqyeah and that's my fault and I'm trying to minimize these problems by working on branches myself
07:56:54Araqwhich then quickly rot :P
07:57:58Araqit's not that I don't feel your pain, but I don't have many good solutions. The solution cannot be to merge PRs more quickly at the cost of code quality.
08:00:35narimirandom96: are you here maybe?
08:01:48FromGitter<timotheecour> I suggested 1 concrete thing that I believe can improve things quite a bit: reviewer can give LGMT modulo fixing X,Y,Z, which avoids 1 back and forth; it’s assuming some level of trust and is applicable for small points
08:02:03narimiranLGMT?
08:02:10FromGitter<timotheecour> looks good to me.
08:03:01FromGitter<timotheecour> basically reviewer trusts the author will either fix and let him merge himself. (once CI green), or author can push back if he disagrees with suggested fix
08:03:18narimiranso, in more words: comment "fix X, Y and Z, and then it can be merged" + put 'merge when CI passes' label?
08:03:20FromGitter<timotheecour> (sorry typo, was LGTM)
08:03:44FromGitter<timotheecour> ya
08:04:31Araqand I suggested the CIs start to tell us when we break common Nimble packages
08:04:45FromGitter<timotheecour> yup, that will also happen.
08:05:17*Vladar joined #nim
08:05:22narimiranAraq: i started working on "common nimble packages" list. but haven't had the time to refine it yet
08:05:38FromGitter<timotheecour> cool do u have a link?
08:06:19narimiranit is just a list on my computer for now
08:06:48Araqtimotheecour: Another possibility is to have 1 "Timothee" branch that you occasionally use for bigger PRs
08:07:01narimirantoo early stage to be of any usage so i didn't make it public
08:07:23Araqwill take some time to get merged then but it's preferrable over 150 branches and blocking you constantly
08:09:36FromGitter<timotheecour> well i could use that but violates the 1 PR 1 issue rule we have; it would help for some things though
08:10:17Araqthe rules exist to be broken
08:12:36*absolutejam joined #nim
08:12:56FromGitter<timotheecour> ok; ⏎ what about extending set of ppl who can merge PR's? (with proper checks, eg reviewer takes full responsability yada yada)
08:14:20narimirany'all know the story about traffic congestion and building more roads?
08:14:35FromGitter<timotheecour> fitting
08:17:44Araqtimothee: ok, who
08:19:11*sheerluck joined #nim
08:20:27*absolutejam quit (Ping timeout: 240 seconds)
08:20:41FromGitter<timotheecour> some objective criterion based on past contributions; we can write a small paragraph on rules of the game in contributing.rst if needed to specify what requires more adult supervision (ie a LGTM from core dev)
08:22:15Araqno, who?
08:28:16Araqlatest addition to the core team was a couple of weeks ago, shashlick (who is doing awesome work btw!)
08:28:24FromGitter<timotheecour> i’d say a subset of ppl with > 20 recent contributions (eg https://github.com/nim-lang/Nim/graphs/contributors?from=2017-08-10&to=2019-01-09&type=c) ; recent so that they’re familiar w recent changes; in addition to ppl who already can, maybe lemonboy, zah, yglukhov, nc-x, narimiran, mratsim, cooldome, i’m forgetting some
08:28:53FromGitter<timotheecour> shashlick of course
08:29:02FromGitter<timotheecour> but he’s already in core team
08:29:05Araqthey all can merge PRs already, maybe mratsim can't, I don't have a complete list in my head
08:29:23FromGitter<timotheecour> (and myself hopefully)
08:30:54AraqI misread, sorry
08:31:00FromGitter<timotheecour> well i thought there was unofficial rule that if not in core dev, u can’t merge otehr ppl’s PR (regardless if u have github rights for that)
08:32:13Araqthat's true :-)
08:32:20narimiran@timotheecour of those 20-30 people you mentioned: how many of them are willing to go through old PRs? of those, how many know the topic at hand and want to have a responsibility to merge something?
08:32:54*absolutejam joined #nim
08:33:00FromGitter<timotheecour> (and in practice too; the overwhelming majority is merged by just u @araq; then krux, then decreases exponentially)
08:33:07FromGitter<mratsim> I’m OK with going through old PR
08:33:29narimirane.g. i see that relatively lot of those old PRs are passing the tests. should i merge them? why haven't they been merged already if it was that simple? (these are the questions i'd ask myself)
08:33:38FromGitter<mratsim> you can even create some kind of event on PR review like “saturday of review” once per month :p
08:33:51FromGitter<mratsim> you need to retrigger the tests I think
08:34:02Araqwell we hired narimiran to do that, but he is already busy improving our docs
08:34:33FromGitter<timotheecour> i’m ok too; the necessary pre-condition for review is: shd be green, shd be fast-forwardable (caution old PR’s, need rebase);
08:35:14Araqwell ... I'll think about it. One obvious rule should be "nobody merges his own PRs" ;-)
08:35:47FromGitter<timotheecour> (well unless it was explicitly approved)
08:36:04FromGitter<alehander42> yes, timothee, merge only my PR-s :p
08:36:18Araqyes ok, but approval needs to be done by somebody else
08:36:56FromGitter<timotheecour> well that’s kind of obvious
08:37:02Araqand it also cannot be that you ping e.g. @friendlyguy and hope for @araq to not look at it and get it merged
08:37:28narimiranif tests need to be re-run, and the reviewer is satisfied with the PR, put that 'merge when CI passes' label, and it will speed up the process.
08:37:44narimiranbut for the process to start, there needs to be a (fresh) review
08:37:52FromGitter<alehander42> btw i can't put labels on my issues
08:37:55FromGitter<alehander42> is that a github limitation
08:38:00FromGitter<alehander42> or a permission one
08:38:09narimiranpermission, AFAIK
08:38:31FromGitter<timotheecour> permision; u need to ask araq to enable u for that
08:39:29FromGitter<timotheecour> well @friendlyguy shdn’t be a reviewer if he’s not doing a proper review
08:40:05*absolutejam quit (Ping timeout: 250 seconds)
08:40:19FromGitter<alehander42> narimiran I see: isn't it possible to always enable the issue-creator to label his own issue?
08:40:25Araqok, but just a couple of sentences ago you argued that contributor == good reviewer
08:40:25FromGitter<mratsim> we can also add a tag “ready for Iraq” :p
08:40:35FromGitter<mratsim> Araq*
08:40:40*narimiran not sure if typo or pun :D
08:40:45FromGitter<mratsim> autocorrect
08:41:08FromGitter<alehander42> otherwise i noticed e.g. andreaferretti and other ppl very quickly labels my stuff(and other issues) so its probably ok
08:41:11FromGitter<mratsim> I guess I’ll have the authorities watching me from now on
08:41:21narimiran:D
08:41:43Araqalternatively I can also delegate feature development more to you guys and review even more
08:41:50FromGitter<timotheecour> well @friendlyguy can have his right to merge revoked (for some time or for ever) if he abuses it
08:42:20Araqnobody "abuses" it, it's all "bad stuff with good intentions"
08:42:26narimiranbtw, there are also lots of old issues that need to be looked at (and it is easier than PR reviewing), and lots of them are already fixed — i had a closing-spree while hacktoberfest, but i'm sure there's more
08:42:36FromGitter<alehander42> eh, people can have just bias
08:43:29narimiranwhat about: PR --> reviewers --> fix stuff --> ready for Araq's review
08:43:58FromGitter<alehander42> still not good enough I think: there are some things that e.g. Araq would never merge
08:44:04FromGitter<alehander42> so it's good to know this immediately
08:44:11narimiranthat way Araq still reviews and approves things, but wastes less time on some basic things
08:45:10narimiranor even better idea: nobody opens up new PRs until we halve the number of currently open ones? :D :D
08:45:22narimiran(only 90% joking)
08:45:22FromGitter<timotheecour> No :)
08:46:09FromGitter<mratsim> that’s how Linux Torvalds scaled himself
08:46:17FromGitter<mratsim> he only does reviews
08:46:29FromGitter<mratsim> but It’s probably too early
08:46:42FromGitter<mratsim> no one will do destructors in your place Araq
08:46:46FromGitter<timotheecour> a critierion that i like is: a PR is good if nothing gets worse and at least 1 thing is improved
08:47:33FromGitter<mratsim> For me, I’m OK with PR that fixes bug that only get a second look
08:47:37Araqmratsim: cooldome does it already
08:47:44FromGitter<mratsim> PR that adds feature need to be vetted by Araq
08:47:52FromGitter<mratsim> to avoid feature creep
08:47:56Araqbut he is not working on --gc:destructors afaict
08:49:10FromGitter<timotheecour> btw it’s open source, so it’s really easy to audit if a reviewer does a bad job by approving stuff that’s obviously subpar
08:50:03Araqit's incredibly demotivating to remove rights to somebody
08:50:13Araq*from
08:50:23FromGitter<timotheecour> it can be a private ping
08:50:49AraqI don't think that changes anything
08:51:25FromGitter<mratsim> well, I think we should start doing something and assuminge people are reasonable, instead of imagining all the ways it can go wrong. You wouldn’t have started your own language from scratch otherwise ;)
08:51:41FromGitter<mratsim> and assume that*
08:52:22narimiransooo, tomorrow morning there be less than 80 open PRs? ;)
08:52:30*zyklon quit (Read error: Connection reset by peer)
08:52:35FromGitter<timotheecour> totally agree. too many contributors/reviewers has never been Nim’s problem ; we can see how it goes and corrective action if it doesn’t.
08:53:05Araqok. Glad we figured that out.
08:53:24Araqanything that I need to do now... :P
08:53:27Araq?
08:53:45FromGitter<mratsim> forum post?
08:54:13FromGitter<mratsim> “Plan to tackle PRs in the future"
08:54:31FromGitter<mratsim> or even blog post, so we can HN/reddit that ;)
08:54:38FromGitter<mratsim> cc @narimiran
08:54:44FromGitter<timotheecour> we can add a blurb in https://nim-lang.github.io/Nim/contributing.html specifying reviewer responsability
08:54:51narimiranisn't this just an internal thing?
08:54:55FromGitter<mratsim> oh excellent idea
08:55:02narimiranno need for public post about it, IMO
08:55:05Araqseriously guys?
08:55:20FromGitter<mratsim> contributing at minimum
08:55:46narimiran@timotheecour write something there. (and then wait for a PR review for that :D :D)
08:55:56FromGitter<timotheecour> Lol. sure.
08:56:00Araqjust review PRs
08:56:17Araqoften somebody mentioned what remains to be done
08:58:04FromGitter<alehander42> ok, in this case i'd like to be able to review javascript backend/javascript lib stuff: I feel like i am one of its main users and breakage/changes affect my code daily (and i have to finish my rewrite of it one day)
08:58:34narimiran@alehander42 what is stopping you from being able to review that?
09:00:17FromGitter<timotheecour> that’s acutally raising a good point; obviously anyone can review a PR including your neighbors’s dog as doesn’t require permissions; but oftentimes what actually happens is unless someone has permission to merge, he has less incentive to review
09:01:25*floppydh joined #nim
09:02:23FromGitter<timotheecour> drive by comments is good and welcome, but is different from a review where a reviewer puts his stamp on. no merge rights often implies less thorough review. in practice.
09:03:39narimiranlet's try it and see how it goes
09:03:58narimirandon't let the perfect be the enemy of the good
09:06:15FromGitter<alehander42> @narimiran good point: you're right that i don't need permissions for that. hm, then i am just declaring that i'll try to ⏎ take a look at all javascript-related issues/pr (so e.g. people can know they can ping me about them etc)
09:07:19narimiran@alehander42 great to hear!
09:08:18narimiranif you think that adding some labels to those PRs would be beneficial (and i guess it would), we should give you the permission to make it possible
09:08:49*tradfursten joined #nim
09:08:58FromGitter<mratsim> @narimiran: I think we should backport that: https://github.com/nim-lang/Nim/issues/10075
09:09:23FromGitter<alehander42> narimiran: yeah, I guess labels would be useful
09:10:00narimiran@mratsim so this should be backported? https://github.com/nim-lang/Nim/pull/8715/
09:10:02*zyklon joined #nim
09:10:50narimiran@alehander42 it is not up to me, but feel free to remind me later if nothing happens (you don't have permission)
09:10:51FromGitter<mratsim> it fixes a bug that was always there and a regression.
09:11:08FromGitter<mratsim> I think the fact that it fixes a regression is a side-effect
09:11:09FromGitter<mratsim> :P
09:11:30narimiran@mratsim i'll leave that backport decision to Araq
09:11:57FromGitter<alehander42> narimiran: ok, thanks
09:33:35*tradfursten quit (Ping timeout: 256 seconds)
09:35:08Araqwhat needs to be done with the old PRs is "stay tuned, I'm taking over"
09:35:09*PMunch joined #nim
09:35:52Araqand again, testing Nimble packages in the wild out there is prio number one, we have extensive tests, apparently they are never good enough, so let's try something new
09:36:57Araqwe can also think about removing tests that are too simple in exchange for more realworld testing if the CIs start to timeout again
09:37:23narimiranAraq: ok, i'll try to have the initial version of nimble package list for tomorrow
09:37:56narimiranand i agree about removing assert `2+2 == 4` kinds of tests
09:39:24Araqthe CIs are now controlled by koch.nim btw, we can have a testpackages.nim file and ask our community to add their projects
09:39:59Araqyou don't have to do it yourself, narimiran, you only need to start
09:40:57Araqand packages are platform specific so they can get 'when defined(linux): testPackage("giturl_here", "nim c -r tests/tester.nim")'
09:41:17narimirani'm against everybody adding their project. i think this list should contain only big/popular projects.
09:41:49narimiranbut let's have *something* for a start, and see where will that take us
09:41:54Araqok
09:42:11FromGitter<alehander42> does nimble have some kind of downloads stat
09:43:06narimiran@alehander42 that would be useful, indeed. for my list, i used github stars as a criterion for picking the packages
09:44:38Araqonly *my* Nimble packages are important :P
09:47:00Araqmratsim: happy with your rights?
09:47:10narimiranAraq: did you see the above discussion with @mratsim about should we backport https://github.com/nim-lang/Nim/pull/8715 ?
09:47:13Araqalehander42: happy with your rights?
09:47:32Araqnarimiran: just looked at it, can't backport that one I'm afraid
09:47:40narimiranok
09:50:43narimiranbtw, @mratsim, that PR (#8715) didn't solve the issue (#10075) from what i can tell?
09:51:09narimiranoh, i misunderstood the comment "The code is added to fix #8715"
09:51:26FromGitter<alehander42> Araq: yeah, just wanted the right to label issues
09:54:50Araqnarimiran: but please backport my docgen fix that speeds up runnableExamples
09:54:53FromGitter<mratsim> @Araq, did you add new rights? I’m happy with mine yeah
09:57:30narimiranAraq: ok, it is this one https://github.com/nim-lang/Nim/commit/086229459aa72f06d31a4f920653a82a74cfc6b0 . if there's anything else to backport (which doesn't have the backport tag), let me know
09:58:03Araqthere is another commit fixing that one...
09:58:22Araqmaybe move docgen.nim over to 0.19
10:02:59narimiranok, found that fix
10:05:53*rayman22201 quit (Ping timeout: 256 seconds)
10:07:36narimiranbackported some recent documentation fixes too
10:10:24*dom96_w joined #nim
10:14:45*abm joined #nim
10:17:42Araqyay
10:56:39*stefanos82 joined #nim
11:10:39Araqping dom96_w
11:10:46dom96_wyes?
11:12:15*theelous3 joined #nim
11:33:09*dom96_w quit (Quit: Textual IRC Client: www.textualapp.com)
11:34:22*hoijui joined #nim
11:34:37FromGitter<alehander42> Araq, what is `astdef`
11:35:41Araqthe meaning of sym.ast changed
11:35:49Araqsym.astdef gives you the old meaning
11:36:04Araqonly skLet, skVar and maybe skConst are affected
11:36:25Araqfor the JS codegen you should use 'astdef'
11:36:42FromGitter<alehander42> yeah, good to know!
11:36:53FromGitter<alehander42> otherwise there is a bug in https://github.com/nim-lang/Nim/blob/devel/compiler/semstmts.nim#L335
11:37:05FromGitter<alehander42> there should be a check for v.astdef.typ.isNil
11:37:23Araqpossible
11:37:26FromGitter<alehander42> because otherwise some pragmas with notnil types are segfaulting
11:37:30FromGitter<alehander42> (my codebase)
11:37:38FromGitter<alehander42> ok, PR-ing
11:38:11FromGitter<alehander42> (i just wondered if v.astdef.typ is always supposed to be valid)
11:48:22Araq(I think so.)
11:49:41FromGitter<alehander42> well it's nil on several places in my codebase, so maybe there is a deeper bug there
11:49:49narimiranversion 0.19 branch failed with "The command "if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install boehmgc; fi" failed and exited with 1 during ." :/
11:50:03FromGitter<alehander42> but the check fix cant hurt
11:51:31FromGitter<alehander42> even for a simple notnil type astdef.typ is nil
12:02:52*bgiannan joined #nim
12:03:45*hoijui quit (Ping timeout: 268 seconds)
12:05:12narimiransomebody was quicker than me: there's a new article about Nim in 2018 here: https://nim-lang.org/blog/2019/01/08/nim-in-2018-a-short-recap.html
12:05:22narimiranHN discussion here: https://news.ycombinator.com/item?id=18863759
12:06:44narimiranreddit discussion here: https://old.reddit.com/r/programming/comments/ae67ns/nim_in_2018_a_short_recap/
12:07:45narimiranfeel free to share your experience with Nim in 2018 and/or answer some questions that might arise
12:13:42bgiannantrying to compile a first program with nim
12:13:59bgiannanI get "invalid module name: test-nim"
12:14:05bgiannanwhat am I missing ?
12:14:47zyklonquite the opposite :D
12:15:00FromGitter<alehander42> narimiran, i replied with some of the ecosystem stuff, but i am forgetting a lot probably
12:15:21narimiranbgiannan: remove `-`
12:15:56*hoijui joined #nim
12:16:05bgiannancan i compile to c and see the generated code ?
12:16:22zyklonit's in the nimcache dir
12:16:27bgiannan90K seems quite big for just "hello world"
12:17:37Zevv-d:release
12:18:14*hoijui quit (Remote host closed the connection)
12:18:28bgiannanwhere's the nimcache dir ?
12:21:36*Cthalupa quit (Ping timeout: 246 seconds)
12:22:04bgiannanrtfm i can set it with --nimcache
12:22:18zyklonin the same dir as your .nim file by default
12:22:41narimiranzyklon: not true anymore
12:23:03zyklonoh sry
12:23:20narimiranbgiannan: by default, nimcache is now in ~/.cache/nim
12:23:26bgiannanthx
12:23:28zyklonI use an old version probably
12:23:50*Cthalupa joined #nim
12:23:52narimiranbgiannan: as Zevv said, to reduce the size (and get the much faster release version), use `-d:release`
12:24:25narimiranbgiannan: you can also use `--opt:size` for some additional size shrinking
12:24:38bgiannanbeat
12:24:40bgiannanneat*
12:26:53*xet7 quit (Quit: Leaving)
12:31:30*BigEpsilon quit (Ping timeout: 268 seconds)
12:33:01*BigEpsilon joined #nim
12:33:10*theelous3 quit (Ping timeout: 250 seconds)
12:36:30*dom96_w joined #nim
12:36:42dom96_wyay, front page of HN
12:36:49dom96_wGood job narimiran :)
12:36:56narimiranweee
12:39:15PMunchNice, #2 spot even
12:40:09narimiranPMunch: it was #1 few minutes ago ;)
12:40:24dom96_wAraq: if you want to fix that redirect issue: try opening /etc/nginx/sites-available/nim-lang.org (paste it for me and pm me the link and I should be able to tell you what to modify)
12:42:16*nsf quit (Quit: WeeChat 2.3)
12:44:47narimiran"number of open issues" is the new "i don't like style insensitivity" :D
12:46:51dom96_wjust wait... lol
12:47:32FromGitter<alehander42> nah number of open issues is very easily refutable
12:48:03narimiranhaha, i know i know, i should have said "inb4 stYle_inSenSi_tiviTy" :D
12:49:39zyklonit turned into the usual autistic "hacker""news" shitshow
12:50:53narimirani'm surprised by no comments on reddit
12:51:23dom96_wreddit is slow
12:51:36dom96_wdoesn't get as much traffic as HN unless you get 2k+ upvotes
12:53:16PMunchShould've mentioned nimlsp so I could get some more guinea pigs for testing it :P
12:53:29PMunchSo far I'm the only one I know who uses it, and it's really nice
12:53:38dom96_wannounce it on the forum ;)
12:56:56narimiranPMunch: we need to leave something for 2019 ;)
13:05:59AraqPMunch: I want to use it, does if fix the project management problems the old plugin has?
13:06:06Araq*does it
13:06:20PMunchWhat do you mean?
13:06:53Araqthe old plugin runs 'nim check' on the current file, ignoring the project info
13:07:01Araqand spawns dozens of nimsuggest instances
13:07:32PMunchWell, this doesn't spawn any nimsuggest instances as it uses it as a library. But it does keep a state object for each detected "project file"
13:08:16PMunchThe way it detects the project file is this: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L98
13:08:17Araqthat's ok if you don't assume Nim file == project file
13:08:37Araqthere is a proc for that in the compiler
13:08:43Araqno need to reimplement this logic
13:09:43PMunchWhy doesn't nimsuggest use that then?
13:09:51AraqIT DOES!
13:09:58*zyklon quit (Read error: Connection reset by peer)
13:10:02PMunchWhy does it ask for a project file then?
13:10:49Araqpass it a directory and it detects the project file
13:12:14PMunchWhat directory?
13:12:19PMunchThe one the file is in?
13:12:29PMunchThen it should just be able to figure it out based on the file
13:13:07PMunchSo this should just be removed? https://github.com/nim-lang/Nim/blob/devel/nimsuggest/nimsuggest.nim#L662
13:14:49*xet7 joined #nim
13:18:22*bgiannan left #nim ("WeeChat 2.3")
13:20:36*absolutejam joined #nim
13:25:21leorizeis there any path from nim-lang.org to Araq's blog? afaict you can only access the blog once someone posted the link to an article somewhere
13:27:52*zyklon joined #nim
13:36:35*vlad1777d_ joined #nim
13:37:00*Vladar quit (Remote host closed the connection)
13:37:43absolutejamcan anyone explain the {.inline.} pragma to me please?
13:38:33ZevvIt requests the C compiler to put the code of the function in the callee, instead of making it a function and doing a call
13:38:53Zevvbasically it increases binary size, and might benefit performance.
13:39:09ZevvUsually you shouldn't care for this and just leave it to the compiler, as it knows best what to inline and what not
13:39:16PMunchhttps://www.greenend.org.uk/rjk/tech/inline.html
13:39:38PMunchBasically it does that to your C code
13:40:34FromGitter<mratsim> compiler will never inline across module boundaries if you don’t put the inline pragma
13:40:34*zyklon quit (Read error: Connection reset by peer)
13:40:47absolutejamas somebody who knows nothing of C
13:40:54absolutejamShould I leave it until I understand it?
13:41:05PMunchYeah
13:41:11absolutejamI'm reading that link still
13:41:20PMunchProbably won't do anything good unless you know how to use it
13:41:30PMunchHow did you even end up looking at it? :P
13:41:31ZevvAfter 25 years I'd like to think I start to understand bits of C, and I usually leave it
13:41:38absolutejamI'm not disregarding what you said; I'll read it and ignore using it for now
13:41:42absolutejamIt's in the docs
13:41:47ZevvPMunch: its in the manual
13:41:58absolutejamReading about the getter/setter syntax for properties
13:42:38absolutejammind if I drop another stupid question?
13:42:49absolutejamwhat's the difference between a proc and a method?
13:43:09Zevvdynamic/static dispatch, that's an OO thing
13:43:20narimiran(the answer to that question should really be documented, as it is relatively frequently asked one)
13:44:20PMunchWell it is documented here: https://nim-lang.org/docs/tut2.html#object-oriented-programming-dynamic-dispatch
13:44:35absolutejamit may be because some of the language features are new to me too
13:45:03FromGitter<zetashift> I have no idea what dynamic dispatch really means I always looked at it like methods are members/bount to an object while procs are standalone functions
13:46:05absolutejamI thought DD was ability to to declare the same function multiple times, based on different types of the arguments
13:46:24absolutejamI need to read more on the basics of OOP, haha
13:46:32FromGitter<alehander42> this is overloading
13:46:43FromGitter<alehander42> it's a more general concept
13:47:20FromGitter<alehander42> the idea behind dynamic dispatch is that the actual method being called might be decided on runtime
13:47:46*theelous3 joined #nim
13:47:56FromGitter<alehander42> based on a runtime "type" e.g. the object subclass type in OOP
13:48:41absolutejamright
13:48:56absolutejamWe're not in ~Kansas~Python now Dorothy
13:49:29narimiran(as we've just seen, this needs to be *better* documented ;))
13:49:44Zevvabsolutejam: and a small "beware": for reasons that I do not grok, there is something fishy in Nim with mixing methods and generics.
13:50:02ZevvThe docs don't speak about this caveat, but Araq told me not use either one, but not both.
13:50:03FromGitter<alehander42> on the other hand, overloading means you can e.g. define `a(b: int)` and `a(b: seq[int])` and they would be different, but usually it's clear on compile time which one would be called(static dispatch)
13:50:20FromGitter<zetashift> with the help of a virtual table?
13:50:29FromGitter<alehander42> (of course method overloading leads to dd)
13:51:02FromGitter<zetashift> I've rarely seen methods being used, only in godot-nim mainly but that's because it's handy with declaring those types
13:51:07AraqZevv: that's because you discovered the problems with them :P
13:53:04absolutejamWell, I was using a method because that's the terminology I'm used to when declaring classes
13:53:11absolutejamSo I can just stick to procs?
13:53:45*vlad1777d__ joined #nim
13:53:46absolutejamI'm a hobbyist (sysadmin by trade) and I've been using Python thus far
13:54:38absolutejamnow I'm trying my hand at Nim, but I'm well aware there are a lot of concepts that I only know about, especially when moving to a compiled language
13:54:41FromGitter<zetashift> Nim is mostly procedural so yes try not to think in terms of classes
13:55:03FromGitter<alehander42> probably you can for the beginning
13:55:29FromGitter<zetashift> Weren't there OOP macros which made it easier?
13:55:44absolutejamthere's still a usable OOP side though, right?
13:55:51absolutejamI mean, the docs seem to imply there is
13:55:52FromGitter<alehander42> those are not really idiomatic nim, so it's better to not use them if you're a beginner
13:56:06absolutejamhow old is Nim by the way?
13:56:35*zyklon joined #nim
13:56:43*vlad1777d_ quit (Ping timeout: 245 seconds)
13:56:45FromGitter<zetashift> 11 years?
13:56:50PMunchA quick example of the usage of DD I just threw together: http://ix.io/1xSD/Nim
13:56:54absolutejamoh wow, didn't realise
13:57:09FromGitter<alehander42> yes, oop is available, but it's just not used so much: often people use just procs or variant types + proc
13:57:18FromGitter<alehander42> (of course sometimes this is not enough)
13:57:44PMunchIf those were procs it would just print 3 "Unspecified thing", with methods it will use the correct one for Unit, or Value
13:58:36PMunch99% of the time you can simply use something other than OOP
13:59:40FromGitter<zetashift> I think it's because OOP is taught everywhere and in the beginning it's really easy to reason about it too
14:02:27Araqmy wish for the new year: people stop using "easy to reason about" when they mean "I like it better"
14:03:31shashlicknice discussion last night
14:03:49shashlickcan this be merged? https://github.com/nim-lang/Nim/pull/9806
14:03:57shashlickseems simple enough
14:04:06FromGitter<zetashift> mhmh maybe there is some misunderstanding here, I didn't mean I like OOP better, I like procedural/FP a lot more now, but the initial learning curve for both paradigms are different
14:05:17Araqoh you're also free to like OOP better, but it most certainly isn't easy to reason about and even it were, you would need to argue why that is
14:05:20absolutejamI was aiming for basic OOP because I want to emulate a repl with access to classes that are nice and easy to mutate
14:05:45Araqshashlick: ok
14:06:10absolutejamI've been toying with Clojure but I honestly don't have the programming background or insight to reason when to decide on OOP/FP
14:07:06shashlickAraq: ran into this while enabling stdin reading in VM - https://github.com/nim-lang/Nim/issues/10240
14:07:17AraqI noticed
14:07:28Araqfix it
14:07:41shashlick😄
14:08:09shashlickso seems like nimble package testing is higher priority - where do we want to run those
14:08:47shashlickdo we want that to run in separate repo, nim-lang/nim or nightlies
14:12:33dom96_wwow https://news.ycombinator.com/item?id=18864730
14:13:06*dddddd_ joined #nim
14:15:54narimirandom96_w: wow indeed
14:16:01narimiran"did someone here had a better or different experience than mine?"
14:16:22narimiranpeople, it's your turn ;)
14:16:48FromGitter<alehander42> i feel he just wants a different language
14:17:08FromGitter<alehander42> something like scala
14:17:29narimirani think we should write some replies. not for him to change his mind, but for some general information for the public
14:17:54Araqshashlick: preferably nim-lang/nim if it weren't for the timeout problems
14:18:36narimiranAraq: ...but there are timeout problems, so delegate that to nightlies?
14:19:01Araqare there? they have become rarer thanks to megatest
14:19:53narimiranok, i'll rephrase: we need to make tests (even) faster
14:20:08shashlickcan we also have a megadoc - nightlies docs takes a long time as well
14:20:40FromGitter<timotheecour> @dom96 what’s easiest way to run `nimble test` ? i can run it inside `nimble develop foo` but doesn’t work if run inside the install dir (after `nimble install foo`) ; so do is my best bet to run both `nimble install foo` (to test co-installation) and `nimble develop + nimble test` ?
14:21:12FromGitter<timotheecour> (for the PR on nimble CI, see https://github.com/nim-lang/Nim/pull/10247)
14:22:48shashlick@timotheecour - tests do not get installed
14:22:58shashlickso you need to clone the repo, not simply nimble install
14:23:51shashlickmaybe we can add a --tests flag to nimble so that tests also get installed - that way we can test packages with nimble install package and then cd packagepath and nimble test
14:24:48shashlick@timotheecour - we also need to port your ci streamlining into nightlies
14:25:07dom96_wnarimiran: I replied
14:25:30*dddddd_ is now known as dddddd
14:26:04FromGitter<zetashift> @Araq I think when I started learning about classes was using Python and seeing how I could structure things in a game as objects in pyGame was easy to grasp then. Maybe it's because in gamedev a lot of things are done using OOP languages and not actually because OOP is easier to reason about
14:26:11*xet7 quit (Quit: Leaving)
14:27:23FromGitter<alehander42> @dom96 he is talking about deep immutability
14:27:53dom96_wThen he should be more specific ;)
14:27:56*nsf joined #nim
14:28:01*BigEpsilon quit (Ping timeout: 244 seconds)
14:30:01FromGitter<alehander42> he just wants a different kind of language, but the problem is anecdotical evidence like "i wrote this programs once which was slow"
14:30:17FromGitter<alehander42> this is hard to refute in discussions like this
14:31:30Araqbtw what we should do more is to collect bugs. Real bugs caused by nim's design.
14:32:28Araq"I think I might mutate someday something I'm not supposed to" is a not a real language defect, it's s a perceived one.
14:32:42*dddddd quit (Read error: Connection reset by peer)
14:33:10Araqand I actually agree with that, but that doesn't make it a real defect either.
14:33:13narimiran@mratsim can you edit your HN post to fix that extra-long code line (which isn't code)? i'm guessing that's because some initial spaces
14:34:00FromGitter<mratsim> @narimiran several fixes
14:34:25narimiran@mratsim great
14:36:56*dddddd joined #nim
14:39:42*theelous3 quit (Ping timeout: 250 seconds)
14:42:59shashlickAraq: the nimscript not raising exceptions hasn't worked as far back as 0.16.0
14:43:13shashlicktht's as far as i've checked
14:43:45*Tyresc joined #nim
14:47:35absolutejamis there any in-built documentation within nim?
14:47:36FromGitter<kaushalmodi> shashlick: I don't think many people using nims until recently
14:48:22absolutejamIt looks like there's no in-built repl, but any way to reference in-built procs etc? I don't _think_ the vscode plugin has this either?
14:49:12FromGitter<kaushalmodi> absolutejam: check out the Inim package in nimble; it mimicks a REPL
14:49:18absolutejamI just pulled that
14:49:49absolutejambut I'm wondering if there's any kind of doc()/help()/dir() etc. functions
14:49:50FromGitter<kaushalmodi> You should just need to do `nimble install inim`
14:49:56Araqshashlick: possible
14:50:07dom96_wabsolutejam: Here is what we usually use to find things: https://nim-lang.org/docs/theindex.html
14:50:20shashlickdom96_w: are release packages not posted for nim releases before 0.15.2?
14:50:44*jugash[m] joined #nim
14:50:45absolutejamYeah, I meant with inim
14:50:47absolutejammy bad
14:50:49absolutejamwith nimble*
14:50:54FromGitter<alehander42> Araq: on the other hand having deep immutability for X helps you to directly prove that a class of stuff can't happen : not always necessary, but obviously useful in principle
14:51:02*BigEpsilon joined #nim
14:51:05FromGitter<kaushalmodi> absolutejam: yeah, those things are not there. I use devdocs or the theindex page that dom96 pasted
14:51:25absolutejamcool, thanks
14:55:38narimiranHN discussion posted 4 hours ago, 35 comments, and not *one* mention of case insensitivity
14:55:49narimiranif this isn't a success, i don't know what it is :)
14:56:21Araqalehander42: in principle everything always helps, in practice type system complexity becomes a real problem
14:56:25*Snircle joined #nim
14:56:50dom96_wnarimiran: don't jinx it!
14:58:03narimiranhaha, you know it will happen sooner or later
14:58:22dom96_wMaybe I should just comment about it, just to ruin their element of surprise :P
14:58:30Araqtypes encode invariants and are bad at modeling things that are not always true from the beginning. Like mutability which fades away after construction but the construction can be arbitrarily complex
14:59:09shashlickdom96_w - am trying to install older versions of nim but choosenim cannot find anything before 0.15.2
14:59:12FromGitter<alehander42> Araq, yeah, I just said that immutability is a reasonable type system feature: not saying we need it in Nim
14:59:22shashlickthis is on windows
14:59:31Araqwe have it, only 'ref' and 'ptr' breaks it
14:59:32dom96_wshashlick: likely because the .tar.gz doesn't exist for those
14:59:51shashlickI see - what about windows binary releases
14:59:56shashlickwhen did those start getting posted?
15:00:14shashlickso i guess my change to install from github is useful to test these older versions
15:00:15FromGitter<alehander42> Araq: that's true, but I think one can model the "fading" in a hypothetical language
15:00:34Araqsolution: don't use ref/ptr. Alternative: push for write tracking. Other alternative: Complain about it.
15:00:38FromGitter<alehander42> e.g. having different contexts for init/after init and a mut type/imm type in them
15:00:54absolutejamholy crap, .a_b is the same as .aB
15:01:07Araqabsolutejam: sshhhhttt :-)
15:01:08FromGitter<alehander42> @dom96 what did you do ..
15:01:10absolutejamdid I just balls that up, or is that legit?
15:01:57shashlickabsolutejam: https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifier-equality
15:02:04FromGitter<alehander42> Araq: the problem with this is that "use an index in a collection" isn't a good replacement for ref/ptr
15:02:30narimiranabsolutejam: congrats, you win today's prize :)
15:02:30FromGitter<alehander42> because often you just get silent data corruption
15:02:31dom96_walehander42: hrm?
15:02:38AraqI disagree, it's a nice solution with lots of other benefits
15:02:43FromGitter<alehander42> absolutejam found out about aB a_b :D
15:03:35shashlickdom96_w - once you merge the windows release zip PR for choosenim, i'll submit one for downloading nim from github if not on http://nim-lang.org
15:03:45dom96_walehander42: I wasn't the one bringing up style insensitivity :P
15:04:02*narimiran hides
15:04:15dom96_whuh, I thought unicode was always case sensitivie in Nim though
15:04:17dom96_wdid that change?
15:04:30Araqno, it still is
15:04:35FromGitter<alehander42> Araq: so what's your opinion about the data corruption thing? sometimes you need to make sure all your "index" operations lead to valid state and that you don't override "fresh" values etc etc .. reinventing stuff
15:04:44shashlickdom96_w - I'll also submit another PR to download a corresponding tagged csources version and only donwload latest if an equal csources tagged version doesn't exist
15:04:52FromGitter<alehander42> it's a ok approach but it doesn't come for free
15:05:01Araqthere is no "data corruption thihng"
15:05:09absolutejamwow, magic
15:05:18Araqmy opinion is to deny it exists
15:05:41Araqyou have indexing checking and don't reuse indexes
15:06:04FromGitter<alehander42> well, how can you mutate something then
15:06:08dom96_whow can a_b be the same as aB then?
15:06:09dom96_wbbl
15:06:09Araqlike the databases do it, since 1960 or something
15:06:13*dom96_w quit (Quit: Textual IRC Client: www.textualapp.com)
15:06:55Araqalehander42: That's the point, in order to mutate it you also need to have the owner/collection
15:07:25Araqit's similar to a capability based system
15:08:37shashlickAraq: how do i start debugging the nimscript exception issue? not familiar with the VM
15:09:47FromGitter<alehander42> Araq: ok, and you want to change the element 2: so everything else that has `this owner, index 2` can read the new value
15:10:01FromGitter<alehander42> you reuse the index 2 in this case
15:11:36Araqvmops.nim getCurrentExceptionMsgWrapper, shashlick
15:12:29absolutejamis nimscript interpreted nim on a VM?
15:12:51absolutejamor I guess JIT, not interpreted (?)
15:13:22Araqalehander42: but what else has "this owner, index 2"? there is no aliasing possible.
15:13:24absolutejamnevermind, found the docs
15:13:24shashlickawesome thanks!
15:16:33FromDiscord_<moerm> Hello - and congrats to the Nim team! Just saw it via HN and I liked in particular the last part (-> 0.20 ~ 1.0rc) very much 😉 - So, a big THANK YOU to Araq and the Nim team!
15:18:23FromGitter<alehander42> @Araq : so a value can have only one owner at a given point?
15:18:53Araqthat's the "natural" model of value semantics where you nest objects in seqs etc
15:18:56FromGitter<alehander42> if this is true, one can just have rust-like borrow checking
15:19:22Araqyou need to protect against f(a, a) for proc f(x: var T, y: T)
15:19:23FromGitter<alehander42> Araq: well my point was that sometimes you need aliasing and accessing the same value from multiple owners
15:20:17Araqthis protection is also what Swift does afaik
15:20:19FromGitter<alehander42> otherwise some of the index/db stuff reminds me of https://floooh.github.io/2018/06/17/handles-vs-pointers.html
15:21:28Araqhmm seems to be the article I've been wanting to write
15:21:50Araqyes, handles are the better pointers. DBs use them and had memory safety from the beginning.
15:21:55Araqas do OSes.
15:23:31FromGitter<mratsim> cool article. I’m struggling with ref objects overhead in directed acyclic graphs ...
15:23:58ZevvAraq: thanks for picking op the epoll mem PR - hope cheatfate isn't mad :/
15:24:30FromGitter<alehander42> Araq: the blog `handles` are not exactly the same as os `handles` , but otherwise yeah, i think it would be an interesting read for you
15:30:09Araq"would be"? I've read it
15:30:36absolutejamnim doesn't support ? or ! in proc names, right?
15:30:54Araqit's precisely what I have in mind
15:31:16FromGitter<alehander42> Ah ok
15:32:16narimiranabsolutejam: right, and no _ at the end
15:32:25absolutejamI really enjoyed using '?' in clojure and Ruby
15:32:41absolutejamJust tried it out and I can get away with `xyz?` but that's pointless haha
15:32:52AraqNim uses is/has prefixes instead
15:33:05narimiranabsolutejam: is that for bool procs? use `isFoo`
15:33:11absolutejamyeah
15:33:36absolutejamthink I saw mention of a style guide actually
15:33:50Araqalehander42: The question however, if how far this model scales in other domains
15:33:50absolutejamfound it https://nim-lang.org/docs/nep1.html
15:34:08narimiranabsolutejam: you started learning nim today?
15:34:18AraqI can see it work for the Nim compiler but it would take a year of refactoring
15:34:25absolutejampretty much haha
15:34:40absolutejamI've looked at the site a couple of times prior
15:34:48FromDiscord_<moerm> I think that is/has is a good approach. Readability (and understandability) always trumps ease of typing/short (C like) notation.
15:35:08narimiranabsolutejam: well, you came just a half day too early — in couple of hours we'll have lots of learning resources at one place, so it should be easier for you to start
15:35:28absolutejamsweet, I'll stay tuned in
15:35:40FromDiscord_<moerm> narimiran more good news ... great. Today seems to be a good day for uns Nimers
15:35:42absolutejamwhat's the best place for info - reddit/forums/mailing lists?
15:36:00Araqhere, I'm afraid
15:36:11narimiran@moerm as i said on forum: i'm working on it ;) these are just the first results
15:36:14FromGitter<mratsim> the forum too
15:36:30absolutejamasync info I mean
15:36:39Araqnothing beats talking to the bloke who knows everything
15:36:40absolutejamthis IRC actually seems active, which is great
15:37:25FromGitter<mratsim> also dom book: https://github.com/dom96/nim-in-action-code/tree/master/Chapter3/ChatApp
15:37:31FromDiscord_<moerm> @absolutejam The forum is a good place, too. Nim isn't yet perfectly well documented but it's actually very well feasible to understand and learn it
15:37:35narimiranabsolutejam: yeah, on IRC you can get the answer the quickest, and sometimes you'll speak to the guy(s) behind it, and you don't even know :)
15:38:13FromGitter<mratsim> The book introduces an async multi-clients one server chat app in chapter 3
15:38:27FromGitter<mratsim> though without buying the book you will only see the code
15:38:29narimiranfor me, if it wasn't for IRC community, i would have probably quit nim
15:38:42Araqouch. lol
15:38:44FromDiscord_<moerm> @Araq Haha. Yes (the bloke who wrote it) ... but: a lot of people have a lot of things to ask. So my take is that that bloke shouldn'tz be abused as a first learners resource
15:39:10FromGitter<mratsim> and for async, it should be similar to Python AsyncIO and C# AFAIK
15:39:25narimiranabsolutejam: there was a gist showing similarities between python and nim async, let me see if i can find it
15:39:43absolutejamI meant a async source of info
15:39:48FromDiscord_<moerm> @absolutejam Oh, btw, dom96's book ("Nim in action" iirc) is a *really good* resource too!
15:39:52absolutejamlike emails, forums, etc.
15:39:52narimiran(you mentioned python before, if i didn't confuse you with somebody else)
15:39:58absolutejamstuff I can look at later
15:40:03absolutejamIRC I will miss without a bouncer
15:40:04narimiranaaaaaahaaa
15:40:10absolutejamhowever, async is still on my list, so thanks :P
15:40:34narimirandamn, and i hoped i don't have to look for it :D
15:40:52*Ven`` joined #nim
15:40:55FromGitter<mratsim> everything said on IRC is logged: https://irclogs.nim-lang.org/
15:41:04narimiranok, it was faster than i thought to find it
15:41:05narimiranhttps://gist.github.com/juancarlospaco/7a486056786919387ec6f5e83d693908
15:41:07absolutejamyeah, I'm almost all Python. I don't _really_ have a need for a language other than Python at the moment, I just wanted to see what else I could learn while on a hobby project
15:41:10absolutejamIt may be the end of me
15:41:53narimiranabsolutejam: that's what i thought too. and look at me now :)
15:42:05FromDiscord_<moerm> I think it wouldn't be utterly wrong (from a certain perspective) to say that Nim is python on steroids.
15:42:26absolutejamI was originally looking at Crystal, but Nim seems to be way ahead
15:42:34absolutejamand I can't stomach Go
15:42:37FromDiscord_<moerm> If you grok python you won't have a hard time groking Nim
15:43:19absolutejamAfter toying with Clojure, I find Macros fascinating
15:43:24absolutejamalso wholey alien and confusing
15:43:31narimiranyeah, at first just sprinkle some `let` and `var`, rename `def` to `proc`, and you're 90% ready to go
15:43:40l1xabsolutejam: :D
15:43:48l1xclojure is pretty good
15:43:52Araqdunno about that, Python is quite different. But some aspects translate well
15:43:55narimiranafter a while, you'll see more and more differences between the two
15:43:56l1xyou dont need macros for application development
15:44:00FromDiscord_<moerm> crystal *seems* to be roughly the same league and kind but it isn't (e.g. readability, conceptual consistence), but one might say that Crystal is to Ruby what Nim is to Python
15:44:12absolutejamoh yeah, I just found them when reading about hte language
15:44:21absolutejamstarting with the threading macros
15:44:55FromDiscord_<moerm> Araq From the perspective if a Pythonista looking for something similar but more serious my statement isn't wrong I think
15:44:59absolutejamI really like Clojure l1x
15:45:10l1xyeah me too
15:45:19l1xi am just working on a http lib for it
15:45:33FromGitter<mratsim> Crystal main issue is windows :P, but Crystal was done with the goal of being able to map Ruby 1:1. While Nim “only” borrows the syntax/ergonomic feel
15:45:35absolutejamWell, I was drawn in to nim because of the surface similarities but already see it's way different to Python
15:45:35l1xi want to beat the other frameworks with performance :)
15:46:05absolutejamMy biggest issue I experience with Clojure is just moving to a FP mindset
15:46:14absolutejamdaren't go near haskell etc
15:46:58FromDiscord_<moerm> *Of course* Nim is quite different from Nim when looking closer. But I guess that Nim is *the*serious (system etc) language that's easiest to grok for Pythonistas
15:47:05l1xabsolutejam: you can write non-FP code easily
15:47:54Araqyou can argue both ways, "Nim is only superficially similar to Python" or "Nim thought about how to map Python's features into a systems programming language setting"
15:48:13absolutejamthe pep-8 and chill on https://gist.github.com/juancarlospaco/7a486056786919387ec6f5e83d693908 made me laugh
15:48:33FromDiscord_<moerm> Araq Yep.
15:49:11FromDiscord_<moerm> ... and more (than Pythons feature set).
15:49:20Araqthe truth is somewhere in the middle I guess. plenty of Python's features have been adopted
15:49:38absolutejamjust take the best of what you want I guess
15:49:49absolutejamyou're not trying to be Python, just taking the best/most fitting bits
15:50:26absolutejamLike not requiring parens for proc calls or the uniform function thing
15:50:31absolutejamYou can tell I paid a lot of attention
15:50:35absolutejambut both of those are slick
15:50:41absolutejamand they're very Ruby like
15:50:51absolutejamnot just Ruby but that's what I have seen pieces in
15:51:16*chho1229 joined #nim
15:51:16FromDiscord_<moerm> That's one of the funny (and good things) with Nim. Superficially it looks like - and *is* - an easy to learn language. But then what I call "the second journey" begins and one can discover a lot more and good stuff (but it's of course more complicated)
15:51:33*seni joined #nim
15:51:46narimiranyup
15:52:22absolutejamlow floow/threshold, high ceiling
15:52:28absolutejamfloor*
15:53:16FromGitter<mratsim> I didn’t start my async journey yet but I think I’m at my 4th journey in low-level Nim :P and 3rd journey in macros :D
15:53:36FromDiscord_<moerm> mratsim *g
15:54:57narimiran@mratsim i'm still hoping that you'll write some blog post about your low-level journey
15:55:13narimiranthat "X times faster min/max" seems like a nice candidate
15:55:14absolutejamwhat's more idiomatic - return or var|let result?
15:55:27narimiranabsolutejam: result without let|var
15:55:30FromGitter<mratsim> I have an idea for a “Nim for High performance computing” blog post serie
15:55:31*chho1229 quit (Ping timeout: 256 seconds)
15:55:38Araqalehander42: Ada Spark also has interesting aliasing restrictions btw, you must not pass someGlobal to 'f' if 'f' uses it directly.
15:55:42FromDiscord_<moerm> Btw. really, really funny: For years I used Python as my quick and dirty check something out, create some repetitive (e.g. C boilerplate, etc ... and since recently I began to find Python lacking and I started to those jobs in Nim - and it's actually faster!!! (well, at least for me)
15:55:55narimiranabsolutejam: `result` is special, it is implicitly declared
15:56:11absolutejamohh
15:56:17absolutejamI see
15:56:26FromGitter<mratsim> @absolutejam, usually result (without let/var) and return is used if you have multiple exit points from the function
15:56:30FromDiscord_<moerm> Now, that's a statement, that's something to really love, wenn a language is easier and quicker for quick and dirty helper jobs ... and at the same time a fully fledged compiled systems language!
15:56:49narimiranabsolutejam: see here https://narimiran.github.io/nim-basics/#_result_variable
15:57:01Araqalehander42: and it's very interesting because allowing this only results in bugs, most of the time
15:58:34absolutejamokay, so you've convinced me to write my new hobby project in nim
15:58:41absolutejamI was doing it in python then testing bits in Nim
15:58:56absolutejamyou only have yourselves to blame.
15:59:09narimiranabsolutejam: see you around then :)
15:59:36narimiranbtw, that's how i started — translating my python AoC solutions to nim
15:59:54FromDiscord_<moerm> absolutejam Keep it simple! If you are happy, laud Araq and the Nim team. If you are not, blame me *g
16:00:04FromGitter<mratsim> > _>
16:00:08narimiranand when nim solutions weren't much faster — i knew it is time to ask questions, because i was doing something wrong :)
16:00:14FromGitter<mratsim> You sound like the Rust Evangelisation Team :P
16:00:44FromDiscord_<moerm> Who? narimiran?
16:00:46absolutejamAoC?
16:00:50FromGitter<mratsim> you moerm :P
16:00:54narimiranabsolutejam: advent of code
16:00:57FromGitter<mratsim> oC = Advent of Code
16:00:58absolutejamah
16:01:25FromGitter<mratsim> https://adventofcode.com/2018/day/1
16:01:47narimiranbtw, 2018 was way harder than 2017. start with 2017, IMO
16:02:38FromDiscord_<moerm> mratsim I *actually* would take that as an insult (I *strongly dislike Rust) but knowing how you meant it I'm smiling. Thanks
16:03:39FromDiscord_<moerm> But seriously, I'm *not* evangelizing. I simply speak of my (largely very good) personal experience
16:04:10absolutejamis Nim funded or backed?
16:04:28PMunchabsolutejam, it does receive some funding from companies
16:04:35PMunchAnd donations from regular people
16:04:37absolutejamJust reading about languages in the last few days and I saw Mozilla are backing Rust vs. some of the smaller projects with no funding
16:04:42absolutejamcool, just curious
16:04:45FromGitter<mratsim> https://nim-lang.org/blog/2018/08/07/nim-partners-with-status.html
16:04:48absolutejamin no situation to contribute, sorry ;)
16:04:52FromDiscord_<moerm> Yes, but in small scale and *not* by a large corp/org - which is a *good* thing in my eyes
16:05:01PMunchhttps://nim-lang.org/sponsors.html
16:05:19absolutejamYou mean, you don't want Microsoft Nim?
16:05:21FromGitter<mratsim> ^ah right that was the page I was looking for
16:05:24absolutejamMicrosoft Nim Studio 2019*
16:05:34*PMunch shudders
16:05:37absolutejamSystem Center Nim Manager 2019 R2
16:05:38FromDiscord_<moerm> I don't want Mozilla Nim.
16:05:53FromGitter<alehander42> @Araq hm interesting i was trying to think of smarter alias-restricting annotations last week
16:05:59narimiran@moerm i think you don't have to worry about that :P
16:06:00FromGitter<alehander42> have to take a look at ada
16:06:03FromGitter<alehander42> spark
16:06:09absolutejamI get out of the Windows world forever at the end of the month. Can't wait
16:06:14*nim-newb joined #nim
16:06:18FromGitter<alehander42> is this like a dialect/subset of ada?
16:06:25FromDiscord_<moerm> I also wouldn't like MS Nim ... but I do see that MS actually has done some very good things wrt languages and safety
16:06:28Araqsubset
16:06:36FromGitter<mratsim> I’m going back to the windows and Linux world in the weekend :P
16:07:14Araqyou can run Nim on Haiku
16:07:31Araqand it's Haiku's official scripting/application language.
16:07:37FromDiscord_<moerm> alehandler I *come* from Ada/Spark and still use it for very sensitive stuff. But I can tell you that working in Ada/Spark is A LOT harder and more burdensome and less convenient than with Nim
16:07:45Araqnah, I'm kidding :D
16:08:06Araqmoerm: hmm now you have my attention
16:08:19FromDiscord_<moerm> Hmm?
16:08:28narimiranAda is the magic word
16:08:49FromGitter<mratsim> Actually during Fosdem 2018 we got a lot of attentions from Ada devs
16:08:58FromDiscord_<moerm> The *really good stuff* imo is Spark and computer aided verification
16:09:02AraqI studied it more during my holidays and found plenty of stuff to steal from it and I'm beginning to understand how a NimZ3 could work
16:09:16FromGitter<alehander42> moerm: oh probably, I am just interested in this from my langdesign-hobbyist point
16:09:18PMunchalehander42, if you are going to FOSDEM I recommend the Ada dev room. Nice beginner talks on Ada
16:09:27*jxy quit (Ping timeout: 240 seconds)
16:09:37PMunchNimZ2?
16:09:40PMunch3*
16:09:43FromDiscord_<moerm> mratsim I'm not in the least surprised. Nim is a very very attractive route for many or even most jobs that Ada devs do
16:10:07stefanos82PMunch: like Dragonball Z, but for Nim
16:10:27AraqPMunch: Nim combined with the Z3 verification engine
16:10:28FromGitter<alehander42> @PMunch : yes, I am: thanks for the recommendation, i'll take a look at their program
16:10:29*jxy joined #nim
16:10:38FromDiscord_<moerm> Araq Now you see a REALLY BIG smile on my face. The idea that Nim should (at some point later) be hooked up to Z3 is hunting me since weeks
16:11:02FromDiscord_<moerm> Hint: Have a look at boogie. Makes it easier and keeps some more paths open
16:12:03FromDiscord_<moerm> "Nim combined with the Z3 verification engine" - that would be a killer thing. It would push Nim into another league and create lots of distance to Rust, Crystal, etc.
16:12:32FromDiscord_<moerm> Plus: Look at ats, idris, agda, etc. Way to FP for many devs and way too complicated
16:12:37nim-newbHey guys, sorry to interrupt. I want to learn Nim and just wanted to come by and ask if "Nim in Action" is still a good reference or if it's outdated by now with the recent releases?
16:13:00narimirannim-newb: still good, not outdated
16:13:05FromGitter<mratsim> not outdated, the example are used as anti-regression tests
16:13:05FromDiscord_<moerm> The real killer trick (that is possible with Z3) is to make it *accessible* and *convenient* to many devs
16:13:14nim-newbThanks!
16:13:23FromDiscord_<moerm> nim-newb YES it is
16:15:22FromDiscord_<moerm> Re *How* to do it: Start with design by contract. Simple pre and post conditions, some basic invariants esp. for data, loops, etc
16:15:57FromDiscord_<moerm> You can (and probably should) use something similar to Ada's (elegant and good) "where" style
16:17:05FromGitter<mratsim> for design by contracts, I find this lib quite elegant: https://github.com/Udiknedormin/NimContracts
16:17:07FromDiscord_<moerm> And the best thing: a) contracts for Nim already exist (macro based) albeit a bit crude, but hey, it's a start. And b) Nim *actually does* already perform many checks that would beg to be done via an SMT like Z3
16:18:04*nim-newb quit (Quit: Page closed)
16:18:12FromDiscord_<moerm> And: DbC is THE classical entrance to verifiable code. Ada did it that way too. One could even say that Spark is largely Hoare triples added to Ada
16:19:05Araqyup
16:19:28FromDiscord_<moerm> The bad side: Separation logic isn't easy to implement or to use. But the good news is that Nim is largely not concerned due to mostly ref (instead of pointers)
16:20:01FromDiscord_<moerm> So, in summary, formal verif. would be well feasible and not too hard for Nim
16:20:16Araqmoerm: My plan was to allow for "vendor" specific pragmas that Nim ignores but NimZ3 uses
16:20:38FromDiscord_<moerm> modulo ``ptr`` but those are anyway kind of "if you use them you're on your own" already
16:21:49*absolutejam quit (Ping timeout: 246 seconds)
16:22:16FromDiscord_<moerm> Araq Hmmm that's similar to the classic annotation approach. That's a good approach, in particular if NimZ3 does it more like Ada (not comments but a real part of the language). And yes, it should be feasible to treat those in Nim std. simply as "empty macros"
16:23:12Araqwell it's crucial to annotate proc *types* with them, not use proc bodies. We can always add more keywords to the language later...
16:23:16*BigEpsilon quit (Ping timeout: 250 seconds)
16:23:36*nc-x joined #nim
16:23:42FromDiscord_<moerm> Btw Again, Nim already *does* some limited stuff that is typically in the formal verif. camp. Example: subranges (which are basically data invariants)
16:24:07AraqI have a branch where Nim proves array indexing correct or warns if it can't
16:24:42FromDiscord_<moerm> Araq Yes, but pre and post conditions are on proc types anyway. Only invariants (e.g. typ. case loop invars) are within the body
16:24:48Araquses a homegrown proof engine though, using Z3 instead is a natural thing to do
16:25:23FromDiscord_<moerm> Araq Yes, absolutely. Stay away from homegrown engines and use Z3, either directly or via boogie
16:25:54FromDiscord_<moerm> (I'm notg sure that boogie runs on non-windows though. Would need to look that up)
16:27:06FromDiscord_<moerm> Another point I'd suggest to think about is how much can be done using Nims CT capabilities. I don't know them well enough to make a tenable statement yet but I have a hunch that that might be interesting to ponder
16:28:11FromGitter<alehander42> I agree, pre/post conditions are ct expressions that can be hypothetically part of a signature
16:28:45FromDiscord_<moerm> One point to keep in mind however is that Z3 does *not* look whether a proposition is true. Rather it usually looks whether it can find a counter example. A small detail it might seem but should keep it in mnd
16:29:13*nc-x quit (Quit: Page closed)
16:29:41FromGitter<mratsim> the array indexing proving is already used in teh parallel statement no?
16:29:42FromDiscord_<moerm> alehandler I guess so. But my expertise with Nim doesn't yet allow me to make strong statements about CT for FV/dbC
16:30:42FromGitter<mratsim> there are some interested: https://github.com/Udiknedormin/NimContracts/issues/4
16:31:13Araqmratsim: correct but I only recently made it more stable
16:31:56*dom96_w joined #nim
16:32:00dom96_whttps://fosdem.org/2019/schedule/event/nim_metaprogramming/ :D
16:32:02dom96_wCC PMunch
16:32:05Araqmoerm: well as I said, I think I figured out how to do this during christmas
16:32:25FromDiscord_<moerm> Araq GREAT!
16:32:30Araqbut I'm busy with other things, however, I can guide you *if* you find the time for it
16:32:51PMunchdom96_w :)
16:32:57FromDiscord_<moerm> Araq right now I don't have the time 😦
16:33:13Araqok, ping me when you do please :-)
16:33:21narimirancongrats PMunch
16:33:28PMunchThanks :)
16:33:39PMunchNow just to write the talk :P
16:33:43FromDiscord_<moerm> Araq will do. But keep in mind that I'm still just a "grasshopper" in Nim and far away from mastery
16:34:11Araqdoesn't matter much to me. as long as you stay and know Ada Spark.
16:34:50FromDiscord_<moerm> Haha, Spark was and is *the* reason I still love Ada.
16:36:29*floppydh quit (Quit: WeeChat 2.3)
16:37:37FromDiscord_<moerm> We should btw find a better solution than Spark in one point: Not to have to create large condition "snakes" but to have a nicer syntax; something like "where chains"
16:39:57FromDiscord_<moerm> like "where required A, required B, required C and D" (Note the commas) and maybe "pre" and "post" instead of "required" and "ensured".
16:40:49FromDiscord_<moerm> And, important: A way to to have "CT only" or CT and RT"
16:43:55AraqI can't follow you unfortunately
16:45:17FromDiscord_<moerm> Don't worry, just details (albeit significant ones). For now the important point is to offer the conditions to be checked only CT or both CT and RT. Experience tought me that some granularity there is strongly desirable
16:46:23FromDiscord_<moerm> Probably easy to handle by a simple pragma like "require {.rtcheck.} some_proposition"
16:47:25Araqhuh? that's an "assume" in my book
16:47:34FromDiscord_<moerm> The only "problem" is that CT is about formal verification while RT means to actually create code (which Nim does anyway already in many cases). But it's quite different beasts
16:47:57Araqexactly. I'm talking about verification.
16:48:20Araqif you can't prove it, you need to *assume* it
16:48:30Araqand assumptions work better when checked at runtime ;-)
16:49:00*cspar_ quit (Ping timeout: 246 seconds)
16:49:01FromDiscord_<moerm> I personally would advise against mixing up/mangling concepts. A CT require is for Z3 proving, a RT require is for creating RT checks.
16:49:22FromDiscord_<moerm> Yes, you are right from a language point of view
16:49:43FromDiscord_<moerm> But you can not verify everything at CT
16:49:46Araqwell yes, I agree. I'm not mixing them up, I intend to use different verbs for them
16:50:08Araqhave a look please: https://rise4fun.com/Boogie/4OVU
16:50:27Araqam I dumb or is it the tool?
16:50:27*dom96_w quit (Quit: Textual IRC Client: www.textualapp.com)
16:51:00Araqoh it's me, never mind
16:51:12Araqsilly typo :D
16:52:01FromDiscord_<moerm> That's easy to pardon because the example there is somewhat nonsensical *g
16:52:28Araqnot really, I checked how well the tool understands mutable locals
16:53:17FromDiscord_<moerm> More important probably: Is it windows only and MIT/BSD licensed?
16:53:42FromDiscord_<moerm> (MS is not really consistent wrt their open source)
16:55:03Araq"Microsoft Public License (Ms-PL)"
16:55:11Araqand it uses Mono/.NET
16:55:35FromDiscord_<moerm> And: I don't particularly like your choice of verbs because "assume" in the formal verif world usually is used a hint to the verifier
16:56:19Araqbut that's what it is, the verifier may assume it, we need to emit a runtime check
16:56:34FromDiscord_<moerm> Yuck, Mono/.NET probably means that we'll have to address Z3 directly. I hoped that we can use boogie but that seems to not make sense
16:57:12Araqmaybe we can get away with their web service for a start :P
16:57:32Araqthe license appears to be MIT compatible
16:57:47*tiorock joined #nim
16:57:47*rockcavera quit (Killed (tepper.freenode.net (Nickname regained by services)))
16:57:47*tiorock is now known as rockcavera
16:57:47*rockcavera quit (Changing host)
16:57:47*rockcavera joined #nim
16:57:56FromDiscord_<moerm> (No. You are looking from a PL perspective. "assume" simply means a "hint" to the verifier. A typical case would be that 0 *is* in the domain but a rare case)
16:58:13FromDiscord_<moerm> their web service? Tsss.
16:58:45FromDiscord_<moerm> No, if we do it (and we definitely should!) we should do it properly and right.
16:59:11Araqyuck it uses the visitor pattern
16:59:14FromDiscord_<moerm> which unfortunately means to use Z3 directly, sigh. Feasible but a lot harder
16:59:25FromDiscord_<moerm> *laughing*
16:59:55FromDiscord_<moerm> (I usually try hard to stay away from commenting on web related things...)
17:00:55FromDiscord_<moerm> I don't know a lot about the Nim compiler yet. Do we have something like SSAs (similar to clang)? If so that would be useful
17:02:56Araqunfortunately not but it's not a big deal, I know how to deal with mutability
17:03:47AraqBoogie also uses a weird lexer and parser
17:04:55FromDiscord_<moerm> Yes but that's not the point. SMT solvers usually digest propositions very similar to what a compiler's SSAs provide
17:06:43FromDiscord_<moerm> Maybe our LLVM backend might be useful Dunno, will have to look and check
17:08:33AraqI fail to see the point, I think I can translate Nim into propositions, but I cannot solve the propositions
17:08:59FromDiscord_<moerm> Then we have no significant problem
17:09:49*Vladar joined #nim
17:10:39FromDiscord_<moerm> Reason: No, what a compiler produces are rarely really useable (for a verifier) propositions - but: if you give me something looking like propositions (and links into the AST) I should be able to make those into Z3 grokable requests
17:11:25FromDiscord_<moerm> Disclaimer: This is not a promise. It's merely "loud thinking" (albeit based on quite experience)
17:11:49Araqok, got it, seems like you know the other puzzle piece
17:13:09FromDiscord_<moerm> Yes
17:13:38FromDiscord_<moerm> But just a grasshopper in Nim, not knowing many relevant things
17:14:20AraqI could make the compiler output a JSON file with the propositions and then you can lay a tool on top of it based on Z3
17:15:17FromDiscord_<moerm> Hmmm, that might be a reasonable way although in the end/later we should some up with an on the fly solution
17:15:29FromDiscord_<moerm> But it's a good starting point I guess
17:15:42FromDiscord_<moerm> -some + come
17:16:36Araqwell JSON doesn't really mean anything, unfortunately
17:17:02Araqthe format still would be adhoc
17:17:15Araqand ultimately pointless, might as well generate Z3 syntax
17:17:44FromDiscord_<moerm> I'd imagine something with (quite granular) compiler calls to which the verif. engine would respond with a tuple of bool (OK, not OK) and a string with some problem/error description.
17:18:05FromDiscord_<moerm> (Yes, I was hesitating also when you brought up JSON)
17:19:03FromDiscord_<moerm> (would create 2 additional steps without offering a lot of candy)
17:19:27*dorelix quit (Ping timeout: 246 seconds)
17:20:42FromDiscord_<moerm> just give a reasonable representation of the propsitions along with some (mainly type) info
17:21:22FromDiscord_<moerm> My orientation point would something like LLVM IR
17:21:56FromDiscord_<moerm> Those could be pre evaluated and with a little massaging be handed to Z3
17:22:13AraqI can output some adhoc stuff and then you hit me with a stick until it's Z3 syntax or at least useful
17:22:34FromDiscord_<moerm> useful is good enough. Z3 syntax isn't needed
17:23:27FromDiscord_<moerm> Maybe a simple loop invariant would be a good thing to look at for a start
17:24:01Araqalready too much, I can give you array indexing problems though
17:24:10Araqlike
17:24:15FromDiscord_<moerm> I'd need the Index var and it's type along with eventual further constraints
17:24:24FromDiscord_<moerm> Hmm?
17:24:38Araqwe know: i >= 0 and i <= x-4
17:24:56Araqquestion: does i <= x hold?
17:24:58FromDiscord_<moerm> Then Z3's first question would be the domain of x
17:25:06Araqintegers
17:25:17FromDiscord_<moerm> Yes and no
17:26:21Araqwhat do you mean?
17:26:39FromDiscord_<moerm> Today it's "integers. done". But with NimZ3 it could (and usually should) be integer with constraint (like "x \elem integer | 3 < x < 2000")
17:27:15*BigEpsilon joined #nim
17:27:47FromDiscord_<moerm> and Z3 would try to find an example for which "i < x" does *not* hold
17:29:18FromDiscord_<moerm> That's what we programmers often have a hard time to get. Formal Verif/SAT/SMT is basically about domains, co-domains, and some logic (often FOL)
17:29:58Araqwell yes but I can translate 'var x: range[3..5]' into 'x >= 3 and x <= 5'
17:30:03FromDiscord_<moerm> Have you ever worked (more than superficially) with formal modelling?
17:30:34FromDiscord_<moerm> (Yes! and you SHOULD! because that's what I'll work with)
17:30:50Araqno. not at all. Only read about it.
17:31:01FromDiscord_<moerm> something like TLA or (worst case *g Promela=
17:31:09FromDiscord_<moerm> Hmm. Let me explain:
17:32:20FromDiscord_<moerm> In a formal modeller you do something like coding. But it's really all about constraints. You are basically care about the data mainly. It's not about the code
17:32:46Araqyeah I know, I also know there are other domains beyond the integers
17:33:10FromDiscord_<moerm> It's in a way somewhat along the line of how a mathematician sees the world (and the result just "coincidentially" happens to be useful for software too)
17:33:36Araqand depending on the domain you have different axioms and rules
17:33:53FromDiscord_<moerm> No, Araq, sorry, my clumsy wording. It's not about integers vs. floats and such. It's about *constraints*.
17:34:21FromDiscord_<moerm> like when we were in school and the math teacher always terrorized us with "and what's the domain?"
17:35:20FromDiscord_<moerm> The best clue is *how* I wrote it above. Example: x \elem N1 | such that 3 < x < 2000
17:36:05FromDiscord_<moerm> The "N1" (positive integers) is just a first "crude ballparl". The relevant part is what comes after the "such that"/"where" ('|')
17:36:30Araqhmm sure but I still don't understand why you emphasize that so much
17:36:44FromDiscord_<moerm> Because that's what it's all about
17:37:04Araqthe thing is, x < 2000 is not all that useful, usually it's at least x < N
17:37:33FromDiscord_<moerm> Whatever x happens to be. It has boundaries and those are decisive
17:37:52Araqand then I don't know if y elem N1; x \elem N1 | such that 3 < x < y
17:38:11FromDiscord_<moerm> And our problem is that it's usually not clear and simple.
17:38:12Araqhelps the verifier that much
17:38:43Araqover the more imperative x < y stated as a separate fact
17:39:02FromDiscord_<moerm> Thanks. That's one example. The verifier WILL look at the y domain - the value of y has probably been set who knows where in the code
17:39:18FromDiscord_<moerm> That's why I asked for links to the AST
17:40:11FromDiscord_<moerm> You just hand me the propsitions in a somewhat formalized way (just as you proposed). Then I will have to find the rest that's needed before I can feed Z3
17:40:11Araqin my proof engine I translate range types into propositions about relations
17:40:31Araqbbs
17:40:40FromDiscord_<moerm> "bbs"?
17:42:06PMunchBe Back Soon
17:42:06*Ven`` quit (Ping timeout: 252 seconds)
17:42:35FromDiscord_<moerm> Thanks. Me chat stupid
17:42:48FromGitter<alehander42> i guess that moerm means that some similar engines operate on domains/constraints instead of `a op b` facts?
17:42:51FromGitter<alehander42> just guessing
17:44:47FromDiscord_<moerm> Yes and no. Look, in real world code it's not handy primitive SSAs. ``b`` might come from who knows where. Think of it somewhat like an AST. You need to walk it along and find the domains and constraints to prepare something that Z3 can grok
17:44:59*rayman22201 joined #nim
17:46:39FromGitter<alehander42> so yeah in this case i think Araq's propositions should be relatively easy to convert to domains: i think technically that's what it models anyway
17:47:06FromDiscord_<moerm> The op part is relatively simple. When, for instance op happens to be + Z3 can easily check that IF it has a clear and well defined (and constrained) domain
17:47:31*sheerluck quit (Quit: Leaving)
17:47:34FromGitter<alehander42> what i mean is more stuff like `a >= x a <= i`
17:48:11FromDiscord_<moerm> Looks more complex but is basically the same thing.
17:48:32FromGitter<alehander42> i think one of the analysis that inspired the bound checking thing used sets to model the possible states of some properties, so the domain of the index is the obvious equivalent thing for bounds checking indeed
17:50:09FromDiscord_<moerm> and would be transformed to ``(a >= x where a = <spec>, x = <spec>) and (a <= i where a = <spec>, i = <spec>)``
17:51:06FromDiscord_<moerm> There are some more things that add complexity, like for example quantors, but that's basically it
17:53:02FromDiscord_<moerm> (*all* a >= x for a given context is very much different from *exists* a | a >= x) but that mainly Z3's problem not ours. We "just" have to prepare everything so that Z3 can grok it
17:54:14FromDiscord_<moerm> But I'm extremely excited and pleased about Araq interest and plans. If we manage to pull that off, Nim will me in another league than the competition (incl. Rust)!
17:54:19*wildlander joined #nim
17:54:32FromDiscord_<moerm> -me +be
18:05:50FromDiscord_<moerm> I seem to have driven away everybody here. Apologies. I got carried away.
18:06:42narimiran:)
18:06:49FromGitter<alehander42> no, it's all very interesting, i guess that just people are away from pc around this time (leaving work etc)
18:07:04narimirannah, he drove us away :P
18:07:19FromGitter<alehander42> i guess that existential constraints are more similar to generics
18:10:28*BigEpsilon quit (Ping timeout: 245 seconds)
18:15:44*shashlick_ joined #nim
18:16:16*BigEpsilon joined #nim
18:17:18Araqmoerm: I'm back and I might give you something this weekend but I should really focus on other things
18:18:14FromDiscord_<moerm> No prob. No need to hurry as I don't have lots of time on hand right now anyway
18:18:54Araqon the other hand, it's probably 1-4 hours of work for me, I have the propositions for my home grown "proof engine" already
18:19:04FromDiscord_<moerm> But whatever you give to me will definitely help to think about it more concretely. and for that at least I should find some time
18:19:26Araq(if it can be called that)
18:19:47*NimBot joined #nim
18:20:32Araqand I can see problems ahead :-) for more general loop invariants
18:20:45FromGitter<alehander42> i'll be very interested to see how this develops as well
18:21:46FromDiscord_<moerm> Araq yes, but then: Nim is among the best problem solving tools around *g
18:22:13rayman22201+1 to that. I have followed formal tools like idris or SPARK only from afar, but I think the concept is really freaking cool.
18:22:21FromDiscord_<moerm> I guess it will take some time and some refining iterations but it's achievable and it's extremely attractive
18:22:26narimiran@moerm offtopic, but what is that "*g" you're using at the end of some of your messages?
18:22:55FromDiscord_<moerm> I have learned that *g stands for a friendly grin
18:23:08Araqof course the unwise thing to do is to reimplement the relevant stuff from Z3, it's a huge C++ project with unknown artificial complexity, as usual
18:23:40FromDiscord_<moerm> rayman The trick - which seems feasible with Nim - is to make it *easy* and really accessible for normal developers
18:23:57FromDiscord_<moerm> C++ (mistrusting unhappy look)
18:24:00FromDiscord_<moerm> ?
18:24:13Araqyeah and for that the compiler devs need a deep understanding
18:24:22Araqwhich comes from reimplementing stuff
18:24:35FromDiscord_<moerm> Oh, you are talking about Z3 and not about what you have done so far. I misunderstood you
18:25:05Araqyes.
18:26:01*nsf quit (Quit: WeeChat 2.3)
18:26:03FromDiscord_<moerm> I know some projects where I can have a good close look. My (and I guess Araq's) target would be a *simple* (to use) yet true formal solution
18:26:28AraqI remember that SAT solvers used to work with BDDs
18:26:47Araqis that still the case?
18:27:43FromDiscord_<moerm> Obviously - but that's the case everywhere - the result quality is depending on the input quality. So a dev hardly making the effort to nail his code down will have little outcome. But I think it would be an excellent result if one *could*, albeit with some more thought and effort, create seriously verified code
18:27:55FromDiscord_<moerm> "BDD"?
18:29:02Araq"binary decision diagram"
18:30:19FromDiscord_<moerm> Hmmm, depends. There are diverse paradigms. But frankly, I wasn't too interested in *how* SAT/SMT solvers work internally. But yes, certainly BDD and graph walkers are prominent
18:32:35Araqstill a bit shocked that Z3 doesn't use Ocaml or similar as the implementation language
18:32:58FromDiscord_<moerm> Araq How difficult is it to add more information to Nims internal representation or AST?
18:33:17FromDiscord_<moerm> re ocaml -> performance reasons I guess
18:33:47Araqwhat do you mean "more information"? the AST is typed and has precise line information throughout the compilation pipeline
18:33:48FromGitter<alehander42> Ocaml is pretty fast
18:34:27FromGitter<alehander42> I guess it just wasn't so popular back then when they wrote it
18:34:43FromDiscord_<moerm> I'm asking because somewhere I'll need additional info on constraints. If we don't want to have that in the AST I'lll basically need to have a second one for my sub-pass
18:34:59Araqhmm I remember lots of stuff about BDDs that I learned at university
18:35:26FromDiscord_<moerm> Example: I would need for *any and every* integer it's (potentially constrained* domain
18:35:41Araqyeah I know, that's not a problem
18:36:05FromDiscord_<moerm> (I remember a lot too but I'm still not really interested to know a lot about the inner working of Z3)
18:36:57FromDiscord_<moerm> also constrained types (we already have that e.g. as subranges) but those are typical for that kind of prgramming. You nail things down early
18:37:36*Trustable joined #nim
18:37:54FromDiscord_<moerm> OK, if you say that's not a problem I'm a happy man. Then it's good enough to pass links to the AST along for the "pre propositions" you create and pass to my sub-pass
18:38:29FromDiscord_<moerm> And 'll have to learn a whole lot more about Nim and way faster than I had planned, sigh
18:38:52Araqproblem is that I have no clue whatsoever how to map anything to SAT :-)
18:39:42Araqfor example, it I know 'a = b', what to translate that into? 'if a: b elif b: a else: false' ?
18:39:45Araq*if
18:39:56*BigEpsilon quit (Ping timeout: 272 seconds)
18:39:58FromDiscord_<moerm> Don't. Just pass me the propositions and the broken down instructions
18:40:35AraqBDDs only understand boolean algebra
18:40:44FromDiscord_<moerm> "I" == the developer knowing his stuff? Or you, the compiler writer?
18:40:57Araqme, the compiler writer.
18:41:27FromDiscord_<moerm> Then you just pass me "a == b" as a valid premise
18:41:49Araqdon't misunderstand me
18:41:57FromDiscord_<moerm> hmm?
18:41:57AraqI'm asking how Z3 works under the hood
18:42:40FromDiscord_<moerm> Why? Do you want to implement a solver, a Nim version of Z3?
18:43:27FromDiscord_<moerm> (I'm a bit afraid the answer from Araq might be "Yes" *g)
18:44:02Araqwhy not, as I said, things work out better when you understand the technology
18:44:45FromDiscord_<moerm> I agree. But things also work out a LOT slower when every wheel is re-implemented
18:44:57Araqand even I don't implement anything I still want to know how it works
18:45:50FromDiscord_<moerm> There has been LOTS of work on SAT and later on SMT solvers. I guess re-implementing it would be a project the size of Nim itself
18:46:42FromDiscord_<moerm> I would strongly suggest to simply use it and be done. (besides profoundly studying it if you are interested of course)
18:49:00Araqdon't you worry, there is nothing wrong with being curious
18:49:31FromDiscord_<moerm> Full ACK. My point is just *implementing* our own Z3
18:49:46FromDiscord_<moerm> *That* is what I'm opposed to
18:50:34FromGitter<alehander42> I agree, I think it's best to play/prototype with several different solvers and learn their strengths, maybe one can even come up with something novel
18:51:02*absolutejam joined #nim
18:51:34absolutejamis there a lazy-man's form of concurrency in Nim, a la go routines/fibers?
18:51:48leorizeyep, threadpool
18:51:57absolutejamIs that using traditional threads?
18:52:24FromDiscord_<moerm> Later that might indeed a good idea. After all it should be a lot easier to do something like that in Nim. Right now, though, I would fully bet on just using Z3. One reason being that we (Nim) still is somewhat of an outsider while Z3 ist THE "standard" and has a high reputation.
18:52:31absolutejamJust curious. I can't say I know enough about other language implementations - or the real world implications - to compare, just curious
18:52:35AraqI figured that SMT is not the same as SAT and indeed they don't resolve 'a = b' at all
18:52:38absolutejamApparently I'm double curious
18:52:50leorizeyea, or you can go async for single-threaded
18:53:12*jxy quit (Ping timeout: 250 seconds)
18:53:33FromDiscord_<moerm> If we (at least now and for some time to come) came up with our own "Z3" we would get but mistrust and frankly, often lack of interest. Trust me, I know that community quite well.
18:53:57*jxy joined #nim
18:53:57FromDiscord_<moerm> Araq Yes, SMT != SAT
18:54:36FromDiscord_<moerm> And yes they don't *resolve* ``a == b`` - but they use it as something "assume" like
18:54:45Araqbtw https://github.com/nim-lang/Nim/blob/devel/compiler/guards.nim#L832 seems like I wrote a shitty SMT without noticing
18:54:53absolutejamFrantically googling Z3
18:55:17rayman22201@absolutejam: https://github.com/Z3Prover/z3
18:55:27absolutejamhttps://medium.com/@ahelwer/checking-firewall-equivalence-with-z3-c2efe5051c8f - this guy has closing parens on its own line
18:55:35absolutejamcall the lisp police
18:56:38Araqbut I didn't know what I was doing thus it's unprincipled
18:57:23FromDiscord_<moerm> Araq I'll stay away from judging your work; I'll simply leaving it at saying that I'm not surprised that you though along those lines. And I greatly like it
18:59:24FromDiscord_<moerm> But I'll also underline again that many (in the formal verif camp) are very mistrusting. "we have Z3 verification" is a statement with weight. "We have created our own solver" however will not lead to much (in that camp)
19:01:15FromDiscord_<moerm> Being at that: If you feel that you want to bring closer to those people and don't mind lots of work, we might want to have a look at getting some formal modeller to generate valid Nim code from models. It's available for C and some more esoteric language. To have it for Nim for be very very cool
19:01:27rayman22201kind of makes sense. The whole point of formal verification is "trust" in a sense. Similar to how crypto people don't trust re-implementing crypto algorithms.
19:02:50FromDiscord_<moerm> rayman They do - if they can immediately recognize that one knew bloody well what one was doing. What they don't accept though is crypto implementations that aren't *obviously* professional
19:03:17Calinouhttps://github.com/nim-lang/nimble#nimble-install
19:03:23FromDiscord_<moerm> As for VF you are right. Z3 is like a seal of quality
19:03:49CalinouI wondered about nimble install, could it be made to fetch the latest version from the .nimble file instead of inferring it from the latest VCS tag date? (according to the description, I haven't tried it)
19:04:14CalinouI'd like to make continuous CI builds of my projects (uploaded to GitHub Releases), which requires creating a `continuous` tag that will almost always be the newest tag (compared to stable release tags)
19:04:31Calinoubut if I do that, then people doing a `nimble install` would install the latest continuous version, not the stable release
19:04:54Calinou(I know it's easy to install Nim and Nimble if someone wants to try out Git HEAD, but not everyone wants to)
19:05:39FromDiscord_<moerm> Z3 is a bit like Ada. It radiates trust
19:05:56absolutejamis there an idiomatic name for a method's 'self' parameter?
19:06:23absolutejam/ proc
19:09:21shashlickCalinou - probably not how it is today
19:09:35shashlicknot sure if it will help with nimble but perhaps create tags on a branch instead?
19:10:19shashlickalso perhaps nimble looks for a.b.c versions and skips others but that is probably not the case
19:17:57Araqmoerm: I completely agree with you, even if we produced something "better" than Z3, I wouldn't trust it either :D
19:19:38FromDiscord_<moerm> *g
19:20:02FromDiscord_<moerm> From what I see the main points are 2:
19:20:26FromDiscord_<moerm> a) what is available is way too complex (and often immature) for the average dev.
19:21:10FromDiscord_<moerm> b) The security nightmare isn't due to 0.1% of super elusive bugs. It's due to 99% crappy code
19:21:30FromDiscord_<moerm> connect the two and you have recipe for success
19:22:25FromDiscord_<moerm> Nim is in an excellent position for that. With Z3. That's what's needed. Now.
19:23:24FromDiscord_<moerm> Besides other results Z3 will add credibility to Nim.
19:24:07FromDiscord_<moerm> And now I'll stop before I get carried away again *g. I'll leave it at saying how delighted I am by your interest in that field
19:25:37FromDiscord_<moerm> (And: please at least keep my modeller proposition somewhere in your head, even though that's probably for the future)
19:25:55Araqmodeller proposition?
19:26:15*xet7 joined #nim
19:27:14FromDiscord_<moerm> A good formal modeller creating Nim code from a model
19:28:01FromDiscord_<moerm> "The safest and most comfortable way to create really, really good (as in "safe") code ... for NimZ3"
19:28:22FromDiscord_<moerm> The point is to cover the whole cycle from modelling to verification
19:38:25*Marumoto joined #nim
19:39:30*nevermind joined #nim
19:41:30Araqthat's beyond my capabilities
19:42:23Araqone more question: how do you deal with integer overflows?
19:42:38Araqgenerally, in Ada Spark.
19:43:51FromDiscord_<moerm> The point is about having them at all in the first place
19:44:34FromDiscord_<moerm> And: No, that's certainly not beyond your capabilies. Actually you already did something very comparable 😉
19:44:56FromDiscord_<moerm> But that thing was anyway just a long term idea. No need to worry
19:45:39FromDiscord_<moerm> oops. + "NOT having them ..."
19:47:17FromDiscord_<moerm> (and in plain Ada (no Spark) it would trigger an exception just like in other languages)
19:51:59Araqyes I know in Ada it raises an exception, how much of these can Spark prove to not happen
19:52:05Araqroughly speaking of course
19:59:52FromGitter<verilog15> Hi guys, someone is here?
20:00:19Calinou@verilog15 yes, ask your question :)
20:00:51FromGitter<jaguilar> Friends: I have a newb question. Is there a way to take a temporary reference to an element of an array? Something similar to the following C++: ⏎ ⏎ auto& foo = array[5]; ⏎ foo = "bar"; ⏎ std::cout << array[5]; // Prints "bar" [https://gitter.im/nim-lang/Nim?at=5c3652f34ed1827877851f4e]
20:00:56FromGitter<kaushalmodi> Hello, umm @verilog15 .. I deal with (System)Verilog too
20:01:09FromGitter<verilog15> I was wondering if Nim has pointer arithmetic as in C?
20:03:29FromGitter<verilog15> Consider the following piece of code in C I found about pointer arithmetic. Is it possible to do something similar (with pointers) in Nim? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c365391bd592b2e6e7a9a95]
20:07:04FromGitter<verilog15> Or maybe this method: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Is it possible to do so in Nim? (with pointers) [https://gitter.im/nim-lang/Nim?at=5c3654686370df0b91b6bcb9]
20:10:06FromGitter<jaguilar> I think nim explicitly disallows pointer arithmetic. It is on the feature list.
20:10:07FromGitter<jaguilar> https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers#philosophy
20:10:25*absolutejam quit (Read error: Connection reset by peer)
20:11:11Zevvno, it's perfectly possible
20:11:28FromGitter<jaguilar> Oh. My mistake then.
20:12:04Zevvbut your entering the "unsafe" realms of the language
20:13:38FromGitter<jaguilar> Perhaps an additional useful data point is that pointer arithmetic is rarely a good idea
20:13:47FromGitter<jaguilar> Even in C
20:13:56FromGitter<jaguilar> it's a source of an incredible number of security bugs
20:14:30FromGitter<jaguilar> It's often less confusing to use array[offset] style instead
20:14:39FromGitter<jaguilar> and increment the offset rather than the array pointer.
20:16:46*zachk joined #nim
20:18:18FromGitter<verilog15> I know that it is not recommended and that is why Nim was created in the first place. I'm just looking for a fair easy example which proves that there is pointer arithmetic in Nim, for study purposes
20:18:37*absolutejam joined #nim
20:19:10*zachk quit (Changing host)
20:19:10*zachk joined #nim
20:19:11Araqvar p = cast[ptr UncheckedArray[T]](addr someThing)
20:19:12Zevvhttp://paste.debian.net/1059450/
20:19:14Araqp[i]
20:19:17Zevvdon't try this at home
20:21:13FromGitter<verilog15> Oh great! thank you very much. Is it the same as the one I wrote in C?
20:21:30Zevvmore or less
20:22:13Zevvp1 gets you a ByteAddress pointing to the first character of the string. ByteAddress is a type allowing you to do arithmatic with.
20:22:38Zevvthe while checks if the poiner points to a char '\0', and increases otherwise
20:22:39*Trustable quit (Remote host closed the connection)
20:23:40FromGitter<kaushalmodi> @verilog15 I don't have experience with pointer arithmetic, but searching for this in nim forum yielded https://forum.nim-lang.org/t/1188#7366
20:24:05FromGitter<kaushalmodi> May be Zevv can comment on that code
20:25:18Zevvthe reason you can't do pointer arithmatice with 'normal' ptrs is that the basic operations like `+` and `-` are not available for them. These templates define those for you.
20:25:26ZevvBut just don't go there :)
20:27:56FromGitter<jaguilar> According to the docs, nim will automatically dereference pointers and references via dot notation
20:28:15FromGitter<jaguilar> But I'm seeing an error when I try to do this, which is fixed by adding empty brackets
20:28:37Araqthat's only done for fields, not for procs
20:28:40FromGitter<jaguilar> I.e. let foo = addr(bar[1]); foo[].action works
20:28:44FromGitter<jaguilar> but foo.action doesn't
20:28:48Zevvthere is an experimental mode for that
20:28:53FromGitter<jaguilar> was this feature added recently?
20:28:53Araqaction is not a field then
20:29:31FromDiscord_<Obstinate> Ah, that only works for fields?
20:29:34FromDiscord_<Obstinate> not functions?
20:29:48Zevvthere is an experimental mode for that
20:29:55Zevvoh sorry, I ment: add {.experimental.}
20:31:04FromGitter<kaushalmodi> @jaguilar From my notes, this works: https://ptpb.pw/cj4J/nim
20:31:34FromGitter<kaushalmodi> `[]` is the dereferencing operator
20:31:53FromDiscord_<Obstinate> I got it. I just thought it happened automatically. It turns out it does with {.experimental.}
20:32:02*zestyr joined #nim
20:34:15FromGitter<verilog15> Did they override the operators '+' and '-' so they would work on pointers in the following link?: https://forum.nim-lang.org/t/1188#7366
20:36:06Zevvyes
20:37:46absolutejamI have to use parens for procs when I have multiple args right?
20:37:50FromDiscord_<Obstinate> Is there a way to specify a "constructor" for tuples and such?
20:37:59FromDiscord_<Obstinate> Or do I just write an "init" function
20:38:35zestyrno absolutejam, it's in the manual under "Command invocation syntax"
20:38:35ZevvI believe initSomething or newSomething is idiomatic indeed
20:40:11Zevvor just construct on the fly with (blah: 42, this: "that") syntax
20:45:53*absolutejam quit (Ping timeout: 245 seconds)
20:46:13shashlickAraq: size_t (uint) = csize, but what is ssize_t (int)
20:46:38zestyrsigned size_t
20:47:59FromGitter<verilog15> does Nim has Automatic variable as in C? (Link to wiki: https://en.wikipedia.org/wiki/Automatic_variable?fbclid=IwAR11mTo2zdD8-j2cM-dt6bBYy6kIb2fhiVHPyp7xzQrghFK0-43pCFLBDCc)
20:48:49narimirandom96: you here? any luck with that website server thingy?
20:48:51*absolutejam joined #nim
20:49:28*shashlick_ quit (Quit: The Lounge - https://thelounge.chat)
20:52:05absolutejamthanks for pointing that out zestyr
20:52:17absolutejamI was testing it but issue was I was trying to wrap in 'echo'
20:52:34absolutejamand obviously it doesn't like `echo(myproc "a" "b")` (as per docs)
20:52:37*ng0 joined #nim
20:54:19FromGitter<SolitudeSF> you still need commas, its not lisp
20:55:21absolutejamthat was just a bad copy to IRC :P
20:57:21shashlicklooks like this should be uint there - https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L1729
21:05:01FromGitter<Varriount> @verilog15 Yes.
21:05:49FromGitter<Varriount> @verilog15 I have yet to see a procedural language (with scoped functions) that doesn't implement automatic variables.
21:06:21*banc quit (Quit: Bye)
21:09:53FromGitter<verilog15> @Varriount can you example or show with example?
21:10:39*narimiran quit (Quit: Leaving)
21:11:00FromGitter<verilog15> can you explain or show an example*. sorry :)
21:14:20*banc joined #nim
21:14:27dom96narimiran[m]: fixed
21:18:50FromGitter<verilog15> In C each variable can be only in the scope: ⏎ ⏎ ```void main() {``` [https://gitter.im/nim-lang/Nim?at=5c36653a783a5553d80ad7a7]
21:20:41FromGitter<verilog15> In C each variable can be only in the scope: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This will lead to fail. ... [https://gitter.im/nim-lang/Nim?at=5c3665a95aa04d46c584fbc1]
21:24:23FromGitter<kaushalmodi> @verilog15 something like this?
21:24:27FromGitter<kaushalmodi> ```let foo = 1 ⏎ block: ⏎ let bar = 2 ⏎ echo bar``` [https://gitter.im/nim-lang/Nim?at=5c36668b783a5553d80aded7]
21:25:03FromGitter<kaushalmodi> ^ above will fail with *Error: undeclared identifier: 'bar'* because `bar` is only in that block scope
21:25:13FromGitter<verilog15> yeah thanks! `foo` and `bar` are automatic variables right?
21:25:24FromGitter<kaushalmodi> sorry I am dumb when it comes to C
21:25:44FromGitter<kaushalmodi> you can compile the above and see in the nimcache to see what the compiled C looks like
21:26:46FromGitter<verilog15> It does, but if we speak about the definition of `automatic variables`, then `foo` and `bar` are both automatic variables?
21:26:49*krux02 quit (Remote host closed the connection)
21:33:31FromGitter<kaushalmodi> I don't know the low level jargon of how it's done in C. But yes, this compares to the automatic variables in SystemVerilog i.e. their lifetime expires once the scope ends
21:34:50FromGitter<verilog15> Great thank you
21:35:47FromGitter<verilog15> How Are NIM Arrays Represented In Memory?
21:37:51dom96same as C arrays
21:40:39FromGitter<verilog15> with pointers?
21:41:20*vlad1777d__ quit (Ping timeout: 250 seconds)
21:43:43FromGitter<verilog15> What will happen if we will go out of arrays bounds? will the program end at that second or will it continue?
21:45:34FromGitter<kaushalmodi> @verilog15 the best way is to try it out
21:45:39FromGitter<kaushalmodi> Nim is a compiled language
21:45:49FromGitter<kaushalmodi> it won't even compile if things go out of bounds
21:46:26FromGitter<kaushalmodi> e.g. ⏎ ⏎ ```let foo = [1, 2] ⏎ echo foo[0] ⏎ echo foo[1] ⏎ # echo foo[2]``` ⏎ ⏎ works [https://gitter.im/nim-lang/Nim?at=5c366bb26a394e2821818240]
21:46:55FromGitter<kaushalmodi> but the moment you uncomment the last line, it won't even compile; you will get: `Error: index out of bounds: (a:0) <= (i:2) <= (b:1) `
21:50:29CalinouI remember seeing something about array bounds checks being disabled in release mode
21:50:43CalinouI believe this doesn't impact compilation errors that might be thrown?
21:52:14FromGitter<kaushalmodi> Calinou: you are right!
21:52:30FromGitter<kaushalmodi> running with `-d:release` doesn't fail compile
21:52:44FromGitter<kaushalmodi> index 2 just rolls over to index 0
21:53:57FromGitter<kaushalmodi> well. it is not rolling over
21:54:09FromGitter<kaushalmodi> it is just fetching arbitrary vals from memory
21:54:19FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c366d8a9289cc7aa74a931d]
21:54:41FromGitter<kaushalmodi> run with `-d:release` and I get: ⏎ ⏎ ```10 ⏎ 20 ⏎ 1 ⏎ 140733011305400 ⏎ 0``` [https://gitter.im/nim-lang/Nim?at=5c366da19289cc7aa74a9339]
21:54:50FromGitter<kaushalmodi> that's something good to know :)
21:54:58*zyklon quit (Read error: Connection reset by peer)
21:57:15FromGitter<kaushalmodi> one last thing on that topic .. you can pass `-d:release --boundChecks:on` to enable boundary checks in release mode too, and above snippet will fail
21:59:42*PMunch quit (Read error: Connection reset by peer)
22:01:59FromGitter<verilog15> what else `-d:release` do?
22:09:01Calinouuh, that's bad to hear :(
22:09:12Calinouthis means you need to compile both in debug and release mode in CI to catch more bugs
22:09:27Calinou(if you want to produce optimized binaries for distribution)
22:09:29FromGitter<verilog15> Also can you point when was `-d:release` implemented? A link to the release notes would be nice.
22:09:58zestyrverilog15 just check the manual
22:11:14zestyroh nevermind, the release option isn't documented there
22:11:15*zyklon joined #nim
22:11:49FromGitter<SolitudeSF> just look for `release` and `speed` https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg
22:18:39Araqyeah -d:release is pretty terrible :-) better use --stackTrace:off --opt:speed instead
22:22:40*koranza joined #nim
22:22:58rayman22201@Calinou It's very common practice in the C/C++ world to have both a debug mode and release mode (and run CI on them)
22:23:07FromGitter<verilog15> what does Nimord stands for?
22:23:25rayman22201https://en.wikipedia.org/wiki/Nimrod
22:23:27ZevvKing Nimro
22:23:28Zevvd
22:28:15Calinourayman22201: I know, also because in C++, null behavior depends on debug/release mode IIRC
22:28:22Calinou(good old bugs that disappear with a debug build)
22:28:39CalinouAraq: what's the performance difference like?
22:31:45*Vladar quit (Remote host closed the connection)
22:39:57*absolutejam quit (Ping timeout: 252 seconds)
22:48:07Araqfeels the same to me :P
22:50:32*oculux joined #nim
22:53:52*oculux quit (Client Quit)
22:56:06*jxy quit (Remote host closed the connection)
22:56:07*zyklon quit (Read error: Connection reset by peer)
22:56:57dom96shashlick: reviewed your PR. Sorry, there is a fair amount of changes
22:59:53*jxy joined #nim
23:04:14shashlickdoesn't seem too unfair 🙂
23:11:08FromGitter<timotheecour> @araq do u have 30 seconds?
23:11:18*oculux joined #nim
23:13:25*zyklon joined #nim
23:21:41*Ven`` joined #nim
23:29:32dom96I wonder how big of a deal this is: https://gist.github.com/dom96/af65206852e17178a62a5265e05f2bce
23:29:50dom96People on HN seemed to really think it was a disaster to be able to mutate the key of a table
23:35:32FromGitter<timotheecour> I think it enables real use cases though that overly strict rules of immutability wouldn’t allow; as it currently stands it requires programmer to make sure hash doesn’t change when key is mutated; I’m curious if there’s a way we can have both mutability of key and safety (or show warnings etc) by preventing hash from changing
23:38:11FromDiscord_<moerm> Oops, I'm still here .. sorry, was absent. see you soon - and Thanks for todays discussion, Araq 😉
23:43:09*nim-listener joined #nim
23:43:18*nim-listener quit (Client Quit)
23:46:05FromGitter<timotheecour> actually without reall immutability (in the D sense, not the weaker nim sense which is not really immutable), I don’t think there’s a way to design a table data structure that accepts arbitrary types as Keys and has immutable hashes
23:46:13l1xdom96: people think lots of crap on HNz
23:46:34FromDiscord_<exelotl> Here's the result of today's experiments https://hastebin.com/raw/oyujayizub
23:46:42l1xdom96: question is how obvious is some behavior
23:47:02rayman22201I could it see it being less of a "problem" if you could get the actual hash back out. Technically the internal hash is immutable.
23:47:07FromDiscord_<exelotl> managed to get nim to generate something pretty close to the same C code I'd write by hand
23:47:53FromDiscord_<exelotl> for initialising structs, and calling functions that take pointers to structs
23:48:04FromGitter<timotheecour> @rayman22201 what do u mean
23:51:16rayman22201The way table is implemented uses the Hash type https://nim-lang.org/docs/hashes.html
23:52:33rayman22201in Dom's example, if you changed the string back to the original "hello!" it would work again.
23:53:16rayman22201or to put it another way, the hash function is pure. So in that way, the table keys are immutable.
23:53:30FromGitter<timotheecour> well but the safety concern is still a valid concern; personally i prefer the flexibility-at-expense-of-safety here but it’s a valid concern
23:53:59rayman22201it's kind of a contrived example imo, but I agree with you @timotheecour
23:54:20FromGitter<timotheecour> > the table keys are immutable ⏎ ⏎ you do realize that nim’s immutability is not enforced, right?
23:55:17*stefanos82 quit (Remote host closed the connection)
23:55:22rayman22201yes of course.
23:56:50rayman22201I guess the safety is on par with C++ here I suppose. In that you can't get at the internal data structure of the table and change the hash values. But that's more about encapsulation than immutablity.
23:56:51*zyklon quit (Read error: Connection reset by peer)