# defprotocol
Define a protocol — a set of methods that types can implement.
## Syntax
defprotocol ProtocolName {
method-name {}
method-with-args {arg1 arg2}
}
## Examples
defprotocol Showable {
show {}
format {prefix}
}
defprotocol Measurable {
area {}
perimeter {}
}
# Check what protocols exist echo [protocols] # Get protocol info set info [protocols Showable] echo $info~methods echo $info~types
## Notes
- Protocols are implemented externally via `defimpl` — not in the protocol definition
- A type can implement multiple protocols
- Protocol methods dispatch based on the target value's type
- Use `[satisfies ProtocolName $value]` to check if a value supports a protocol
## See Also
`defimpl`, `defmethod`, `deftype`, `satisfies`