-
Notifications
You must be signed in to change notification settings - Fork 110
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
Placeholder name, eg %name #274
Comments
Don't comments work for that purpose? I often use them to document what each parameter is when calling a function, regardless of pipes. const fileName = "file.txt";
fileName
|> addServerPath(%) // `/path/to/server/file.txt`
|> convertToUrl(/* filePath */ %) // `http://server.com/path/to/file.txt`
|> await fetchFile(/* fileUrl */ %) // some node file object
|> await saveFile(/* fileHandler */ %, "downloads") |
Of course this can be addressed with comments, but placeholder could be a nice "baked in" way to do that. A bit similar to why we give variables good names if possible before writing a comment. |
This probably was discussed in #91. |
If you have good function names, you may not need to give variables names at all. |
True, but also quite subjective. What do you feel is the reason against placeholder names? In the end you don't have to use them if you don't want to |
I don't have any reason against placeholder name, because I don't oppose it. It may not be needed but I would say that it is not a bad thing either. |
Isn't avoiding giving the name 90% of the choice to use Also, IDEs are very likely to give an inline hint for the argument name right after |
Just use a list of const declarations in this case, no? |
I wanted to propose adding an optional placeholder name to the syntax and ask you what do you think about it?
Example:
As seen, in the pipe steps we add the name of the placeholder. It is optional and has 0 impact on how this code works, but makes it easier to read, as we can add the information 'what is the placeholder at this step' so the reader of the code doesn't have to guess it from function names.
The text was updated successfully, but these errors were encountered: