Subject Re: [IB-Architect] Declare Variables as Domains
Author Jim Starkey
At 08:02 PM 12/12/01 +1100, Helen Borrie wrote:
>>How about declaring vars as domains
>>declare variable i1 domain_integer;
>My view - it would be a "nice to have" but not an earth-shaker. I can see
traps that don't exist with system-defined data types, e.g. domains can be
altered, so it adds one more area of dependency, one more area of
performance hit in SPs
>I'd suspect an ODS change might be required, too. Wolf?

I was going to stay out of this one, but since I've been asked ...
here are some thoughts.

The trend in programming languages is against "batch" declarations
of variables for a couple of reasons. Java, for example, supports
them but the "authorities" discourage their use. Theoretical and
aesthetic arguments aside, the pragmatic reason is that defering
the declaration until first use, necessarily an assignment, is a
better way of writing programs. So rather than writing:

int foo;
blah blah blah
foo = 42;

one would write

blah blah blah
int foo = 42;

Done this way, multiple variable declaration is as best pointless
and probably bad.

But on use the of global variable based variables, I applaud it
wholeheartedly. From the very dawn of time (yea, even before the
first line of engine code was typed on the Pro-350) GPRE supported
variations on "declare foo based_on bar" where "bar" was a global
variable. The practice is excellent for both clarity and maintainability.

As to implementation problems, I haven't a clue; I didn't write that
code. I doubt that anything like an ODS change would be required.
But do remember that the stored procedure corner was designed and
implemented by the Raspellians who built in politically/correct.

Jim Starkey