-
Notifications
You must be signed in to change notification settings - Fork 9
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
Allow constructors to specify value type #69
Comments
imo it should not throw an error at least because constructor may return i'll use this feature. On Friday, June 14, 2013, Vitaly Puzrin wrote:
|
ndoc throws error on syntax mismatch. I guess, original pdoc does not allow it too. But, as i said, i don't see principal problems in syntax extention. /cc @ixti |
Constructor can't return anything but /**
* new Foobar()
*
* Description of a constructor. In docs it will be explicitly
* named as constructor.
**/
/**
* Foobar() -> String
*
* Description of a constructor used as a function.
**/ |
/**
* class Foobar
*
* Class desc.
**/
...
/**
* new Foobar()
*
* Constructor desc.
**/
/**
* Foobar() -> String
*
* Constructor function desc.
**/
var Foobar = function() {
...
return 'abc';
} throws I'm a little confused :-/ without |
Ah, right! Indeed. Problem here is that in the way we build AST of doc nodes - we don't separate functions from classes, so for class Foobar AST node will have id So either the example above will work either in case if you will avoid Idea of specifying constructor signature as Can you please provide an example when constructor used as function for side effects (not just a shorthand syntax of |
Ndoc 3.0.1 allows to assign value for constructor. That's not documented feature, and it's not guaranteed to work in future. But i think, it will not be used widely. So, it will not be a problem to update docs when something changed. Anyway, we can't spend time now for rewriting AST. If @deepsweet requirement is solved, i would close this ticket. |
#59 (comment)
new Foobar(param) -> Type
causes fatal error. I don't know, if such notation is useful, but it costs nothing to implement.The text was updated successfully, but these errors were encountered: