>
> On Mon, Apr 10, 2017 at 5:24 AM, Sannyasin Siddhanathaswami via 4D_Tech
> <[email protected]> wrote:
> Aloha,

Howzit? By the way, do you go by Sannyasin or Siddhanathaswami? (I've
always seen Sannyasin used as a title/honorific, but I don't know in your
case.)

> Thanks for the tip. Tons and tons of errors in the first run of Check
Syntax
> in the compiler. It is nice that it highlights the line numbers/issues in
an
> open method. The errors though are mostly or all, “The Variable xxx has
not
> been explicitly declared in the typing methods.” As I don't need/want to
> compile,  how do I use this to my advantage? Are you saying I should add
> declarations to the compiler method for all variables?

Yes. Well, all parameters, process, and interprocess variables. Locals need
to be declared in the method. I set my compiler methods up like this:

Compiler_Module

So, for the 'Accounts' module:

Compiler_Accounts

I then have three sections in the method:

Variables
Arrays
Parameters

Why do it like this?

* I can move modules between databases (perhaps of no use to you).
* I always know right where to look.
* It helps me maintain the practice of deciding what module "owns" any bit
of code or data.
* The methods don't usually get too long or unwieldily.

> What I’d really like, is to have only typing errors within a method
> highlighted.
>
> For example, in the method I’m working on, my first lines are:
> C_TEXT($0)
> C_TEXT($1)
>
> This give an error saying these variables are not declare in typing
methods. I
> don’t see how these “errors" highlighted in my code will help with this.

A couple of things come to mind from your post:

* Debugging and reprogramming a live 4D system seems like a super stressful
and risky thing to do to me. What about making a copy of the structure that
you clean up using a single-user development copy?

* $0 and $1 are different than locals. Parameters are subtly different to
locals in a few ways and very different in an important way: they define
how data can go in and out of the method. So, they're not local to the
method - they define the method's interactions. So, it kind of makes sense
to declare them in a Compiler_ method.

* It's not just your imagination: The Compiler_ method system is awkward
and a bit of a pain. It was set up this way in the 1980s and has not
improved since. I see it as a housekeeping nuisance and don't worry about
it too much.

* You're correct: Fixing most of these 'errors' is going to do nothing of
use for you. In a lot of cases, it's just housekeeping with exactly zero
benefit. In other cases, you'll just be making explicit what was working
perfectly implicitly. This task is so daunting now because you've got such
a huge backlog. After that, the process isn't hard. My impression from
people that have shoveled through a pile of errors like yours is that they
were ultimately glad that they did it.

* You _will_ find real bugs. Things like this are subtle:

For ($I;1;$count)
   $value:=$array($l)
End for

As you clear out the nonsense 'errors' and get into the real problems, you
should see some benefits. I always find it humbling to come across
"working" code that has had flaws for years. Even when I've written a bunch
of tests cases, it can still happen. I'm of the school of thought that
thinks writing your own test cases is super likely to lead you to not
thinking of exactly the right cases!

As you get further into it, you'll also probably run into situations
involving multiple methods and shared variables where you have to figure
out what you were thinking (or what someone else was thinking) way back
when. A lot of times, you'll come up with a way of solving the same problem
much more neatly. That always feels good. Of course, be careful about this
sort of work. It's risky just "improving" things. Make notes about what you
find, even if you don't "fix" it. There is a lot of wisdom in the old
phrase "If it ain't broke, don't fix it." Still, the temptation will be
there...

>  Right now it’s crashing on Distinct Values, which I suspect means there
are not
> “distinct” values in the selection.

Have you tested the data file with MSC? Have you tried rebuilding indexes?
**********************************************************************
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