Please forgive a digression on coding style.

> From: Wjhonson 
> By the way, the point of selecting out to a list and then
readnexting
> from that list, for those who are virgins, is that two selects in
one
> program, are almost always prevented from stepping on each other's
> toes.

Are you talking about SELECT FV1 TO LISTX followed by SELECT FV2 TO
LISTX?
That's the reason for the CLEARSELECT statement. 

Re-using a variable is perfectly reasonable for many reasons. Re-using
a variable because you're not sure if its state is awkward.

The word "almost" above is either an error or feigned insight. In
either case, I don't like anything in code "almost" working.

Some code is structured such that the management of the flow is
explicitly controlled. Some code is written to cover for situations
where it is not aware of the current state, so it attempts to
compensate.

I prefer the former to the latter. If you're not sure of the "state"
of processing at some point in the code then you can only guess what's
happening, and you could miss options. "State management" is a
development technique that precludes many kinds of errors, and unusual
or unnecessary workarounds. There are times when you legitimately may
not know exactly what the code is doing, where the code is not aware
of its execution state, but this should not be by design.

For the above situation, you're either actively reading through a
list, or you've made a logical choice to stop using that list. When
that choice is made, clear the variable if you intend to re-use it -
even if not. This way you're not re-using the same variable "just in
case" it was already in some prior state, and if your code does happen
to fall into a different path of logic, maybe from a later mod, the
list won't accidentally be active with IDs from another selection. If
that doesn't fit your code logic, use a state variable that identifies
the selection currently active, and reset that variable when the list
is exhausted or when you have chosen to stop using it. Check the
variable before using the list to ensure it's in the proper state.

This is the kind of thing that separates amateurs from pros - sorry if
it offends anyone, but it is what it is, and I prefer posting
something like this to the technique that was offered.

Being a non-virgin doesn't mean you know how to, uh, do it.  ;)

T

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to