<< 17-07-2019 >>

00:02:16skrylar[m]I dunno, CF was good in its time
00:02:32skrylar[m]Used to see a lot of argument about dev and maintenence TCO's between early PHPs and old coldfusion users
00:03:02skrylar[m]Nowadays there is also Lucee which can run most of it, albeit not the current gen adobe stuff
00:07:36shashlickNim cpp should be enough
00:14:19*altarrel_ quit (Quit: Leaving)
00:17:39*altarrel joined #nim
01:03:36*altarrel quit (Quit: Leaving)
01:20:24*altarrel joined #nim
01:22:00*altarrel_ joined #nim
01:40:55*johnjane[m] joined #nim
01:41:58*altarrel quit (Quit: Leaving)
01:54:43*UNIcodeX quit (Read error: Connection reset by peer)
02:06:56*altarrel_ quit (Quit: Leaving)
02:10:09*krux02_ quit (Remote host closed the connection)
02:48:56*leorize quit (Ping timeout: 260 seconds)
02:49:52*leorize joined #nim
02:51:34*dddddd quit (Remote host closed the connection)
03:12:44*lritter quit (Ping timeout: 272 seconds)
03:13:11*lritter joined #nim
03:36:46*fjellfras joined #nim
03:38:11*lritter quit (Quit: Leaving)
03:44:25*ftsf joined #nim
04:07:54*martinium joined #nim
04:12:36*nsf joined #nim
04:22:42skrylar[m]looked in to loading ktx on nim
04:22:49skrylar[m]seems like the tools that make ktx are spread out here and there
04:36:02*martinium quit (Quit: Textual IRC Client: www.textualapp.com)
05:01:04*stefanos82 joined #nim
05:01:42*absolutejam joined #nim
05:01:59shashlickwhen you add to a seq, does it deepCopy or just point to T
05:02:14*NimBot joined #nim
05:03:47*Jjp137 quit (Ping timeout: 245 seconds)
05:04:21*Jjp137 joined #nim
05:05:11shashlicknightlies have passed - https://travis-ci.org/nim-lang/nightlies cc @narimiran
05:14:08*absolutejam quit (Ping timeout: 258 seconds)
05:14:44*absolutejam joined #nim
05:31:43*actuallybatman quit (Ping timeout: 245 seconds)
05:39:54*narimiran joined #nim
05:43:50*sniffdtek joined #nim
05:53:33*solitudesf joined #nim
06:16:03*solitudesf quit (Quit: Leaving)
06:16:30*solitudesf joined #nim
06:25:03dvni can't find any docs for the tui module, but i saw someone using it. they did "import tui" - so it's part of the stdlib?
06:33:03*absolutejam quit (Ping timeout: 244 seconds)
06:41:36*fjellfras quit (Ping timeout: 268 seconds)
06:43:14*brakmic joined #nim
06:48:33*brakmic_ joined #nim
06:50:27*brakmic quit (Ping timeout: 245 seconds)
06:53:27*krux02 joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:02:00*rockcavera is now known as Guest72744
07:02:00*tiorock joined #nim
07:02:01*Guest72744 quit (Killed (card.freenode.net (Nickname regained by services)))
07:02:01*tiorock is now known as rockcavera
07:04:46*gmpreussner joined #nim
07:06:58*absolutejam joined #nim
07:07:31*absolutejam1 joined #nim
07:08:27*tiorock joined #nim
07:11:19*brakmic_ quit ()
07:11:26*rockcavera quit (Ping timeout: 258 seconds)
07:11:52*brakmic joined #nim
07:14:12*brakmic quit (Read error: Connection reset by peer)
07:14:18*brakmic_ joined #nim
07:14:35*brakmic_ quit (Client Quit)
07:18:04*rockcavera joined #nim
07:21:01*tiorock quit (Ping timeout: 258 seconds)
07:22:49*jjido joined #nim
07:36:38*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:37:50Araqdvn, I don't have tui.nim
07:38:13narimirannim v0.20.2 is almost ready. if you're impatient, you can already grab it from https://github.com/nim-lang/nightlies/releases — please report ASAP if something is broken or not shipped :)
07:39:11*Jjp137 quit (Ping timeout: 244 seconds)
07:42:29*Jjp137 joined #nim
07:47:14Zevvwow 250 commits since 0.20.0
07:49:22*disruptek quit (Ping timeout: 248 seconds)
07:49:30narimiranZevv: yeah, it's been only a month, but we worked hard on bugfixes :)
07:49:49*sniffdtek quit (Read error: No route to host)
07:51:45*disruptek joined #nim
07:53:44FromGitter<arnetheduck> fwiw, nim-chronos is gaining an asyncchannel for communicating work to the event loop (re flowvars and asyncevents etc)
08:00:13FromGitter<arnetheduck> and thinking about nim with batteries, I'd rather have a solid tool that allows me to package my deps myself so I get the ones I need (for the behind-the-firewall-case) rather than a bunch that I don't need, and missing some.. I still think that unless you think clearly about the "governance" of the deps list, it'll quickly become more annoying than the current setup - having a small std lib + tool is efficient
08:00:13FromGitter... because development can happen in parallel and independently, and because there's a natural tendency to let obsolete libraries die without breaking things - as long as the old versions are around, everything that worked keeps working and only when you want to upgrade or change things do you need to take into account ... [https://gitter.im/nim-lang/Nim?at=5d2ed58d570ac36f8d3c0e24]
08:01:04Araqwell obviously "nim with batteries" is not for you, that doesn't mean the idea is bad
08:01:23FromGitter<arnetheduck> on governance, the crucial question is this: when do you drop a library whose maintainer has moved on? this is what plagues the std lib where someone randomly dumps some incomplete module and when it's time to deal with the tail 20% that make a quality implementation, there's silence and maintenance burden
08:02:35FromGitter<arnetheduck> well, it's totally for me if it's made in a way that I can supply my own list so I can include my own batteries as well
08:02:57*absolutejam quit (Ping timeout: 244 seconds)
08:03:35AraqI'm trying to see the newcomer's perspective. "oh a Nim that ships with a UI library, OpenGL support, SDL support and a better terminal.nim? Count me in."
08:04:36Araqthat's different from "here, you can 'design' your own distro easily, but you still need to search Nimble and hope you picked the right one"
08:05:40*floppydh joined #nim
08:05:47Araq> on governance, the crucial question is this: when do you drop a library whose maintainer has moved on?
08:06:02Araqwell ideally we don't, we fork the project and ensure it keeps compiling.
08:06:36*Jesin quit (Ping timeout: 272 seconds)
08:06:45Araqthat's not good enough for a "battle tested Nim distro" but not every user has the same requirements or even quality standards
08:08:40*rokups joined #nim
08:09:52Araqtake this issue as an example, https://github.com/nim-lang/Nim/issues/11713
08:10:25Araqyes, it's kinda embarrassing we never moved htmlparser into a Nimble package
08:11:00Araqbut that aside, it's quite typical: it's not perfect at all but too useful to simple remove it from the face of the earth
08:12:41Araqand a nim-with-batteries should include it, a nim-solid shouldn't
08:23:04dom96arnetheduck: asyncchannel? can you elaborate on what this means?
08:23:19*ftsf quit (Quit: Leaving)
08:25:19FromGitter<arnetheduck> well - with limited time and resources, something's gotta give - which can most easily be outsourced to an interesting third party? htmlparser or in-depth researched language and compiler features? how do you encourage that it's light and easy for said newcomer to improve htmlparser? in a smaller library with clear bounds or in a large complicated setup? don't get me wrong - I agree with nim-batteries being a step
08:25:19FromGitter... in the right direction - for example, this way, there are pieces that are digestible on their own, without having to understand the full picture, which I think is helpful.
08:28:22FromGitter<arnetheduck> @dom96 we're developing a channel feature for chronos so we can pass work to it from other contexts / threads / etc.. @cheatfate and @zah will know more
08:29:48dom96so you're integrating Nim's channels with async?
08:30:17dom96We're doing the same but for spawn's FlowVar, and possibly might also do the same for channels if rayman22201 (or someone else) is interested
08:30:34*absolutejam joined #nim
08:31:52federico3arnetheduck: essentially you described distributions
08:32:23Araqfederico3, yes it's about distributions
08:34:50Araqarnetheduck: well we agree htmlparser should be its own Nimble package
08:35:03Araqbut now if we move it out of the stdlib, we break somebody's code
08:35:32Araqexcept if we had this nim-batteries thing, we could still ship it
08:35:41*absolutejam quit (Ping timeout: 268 seconds)
08:36:12FromGitter<mratsim> those kind of things need to be announced with 3months of leeway to manage people expectations
08:36:36FromGitter<mratsim> like "for 1.0 we will be moving some libraries out of the stdlib, this is done for .... here are the replacement"
08:36:46FromGitter<mratsim> just like basic2D and basic3d in the past
08:36:53FromGitter<arnetheduck> federico3, no, I mostly described go's vendor approach - distributions suffer the same problem: they package random versions of random packages which I may or may not be interested in (as in, my application may or may not be compatible with). look at modern distros - they're *also* moving away from the monolith - they package a stable core (glibc, gnome) and the rest goes into indiviudally upgradable modules with
08:36:53FromGitter... all deps included in the right versions (fedora atomic / modules / appstream)
08:37:48Araqmratsim: yes we did that in the past. we missed plenty.
08:37:50FromGitter<arnetheduck> Araq - better break someone's code before announcing a stable version than after, if it's going to be done - you don't break anyone's code if they stick with the previous nim version
08:38:03federico3the go model is a disaster
08:38:38Araqarnetheduck: well already people stick to their precious previous Nim versions, I don't think it's healthy
08:39:03*skaruts joined #nim
08:39:13federico3bundling is ultimately hurting end users (along with distributions on the way)
08:39:25FromGitter<mratsim> They don't stick to previous nim versions for something missing in the standard lib
08:39:43FromGitter<arnetheduck> well, when nim is smaller, it's easier to upgrade it..
08:40:06Araqthey stick because Nim keeps breaking stuff and the dependencies work with 0.19.x
08:40:32FromGitter<arnetheduck> federico3, how is bundling hurting users?
08:40:57FromGitter<arnetheduck> there's less to break if nim is smaller
08:41:26Araqyeah, I like a smaller Nim as much as you do
08:41:46FromGitter<arnetheduck> if they need dependencies upgraded, and it has not been done yet (aka the dependency is not obsolete), you build in an incentive to get the dep upgraded as well
08:41:48federico3Araq: exactly. I have to use previous versions when I don't have time to port stuff to newer releases. At least depending exclusively on compiler + stdib allows me to use an older release without surprises.
08:42:31FromGitter<arnetheduck> https://docs.fedoraproject.org/en-US/modularity/ - what distros do nowadays
08:44:29Araqhttps://github.com/nim-lang/Nim/pull/11704 also *very* typical
08:44:41Araqit's a bugfix, the compiler is now correct.
08:44:42federico3arnetheduck: it discourage developers to care about backward compatibility and planned deprecation. This leads users to have large blobs of code where security upgrades are extremely difficult to do
08:44:58federico3(and also other upgrades, e.g. changes in network protocols)
08:44:59Araqbut it breaks 2 Nimble packages
08:45:59Araqnow, what to do?
08:46:22Araqthe packages are declared to be "important"
08:46:38Araq(honest question, I don't know what to do :P )
08:47:07federico3Araq: in this case or in general?
08:47:54FromGitter<arnetheduck> developers are completely an utterly incabable of maintaining backwards compatibility at scale. glibc broke `memcpy` like 3 times - it's one of the most simple functions at the bastion of stability. seems like a bad idea to opimise your processes for that, no matter how much you'd like for the world to be both evolving and unchanging at the same time
08:48:46FromGitter<alehander42> Ь
08:48:46Araqfederico3, in general, for this case I have a solution, but it will be more work
08:50:21Araqin general I'm of the opinion that v1 should be bug-compatible with what we ship. it's not the end of the world anyway, there will be a v2. it's like Nim never really understood how versioning works...
08:50:46FromGitter<arnetheduck> well, yeah - bugs spread and grow worse over time as people start relying on them. yet another reason to ensure that a std lib has a way to ship non-breaking upgrades.. in c++, that's inline namespaces whick allow the old and new implementations live side-by-side at an abi level - it's not perfect, but it's one approach. rust does a similar thing: deps of deps get versioned so that if a depents on c.2, and b depends
08:50:46FromGitter... on c.3, both c.2 and c.3 get bundled so that both a and b can work
08:50:48*shomodj joined #nim
08:51:21federico3arnetheduck: backward compatiblity works well for 99.9% of the cases. There are occasional bugs and you are cherry-picking one. Those cases can be handled as long as people still make an effort.
08:51:27FromGitter<arnetheduck> it's easier to do all that if it doesn't become so much of a problem to begin with, and that means battle-testing stuff *before* it goes into std
08:52:10FromGitter<arnetheduck> lol raymond chen of microsoft would probably have a different opinion :)
08:52:21Araqthat sometimes works, and sometimes doesn't. KDE 4 only became stable long after v1 because before that not enough people tested it
08:52:30Araqer
08:52:34AraqI mean after 4.0
08:53:48federico3"grow worse over time as people start relying on them" -> that's a form of stability and it's a feature. When a bug is fixed in a way that changes an expected behaviour it's treated as a breaking change and warrants a new release train
08:54:47*tiorock joined #nim
08:54:47*tiorock quit (Changing host)
08:54:47*tiorock joined #nim
08:54:47*rockcavera quit (Killed (hitchcock.freenode.net (Nickname regained by services)))
08:54:47*tiorock is now known as rockcavera
08:57:44FromGitter<arnetheduck> well yeah, and packages offer exactly that: you want stability? use version 3.42 with the bug. you want the fixed version so that you don't have to pile more workaround on top of the bugs? go with the next version. best of both worlds - those that want no change are served and those that are actively maintaining their stuff get to do so. if backwards compatibility "happens" and the upgrade is easy, that's a
08:57:44FromGitter... fantastic bonus, but at least you have a "regular" way to deal with the breakage that can and will happen, every time
08:58:51FromGitter<arnetheduck> if you don't anticipate that stuff breaks, you're out of tune with reality and the tool/environment/langauge fails you when you actually need it
08:58:56federico3Araq: in general I would recommend announcing a guaranteed minimum time between a breaking change is introduced in a nightly and when it lands in a new release.
08:59:22Araqfederico3, usually we provide a switch instead
08:59:38Araqbut it depends on the kind of breaking change
09:00:19federico3Araq: yes, the switch is not always effective
09:01:12federico3arnetheduck: yes, that's how semantic versioning works
09:01:17*fjellfras joined #nim
09:01:49*fjellfras quit (Max SendQ exceeded)
09:02:07FromGitter<arnetheduck> switch doesn't scale for larger projects (like ours) because you end up with package a needing the switch and package b not.
09:02:21*fjellfras joined #nim
09:03:15FromGitter<arnetheduck> semantic versioning gives the author a way to communicate their belief about what breaks and what doesn't between versions. it's excellent! but as a consumer, I also need tooling to deal with when that belief turns out to be unfounded
09:03:52FromGitter<arnetheduck> *a structured way
09:04:20federico3also, a new breaking change can land into devel at any time with no warning and releases are not announced in advance. This forces developer to either test constantly against devel and rush to fix breakages or give up and let things break on a new release
09:04:54*absolutejam joined #nim
09:08:33FromGitter<arnetheduck> a new breaking change can be discovered in a release minor-point version and not announced in advance!
09:08:34Araqarnetheduck: well a switch is not an absolute solution, but a help for migration
09:09:04Araqand it did work for nimble and others fwiw
09:09:17AraqI'm talking about --nilseqs:on
09:09:19FromGitter<arnetheduck> sure, I'm just pointing out that things like that don't scale
09:09:30*absolutejam quit (Ping timeout: 258 seconds)
09:09:38Araqnothing "scales". For Google only their mono-repo scales.
09:10:20FromGitter<arnetheduck> if we're talking about bringing nim to more developers out there, we'll see more and more of these little tricks break apart.. that's why we're having this discussion now, so that perhaps we can anticipate how to handle it
09:10:50AraqI think it's an unhealthy word, it's wiser to think about a spectrum of pain
09:10:55skrylar[m]yup. i develop on a point release and ignore devel generally
09:11:16Araqskrylar[m], and that's what you should do.
09:11:35skrylar[m]sometimes i hook a CI up to do canary builds against devel
09:12:06AraqI also don't use "devel" versions of GCC, clang, Linux, ...
09:12:39skrylar[m]a lot of people target devel in nimble and nightly in rust
09:12:42skrylar[m]its odd
09:12:53skrylar[m]well for rust its often because a lot of things stay perpetually broken
09:13:06Araqif you want --newruntime, you should devel.
09:13:09Araq*use
09:16:22federico3Araq: do you see my point? People are given a binary choice: devel vs point release and nothing in the middle
09:16:43Araqno I'm sorry, too many people talking
09:17:39Araqwhat's the alternative? how does the "middle" look like?
09:18:54FromGitter<zah> I would personally appreciate more frequent point releases. Perhaps this would allow me convince @arnetheduck that we can finally spend a little bit of time investigating and fixing the bugs that we encounter
09:19:11skrylar[m]well if its put like that, i can just stop talking :shrug:
09:19:44FromGitter<arnetheduck> haha, yeah, and frequent point releases are easier when... dumroll... nim is smaller :)
09:21:18dom96actually, if I recall correctly the --nilseq flag didn't work for Nimble because we ended up shipping a broken Nimble that only worked with that flag or something like that
09:21:34Araqdom96, don't ruin it :P
09:21:51federico3Araq: doing alpha releases (perhaps more frequently) that are in feature freeze. After a fixed amount of time an alpha release turns into a point release (unless there are critical bugs that still need fixing)
09:21:56dom96also, in your PR it might help to call out the packages that broke and explain what your thinking
09:22:01dom96the PR has no description
09:22:12dom96barely any discernible explanation of what it does
09:22:27dom96so if you want to know what to do ask the community
09:23:22federico3Araq: ...so that people know in advance when a pre-release comes out and how much time do they have to test their packages against it
09:24:18FromGitter<arnetheduck> the .0 release of each series is the alpha release :)
09:24:34AraqI'm not a fan of "alpha" or "beta" releases, if we break stuff in X.0.0 there should be a X.0.2
09:27:01Araqpossibly related: https://herbsutter.com/2019/07/13/draft-faq-why-does-the-c-standard-ship-every-three-years/
09:27:40Araqhe argues for a fixed release schedule
09:28:49Araq> There are bugs in the standard, so should we delay C++20? -
09:28:49AraqOf course, and no.
09:30:16*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:36:12FromGitter<arnetheduck> pretty good article, yeah. shipt stuff that works, cut the stuff that doesn't (yet), have staging area for stuff to grow in before putting in std
09:39:45federico3Araq: call it odd/even then, but the point is to let library maintainers know in advance when things will break
09:40:06FromGitter<arnetheduck> fwiw, we recently opened a staging area of our own where we'll be trying out stuff before potentially proposing them for inclusion: https://github.com/status-im/nim-stew - also so that we can be a bit more independent of the point-release cycle and to some extent offer a migratory compatibility layer
09:43:15Araqyeah I've seen it, good stuff.
09:43:58Araqis it too late to change the name?
09:45:50*skaruts quit (Remote host closed the connection)
09:46:43Araqnim-boost or nim-turbo, maybe?
09:48:53livcdi propose "nimbo"
09:51:48*Vladar joined #nim
09:57:01FromGitter<arnetheduck> @zah minted it, you'd have to convince him :)
09:57:50FromGitter<zah> o.O what did I invent?
09:58:26FromGitter<arnetheduck> the `stew` name
10:00:02*fjellfras quit (Ping timeout: 248 seconds)
10:04:19*absolutejam joined #nim
10:04:42Araqlivcd, I like "nimbo" too
10:05:13FromGitter<zah> ah, our hodge podge library. ⏎ ⏎ reminds me to ask, what are the reasons for why our proposal for a generic `init` scheme is not being accepted in the standard library?
10:07:45AraqI haven't rejected it yet, but in the meantime tables and seq default to the 'empty' value, mitigating the same pains your RFC addresses
10:08:45AraqI don't think Nim needs yet another way of writing initTable as annoying as that might be.
10:09:25Araqconstructors didn't save C++ from introducing make_shared.
10:10:27*absolutejam quit (Ping timeout: 258 seconds)
10:14:46dom96Starting to think more and more that I'll need to write my own nimpretty implementation to get everyone to use the style I like :P
10:18:56FromGitter<zah> Araq, it's not only about tables though. We have a good deal of types that have init arguments and quite a lot of generic code that benefits from this
10:19:12Araqyou'll enjoy getting Nim's comment handling right with its plethora of ways to write the same thing
10:19:35dom96Araq, Just make it consistent?
10:25:22Araqsure, write your own nimpretty, that's all I'm saying.
10:27:47Araqteach a system without eyes how to make code visually appealing, how hard can it be? :P
10:31:15federico3even better if we can configure the style
10:34:27*shomodj joined #nim
10:39:08Araqzah: ok, fair enough. I remember you told me about some issue though
10:39:40FromGitter<zah> there is an issue with perfect `varargs` forwarding. I'll file it
10:40:15*absolutejam joined #nim
10:40:34*solitudesf quit (Ping timeout: 246 seconds)
10:40:37Araqah "prefect forwarding", C++ here we come, watch out :-)
10:41:04FromGitter<zah> It's easier in Nim, but not fully working :)
10:42:01dom96federico3, one true style might be better, it is what people love about Golang after all
10:42:47federico3no, Nim style insensitivity is a feature
10:43:10Araqwe killed that.
10:43:20federico3what?!
10:43:36Araqit's --styleCheck now
10:44:23narimirandom96: ...as long as that style is your style? :P
10:45:03narimiranit is also what people like about python's "black"
10:45:32narimiranyeah, some people don't like it, but it has generally been accepted, and it cuts down pointless discussions
10:45:48*absolutejam quit (Ping timeout: 268 seconds)
10:45:54federico3accept what?
10:45:58Araqfederico3, well I was kidding, relax, it's only a linter, opt-in
10:46:01narimiran...so people now have more time for other pointless discussions :D
10:46:12Araqwhat's python's "black"?
10:46:18*Vladar quit (Ping timeout: 245 seconds)
10:46:22federico3Araq: like gofmt for python, but more relaxed
10:46:28narimiranhttps://github.com/python/black
10:49:21FromGitter<zah> Araq, I had already filed it actually: ⏎ proc foo(a, b: string, i = 10): string = ⏎ "foo called with " & a & "," & b & "," & $i ⏎ ⏎ proc bar(i = 10): string = ... [https://gitter.im/nim-lang/Nim?at=5d2efd313be99c4786673399]
10:49:47FromGitter<zah> Sorry, copy/pasting mistake. Here it is: ⏎ https://github.com/nim-lang/Nim/issues/9996
10:51:01Araqkrux02 has some RFC pending for varargs ... *cough*
10:51:26*Vladar joined #nim
10:51:32AraqI wasn't aware we support this way of forwarding
10:51:33*absolutejam joined #nim
10:51:51AraqI would have used a macro with unpackVarargs
10:52:03Araqor whatever I called it
10:52:25dom96Araq, what? You killed style insensitivity?
10:52:36AraqI was kidding
10:52:41Araqbut we now have a linter
10:52:54Araqand the *compiler*/nim.cfg enforces it
10:52:55dom96my god, you need to say you're joking after your joke
10:53:07dom96otherwise you're spreading misinformation
10:53:08krux02actually we don't support this way of forwarding.
10:53:45FromGitter<zah> varargs forwarding is supported through the use of `nkArgList` inside the compiler
10:53:46dom96black is in fact what FB uses (it was written by an ex-colleague)
10:54:33dom96narimiran: we should have a few discussions about the one true style and come up with some compromises
10:54:49Araqbut we do have NEP-1
10:54:55Araqand nimpretty tries to follow it
10:55:01dom96I'm not arrogant enough to expect everyone to abide by every one of my style choices, but we should at least come up with something we can all agree to
10:55:06Araqwe had this discussion!
10:55:10dom96NEP-1 was never properly scrutinized
10:55:27Araqit needs an update, PRs are welcome
10:55:48federico3that applies to the compiler and stdlib but I want to have a different style in libraries and C wrappers
10:56:05Araqfederico3, sure and Nim lets you have that
10:56:38federico3hence my need for a formatter that allows configuring styles
10:58:50Araqthat's not nimpretty's job
11:00:09FromGitter<alehander42> i also like the init idea
11:00:16FromGitter<alehander42> otherwise its hard to agree on a style
11:00:18*Vladar quit (Ping timeout: 248 seconds)
11:00:42FromGitter<alehander42> there will be always be cases that seems bad if one style is enforced
11:00:51FromGitter<alehander42> usecases*/snippets
11:00:54FromGitter<alehander42> that look bad*
11:04:26FromGitter<zah> `unpackVarargs` is not quite good, because you cannot insert additional arguments besides the ones you are unpacking
11:06:52FromGitter<zah> surely, you can write a one-off macro with a body similar to`unpackVarargs`, but why should things be that complicated
11:06:52*Vladar joined #nim
11:09:48*Vladar quit (Read error: Connection reset by peer)
11:10:58Araqer ... a take the 4 line macro over yet-another compiler feature including a node kind, nkArgList that I constantly need to remember for every transformation that I do
11:11:26*dddddd joined #nim
11:11:33Araqit's an unfair comparison because nkArgList already exists, but still
11:11:52federico3any help on https://github.com/FedericoCeratto/nimfmt is welcome
11:12:35*Vladar joined #nim
11:29:50*Ivo quit (Quit: Leaving)
11:30:05FromGitter<zah> If you remove the built-in support for `nkArgList`, it's possible to define `unpackVarargs` along these lines: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Then it would be able to mix the varargs will other injected arguments [https://gitter.im/nim-lang/Nim?at=5d2f06bdd14e297762e94c78]
11:48:48FromGitter<zah> To support the `init` proposal properly, you'll need to use perfect forwarding in the system module though. Since macros are off-limit there, this means we either have to fix `nkArgList` inside the compiler or add `unpackVarargs` as a magic
11:52:43*zahary joined #nim
12:00:09Araqthere is no reason system.nim cannot use macros
12:00:35Araqwe don't do it but in the meantime system.nim imports plenty of other modules and it worked out
12:03:30*altarrel joined #nim
12:05:39*stefanos82 quit (Quit: Quitting for now...)
12:07:23*brakmic joined #nim
12:30:58*altarrel quit (Ping timeout: 248 seconds)
12:37:55dom96federico3, why semicolons in arg list, why :/
12:40:25federico3huh?
12:40:40dom96in nimfmt's output
12:41:08federico3that came out from Nim's parser/formatter. nimfmt is a very thin layer on it
12:44:10FromGitter<kayabaNerve> I just want a Nim linter to tell me of unused imports. I don't believe any Nim software does that yet.
12:44:17*sniffdtek joined #nim
12:44:47FromGitter<kayabaNerve> As a side note, going to ask this again, why is ProveInit a thing and can I disable it?
12:45:38FromGitter<kayabaNerve> Because I have a try init except fatal and would rather complain about it than add the line to fix it.
12:46:30FromGitter<kayabaNerve> Jokes aside, I do believe it's more counter productive than productive to users if it can't be disabled.
12:51:34disruptekwould you rather maintain a large stdlib for a large number of users or develop a fast-moving compiler for a small number of users?
12:54:50*altarrel joined #nim
13:02:05AraqkayabaNerve: will do some livecoding session about it
13:02:17AraqI'm always looking for the easy stuff for these :P
13:03:04narimiranhint on unused imports? yes please
13:03:47*rockcavera quit (Remote host closed the connection)
13:04:20*UNIcodeX joined #nim
13:15:18FromGitter<kaushalmodi> > hint on unused imports? yes please ⏎ ⏎ +1
13:21:06shashlickwhat's the preference? need votes - https://github.com/nim-lang/Nim/issues/10630#issuecomment-511995621
13:25:21Araqas I said, use a 'select' template to cut the boilerplate
13:27:33shashlicknot sure what that means which is why i put some examples up
13:27:53shashlickis it option 2? or somethingelse
13:31:10Araqsomething else
13:31:46Araqconst CurDir = selectMac(':', '.') ## doc comment
13:32:21Araqyou need a couple of selectMac/Posix/Doslike variants. so maybe it's not worth it
13:32:31Araqand your 'when' is better
13:32:41Araq(that would be option 1 then)
13:34:45*ofelas quit (Quit: shutdown -h now)
13:35:45shashlickokay option 1 it is, will create a PR in some
13:39:00Araqdisruptek: you raise a good point. We're talking without any numbers.
13:39:14*rockcavera joined #nim
13:40:18*rockcavera quit (Remote host closed the connection)
13:40:38*rockcavera joined #nim
13:43:08disrupteki really don't know what the preference is for the community, but it doesn't have to be inclusive. maybe you should light a torch for a compiler designer and focus on the stdlib if that's what you want to invest in.
13:44:49Araqwell I'm about to have holidays
13:44:58AraqI'll go inside me and think about what to do
13:47:28*UNIcodeX quit (Quit: Leaving)
13:49:37disruptekshashlick: well, i couldn't automate cpp codegen. if you have a few minutes to look at a wrapping attempt, i'd appreciate it.
13:50:06shashlickAm in a two day secure coding training
13:50:18shashlickBut please text - I'll catch up when I can
13:50:43shashlickAraq - does https://arxiv.org/abs/1907.01933 influence your Nim cold fusion idea
13:50:50disruptekit's aws-cpp-sdk or aws-sdk-cpp, depending on where you are in the repository.
13:51:01shashlickApp specific compiler stack
13:51:24shashlickCan you share a link @disruptek
13:52:19disruptekshashlick: sure, but i won't blame you if you take a pass: https://aws.amazon.com/sdk-for-cpp/
13:52:33Araqshashlick: I'm aware of it but it doesn't influence me wrt Nim cold fusion
13:53:57shashlickCool
13:54:03Araqlol
13:54:25disrupteki am gonna try to wrap this for two reasons: it'll be a big win for nim, and the code is pretty damned tame. once we have a solution, we can take our time at a new codegen effort. i'm not sure i can use ryukoposting's work.
13:54:31shashlick@disruptek @varriount and one other person were looking at an aws wrapper
13:54:36shashlickWas it you or someone else
13:55:11disruptekyes? but i hadn't done anything but run the tests. now i come to find that half the product is unimplemented.
13:55:56shashlickI see - well, i'm happy to help
13:56:31shashlicki'd use nimterop for everything except the actual wrapping and call c2nim underneath if the headers are c++
13:56:49shashlicknimterop needs some work to integrate c2nim
13:57:05shashlicknow that c2nim is more backwards compatible, i might consider making it a dep
13:57:15shashlickbut ideal way would be for wrapper to depend on nimterop and c2nim
13:57:18disruptekactually, that might be the best solution. as i said, the code is pretty tame.
13:57:59disrupteki struggle to follow the api generator, which is in nim, if that gives you a sense of my ability level.
13:58:18shashlickc2nim isn't fond of advanced templates, tho @ratiotile has made some PRs
13:58:19disruptekor of ryukoposting's ability to obfuscate...
13:58:48shashlickokay i'm game to help out with this
13:59:10shashlickbut obviously very distracted right now - what specific API do you want to start with
13:59:39disrupteki'm trying to invoke() a lambda function from the ...-lambda/ tree.
14:00:40FromGitter<alehander42> hm what about nim-extended
14:00:42disruptekbut basically, the problem i have is that the most common header, aws/core/aws.h cannot be toasted.
14:00:42shashlickdo you intend using the nimterop API (cImport, etc) dynamically or generate wrappers using the CLI
14:00:45FromGitter<alehander42> cold-fusion was taken right
14:01:14disrupteki've tried both ways, and it seemed like i got farther in cimport, but it wouldn't run in cpp for me, so i went back to toast.
14:01:45disrupteki had to hack some coldfusion once. Once.
14:02:44shashlickwhat error did you have with aws.h
14:02:59shashlickuse toast to preprocess then run through c2nim --cpp
14:03:42disruptekError: unhandled exception: getters.nim(108, 12) `name.len != 0` Blank identifier error [AssertionError]
14:03:47Araqplease don't run an external preprocessor, c2nim ships with one
14:04:26shashlickthat requires code changes to the h files
14:04:38disruptekhow rude.
14:05:45shashlick@disruptek - that error looks like an issue when trying to convert to nim, nimterop doesn't know c++
14:05:59shashlickyou just want to use -p to preprocess
14:06:11disrupteki think it needs to know about namespaces, no?
14:06:33shashlicknimterop doesn't know anything in C++ - classes, templates, namespaces, etc.
14:06:38shashlickyou have to use c2nim
14:07:19shashlickdoesn't look like aws.h uses much in terms of preprocessor stuff
14:07:25shashlickso you could even skip toast
14:07:26disruptekwhat does the cpp mode do?
14:07:40Araqit enables c2nim's C++ support
14:08:10shashlicki think he's asking with nimterop - all it does now is parses the code as cpp using tree-sitter, i guess it is confusing
14:08:31shashlicknimterop cannot convert cpp => nim
14:08:37disruptekyes, especially because it seemed that i got better fidelity when switching to cpp mode.
14:08:59FromGitter<dwlnetnl> Hello, I am wondering if it's possible to build a static C library written in Nim
14:09:01shashlickthat's why i have it available
14:09:19shashlickdwlnetnl - yes, look at exportc
14:09:33disrupteki just tested it and cpp mode crashes and mode=c works fine. so, that's worse fidelity.
14:09:55disruptekbut, clearly that mode change is impactful.
14:10:04FromGitter<dwlnetnl> shashlick: oh yes that's cool
14:10:21FromGitter<dwlnetnl> can you also use exportc to export types etc?
14:10:25FromGitter<dwlnetnl> or just procs
14:10:38disruptekanything.
14:10:43disruptekmore or less the same as c.
14:10:43shashlickagain, it controls which tree-sitter engine i use, it isn't crashing but complaining about the naming used
14:11:17shashlickanyway, is a distraction for what you want to do - you need to use c2nim for c++ headers
14:11:20disruptekwell, this probably solved my problem, thank you.
14:11:26FromGitter<dwlnetnl> And how would it work memory wise? I see that Nim uses a GC by default
14:11:49FromGitter<dwlnetnl> can you like 'disable' the GC?
14:11:53disruptekthere are alternative arrangements available. more than you might imagine.
14:12:04FromGitter<dwlnetnl> so it's easier in C and other languages?
14:12:08disruptekyes, you can disable it, swap it, omit it.
14:12:39FromGitter<dwlnetnl> but you still seems to need to call NimMain, do you?
14:13:18disrupteki imagine so, if you wanted to build a static lib that uses a gc.
14:13:37disrupteksomeone else here could surely answer for sure, surely.
14:14:31FromGitter<dwlnetnl> I'd probably want to build a static c lib in a way that is as easiest to interoperate/embed in other languages
14:14:51FromGitter<dwlnetnl> maybe reference counted?
14:15:39disrupteki think you should install the compiler and dig through `--fullhelp` to identify qualities you deem important to your application.
14:16:04FromGitter<dwlnetnl> sure, I'll have a look
14:16:09FromGitter<dwlnetnl> thanks for the help so far
14:16:53*stefanos82 joined #nim
14:17:21disrupteksure. see the --gc option; refc, mark&sweep, boehm, go, (none), or regions. lots of options and as i said, more than you might imagine.
14:17:51shashlickhttps://nim-lang.github.io/Nim/manual.html#foreign-function-interface-exportc-pragma
14:18:26shashlickhttps://nim-lang.github.io/Nim/gc.html
14:19:25*altarrel quit (Quit: Quit)
14:19:42*altarrel joined #nim
14:20:42FromGitter<mratsim> there was a recent article on building static lib Nim that was quite good
14:20:45FromGitter<mratsim> with musl
14:29:56FromGitter<mratsim> https://www.google.com/search?q=nim%20musl%20static%20binary
14:30:07FromGitter<mratsim> sorry: https://scripter.co/nim-deploying-static-binaries/
14:30:22disruptekthanks. ;-)
14:30:38FromGitter<mratsim> @dwlnetnl ^
14:37:29FromGitter<dwlnetnl> thanks@!
14:41:52disruptekah, that's our own kaushalmodi; i never put that together before. :-)
14:56:52FromGitter<yglukhov> Hey guys. Was there any discussion about renaming Exception -> RootError, CatchableError -> Exception, and changing `except:` semantics to `except Exception:` instead of `except RootError`?
14:57:47disruptekthat's probably something that should have gone into 0.20.
15:01:17*UNIcodeX joined #nim
15:01:47FromGitter<yglukhov> If we treat `except:` being equal to `except RootError:` as a bug, there's still a way to do it :).
15:03:03disruptekthere aren't too many other bugs i can imagine breaking quite so much as the fix for this one.
15:04:10FromGitter<yglukhov> why? Defects were introduced quite recently for exactly the reason to not being easily caught, no?
15:04:46disruptekbecause exceptions are control flow whether we like it or not and you're changing the semantics under the covers.
15:05:27FromGitter<mratsim> we can have a -d:nimOldExceptions
15:06:15disruptekyou want to introduce a compile-time switch to restore old behavior as a bugfix release?
15:06:24disruptekgood god, are you mad, man?
15:06:44Araqyglukhov: can't we fix 'except:' without renaming the exception types yet again?
15:06:45disruptekwhat will you write your code in? new style or old?
15:06:54Araqdisruptek: please calm down
15:06:57FromGitter<arnetheduck> exceptions are random and hidden control flow anyway :)
15:07:05disrupteki'm just kidding aroun'. ;-)
15:07:22FromGitter<yglukhov> Araq: we can, but if you're into it, you
15:07:58FromGitter<yglukhov> 're breaking old code already. at which point we should think if we can do it right once and for all :)
15:08:13*actuallybatman joined #nim
15:08:34FromGitter<yglukhov> And then CatchableError can remain an alias to Exception for backward compat
15:08:39AraqI think I heard that one before, "this will be the last breaking change..."
15:08:47FromGitter<mratsim> famous last words :p
15:08:54disruptekhey, i don't disagree that it needs fixin'. i just don't think it's small enough to go into a patch release.
15:09:03FromGitter<arnetheduck> re `init` - I still miss the ability to use them to balance destructors and enforce their use for a particular type. without that, they're just syntactic sugar
15:10:13*absolutejam quit (Ping timeout: 258 seconds)
15:11:00disruptekthis is why i wanted `exception MyError of ValueError as e:` syntax.
15:12:50disruptekcall it 0.21 and then people can opt-in in a sane way. no reason not to have a 0.21 branch, right?
15:13:09Araqwe have this branch already, it's called 'devel'
15:13:14FromGitter<yglukhov> "this will be the last breaking change" every change is breaking. It just depends where you draw the line :).
15:13:46Araqwell write a short RFC about it then
15:13:54FromGitter<yglukhov> alright
15:13:55Araqor find some existing
15:14:10disruptekif you break 0.20 you can unbreak it. if you break 0.21, you just re-break it correctly.
15:14:14FromGitter<yglukhov> found none, that's why I asked
15:14:41*floppydh quit (Quit: WeeChat 2.5)
15:14:43disruptekthere's an existing issue for this.
15:15:27FromGitter<yglukhov> oh? which one?
15:16:02*sagax quit (Quit: Konversation terminated!)
15:16:16*sagax joined #nim
15:16:34disrupteki think the one i'm thinking of is: https://github.com/nim-lang/Nim/issues/10288
15:17:32*xet7 quit (Ping timeout: 245 seconds)
15:17:36Araqwe can declare it a bug and fix it in 0.20.4
15:18:20Araqsystem.Defect is not catchable, 'except:' shouldn't catch it. Er .. and break the unit testing stuff.
15:19:25FromGitter<yglukhov> disruptek: yeah, I've seen that, but it looks different.
15:19:52disruptekhow is it different? the semantics need to reflect the names.
15:20:02disruptekthat's the bug in a nutshell.
15:20:22disruptekotherwise, we don't know how to write a compiler that can intuit a programmer's intention.
15:20:46FromGitter<yglukhov> Araq: good point about unit testing.
15:22:01FromGitter<yglukhov> disruptek: I'm saying 10288 is orthogonal to what I'm suggesting. It talks about Exception subclasses and their inheritance.
15:23:47FromGitter<GULPF> there's also https://github.com/nim-lang/RFCs/issues/77 which is related as well
15:23:55disruptekif you're not talking about changing the semantics, then i don't know what you're talking about, to be honest.
15:24:43*nsf quit (Quit: WeeChat 2.4)
15:26:28FromGitter<yglukhov> @GULPF thanks
15:28:00FromGitter<arnetheduck> I've mostly learned to ignore bad naming, but oh boy is CatchableError ugly
15:28:10*lritter joined #nim
15:28:14FromGitter<zah> it would have been nice if CatchableError was named just Error IMO
15:28:18FromGitter<kaushalmodi> Just saw a mention of my blog post above.. it's been a while since I wrote a post..
15:29:02Araqhuh?
15:29:15Araqwhat's bad about that name?
15:29:22FromGitter<zah> The base Exception type could have a name that nobody in their right mind would use - for example StackUnwindingEvent
15:29:41FromGitter<zah> In our team, people inherit from Exception too often because they forget about the distinction
15:29:43federico3isn't "catchable" implicit?
15:29:51Araqit's a catchable error, it doesn't get clearer than that
15:30:06FromGitter<zah> Error - short and simple :)
15:32:50*altarrel quit (Ping timeout: 248 seconds)
15:33:32disruptekmaybe except: could set the exception type to Error instead of Exception. now you have a differentiator that's at least a little less painful. i really hate doing this as a bugfix though.
15:34:57Araqdisruptek: yeah I take it back, this is not a bugfix
15:35:15*sentreen_ joined #nim
15:36:22Araqyou shouldn't inherit from CatchableError btw
15:36:35Araqusually it's IOError, OSError or ValueError
15:37:28Araqthe name would be bad if it's what you should use, but you shouldn't use it
15:37:31disruptekthat makes sense.
15:38:02*sealmove joined #nim
15:38:04*sentreen quit (Ping timeout: 246 seconds)
15:38:47FromGitter<zah> hrm, we've adopted the practice of introducing a root cachable error exception for each subsystem (e.g. SerializationError) and then having more-specific sub-types
15:39:25FromGitter<zah> picking one of the std lib errors as a base is not appropriate with this approach
15:39:28*sentreen joined #nim
15:39:44disrupteki guess you need a variant exception type that can hold ioerror, oserror, or valueerror -- if you want inheritance for your exception types.
15:41:59Araqzah: since only OSError has the errorCode*: int32 field it's what you should have inherited from afaict
15:42:32*sentreen_ quit (Ping timeout: 245 seconds)
15:43:18*Trustable joined #nim
15:43:34Araqbbl
15:44:10FromGitter<zah> SerializationError may mean "missing comma in a json file", "RLP object with an invalid blob inside" and so on. Having a base type makes it easy for you to just treat all such errors the same (the details are irrelevant in many situations)
15:44:25FromGitter<zah> The same pattern is present in other sub-systems
15:44:34disruptekpreaching to the choir, my dude.
15:46:45FromGitter<rishavs> Is there any article, tut on using the peg module?
15:54:56*sealmove quit (Quit: WeeChat 2.5)
15:56:43FromGitter<alehander42> just askk Zevv
15:56:46FromGitter<alehander42> oh wait
15:56:49FromGitter<alehander42> sorry nvm
15:56:53FromGitter<alehander42> i thought npeg
15:56:58FromGitter<rishavs> :D
15:59:50FromGitter<rishavs> i am assuming that npeg is the port of lua lpeg?
16:03:04Zevvbasically, although it compiles to nim code instead of executing the peg in a vm
16:03:52Zevvand it has some limitations conpared to lpeg involving captures, because of the static typing
16:04:28FromGitter<rishavs> cool. will check out
16:06:56*brakmic_ joined #nim
16:07:45*brakmic_ quit (Client Quit)
16:08:04*brakmic_ joined #nim
16:08:10*brakmic quit (Read error: Connection reset by peer)
16:19:02*sealmove joined #nim
16:22:17Araqzah: well JsonError inherits from ValueError, it's nothing new
16:23:58FromGitter<zah> Perhaps I picked a bad example, but defining a complete taxonomy of errors in the stdlib seems like a tall order for me. I don't see a problem with people inheriting from `Error` directly instead
16:34:57Araqinherit from ValueError, OSError or CatchableError but I don't think CatchableError is badly named
16:35:23Araqit's not the "don't have to think" solution, it doesn't need a nice name
16:49:33*altarrel joined #nim
16:52:29FromGitter<rishavs> @araq some questions on compiler design; I am trying to create a toy language which will compile down to c. I have a good idea of parsing but I am not sure what to do after AST generation. ⏎ ⏎ 1) Is there a specific format I should adhere to? ⏎ 2) Is there a tool/lib that you would recommend to convert ast to c code? ⏎ 3) I want to have GC in the future. is there anything specific that i should keep in mind
16:52:30FromGitter... right now when I am still deciding on the toolchain? [https://gitter.im/nim-lang/Nim?at=5d2f524d01621760bcd03f95]
16:56:35*brakmic_ quit ()
16:56:58*ibutra joined #nim
16:57:01Araqone "trick" that you should do (and Nim doesn't) is that you should produce the C code as a tree, don't do string concats everywhere
16:57:21FromGitter<zah> While we are discussion exceptions there are few other things I've learned with experience: ⏎ ⏎ 1) The built-in `msg` string field of exceptions feels a bit sub-optional at times. I'd like to create exceptions that carry light-weight data and that will be rendered as strings only sometimes. We could have that if `msg` was a method instead of a field ⏎ ⏎ 2) Exception chains are nice thing to have, because they
16:57:21FromGitter... don't ask me to choose between a complete stack trace and most appropriately typed exception (I'm referring to the situations where you want to remap some system exceptions to your own sub-system exceptions, so you catch them and then reraise as another type) [https://gitter.im/nim-lang/Nim?at=5d2f5371f4fe943971260003]
16:57:55*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:57:57*rokups quit (Quit: Connection closed for inactivity)
16:59:01FromGitter<zah> opps, *feels a bit sub-optimal*
16:59:15Araqabout the GC: avoid everything with the name 'conservative' in it :-)
17:02:31FromGitter<rishavs> thanks
17:03:02*stefanos82 quit (Quit: Quitting for now...)
17:04:48Araqanother tip: C typedefs are a pita, easiest seems to be to emit them and then re-order them in a postprocessing step
17:05:16Araq(Nim doesn't do that either :-) )
17:06:09Araqzah: nothing stops you from not using the 'msg' field and to use a method instead
17:06:45Araq(But I agree)
17:06:50FromGitter<zah> that's what I do, but then my exceptions don't play nice with the built-in handling
17:09:30*nsf joined #nim
17:12:42rayman22201@dom96: you around? More async questions. Does the async wait forever on a select() or poll ()? Or does it periodically timeout to check the work queue?
17:14:55*Trustable quit (Remote host closed the connection)
17:15:37shashlick@kaushalmodi - u around?
17:16:30*absolutejam joined #nim
17:23:11*zyklon joined #nim
17:23:48*shomodj joined #nim
17:26:57*altarrel quit (Quit: Leaving)
17:27:39*uvegbot quit (Ping timeout: 264 seconds)
17:34:02*ibutra quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:34:51*ibutra joined #nim
17:36:31*solitudesf joined #nim
17:40:49*absolutejam quit (Ping timeout: 268 seconds)
17:40:59FromGitter<kaushalmodi> shashlick: yes
17:42:12*ibutra quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:42:39*ibutra joined #nim
17:44:01*ibutra quit (Client Quit)
17:45:59dom96rayman22201, asyncdispatch.poll takes a timeout
17:47:12*oculux quit (Quit: blah)
17:48:30*oculux joined #nim
17:55:52shashlick@kaushalmodi - looks like docs are deployed by every travis job rather than just one - https://github.com/nim-lang/Nim/blob/devel/.travis.yml#L78
17:56:01*altarrel joined #nim
17:56:34*altarrel left #nim (#nim)
17:56:38leorizeyea, someone should limit that to osx
17:56:42shashlickmight be better to have a condition so it happens only for one - https://github.com/genotrance/feud/blob/master/.travis.yml#L52
17:56:44*altarrel joined #nim
17:57:14shashlicki'm also looking into generating a docset using dashing and niv/nim-docset
17:58:18shashlickas part of travis so that it is also kept up to date
18:02:39sealmovehow do you by-pass object field/function conflict?
18:02:43FromGitter<kaushalmodi> shashlick: hmm, somewhere I had a DO_DEPLOY env var setting.. may be that is set just once?
18:03:22shashlickthat's in nightlies, not in devel
18:04:06FromGitter<kaushalmodi> right
18:04:15FromGitter<kaushalmodi> so devel would need something like that
18:04:16FromGitter<kaushalmodi> see https://github.com/nim-lang/nightlies/blob/master/.travis.yml#L106
18:04:23*artemis_coven joined #nim
18:04:44shashlickcan just do it how i did it in feud - the second link I shared
18:05:06leorizeoooh 0.20.2
18:05:35FromGitter<kaushalmodi> shashlick: but that `on:` condition is on Nim devel too
18:05:36shashlickOS = osx && NIM_COMPILE_TO_CPP = false
18:05:59FromGitter<kaushalmodi> so just tighten that on: condition
18:06:04narimiranleorize: yeah :)
18:06:21shashlickyep
18:06:23narimiranwe're getting too casual with these releases :P "oh, btw, 0.20.2 is here"
18:07:35*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:11:34shashlickwish https://github.com/nim-lang/Nim/issues/11553 was fixed in 0.20.2
18:12:01shashlickbut 200 issues in 40 days is amazing
18:12:13narimiranshashlick: we need to leave something for 0.20.4 ;)
18:12:37shashlick😄
18:12:47shashlickawesome work though
18:13:06Cadeyyou can pass a proc as a proc argument right?
18:13:29shashlickyes
18:13:33narimirani'm personally impressed that we managed to focus mostly on bugfixes, and not just work on new (breaking) features. and i hope this will continue in the upcoming months
18:14:46Cadeyhyped for nim 1.0
18:15:15*absolutejam joined #nim
18:16:53rayman22201 @Dom96, thanks. That's what I thought.
18:18:00sealmovenewSeq is called automatically for objects that contain seq fields now?
18:19:34*elrood joined #nim
18:24:55Araqsealmove: kinda
18:24:58*skaruts joined #nim
18:25:08skarutswhat's the best data structure to use if I need to delete elements while keeping the order they're at?
18:25:30skarutslists?
18:25:43Araqa seq
18:26:34narimiranOrderedSet?
18:30:13skarutsdoesn't the seq move the last element to the empty place?
18:30:24narimiranskaruts: `del` vs `delete`
18:32:15skarutshmm
18:32:42skarutsoh, I never knew that
18:32:50skarutsdelete keeps the order
18:32:57skarutsthanks
18:40:38artemis_covendoes cross compilation work from arm host architecture/
18:41:04artemis_covenI'm trying the cross-compilation listed in the docs and telling it to generate an amd64 binary, and its just generated an arm binary instead
18:41:33Cadeydo you have an amd64 gcc toolchain installed?
18:41:37artemis_covenyeah
18:42:51artemis_covenmaybe I need to manually configure the paths for the amd64 toolchain or something
18:45:59artemis_covenyeah that did it
18:46:05dom96Hope you guys tested both Nim and Nimble in the release this time :)
18:46:19narimirandom96: :P
18:50:52dom96Nice to see a tweet as well
18:51:07dom96I think a separate forum thread is warranted for these releases, no need to bump the thread I created
18:51:16dom96but *shrug*
18:51:32Araqit's ok this way, it's only a bugfix release
18:53:49*altarrel quit (Quit: ZNC 1.6.5+deb1+deb9u2 - http://znc.in)
19:01:03rayman22201Sooo.... @Dom96 and @Araq, @Zevv just convinced me that having a timeout int Poll is really broken
19:04:09dom96Really? Strange that both POSIX and the WinAPI offer this timeout argument then, no? :)
19:04:59rayman22201those aren't async apis. any good sync api has a timeout, what does that have to do with async?
19:05:44rayman22201comparing to the chronos implementation. Chronos does not accept a timeout
19:06:17rayman22201It finds the lowest timer value, or if there are no timers, waits forever (until signaled).
19:07:53rayman22201which is correct. That is how it has to be, otherwise, you either spin the async event loop too much burning your cpu cycles, or you wait too long, having bad performance.
19:08:32rayman22201The current stdlib impl, defaults to waking up twice a second no matter what. This is not a great implemenation.
19:09:32*altarrel joined #nim
19:10:34*absolutejam quit (Ping timeout: 258 seconds)
19:10:54dom96The current stdlib implementation doesn't assume that you're happy to give complete control to the async event loop.
19:10:56rayman22201Looking at it another way, it would be impossible to implement the uniqueID asyncEvent trick we talked about in Chronos. It would deadlock. The same thread cannot both read and write to the same pipe, because it will block forever on the read, and never get a chance to do the write.
19:11:50dom96If this makes a real practical difference in benchmarks then I'll listen to you, but until then it's a small implementation detail
19:11:51rayman22201the trick will work in the stdlib, but only because of these "forced wakeups", which forces progress to be made.
19:12:32rayman22201Well, at the very least it is a huge design difference between Chronos and the stdlib, leading to even more fragmentation (which you are against.)
19:12:52*altarrel quit (Client Quit)
19:13:02*altarrel joined #nim
19:14:01dom96I don't see how these "forced wakeups" make a difference
19:14:08rayman22201At worst, it has bad efficiency issues. Especially on mobile. (@Zevv firmly believes this. Also Status made this decision very conciously, and they are smart people who want nim to target mobile... They care about this stuff. why would they do it otherwise?)
19:14:20dom96If you call `runForever` (which most apps do) you will be running `while true: poll(500)`
19:14:44rayman22201Think about a phone. Phones go into a low power mode. If they have to wake up every 500ms, it will kill your battery.
19:14:57dom96so increase the timeout?
19:15:07dom96Nothing stops you from passing -1 to the `poll`
19:15:14dom96which means "infinite"
19:15:44rayman22201True. But it is not the default. and defaults are important
19:15:48*absolutejam joined #nim
19:15:54*altarrel quit (Client Quit)
19:16:33dom96Changing it in `runForever` and `waitFor` should be safe
19:16:57rayman22201Also, back to the asyncEvent thing. If we implemented your suggestion and somebody sets the timeout to -1, asyncEvents will suddenly not work anymore.
19:17:09dom96Why not?
19:17:21dom96The master async event will get triggered and things will work
19:17:38rayman22201because of the deadlock I described. No. It will block forever on the read and never do the write to trigger the wakeup.
19:18:01Araqdon't ask me, I believe in polling moreso than everybody else
19:18:18rayman22201If the same thread is holding both ends of the pipe, it cannot both wait forever on a read, and do a write.
19:18:23Araqit's the only thing that really works and composes well with all the other stuff
19:18:40dom96You keep saying `pipe` and I don't understand why, do you mean a conceptual pipe?
19:18:46dom96My solution doesn't involve any actual pipes
19:19:21rayman22201yes. I mean conceptually. a select() call followed by a trigger.
19:19:25dom96But I think I get what you mean
19:19:33*altarrel joined #nim
19:19:43Araqso ... I'm about to stream
19:19:50rayman22201I'm from the unix world, so pipes are familiar to me, but any trigger mechanism, IOCP, whatever.
19:20:01dom96Araq, how does the flowvar signal proc get scheduled?
19:20:23Araqit's based on a "condition variable", the OS does the scheduling
19:20:47dom96so if my thread is blocked on a select() call it will still get scheduled by the OS?
19:20:49rayman22201doesn't matter what flowvar does. If the main thread is doing `select(asyncEventFd, -1)` it will wait forever.
19:21:01dom96perhaps it will use some signal to break way from the select call?
19:21:14rayman22201that signal has to be in another thread.
19:21:23dom96I feel like you're being a little intentionally distrustful, I am just trying to help I hope you know
19:21:54rayman22201no! not at all. I'm sorry I'm coming off confrontational! I'm just excited and caffeinated. :-)
19:22:04rayman22201I think it's an interesting problem.
19:22:17Araqdom96, if select blocks the full thread is blocked
19:22:30Araqthe OS can only schedule other threads to run
19:22:56dom96Araq, but how does this work? Presumably a thread is always doing /something/
19:23:10dom96The OS must tell it "pause for a second and go into this signal proc"
19:23:38Araqwell the 'signal' wakes up the other thread that waited for this signal
19:23:51AraqI'm not sure I understand your question
19:24:16dom96Argh.
19:24:28Araqsignal is paired with 'wait' aka 'blockUntil'
19:24:54dom96but we don't `wait` in the examples that we ran on the stream
19:25:14dom96we just have the main thread calling select() all the time
19:25:16Araqwell but '^' does
19:25:21dom96yes, but we don't use that
19:25:31rayman22201we do. the read wraps '^'
19:25:34Araqwe did use the roof in the callback, didn't we?
19:25:38rayman22201yup
19:25:40dom96We do, but only after the FlowVar completes
19:25:48dom96The signal proc gets called before we call ^
19:26:09rayman22201Right, this works because of the spurious `500ms` wakeups
19:26:13rayman22201not because of flowvar
19:26:19Araqhmmm, maybe
19:26:21dom96Are you sure?
19:26:28dom96Can you try it with -1 real quick?
19:26:40rayman22201good idea. I will test it
19:26:40dom96Even if that is the case, after the 500ms wake we call select() immediately after
19:26:50dom96there is no "threadpool.canYouPleaseCheckForCompletions()"
19:27:11*altarrel left #nim ("Leaving")
19:27:18dom96Araq, Do you understand my dillemma?
19:27:27*altarrel joined #nim
19:27:30dom96How can this `signal` proc be called in the main thread?
19:27:49dom96How can the OS schedule it _out-of-order_ (that's possibly the wrong term)
19:28:11*altarrel quit (Quit: ZNC 1.6.5+deb1+deb9u2 - http://znc.in)
19:31:22Araqkind of, maybe
19:31:48AraqI'm about to stream, today's topic: detect unused imports
19:32:20dom96cool
19:33:37Zevvi still do not understand what all the confusion is about :/
19:33:53Zevvi'm just waiting for the dust to settle
19:34:02AraqZevv, that means you should answer the questions
19:34:16dom96Yes, please explain your point of view
19:34:56Zevvim on the road on mobile
19:35:04Zevvbut i'll get back, sure
19:35:23*altarrel joined #nim
19:35:55disrupteki think the reason you're using a fd is so select can trigger on it. that's something the os does for you.
19:36:07disrupteknot sure what else you are missing, tbh.
19:36:20Araqhttps://www.twitch.tv/araq4k
19:43:01*nsf quit (Quit: WeeChat 2.4)
19:48:21shashlickIf I copyMem a string I'm not really copying the contents right? Just a pointer to the contents?
19:48:30shashlickHow about cstring?
19:49:21dom96shashlick, depends how you pass it into copyMem
19:53:47Calinouis it just me or execProcess()' signature has changed twice recently?
19:53:57Calinouit seems to expect a workingDir argument again, while I specifically removed it last month
19:54:07Calinouhttps://github.com/Calinou/godot-size-benchmarks/commit/6dc999f14625936110cd980448d04515d512ff1c, that is
19:54:48Calinouyeah, it builds if I revert it. I'm using Nim 0.20.0
19:54:56*yeetcannon quit (Remote host closed the connection)
19:55:38*yeetcannon joined #nim
19:57:05leorize[m]there was a change to make `execProcess` have a similar signature with the rest of osproc iirc
19:58:56CalinouI see, it's a welcome change anyway, I'm just surprised it changed twice between two releases
20:01:38leorize[m]and it should still accept workingDir
20:01:50leorize[m]just that it's now in a different position
20:02:02rayman22201@Zevv, @Dom96, I'm totally confused now. Poll(-1) still works... but I don't understand how.
20:02:10dom96hehe
20:02:25rayman22201It is way more efficient to use Poll(-1) though :-P
20:02:31rayman22201no spurious wakeups
20:02:48rayman22201I don't understand how though
20:02:48dom96Probably. But I'm skeptical about "way more"
20:03:15*narimiran quit (Remote host closed the connection)
20:03:51rayman22201I guess it depends on your use-case. It does make me think that waitFor and runForever should accept optional timeout values though.
20:04:07rayman22201I can definitely see how it would affect mobile
20:04:34disrupteksounds like it's a bug that it works.
20:04:36rayman22201that's a bikeshed though... I really want to understand how this works. It's blowing my mind lol
20:04:46leorize[m]looks like there's still code for idetools in the compiler
20:04:50leorize[m]not sure if they're still used or just dead code
20:08:43dom96rayman22201, my guess: the OS interrupts the select(), then runs the `signal` function, or vice versa
20:08:55*jjido joined #nim
20:08:55dom96Add some echos around the place and you should find out
20:09:01dom96It is very interesting
20:09:24dom96But yes, whether we run poll with -1 or not is totally orthogonal. I'm glad we established this :)
20:11:36Zevvrayman22201: so, which part is not clear then?
20:12:47rayman22201what Dom said. "The OS interrupts the select(), and runs the signal function". In this case the signal function is a semaphore from the threadpool (I think?)
20:12:58Zevvright
20:13:23dom96Do you know how the scheduling of this `signal` function is performed Zevv ?
20:13:42disrupteki think it's more like the os allows select to unblock and tells it what, if any, fds are selected.
20:14:14dom96disruptek, that's how select normally works.
20:14:19Zevvshall we go practical, let's make a little nim snippet doing that and discuss how it works
20:14:43disruptekoddly, a -1 to select isn't working that way, right? due to something weird with nim's poll?
20:15:01dom96disruptek, it does, what gave you that idea?
20:15:20rayman22201I did not think that two different blocking primitives could interact in this way. I always assumed that the OS will only let you block on type of thing. You are saying that I can have a thread block on both a select and a semaphore, and get signals from both (with separate entry points back into my program)
20:15:23disruptekoh, i thought ray said a -1 was still unblocking.
20:15:57rayman22201no -1 blocks, the stdlib just doesn't use it by default :-)
20:16:07disrupteki'm not sure what these signals are you're speaking of, but i only just started paying attention.
20:16:13disruptekoh, okay.
20:16:53rayman22201I don't see how you can block on both a semaphore and a select at the same time.
20:17:07Zevvrayman22201: a poll (epoll,select,poll) system call returns in 3 cases: one of it's watched file descriptors has an event, the timeout occurs, or a the process receives a unix signal
20:17:23Zevvso, you *can not* block on a wait condition and on a poll at the same time
20:17:32Zevvthat is the whole essence of the problem we are solving here
20:17:59disruptektechnically, you could have one side block on the semaphore and one on the select; that's a deadlock. ;-)
20:17:59Zevvso there is a trick needed: the poll is doing its normal poll business, but it needs to be woken up when there is other work to do that it can not know of
20:18:02dom96Indeed, which is why I'm predicting that the process receives a unix signal when the `spawn`ed procedure finishes
20:18:04rayman22201exactly. This is why I don't understand how it is working in my sample program?
20:18:16disruptekcan we see the sample?
20:18:32dom96Zevv, you seem to be implying that this trick needs to be implemented, it appears to already be in place
20:18:46rayman22201I think what @Dom96 is saying must be true. the semaphore must send a unix signal (or windows equivalent on windows)
20:18:57rayman22201hold on. I will share the sample
20:19:16Zevvpart of my confusion: are we talking about the new synchronization mechinism that was just made a few days ago?
20:19:36dom96Zevv, which mechanism is that? Your PR?
20:19:52rayman22201http://ix.io/1OLc
20:20:08rayman22201I'm using the version of spawn that we created on the livestream
20:20:24Zevvrayman22201: that was the asyncFlowVar branch?
20:20:28rayman22201yes
20:20:40Zevvdom96: that one
20:22:04disruptekyou spawn a thread and the other one is polling. are you saying the poll isn't running? is returning? what?
20:22:10dom96Yes, we are talking about that. Specifically: the only way that sample can work is if the FlowVar is signalled by the OS somehow.
20:22:31dom96(And the signalling happens in the same thread that is blocked on `poll`)
20:22:54Zevvthat is the 'pipe' we are talking about
20:23:22Zevvthe thread that reads from stdin writes into the pipe
20:23:30Zevvthe other end of the pipe is watched in the poll set
20:23:37dom96Huh?
20:23:39Zevvso there is data availabe, poll wakes up and voila
20:23:47dom96Is this what you're proposing we implement or how threadpool currently works?
20:23:55Zevvthat is how it now works
20:24:09Zevvand there is nothing wrong with that!
20:24:23rayman22201no it's not. The spawned thread never gets the other end of the pipe
20:24:30Zevvpfff,
20:24:31Zevvwait
20:24:32dom96I need evidence of this
20:24:44dom96Do you have links that show this "pipe" being added to the set of FDs watched by epoll?
20:24:45ZevvI will prepare, give me one minute
20:25:01Zevvwait
20:25:04Zevvi'm typing
20:25:59rayman22201"the other end of the pipe is watched by the poll set." where? There is no code for this.
20:26:05Zevvthere *IS*
20:26:06Zevvwait
20:26:50rayman22201I can make another example with no IO
20:30:32Zevvhttp://ix.io/1OLg
20:30:39Zevvand there it is
20:32:23Zevvin the nim libs the path is newAsyncEvent -> newSelectEvent(creates eventfd) -> registerEvent(puts it in the epoll set) -> trigger(sends data)
20:33:11dom96This is code that rayman added I'm pretty sure
20:33:40dom96This doesn't answer my question :(
20:33:54Zevvthis code has been there since jul 5 2016
20:34:03dom96can you show me the code?
20:34:38Zevvsure: lib/pure/ioselects/ioselectors_epoll.nim
20:34:45ZevvnewSelectEvent(), trigger(), etc
20:35:14dom96That's the API
20:35:18dom96What calls these functions?
20:35:45rayman22201@Zevv the trigger gets called from the main thread
20:35:45Zevvthat is the new rayman code, commit 7fac17e
20:35:51dom96precisely
20:36:08dom96This doesn't explain how `trigger` gets called
20:36:14Zevvno rayman, check the pid of my strace output where the write(3, ...) happens
20:36:29ZevvnimFlowVarSignal() does the trigger
20:36:37rayman22201right
20:36:58Zevvthat used to only signal the waitcondition/semaphore
20:37:12Zevvbut it now also triggers the pipe to the receiving thread
20:37:31dom96yes, what calls nimFlowVarSignal?
20:37:56Zevvmagic
20:38:01*dom96 leaves
20:38:12Zevvreally, its in compiler/
20:38:15Zevvso that's offlimits for mortals
20:39:06Zevvjoking aside, does this all make sense rayman22201?
20:39:25rayman22201I found the magic. @Zevv is right: https://github.com/nim-lang/Nim/blob/9db369063c4d14d775015df8f7490d23603827f3/compiler/spawn.nim#L107
20:39:53rayman22201My faith in my understanding of Operating System scheduling is restored.
20:40:04*abm joined #nim
20:40:10Zevvdom96 is now gone, I guess we should proceed some other time
20:40:18dom96I'm not really gone :)
20:40:21Zevv:)
20:40:26Zevvso, dom96 also with me?
20:40:31Zevvdoes it all make sense still?
20:40:57dom96I'm frustrated.
20:41:21Zevvyou'll get over it :)
20:41:33dom96Your explanation doesn't explain anything I didn't already know
20:41:43Zevvno, but for rayman22201 it did I hope
20:41:50rayman22201yes, it helped me
20:42:06Zevvok, now back: what are we still confused about?
20:42:23Zevvbecause there was a lot of confusion going on all the time :)
20:42:30rayman22201I thought `nimFlowVarSignal` was called in the main thread (partially because Dom told me this was the case.) That is not true.
20:42:41dom96what
20:42:58rayman22201It may have been my misunderstanding of what you said.
20:43:08dom96No, it is called in the main thread
20:43:12dom96there is no other way it can work
20:43:14rayman22201It is not.
20:43:16Zevvit is not
20:43:19Zevvcheck the strace
20:43:32Zevvit is not supposed to - the main thread is doing the epoll()!
20:43:33rayman22201you don't need the trace, just look at the code I just linked
20:44:30Zevvthe main thread does not know if the worker thread is done, it is autistically waiting for file descriptors and can do nothing else
20:44:49Zevvso the eventfd() file descriptor is just a way to call BOOO so it wakes up
20:46:15disruptekyes.
20:47:20dom96This shouldn't be possible
20:47:31dom96Because each thread has its own heap
20:47:36dom96The AsyncEvent is allocated on the main thread
20:47:36*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:47:41disrupteklife would be pretty difficult without the os helping us out here.
20:47:51dom96so how can the other thread access it?
20:47:57dom96That is what I based my assumptions on
20:48:04disruptekaccess what?
20:48:38rayman22201threads can access other threads heaps, it's just not safe.
20:49:15rayman22201we get lucky because there is no way the GC will collect the asyncEvent because the thread is stuck waiting on the read. It can't GC and wait on the select at the same time.
20:49:22Zevvyes, but the trigger is sent through a file descriptor, which is perfectly safe to do
20:49:41FromGitter<kaushalmodi> does anyone use the `comprehension` package?
20:49:42dom96yes, but a ref object stores the fd, which isn't safe
20:49:59disruptekit doesn't need to share it, though.
20:50:02rayman22201what @Dom96 is saying is that in order to know what fd to trigger on, it has to read the fd from the other thread.
20:50:02dom96but yes, you're likely right, we get lucky here and this works
20:50:11FromGitter<kaushalmodi> I am trying to translate this snippet from `lc` to `comprehension.comp`: https://play.nim-lang.org/#ix=1OLo
20:50:15dom96I expected the compiler to complain about this access
20:50:17disruptekno, they have identical information.
20:50:19dom96if it was cross-thread
20:50:27disrupteknot that it matters.
20:50:28rayman22201The annoying part is that it is hard to see because of all the compiler magic going on. the `wrapSpawnProc` that does this is part of a freaking compiler rewrite pass
20:50:34dom96since it complains about GC-safety nearly constantly
20:50:56rayman22201all of that is bypassed because of the compiler magic... lol
20:51:17rayman22201https://github.com/nim-lang/Nim/blob/58e0dad3712d4e423fd26bd91b26b8a31a85bf33/compiler/ccgexprs.nim#L2250
20:52:02Araqtold you to use yuri's threadpool
20:52:09AraqI dunno why you don't listen
20:52:15Zevvhehe
20:52:23dom96because you didn't explain why
20:52:25dom96you just said "use it"
20:52:32Zevvits not in the stdlib. And we can't just try out random nibmles and hope they are the right ones
20:53:30rayman22201especially when the whole point of this exercise is to make the stdlib better... (not that yuri is random. but still)
20:54:38FromGitter<awr1> has there been any talk of a work-stealing pool for nim
20:54:49rayman22201Yuri's pool does that
20:54:52FromGitter<awr1> or is that too hard b/c of the per-thread heap model
20:55:13*Vladar quit (Remote host closed the connection)
20:55:24rayman22201well, depends on how the data.
20:55:27rayman22201https://github.com/yglukhov/threadpools
20:55:38FromGitter<kayabaNerve> Errors? I'd like to complain about how IndexErrors aren't tracked by raises.
20:57:35FromGitter<kayabaNerve> Or really, I'd like to know why so I know not to complain.
20:58:07Araqread the spec, there are no IndexError
20:58:14FromGitter<awr1> i remember reading a paper a while back on implementing work-stealing using a deque structure and atomic CAS
20:58:32Araqyou can't catch IndexErrors, instead fix your code
20:58:59rayman22201so, what is the conclusion here? @Zevv, @Dom96? Are we all on the same page about how flowVars are working in this model? What is the next step?
20:59:06FromGitter<kayabaNerve> I use the term complain a lot, and sure, they're complaints, but I believe they're purposeful
20:59:29FromGitter<kayabaNerve> Araq: You can.
20:59:44FromGitter<kayabaNerve> ... or at least I'm pretty sure I have before
20:59:53FromGitter<kayabaNerve> Let me check the playground. I'm on my phone right now
21:00:32Zevvafaik: the current setup works just fine, the pipe mechanism is proved technology. The only *but* is that it eats fds for breakfast, thus the other adventure with reusing the same fd for different event
21:01:01rayman22201Dom's trick will still work in this model.
21:03:30FromGitter<kayabaNerve> https://ibb.co/qYGhwvm
21:03:50FromGitter<kayabaNerve> You can catch IndexErrors thrown by invalid seq accesses.
21:04:30FromGitter<kayabaNerve> And that site doesn't work well on mobile at all
21:04:40rayman22201the big issue is that FlowVar is taking advantage of an unexpected interaction between select, the GC, and threads. It's only safe because the main thread is essentially frozen on the select, so we can read and write the memory from another thread safely (to get the fd). It's a big hack...
21:04:44FromGitter<kayabaNerve> Well. It works poorly
21:04:45Araqwell you can't, why? because the spec says so.
21:04:54FromGitter<kayabaNerve> Kept deleting what I typed
21:05:01Araqthe implementation doesn't follow the spec.
21:06:10FromGitter<kayabaNerve> So. IndexErrors are real things not tracked by raises yet catchable.
21:06:28disruptekrayman22201: why can't both parties simply agree on what the fd will be?
21:06:49Araqthey are not catchable with -d:danger
21:07:14dom96rayman22201, yeah, this is problematic, I bet it hides some big problems
21:11:40rayman22201@dom96, we can just put a lock around asyncEvent. boom it's safe now :-)
21:12:16dom96I'm not so sure
21:12:21dom96the problem is that the other thread owns the memory
21:12:22rayman22201@disruptek, you can't know in advance what fd you will get. It's whatever the OS decides to give you.
21:12:29dom96it could deallocate it from under us
21:12:33Zevvit's global
21:12:42Zevvbecasue it is in the async part, not in the selector
21:13:02rayman22201It will live as long as the asyncDispatcher lives. exactly
21:13:02Zevvand it exists before any other threads spawn, so putting a lock on it should be fine
21:13:11Zevv(which, i have been told, is in the book of famous last words)
21:13:41rayman22201lol
21:14:00dom96Well, I'll let Araq decide this
21:14:22disruptekit's not even an issue.
21:14:22Zevvbut I must now leave this discussion - a decade ago I made a resolution never to use shared memory and mutexes ever again in my life because these make up a large fraction of things I regret in my career
21:15:18ZevvAraq will tell us to use some other threading lib - we might as well move to chronos while we're doing that and let Status do all maintainance for us
21:15:36disrupteksounds good to me.
21:16:00rayman22201@Araq is telling us to use Yuri's threading lib and Status is telling us to use Chronos for async.... what hope does the stdlib have :/
21:16:23disruptekthis is kinda how a quality stdlib gets built.
21:16:25*shomodj joined #nim
21:16:37Zevv^^^
21:16:46Araq^ exactly.
21:17:18rayman22201Ok. so we should stop working on all of this and instead rip out the current implementations and replace them with these other implementations?
21:18:12disruptekonly if you want experts to provide and support a quality contributions.
21:18:21Araqyeah. eventually. But I see this an experiment, you are learning how this thing needs to be setup
21:18:38Araqthat's what I told you to not focus on the PR
21:18:45Araq*why
21:19:16rayman22201Ok. Well in that case. experiment complete. But I want to contribute to the community and right now I just feel like I'm spinning my wheels.
21:19:31Araqhow so? how is it complete?
21:19:45Araqare we sure gcsafety is not violated?
21:19:46disruptekthat's silly, you're one of a dozen people closest to understanding this critical piece of infra.
21:20:15rayman22201a piece of infra that you just said that you want removed.
21:20:28Araqlook, Python's async implementation is probably it's 3rd implementation
21:20:48disruptekif chronos is a superior product, sure, it could be a good upgrade if it also meets the needs of nim's stdlib.
21:21:05disruptekbut it's hard to know what it buys you when you don't even understand the problems it solves.
21:21:11Araqwe don't throw the stdlib's async away. But at the same time it's not for forever either.
21:21:54*shomodj_ joined #nim
21:22:16Araqand the threadpool is simply in a poor shape, but even if it weren't, you complain in #nim how it's built with compiler magic
21:22:23Araqso that it is hard to understand.
21:22:39Araqwhich is correct, so use something more hackable for the experiment
21:23:02rayman22201the problem is, at that point, I'm making a PR for Yuri's threadpool, not the stdlib threadpool.
21:23:42disruptekand that's bad why? ;-)
21:23:50Zevvrayman22201: my conclusion is that we simply are on the right track. people had different assumptions about inner workings, causing a lot of confusion. THat is resolved, and we basically know the next step. Lets just make that implementation and see what starts smoking first when we push it hard
21:24:23Araqpatch yuri's threadpool, submit it as a PR
21:24:31Araqto Nim's repo
21:24:51Araqwrite tests, no question will be asked and I'll throw away my code
21:24:55*shomodj quit (Ping timeout: 246 seconds)
21:24:59Zevvrayman22201: there is no problem here - put a lock over the thing and it should be just fine.
21:25:14disruptekbut you won't need the lock. ;-)
21:25:17*absolutejam quit (Ping timeout: 268 seconds)
21:25:51Zevvright :) Anyway, I'm glad we are now all talking about the same thing, and I'm off for my daily downtime.
21:26:10rayman22201@Zevv, thanks again. enjoy your downtime
21:26:15Araqso once more: threadpool can be replaced with yuri's implementation
21:26:18*Zevv poll(NULL, 8*60*60)
21:26:36rayman22201@Araq that seems like the PR I should be doing
21:26:39rayman22201apparently
21:26:45Araqbut we won't throw away asnc as easily
21:27:09Araqasync is battle-tested, yeah it bugs, it's a complexe piece of infrastructure
21:27:11rayman22201by making stdlib async work with spawn we are making it more likely for people to use spawn, so we need a good spawn.
21:27:50rayman22201I've just been forever frustrated by the stdlib async vs. chronos async split for a long time
21:28:14*absolutejam joined #nim
21:28:31rayman22201I don't really care who wins. they are both performant, and both battle tested....
21:28:55rayman22201but for the end user, it's just confusing, and annoying.
21:29:18Araqwell currently chronos is winning, it supports 'cancel', was built after the stdlib's async
21:29:58Araqso it learned lots of lessons.
21:30:29rayman22201chronos also already has working async locks and async streams (and soon channels apparently). So it's more feature complete.
21:30:53Araqit's like complaining about too much candy, man
21:31:01rayman22201It makes me think, why waste time with the stdlib async?
21:31:55*solitudesf quit (Ping timeout: 246 seconds)
21:32:04Araqok, how about this: what do you think we should do?
21:32:04rayman22201but less experienced programmers will pick the stdlib async, and have a worse experience b/c they will use what is included....
21:32:28rayman22201Chronos should be the stdlib async.
21:32:36Araqyou know the context, the mystical voices whispering 'v1'
21:34:30Araqtoday we released the 2nd release candidate for v1. What to do next? throw away async. Doesn't look like a plan to me. :-)
21:36:12dom96rayman22201, imagine how I feel about the chronos split
21:36:26rayman22201I understand the constraint here. I just think it looks bad that 'v1' is going to ship with an obviously inferior set of features...
21:37:25dom96If you want to help, please port these features to the stdlib async
21:37:28Araqwell "obviously inferior". I never used chronos and I did use async (believe it or not)
21:37:47dom96"obviously inferior" sounds pretty harsh
21:38:13rayman22201ok, particularly in the case of async vs. chronos that is a bit harsh. They are neck and neck really.
21:39:05dom96They probably aren't, but one is being developed by a set of employees being paid a full-time wage to work on it
21:39:13Araqlet me say it differently: replacing spawn by a better or even a simpler one is welcome and could make it into v1
21:39:14rayman22201I don't know if "port these features to async" is the right answer either. We will always being playing catchup that way.
21:39:25rayman22201exactly @Dom96, it makes more sense to take advantage of that
21:39:41Araqand making async work with the threadpool is obviously very useful
21:40:03Araqand we cannot abandon async either. So you're helping Nim's core.
21:40:24dom96Sorry but this simply isn't going to happen for v1, it's too much breakage
21:40:37*ng0 joined #nim
21:40:44rayman22201I did not mean to assume v1.
21:41:02rayman22201but my understanding is that there is no roadmap to this at all, even for v2.
21:41:14rayman22201for v1, it's too late. I get that.
21:41:30rayman22201and I hear you loud and clear about threadpool @Araq.
21:42:29dom96I would prefer we revamp async completely for v2
21:42:54dom96In particular to make it heap-free
21:43:04dom96no idea if that's even possible of course, but it's worth a try
21:43:27dom96chronos is so similar to stdlib async that it's a shame to switch to it and deal with the random breakages that were introduced
21:43:38rayman22201I strongly believe that we should adopt chronos for v2. They are paying a team to work on that full time. How can we ever compete with that?
21:43:47rayman22201or why would we want to?
21:44:21dom96Just because they are paid now doesn't mean they will be forever
21:44:41Araqsure, but it's open source
21:47:56dom96Well, I'll admit, I'm very biased here so you'll have a super hard time convincing me.
21:48:17dom961.0 isn't even out yet, let's see what happens
21:48:20Araqbut you're right, why would we want to compete with them. We should maintain what we have to keep up the trust people have in Nim. I can write a better strutils tomorrow
21:48:44Araqnow what? should we remove strutils from Nim and replace it with the "better" version?
21:49:11rayman22201That is essentially what you do today?
21:49:23Araqwhat?
21:49:24rayman22201see all the regex libs in the stdlib
21:49:36disruptekthose are additative.
21:49:40Araqwell the number is two.
21:49:49Araqthere is also a wrapper
21:49:57rayman22201they aren't really additive, they each have different feature sets
21:49:58Araqthe wrapper doesn't count
21:50:25disruptekthe point is, none of them got taken out behind the woodshed and tol' to put their head down.
21:50:25dom96btw, I have absolutely no idea why you'd ever need async locks
21:50:46Araqwell I wrote re.nim, people complained, contributed nre, we decided to adopt nre and deprecate re
21:50:52rayman22201you need it for when you have threads mixed with your async @dom96 :-)
21:50:59Araqthen we figured we like re.nim better and now we have both
21:51:08rayman22201instead of blocking on a lock you can do another async task.
21:51:30Araqand also all my code uses re.nim and I am not happy to rewrite it
21:51:43disruptekand why should you be?
21:52:04Araqsame with async, you think everybody is happy to constantly update their code.
21:52:09disrupteksoftware is hard enough to write once, why do we need to write it twice?
21:52:32dom96rayman22201, true, I'm too much in the heap-per-thread mindset now. Nim changed me :P
21:53:00Araqbut that's not true, it's tiresome to do this. especially when the development process is longer than a decade
21:53:08rayman22201but this is the argument for adopting Chronos? why rewrite all those features for the stdlib async when you can just use the already written versions?
21:53:14dom96I still think that is a good threading model, especially for servers which typically serve thousands of requests with no state shared between requests
21:53:27dom96(the state can just be looked up in a DB)
21:54:01dom96btw regarding regex, we can take another example, there is a Nimble package which implements native regex in Nim
21:54:09disruptekthe argument for adopting chronos is to put those closest to the solution and most heavily invested in it, in charge of the implementation.
21:54:11rayman22201lol. sure. you are passing the problem to the DB. (DB's are really good at this though.)
21:54:12dom96Should we just replace the current stdlib regex modules with that package?
21:54:15dom96I don't think so
21:54:50disruptekdon't conflate replace with adopt.
21:55:32Araqfor v2 it's a perfectly fine outcome to say "async is in maintainance mode, old code keeps working, new code should seriously consider chronos"
21:57:04rayman22201That's practical. I respect that decision.
21:57:38Araqit's one possible outcome, I haven't QA'ed chronos btw
21:58:22rayman22201If that happens, It makes me (and maybe others) not want to contribute to stdlib async though. Just contribute to chronos instead...
21:58:37disruptektry to imagine a world in which you're glad that you can rely on a package X being present and working in your stdlib. that doesn't happen overnight, but it has to start somewhere.
21:59:20Araqlook at Python, its stdlib has plenty of packages that were crappy compared to what Python's community came up with
21:59:40rayman22201@disruptek I agree with you. that is why I am arguing the way I am. I am trying to make the async I want to see in the world. lol
22:00:08Araqthat's simply how it works. Yet Python is better off with keeping its stdlib
22:00:10AlexMaxhttps://paste.ee/p/nvAT4
22:00:17AlexMaxIs this an intended output of finish.exe?
22:00:22rayman22201@Araq, you are correct. In a way it's one of the down sides of the "batteries included" approach to a std lib.
22:00:54*elrood quit (Remote host closed the connection)
22:01:12rayman22201AlexMax: no it is not. You may have missed a step? do you have mingw installed?
22:01:23AraqAlexMax, is that with 0.20.2?
22:01:43dom96rayman22201, the async in the stdlib is pretty freaking awesome, please don't be discouraged from contributing to it
22:03:08AlexMaxYes
22:03:13AlexMaxYes that's with 0.20.2
22:03:29dom96rayman22201, also, by now I bet it has features which chronos doesn't have
22:03:33Araqat least that's not a regression
22:03:52AraqAlexMax, do you have C:\Program Files\mingw-w64 but not C:\Program Files\mingw-w64\bin ?
22:03:54dom96rayman22201, the biggest of which: it's supported by practically all nimble packages
22:04:00AlexMaxI do have a directory called mingw-w64 but it is empty
22:04:14Araqok, well remove this directory
22:04:14AlexMaxpossibly from uninstalling mingw-w64
22:04:21rayman22201lol. @dom96, that is a very good argument for the stdlib async. I give you that.
22:04:22Araqbug will be fixed in the next release
22:04:48AlexMaxokay, working now, just thought it was worth bringing up
22:04:55Araq(we really need a expandFilename that doesn't raise exceptions ...)
22:05:06AlexMaxwould you like me to create an issue or do you have it?
22:05:23Araqan issue is nicer
22:05:39AlexMax10-4
22:05:41Araqbut I already fixed it, but now I have a ticket number
22:06:47Araqdom96, rayman22201 maybe most packages can work with both chronos and the stdlib
22:06:57AraqI don't know how incompatible it is
22:07:12AraqI mean, .async + await, how can you improve on that DSL?
22:07:21rayman22201The biggest thing is that they decided on a fairly different api for their Future type...
22:07:31dom96they seemed to have changed most of the API
22:08:17FromGitter<kayabaNerve> Araq: Sorry, I didn't get your messages. I thought I sent my image and all other messages without any in between. Thanks for the info. Have any documentation for the danger define?
22:08:31rayman22201it's annoying. The big ideas and patterns are similar, but the chronos api is different enough to make it a PITA
22:09:05disruptekif you don't remove existing async, nothing breaks. what's the problem?
22:09:39Araqdisruptek, package A uses stdlib, package B uses chronos and you want to use both in your program
22:10:09disruptekis there a symbol collision?
22:10:44dom96there is an event loop collision
22:10:52dom96it's less efficient
22:11:04dom96and you have to run two event loops at the same time and make sure they cooperate somehow
22:11:54disruptekhmm, there's your contribution, rayman22201 -- plugable async. ;-)
22:11:57AlexMaxAraq: Done, #11770
22:14:29FromGitter<mratsim> @awr1 if you want an efficient work-stealing threadpool, each thread should have a deque to steal from.
22:14:40FromGitter<mratsim> A global deque doesn't work
22:15:10FromGitter<mratsim> also threadpools with a single queue will just move the contention to the lock protecting that queue
22:15:31FromGitter<mratsim> iirc, libdispatch (from Apple Grand Central Dispatch) randomly picks the queue to add the task too
22:15:47FromGitter<awr1> yeah that was mentioned in the paper
22:15:52FromGitter<mratsim> or maybe it was Cilk
22:16:12Araqmratsim: we could never reproduce these contention points
22:16:12FromGitter<mratsim> you can also pick the one with the less tasks
22:16:32FromGitter<awr1> i remember going to a talk by one of the cilk devs at intel ages ago
22:16:45FromGitter<awr1> which is how i found out about workstealing
22:16:46Araqit always was in the noise. but ok, our benchmarking probably sucked
22:17:08Araqbut yeah, everybody else uses workstealing, it has won
22:17:46disrupteki think the issue is that it's hard to reproduce some of those troublesome workloads, but that doesn't mean you don't have to design around them.
22:17:49FromGitter<mratsim> Well, I'm looking into implementing some work-stealing threadpool for high performance computing, because OpenMP has some critical limitations that I will hit in a couple of months
22:18:10*abm quit (Ping timeout: 248 seconds)
22:18:47dom96btw I implemented prometheus recently with a nice async collector which allows you to see exactly which futures are pending in your program. It's an awesome way to diagnose async problems.
22:21:26FromGitter<mratsim> @awr1, I think this video is a nice recap on some of the challenges of a threadpool: https://youtu.be/zULU6Hhp42w?t=1695
22:25:46FromGitter<awr1> https://blog.molecular-matters.com/2015/08/24/job-system-2-0-lock-free-work-stealing-part-1-basics/
22:25:53FromGitter<awr1> i also remember reading this
22:25:56*darithorn joined #nim
22:27:23FromGitter<awr1> in a threadpool engine you can use a "global queue" but yeah like you say i'd hesitate to call it work stealing at that point, seems to me like it would cause too much contention
22:31:56FromGitter<awr1> i vaugely remember (and correct me if i'm wrong) in the deque structure you need to have one end for non-associated threads to "steal from" (as where are where incoming stolen jobs are pushed to), and that the other end is for the thread associated with the deque to pop and execute from
22:33:34FromGitter<awr1> and supposedly you can do this with just CAS and without heavier locks
22:34:41disruptekyou don't need strict deques.
22:35:05Araqimplement the "disruptor"
22:35:07disruptekgah, i cannot make nimteropt work at all.
22:35:28rayman22201@awr1 that looks really fun to implement :-)
22:43:56FromGitter<awr1> @disruptek you can use normal queues but i believe you would need to guard every queue with a lock
22:47:18FromGitter<mratsim> yes the thread takes task from one end and the thieves from the other
22:49:18FromGitter<mratsim> Then there are other considerations depending on the domain. For example, in high-performance computing, you want last in first out because the last in probably is depending on data hot in cache so it would be faster to process it, you wouldn't have to wait on memory
22:49:56FromGitter<mratsim> but in other cases you want fairer scheduling/optimize waits
22:50:08*darithorn left #nim ("Leaving")
22:52:49*ng0 quit (Quit: Alexa, when is the end of world?)
23:06:09shashlick@disruptek what are you trying
23:12:02*yeetcannon quit (Ping timeout: 248 seconds)
23:12:55*yeetcannon joined #nim
23:13:32*yeetcannon quit (Remote host closed the connection)
23:18:22*yeetcannon joined #nim
23:23:28*dddddd quit (Remote host closed the connection)
23:23:34*absolutejam quit (Ping timeout: 258 seconds)
23:38:51*shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:49:08*krux02_ joined #nim
23:51:35*krux02 quit (Ping timeout: 250 seconds)
23:55:43*smitop joined #nim