"I'm actually considering disabling this warning
by default, and developers can opt in if they like it."

That sounds good to me, Josh - I think it can be useful, but agree that at
the moment it is mostly 'noise' when I see it.

On Wed, Dec 11, 2024 at 6:52 AM Josh Tynjala <joshtynj...@bowlerhat.dev>
wrote:

> No, [this] is not correct. That places "this" into an array. Then, it tries
> to access the 'mapView' field on the array instead of on this.
>
> Unfortunately, there isn't always a good way to work around this warning.
> Sometimes, you can store the value in a local variable in the outer scope,
> and then use that variable instead of "this" within the closure. However,
> that's not always possible.
>
> We added this warning to the Royale compiler a few updates back, but it
> feels like cases where you want to use this in a local function are a bit
> more common than expected. I'm actually considering disabling this warning
> by default, and developers can opt in if they like it.
>
> --
> Josh Tynjala
> Bowler Hat LLC <https://bowlerhat.dev>
>
>
> On Tue, Dec 10, 2024 at 4:17 AM Maria Jose Esteve <mjest...@iest.com>
> wrote:
>
> > This warning appears many times. Some examples:
> >
> > "get": function():*{return this}
> > "get": function():* { return this._xmlArray[idx]; }
> > this.append(newValue);
> > (this['mapView'] as GoogleMapView).finishInitialization();
> >
> > Would simply "[this]" be correct? (I have tested it in
> "([this]['mapView']
> > as GoogleMapView).finishInitialization();": it produces no error and the
> > warning is gone)
> >
> > Thx.
> > Hiedra
> >
> >
>

Reply via email to