Most if this is just praising or criticizing syntactical sugar. And it's a weird and manipulative writing style to tell the reader "this is how you need to do it" followed by examples that don't even compile - simply to include some oh so bad compiler errors.
Why does the author seem surprised when his code doesn't compile after adding a non-optional parameter? It's arguable whether parameters should be optional by default or mandatory by default. Not really knowing much about c# I guess anything besides primitives will be `null`, which doesn't seem like you gain much.
I'm not sure I have ever seen annotation used like in this `whenType` example. Besides that the whole approach looks suspiciously complex (why not just create `@DefaultPriority` which you can add to your type?), annotations are supposed to be simple meta data and you shouldn't be trying to implement some kind of logic with them. Any logic like this should be done when processing the annotation in my opinion.
Java annotations sure are limited and it's does seem kind of weird that you can't use null as default value. But I never encountered any real problems that couldn't be handled by inspecting annotations using reflections or annotation processors.
Why does the author seem surprised when his code doesn't compile after adding a non-optional parameter? It's arguable whether parameters should be optional by default or mandatory by default. Not really knowing much about c# I guess anything besides primitives will be `null`, which doesn't seem like you gain much.
I'm not sure I have ever seen annotation used like in this `whenType` example. Besides that the whole approach looks suspiciously complex (why not just create `@DefaultPriority` which you can add to your type?), annotations are supposed to be simple meta data and you shouldn't be trying to implement some kind of logic with them. Any logic like this should be done when processing the annotation in my opinion.
Java annotations sure are limited and it's does seem kind of weird that you can't use null as default value. But I never encountered any real problems that couldn't be handled by inspecting annotations using reflections or annotation processors.