On Thu, Sep 7, 2017 at 5:07 AM, Emilio Cobos Álvarez <emi...@crisal.io>
wrote:

> Hi,
>
> I have a coding style question which I don't see addressed in the coding
> style page.
>
> Given there have been a few threads lately on coding style, I guess I
> should just ask.
>
> We have a lot of meaningless argument names in function declarations, like:
>
>   void DoFoo(Element& aElement);
>
> Or:
>
>   enum class Operation {
>      // ..
>   };
>
>   void DoBar(Operation aOperation);
>
> I personally think those argument names are mostly noise (the type gives
> you the same information), and C++ allows omitting them.
>
> That would make the signature more concise, like:
>
>   void DoBar(Operation);
>
> Which is helpful specially in long signatures.
>
> I don't see anything mentioned in the style guide about this, should it be?
>

I don't know if it rises to the level of something that should be in the
style guide, but I find the names very useful as a form of lightweight
documentation. Sure, if you are naming your Foo arguments aFoo the names
aren't useful, but for many widely used types like JSObject* and bool
knowing whether the argument is the global or something else is very useful.


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

Reply via email to