-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] More specific types in YUIDoc #4991
Comments
I realized that I'm not 100% sure that the common syntax |
YUIDoc is no longer being maintained and I'm a bit wary of continue relying on it going forward. However there isn't a good alternative out there that we can easily transition over to. I have started some exploration into a custom documentation generator based on the idea of YUIDoc but didn't have the time to make it feature complete for p5.js, it is working for my own project though. |
I understand, thought about that a bit too. I think this doesn't block replacing some of By the way is there any reason to try a custom generator rather than JSDoc? |
Two main problems with JSDoc for us:
The difficulty lies only in generating a JSON file with the relevant data in it with the right structure, ideally we won't need to modify the actual reference page's code. The majority of the work is already done by comment-parser, and I have some tags already being handled, I've just yet to complete its compatibility with JSDoc/YUIDoc and spin it out as its own project. Though if something else out there fits our purpose without needed too much effort from the p5.js project itself, they can be considered as well. |
Closing this issue since it is addressed in #6972 |
How would this new feature help increase access to p5.js?
Not really a feature, but I'm wondering if we could describe more specific types in the YUIDoc comments (please see below, I'll be happy to work on it) in order to improve the machine-readable documentation.
This will help p5.ts to resolve some issues and generate better type definitions, which will also help those who love p5 but feel a little difficulty with dynamic-typed languages (e.g. who learned Processing Java first).
It might also open up other possibilities (if any exists -- at least I'm interested in a Haxe port as well).
Most appropriate sub-area of p5.js?
Feature enhancement details:
Below I listed some points that could be improved.
I suppose the first two are relatively reasonable (however they'll require to edit the contributor docs as well), and of course I don't intend to change everything at once, but I'd like to ask if anyone has any concerns, or if there are any related issues.
What we can do relatively easily:
{Object}
typesIn some cases these can be simply replaced with existing types.
For instance,
Here
{Object}
can be described more specifically:{MouseEvent}
.{Array}
typesIn many cases we can describe what kind of
Array
.For instance,
Here
{Array}
can be described more specifically:{Array<String|Boolean|Number>}
.(By the way this case seems not to change the reference rendering;
we might need some conventions for choosing from either
Array<SomeType>
orSomeType[]
)What will need a little more thoughts:
For instance in
random(choices)
, the return type depends on the argument type.The actual type of
p5.Element.elt
depends on the case, e.g.createDiv().elt
isHTMLDivElement
(but as the first step it would also be fine to use always
HTMLElement
, which is a super-type).May require some invention: Callback tag/type yui/yuidoc#33, Remove parentheses from YUIDoc params? #2042
{Object}
Maybe just in a few cases, such as in
saveFrames()
.Maybe just in a few cases, such as
print(...args)
.The text was updated successfully, but these errors were encountered: