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]
**********************************************************************

Reply via email to