Add a more functional (i.e. fewer-stubs) implementation of System.Data.Linq.
[mono.git] / mcs / docs / ecma334 / 14.16.xml
1 <?xml version="1.0"?>
2 <clause number="14.16" title="Boolean expressions">
3   <paragraph>A <non_terminal where="15.7.1">boolean-expression</non_terminal> is an expression that yields a result of type <keyword>bool</keyword>. <grammar_production><name><non_terminal where="15.7.1">boolean-expression</non_terminal></name> : <rhs><non_terminal where="14.14">expression</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>The controlling conditional expression of an <non_terminal where="15.7.1">if-statement</non_terminal> (<hyperlink>15.7.1</hyperlink>), <non_terminal where="15.8.1">while-statement</non_terminal> (<hyperlink>15.8.1</hyperlink>), <non_terminal where="15.8.2">do-statement</non_terminal> (<hyperlink>15.8.2</hyperlink>), or <non_terminal where="15.8.3">for-statement</non_terminal> (<hyperlink>15.8.3</hyperlink>) is a <non_terminal where="15.7.1">boolean-expression</non_terminal>. The controlling conditional expression of the ?: operator (<hyperlink>14.12</hyperlink>) follows the same rules as a <non_terminal where="15.7.1">boolean-expression</non_terminal>, but for reasons of operator precedence is classified as a <non_terminal where="14.11">conditional-or-expression</non_terminal>. </paragraph>
5   <paragraph>A <non_terminal where="15.7.1">boolean-expression</non_terminal> is required to be of a type that can be implicitly converted to <keyword>bool</keyword> or of a type that implements operator true. <note>[Note: As required by <hyperlink>17.9.1</hyperlink>, any type that implements operator true must also implement operator false. end note]</note> If neither requirement is satisfied, a compile-time error occurs. </paragraph>
6   <paragraph>When a boolean expression is of a type that cannot be implicitly converted to <keyword>bool</keyword> but does implement operator true, then following evaluation of the expression, the operator true implementation provided by that type is invoked to produce a <keyword>bool</keyword> value. </paragraph>
7   <paragraph>
8     <note>[Note: The DBBool struct type in <hyperlink>18.4.2</hyperlink> provides an example of a type that implements operator true and operator false. end note]</note>
9   </paragraph>
10 </clause>