[PHP-DEV] [RFC] [Discussion] JSON_THROW_ON_ERROR

2017-09-09 Thread Andrea Faulds
Hi everyone, Craig Duncan previously sparked discussion here about JSON's error-handling behaviour. Unfortunately, his attempt to change it seems not to have gone anywhere, but I have his blessing to try this other approach instead. So here's an RFC: https://wiki.php.net/rfc/json_throw_on_er

Re: [PHP-DEV] [RFC] [Discussion] Operator functions

2017-09-09 Thread Andrea Faulds
Hi Nikita, Nikita Popov wrote: On Fri, Sep 8, 2017 at 11:41 PM, Andrea Faulds wrote: I like the general idea here, but have some comments. My main observation is that this proposal is only really useful in combination with a form of partial application. Indeed. I think the RFC feels somewha

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-09 Thread ilija . tovilo
> Applying break statements is the first thing you should do if you intend > to break. That way it can't be forgotten. You should also immediately free the memory you’ve allocated but memory leaks still happen all the time. Human error is inevitable. The more the compiler can do for you automati

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-09 Thread Thomas Hruska
On 9/9/2017 5:18 AM, Dan Ackroyd wrote: for when you forget to put break. Applying break statements is the first thing you should do if you intend to break. That way it can't be forgotten. -- Thomas Hruska CubicleSoft President I've got great, time saving software that you will find useful

Re: [PHP-DEV] [RFC] [Discussion] Operator functions

2017-09-09 Thread Nikita Popov
On Fri, Sep 8, 2017 at 11:41 PM, Andrea Faulds wrote: > Hi everyone! > > Here's an RFC for a small, simple, self-contained feature with no > backwards-compatibility breaks and which in fact doesn't even touch the > language's syntax (it's 50%+1 eligible!) but which could make PHP a bit > more exp

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-09 Thread Dan Ackroyd
On 9 September 2017 at 12:21, wrote: > Hi everybody! > > Has this idea been discussed before? > .. > Each case has an implicit `break` This part has come up before, as the default behaviour of fall through is a nasty gotcha for when you forget to put break. I can't find the conversation right no

[PHP-DEV] Re: [RFC] Match expression

2017-09-09 Thread Andreas Treichel
Hi, Something like: function match($x) { switch(true) { case $x === 1: return 'Tiny'; case is_numeric($x) && $x <= 10: return 'Small'; case is_numeric($x) && $x <= 20: return 'Medium'; case is_numeric($x) && $x <= 30:

[PHP-DEV] [RFC] Match expression

2017-09-09 Thread ilija . tovilo
Hi everybody! Has this idea been discussed before? I find myself writing switch statements in PHP quite rarely. This has a few reasons: 1. It doesn’t have a "strict_types” version 2. It is quite verbose (lots of breaks) 3. It is a statement rather than an expression Often, if / elseif statemen

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-09 Thread Niklas Keller
2017-09-09 8:07 GMT+02:00 Haitao Lv : > > > On 1 Sep 2017, at 22:25, Niklas Keller wrote: > > > > A potential way around that (might be a stupid idea I just had): Allow > > defining "wrappers" per file, that auto-wrap marked functions. > > Amp need these wrapper functions because we cannot yield

Re: [PHP-DEV] add Fiber (sackful coroutine) support

2017-09-09 Thread Haitao Lv
> On 9 Sep 2017, at 14:27, Haitao Lv wrote: > >> I note that the examples there all implement it not as a keyword, but as a >> library function, which maybe makes more sense: whereas "yield" turns a >> function declaration into a generator declaration, "Fiber\yield", as we >> might call it, i

Re: [PHP-DEV] Re: [RFC] [Discussion] Operator functions

2017-09-09 Thread ilija . tovilo
I also love this idea! This and short arrow functions and I’m golden (in terms of closures at least) :) Regards On 9 Sep 2017, 03:31 +0200, Tom Worster , wrote: > On 8 Sep 2017, at 17:41, Andrea Faulds wrote: > > > Hi everyone! > > > > Here's an RFC for a small, simple, self-contained feature wi

Re: [PHP-DEV] A validator module for PHP7

2017-09-09 Thread Tony Marston
"Yasuo Ohgaki" wrote in message news:caga2bxa4uvkl-zslab2bf05l4q_oduixszvvyzu9nddksvt...@mail.gmail.com... Hi Tony, As a person who has been developing database applications for several decades and with PHP since 2003 I'd like to chip in with my 2 cent's worth. Firstly I agree with Dan's

Re: [PHP-DEV] Don't add simple objects to GC's roots

2017-09-09 Thread Haitao Lv
> On 30 Jul 2017, at 18:19, Andreas Treichel wrote: > > Hi, > >> So I propose to make the gc_disable function accept one zval reference as >> parameter. And if gc_disable get that zval, gc_disable just drop the zval’s >> GC_COLLECTABLE flag, which will hint the PHP gc not to trace that zval. >