-
Notifications
You must be signed in to change notification settings - Fork 29
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
Include types in SIGNATURES #20
Comments
Slightly related: #19. This can be done, but I opted initially to not include types since as soon as you get a signature a bit more complex I've found that it becomes a bit of an information overload. When a signature happens to include a big typealias, Probably the best approach to take (as mentioned in #19) would be to add some kind of setting/option to |
Yeah that's totally true -- I definitely don't think it should be turned on always. Perhaps we could have SIGNATURES take an argument like |
Yes, something like that would probably work nicely. (Whatever the eventual syntax happens to be it needs to be as lightweight as possible so as not to be too intrusive.) |
+1 for this feature, it would be really useful. I feel that for many simpler projects, if functions and arguments are named reasonably, just by using the names and type information one can get a very good idea of what the function does. Further, once this makes its way into documentation, a natural higher-order feature might be the ability to search for functions with the appropriate type signature. |
Yes, we'll definitely do this at some point, just requires some spare time to actually get it done :) |
Great package! +1 for this feature. |
Just came here looking for this too... would be very useful |
I can submit a PR for this if you'd like. I have an implementation that seems to work. Though, I don't know how to retrieve the return type when it is written out in the function definition. I'm able to use Any suggestions on how to get the return type annotation from the function itself? I asked on gitter but it seems from the responses that it is not possible to do. |
@kdheepak: I don't think the return type is necessary, it is something for the compiler to figure out. |
Thanks for the quick comment! I can submit the PR without that then. However, in my use case and I want to either 1) ensure that the return type is the particular type I think it is, or 2) convert it to an appropriate return type or throw an error if it cannot. Do you know if there's a way to get the return type of function from the type declaration provided by the user? |
|
I see what you are saying. I will add though, that another motivation for me to add return types to the function is just documentation. I personally find it a lot more easier to read the code and know just by looking at it exactly what type will be returned, especially if there's no generics involved. Having that be included in the docstring is an added bonus imho. |
I would really like to be able to do this.
And have the docstring be
This seems feasible, any chance we can do this?
The text was updated successfully, but these errors were encountered: