At the very least, I think it would be really helpful for documentation. I recently implemented DB::Serializable
for crystal-db
and I noticed that the only way to really describe the possible parameters for the annotation is through manually listing them inside a doc comment. Personally, I think it would’ve been much cleaner to do something like
module DB
annotation Field(ignore : BoolLiteral = false, key : StringLiteral | NilLiteral = nil, converter : TypeNode | NilLiteral = nil)
end
and have crystal doc
create some kind of documentation for it. At that point, I see no reason not to typecheck.