Rename "MOZ_TRY" macro to "try$", to mimic Rust naming convention.

RESOLVED WONTFIX

Status

()

Core
MFBT
RESOLVED WONTFIX
a year ago
a year ago

People

(Reporter: nbp, Assigned: nbp)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

The MOZ_TRY macro added as part of Bug 1283562 is replicating the Rust  try!  macro.

Rust macro are invoked/named with an exclamation mark (!) symbol as suffix, which is not a valid identifier.  Having such special character avoid ALL_CAPS macros, and also avoid having a MOZ_prefix for all our macros.

The dollar sign ($) is a valid macro identifier in MSVC, GCC, and Clang, and it is not a valid C++ symbol, nor identifier.  (Note, the dollar sign is likely on all developer keyboards: Shell, PHP, Perl, Ruby, etc…)

I think we could follow the same principle for some MOZ_* macros, by renaming MOZ_TRY(…) to try$(…), to follow Rust schema.

What do you think?
Flags: needinfo?(jwalden+bmo)
Flags: needinfo?(Ms2ger)
I don't think this adds enough value to be worth a deviation.  There's not significant value in avoiding ALL_CAPS or MOZ_.  We *want* macros to be visibly macro-ish, and we don't want potential conflicts.  People will have to understand it as having non-local control flow.  Saving a few characters and making it less visually distinct seems undesirable to me, in a world where
Status: NEW → RESOLVED
Last Resolved: a year ago
Flags: needinfo?(jwalden+bmo)
Resolution: --- → WONTFIX
Defer to Waldo.
Flags: needinfo?(Ms2ger)
You need to log in before you can comment on or make changes to this bug.