Opened 11 years ago
Closed 11 years ago
#2873 closed enhancement (fixed)
Implement for-loop for arrays
| Reported by: | Per Östlund | Owned by: | Martin Sjölund |
|---|---|---|---|
| Priority: | high | Milestone: | Bootstrapping |
| Component: | MetaModelica | Version: | trunk |
| Keywords: | Cc: |
Description (last modified by )
It would be nice to be able to loop over arrays in the bootstrapped compiler, similar to how it's possible to loop over lists. E.g.:
array<T> someArray; algorithm for e in someArray loop // Some code end for;
Change History (5)
comment:1 by , 11 years ago
| Description: | modified (diff) |
|---|---|
| Summary: | Implemented for-loop for arrays → Implement for-loop for arrays |
follow-up: 3 comment:2 by , 11 years ago
comment:3 by , 11 years ago
Replying to adrpo:
case (a[1] as "blah") then something;
Looks very bad. I read this as
match str case "blah" algorithm a[1] := "blah"; then something;
comment:4 by , 11 years ago
This is possible though:
_ := match(a[1]) case "blah" then something; end match;
comment:5 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed in r22702 (none of the pattern-matching on array elements as it should not be needed in the bootstrapped compiler).
Note:
See TracTickets
for help on using tickets.

Also would be nice to have pattern matching on the array elements, not the entire array, i.e.