-
-
Notifications
You must be signed in to change notification settings - Fork 59
comment syntax #82
Comments
Alongside the normal flow syntax following also might be considered, where the type specification is completely separated, then comments in the middle of code.
Maybe we do not need the function here as this information is found elsewhere and also can be inferred:
|
Hindley-Milner comments would be cool to have too: // capitalize :: String -> String
const capitalize = function(s) {
return toUpperCase(head(s)) + toLowerCase(tail(s));
} |
With flow.js, I tend to use this pattern:
It's about as close as I can get to haskell-style type annotations in a typed superset of js, but not quite there... Flow's syntax also has some weird quirks I don't like (like the ability to arbitrarily change the effective AST, e.g. |
I believe we have to keep one set of syntax closer to JS syntax as much as possible with support for Hindley-Milner style also. |
Ideally there should be a single way to write type annotations - something as close as possible to existing widespread solutions like typescript/flow. |
Why do not use JSDoc? This is widely spread and TypeScript supports it. |
Hmm. We need to think about the way to declare the type in a comment. |
And thank you all for your contribution ^_^. |
JSDoc support will allow using Hegel with Google Closure Compiler. |
@JSMonk I personally thinkg - in order for people to really use it - which i would love to - the comment version of it should be really conscise and I think @flow does a much better job than @jsdoc which is just old. If people want tradition, they will anyway continue to use JSDoc and TypeScript, but somebody who is forward thinking and want a lean and unintrusive way to add this, they want the best possible developer experience that is straight to the point, so the in-line way @flow uses or the above mentioned hindley-milner comments and @sirinath comments :-) Otherwise, great job :-) I really like hegel.js so far and will use it as soon as it allows a comment style version of it :-) |
Thank you a lot. We will try to choose a better decision for the community. And thank you for your opinion. I have the same one :) |
My opinion now is to stick to Flow, JSDoc, TSDoc, ESDoc, etc format without any extensions, But support all, but one style would be consistently used within a file or project. This support can be through a set of language plugins which provides the type information for further processing. This way new formats can be added and if one is uninterested in any format then they can be removed for the whole project of selected files. Each dependency will use the relevant plugin within itself without forcing it to the end-user of the library or beyond library boundaries or in some cases file boundaries. |
Hey, cool project. Was wondering if you're planning on supporting comment syntax. I use that w/ flow.js to avoid a build step. Would be great if hegel had something similar
The text was updated successfully, but these errors were encountered: