IMO, As* generally implies a cast between two different types for the same
underlying object, or at least a reflexive conversion between two different
"view" (for some fuzzy definition of that). Even in cases where we have two
objects with a 1-to-1 correspondence, As* feels inappropriate to me. For
example, both Document::AsRootElement or nsDocShell::AsOuterWindow seem
like misleading names given how the data structures are set up.

I'm assuming here that Aidin is dealing with two different objects. If not,
As* is clearly fine.

On Wed, Feb 10, 2016 at 10:02 PM, Kyle Huey <m...@kylehuey.com> wrote:

> What's wrong with AsWidgetEvent? We do AsFoo a fair bit.
>
> - Kyle
> On Feb 10, 2016 8:58 PM, "Aidin Gharibnavaz" <ai...@aidinhut.com> wrote:
>
> > In Bug 1235830 <https://bugzilla.mozilla.org/show_bug.cgi?id=1235830>,
> I'm
> > going to rename this method to something more meaningful. I need
> suggestion
> > about what the name should be.
> >
> > Summary of the discussion so far:
> >
> > * WidgetEvent() can't be used, since it's also the name of a type.
> > * GetWidgetEvent() is good, but may suggests that method can return
> > nullptr.
> > * AsWidgetEvent() don't have this ambiguousness, but is not a good name.
> >
> > Any other ideas?
> > _______________________________________________
> > 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
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to