Closed alperkocatas closed 1 year ago
This is a bug.
The implementation for Queue::first
can ultimately be found in the file org.modeldriven.alf/Libraries/alf/Alf/Library/CollectionClasses/Impl/QueueImpl.alf
:
protected firstImpl(): any[0..1] {
this.content->First();
}
The statement in the body of this operation should obviously begin with return
. When this change is made, your sample code runs as expected.
This is now fixed in commit c3b5d77 on the maintenance branch, if you would like to try it out.
Thanks a lot, I have applied the suggested fix to my version and it worked. I am closing the issue as it is fixed with the new commit.
I would prefer to leave the issue open until the fix is included in a production release.
Resolved in Release 1.1.0l.
I am trying to use the Queue data structure in Alf, with the reference implementation. I can insert and remove elements from the queue, however, when I want to peek the queue using the "first" function, the value returned is null.
Here is a test code which demonstrates the problem:
Output from executing the code is:
I wonder if this is the expected normal behavior, or is this a bug?
Thanks.