This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Dominant Value Expressions =head1 VERSION Maintainer: Glenn Linderman <[EMAIL PROTECTED]> Date: 24 Sep 2000 Mailing List: [EMAIL PROTECTED] Number: 356 Version: 1 Status: Developing =head1 ABSTRACT An aid to determining if an input value has an impact on the result of an expression whole program. Can also be used for Perl poetry. =head1 DESCRIPTION This is an optional feature; to turn it on, "use domination;" is suggested. When use domination is in scope, two new functions are available, and new rules for expression evaluation obtain. Each of these is described in a subsection below. =head2 Domination pragma The "use domination;" pragma enables the rest of the functionality. It should be scoped, affecting the current and nested blocks. The "no domination;" pragma would turn off the effect of "use domination;" for the current and nested blocks. If a dominant value is encountered while "no domination;" is in effect, it is treated as "undef" by all scalar operators. =head2 Dominant function The dominant function takes a scalar argument, which is considered to be a weight parameter. The scalar argument is converted to numeric, if possible, with the resultant positive weight parameter producing a dominant value with that given weight. A scalar argument that cannot be automatically converted to numeric, or that produces a negative or zero numeric value produces undef as a result. =head2 Weight function The weight function takes a scalar argument. If the scalar argument is a dominant value, it returns its weight as a positive number. If the scalar argument is not a dominant value, the return of the weight function is zero. =head2 Expressions involving dominant values All scalar operations are affected by the presence of dominant values. If a scalar operation involves one or more dominant values, the result of the operation is the heaviest (by weight) dominant value among the operands. If no dominant values are supplied to the operation, the result of the operation is the same as it would be according to the usual definition of the operation. =head1 COMPATIBILITY New functionality, no compatibility issues. The new functionality only obtains if the "use domination;" pragma is in effect. =head1 IMPLEMENTATION The impact of dominant value expressions is pervasive, affecting all builtin scalar operators in a minor way. Any operators doing item by item operations on each scalar of a list or hash would be similarly affected (various RFCs exist for extending scalar operations to work on lists of values in "corresponding item" fashion). =head1 REFERENCES RFC 263: Add null() keyword and fundamental data type