Re: [PHP-DEV] Data serialization of objects, want to iterate 'sealed' properties then dynamic ones

2015-09-22 Thread François Laupretre
Hi, Hope this can help. Le 22/09/2015 20:16, j adams a écrit : I'm working on a data serialization routine wherein I must iterate through an object's properties while distinguishing between "sealed" properties (i.e., those specified by class definitions) and "dynamic" properties" (i.e., those a

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-22 Thread François Laupretre
Hi Rowan, Le 22/09/2015 12:49, Rowan Collins a écrit : I take it you didn't like my suggestion of separate functions for hasitem() and variable_exists() then? I think there are two very different use cases here, and combining them will just add to the confusion which isset() already seems to c

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
On Wed, Sep 23, 2015 at 12:00 AM, Anthony Ferrara wrote: > Dmitry, > > On Tue, Sep 22, 2015 at 3:19 PM, Dmitry Stogov wrote: > > > > > > On Tue, Sep 22, 2015 at 9:20 PM, Anthony Ferrara > > wrote: > >> > >> Dmitry, > >> > >> On Tue, Sep 22, 2015 at 2:05 PM, Dmitry Stogov wrote: > >> > On Tue,

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Anthony Ferrara
Dmitry, On Tue, Sep 22, 2015 at 3:19 PM, Dmitry Stogov wrote: > > > On Tue, Sep 22, 2015 at 9:20 PM, Anthony Ferrara > wrote: >> >> Dmitry, >> >> On Tue, Sep 22, 2015 at 2:05 PM, Dmitry Stogov wrote: >> > On Tue, Sep 22, 2015 at 7:01 PM, Bob Weinand >> > wrote: >> > >> >> >> >> > Am 22.09.2015

Re: [PHP-DEV] Data serialization of objects, want to iterate 'sealed' properties then dynamic ones

2015-09-22 Thread j adams
Thank you, Sean. Still looking for a couple of answers... > 1) 'Default Properties' or properties stored on the class (not object) can be found on the zend_class_entry[0], they are just accessed by offset [1] > This isn't a stable/public API, but good for a cool hack! I'm afraid I don't follow. C

Re: [PHP-DEV] Data serialization of objects, want to iterate 'sealed' properties then dynamic ones

2015-09-22 Thread Sean DuBois
On Tue, Sep 22, 2015 at 11:16:46AM -0700, j adams wrote: > I'm working on a data serialization routine wherein I must iterate through > an object's properties while distinguishing between "sealed" properties > (i.e., those specified by class definitions) and "dynamic" properties" > (i.e., those ass

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Jefferson Gonzalez
On 09/22/2015 06:38 AM, Stig Bakken wrote: Actually, you need to think about compatibility in a bigger perspective. One of the first things I would want do if PHP were to grow enums, is to add support for it to Apache Thrift. For those not familiar with it, Thrift is basically an IDL for specify

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
On Tue, Sep 22, 2015 at 9:24 PM, Bob Weinand wrote: > > Am 22.09.2015 um 20:05 schrieb Dmitry Stogov : > > The current PHP version emits two warning on similar constructs, and this > is explainable because we explicitly "use" $y. > > $ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3;

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
On Tue, Sep 22, 2015 at 9:20 PM, Anthony Ferrara wrote: > Dmitry, > > On Tue, Sep 22, 2015 at 2:05 PM, Dmitry Stogov wrote: > > On Tue, Sep 22, 2015 at 7:01 PM, Bob Weinand > wrote: > > > >> > >> > Am 22.09.2015 um 17:36 schrieb Dmitry Stogov : > >> > > >> > On Tue, Sep 22, 2015 at 4:54 PM, Joe

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Bob Weinand
> Am 22.09.2015 um 20:05 schrieb Dmitry Stogov : > > The current PHP version emits two warning on similar constructs, and this > is explainable because we explicitly "use" $y. > > $ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3; return > $y+$x;})(5);return $y;} var_dump(foo());' >

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Anthony Ferrara
Dmitry, On Tue, Sep 22, 2015 at 2:05 PM, Dmitry Stogov wrote: > On Tue, Sep 22, 2015 at 7:01 PM, Bob Weinand wrote: > >> >> > Am 22.09.2015 um 17:36 schrieb Dmitry Stogov : >> > >> > On Tue, Sep 22, 2015 at 4:54 PM, Joe Watkins >> wrote: >> > >> >> I'd really like to understand what you're tryi

[PHP-DEV] Data serialization of objects, want to iterate 'sealed' properties then dynamic ones

2015-09-22 Thread j adams
I'm working on a data serialization routine wherein I must iterate through an object's properties while distinguishing between "sealed" properties (i.e., those specified by class definitions) and "dynamic" properties" (i.e., those assigned ad-hoc to some object that are not party of any class defin

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
On Tue, Sep 22, 2015 at 7:01 PM, Bob Weinand wrote: > > > Am 22.09.2015 um 17:36 schrieb Dmitry Stogov : > > > > On Tue, Sep 22, 2015 at 4:54 PM, Joe Watkins > wrote: > > > >> I'd really like to understand what you're trying to say there Dmitry, > but > >> I don't get it. > >> > >> What is your

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Rowan Collins
Dan Cryer wrote on 22/09/2015 16:06: C#'s enums seem a good model to follow. It's worth pointing out that C#'s enums are basically the same as C's - a typedef over int with a handful of helper methods in the standard library. They don't even range-check on assignment, so that a "weekday" var

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Levi Morrison
On Tue, Sep 22, 2015 at 10:29 AM, Rowan Collins wrote: > Dan Cryer wrote on 22/09/2015 16:06: >> >> C#'s enums seem a good model to follow. > > > It's worth pointing out that C#'s enums are basically the same as C's - a > typedef over int with a handful of helper methods in the standard library. >

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Bob Weinand
> Am 22.09.2015 um 17:36 schrieb Dmitry Stogov : > > On Tue, Sep 22, 2015 at 4:54 PM, Joe Watkins wrote: > >> I'd really like to understand what you're trying to say there Dmitry, but >> I don't get it. >> >> What is your example function trying to show ? >> >> As it mentions in the RFC, vars

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
On Tue, Sep 22, 2015 at 4:54 PM, Joe Watkins wrote: > I'd really like to understand what you're trying to say there Dmitry, but > I don't get it. > > What is your example function trying to show ? > > As it mentions in the RFC, vars in short closure are by-value, so I can't > see what side effect

[PHP-DEV] Re: [RFC] [VOTE] Short Closures

2015-09-22 Thread Andrea Faulds
Hi Bob, Bob Weinand wrote: Hey, Thanks for all your feedback in the discussion thread! So, before I start the vote, just two quick notes: I've added two notes about the statement syntax and the single variable use. Though a few people complained, I'm not switching to the ==> operator, as I no

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Sebastian Bergmann
Am 22.09.2015 um 12:38 schrieb Stig Bakken: > The point I'm trying to make is that an enum's normalized > representation should be an integer, and that is also how it should be > serialized. Makes sense to me. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http:

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Dan Cryer
> > You can always serialize things however you want. Using `serialize()` > is just a convenience – there is absolutely nothing that prevents you > from using a custom serialization routine. Note that while Java has > built in serialization it is often not used, and instead libraries > like Google'

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Levi Morrison
> The point I'm trying to make is that an enum's normalized > representation should be an integer, and that is also how it should be > serialized. It also happens to be how most other languages chose to > represent enums, and deviating from that will cause all kinds of pain > the minute you need to

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Joe Watkins
I'd really like to understand what you're trying to say there Dmitry, but I don't get it. What is your example function trying to show ? As it mentions in the RFC, vars in short closure are by-value, so I can't see what side effects you might be thinking of ? Cheers Joe On Tue, Sep 22, 2015 at

[PHP-DEV] Benchmark Results for PHP Master 2015-09-22

2015-09-22 Thread lp_benchmark_robot
Results for project php-src-nightly, build date 2015-09-22 05:00:00+03:00 commit: b7f0b4bdb3f2723695224eadef73ef180db6132a revision_date: 2015-09-21 22:05:45+08:00 environment:Haswell-EP cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-22 Thread Rowan Collins
François Laupretre wrote on 22/09/2015 01:11: Hi, for those interested, a pull request implementing an exists() construct (on PHP 7) is available for testing and reviewing : https://github.com/php/php-src/pull/1530 exists() is modelled after isset(), with the difference that every value (in

Re: [PHP-DEV] Re: Let's discuss enums!

2015-09-22 Thread Stig Bakken
On Fri, Sep 18, 2015 at 2:05 AM, Rowan Collins wrote: > On 18/09/2015 00:34, user@domain.invalid wrote: >> >> Well, how are you supposed to serialize an enum value without some sort of >> numerical representation or value? Maybe you could serialize it by >> converting the enum to a string represen

Re: [PHP-DEV] Coding styles ...

2015-09-22 Thread Stig Bakken
On Sep 19, 2015 15:50, "Rowan Collins" wrote: > > On 19 September 2015 10:48:17 BST, Lester Caine wrote: > >I get that a lot of people think that the only way forward with PHP is > >fully typed, strict checking and blocking anything that may be deemed > >to > >be risky. However PHP7 has not yet d

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Peter Petermann
Hi, The introduction claims: "he current implementation of anonymous functions in PHP is quite verbose compared to other languages. That makes using anonymous functions be more difficult than it could be, as there is both more to type, and more importantly the current implementation makes it hard

Re: [PHP-DEV] [RFC] [VOTE] Short Closures

2015-09-22 Thread Dmitry Stogov
I'm against the magic - "automatically use () all of the (compiled) variables". I'm also against compound short closures with curly brackets. in my opinion they opens too many ambiguous questions. function foo() { (($x) ~> {$y = 3; return $y + $x;})(5); return $y; } also think about nested cl

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-22 Thread Lester Caine
On 22/09/15 01:11, François Laupretre wrote: > for those interested, a pull request implementing an exists() construct > (on PHP 7) is available for testing and reviewing : > > https://github.com/php/php-src/pull/1530 > > exists() is modelled after isset(), with the difference that every value >