On Feb 18, 2018, at 9:18 AM, Jörg Knebel wrote:

>> On 18 Feb 2018, at 18:47 AEDT, Stephen Shaw via 4D_Tech 
>> <[email protected]> wrote:
>> 
>> I presume you have used the generate typing button in the compiler dialog.
> 
> NO, I never used the “4D variable typing function” or what ever it is/was 
> called and I’m with 4D since v2.
> 
> All Compiler_definition-Methods are "hand-crafted"!

I do the same thing. I don’t like 4D making them for me. It keeps me well 
disciplined with creating new process and IP variables. I often catch spelling 
error in variable names this way too. 

I’ve been using 4D since v2.0.10 and RD Complier v1.0. So I’ve got structures 
that have been around for a long time. I’ve used every version of the 4D 
compiler.

First versions of the compiler did not have “compiler methods”. It would make 3 
passes over the entire structure file to locate all variables and type them 
either by context or by compiler declarations like C_TEXT. “Compiler methods” 
came later so it could avoid this multi-pass scanning. 

Over the years I have occasionally ran across strange occurrences where the 
compiler would complain about a variable or parameter not being typed. It would 
be an old variable or method that I had worked on, but only did code changes. 
No new variables or parameters. I’d check my Compiler Methods and sure enough 
the parameter was not declared or variable was not declared.

I would think, how could this be? I have “all variables typed” set and have 
compiled this thing 20+ times in the last few years. Why didn’t it catch this 
before? The change to the method was only a little code change. Nothing to do 
with parameters or variables. 

With what Jörg experienced, I think my suspicions have been confirmed. 4D has 
been doing some “sneaky” things regarding the compiler, and that has changed 
with v16. 

I believe that 4D has been using a secret variable typing cache in addition to 
the Compiler Methods. It was probably created and used before Compiler Methods 
were introduced to speed up compiling and eliminate some of the compiler 
scanning method text for variables. Probably each method had a “variable type 
cache” object that had all variables and parameters used in the method typed. 
If the method had not been changed since the last cache update, then the 
compiler would use that instead of scanning the method text. For thousands of 
methods it would be a nice performance optimization. And something that 4D 
would do “secretly”. Why tell us all about it? It was just a compiler 
performance optimization. Implementation details. 

This would explain what I have been seeing randomly and what Jörg saw on a 
massive scale. His Compiler Methods were incomplete and he didn’t realize it. 
The variable typing cache objects were being used. Or could be 4D decided his 
cache was bad and needed to be dumped and recreated. 

So for v16 the secret variable typing cache is no longer being used like it was 
before. Something has changed. I’m guessing it is still there and being used 
for local variables. But for parameters it is ignored now and Compiler Methods 
are the exclusive place for parameter typing. 

Another great 4D implementation question for the 4D engineers at 4D Summit. 

Tim

Sent from my iPad
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to