Ver Mensaje Individual
  #2  
Antiguo 18-08-2005
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Esto puede interesarte:

Cita:
> Apparently, Boolean short-circuit evaluation is not used when either or
> both of the operands is a Variant.

Correct. I suspect Borland would say this behavior is "as designed." I can
see arguments that say if the left-hand operand is a Boolean whose value is
False, the right-hand operand should not be evaluated even if its type is
Variant. On the other hand, operations on Variants are converted into
function calls that forcibly cast the two operands into Variants of
compatible types, and then perform the operation. This means the Boolean
value is converted to a Variant whose type is varBoolean. Both operands
must be evaluated.

The former preserves Boolean short-circuit logic, and is the least
surprising result for someone who uses Boolean short-circuit a lot and
Variants a little.

The latter preserves uniform Variant logic, and is the least surprising
result for someone who regularly uses Variants and intuitively understands
the automatic casting that takes place.

I see no way to preserve both points of view. Borland chose the latter. I
wouldn't expect them to change any time soon (or ever), but you are of
course, free to submit a bug report.
--
Ray Lischner (http://www.tempest-sw.com)
// Saludos
Responder Con Cita