When a function has reached the end of its life, we add a @deprecated
tag into its doc-comment to notify other developers that they should stop using this function, and then a couple years later it's removed.
I was just thinking about an @beta
tag to signify this method is brand new and hasn't been tested in a variety of use-cases yet.
You might be thinking "you can write use-cases to ensure its correctness!" Of course you can, but its the API that concerns me, and how it behaves in edge-cases. Sometimes these decisions are not obvious until you have tried out the function in a variety of situations. Sometimes new parameters need to be added to cover more use-cases. Sometimes re-ordering them makes sense if you find that an argument is actually optional and needs to be moved to the end (or vice versa).
By adding the @beta
tag, you are warning other developers that the API of this method might change yet, and they should use it with extreme caution. This gives you more granular control over your API instead of making the entire project 'beta'.
To get the most use out of this, however, IDEs and documentation-generators would need to pick up on this tag.
What do you guys think? Could you see this as being useful, is it a waste of time, or do you have other ways of dealing with this?
In the past, I have made such methods 'private' where possible, or prefixed them with an underscore.
@Warning
or@Experimental
would be better?@deprecated
, it stays that way, but a@beta
function will (hopefully) eventually change, even if that change is just removing the@beta
tag. So you're introducing a temporary tag to cover your back when you shouldn't be publishing an API that is still changing in the first place.