David Thanks for the insight. I think i might try that-day 2 and half already of this! Hopefully the compile with ‘all vars are declared should show me what is not declared(!)…i would love to be able to run my code(which i spoke about on here) that now auto sets the declarations of variables at the top of methods and declares everything that does not comply with the naming convention and is not declared as //C_UNKNOWN..but alas not much naming convention in play. I will try your re-tokenize code shortly.
My next ‘side task’(now that i have my updated code repository working-although not installed on the system i am talking about here yet) is to write something that will report repeating methods-methods and scripts that are identical or near identical, and i think as part of that I will get it to report if there are invalid method names in new process(I find it annoying that ‘find unused methods’ shows any methods called only in new process or from a menu as uncalled) As with most people my own code never assumes parameters these days-with all vars passed put into locals which really helps with parameter checking in the code-and very few vars not passed(so a big reduction in process vars and virtually no interprocess)..but we are someway from even starting on that here I will go vote.. Nigel Greenlee > On 4 Apr 2017, at 22:58, David Adams via 4D_Tech <[email protected]> wrote: > > Nigel, > > The Compiler changed some versions back and no longer detects all error sin > one pass...at least in certain situations. A few tips and things to look > out for: > > * If you've got a missing method, the Compiler usually stops reporting > errors, even if there are multiple cases of the problem. > > * Sometimes, code doesn't seem to be scanned. I use a method to retokenize > all methods (pasted below) which helps. Note that you get an error on this > most of the time when the method tries to retokenize itself. > > * If you compile with 'all variables are typed ' (and you are likely to > find more genuine errors this way), then periodically do a syntax check > with 'type the variables.' If you've got inconsistent declarations, this > can turn them up. > > There are still a number of things that the compiler won't do - even in V16: > > * Check parameter list lengths and detect extra params in some cases. > > * Check parameter list lengths and detect missing params in any case. > (There's no syntax to declare a method parameter as optional in 4D.) > > * Check method name references, like with New process, ON ERR CALL, etc. > There's also still no way to declare that a parameter is a method reference. > > I've already got a feature request in at forums.4d.fr for these > improvements. If you like these ideas, or have related suggestions, please > comment and vote here: > > Compiler/Typing Improvements: Detect some runtime errors in advance > http://forums.4d.fr/Post/EN/19107688/1/19107689 > > I have to say, I've got zero evidence to make be believe that the forum > voting makes any difference at all...but I'm new over there. So, maybe I > does. I do know that 4D officially ignores comments on this list, so > everything here is just chat. If, like many of us, you don't guess how to > vote properly, here's a Tech Tip that Tim Penner kindly pointed out not too > long ago: > > Tech Tip: How to vote for a feature request > http://kb.4d.com/assetid=76726 > > Here's that method I promised earlier. The subroutine names are pretty > self-explanatory. > > If (False) > Method_RetokenizeAllCode > > // Adapted from a NUG thread in September of 2015. > // From: Vincent de Lachaux<[email protected]> > // Date: Wednesday, September 23, 2015 > // Subject: Re-Tokenize Methods Procedurally > // To: 4D iNug Technical<[email protected]> > End if > > C_BOOLEAN($1;$confirm_first) > > $confirm_first:=True > If (Count parameters>=1) > $confirm_first:=$1 > End if > > C_BOOLEAN($continue) > $continue:=True > > If (System_IsCompiled ) > //Method_AlertIfRunningCompiled ("Method retokenization does not work > in compiled mode.") > $continue:=False > End if > > OK:=0 > If ($continue & $confirm_first) > C_TEXT($message) > $message:="" > $message:=$message+"Please make a backup of the structure if you haven't > already."+Char(Carriage return)+Char(Carriage return) > $message:=$message+"Close any methods currently open in the Design > environment before proceeding."+Char(Carriage return)+Char(Carriage return) > $message:=$message+"Retokenize all methods now?" > > CONFIRM($message) > $continue:=OK=1 > End if > > If ($continue) > C_TEXT($icon_path) > C_LONGINT($progress_id) > C_BOOLEAN($enable_close) > $icon_path:=Resources_GetImageFilePath ("Validate_Code_Large.png") > $enable_close:=True > $progress_id:=Progress_Open ("Retokenizing all > code";$icon_path;$enable_close) > > ARRAY TEXT($method_paths_at;0) > METHOD GET PATHS(Path all objects;$method_paths_at;*) > > C_LONGINT($paths_count) > C_LONGINT($path_index) > $paths_count:=Size of array($method_paths_at) > For ($path_index;1;$paths_count) > C_TEXT($method_path) > $method_path:=$method_paths_at{$path_index} > > Progress_Update ($progress_id;$method_path;$path_index/$paths_count) > > C_TEXT($method_text) > METHOD GET CODE($method_path;$method_text;*) > METHOD SET CODE($method_path;$method_text;*) > End for > > Progress_Close ($progress_id) > End if > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

