oops, that last idea won't work so well with  @flexjsignorecoercion
ArrayBuffer above it :)

On Wed, Jul 12, 2017 at 9:54 AM, Greg Dove <greg.d...@gmail.com> wrote:

>
> In application development I would normally do this type of thing inside
> CONFIG::dev
> blocks, or similar, so having the possibility, as described, to exclude
> development-only code (extra type checking, null checks etc) would
> definitely also be helpful PAYG-wise from within the framework.
>
> The general issue here I think is that using this approach for the
> framework requires a dev build of the framework and a separate
> produciton-ready build, so the approach of using GCC to avoid this via
> annotations sounds like a great solution to that. I don't know how we could
> do this on the swf side though without having two framework builds?
>
> btw React/React-Native has something like this as well iirc, including
> removal of a bunch of runtime type-checking support in the release builds,
> so having something like this seems like it would be a good thing to for
> comparison with others.
>
> I terms of the 'type check' in this case, personally I think it could be
> as simple as
>
> ba = bytes ? bytes as ArrayBuffer : new ArrayBuffer(0);
> if (bytes && !ba) throw new Error('unexpected constructor argument type');
>
> I think that could be used for both swf and js.
>
>
>
> On Wed, Jul 12, 2017 at 8:56 AM, Alex Harui <aha...@adobe.com.invalid>
> wrote:
>
>> I've mentioned the notion of debug-mode beads on the mailing list a couple
>> of times.  It would be great to see this idea explored more.
>>
>> By definition, now that you've debugged your code, any type-checking code
>> path becomes unused in production, which is what we don't want.  But
>> adding code paths that go away in production, or swapping in different
>> beads during development that have more code paths that check for common
>> mistakes is certainly within the charter.  We want to maximize developer
>> productivity.
>>
>> I think Google Closure Compiler supports a debug flag you can use in
>> COMPILE::JS blocks that gets dropped in production.  If we need to mimic a
>> similar flag for SWF so code can compile outside of COMPILE::JS blocks
>> that might be ok.
>>
>> -Alex
>>
>> On 7/11/17, 1:07 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>>
>> >I just wasted over an hour because I was initializing a BinaryData with a
>> >string instead of an ArrayBuffer.
>> >
>> >I would like to add a typecheck to the bytes argument in the BinaryData
>> >constructor to throw an error if something other than an ArrayBuffer is
>> >provided. We cannot use strict typing to catch this in the compiler,
>> >because the argument is different for SWF and JS. Is this a violation of
>> >PAYG? It’s sort-of just in case code, but not really because it’s
>> >protecting against errors.
>> >
>> >Thoughts? Other solutions?
>> >Harbs
>>
>>
>

Reply via email to