3 ms·
> They syntax for annotations on structs are also really distracting to me as well. I really like annotations on structs/struct fields, but I've never seen a s
by gpm 4y ago
> They syntax for annotations on structs are also really distracting to me as well.
I really like annotations on structs/struct fields, but I've never seen a syntax for it that felt quite right.
The ones that I've seen and come to mind are rust's:
#[annotation goes here, always tokenized and usually strictly parsed according to some custom-ish dsl]
go's:
"let's just use a string, parsing is often questionable"
and kotlin/scala/...'s
@SingleIdentHere(Maybe, With, Arguments)
I'm curious if people have other examples, and/or a preference for one.
- neilv 4y agoScheme: (my-syntax-identifier-goes-here (we do not annotate) (we transform syntax))
- elcritch 4y agoAnnotations are very useful, but they're pretty much ugly regardless of the language. Though I like the sibling comment's Scheme version where it's postfixed. I've also come to appreciate Nim's sorta post-name annotation syntax since I can quickly read the name and type at the ends: type MyComponent = object position {.editable, animatable.}: Vector3 alpha {.editRange: [0.0..1.0], animatable.}: float32 I was pondering if languages could provide CSS like annotation. Like #annotate: MyComponent.position { editable }