Replying to myself: I just found some discussions here: https://lists.gt.net/wiki/wikitech/378676 I bet that the new assert features in PHP7 don't change the conclusions here, so please ignore my e-mail and sorry for the noise.
On Thu, Mar 15, 2018 at 2:42 PM, David Causse <[email protected]> wrote: > Hi, > > Sometimes I find adding assert() calls in my code very handy for various > reasons: > - failures in development mode on some complex code where exposing all the > details to unit tests is sometimes hard and/or pointless > - readability of the code > > But I worry about the perf implications of these lines of code. I don't > want these assertions to be used to track errors in production mode. > > PHP7 introduced expectations which permit to have zero-cost assert() [1] > Looking at the MW codebase we don't seem to use assert frequently (only 26 > files [2] ). > > Are there some discussions about this? > Is assert() a good practice for the MW code base? > If yes would it make sense to benefit from zero-cost assertions in WMF > appservers? > > Thanks! > > [1] http://php.net/manual/en/function.assert.php#function. > assert.expectations > [2] https://codesearch.wmflabs.org/search/?q=%5Ctassert%5C(&i=nope&files= > php%24&repos= > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
