flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [FlexJS] String.match()
Date Thu, 20 Jul 2017 06:39:33 GMT
Both Flash and JS engines automatically convert to RegExp. I had not realized that at first.

It seems that the only difference between the Flash engine and JS engines is what happens
when constructing a RegExp object from invalid input. Flash matches nothing, while JS throws
an error.

By just wrapping the call in a try/catch, that seems to resolve the issue.

I added the trace because I think it’s bad practice to use strings instead of RegExp because
it can lead to unexpected results and a new RegExp instance needs to be constructed every
time.

> On Jul 20, 2017, at 3:32 AM, Alex Harui <aharui@adobe.com.INVALID> wrote:
> 
> It looks like they just trace a warning instead of trying to convert to a
> RegExp.  Is that what we want to do?  Or should we add code that converts
> a string to regex?
> 
> Thoughts?
> -Alex
> 
> On 7/19/17, 4:32 AM, "Harbs" <harbs.lists@gmail.com> wrote:
> 
>> I added the utility functions. I think they can be very simple.
>> 
>>> On Jul 19, 2017, at 9:30 AM, Alex Harui <aharui@adobe.com.INVALID>
>>> wrote:
>>> 
>>> Unless we are absolutely sure that everybody will need the code
>>> generated
>>> by the compiler, having the compiler call a framework function makes it
>>> easier for an app developer to make any adjustments to that code.  It is
>>> easier to monkey-patch a utility function than find-and-replace some
>>> sequence of code the compiler has sprinkled throughout the output.
>>> 
>>> My 2 cents,
>>> -Alex
>>> 
>>> On 7/18/17, 11:36 AM, "yishayw" <yishayjobs@hotmail.com> wrote:
>>> 
>>>> Alex Harui-2 wrote
>>>>> By
>>>>> calling new utility functions, the developer has control over the
>>>>> conversion.
>>>> 
>>>> I don't understand that point. Do you mean an app developer?
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context:
>>>> 
>>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-f
>>>> le
>>>> 
>>>> x-development.2333347.n4.nabble.com%2FFlexJS-String-match-tp63392p63405.
>>>> ht
>>>> 
>>>> ml&data=02%7C01%7C%7C9ff1088402ef439ca27908d4ce0e97eb%7Cfa7b1b5a7b344387
>>>> 94
>>>> 
>>>> aed2c178decee1%7C0%7C0%7C636360009448210304&sdata=nprl9yHUtlsTHbIZxeFq2h
>>>> %2
>>>> FQNWmtimM%2BxAt0kJA8EcA%3D&reserved=0
>>>> Sent from the Apache Flex Development mailing list archive at
>>>> Nabble.com.
>>> 
>> 
> 


Mime
View raw message