Timeline for Why tag function definition with def, fn, fun, func or function etc?
Current License: CC BY-SA 4.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 29, 2024 at 1:28 | answer | added | Alexander | timeline score: 2 | |
| Oct 1, 2023 at 23:21 | answer | added | jmoreno | timeline score: 0 | |
| Oct 1, 2023 at 21:59 | comment | added | Luatic |
sayHi() {} is perfectly valid Dart (and not frowned upon, as opposed to the same code in C).
|
|
| Sep 30, 2023 at 20:11 | history | edited | kaya3 |
edited tags
|
|
| Sep 30, 2023 at 11:43 | answer | added | Martin Berger | timeline score: -2 | |
| Sep 30, 2023 at 11:12 | history | reopened |
kaya3 lyxal♦ |
||
| Sep 30, 2023 at 11:01 | comment | added | kaya3 |
This is not a duplicate of the question about type-first syntax; it's not about type annotations, and the benefit or need for a function-definition keyword like function is orthogonal to the question of whether the type annotation (assuming there is one) should go before or after the name it's associated with.
|
|
| Sep 30, 2023 at 10:54 | review | Reopen votes | |||
| Sep 30, 2023 at 11:13 | |||||
| Sep 29, 2023 at 23:59 | history | closed |
Seggan Ginger feldentm Matthieu M. Isaiah |
Duplicate of What are the advantages/disadvantages of prefix type syntax? | |
| Sep 29, 2023 at 20:57 | answer | added | kaya3 | timeline score: 4 | |
| Sep 29, 2023 at 19:53 | answer | added | user23013 | timeline score: 3 | |
| Sep 29, 2023 at 19:42 | history | became hot network question | |||
| Sep 29, 2023 at 18:38 | answer | added | feldentm | timeline score: 5 | |
| Sep 29, 2023 at 15:33 | comment | added | Christian Lindig |
Haskell defines functions without using a keyword: square x = x * x defines function square.
|
|
| Sep 29, 2023 at 14:05 | comment | added | Seggan | @RydwolfPrograms the answers there can be mostly applied here too | |
| Sep 29, 2023 at 13:41 | answer | added | Luke LaBonte | timeline score: 14 | |
| Sep 29, 2023 at 13:41 | comment | added | Matthieu M. | @TomTsagk: Just because one language did it doesn't mean it's not a terrible idea. In fact, the syntax of C -- and notably of function declarations -- is fairly problematic in general, requiring the maintenance of a symbol table when parsing, and leading to the Most Vexing Parse issue. | |
| Sep 29, 2023 at 13:30 | comment | added | rydwolf | @Seggan I don't think it does; OP isn't asking about using the return type as a prefix, they're asking about having no prefix at all, which is much different. | |
| Sep 29, 2023 at 12:58 | comment | added | Tom Tsagkatos |
Is it worth pointing out that in some languages like C you can just say void MyFunction() {} and it recognises it as a function. So I don't think it's hard for a compiler/interpreter to parse a function, it just might not be as readable on some languages.
|
|
| Sep 29, 2023 at 12:18 | review | Close votes | |||
| Sep 29, 2023 at 23:59 | |||||
| Sep 29, 2023 at 11:51 | comment | added | Chris Dodd |
In sh, you can't have a function keyword and have to define functions like you describe with just the name. bash and zsh added the ability to also use function keyword to make the code clearer to read.
|
|
| S Sep 29, 2023 at 11:42 | review | First questions | |||
| Sep 29, 2023 at 13:30 | |||||
| S Sep 29, 2023 at 11:42 | history | asked | Anubhav | CC BY-SA 4.0 |