Re: [PHP-DEV] RFC: Expectations

2015-02-19 Thread Dmitry Stogov
Hi Joe, I think, we may just add additional vote question. - If we like to custom exceptons as second argument? but I don't care about it, so do as you like. According to AssertException: add a note into Open Issues section. e.g. we may introduce new abstract class BaseException then make Except

Re: [PHP-DEV] RFC: Expectations

2015-02-18 Thread Joe Watkins
Morning, I hear the concern regarding custom exceptions. Things will be used badly whatever. It's easy to imagine that in a simple application you just don't need to specify custom exceptions. But in a large codebase, being able to structure exceptions is invaluable, it gives documentation referen

Re: [PHP-DEV] RFC: Expectations

2015-02-18 Thread Dmitry Stogov
On Wed, Feb 18, 2015 at 5:44 PM, Nikita Popov wrote: > On Tue, Feb 17, 2015 at 10:50 PM, Dmitry Stogov wrote: > >> Hi Joe >> >> The patch is ready https://github.com/php/php-src/pull/1088/files >> >> 1) I implemented AST pretty-printer to reconstruct the source. It may be >> reused in Reflection

Re: [PHP-DEV] RFC: Expectations

2015-02-18 Thread Nikita Popov
On Tue, Feb 17, 2015 at 10:50 PM, Dmitry Stogov wrote: > Hi Joe > > The patch is ready https://github.com/php/php-src/pull/1088/files > > 1) I implemented AST pretty-printer to reconstruct the source. It may be > reused in Reflection and other places through > > ZEND_API zend_string *zend_ast_exp

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Dmitry Stogov
OK thanks. I'm switching to another task :) Thanks. Dmitry. On Wed, Feb 18, 2015 at 10:16 AM, Joe Watkins wrote: > Updated RFC as requested. > > I'm just going to wait to hear what Nikita says, especially about > optimizing away unqualified calls to assert. > I guess this could be viewed as

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Joe Watkins
Updated RFC as requested. I'm just going to wait to hear what Nikita says, especially about optimizing away unqualified calls to assert. I guess this could be viewed as a BC break, it seems like quite a nice break but not sure. Will open voting when we hear from Nikita. Cheers Joe On Wed, Feb 1

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Joe Watkins
Will update RFC today, thanks for working on it Dmitry :) Cheers Joe On Tue, Feb 17, 2015 at 9:50 PM, Dmitry Stogov wrote: > Hi Joe > > The patch is ready https://github.com/php/php-src/pull/1088/files > > 1) I implemented AST pretty-printer to reconstruct the source. It may be > reused in Refl

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Dmitry Stogov
Hi Joe The patch is ready https://github.com/php/php-src/pull/1088/files 1) I implemented AST pretty-printer to reconstruct the source. It may be reused in Reflection and other places through ZEND_API zend_string *zend_ast_export(const char *prefix, zend_ast *ast, const char *suffix); 2) zend.a

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Dmitry Stogov
On Tue, Feb 17, 2015 at 5:11 PM, Nikita Popov wrote: > On Mon, Feb 16, 2015 at 4:47 PM, Dmitry Stogov wrote: > >> Hi Nikita, >> >> it looks like a part of old implementation is not trivial with new AST >> compiler. >> >> previously we translated assert(condition) into assert(condition, >> "asser

Re: [PHP-DEV] RFC: Expectations

2015-02-17 Thread Nikita Popov
On Mon, Feb 16, 2015 at 4:47 PM, Dmitry Stogov wrote: > Hi Nikita, > > it looks like a part of old implementation is not trivial with new AST > compiler. > > previously we translated assert(condition) into assert(condition, > "assert(condition)"). > actually we just captured a part of input buffe

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Dmitry Stogov
Hi Nikita, it looks like a part of old implementation is not trivial with new AST compiler. previously we translated assert(condition) into assert(condition, "assert(condition)"). actually we just captured a part of input buffer and added missing string argument. Is there a simple way to do the

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Joe Watkins
> is there any penalty of catch-AssertionException-blocks? Are those eliminated in production code? Assertions should never be enabled in production code, the ability to catch (and enable by configuration) the exception serves the developer of the code during development only. The example code is

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Benjamin Eberlei
On Mon, Feb 16, 2015 at 10:37 AM, Joe Watkins wrote: > Morning internals, > > I've had mostly negative feedback on the design-by-contract idea, maybe > it's a step too far. > > The expectations RFC in its current form proposes that we introduce > zero-cost assertions, which are compatible

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Crypto Compress
Hi Joe, is there any penalty of catch-AssertionException-blocks? Are those eliminated in production code? Thanks -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Yasuo Ohgaki
Hi Martin, On Mon, Feb 16, 2015 at 6:59 PM, Martin Jansen wrote: > On 16.02.15 10:37, Joe Watkins wrote: > > Please review the RFC, and provide feedback, if there are no strong > > objections we will go ahead with a vote when the patch is ready, in the > > coming days. > > > > https://wi

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Martin Jansen
On 16.02.15 10:37, Joe Watkins wrote: > Please review the RFC, and provide feedback, if there are no strong > objections we will go ahead with a vote when the patch is ready, in the > coming days. > > https://wiki.php.net/rfc/expectations I like it. But why do those two INI settings use d

RE: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Zeev Suraski
> -Original Message- > From: yohg...@gmail.com [mailto:yohg...@gmail.com] On Behalf Of Yasuo > Ohgaki > Sent: Monday, February 16, 2015 11:45 AM > To: Joe Watkins > Cc: PHP internals > Subject: Re: [PHP-DEV] RFC: Expectations > > Hi Joe, > > On Mon, Feb

Re: [PHP-DEV] RFC: Expectations

2015-02-16 Thread Yasuo Ohgaki
Hi Joe, On Mon, Feb 16, 2015 at 6:37 PM, Joe Watkins wrote: > I've had mostly negative feedback on the design-by-contract idea, maybe > it's a step too far. > I think introducing strict type safety for DbC like static/compiled languages is too far. I agree. The expectations RFC in its

[PHP-DEV] RFC: Expectations

2015-02-16 Thread Joe Watkins
Morning internals, I've had mostly negative feedback on the design-by-contract idea, maybe it's a step too far. The expectations RFC in its current form proposes that we introduce zero-cost assertions, which are compatible with the current assertion API. Since this has been in discus

Re: [PHP-DEV] RFC: Expectations

2013-10-24 Thread Joe Watkins
On 10/22/2013 06:20 PM, Adam Harvey wrote: On 22 October 2013 02:08, Derick Rethans wrote: I'm pretty convinced that expectations *without* exceptions are a good idea, as using assert (which is really eval) is a nasty thing that should be replaced, but IMO exception throwing should not be part

Re: [PHP-DEV] RFC: Expectations

2013-10-23 Thread Joe Watkins
On 10/22/2013 07:32 PM, Patrick Schaaf wrote: Am 22.10.2013 20:07 schrieb "Joe Watkins" : You can catch exceptions, and log them. You can do that without impacting everything around you, you can do that, or whatever else you like. You can do that handling when you have only a few toplevel scr

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Adam Harvey
On 22 October 2013 10:32, Joe Watkins wrote: > On 10/22/2013 06:20 PM, Adam Harvey wrote: >> I agree that something to replace the eval-based assert() would be >> good. What if the new syntax simply respected assert_options(), and >> assert_options() was extended to support an explicit ASSERT_EXCE

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Adam Harvey
On 22 October 2013 02:08, Derick Rethans wrote: > I'm pretty convinced that expectations *without* exceptions are a good > idea, as using assert (which is really eval) is a nasty thing that > should be replaced, but IMO exception throwing should not be part of > this feature. I agree that somethi

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Joe Watkins
On 10/21/2013 09:42 PM, Andrea Faulds wrote: On 21/10/2013 21:36, rpar...@yamiko.org wrote: This proposal sounds a lot like exceptions to me or am I missing something :/ Could we do something like throw new expectation($expects, $message); Er, T_EXPECT will be essentially a clone of Java and

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Matthew Leverton
Since this would throw exceptions, could it look like (or be) a final/abstract (although PHP doesn't allow that combo for some reason) class with static methods? Assert::isTrue($expr, $msg); That syntax is already valid (so of course there are BC issues) and I don't know how practical it is to op

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Andrea Faulds
On 21/10/2013 21:36, rpar...@yamiko.org wrote: This proposal sounds a lot like exceptions to me or am I missing something :/ Could we do something like throw new expectation($expects, $message); Er, T_EXPECT will be essentially a clone of Java and Python's assert statement, but not called as

[PHP-DEV] Declaring purely static classes [Was Re: [PHP-DEV] RFC: Expectations]

2013-10-22 Thread Rowan Collins
Matthew Leverton wrote (on 21/10/2013): final/abstract (although PHP doesn't allow that combo for some reason) Final means "cannot be sub-classed", abstract means "must be sub-classed"; the combination would make no sense. Specifically, it would allow completely illogical code like "final abs

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Andrea Faulds
-1 to "expect is a problem". expect is not a problem. > Le 21 octobre 2013 à 10:42, Joe Watkins a écrit : > > > On 10/21/2013 09:57 AM, Tjerk Meesters wrote: > > On Mon, Oct 21, 2013 at 4:16 PM, Michael Wallner wrote: > > > >> On 21 October 2013 10:13, Patrick Schaaf wrote: > >>> Am 21.10.201

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Joe Watkins
On 10/21/2013 02:27 PM, Hochstrasser Christoph wrote: Hi Derick, This is again an RFC that does not even attempt to argue for its usefulness. "This functionality was meant to replace the assert() API that currently exists in PHP, because of problems replacing it in a compatible manner". This do

Re: [PHP-DEV] RFC: Expectations

2013-10-22 Thread Derick Rethans
On Fri, 18 Oct 2013, Joe Watkins wrote: > Evening Chaps, > > Following on from discussion regarding assertion API in PHP, the > following RFC is now up for discussion: > > https://wiki.php.net/rfc/expectations > > Please do point out any missing sections or information, so tha

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Joe Watkins
On 10/21/2013 09:16 AM, Michael Wallner wrote: On 21 October 2013 10:13, Patrick Schaaf wrote: Am 21.10.2013 03:52 schrieb "Joe Watkins" : So looks like we need a new name ?? Ideas ?? abstract EXPRESSION wat? abstract is already a keyword, so no BC. abstract is not concrete so alludes

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Michael Wallner
On 21 October 2013 10:13, Patrick Schaaf wrote: > Am 21.10.2013 03:52 schrieb "Joe Watkins" : >> >> So looks like we need a new name ?? Ideas ?? > > abstract EXPRESSION wat? > abstract is already a keyword, so no BC. > > abstract is not concrete so alludes a bit to the > might-be-or-might-not-b

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Patrick Schaaf
Am 21.10.2013 03:52 schrieb "Joe Watkins" : > > So looks like we need a new name ?? Ideas ?? abstract EXPRESSION abstract is already a keyword, so no BC. abstract is not concrete so alludes a bit to the might-be-or-might-not-be-checked nature of the test abstract is the name for the "short summ

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Tjerk Meesters
On Mon, Oct 21, 2013 at 4:16 PM, Michael Wallner wrote: > On 21 October 2013 10:13, Patrick Schaaf wrote: > > Am 21.10.2013 03:52 schrieb "Joe Watkins" : > >> > >> So looks like we need a new name ?? Ideas ?? > > > > abstract EXPRESSION > > wat? > > > > abstract is already a keyword, so no BC. >

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Julien Pauli
On Mon, Oct 21, 2013 at 3:52 AM, Joe Watkins wrote: > On 10/20/2013 12:15 AM, Ferenc Kovacs wrote: > >> On Sun, Oct 20, 2013 at 12:36 AM, Robert Stoll wrote: >> >> Heya, >>> >>> I do not know how much it concerns this RFC but I came across the >>> following >>> page about an extension named "Ex

Re: [PHP-DEV] RFC: Expectations

2013-10-20 Thread Joe Watkins
On 10/20/2013 12:15 AM, Ferenc Kovacs wrote: On Sun, Oct 20, 2013 at 12:36 AM, Robert Stoll wrote: Heya, I do not know how much it concerns this RFC but I came across the following page about an extension named "Expect" when I was searching for RFC Expect with google. http://php.net/manual/en