--
---
You received this message because you are subscribed to the Google Groups "YARD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yardoc+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "YARD" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/yardoc/gxxe2MNtp5A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to yardoc+un...@googlegroups.com.
There are a couple of things here:
The YARD type specification is free-form, because anything we define is fundamentally at odds with Ruby syntax in many ways. YARD core doesn't _really_ define syntaxes except to make suggestions about what looks good. All of this is a middle ground between formal specification and prose. When you hit the edges of that specification (as this case does), you usually want to use the specification as a base to guide a discussion in prose. Ultimately, you will need to use both the specifier and prose to explain things.A good example of this is the "raise EXC" part of your spec. Even
if there was a "formal specification" of what raise EXC means in
YARD tags, it still doesn't really explain how the potential
raised exception will be handled in the context of your callback.
Will you throw that exception out of the method? Is the method
going to handle it? Is there a special exception that might be
handled and others not (like a StopIteration)? This fundamentally
can't be specified and needs prose to aid in the understanding
process.
For that reason, I would keep it simple and use as little specification as possible to (a) make it clear what is expected but (b) without confusing the user. I assume your interface is actually going through #call(*args), therefore you can consider something like:
#call<(Symbol, Numeric)> returns String raises EXC