What is the need to add the "fn" attachment? #3289
Replies: 4 comments 2 replies
-
instead:
Could be:
|
Beta Was this translation helpful? Give feedback.
-
Adding "->" and "fn" in real life is a waste of time and makes life difficult for people who are just starting out. The objective of a language is that it should be as versatile and direct as possible in every sense. |
Beta Was this translation helpful? Give feedback.
-
I also propose that the "auto" type be added. With automatic type conversion in a standardized way, which allows recycling of functions to obtain more compact codes. |
Beta Was this translation helpful? Give feedback.
-
This is discussed in https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p0438.md#function-keyword . Just using the return type to say "here comes a function declaration" may feel less complicated to you because you're familiar with it, but that doesn't mean it's simpler for everyone. It makes the parsing (for the compiler) harder. It may make reading the code harder for people who are not coming from a C or C++ background and expect an introducer like fn to explicitly mark the start of a function. |
Beta Was this translation helpful? Give feedback.
-
What is the need to add the "fn" add-on and look like Rust instead of C? Why complicate things?
Beta Was this translation helpful? Give feedback.
All reactions