Well, it may be just me, but I have the opposite thought...

IMO, instead of bracket access, we should take the time to create
ValueObjects for each of the data structures used in the ASDoc example.

I'm not even quite sure how to do #2 without blindly preventing renames of
all uses of the property names throughout the entire app.
I also think there are plenty of places where you don't need bracket
notation for plain objects.  I thought the only time minification is a
problem is when the data is externally supplied.

The compiler, the language, and the Flash runtime are all designed to
prevent you from making silly mistakes, so I think the best practice is to
define data classes.  I've even considered adding a warning that detects
use of plain object.

For example, in your example below, the following code

  doSomthing(myObj.foobaz);

could easily be accidentally written as:

  doSomthing(myObj.foobar);

Or 

  doSomthing(myObj.fooBaz);

If I take the time to define a data class




  public class MyObject
  {
     public var foobaz:String
  }

The compiler will catch this long before you will catch this at runtime.
Since we are all about developer productivity, that seems like the right
approach, but maybe generating data classes is too painful?

If anything, what I was going to suggest for ASDoc was to explore
converting JSON to AS data classes similar to how we just got AMF sort of
working.  It might be that only the SWF code needs to actually do the
conversion.  The JS code wouldn't need it unless someone is testing for
the type of the class with "as MyObject".

IOW, my claim is that it will save you time in the end to create data
classes.  You'll even get code hinting in many IDEs.  But of course, I
could be wrong.

Thoughts?
-Alex


On 9/26/17, 2:47 PM, "Harbs" <harbs.li...@gmail.com> wrote:

>That’s probably it.
>
>It really needs bracket access.
>
>Alex, if you are looking for a task in the compiler, here’s a suggestion
>that would drastically reduce bugs in minified apps:
>
>1. For all untyped objects, dot notation should be rewritten to bracket
>notation:
>
>var myObj:Object = myArr[idx];
>doSomthing(myObj.foobaz);
>
>Should probably become:
>
>var myObj:Object = myArr[idx];
>doSomthing(myObj[“foobaz”]);
>
>2. Object literals should not be minified:
>
>var foo:Object = {
>       name:”foo”,
>        age:15,
>       vegetable:true
>}
>
>Should be rewritten to:
>var foo:Object = {
>       “name":”foo”,
>        “age":15,
>       “vegetable":true
>}
>
>I have been doing a LOT of manual fixing of these kinds of errors. It’s
>really tedious and hard to find all of them. Basically, unless you’re
>really good an find/replace, your app is almost guaranteed to blow up on
>some of these and then you need to find the needle in the haystack to fix
>it.
>
>Harbs
>
>> On Sep 27, 2017, at 12:33 AM, Alex Harui <aha...@adobe.com.INVALID>
>>wrote:
>> 
>> You can grab the JSON files from the Jenkins server, but the Ant build
>> should also build them.
>> 
>> My guess is that the code isn't finding properties from the JSON objects
>> because GCC renamed the properties.
>> 
>> -Alex
>> 
>> On 9/26/17, 2:25 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>> 
>>> I can’t test because I’m missing the json files and I’m not sure how to
>>> generate them.
>>> 
>>> Looks like some binding problem probably due to renaming. The json
>>>files
>>> appear to be loading correctly from the web.
>>> 
>>>> On Sep 26, 2017, at 11:41 PM, Alex Harui <aha...@adobe.com.INVALID>
>>>> wrote:
>>>> 
>>>> Feel free to take a investigate.  Peter's old ASDoc page points to the
>>>> js-debug version.  It loads slowly some times, but at least it is
>>>> functional.  I'd rather work on other things right now than chasing
>>>> down a
>>>> js-release problem.
>>>> 
>>>> -Alex
>>>> 
>>>> On 9/26/17, 1:36 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>>>> 
>>>>> FWIW, the debug version is working, but the release version does not
>>>>> appear to work:
>>>>> 
>>>>> 
>>>>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache
>>>>>fl
>>>>> ex
>>>>> 
>>>>> 
>>>>>build.cloudapp.net%3A8080%2Fjob%2FFlexJS_ASDoc_Example%2FlastSuccessfu
>>>>>lB
>>>>> ui
>>>>> 
>>>>> 
>>>>>ld%2Fartifact%2Fexamples%2Fflexjs%2FASDoc%2Fbin%2Fjs-release%2Findex.h
>>>>>tm
>>>>> l&
>>>>> 
>>>>> 
>>>>>data=02%7C01%7C%7C54179a88620d4b09851a08d5051e4e2b%7Cfa7b1b5a7b3443879
>>>>>4a
>>>>> ed
>>>>> 
>>>>> 
>>>>>2c178decee1%7C0%7C0%7C636420550126149199&sdata=%2BTvYxjGSPD%2FJidjhxaw
>>>>>Ds
>>>>> cN
>>>>> 4YnE1vPWE%2BarU5wgrolk%3D&reserved=0
>>>>> 
>>>>> 
>>>>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapach
>>>>>ef
>>>>> le
>>>>> 
>>>>> 
>>>>>xbuild.cloudapp.net%3A8080%2Fjob%2FFlexJS_ASDoc_Example%2FlastSuccessf
>>>>>ul
>>>>> Bu
>>>>> 
>>>>> 
>>>>>ild%2Fartifact%2Fexamples%2Fflexjs%2FASDoc%2Fbin%2Fjs-release%2Findex.
>>>>>ht
>>>>> ml
>>>>> 
>>>>> 
>>>>>&data=02%7C01%7C%7C54179a88620d4b09851a08d5051e4e2b%7Cfa7b1b5a7b344387
>>>>>94
>>>>> ae
>>>>> 
>>>>> 
>>>>>d2c178decee1%7C0%7C0%7C636420550126149199&sdata=%2BTvYxjGSPD%2FJidjhxa
>>>>>wD
>>>>> sc
>>>>> N4YnE1vPWE%2BarU5wgrolk%3D&reserved=0>
>>>>> 
>>>>>> On Sep 26, 2017, at 11:02 PM, Alex Harui <aha...@adobe.com.INVALID>
>>>>>> wrote:
>>>>>> 
>>>>>> Or are you saying ASDoc isn't working for you on some browser?
>>>>> 
>>>> 
>>> 
>> 
>

Reply via email to