As workers and call form are in the air today, I thought that I'd point out
a small detail that some people may like a lot. As we know, 4D doesn't
partition code or scope variables like other languages. Sometimes this
makes us pout. The worker system provides a few helpful wrinkles. Well, you
could use the same idea elsewhere, but I'll restrict myself to workers.

Imagine that you've got a worker that scans folders for some reason.
Cleanup, drop folders, whatever. The worker is called "FolderScan". Now
lets say that you have a bunch of methods that you want to run _only_ in
the context of that worker. Easy:

If (Process_GetName ="FolderScan")
  // Do whatever
Else
  // Record error
End if

Done. You've now scoped methods to run only in the context of part of the
program at the cost of a single if construct. Since the test is based on
the worker (process) name, you can do fancier things to allow, for example,
multiple instances of a single worker type. Say you've got a worker that
handles different categories of employees - say you've got three:

Employees_FullTime
Employees_PartTime
Employees_Contract

...those are three different workers, each seeded with different starting
data. So, three instances. But you want each of them to be able to run the
same core methods:

If (Process_GetName ="Employees_@")
  // Do whatever
Else
  // Record error
End if

etc.

Again, not really a new option - and not necessarily a game-changer. Still,
it's got some nice uses and I figured I'd point this out for anyone that
likes this sort of thing.
**********************************************************************
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