Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Harbs
Yeah. The check I was going to do is actually pretty simple: if(bytes && typeof bytes.byteLength != "number") throw new TypeError("BinaryData can only be initialized with ArrayBuffer”); ba = bytes ? bytes as ArrayBuffer : new ArrayBuffer(0); It’s not 100% foolproof, but if someone wants to pa

Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Greg Dove
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 genera

Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Greg Dove
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 wrote: > > In application development I would normally do this type of thing inside > CONFIG::dev > blocks, or similar, so having the possibility, as described,

Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Harbs
Sounds interesting. I’m not sure I understand how this would work. I am willing to explore this with a bit of direction. I don’t see a debug flag listed here: https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler

Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Harbs
Ah. This is helpful.[1] Basically, we could use @define or maybe goog.DEBUG. I’m not clear on whether goog.DEBUG code is removed if goog.DEBUG is false. [1]https://stackoverflow.com/questions/11402218/removing-debug-code-from-inside-a-function-using-closure-compiler-simple-optimis

Re: [FlexJS]Runtime type checking and PAYG

2017-07-11 Thread Alex Harui
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 t