Open benfrankel opened 4 months ago
This is really interesting, I hadn't considered using
trait as _
to avoid name collisions. At a glance this also works in preludes. For a future PR, could be nice to do this for extension style traits (e.g.,AppAssetExt
etc.) so the preludes aren't so heavy with names.
_Originally posted by @bushrat011899 in https://github.com/bevyengine/bevy/pull/16163#discussion_r1821705357_
I agree that use Trait as _
should be the standard in our code. I say even for normal use
, not just exports.
Extension traits can be re-exported without bringing their name into scope using underscore imports:
Users can still pull in the name if needed:
Benefits: