Dear all,
should we allow using PHP's assert [1] in MediaWiki code?
It would allow us to formulate and automatically verify conditions
about code, while at the same time providing readable documentation of
code for free.
Possible, exemplary use cases would be:
- automatically verifyable documentation of code's intent
- guarding against logic pitfalls like forgetting to set a variable in
all branches of switches, if/else cascades
- guarding against using uninitialized variables
What do you think?
Kind regards,
Christian
P.S.: For typical MediaWiki use cases, PHP's assert is even faster
than throwing exceptions behind 'if'-guards.
[1]
http://php.net/manual/en/function.assert.php
(Not to confuse with PHPUnit's functions for assertions, which solve a
different problem.)
--
---- quelltextlich e.U. ---- \\ ---- Christian Aistleitner ----
Companies' registry: 360296y in Linz
Christian Aistleitner
Gruendbergstrasze 65a Email: christian(a)quelltextlich.at
4040 Linz, Austria Phone: +43 732 / 26 95 63
Fax: +43 732 / 26 95 63
Homepage:
http://quelltextlich.at/
---------------------------------------------------------------