Hi Rob,
Reasonable questions.
(Pull the latest comment branch where I have tried to answer them and allow named return annotation.)
Also inline here, with more detail:
Q1. Re "why 0 on that line"?
The "result 0 imm" is saying that the first (0-th) return value should have an \imm ownerstamp.
As a Go func can have dozens or more return values, and they can be all named or all un-named,
this syntax is a regular and uniform way to indicate which of the return arguments the
ownerstamp annotation should apply to.
In this case it is the first return value. We are simply numbering the unnamed arguments, starting from 0.
I'm open to suggestions if you have a more intuitive syntax, but this is the best I have come up. This is
the klunky part I mentioned before.
If we had in .gown a
func f() (answer \iso *int) { ...
then we could have .go comment format as:
//gown: result answer iso
func f() (answer *int) { ...
here are some more examples from vector/ex4/main.go which I added to illustrate:
// gown: result answer iso
func f() (answer *bicycle) {
return &bicycle{} //gown:new
}
// gown: result answer iso
func ff() (anum int, answer *bicycle) {
return 7, &bicycle{} //gown:new
}
// gown: result 0 iso
func g() *bicycle {
return &bicycle{} //gown:new
}
// gown: result 1 iso
func h() (int, *bicycle) {
return 12, &bicycle{} //gown:new
}
// gown: result 2 iso
func gg() (int, int, *bicycle, string) {
return 1,
2,
&bicycle{}, //gown:new
"this string is last"
}
// gown: result 3 iso
func ggg() (int, int, string, *bicycle) {
return 1, 2, "new bikes are fun", &bicycle{} //gown:new
}
Q2. I don't understand why you declare fmt.Printf to be an observer. What should be declared an observer and why?
First, did you read the description and current documentation of observers and not understand it? If so, how can it be improved? If not, here is what is in the tutorial to begin with:
README.md line 524:
| `\\\\observer` | designate access (e.g. \rob fmt.Printf) as safe | avoids changing stdlib |
line 654:
## `\\\\observer`
For example, the `\\\\observer fmt.Printf` stand alone comment is used to designate the
debug helpers like fmt.Printf are doing read-only borrows and should not cause alarm.
The observer annotation turns off strict checking on a per-function basis. This is a practical affordance to avoid having to annotate the declarations of the standard "fmt" library.
To summarize, if we do not annotate Printf as an innocuous observer, then it will terminate Gown's proof of for iso uniqueness;
because we cannot otherwise know that it does not store or send away the pointer on a channel.
Since fmt.Printf are frequently used simply for debugging, we do not want the debug prints to accidentally create false alarms about use of iso after proof has been terminated. You can try simply removing the observer annotation to see what Gown reports as an error otherwise. Typically something like:
gown/vectors/ex4/main.go:57:26: GWN008: cannot pass \iso value "a" to untracked parameter
fmt.Printf("a='%#v'\n", a)
^
On Tuesday, June 9, 2026 at 8:42:50 AM UTC-3 Robert Solomon wrote:
I don't understand why the comment below says "result 0 imm". Why the 0 in that line?
And, I don't understand why you declare fmt.Printf to be an observer. What should be declared an observer and why?
//gown: param goner iso; param spare rob; result 0 imm
func puncture(goner *wheel, spare *wheel) *report {}
//gown:observer fmt.Printf
//gown:iso
//gown:clone
//gown:new
//gown:swap
comment branch to attempt to imporove usabiltyThat's a typo that should be improve.