On Friday, May 27, 2022 at 7:45:18 PM UTC+2 Bobby Holley wrote:

> Hi Folks,
>
> We've long had two ways to specify SpiderMonkey rooting types in C++: via 
> the canonical definition (e.g., JS::Handle<JSObject*>) and the a set of 
> shortcut typedefs defined in TypeDecls.h (e.g., JS::HandleObject).
>
> Thus far we have relied on a loose cultural understanding of when and 
> where to use each variant, but this approach inevitably creates distracting 
> consistency problems, and is thus something we're moving away from. As the 
> C++ style owner, I would like to resolve this specific issue with 
> consistent guidance.
>
> I've spoken with a number of engineers, and the conversations lean in 
> favor of eliminating the typedefs, because:
> * They don't improve understandability or flexibility, and sometimes 
> hinder them.
> * Consistency around typedef availability and naming for more complex and 
> esoteric types is an ongoing headache.
> * Needing a separate header to access the typedefs is occasionally 
> cumbersome.
> * We don't shortcut other commonly-used handles like RefPtr and 
> already_AddRefed.
>
> I do think the typedefs improve readability to some degree, but that those 
> benefits are outweighed by the simplicity and consistency advantages of 
> eliminating them.
>
> Please let me know if there are important considerations that appear to 
> have been overlooked. Absent further discussion I plan to update the style 
> guide next week, and we can proceed with eliminating the typedefs from the 
> code as time permits.
>

Just for the sake of completeness, one could use C++14's `[[deprecated]]` 
keyword [1] here. Mentioning it, because it's currently rarely used in 
Gecko [2].

[1] https://en.cppreference.com/w/cpp/language/attributes/deprecated
[2] 
https://searchfox.org/mozilla-central/search?q=%5B%5Bdeprecated%5D%5D&path=&case=true&regexp=false

Mirko
 

>
> Thanks,
> Bobby
>

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/5aff66bd-3d42-41b3-9790-70dbf52aa744n%40mozilla.org.

Reply via email to