Re: Check is something is Class or instance in Royale

2018-10-07 Thread Carlos Rovira
While I'm pro PAYG, I think Language is for me a very internal piece, and for users will be even more. So we should think as well if in cases like this we should just implement all the cases since doesn't seems to me more than what we are talking here, even if we get 2-3 more, I think will be

Re: Check is something is Class or instance in Royale

2018-10-07 Thread Alex Harui
If Language.is needs other handling, maybe it is worth implementing some sort of plug-in model for it so folks can alter what it does to suit their needs. Where possible, we want the runtime code to handle PAYG/Just-in-case issues. The compiler's job is really to transpile a syntax tree and

Re: Check is something is Class or instance in Royale

2018-10-07 Thread Harbs
I think”is Array” should be rewritten to Array.isArray() in the compiler. Some time back, I added some comments to Language.is expressing some possible improvements there. I also highlighted a bug where “new String(“foo”)” new Number(2) and new Boolean(false) will get wrong results. (I don’t

Re: Check is something is Class or instance in Royale

2018-10-07 Thread Alex Harui
Ah yes, Class is currently in missing.js in typedefs because so far nobody needed it at runtime. I kind of wish we could avoid creating a dummy Class and having it linked into every app via Language.is even thought it will only be around 20 bytes. We could require a bead that injects the

Re: Check is something is Class or instance in Royale

2018-10-06 Thread Carlos Rovira
Hi Piotr, I think the problem is more about what to do with "Class" since is valid in AS3 and we need proper transpiler to SWF, JS... Right now in JS Class is not know [Error] ReferenceError: Can't find variable: Class= As I posted in the first email, I can workaround with typeof myFunc ===

Re: Check is something is Class or instance in Royale

2018-10-06 Thread Piotr Zarzycki
In the other words you are interested whether there is an object not a simple type? That's what I mean. Why not if (are[0] is object) - does it not cover all of the cases? On Sat, Oct 6, 2018, 2:48 PM Carlos Rovira wrote: > No, arr[0] has an instance of a custom typed object. > > El sáb., 6

Re: Check is something is Class or instance in Royale

2018-10-06 Thread Carlos Rovira
No, arr[0] has an instance of a custom typed object. El sáb., 6 oct. 2018 a las 10:58, Piotr Zarzycki () escribió: > Hi Carlos, > > Are you trying to distinguish something from simple type by that if(arr[0] > is Class) ? By simple type I mean String, Boolean? > > Piotr > > On Sat, Oct 6, 2018,

Re: Check is something is Class or instance in Royale

2018-10-06 Thread Piotr Zarzycki
Hi Carlos, Are you trying to distinguish something from simple type by that if(arr[0] is Class) ? By simple type I mean String, Boolean? Piotr On Sat, Oct 6, 2018, 10:54 AM Carlos Rovira wrote: > Hi Alex, > > I'm very new to Language.as, so I'll try to do my best. > > I'm trying to add to

Re: Check is something is Class or instance in Royale

2018-10-06 Thread Carlos Rovira
Hi Alex, I'm very new to Language.as, so I'll try to do my best. I'm trying to add to Language.as "is" function this: if(rightOperand === Class) { return typeof leftOperand === 'function'; } the test case is : var arr:Array = [main]; //main is a container declared

Check is something is Class or instance in Royale

2018-10-05 Thread Carlos Rovira
Hi, in js, check if something is a class or is an instance is like this [1] typeof myFunc === 'function' In Royale since we are using AS3, doing if(something is Class) do this else do that should work either for SWF and for JS, but seems is not the case. I must make two codes