-
Notifications
You must be signed in to change notification settings - Fork 2k
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
alternative syntax for block comments #5002
Conversation
|
This PR would be a breaking change: #*
#* Block comment
#* If anyone wrote the above, after your PR all their code would be commented out. |
@GeoffreyBooth you're right about the breaking change. This
compiles into //*
//* Block comment
//*
var foo;
foo = function(a) {
return a + 1;
};
/*
More comments here.
*/
foo(41);
/*
Ends here.
*/ |
How about we just support It's guaranteed not to break anyone's code since |
I don’t think we want to have lots of alternatives for comments syntax. We certainly don’t want to introduce a breaking change to create something we don’t need. I sympathize with the ugliness of block comments for Flow that is inspiring this effort, but I think there might be a better approach: a preprocessor, similar to https://github.com/billymoon/illiterate. Imagine you make a new command-line utility called flowcoffee --compile --output dist/ src/ The files output would all be JavaScript, not CoffeeScript. So within
So you could fork Instead of Flow syntax like this: fn = (str ###: string ###, obj ###: Obj ###) ###: string ### ->
str + obj.num You could do something like this, for example: fn = (str : string, obj : Obj) : string ->
str + obj.num In this proposal, we’re using the fact that “space-colon-space” currently doesn’t compile in CoffeeScript, and therefore it can be a cue that |
This PR adds alternative syntax for the comment block:
#* comment *#
.I've checked the previous proposals for something similar but couldn't find anything (@vendethiel do your magic).
compiles to:
Easier writing of Flow’s comment types syntax.
Improved readability of multiple comment blocks.