Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Markus Fischer
Hi, On 22.01.19 21:34, Girgias wrote: - phpversion (use PHP_VERSION constant) The function takes an optional argument `string $extension`, what is the replacement for that? - intval (for arbitrary base change there exists the math function base_convert) I've seen and myself u

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Claude Pache
> - settype AFAICS, there is no easy replacement for settype(). If the second argument is a string literal, you can use type coercion + assignment at the price of duplicating the occurrence of the first argument. If the second argument is not known at compile time, you have to resort to a

RE: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Jani Ollikainen
Hi, The arguments why to deprecate didn't seem much more than, this maybe could be deprecated. I think there should usually be some benefits of deprecating, otherwise why not just leave it as it is? But some comments that I didn't notice in others. >- php_uname (use PHP_OS constant) PHP_OS

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Arvids Godjuks
ср, 23 янв. 2019 г. в 12:04, Jani Ollikainen : > Hi, > > The arguments why to deprecate didn't seem much more than, this maybe > could be deprecated. I think there should usually be some > benefits of deprecating, otherwise why not just leave it as it is? > > But some comments that I didn't notice

[PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Andrey O Gromov
Full description https://wiki.php.net/rfc/code_free_constructor Draft realisation https://github.com/php/php-src/compare/master...rjhdby:constructor "Code free" constructor is constructor with only purpose to directly set object properties from received parameters and, optionally, call parent co

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Ivan Enderlin
On 23.01.19 13:32, Andrey O Gromov wrote: Full description https://wiki.php.net/rfc/code_free_constructor Draft realisation https://github.com/php/php-src/compare/master...rjhdby:constructor "Code free" constructor is constructor with only purpose to directly set object properties from received

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Girgias
On Wed, 23 Jan 2019 at 09:02, Markus Fischer wrote: > Hi, > > On 22.01.19 21:34, Girgias wrote: > > - phpversion (use PHP_VERSION constant) > > The function takes an optional argument `string $extension`, what is the > replacement for that? > Didn 't realise not all of the extensions have a

[PHP-DEV] Re: Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Andrey O Gromov
>> Full description https://wiki.php.net/rfc/code_free_constructor >> Draft realisation https://github.com/php/php-src/compare/master...rjhdby:constructor >> >> "Code free" constructor is constructor with only purpose to directly set >> object properties from received parameters and, optionally,

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Bruce Weirdan
On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > Proposed syntax > class A($prop) extends B("BlaBla", $prop) { > } Would this work with anonymous classes? If so, how would the syntax look like? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.ph

HA: Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Andrey O Gromov
>> Proposed syntax >> class A($prop) extends B("BlaBla", $prop) { >> } >Would this work with anonymous classes? If so, how would the syntax look like? Currently this syntax can't be used with anonymous classes because those classes instantiated at once they declared and same syntax is used for

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Claude Pache
> Le 23 janv. 2019 à 14:19, Girgias a écrit : > > > > On Wed, 23 Jan 2019 at 09:19, Claude Pache wrote: > >> >>> - settype >> >> AFAICS, there is no easy replacement for settype(). If the second argument >> is a string literal, you can use type coercion + assignment at the price of >> d

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Girgias
On Wed, 23 Jan 2019 at 15:43, Claude Pache wrote: > So, since you didn’t see, here are some practical usages of settype(): > > function foo($bar) { > // $bar is supposed to be either a string, or a list of strings > settype($bar, 'array'); > // ... > } > > function qux($id) { >

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Dan Ackroyd
On Tue, 22 Jan 2019 at 20:34, Girgias wrote: > > a list of functions which seem reasonable to deprecate > Classes/Objects functions: > >- is_a (use instanceof operator) This is a fundamentally bad idea. Functions can be passed around as functions, operators cannot be, which makes it easie

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Dan Ackroyd
On Wed, 23 Jan 2019 at 12:32, Andrey O Gromov wrote: > > Full description > https://wiki.php.net/rfc/code_free_constructor > Draft realisation > https://github.com/php/php-src/compare/master...rjhdby:constructor > If this RFC solves a big problem for you, I would strongly recommend looking at sol

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Levi Morrison
On Wed, Jan 23, 2019 at 6:57 AM Bruce Weirdan wrote: > > On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > > > Proposed syntax > > class A($prop) extends B("BlaBla", $prop) { > > } > > Would this work with anonymous classes? If so, how would the syntax look like? I have the same question.

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Levi Morrison
On Tue, Jan 22, 2019 at 1:35 PM Girgias wrote: > > Greetings PHP internals, > After skimming through the PHP documentation, I came up with a list of > functions which seem > reasonable to deprecate as of PHP 8 and I would like to gather some > opinions from Internals. > If this seems like it's too

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Thomas Hruska
On 1/22/2019 1:34 PM, Girgias wrote: Greetings PHP internals, After skimming through the PHP documentation, I came up with a list of functions which seem reasonable to deprecate as of PHP 8 and I would like to gather some opinions from Internals. If this seems like it's too early or should be in

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Benjamin Morel
> 2.78 million vs. 5.1 million* code references. > 1.54 million results. > 10 million results. Broad, active usage. > ... I would not in any way base deprecation decisions on current usage statistics. If there are several ways to do something, and one is clearly better than the others (naming con

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Rowan Collins
On Wed, 23 Jan 2019 at 16:37, Benjamin Morel wrote: > > 2.78 million vs. 5.1 million* code references. > > 1.54 million results. > > 10 million results. Broad, active usage. > > ... > > I would not in any way base deprecation decisions on current usage > statistics. If there are several ways to

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Girgias
On Wed, 23 Jan 2019 at 16:23, Dan Ackroyd wrote: > On Tue, 22 Jan 2019 at 20:34, Girgias wrote: > > > > a list of functions which seem reasonable to deprecate > > > Classes/Objects functions: > > > >- is_a (use instanceof operator) > > This is a fundamentally bad idea. > > Functions can b

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Rowan Collins
On Wed, 23 Jan 2019 at 17:25, Girgias wrote: > I understand the rationale for functional programming, may I ask > in your opinion should PHP have built-in functions for arithmetic > operations so that it can be used in such a way without needing userland > implementations? > There was a proposa

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Levi Morrison
On Wed, Jan 23, 2019 at 8:43 AM Levi Morrison wrote: > > On Wed, Jan 23, 2019 at 6:57 AM Bruce Weirdan wrote: > > > > On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > > > > > Proposed syntax > > > class A($prop) extends B("BlaBla", $prop) { > > > } > > > > Would this work with anonymous

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Girgias
On Wed, 23 Jan 2019 at 18:30, Rowan Collins wrote: > On Wed, 23 Jan 2019 at 17:25, Girgias wrote: > > > I understand the rationale for functional programming, may I ask > > in your opinion should PHP have built-in functions for arithmetic > > operations so that it can be used in such a way witho

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Christoph M. Becker
On 23.01.2019 at 18:30, Rowan Collins wrote: > On Wed, 23 Jan 2019 at 17:25, Girgias wrote: > >> I understand the rationale for functional programming, may I ask >> in your opinion should PHP have built-in functions for arithmetic >> operations so that it can be used in such a way without needin

[PHP-DEV] Exposing the linux namespaces API via pcntl_*

2019-01-23 Thread Pedro Magalhães
Hi internals, Linux namespaces have been around for a long time and in recent years their usage has increased dramatically with the popularization of containers. Modern browsers also make use of them to sandbox certain processes and so on. To quote an introduction to the subject: The purpose of e

Re: [PHP-DEV] Exposing the linux namespaces API via pcntl_*

2019-01-23 Thread Rowan Collins
On 23/01/2019 21:15, Pedro Magalhães wrote: I think it can be useful for a language to expose this functionality to the users for that kind of purpose (ie. run a security sensitive task in isolation, simulate certain conditions like no network access, etc..). For that end, I've put forward https:

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Tom Worster
Hi George, Iiuc, the problem you're trying to solve is that PHP offers too many ways to do the same thing and if there were fewer then PHP code would be easier to write, read and maintain. Differences in code that make no difference to the compiler are differences in style. The conventiona

Re: [PHP-DEV] Deprecation ideas for PHP 8

2019-01-23 Thread Dan Ackroyd
On Wed, 23 Jan 2019 at 17:25, Girgias wrote: > I understand the rationale for functional programming, may I ask > in your opinion should PHP have built-in functions for arithmetic > operations so that it can be used in such a way without needing userland > implementations? No, but only I'd much

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Stanislav Malyshev
Hi! > Proposed syntax > class A($prop) extends B("BlaBla", $prop) { > } This looks like unobvious magic. PHP approach has traditionally been to avoid unobvious magic, and be explicit about what is happening. This functionality does not seem no be enabling anything different, and seems to be prett