@Om, sorry, I misreading but yes, singleton means also some static methods and 
I tried it having some trouble with but don't think it will be for a long time. 

Frédéric THOMAS

> From: webdoubl...@hotmail.com
> To: dev@flex.apache.org
> Subject: RE: [Falcon] Constructor NS (was: [Falcon] starting up)
> Date: Sun, 5 Oct 2014 06:22:50 +0100
> 
> @Om, Didn't mentioned it because I guess the implementation for "new" and the 
> relative checks are almost the same than for the extends and now I understand 
> better FP, even though I mentioned method overloading implementation, 
> actually, I guess it could be even done without but would be cleaner with, 
> I'm anyway close  to and will demonstrate the extends soon.
> I guess I did the hardest part in compiling a lib and be able to have some NS 
> informations passed thru the ABC without FP complaining and keeping the 
> original implementation intention in not modifying the CMImplicit NS to not 
> make FB complaining as mentioned in the method comments).
> 
> @Gordon, from what I've seen at the moment,  I guess you're right,  the 
> constructor is just a function, FB doesn't enforce NS, everything is done at 
> compile time, the only barrier was the CMImplicitNS, I kept it and passed 
> other NS info thru the abc, you will see the code relatively soon, I guess 
> next weekend  (my time on it is very limited) and I would like you to review 
> it if you don't mind, and for the reflection maybe there will be some tricks 
> but as I do it at the moment, even the legacy compiler raise a verify error 
> when I try to instantiate a class with a private ctor.
> 
> 
> Frédéric THOMAS
> 
> > Subject: Re: [Falcon] Constructor NS (was: [Falcon] starting up)
> > From: gsmit...@hotmail.com
> > Date: Sat, 4 Oct 2014 19:35:42 -0700
> > To: dev@flex.apache.org
> > 
> > In general the ActionScript Virtual Machine enforces access modifiers (so 
> > that, for example, something marked private is truly inaccessible by any 
> > means outside the class) but I don't think the AVM enforces non-public 
> > constructors. I'm guessing that a constructor in the ABC is public 
> > regardless of what the source code says, which would mean that the 
> > constructor could be invoked by any code via reflection. If this is the 
> > case, I'm not convinced we should pretend that constructors can be 
> > non-public.
> > 
> > - Gordon
> > 
> > Sent from my iPad
> > 
> > > On Oct 4, 2014, at 4:14 PM, "OmPrakash Muppirala" <bigosma...@gmail.com> 
> > > wrote:
> > > 
> > >> On Oct 4, 2014 12:55 PM, "Frédéric THOMAS" <webdoubl...@hotmail.com> 
> > >> wrote:
> > >> 
> > >> Hi,
> > >> 
> > >> I started to check if it was possible to have private and protected
> > > constructor in Falcon and I have to admit it was tricky especially because
> > > I never seen a compiler from inside before but it is apparently possible,
> > > I've been able to compile successfully:
> > >> package myLib {
> > >> public class CTORTest {
> > >>    private var _p:int;
> > >> 
> > >>    private function CTORTest(p:int) {
> > >>        _p = p;
> > >>    }
> > >> 
> > >>    private function anotherFct():CTORTest {
> > >>        return new CTORTest(10);
> > >>    }
> > >> }
> > >> }
> > >> and using the compiled lib:
> > >> 
> > >> <?xml version="1.0"?>
> > >> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
> > > xmlns:s="library://ns.adobe.com/flex/spark"
> > > creationComplete="creationCompleteHandler(event)">
> > >>    <fx:Script><![CDATA[
> > >>        import mx.events.FlexEvent;
> > >> 
> > >>        import myLib.CTORTest;
> > >> 
> > >>        private function creationCompleteHandler(event:FlexEvent):void {
> > >>            var a:CTORTest = new CTORTest(1);
> > >>        }
> > >>        ]]></fx:Script>
> > >> </s:Application>
> > >> 
> > >> gives:
> > >> [Fault] exception, information=VerifyError: Error #1014: La classe
> > > myLib:CTORTest::CTORTest est introuvable. (not found) with the legacy
> > > compiler
> > >> and:
> > >> F:\sources\falconTestDrive\shell\src\Main.mxml:9
> > >> Erreur: Appel d'une méthode qui ne semble pas définie CTORTest. (Call to
> > > a undefined method)
> > >>            var a:CTORTest = new CTORTest(1);
> > >> 
> > >> (I will customize the error message later)
> > >> 
> > >> I still need to check it works in the 3 possible ways to instantiate a
> > > Class [1] (at the moment it works only with 1st one), check that works 
> > > with
> > > is  / instanceOf, revisit the cast function accordingly and maybe other
> > > things not yet in my mind and especially check FP won't complain using it.
> > >> 
> > >> /* expression = FunctionCallID(KeywordNewID(void), new_type_name,
> > > ContainerID(expression*)) */
> > >> /* expression = FunctionCallID(KeywordNewID(void), expression,
> > > ContainerID(expression*)) */
> > >> /* expression = FunctionCallID(KeywordNewID(void), vector_literal,
> > > ContainerID(void)) */
> > >> 
> > >> In case all this works and I'm far to know it at the moment, I will have
> > > to think about implement "method overloading" otherwise I can't see any
> > > usage of a protected constructor and therefore will probably require some
> > > help for the best way to implement it.
> > > 
> > > Exciting to see these kind of experiments.  A really good usecase for
> > > private constructor would be to create a Singleton class, I.e a class  
> > > that
> > > cannot be instantiated outside of itself.  Would that be something you can
> > > test for?
> > > 
> > > Thanks,
> > > Om
> > > 
> > >> 
> > >> Thanks,
> > >> Frédéric THOMAS
> > >> 
> > >>> From: webdoubl...@hotmail.com
> > >>> To: dev@flex.apache.org
> > >>> Subject: RE: [Falcon] starting up
> > >>> Date: Wed, 1 Oct 2014 16:57:28 +0100
> > >>> 
> > >>> Ah ok, thanks Gordon, I was tearing my hair out :-)
> > >>> 
> > >>> Frédéric THOMAS
> > >>> 
> > >>>> Subject: Re: [Falcon] starting up
> > >>>> From: gsmit...@hotmail.com
> > >>>> Date: Wed, 1 Oct 2014 08:51:16 -0700
> > >>>> To: dev@flex.apache.org
> > >>>> 
> > >>>> That comment is out of date. Code Model was the part of pre-Falcon
> > > Flash Builder that built an abstract syntax tree to support intelligent
> > > editing. We used it as the beginning of Falcon's lexer and parser. The 
> > > code
> > > is just looking at the AST to see if the constructor has a non-public
> > > namespace.
> > >>>> 
> > >>>> - Gordon
> > >>>> 
> > >>>>> On Oct 1, 2014, at 8:33 AM, "Frédéric THOMAS" <
> > > webdoubl...@hotmail.com> wrote:
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>> I updated it to v17.0 and check in
> > > falcon\compiler\generated\dist\sdk\lib\external, is there.
> > >>>>> 
> > >>>>> oops, looking better, it has both, just removed the bad one, it
> > > runs.
> > >>>>> 
> > >>>>> Now, looking at internal\as\codegen\ClassDirectiveProcessor.java, I
> > > see that:
> > >>>>> 
> > >>>>> // If a constructor has a namespace as part of it's declaration, it
> > > must be declared public.
> > >>>>> // It is ok to omit the namespace
> > >>>>> // We must check the AST, as CM treats all ctors as public no
> > > matter what the user typed in
> > >>>>> // so the FunctionDefinition will always be in the public namespace
> > >>>>> if( node.getActualNamespaceNode() != null &&
> > >>>>>       node.getActualNamespaceNode().getName() !=
> > > IASKeywordConstants.PUBLIC)
> > >>>>>   problems.add(new
> > > ConstructorMustBePublicProblem(node.getActualNamespaceNode()));
> > >>>>> 
> > >>>>> What is the CM or Code Model ?
> > >>>>> 
> > >>>>> Thanks,
> > >>>>> Frédéric THOMAS
> > >>>>> 
> > >>>>>> From: aha...@adobe.com
> > >>>>>> To: dev@flex.apache.org
> > >>>>>> Subject: Re: [Falcon] starting up
> > >>>>>> Date: Wed, 1 Oct 2014 13:36:50 +0000
> > >>>>>> 
> > >>>>>> Could you have an old guava.jar?
> > >>>>>> 
> > >>>>>>> On 10/1/14 4:32 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com>
> > > wrote:
> > >>>>>>> 
> > >>>>>>> Hi,
> > >>>>>>> 
> > >>>>>>> I built it with ANT an ran Falcon compc.bat from the
> > > generated/dist/sdk,
> > >>>>>>> does anyone knows why I get that ?
> > >>>>>>> 
> > >>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
> > >>>>>>> com/google/common/cache/CacheLoader
> > >>>>>>>  at org.apache.flex.compiler.clients.MXMLC.<init>(MXMLC.java:379)
> > >>>>>>>  at org.apache.flex.compiler.clients.COMPC.<init>(COMPC.java:54)
> > >>>>>>>  at
> > > org.apache.flex.compiler.clients.COMPC.staticMainNoExit(COMPC.java:75)
> > >>>>>>>  at org.apache.flex.compiler.clients.COMPC.main(COMPC.java:63)
> > >>>>>>> Caused by: java.lang.ClassNotFoundException:
> > >>>>>>> com.google.common.cache.CacheLoader
> > >>>>>>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> > >>>>>>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> > >>>>>>>  at java.security.AccessController.doPrivileged(Native Method)
> > >>>>>>>  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> > >>>>>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > >>>>>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> > >>>>>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > >>>>>>>  ... 4 more
> > >>>>>>> 
> > >>>>>>> Thanks,
> > >>>>>>> Frédéric THOMAS
> > >> 
>                                         
                                          

Reply via email to