Followup: I've confirmed that the compiler already produces a warning when a method is missing a return type.
-- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Wed, Sep 23, 2020 at 10:37 AM Josh Tynjala <[email protected]> wrote: > Yeah, I can look into it next month. > > -- > Josh Tynjala > Bowler Hat LLC <https://bowlerhat.dev> > > > On Wed, Sep 23, 2020 at 2:20 AM Carlos Rovira <[email protected]> > wrote: > >> Hi Josh, >> >> could you add the compiler warning? I think that would make a difference. >> Also I could take a look at your commit (and others) to learn how to add >> this kind of warnings. >> >> If we could see more of this cases (maybe there are only few) we can add >> them more easily between all. >> >> About Crux, I think Greg could know better than me where we can add the >> check. >> >> Thanks >> >> El mar., 22 sept. 2020 a las 19:49, Hugo Ferreira (< >> [email protected]>) >> escribió: >> >> > OK. >> > >> > It was something that always annoys me on Flex and also happens in >> Royale >> > but I understand but is following a standard definition. >> > >> > >> > Josh Tynjala <[email protected]> escreveu no dia terça, >> 22/09/2020 >> > à(s) 18:08: >> > >> > > Remember that ActionScript has function scope and not block scope >> (same >> > as >> > > var in JS). So you are, in fact, declaring two variables named item in >> > the >> > > same scope. >> > > >> > > -- >> > > Josh Tynjala >> > > Bowler Hat LLC <https://bowlerhat.dev> >> > > >> > > >> > > On Tue, Sep 22, 2020 at 9:54 AM Hugo Ferreira <[email protected] >> > >> > > wrote: >> > > >> > > > Sure. >> > > > >> > > > for each (var item:Entity in items) >> > > > { >> > > > addEntity(item); >> > > > } >> > > > >> > > > for each (var item:Entity in items2) >> > > > { >> > > > addEntity(item); >> > > > } >> > > > >> > > > Warning on the second item:Entity (Duplicate variable but it's not >> > true). >> > > > >> > > > Josh Tynjala <[email protected]> escreveu no dia terça, >> > > 22/09/2020 >> > > > à(s) 17:34: >> > > > >> > > > > Can you share some example code that demonstrates the issue, Hugo? >> > > > > >> > > > > -- >> > > > > Josh Tynjala >> > > > > Bowler Hat LLC <https://bowlerhat.dev> >> > > > > >> > > > > >> > > > > On Tue, Sep 22, 2020 at 9:28 AM Hugo Ferreira < >> > [email protected]> >> > > > > wrote: >> > > > > >> > > > > > "1) The compiler must not be giving a warning for a missing >> return >> > > type >> > > > > on >> > > > > > a >> > > > > > method. I'm pretty sure that the Flex compiler had a warning." >> > > > > > + 1 >> > > > > > >> > > > > > I would add: >> > > > > > 3) The compiler must not be giving a warning for 2 variables >> with >> > the >> > > > > same >> > > > > > name on different scopes. >> > > > > > >> > > > > > Josh Tynjala <[email protected]> escreveu no dia terça, >> > > > > 22/09/2020 >> > > > > > à(s) 16:47: >> > > > > > >> > > > > > > It sounds like there are two things that could be improved. >> > > > > > > >> > > > > > > 1) The compiler must not be giving a warning for a missing >> return >> > > > type >> > > > > > on a >> > > > > > > method. I'm pretty sure that the Flex compiler had a warning. >> > > > > > > >> > > > > > > 2) At runtime, Crux is failing to handle the situation where a >> > > method >> > > > > > > doesn't have a return type. Even if the compiler issues a >> > warning, >> > > > the >> > > > > > > method is still not actually required to have a return type. >> Crux >> > > > > should >> > > > > > > probably handle that situation more gracefully. >> > > > > > > >> > > > > > > -- >> > > > > > > Josh Tynjala >> > > > > > > Bowler Hat LLC <https://bowlerhat.dev> >> > > > > > > >> > > > > > > >> > > > > > > On Tue, Sep 22, 2020 at 1:36 AM Carlos Rovira < >> > > > [email protected] >> > > > > > >> > > > > > > wrote: >> > > > > > > >> > > > > > > > Hi Chris, >> > > > > > > > >> > > > > > > > you're right. I think this is in the "compiler side" of >> royale. >> > > I'm >> > > > > not >> > > > > > > an >> > > > > > > > expert on the compiler, but I guess there should be best >> > > practices >> > > > to >> > > > > > > > detect this kind of issue and report to the user with a >> > compiler >> > > > > error >> > > > > > > > message that is far better. >> > > > > > > > >> > > > > > > > Maybe just adding a few will improve a lot the compiler >> quality >> > > for >> > > > > > > > newcomers (even people working full day and mastering >> Royale). >> > > > > > > > >> > > > > > > > Maybe Josh knows more about this and can give some >> thoughts. If >> > > the >> > > > > > rest >> > > > > > > of >> > > > > > > > us know how to do this, I think we all could add up to make >> the >> > > > > > compiler >> > > > > > > > better. But I think we need to go over some lessons to >> learn so >> > > we >> > > > > can >> > > > > > > > apply... >> > > > > > > > >> > > > > > > > Thanks >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > El mar., 22 sept. 2020 a las 10:15, Christofer Dutz (< >> > > > > > > > [email protected]>) escribió: >> > > > > > > > >> > > > > > > > > Hi all, >> > > > > > > > > >> > > > > > > > > so I have been trying to port my flex application to >> Royale >> > and >> > > > am >> > > > > > > > > currently working on learning Crux. >> > > > > > > > > Here I was having a problem, that was extremely difficult >> to >> > > > trace >> > > > > > > down. >> > > > > > > > > >> > > > > > > > > The effect was, that my Application was giving me the >> > following >> > > > > error >> > > > > > > in >> > > > > > > > > the browser: >> > > > > > > > > >> > > > > > > > > getDefinitionByName.js:59 Uncaught ReferenceError: Error >> > #1065: >> > > > > > > Variable >> > > > > > > > > is not defined. >> > > > > > > > > at >> > Object.org.apache.royale.reflection.getDefinitionByName >> > > > > > > > > (getDefinitionByName.js:59) >> > > > > > > > > at >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> Function.org.apache.royale.crux.factories.MetadataHostFactory.getMetadataHost >> > > > > > > > > (MetadataHostFactory.as:71) >> > > > > > > > > at >> > > > > > org.apache.royale.crux.reflection.TypeDescriptor.getMetadataHost >> > > > > > > > > (TypeDescriptor.as:149) >> > > > > > > > > at >> > > > > > > >> org.apache.royale.crux.reflection.TypeDescriptor.getMetadataHosts >> > > > > > > > > (TypeDescriptor.as:115) >> > > > > > > > > at >> > > > > > > > >> > > org.apache.royale.crux.reflection.TypeDescriptor.fromTypeDefinition >> > > > > > > > > (TypeDescriptor.as:170) >> > > > > > > > > at >> > > > > > > > > >> > > > > > >> > > Function.org.apache.royale.crux.reflection.TypeCache.getTypeDescriptor >> > > > > > > > > (TypeCache.as:60) >> > > > > > > > > at >> > > Function.org.apache.royale.crux.BeanFactory.constructBean >> > > > > > > > > (BeanFactory.as:616) >> > > > > > > > > at >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> de.cware.cweb.frontend.config.Beans.org.apache.royale.crux.BeanProvider.initializeBeans >> > > > > > > > > (BeanProvider.as:70) >> > > > > > > > > at >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> de.cware.cweb.frontend.config.Beans.org.apache.royale.crux.BeanProvider.initialize >> > > > > > > > > (BeanProvider.as:62) >> > > > > > > > > at org.apache.royale.crux.Crux.constructProviders >> > > > (Crux.as:288) >> > > > > > > > > >> > > > > > > > > When setting a breakpoint in getDefinitionByName.js:59 I >> > could >> > > > see >> > > > > > that >> > > > > > > > > “name” is simply set to the empty string. >> > > > > > > > > Also did the stacktrace not really give me any hint to >> what >> > > might >> > > > > be >> > > > > > > > > causing the problem. So I did a debugging session with >> > Carlos. >> > > > > > > > > Effectively we commented out stuff till the application >> > > “worked” >> > > > > > again. >> > > > > > > > > Today I finally found out what was causing the problem. >> > > > > > > > > >> > > > > > > > > In my code I had the following statement: >> > > > > > > > > >> > > > > > > > > [EventHandler(event="LoginEvent.LOGIN")] >> > > > > > > > > public function userLogin() { >> > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> //serviceHelper.executeServiceCall(remoteModuleService.listModulesForCurrentUser(), >> > > > > > > > > handleListModulesForCurrentUser); >> > > > > > > > > } >> > > > > > > > > >> > > > > > > > > I really tried everything, till I noticed I didn’t define >> a >> > > > return >> > > > > > > type, >> > > > > > > > > so as soon as I changed that to: >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > [EventHandler(event="LoginEvent.LOGIN")] >> > > > > > > > > public function userLogin():void { >> > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> //serviceHelper.executeServiceCall(remoteModuleService.listModulesForCurrentUser(), >> > > > > > > > > handleListModulesForCurrentUser); >> > > > > > > > > } >> > > > > > > > > >> > > > > > > > > My application worked. >> > > > > > > > > >> > > > > > > > > So would there be a way to make sure this sort of problem >> > > doesn’t >> > > > > > occur >> > > > > > > > or >> > > > > > > > > to give some output that makes tracking down the issue >> > simpler? >> > > > > > > > > >> > > > > > > > > Chris >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > > -- >> > > > > > > > Carlos Rovira >> > > > > > > > http://about.me/carlosrovira >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> >> >> -- >> Carlos Rovira >> http://about.me/carlosrovira >> >
