2011-10-16, 19:31:52
Hello,
A recent forum reference to this wiki page, showing new functions appearing in v3.1, prompted this request.
On that wiki page, there are three naming styles for functions that fundamentally do the same thing: get, return and echo.
I would like to propose that function naming should follow a more consistent format, so that any data-fetching function is named 'get...', with a switch as the final parameter to select 'echo' or 'return', this switch having a system-wide default value. Ideally, this philosophy should be extended to all the core functions and included in the Coding Guidelines for contributors, too.
Further, if this same idea could be extended to all core functions, they would all provide the flexibility of choice – to echo or return the result – making them more useful for more sophisticated data manipulation (rather than simply echoing content to output).
I know that changing core functions is a painful process, but feel that it would provide a much more solid foundation for future GS development, as well as a rather less frustrating experience for GS developers and site developers alike. At least, if new functions can be more consistent there will be less work to do in the future!
Discuss. ;-)
A recent forum reference to this wiki page, showing new functions appearing in v3.1, prompted this request.
On that wiki page, there are three naming styles for functions that fundamentally do the same thing: get, return and echo.
I would like to propose that function naming should follow a more consistent format, so that any data-fetching function is named 'get...', with a switch as the final parameter to select 'echo' or 'return', this switch having a system-wide default value. Ideally, this philosophy should be extended to all the core functions and included in the Coding Guidelines for contributors, too.
Further, if this same idea could be extended to all core functions, they would all provide the flexibility of choice – to echo or return the result – making them more useful for more sophisticated data manipulation (rather than simply echoing content to output).
I know that changing core functions is a painful process, but feel that it would provide a much more solid foundation for future GS development, as well as a rather less frustrating experience for GS developers and site developers alike. At least, if new functions can be more consistent there will be less work to do in the future!
Discuss. ;-)
--
Nick.
Nick.