|
I think these warnings are just what you'd expect.
The first warning simply means that it is not known whether or not teamDevelop.tasks is readonly (and you're not allowed to invoke Add on a readonly collection). I don't know how you would like to ensure that teamDevelop.tasks is not readonly.
One possibility would be to add it as a precondition of createNewTask, but it may be better to try to add something to the object invariant of TeamDevelop.
The second warning simply means that the effect of Add is not allowed in createNewTask. One possible way to resolve this is to add teamDevelop.tasks to the modifies clause of createNewTask (I'm assuming "tasks" is probably declared with [Peer]).
For your application, I can't determine if the suggestions I made here are the design decisions you want, so you may need to give it some thought or experiment a bit until you figure out what design you want.
By the way, the Task constructor puts the "t" parameter into the "developer" field, which is declared with [Peer]. An alternative to declaring "t" with [Captured], you may want to consider declaring the Task being constructed as [Captured]. I
think (hope) there is a section in the Spec# Tutorial that explains how to do this and the pros and cons.
Rustan
|