Closed DominicSaladin closed 2 months ago
This one is interesting. The reason why it's read-only today is because the implementation returns the same instance for all calls to this method. Performance wise this is more efficient as it avoids creating multiple copies of the ordinal values.
I see no mention of the fact that it is read-only in our docs however, so we at the very least have a doc defect.
I'm marking it for triage, so the team can examine two things: 1) Should the docs be updated? 2) Should the GetOrdinals() and the GetNames() functions be read-only since this concept does not exist in AL?
Hi, this issue is out of scope of for this repository. You should do one of the following:
As a reminder, this repository only handles issues to do with the compiler or VSCode development experience for AL.
The reason why this is out of scope is because this is a runtime limitation. As far as the compiler is concerned, it's a list of integers and so it's treated as such. We don't have a readonly
concept as mentioned - though such a concept would be beneficial here since then the compiler could actually raise a warning/error in this case. I'm not sure where else we might have readonly
data, but if we run into this problem frequently we can consider introducing the concept.
1. Describe the bug When using
Reverse
on theList of [Integer]
returned byEnum::"My Enum".Ordinals();
the Compiler allows the package building, but BC throws the errorThe requested operation is not supported.
. Is the Ordinals List read-only and if yes, why? For me, it seems like a bug.2. To Reproduce
3. Expected behavior The list gets reversed
4. Actual behavior On runtime the error
The requested operation is not supported.
gets thrown, but the compiler does not detect this error on compilation5. Versions: