Hi dev-platform@,

So, yesterday was working on a bug (bug 1362991, if you're curious) when
I decided to do some spring cleanup and pass some non-optional argument
as a reference instead of as a pointer.

I got the cleanup patch rejected, because it went against the prevailing
style of the codebase, and I was told that moving to references required
a discussion in dev-platform, resulting in something more explicit in
the style guide.

So, I'll revert that patch for now, but I'm sending this mail to
kickstart that discussion :)

TL;DR: I think references are useful. We have encoded nullability of
arguments and return values implicitly or explicitly in different ways:
assertions inside of the function, naming conventions...

I think references help to encode that a bit more in the type system,
and help reasoning about the code without having to look at the
implementation of the function you're calling into, or without having to
rely on the callers to know that you expect a non-null argument.

Personally, I don't think that the fact that they're not used as much as
they could/should is a good argument to prevent their usage, but I don't
know what's the general opinion on that.

Thanks for reading.

 -- Emilio

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to