Re: RE: RFC: expectations/assertions

From: Date: Tue, 04 Feb 2014 21:30:22 +0000
Subject: Re: RE: RFC: expectations/assertions
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi Andrea,

On Wed, Feb 5, 2014 at 6:12 AM, Andrea Faulds <[email protected]> wrote:

> On 04/02/14 21:09, Yasuo Ohgaki wrote:
>
>> It's inconsistent as closure is valid expression.
>> Allowing callable make behavior consistent. It enables more
>> complex assertion inline, thus it's possible name space clean.
>>
>
> Might also help assert() performance, given that I expect executing a
> closure to be quicker than eval() (though I may be wrong).


eval() works.

php > assert(eval('FALSE;'));

Warning: assert(): Assertion failed in php shell code on line 1
php > assert(eval('return FALSE;'));

Warning: assert(): Assertion failed in php shell code on line 1
php >

However, it does not solve inconsistency. PHP code has to be string.
Writing PHP code as string is not fun thing to do ;)

Regards,

--
Yasuo Ohgaki
[email protected]


Thread (44 messages)

« previous php.internals (#72217) next »