Re: [PHP-DEV] return values of socket_recvmsg

2018-01-25 Thread Kalle Sommer Nielsen
Hi Sam 2018-01-25 23:11 GMT+01:00 Sam Ding : > > The test case ext/sockets/tests/socket_recvmsg.php has following output > on x86_64: > > === > ... > 1 Array > 2 ( > 3[name] => Array > 4( > 5[family] => 10 > 6[addr] => ::1 > 7

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Niklas Keller
Michael Morris schrieb am Fr., 26. Jan. 2018, 02:06: > On Thu, Jan 25, 2018 at 3:04 PM, Niklas Keller wrote: > > > > >> > >> $a instanceof array > >> > > > > That might work, but array should only return true if it's an > > array, not for anything that

Re: [PHP-DEV] Difference between smart_str and smart_string

2018-01-25 Thread Sara Golemon
On Thu, Jan 25, 2018 at 10:50 PM, Ryan McCullagh wrote: > I have been browsing php-src and notice smart_string, and smart_str, each > with their header files. Why is there two seemingly identical structures with > the same name? > smart_string targets a raw char* buffer,

[PHP-DEV] Difference between smart_str and smart_string

2018-01-25 Thread Ryan McCullagh
Hello internals, I have been browsing php-src and notice smart_string, and smart_str, each with their header files. Why is there two seemingly identical structures with the same name? -- Ryan McCullagh ryanmccullagh.com -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 3:04 PM, Niklas Keller wrote: > >> >> $a instanceof array >> > > That might work, but array should only return true if it's an > array, not for anything that implements ArrayAccess. > > Related: On Thu, Jan 25, 2018 at 4:11 PM, Levi Morrison

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Larry Garfield
On Thursday, January 25, 2018 4:11:02 PM CST Levi Morrison wrote: > > IMPLEMENTATION STYLE #1: collectionof operator > > The style of implementation I like the most is a collectionof operator in > > parallel to the instance_of operator. It would be instanceof's plural > > brother, so > > > >

[PHP-DEV] Requesting php-src Karma

2018-01-25 Thread Thomas Punt
Hi internals, I'd like to request for php-src karma for my account (tpunt) in order to help with the handling of PRs on GitHub. Having been contributing to PHP for a few years now, I feel like I've got the hang of things well enough to make more of an impact to the project now. Thanks, Tom

[PHP-DEV] return values of socket_recvmsg

2018-01-25 Thread Sam Ding
The test case ext/sockets/tests/socket_recvmsg.php has following output on x86_64: === ... 1 Array 2 ( 3[name] => Array 4( 5[family] => 10 6[addr] => ::1 7[port] => 7001 8[flowinfo] => 0 9[scope_id] => 0 10) 11

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Levi Morrison
> IMPLEMENTATION STYLE #1: collectionof operator > The style of implementation I like the most is a collectionof operator in > parallel to the instance_of operator. It would be instanceof's plural > brother, so > > $arg collectionof \SomeClass > > To pass the check $arg must be of the iterable

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Rowan Collins
On 25/01/2018 20:19, Michael Morris wrote: He's getting the syntax from Java. Actually, from C++, and possibly from somewhere before that; at this point, it's pretty widely adopted. The problem is that Java already has the policing mechanics present in the runtime to police insertions

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Niklas Keller
> > On Thu, Jan 25, 2018 at 2:39 PM, Niklas Keller wrote: > >> >> So, given `$a collectionof string` the operator returns whether or not $a >>> is, at that time, a collection of strings (be it an array or other >>> iterable). It doesn't insure $a will stay that way - it's just a

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 2:39 PM, Niklas Keller wrote: > > So, given `$a collectionof string` the operator returns whether or not $a >> is, at that time, a collection of strings (be it an array or other >> iterable). It doesn't insure $a will stay that way - it's just a check of

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Niklas Keller
Michael Morris schrieb am Do., 25. Jan. 2018, 21:19: > On Thu, Jan 25, 2018 at 2:10 PM, Rowan Collins > wrote: > > > On 25/01/2018 14:52, Derick Rethans wrote: > > > >> IMO, it makes a lot more sense to check integrity when creating the > >> "array"

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 2:16 PM, Rowan Collins wrote: > On 25/01/2018 18:56, Michael Morris wrote: > >> Ok, let's stay on topic please. >> This RFC discussion is about an operator or family of functions to verify >> that a given $var is a collection. Objects which

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 2:10 PM, Rowan Collins wrote: > On 25/01/2018 14:52, Derick Rethans wrote: > >> IMO, it makes a lot more sense to check integrity when creating the >> "array" structure. Instead, I would suggest to add a native Collection >> type, that takes a

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Rowan Collins
On 25/01/2018 18:56, Michael Morris wrote: Ok, let's stay on topic please. This RFC discussion is about an operator or family of functions to verify that a given $var is a collection. Objects which enforce collection integrity is a tangential but whole other topic outside the scope of what I

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Rowan Collins
On 25/01/2018 14:52, Derick Rethans wrote: IMO, it makes a lot more sense to check integrity when creating the "array" structure. Instead, I would suggest to add a native Collection type, that takes a "type" as argument. They aren't quite full generics, but it does 1. fix something; 2. isn't

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 10:14 AM, Bishop Bettini wrote: > > Agreed, and we can get *almost* there today with: > > $collection = collection_of('is_int', [ 1, 2 ]); > Ok, let's stay on topic please. This RFC discussion is about an operator or family of functions to verify that a

Re: [PHP-DEV] [RFC][DISCUSSION] Strong Typing Syntax

2018-01-25 Thread Andreas Hennings
I will not On 22 January 2018 at 22:11, Stanislav Malyshev wrote: > Hi! > >> I want to see strict typing as an option, not a requirement. > > You seem to be under impression that this somehow makes things easier. > It does not. To explain: let's say you design a strictly

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Ryan Pallas
On Thu, Jan 25, 2018 at 9:21 AM, Derick Rethans wrote: > On Thu, 25 Jan 2018, Ryan Pallas wrote: > > > On Thu, Jan 25, 2018 at 7:52 AM, Derick Rethans wrote: > > > > > On Wed, 24 Jan 2018, Michael Morris wrote: > > > > > > > Ok, here's another idea I've been

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Michael Morris
On Thu, Jan 25, 2018 at 10:21 AM, Derick Rethans wrote: > > PHP owns the top-level namespace. It has always done that. It's even > documented: http://docs.php.net/manual/en/userlandnaming.rules.php > > That doesn't stop the bellyaching when the refactoring becomes necessary. If

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Derick Rethans
On Thu, 25 Jan 2018, Ryan Pallas wrote: > On Thu, Jan 25, 2018 at 7:52 AM, Derick Rethans wrote: > > > On Wed, 24 Jan 2018, Michael Morris wrote: > > > > > Ok, here's another idea I've been mulling over. This I know is possible > > > because I've done it using user land code,

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Bishop Bettini
On Thu, Jan 25, 2018 at 9:52 AM, Derick Rethans wrote: > On Wed, 24 Jan 2018, Michael Morris wrote: > > > Ok, here's another idea I've been mulling over. This I know is possible > > because I've done it using user land code, specifically Drupal 8's > > Assertion\Inspector class.

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Ryan Pallas
On Thu, Jan 25, 2018 at 7:52 AM, Derick Rethans wrote: > On Wed, 24 Jan 2018, Michael Morris wrote: > > > Ok, here's another idea I've been mulling over. This I know is possible > > because I've done it using user land code, specifically Drupal 8's > > Assertion\Inspector class.

Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection

2018-01-25 Thread Derick Rethans
On Wed, 24 Jan 2018, Michael Morris wrote: > Ok, here's another idea I've been mulling over. This I know is possible > because I've done it using user land code, specifically Drupal 8's > Assertion\Inspector class. > >