Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 1384

Show
Ignore:
Timestamp:
12/14/09 10:07:21 (15 years ago)
Author:
walter
Message:

bugzilla 3587 Aggregate rule references undefined Tuple

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/statement.dd

    r1383 r1384  
    410410    $(I ForeachType) , $(I ForeachTypeList) 
    411411 
    412412$(GNAME ForeachType): 
    413413    $(B ref) $(I Type) $(I Identifier) 
    414414    $(I Type) $(I Identifier) 
    415415    $(B ref) $(I Identifier) 
    416416    $(I Identifier) 
    417417 
    418418$(GNAME Aggregate): 
    419419    $(EXPRESSION) 
    420     $(I Tuple) 
    421420) 
    422421 
    423422$(P 
    424423    $(I Aggregate) is evaluated. It must evaluate to an expression 
    425424    of type static array, dynamic array, associative array, 
    426425    struct, class, delegate, or tuple. 
    427426    The $(PS0) is executed, once for each element of the 
    428427    aggregate. 
    429428    At the start of each iteration, the variables declared by 
    430429    the $(I ForeachTypeList) 
     
    686685<h3>Foreach over Delegates</h3> 
    687686 
    688687    $(P If $(I Aggregate) is a delegate, the type signature of 
    689688    the delegate is of the same as for $(B opApply). This enables 
    690689    many different named looping strategies to coexist in the same 
    691690    class or struct.) 
    692691 
    693692<h3>Foreach over Tuples</h3> 
    694693 
    695694$(P 
    696     If the aggregate is a tuple, there 
     695    If the aggregate expression is a tuple, there 
    697696    can be one or two variables declared. If one, then the variable 
    698697    is said to be the $(I value) set to the elements of the tuple, 
    699698    one by one. If the type of the 
    700699    variable is given, it must match the type of the tuple contents. 
    701700    If it is not given, the type of the variable is set to the type 
    702701    of the tuple element, which may change from iteration to iteration. 
    703702    If there are 
    704703    two variables declared, the first is said to be the $(I index) 
    705704    and the second is said to be the $(I value). The $(I index) 
    706705    must be of $(B int) or $(B uint) type, it cannot be $(I ref),