[TYPO3-dev] Re: [TYPO3-core] RFC: #13697: Add possibility to retrieve extension version

Oliver Klee typo3-german-02 at oliverklee.de
Wed Mar 10 12:49:02 CET 2010


Hi,

Sigfried Arnold schrieb:
> Am 08.03.2010 18:16, schrieb Oliver Klee:
>> Actually, why not use clean return types and return an empty string (or
>> even better: throw an exception) if the extension isn't loaded?
> 
> Why not simply returning boolean 'false'?

An API that doesn't have clean types (for parameters and return values)
makes working with it harder: If this function e.g. can return both a
string or a boolean, the caller needs to make sure that it is a string
before e.g. applying string functions on the return value (like doing a
split for the version parts). It's easy to forget this check, and this
will result in all types of hard-to-track bugs (especially if all the
developer remembers is "this function usually returns a string").

Working with a variable if its type is known is easier and less error-prone.


Oliver

PS: Moving this discussion to the dev list.
-- 
Certified TYPO3 Integrator | TYPO3 Security Team Member




More information about the TYPO3-dev mailing list