rfc:shortsyntaxforfunctions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:shortsyntaxforfunctions [2011/06/01 13:27] – [Why do we need RFCs?] tony2001 | rfc:shortsyntaxforfunctions [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Request for Comments: | + | ====== Request for Comments: |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2011-06-01 | * Date: 2011-06-01 | ||
Line 8: | Line 8: | ||
- | This RFC is a parody on shortsyntaxforarrays RFC. | + | This RFC is a parody on [[https:// |
===== Introduction ===== | ===== Introduction ===== | ||
Line 14: | Line 14: | ||
In some cases it is necessary that you have to declare a lot of functions. Especially when you work with classes and their methods, the function declaration tends to make the code looking ugly. If you take a look at other languages (Brainfuck, Brainfork, Feckfeck, Smallfuck, Ook! and Spoon), they don't have such syntax at all! It's all short and readable and easy to type! Maybe PHP should adopt this behaviour to make code more readable and maintainable. | In some cases it is necessary that you have to declare a lot of functions. Especially when you work with classes and their methods, the function declaration tends to make the code looking ugly. If you take a look at other languages (Brainfuck, Brainfork, Feckfeck, Smallfuck, Ook! and Spoon), they don't have such syntax at all! It's all short and readable and easy to type! Maybe PHP should adopt this behaviour to make code more readable and maintainable. | ||
The purpose of RFCs are to work collaboratively towards a specification and finally an implementation of an idea. | The purpose of RFCs are to work collaboratively towards a specification and finally an implementation of an idea. | ||
- | |||
===== Syntax ===== | ===== Syntax ===== | ||
- | We might just replace the current function < | + | We might just replace the current |
- | I'd personally propose to use dots for everything of the above. It's short and you can read it really fast. | + | I'd personally propose to use dashes and dots for everything of the above. It's short and you can read it really fast. |
+ | |||
+ | |||
+ | Example code: | ||
+ | |||
+ | <code php> | ||
+ | function some_long_function_name($array_parameter_omg, | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | New short non-ugly easily readable example code: | ||
+ | <code php> | ||
+ | . .[., .]. | ||
+ | . | ||
+ | | ||
+ | . | ||
+ | </ | ||
===== Proposal and Patch ===== | ===== Proposal and Patch ===== | ||
Line 27: | Line 44: | ||
===== Changelog ===== | ===== Changelog ===== | ||
- | 2011-06-01 Initial revision. | + | - 2011-06-01 : Changed the RFC to include dashes. |
+ | - 2011-06-01 |
rfc/shortsyntaxforfunctions.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1