On Thu, Apr 21, 2016 at 11:50 AM, Jim Blandy <jbla...@mozilla.com> wrote:
> The pattern seems reasonable enough.
>
> DXR says we have 2579 "init" or "Init" functions, and 9801 callers of such
> functions. I used:
>
> function:init ext:cpp ext:h
> callers:init ext:cpp ext:h

There are also some called "Initialize" :)

I'm not certain that all these functions are instances of this
pattern. But I'm also not certain that they aren't.

> Do you propose we make an effort to fix up existing code, or just introduce
> this as the preferred pattern in new code?

I'd start with the latter. I'd be happy if people converted existing
code, but it's probably not worth the effort of doing mass
conversions.

My motivation for this was that I've been thinking a lot about avoid
null-deref crashes, and using references more is one good way to do
that, and this pattern allows you to use references more as class
members. So it's more a case that I've seen our current use of Init
functions partially blocks that, and I want to clear that obstacle.
The fact that it has other benefits (easier use of |const|, generally
results in nicer code) was an unanticipated bonus :)

Nick
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to