Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31203 invoked from network); 17 Oct 2013 12:01:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2013 12:01:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.43 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.215.43 mail-la0-f43.google.com Received: from [209.85.215.43] ([209.85.215.43:41060] helo=mail-la0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/04-12663-181DF525 for ; Thu, 17 Oct 2013 08:01:06 -0400 Received: by mail-la0-f43.google.com with SMTP id ec20so1710666lab.2 for ; Thu, 17 Oct 2013 05:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=M/jZYko7sjw+5B4+SIJ+eawHfaMC4BL3Iz+gGSYhSJU=; b=hK1fdX/CwsoLZYayFPITuHKR7MVxTO7iH6tXtzQlSYOGczvXIrBGqLryhPSaWQ1RpP JRqH+5xhREweMykATyvomfavIIdz2Vx4SbFRz5nge4grgoyEVcMBKX5fab9fgsevZKFF +lwzxxa58tbkk8I7ioEER+ubKVD90msqbwtg680RcYA1hN6/4GGH3plAAfMXP6OSf2HP iLgz6xYg1u9K1fVQ/Vn/MV7NyIeTmQRj1vSyuTr6knwvU1/YM06eFY/iSxGlQmxiGKzm As/cAXdSL4MZv6Yp2hdkyisGguo45gxFx2ELKxx7G38xEB4lt/7Ye8tyfw6ULf0rxNX1 VRoA== MIME-Version: 1.0 X-Received: by 10.112.155.70 with SMTP id vu6mr1472831lbb.41.1382011262796; Thu, 17 Oct 2013 05:01:02 -0700 (PDT) Sender: mike.php.net@gmail.com Received: by 10.114.184.19 with HTTP; Thu, 17 Oct 2013 05:01:02 -0700 (PDT) In-Reply-To: References: <525FC834.4060501@php.net> Date: Thu, 17 Oct 2013 14:01:02 +0200 X-Google-Sender-Auth: MlOH_0Zrfgeh-bDmLDMslx7-dYg Message-ID: To: Sebastian Krebs Cc: Joe Watkins , PHP internals list , Julien Pauli Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Assertions From: mike@php.net (Michael Wallner) On 17 October 2013 13:45, Sebastian Krebs wrote: > While tinking about it: As assertions are a way to describe conditions, > that are valid _in every case_ (or else the application is unrecoverable > broken), it is somehow different from just "exeptional cases", that may be > recovered during runtime. Therefore I'd prefer "the hard with" with errors > and such. I think they are somehow comparable to compile-errors, but during > runtime. Or with a "LogicException", that isn't simply (and without side > effects) solveable by replacing the value of one variable with another one. I tend to see it the same way. I think PHP's assert is derived from C's assert, where ASSERT(3) says: "... assert() prints an error message to standard error and terminates the program by calling abort(3) if expression is false ..." Where the important part is "terminates the program". -- off topic -- What I'd love to see, though, would be conditional execution of the assert block, i.e. if ASSERT_ACTIVE!=true, the expression wouldn't even be evaluated. So it were usable with expressions instead of strings in production code. I guess, accepting a callable as first argument could more or less solve this wish now that we've got closures... -- Regards, Mike