On Fri, Jan 11, 2019 at 3:10 PM Kyle Machulis <kmachu...@mozilla.com> wrote:
> On Fri, Jan 11, 2019 at 11:59 AM Bobby Holley <bobbyhol...@gmail.com> > wrote: > >> The idea is that we should gradually pass BasePrincipal around the >> codebase >> rather than nsIPrincipal, which would avoid the need to invoke Cast at the >> specific callsite. I have no objection to your proposed pattern in the >> interim if it results in simpler code, but I think we should aim higher >> for >> the desired end state. >> > > The problem for me here seems to be uneven approaches to end states across > the codebase, which is kinda of what I was wondering about in laying out > those tasks. With nsIPrincipal, I have a BasePrincipal concrete(ish) class > to work with. When I was adding infallible SchemeIs via %{C++%} blocks to > nsIURI, that was about the only choice I had because nsIURI could directly > be nsStandardURI, nsSimpleURI, etc... As we wanting to move toward more > Base* (if abstract) C++ classes as the top level of interface work in C++ > where possible? > I think the answer is "it depends". BasePrincipal makes a lot of sense for principals, because it allows for a lot of sharing among the subclasses, of which there are only four. URIs are more complicated, and probably deserve a dedicated conversation. So I think that a shared C++ superclass is a useful and ergonomic pattern. That's not quite the same as "we should switch to this pattern everywhere", because the tradeoffs vary. And we need to weigh the benefit of any cleanup-related engineering work against other priorities. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform