> >
> > We all have, don't we:) Consider this on load/init etc of a form base class:
> >
> >
if not "SOMEPROCFILE" $ set("procedure")
> > set procedure to someprocfile additive
> > endif
> >
> > No error makes it a harder to catch problem:)
> > Cetin Basoz
>
> Hi Cetin,
>
> Apoligies for dagging up an old thread, but I was just wondering why you find this to be bad?
>
> Would you prefer to just have:
>
> set procedure to someprocfile additive
>
>
> regardless of whether the procedures are already available or not?
> I wouldn't consider either to be "bad", and when it comes down to it, I'd prefer to see:
>
>
if not "SOMEPROCFILE" $ set("procedure")
> set procedure to someprocfile additive
> endif
>
> At least it shows that the programmer is considering that the procedures may or may not be available.
>
> Brian
Brian,
First of all using "set procedure ... additive" is bad by itself. Because one who uses that should be on his toes to know what procedure files are already open and in which order. When two procedure files have the same procedure (and worse the same procedure exists as a stored procedure in a database which maybe the curent one) which one would be called?
Next with a code like:
if not "SOMEPROCFILE" $ set("procedure")
set procedure to someprocfile additive
endif
your probable intention is to set someprocfile.prg as a procedure file. Try this:
set procedure to SomeProcFiles
if not "SOMEPROCFILE" $ set("procedure")
set procedure to someprocfile additive
endif
Would it work and set procedure to "SomeProcFile" as you expected? It wouldn't give any error and you'd think it did work. It is simple beginner's pitfall (and might never occur for the lucky programmer). I mean its success is based on luck.
Cetin Basoz