I have looked at parser transformations of logical operators
and they are needed to provide short circuit evaluation.
I see the following solutions:
1) declare that 'and' and 'or' are reserved only for Boolean
   arguments, that they have short circuit semantics and
   leave transformations in place
2) make sure that 'and' and 'or' when applied to Boolean
   use short circuit semantics
3) declare that 'and' and 'or' evaluate arguments and
   change algebra to no longer depend on short circuit
   evaluation
4) declare that 'and' and 'or' evaluate arguments but
   introduce new operators with short circuit semantics
   and use them instead of 'and' and 'or'

I admit that 1) looks most attractive for me.

AFAICS 2) can not work really well: if in generic code 'and'
and 'or' would evaluate arguments even if the actual
type is Boolean -- this means change of semantics
between generic case and case of concrete type.
Also, making such distinction just on type basis
introduces ugly irregularity to the language definition.

I consider 3) as inpractical.  Namely, my experience
with Standard Pascal (which specifies full evaluation
of arguments to 'and' and 'or') is that this complicates
programming as one must introduce extra conditionals
to avoid errors in subexpressions that otherwise would
be guarded by circuit evaluation.

Concerning 4), it could work, but I am not sure if
non-Boolean use of 'and' and 'or' is important enough
to take traditional names -- ATM I feel that use
as programming construct is more important.

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to