> On Dec 4, 2014, at 11:28 AM, Robert O'Callahan <[email protected]> wrote:
> 
> I think this would be a slight improvement but the place where I really want 
> out-parameters to be visible is at the caller, not the callee.

Agreed! The simplest way to achieve that in C++, though, is to use pointer 
arguments (so the ‘&' operator will generally get used at the callsite). The 
problem is that since pointers are overloaded and have several other uses 
besides out-params, the intention isn’t clear at the method definition. (And 
for longer methods, it can even be unclear in the implementation code.)

The ‘o’ prefix nicely complements the practice of using ‘&’ at the callsite, so 
we get clarity at the caller and the callee.

> I think that the cost of introducing this convention and dealing with the 
> inconsistency of it being incompletely applied across the codebase for the 
> foreseeable future probably outweighs the benefits.

Well, converting all existing code to use this convention overnight definitely 
wouldn’t be worth it. And just adding this to the style guide will give us very 
little benefit *right now*. But I think if we add this to the coding style 
guide and convert things gradually in a pragmatic fashion - when we write new 
code, when we touch old code that doesn’t use the convention, and perhaps when 
we encounter an unclear method definition in the course of our work - a year or 
two down the road it may be common enough that we get significant benefits from 
the change.

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

Reply via email to