Re: 4D Compiler

2017-04-09 Thread Nigel Greenlee via 4D_Tech
Heinz, Timothy.

I completely agree. A strict nomenclature with typing is essential.

 In fact its the only way i too have been able to implement auto declaration in 
my code-not just locals-i was inspired by your comment about doing it for 
locals on here a while back to go back and complete work i had done on code 
previously-of course its harder pulling out variables than locals or 
interprocess-so it was a hell of a job to do (Trust me its a thing of beauty 
but there were about 50 attempts of running this across including a few bad 
failures with my code before i weeded out all the gotchas)..i might now go back 
and provide a way of allowing definition of the nomenclature so it could be 
used with other conventions(I use a convention where the type is after a 
’group' and before the name(xxx_type_name) and i know a lot people use 
Name_type and i define screen variables such as buttons (but) or radio  buttons 
as rb rather than all longints as (l) and a couple of other other usages for 
listboxes, drop downs etc

Here however I have taken over pre-existing work where beyond having adopted S 
for strings at some point there is nothing currently in place. Yes I would love 
to make sure the 69,000 guessing points are sorted-but it will take time. There 
are other pressing challenges such as no usage to speak of of style sheets and 
a variety of form implementation ranging.

So give me time and we will see how i progress.




> On 7 Apr 2017, at 17:35, Herr Alexander Heintz via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> This is where strict variable nomenclature with typing info helps a lot.
> You can easily create a method that can gather all locals in a piece of code, 
> and add the declarations at the top of a method.
> You can even apply that automatically using METHOD GET CODE and METHOD SET 
> CODE.
> OTOH if you have no variable nomenclature with typing…
> 69000 typing errors.
> Forget it, seriously...
> 
>> Am 07.04.2017 um 18:29 schrieb Timothy Penner via 4D_Tech 
>> <4d_tech@lists.4d.com>:
>> 
>> Nigel,
>> 
>>> I tried David Adams suggestion of trying ‘all vars are declared’ and at 
>>> 69000 errors decided that was not the way to go!
>> 
>> You really should try to fix those...That is 69,000 places that 4D is 
>> guessing what the variable type should be - instead of you explicitly 
>> telling 4D what the variable type should be. All you need to do is use 
>> C_TEXT or C_LONGINT or C_* at the top of your methods to declare what the 
>> variables are. This is the best practice after all.
>> 
>> Just my 2 cents.
>> 
>> -Tim
>> 
>> 
>> 
>> **
>> 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
**

Re: 4D Compiler

2017-04-07 Thread Kirk Brooks via 4D_Tech
Nigel,

I went through a similar process several years ago when I changed the
compile settings on a rather extensive database to 'all variables are
typed.' I forget the number but it was a lot. Daunting.

I forget how much time I spent on it but it turned out to be much less than
I thought it would and the overall improvement in the stability and quality
of the project was substantial and I've never regretted it.

As Tim suggested those are 69k instances where 4D is making a guess about
what's going on. As you start specifying some loose ends they decrease
dramatically. A single variable not typed could cause several dozen such
errors which all go away as soon as it's corrected, for instance. So that
number drops rapidly once you get going.

Vincent's 4DPOP macro module (I think) includes a macro called
'Declarations' - you can run this inside of a method and it will find all
the local vars, let you set the types and then write the declarations.

On Fri, Apr 7, 2017 at 1:30 AM, Nigel Greenlee via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> ​...
>  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
>

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**
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
**

RE: 4D Compiler

2017-04-07 Thread Timothy Penner via 4D_Tech
69,000 typing errors will not necessarily require 69,000 code modifications...

For example, if you have an untyped variable $a in a method, and in that method 
you use the variable 100 times. With 'all variables are typed' this would be 
reported as 100 typing errors. If you type that variable at the top of that 
method then compile again then the 69,000 would be reduced by 100. So don't let 
the 69,000 errors scare you, it may be much less!

The 4D compiler is trying to warn you about coding mistakes, it is better to 
fix those coding mistakes rather than ignore them. 
http://kb.4d.com/assetid=50223

-Tim



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

Re: 4D Compiler

2017-04-07 Thread Herr Alexander Heintz via 4D_Tech
This is where strict variable nomenclature with typing info helps a lot.
You can easily create a method that can gather all locals in a piece of code, 
and add the declarations at the top of a method.
You can even apply that automatically using METHOD GET CODE and METHOD SET CODE.
OTOH if you have no variable nomenclature with typing…
69000 typing errors.
Forget it, seriously...

> Am 07.04.2017 um 18:29 schrieb Timothy Penner via 4D_Tech 
> <4d_tech@lists.4d.com>:
> 
> Nigel,
> 
>> I tried David Adams suggestion of trying ‘all vars are declared’ and at 
>> 69000 errors decided that was not the way to go!
> 
> You really should try to fix those...That is 69,000 places that 4D is 
> guessing what the variable type should be - instead of you explicitly telling 
> 4D what the variable type should be. All you need to do is use C_TEXT or 
> C_LONGINT or C_* at the top of your methods to declare what the variables 
> are. This is the best practice after all.
> 
> Just my 2 cents.
> 
> -Tim
> 
> 
> 
> **
> 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
**

RE: 4D Compiler

2017-04-07 Thread Timothy Penner via 4D_Tech
Nigel,

> I tried David Adams suggestion of trying ‘all vars are declared’ and at 69000 
> errors decided that was not the way to go!

You really should try to fix those...That is 69,000 places that 4D is guessing 
what the variable type should be - instead of you explicitly telling 4D what 
the variable type should be. All you need to do is use C_TEXT or C_LONGINT or 
C_* at the top of your methods to declare what the variables are. This is the 
best practice after all.

Just my 2 cents.

-Tim



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

Re: 4D Compiler

2017-04-07 Thread Chip Scheide via 4D_Tech
anywhere you may use:
- Execute Formula
- other means of indirect code execution. Method(s), code stored in 
data for example

On Fri, 07 Apr 2017 09:30:38 +0100, Nigel Greenlee via 4D_Tech wrote:
> Can anyone think of other examples where a var might be used in a way 
> that does not show up in forms/methods/scripts?
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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
**

Re: 4D Compiler

2017-04-07 Thread Chip Scheide via 4D_Tech
Not copyable is not exactly true  ;)

On Thu, 06 Apr 2017 20:34:59 -0500, Tim Nevels via 4D_Tech wrote:
> 
>>> When he wrote 4D Compiler back in 1990 I thought he was a 
>>> programming god... 
>> 
>> So did ACIUS, given the original pricing.
> 
> I don’t remember the 4D Compiler 1.0 price. Was it $999?  I do 
> remember that you got 4D Compiler on a floppy diskette that was a key 
> disk you could not copy. I remember having to pass that disk around 
> at the place I worked whenever anyone wanted to compile and it asked 
> for the diskette.
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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
**

Re: 4D Compiler

2017-04-07 Thread Nigel Greenlee via 4D_Tech
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 

Re: 4D Compiler

2017-04-07 Thread Nigel Greenlee via 4D_Tech
Tim

I bow to your knowledge on this. I only go back as far as version 2.5 of 4D and 
in my first year of work did not have the compiler. I suspect there is little 
of the original David Hemmo code in the current compiler now. 

> On 7 Apr 2017, at 02:34, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
>> On Apr 6, 2017, at 7:52 PM, Lee Hinde wrote:
>> 
>> On Apr 6, 2017, at 3:09 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>>> 
>>> I wonder whatever happened to the original 4D Compiler writer David Hemmo?
>> 
>> David’s at Apple now.
> 
> I wonder what group he works in. You think he’s in the group that works on 
> compilers, LLVM, Clang and all the super low level stuff?
> 
>>> When he wrote 4D Compiler back in 1990 I thought he was a programming 
>>> god... 
>> 
>> So did ACIUS, given the original pricing.
> 
> I don’t remember the 4D Compiler 1.0 price. Was it $999?  I do remember that 
> you got 4D Compiler on a floppy diskette that was a key disk you could not 
> copy. I remember having to pass that disk around at the place I worked 
> whenever anyone wanted to compile and it asked for the diskette.
> 
> Tim
> 
> 
> Tim Nevels
> Innovative Solutions
> 785-749-3444
> timnev...@mac.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
**

Re: 4D Compiler

2017-04-06 Thread Tim Nevels via 4D_Tech
> On Apr 6, 2017, at 7:52 PM, Lee Hinde wrote:
> 
> On Apr 6, 2017, at 3:09 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
>> 
>> I wonder whatever happened to the original 4D Compiler writer David Hemmo?
> 
> David’s at Apple now.

I wonder what group he works in. You think he’s in the group that works on 
compilers, LLVM, Clang and all the super low level stuff?

>> When he wrote 4D Compiler back in 1990 I thought he was a programming god... 
> 
> So did ACIUS, given the original pricing.

I don’t remember the 4D Compiler 1.0 price. Was it $999?  I do remember that 
you got 4D Compiler on a floppy diskette that was a key disk you could not 
copy. I remember having to pass that disk around at the place I worked whenever 
anyone wanted to compile and it asked for the diskette.

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.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
**

Re: 4D Compiler

2017-04-06 Thread Kirk Brooks via 4D_Tech
Tim,
That's probably an inflation-adjusted number. Which makes the first 128k
Mac I bought in April of '84 the equivalent of about $6,700 now. Still not
the most expensive computer I've personally bought - that was a Mac II with
an 80mb drive and I don't remember how much RAM. 4MB of RAM back then was a
lot of money.

I remember doing 4D on an SE too. Jeesh.

On Thu, Apr 6, 2017 at 3:09 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> I just checked wikipedia and it says the Mac SE/30 with 4MB or RAM and
> 80MB hard drive was $6,569! I don’t remember them being that expensive.
> Makes the machines today look dirt cheap!
>

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**
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
**

Re: 4D Compiler

2017-04-06 Thread Lee Hinde via 4D_Tech
On Apr 6, 2017, at 3:09 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> I wonder whatever happened to the original 4D Compiler writer David Hemmo?
> 


David’s at Apple now.


> When he wrote 4D Compiler back in 1990 I thought he was a programming god... 


So did ACIUS, given the original pricing.


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

Re: 4D Compiler

2017-04-06 Thread Douglas von Roeder via 4D_Tech
Tim:

Great info - many thanks for the explanation.

"I just checked wikipedia and it says the Mac SE/30 with 4MB or RAM and
80MB hard drive was $6,569! I don’t remember them being that expensive.
Makes the machines today look dirt cheap!"

The SE/30 was a great little machine. The PDS card had expansions slots. I
don't think I used an accelerator card but I know I had an ethernet card
and a video card for my 19" (black and white) CRT monitor.

The $6k figure sounds like current dollars but, yes, the Mac was an
expensive computer to purchase though the lifecycle cost made it a no
brainer purchase.  In the past few days, we've seen postings from folks who
are using laptops that are 7+ years old that are still being used to write
software.


--
Douglas von Roeder
949-336-2902

On Thu, Apr 6, 2017 at 3:09 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> On Apr 6, 2017, at 4:43 PM, Douglas von Roeder wrote:
>
> > 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".
>
> If you are letting 4D do the variable typing then the first phase is to
> scan every method and create a list of all variables and their types. If
> you are typing all variables then it first looks at the “Compiler…” methods
> for variable typing.
>
> It also has to type all parameters for methods. So if you let 4D do all
> the typing it has to scan all methods looking for $1, $2, etc and types
> them. If you are doing the typing then it gets this info from “Compiler…”
> methods.
>
> Then you have local variables to deal with. Could be it builds this typing
> list when it is scanning all the methods. Could be during all this typing
> scanning it does some syntax checking along the way instead of waiting
> until the last step.
>
> I think the 4D Compiler is very optimized. As it is processing as soon as
> an uncertain situation occurs it bails. No need to scan the whole structure
> every time if an uncertain situation could have cascading effects. So
> that’s why when you fix some errors and compile again you can get a whole
> new set of errors you didn’t get the first time. And this explains why
> sometimes the number of errors increase with each compile instead of go
> down.
>
> I’m sure it would be extremely difficult to have the compiler show every
> possible error when it compiles each time. I think it is doing the best
> that it can do and as they say “it is what it is”.
>
> I wonder whatever happened to the original 4D Compiler writer David Hemmo?
>
> When he wrote 4D Compiler back in 1990 I thought he was a programming god
> to be able to build all that machine code and hook it all together to make
> something that actually worked. And then to update 4D Compiler to support
> 68K machine code, PPC machine code, Intel machine code, and variances
> between Mac OS and Windows OS. To me that

Re: 4D Compiler

2017-04-06 Thread Tim Nevels via 4D_Tech
On Apr 6, 2017, at 4:43 PM, Douglas von Roeder wrote:

> 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".

If you are letting 4D do the variable typing then the first phase is to scan 
every method and create a list of all variables and their types. If you are 
typing all variables then it first looks at the “Compiler…” methods for 
variable typing.

It also has to type all parameters for methods. So if you let 4D do all the 
typing it has to scan all methods looking for $1, $2, etc and types them. If 
you are doing the typing then it gets this info from “Compiler…” methods. 

Then you have local variables to deal with. Could be it builds this typing list 
when it is scanning all the methods. Could be during all this typing scanning 
it does some syntax checking along the way instead of waiting until the last 
step. 

I think the 4D Compiler is very optimized. As it is processing as soon as an 
uncertain situation occurs it bails. No need to scan the whole structure every 
time if an uncertain situation could have cascading effects. So that’s why when 
you fix some errors and compile again you can get a whole new set of errors you 
didn’t get the first time. And this explains why sometimes the number of errors 
increase with each compile instead of go down. 

I’m sure it would be extremely difficult to have the compiler show every 
possible error when it compiles each time. I think it is doing the best that it 
can do and as they say “it is what it is”. 

I wonder whatever happened to the original 4D Compiler writer David Hemmo?

When he wrote 4D Compiler back in 1990 I thought he was a programming god to be 
able to build all that machine code and hook it all together to make something 
that actually worked. And then to update 4D Compiler to support 68K machine 
code, PPC machine code, Intel machine code, and variances between Mac OS and 
Windows OS. To me that is some serious programming skill and ability.

I remember the first time I ran 4D Compiler 1.0 on a structure. It had over 
4,000 errors! I worked all day to get that number down to the hundreds. A lot 
of code had to be rewritten due to variable retyping issues. I probably tried 
to compile 20 times that day. But by the second day I had a compiled structure 
that ran on my Mac SE/30. 

I just checked wikipedia and it says the Mac SE/30 with 4MB or RAM and 80MB 
hard drive was $6,569! I don’t remember them being that expensive. Makes the 
machines today look dirt cheap!

Tim


Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.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
**

Re: 4D Compiler

2017-04-06 Thread Douglas von Roeder via 4D_Tech
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 

Re: 4D Compiler

2017-04-04 Thread David Adams via 4D_Tech
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
// 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
**

Re: 4D Compiler

2017-04-04 Thread Charles Miller via 4D_Tech
On Tue, Apr 4, 2017 at 12:23 PM, Nigel Greenlee via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Chuck
>
> Yep thats pretty much what i am figuring..but I was just curious if anyone
> know what the 'trigger points’ that cause it to give up are-if we knew what
> they were we could clear up those errors first(I have been at this one all
> day today and most of yesterday)
>

If it was closer to the decade I was doing real computer science stuff I
might have been better able to tell you, but alas that stuff has all passed
me by

Regards

Chuck


-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Sever connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**
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
**

Re: 4D Compiler

2017-04-04 Thread Nigel Greenlee via 4D_Tech
Chuck

Yep thats pretty much what i am figuring..but I was just curious if anyone know 
what the 'trigger points’ that cause it to give up are-if we knew what they 
were we could clear up those errors first(I have been at this one all day today 
and most of yesterday)

Nigel Greenlee

> On 4 Apr 2017, at 17:19, Charles Miller via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:y a
> 
> On Tue, Apr 4, 2017 at 12:05 PM, Nigel Greenlee via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> Just out of curiosity does anyone know why the compiler does this(its a
>> long time since i have had more than 2 errors in the compiler because i
>> compile everytime i change a piece of code to check for syntax before i
>> even test it)
> 
> 
> I would think that at times when compiler hits an error it can not go
> further down that path of logic, so it can not report errors later in that
> code
> 
> Regards
> Chuck
> 
> 
> -- 
> -
> Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
> Informed Solutions, Inc.
> Brookline, MA 02446 USA Registered 4D Developer
>   Providers of 4D, Sybase & SQL Sever connectivity
>  http://www.informed-solutions.com
> -
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption
> from disclosure as to this communication.
> **
> 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
**

Re: 4D Compiler

2017-04-04 Thread Charles Miller via 4D_Tech
On Tue, Apr 4, 2017 at 12:05 PM, Nigel Greenlee via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Just out of curiosity does anyone know why the compiler does this(its a
> long time since i have had more than 2 errors in the compiler because i
> compile everytime i change a piece of code to check for syntax before i
> even test it)


I would think that at times when compiler hits an error it can not go
further down that path of logic, so it can not report errors later in that
code

Regards
Chuck


-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Sever connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**
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 Compiler

2017-04-04 Thread Nigel Greenlee via 4D_Tech
Hi

I have always been curious-but really never had to see this in this way. 

I am currently updating a system which has never been compiled-not with a view 
to compiling but to clear up syntax errors. So i started with some number of 
errors(somewhat north of 100)…i cleared some stuff..and then suddenly i had 
some more errors.

In the past I always thought this was because errors of one type had been 
cleared(ie. syntax) and now it could see bad assignments. But in this case it 
was not so..and the errors now reported are probably more significant

Just out of curiosity does anyone know why the compiler does this(its a long 
time since i have had more than 2 errors in the compiler because i compile 
everytime i change a piece of code to check for syntax before i even test it)


Nigel Greenlee



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