You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2021/12/17 10:11:46 UTC

this within closures

The “this within closure” warnings are sometimes annoying.

Is there any way to suppress the warnings for specific functions without turning off the warnings for a whole project?

Thanks,
Harbs

Re: this within closures

Posted by Harbs <ha...@gmail.com>.
Not a huge deal. If you have a bit of time, I could really use some help figuring out why the sanitize branch is not working...

> On Dec 19, 2021, at 7:09 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> I wonder what % of the time this warning actually helps detect a problem.  The first (and only) example I looked at was in royale-asjs_js\frameworks\projects\Core\src\main\royale\org\apache\royale\utils\object\defineSimpleProperty.as where a manually defined get/set accessor has accessor functions (are they actually 'closures'?) that are, essentially, not separately referenced and thus unlikely to be called from a different context.
> 
> IIRC, Google Closure has a @lends annotation that might be used to turn off this warning in get/set setup code, and maybe elsewhere.
> Or maybe the detection can be smarter, like detecting the function being assigned or passed-in somewhere.
> 
> Just wondering,
> -Alex
> 
> On 12/18/21, 9:03 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>    How difficult would it be to add support for some kind of comment at the start of a function to turn it off for that function?
> 
>> On Dec 17, 2021, at 7:18 PM, Josh Tynjala <jo...@bowlerhat.dev> wrote:
>> 
>> No, it's all or nothing.
>> 
>> --
>> Josh Tynjala
>> Bowler Hat LLC <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbowlerhat.dev%2F&amp;data=04%7C01%7Caharui%40adobe.com%7C9284094113ac44658a8808d9c24846c9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637754437946343146%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=bxt8Ot1smEsxfPTlCYixm9XUs8%2Beva4jQOZ8%2B83DDiE%3D&amp;reserved=0>
>> 
>> 
>> On Fri, Dec 17, 2021 at 2:12 AM Harbs <ha...@gmail.com> wrote:
>> 
>>> The “this within closure” warnings are sometimes annoying.
>>> 
>>> Is there any way to suppress the warnings for specific functions without
>>> turning off the warnings for a whole project?
>>> 
>>> Thanks,
>>> Harbs
> 
> 


Re: this within closures

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I wonder what % of the time this warning actually helps detect a problem.  The first (and only) example I looked at was in royale-asjs_js\frameworks\projects\Core\src\main\royale\org\apache\royale\utils\object\defineSimpleProperty.as where a manually defined get/set accessor has accessor functions (are they actually 'closures'?) that are, essentially, not separately referenced and thus unlikely to be called from a different context.

IIRC, Google Closure has a @lends annotation that might be used to turn off this warning in get/set setup code, and maybe elsewhere.
Or maybe the detection can be smarter, like detecting the function being assigned or passed-in somewhere.

Just wondering,
-Alex

On 12/18/21, 9:03 AM, "Harbs" <ha...@gmail.com> wrote:

    How difficult would it be to add support for some kind of comment at the start of a function to turn it off for that function?

    > On Dec 17, 2021, at 7:18 PM, Josh Tynjala <jo...@bowlerhat.dev> wrote:
    > 
    > No, it's all or nothing.
    > 
    > --
    > Josh Tynjala
    > Bowler Hat LLC <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbowlerhat.dev%2F&amp;data=04%7C01%7Caharui%40adobe.com%7C9284094113ac44658a8808d9c24846c9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637754437946343146%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=bxt8Ot1smEsxfPTlCYixm9XUs8%2Beva4jQOZ8%2B83DDiE%3D&amp;reserved=0>
    > 
    > 
    > On Fri, Dec 17, 2021 at 2:12 AM Harbs <ha...@gmail.com> wrote:
    > 
    >> The “this within closure” warnings are sometimes annoying.
    >> 
    >> Is there any way to suppress the warnings for specific functions without
    >> turning off the warnings for a whole project?
    >> 
    >> Thanks,
    >> Harbs



Re: this within closures

Posted by Harbs <ha...@gmail.com>.
How difficult would it be to add support for some kind of comment at the start of a function to turn it off for that function?

> On Dec 17, 2021, at 7:18 PM, Josh Tynjala <jo...@bowlerhat.dev> wrote:
> 
> No, it's all or nothing.
> 
> --
> Josh Tynjala
> Bowler Hat LLC <https://bowlerhat.dev>
> 
> 
> On Fri, Dec 17, 2021 at 2:12 AM Harbs <ha...@gmail.com> wrote:
> 
>> The “this within closure” warnings are sometimes annoying.
>> 
>> Is there any way to suppress the warnings for specific functions without
>> turning off the warnings for a whole project?
>> 
>> Thanks,
>> Harbs


Re: this within closures

Posted by Josh Tynjala <jo...@bowlerhat.dev>.
No, it's all or nothing.

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>


On Fri, Dec 17, 2021 at 2:12 AM Harbs <ha...@gmail.com> wrote:

> The “this within closure” warnings are sometimes annoying.
>
> Is there any way to suppress the warnings for specific functions without
> turning off the warnings for a whole project?
>
> Thanks,
> Harbs