# Scribble: What is the right way to document a structure property?

**URL:** <https://racket.discourse.group/t/scribble-what-is-the-right-way-to-document-a-structure-property/1016>\
**Category:** Questions & Answers\
**Created:** [May 20, 2022, 10:31pm UTC](https://racket.discourse.group/t/scribble-what-is-the-right-way-to-document-a-structure-property/1016 "2022-05-20T22:31:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [May 20, 2022, 10:31pm UTC](https://racket.discourse.group/t/scribble-what-is-the-right-way-to-document-a-structure-property/1016/1 "2022-05-20T22:31:18Z")

</div>

I'm writing Scribble to document a struct type with an attached property and I'm unsure how to do it. Something like this:

```scheme
(define-values (prop:foo foo-prop? foo-ref)
  (make-struct-type-property 'foo 'can-impersonate))
(struct person (name) #:property prop:foo (delay 7) #:transparent)
(person 'bob)
(force (foo-ref (person 'bob)))

```

When it comes time to document this, I might do something like this:

```scheme
@defstruct*[foo ([name string?])]{A struct type for fooing.}
@defproc[(foo-ref ???) ???]{A func that gets the prop:foo from a struct.}
@defproc[(foo-prop? ???) boolean?]{A func that checks if something is a descriptor or instance of a struct type with prop:foo.}
@def???[prop:foo]{A structure property descriptor.}

```

---

<div class="post-metadata">

**Author:** ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)\
**Post date:** [May 21, 2022, 2:47am UTC](https://racket.discourse.group/t/scribble-what-is-the-right-way-to-document-a-structure-property/1016/2 "2022-05-21T02:47:17Z")

</div>

Looking at the [source code of the Racket Reference](https://github.com/racket/racket/blob/fc41972c9d05510b45f8d3d59407291bbfe10095/pkgs/racket-doc/scribblings/reference/procedures.scrbl#L417), you will see that these `prop:...` are documented with `defthing`. For instance:

```scheme
@defthing[prop:procedure struct-type-property?]

```

I don’t usually see `p-ref` and `p?` being documented. These functions tend to be for internal uses and not exposed to users, so there is usually no need to document them. But if you do want to provide them to users, they would have the straightforward contracts:

```scheme
p-ref :: p? -> <a contract recognizing whatever you store in the property>
p? :: any/c -> boolean?

```

---

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [May 21, 2022, 2:49am UTC](https://racket.discourse.group/t/scribble-what-is-the-right-way-to-document-a-structure-property/1016/3 "2022-05-21T02:49:04Z")

</div>

Aha! Thank you very much.
