Wait...
```json
["content", "Apps"],
["k", "32267"],
```
Do they know that JSON arrays are not position-guaranteed across parsers? xD Uh oh.
I am also not a fan of profile lists in the tag itself. That can easily become stupidly bloated - event size is not exactly unimportant - for storing, parsing and indexing.
Would rather see a "root of truth" event with references (p, e) to more details; we already have a list kind, use that for profiles. And there are application-specific storage events, those can be used for "configuration".
Just squishing everything into one event leads to unneccessary complexity and loss of type-safety.
```go
type Event struct {
Id string
Kind int
}
type Community struct {
Name string
Owner Pubkey
// ...
}
func NewCommunityFromEvent(Event e) (Community, error)
```
This approach is cleaner, allows the constructor to go fetch adjacent events, and properly return an error if there is one.
In doing so ("root of source"), you also allow reusability of components.
Don't overstuff one event. If you want this approach, please look at Matrix and it's m.room event type, and then go to m.device next. You will understand what I mean. x)
View article →