Douglas.

Yes that is kind of what i thought and can remember the old days  so would kind 
of expect it to have failed after one of those passes and-when you have fixed 
of type x get more but that really was not what i saw-i had syntax errors( to 
many” }"or “)” etc) and variables re-declared differently etc but and i had 
only cleared about half of them when it suddenly found all the 
$Something:=confirm(“something”;”Yes”;”No”)..lots of them and if else else etc. 

I did notice though that when I cleared ‘general’ errors(Which oddly where not 
at the top) that did seem to allow it to find more..I finally got through this 
one after 2 days at it(I tried David Adams suggestion of trying ‘all vars are 
declared’ and at 69000 errors decided that was not the way to go!..and could 
not run his retokenise code because this is a live system i am working on and 
its V12). Its feels better to me to have a system that does at least 
syntactically correct and is compilable.

Of course now i got some ‘fallout’ I found that at least one Variable was used 
in a 4D Write document and the same var(Interprocess) was a number and then 
somewhere else a string..changed the name of the variable in the string and 
then was told a document was not working…Can anyone think of other examples 
where a var might be used in a way that does not show up in 
forms/methods/scripts?

Nigel Greenlee




> On 6 Apr 2017, at 21:47, Douglas von Roeder via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Nigel:
> 
> A couple of thoughts on this…
> 
> I couldn't find this documented but 4D's compiler does three "passes"
> through the source code (when you're not typing all of your variables).
> IIRC, the compiler displays what it's doing for each pass but newer
> versions of 4D + modern hardware are so fast that I haven't seen the
> "label" appear in the compiler window.
> 
> For the sake of argument, lets' say that the three passes are something
> like syntax, declarations, and then parameter type matching. There must be
> no errors in one phase before the compiler will move on to the next.
> Perhaps what you're seeing is that as you resolve errors during the syntax
> phase, those changes engender issues within that same phase.
> 
> Once the issues in the syntax phase are resolved, the compiler will run the
> declarations phase and will report those errors.
> 
> Rinse, lather, repeat for the next phase.
> 
> 
> Second issue is that 4D's compiler used to scan methods sequentially, based
> on ID, and would check parameters based on the parameter list that exists
> for the first instance of a method.
> 
> This was my observation of the early versions of the compiler so it could
> be observer error/bias and 4D could have completely revamped how the
> compiler functions. Also, in the 25 years or so since I made this
> observation, I've never gone back and checked. :-)
> 
> Having just done a 2004 to 15 conversion, I saw the same behavior you're
> experiencing and it was *not* a pleasant feeling. Most of the time I
> compile it really is just a "spell check", so it was unnerving to compile -
> error fix - compile and get more errors - error fix - compile and get
> different errors. No fun at all but an inherent part of the process of
> "getting to done".
> 
> 
> 
> --
> Douglas von Roeder
> 949-336-2902
> 
> On Wed, Apr 5, 2017 at 1:56 AM, Nigel Greenlee via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> 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 <4d_tech@lists.4d.com>
>> 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<vincent.delach...@4d.com>
>>>   // Date: Wednesday, September 23, 2015
>>>   // Subject: Re-Tokenize Methods Procedurally
>>>   // To: 4D iNug Technical<4d_tech@lists.4d.com>
>>> 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:4d_tech-unsubscr...@lists.4d.com
>>> **********************************************************************
>> 
>> **********************************************************************
>> 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:4d_tech-unsubscr...@lists.4d.com
>> **********************************************************************
>> 
> **********************************************************************
> 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:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
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:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to