Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96601 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74677 invoked from network); 24 Oct 2016 17:10:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2016 17:10:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.175 as permitted sender) X-PHP-List-Original-Sender: david.proweb@gmail.com X-Host-Fingerprint: 209.85.220.175 mail-qk0-f175.google.com Received: from [209.85.220.175] ([209.85.220.175:34539] helo=mail-qk0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/20-07271-0904E085 for ; Mon, 24 Oct 2016 13:10:41 -0400 Received: by mail-qk0-f175.google.com with SMTP id x11so35360490qka.1 for ; Mon, 24 Oct 2016 10:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=l4UiBHNRFMX17i4EoVU/fa4uwW+3no5SsPqMKE7VsDQ=; b=pOdd/5M43xhMKLat0/mwicLjYz32dDStQt/74AGq7fgAtWSQadYybXVM8b/sdKc6We hXaVUKIn9vzx11j9d8WrplFioVqTAKd52yWN7g30JOho8wMR6LawwOk9GuSp2EMBnWwi XR2B9dsPxh1anR9ADJQCU9E3qdAveYOFD7jBgrREu1MUVFx/BmyaIhmNB0cRmYWP9pFC vWIZymplWxYxXAHAqiHLwIkQ6ZMf9emeDlwa/QkHJuju1LR432sKovh9UvgDa7oT6DaA grAQKGc3ojT4hPXJV96iWUCidWLBbGcolcYKKGF8gn7xPS5C9QWJs1dtKlZlpXQ674Fk Q0uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=l4UiBHNRFMX17i4EoVU/fa4uwW+3no5SsPqMKE7VsDQ=; b=NmCeHZ02ndwyZsD0um+YvHDRjxw0qqUKvnTqGHtWAemoXlEujnvW6hPGR82gZNOuXK ouezTlkCX54z6LYbAmdqgUSXnzGwx26k6QAxECAZR9bUwwFeofoIdEHtSZUQjLHtV2EF DSwRert2Q9BcLwJ9OWj6TdqP0jKmYpgx0gtV0bmUOQ7S1mU1xRD2rxPv1AV6LQFP0Y8n 2b5QYzfiNVAB9TwMTGq7O/7mYBtDDyYGgJLEHpdEf8i7itj/t0fnug69le3kQOyQ8g0b oofeyDHAof4mfIKj0ZQNacMRSRjMlF1zq6PrlPhrGw5p+hR9BduIw29KX7LdyjxsX3OT rPnQ== X-Gm-Message-State: ABUngveS3U7iUDF5Pwl8xghWPfcjf6M15a0vMyBw+bL0ygFSo9FNeNXjPDmoHhepojxlEs+nBQJwqycWRZLm5Q== X-Received: by 10.55.157.215 with SMTP id g206mr17596727qke.12.1477329037740; Mon, 24 Oct 2016 10:10:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.45.67 with HTTP; Mon, 24 Oct 2016 10:10:17 -0700 (PDT) Date: Mon, 24 Oct 2016 15:10:17 -0200 Message-ID: To: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Debugging with zero cost in production From: david.proweb@gmail.com (David Rodrigues) Hello, folks. I'm thinking about a debug function to allow us to create "zero cost declarations" in production code, as assert() does. From what I understand, if I have something like assert(method()), method() will not be called in production, only in development. This behaviour is great because we can help the PHPUnit, for instance, to capture messages in specific places to check if some process have generated the correct value without test it alone. For instance: // On test()'ed method: debug(TestStack::put($varValue)); // On test method: test(); static::assertSame(123, TestStack::pop()); How it should be a debug code, should be important that it not be generated and executed in production. Could I use assert() to do that, in all case? Then I could consider it as "already implemented". Bye! -- David Rodrigues