Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72251 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67809 invoked from network); 5 Feb 2014 08:48:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 08:48:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:55243] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/D4-22810-FBAF1F25 for ; Wed, 05 Feb 2014 03:48:00 -0500 Received: by mail-la0-f46.google.com with SMTP id b8so68130lan.19 for ; Wed, 05 Feb 2014 00:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=N9Cjo40kqHl3qLyaHR/0fIR0FixrPXUIuqO3jRIcEG8=; b=yWWJUs4uWZJJ/E4j5bJNzgsTIJrOqXgXY3xrsVFScc3v+hSZbqBTbbV+wGc6kUfn0w Rfs7ArN1EK/9eNZ4WL4wGLIT+NpMEGoNKfl+zimUb4w6Mplpoq4ItQYSQOzH2BpXy6R1 Xy1/2xcYU7/HsmLmLMdm+icWzOJb1CJ3KiLNlb9cN7IqyT/StbOXFk1LEBDBTWC18Dyd XA4c0nECpappgQ7XMVG95je1JkC6emqH88qXlSYRtUKHNIUH3kgK69BFUxbYEpo4VoTg FdMLtggeG5drgZRo23MVLgl89ZdV7VXZEG719Hr9hqMnrd2ou4e14kCpiv/oEg5smwMj eX3g== X-Received: by 10.152.190.69 with SMTP id go5mr101646lac.79.1391590076324; Wed, 05 Feb 2014 00:47:56 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Wed, 5 Feb 2014 00:47:16 -0800 (PST) In-Reply-To: <52F1F675.2000600@sugarcrm.com> References: <52EE2B66.4040005@pthreads.org> <52F157BE.3020804@ajf.me> <52F15FD6.7060901@ajf.me> <52F1E58F.3050105@sugarcrm.com> <52F1EF12.2050705@sugarcrm.com> <52F1F675.2000600@sugarcrm.com> Date: Wed, 5 Feb 2014 17:47:16 +0900 X-Google-Sender-Auth: xGGJXzWvA1swMY6Pzry61FXe-Tw Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1136c86c2c208604f1a4d055 Subject: Re: [PHP-DEV] RE: RFC: expectations/assertions From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1136c86c2c208604f1a4d055 Content-Type: text/plain; charset=UTF-8 Hi Stas, On Wed, Feb 5, 2014 at 5:29 PM, Stas Malyshev wrote: > > I meant the form of the code, not assert(). > > JavaScript uses callbacks extensively and users are used to it. > > PHP users are also getting used to it since the introduction of closure. > > But I mean assert(). Javascript implementations have assert() - Chrome > has it, Firefox has it, NodeJS has it. It does not work like you > propose. Doesn't it make you question your assertion that Javascript > users really need this? I think it's nice to have as it does not use variable scope/name space. Code related to assert() is better to hide it's existence as much as possible. IMO. JavaScript implementations have different APIs. Node.js has closer API. assert.throws( function() { throw new Error("Wrong value"); }, Error ); while we may have assert( function() { // Some check here return FALSE; }, 'Error' ); I would use at least, since I don't want to assert() related code to use variable scope nor namespace. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1136c86c2c208604f1a4d055--