Menu

#722 Create a range based 'for' loop

v1.1.x
closed
v1.1.5
New Functionality
2023-02-18
2022-08-03
Erik Hänel
No

Create a range based for loop, which will at least support s.th. like for (i = TABLE(:,1)) and optimal also s.th. like for (i = CLST{:}) for arbitrary contents of CLST{}.

Analysis:

To achieve a basic range based for loop, it might be reasonable to switch to the built-in vector expansion syntax completely. But that might be resource intense compared to the fact that we might also use a custom-built iterator. Furthermore it is necessary to handle the deviations from the original syntax in the parser and the static code analyzer.

Creating an generic range based for loop for non-numerical values might be even more difficult and has to be evaluated during the implementation.

Implementation:

  • Implementation: The new range based for loop has been created as indicated by the analysis. However, to achieve the possibility to iterate over non-numerical values it was necessary to create a specialized function for this kind of loop.
  • Revision: [r1285]
  • Implementation test: Range-based for loops were tested in combination with different scenarios.

Documentation:

  • [x] ChangesLog updated
  • [x] Code changes commented
  • Documentation articles:
    • [x] corresponding documentation articles updated
    • [ ] new documentation articles created
    • [ ] not needed
  • Language files:
    • [x] corresponding language files updated
    • [ ] not needed

Tests:

Range-based for loops were added to the automatic SW tests. No deviations detected.

Related

Commit: [r1285]

Discussion

  • Erik Hänel

    Erik Hänel - 2022-08-12
    • Version: Planned --> v1.1.5
     
  • Erik Hänel

    Erik Hänel - 2022-10-17
    • labels: --> internal, ctrlflow
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2022-11-12
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,23 @@
     Create a range based `for` loop, which will at least support s.th. like `for (i = TABLE(:,1))` and optimal also s.th. like `for (i = CLST{:})` for arbitrary contents of `CLST{}`.
    +
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* [ ] ChangesLog updated
    +* [ ] Code changes commented
    +* **Documentation articles:**
    
    +    * [ ] corresponding documentation articles updated
    +    * [ ] new documentation articles created
    +    * [ ] not needed
    +* **Language files:**
    +    * [ ] corresponding language files updated
    +    * [ ] not needed
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2022-12-01
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,9 @@
     Create a range based `for` loop, which will at least support s.th. like `for (i = TABLE(:,1))` and optimal also s.th. like `for (i = CLST{:})` for arbitrary contents of `CLST{}`.
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +To achieve a basic range based `for` loop, it might be reasonable to switch to the built-in vector expansion syntax completely. But that might be resource intense compared to the fact that we might also use a custom-built iterator. Furthermore it is necessary to handle the deviations from the original syntax in the parser and the static code analyzer.
    +
    +Creating an generic range based for loop for non-numerical values might be even more difficult and has to be evaluated during the implementation.
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2022-12-13
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,19 +6,19 @@
     Creating an generic range based for loop for non-numerical values might be even more difficult and has to be evaluated during the implementation.
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation: The new range based `for` loop has been created as indicated by the analysis. However, to achieve the possibility to iterate over non-numerical values it was necessary to create a specialized function for this kind of loop.
    +* Revision: [r1285]
    +* Implementation test:  Range-based `for` loops were tested in combination with different scenarios.
    
     ###Documentation:
    -* [ ] ChangesLog updated
    -* [ ] Code changes commented
    +* [x] ChangesLog updated
    +* [x] Code changes commented
    
     * **Documentation articles:**
    -    * [ ] corresponding documentation articles updated
    +    * [x] corresponding documentation articles updated
         * [ ] new documentation articles created
         * [ ] not needed
     * **Language files:**
    -    * [ ] corresponding language files updated
    +    * [x] corresponding language files updated
         * [ ] not needed
    
     ###Tests:
    
    • status: implementing --> testing
     

    Related

    Commit: [r1285]

  • Erik Hänel

    Erik Hänel - 2023-02-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -22,4 +22,4 @@
    
         * [ ] not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +Range-based for loops were added to the automatic SW tests. No deviations detected.
    
    • status: testing --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB