Re: FN-FORUM: JavaScript help....
date posted 6th August 2003 17:01
On Wednesday 06 Aug 2003 4:39 pm, Ross Hamilton wrote:
> Dom wrote:
> > On Wednesday 06 Aug 2003 3:55 pm, Dan Norcott wrote:
> >>>> /* Set up boolian variables to record the browser type */
> >>>
> >>> Why booleans?
> >>
> >> So he can do specific stuff maybe? If ie6 then do this, if eskimo2
> >> then do that, etc.
> >
> > Yes, but why Booleans? Booleans are for *independent* yes / no
> > things. You can't be both IE6 and Eskimo2 simultaneously, can you?
>
> There's no reason why Booleans variables *have* to be independent of on=
e
> another.
If you're using Booleans and they're not independent, your analysis is br=
oken.
Take two variables, A & B. If for instance A is always true when B is tr=
ue,=20
you've encoded a four-state system, when there are only three states.
If A cannot be true when B is true, the same.
In this case, there's a 64 state system (six Booleans) to encode a three =
state=20
system (the bit that switches docObj and styleObj three ways - IE4, NS4,=20
none of the above).
At first sight this seems rather perverse, hence my question, why Boolean=
s?
In fact, why not just use the provided appName and appVersion to do what=20
you want? I.e.
=20
// pseudo-code
switch name
case navigator
if version >=3D4
do stuff
else if version >3
do other stuff
case Eskimo
=2E...
--=20
Dom Latter.