Re: [PHP-DEV] Compact can't resolve outer scoped variables using short closures

2022-10-20 Thread David Rodrigues
t;function", and getting back to the main topic, would it be possible to do the same with compact()? fn() => compact('dummy') turns into: fn() => [ 'dummy' => $dummy ] which turns into: function() use($dummy) { return [ 'dummy' => $dummy ]; } Atenciosamente, David Rodrigues

Re: [PHP-DEV] Compact can't resolve outer scoped variables using short closures

2022-10-19 Thread David Rodrigues
ectly over the resulting array, rather than the compact itself. Atenciosamente, David Rodrigues Em qua., 19 de out. de 2022 às 14:09, Marco Pivetta escreveu: > On Wed, 19 Oct 2022, 19:04 David Rodrigues, > wrote: > >> Hello! >> >> I'm converting my code to u

[PHP-DEV] Compact can't resolve outer scoped variables using short closures

2022-10-19 Thread David Rodrigues
ssibility of this being fixed? I would love to help, but I don't have much C programming skills, unfortunately. Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-10-16 Thread David Rodrigues
#x27;123' [ $a ?: '123' ] = [ 456 ]; so $a = 456 Atenciosamente, David Rodrigues

Re: [PHP-DEV] Feature preview (formely was: experimental features)

2022-10-11 Thread David Rodrigues
>From what I understand, your concern is "what if we need to change the direction of something already decided"? For example, initially it was decided and very well accepted private(set), but after a while the idea was revised and it was decided that private:set would be better instead. In this ca

Re: [PHP-DEV] Feature preview (formely was: experimental features)

2022-10-11 Thread David Rodrigues
taxes to co-exist in this feature is acceptable (which I personally think is a bad idea). Atenciosamente, David Rodrigues Em ter., 11 de out. de 2022 às 22:23, Larry Garfield escreveu: > On Tue, Oct 11, 2022, at 3:25 PM, David Rodrigues wrote: > > In order to try to organize a litt

[PHP-DEV] Feature preview (formely was: experimental features)

2022-10-11 Thread David Rodrigues
eatures should generally be released in patch versions (eg. PHP 8.1.12 to preview a PHP 8.2 feature). Atenciosamente, David Rodrigues

Re: [PHP-DEV] Experimental features

2022-10-10 Thread David Rodrigues
use experimental_json_validate(), else use previous PHP compatible code. Atenciosamente, David Rodrigues Em seg., 10 de out. de 2022 às 19:20, David Gebler escreveu: > My two cents... > > Why can't "common users" install a PECL extension? It's not a difficult, &

Re: [PHP-DEV] Experimental features

2022-10-06 Thread David Rodrigues
earlier feedback from users willing to test it. Atenciosamente, David Rodrigues Em qui., 6 de out. de 2022 às 17:12, Rowan Tommins escreveu: > On 06/10/2022 17:41, Alex Wells wrote: > > For example, Kotlin has recently introduced a new feature - unsigned > integer types. > > &g

Re: [PHP-DEV] Experimental features

2022-10-05 Thread David Rodrigues
atures and shouldn't be used in production (unless you're willing to take risks). The difference between using the in-development version of PHP 8.2 is that many servers only make this version officially available after a few months, while smaller versions of PHP usually become available w

Re: [PHP-DEV] Experimental features

2022-10-04 Thread David Rodrigues
amente, David Rodrigues Em ter., 4 de out. de 2022 às 19:37, Flávio Heleno escreveu: > On Tue, Oct 4, 2022, 17:43 David Rodrigues wrote: > >> I wanted to suggest the possibility of introducing experimental features >> to >> PHP. >> >> This is an old thread

[PHP-DEV] Experimental features

2022-10-04 Thread David Rodrigues
before the next version is released, allowing users to try them out more easily. Atenciosamente, David Rodrigues

Re: [PHP-DEV] array_merge() vs array unpacking performance

2022-08-01 Thread David Rodrigues
han array unpacking. Atenciosamente, David Rodrigues Em seg., 1 de ago. de 2022 às 14:45, Kamil Tekiela escreveu: > Hi David, > > It would be useful if you could provide your measurements and the way you > arrived at such results. A quick test doesn't seem to support your > fin

[PHP-DEV] array_merge() vs array unpacking performance

2022-08-01 Thread David Rodrigues
Hello! PHP 8.1 supports array unpacking with keys. I guess that is very similar to array_merge(), but for some reason array_merge() is 50% slower than unpacking. So my question is: is there some way to optimize the engine so array_merge() can work like unpacking? Thanks!

Re: [PHP-DEV] RFC Idea - is_json - looking for feedback

2022-07-29 Thread David Rodrigues
ntion. The performance would also be absurdly better. What worries me above is the misuse of the function, like checking if is_json() === true and using json_decode() right after. However, I believe this can be easily optimized by the engine itself. My vote is YES. Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Undefined Property Error Promotion

2022-04-15 Thread David Rodrigues
> $foo[?'maynotexist'] // returns null and emits no warning In JS we have some like: foo['maynotexist'] foo?.['maynotexist'] In PHP could be: $foo['maynotexist'] $foo?->['maynotexist'] Atenciosamente, David Rodrigues Em sex., 15 de ab

Re: [PHP-DEV] [RFC] [VOTE] Allow null and false as stand-alone types

2022-03-12 Thread David Rodrigues
Maybe I'm a little late to this discussion, but is there any reason why *false|null* is allowed but *true|null* is not? I can think of few cases where *true|null* could be interesting, but I've been through situations like this. Atenciosamente, David Rodrigues Em sáb., 12 de mar.

Re: [PHP-DEV] RFC Concept: "Import" of simplied string manipulation and other instructions from ASP Classic

2021-09-25 Thread David Rodrigues
weeks using date() -- I had to search. But I think creating new "root functions" would be too much. Perhaps a package like Carbon could be very useful. Or even the DateTime itself. Atenciosamente, David Rodrigues Em sáb., 25 de set. de 2021 às 16:48, Daniele B via internals < intern

[PHP-DEV] Class static initialization block

2021-09-11 Thread David Rodrigues
Hello! I would like to suggest a feature I saw being implemented in the V8 9.4 engine called "*class static initialization block*". https://v8.dev/blog/v8-release-94 In short, it is a method that is executed once when a class is imported and loaded, allowing for some more advanced initialization

[PHP-DEV] array_merge() inside looping optimization

2021-07-25 Thread David Rodrigues
erate another one. Anyway, I don't know if this is actually possible, or if the cost-benefit would be better than what there is today. But I believe it is a path to be thought of. Atenciosamente, David Rodrigues

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread David Rodrigues
but the idea didn't go forward (even though there were no alternatives). :( Atenciosamente, David Rodrigues Em sáb., 10 de jul. de 2021 às 06:10, Max Semenik escreveu: > I've been thinking about extending PHP's cast syntax to user-defined types, > e.g. not only (int)$f

Re: [PHP-DEV] [RFC] Add parse_query_string as an alternative to parse_str

2021-06-23 Thread David Rodrigues
I really prefer the Sara suggestion, instead of creating a new function to do the same thing. parse_str($str): array. Atenciosamente, David Rodrigues Em qua., 23 de jun. de 2021 às 20:20, Sara Golemon escreveu: > On Wed, Jun 23, 2021 at 5:02 PM Kamil Tekiela > wrote: > > >

[PHP-DEV] Method overload support

2021-04-25 Thread David Rodrigues
be used for $userInstance, retest all options (except #2). } 3. Poorly typed functions or methods cannot be overloaded. function printId(User $user) { ... } function printId($user) { ... } // Fatal error Atenciosamente, David Rodrigues

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-03 Thread David Rodrigues
turn": "return the exit"). Is there any chance of discussing terms, even if the "never" indication is winning at the moment? Or did I miss this discussion? Thanks! Atenciosamente, David Rodrigues Em sáb., 3 de abr. de 2021 às 23:07, Matthew Brown escreveu: >

Re: [PHP-DEV] Inline conditional that returns null if falsy

2021-02-24 Thread David Rodrigues
Em qua., 24 de fev. de 2021 às 12:29, Michael Morris escreveu: > Javascript has this now though support isn't widespread. > > > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining > > The most similar way to do it in PHP would be ?-> > Optional chaining

Re: [PHP-DEV] preg_replace(string, null) is allowed?

2021-02-17 Thread David Rodrigues
Thanks! There is a reason why it is not supported anymore? There is a difference in output or performance, maybe? Atenciosamente, David Rodrigues Em qua., 17 de fev. de 2021 às 17:37, Nikita Popov escreveu: > On Wed, Feb 17, 2021 at 9:28 PM David Rodrigues > wrote: > >> He

[PHP-DEV] preg_replace(string, null) is allowed?

2021-02-17 Thread David Rodrigues
! Atenciosamente, David Rodrigues

Re: [PHP-DEV] Inline conditional that returns null if falsy

2021-02-13 Thread David Rodrigues
ed to include a class in an HTML element conditionally. There are probably better ways, but this is a quick one for simple situations: ... vs. ... It is much easier to read, and I believe that the cost for language would be minimal, and perhaps even more optimized than the use of ?:. Atenciosamente,

[PHP-DEV] Inline conditional that returns null if falsy

2021-02-12 Thread David Rodrigues
my suggestion we have: return $languageFirst instanceof LanguageExperience => $languageFirst->title; The => is just a suggestion, other options using existing keywords is: return expr() then output(); return expr(): output(); I do not know if other languages support something like that. Thanks! Atenciosamente, David Rodrigues

[PHP-DEV] PHP.net is down?

2021-01-07 Thread David Rodrigues
Hello! I cannot access php.net anymore. error 500. Atenciosamente, David Rodrigues

[PHP-DEV] Traits "implements" support

2020-11-26 Thread David Rodrigues
red! } Atenciosamente, David Rodrigues

[PHP-DEV] Strict switch

2020-11-26 Thread David Rodrigues
itch(8.0) { case strict 8.0: ... } // yes Or allowing operators (this would be the most flexible way, as it would allow for a number of other features): (6) switch(8.0) { case === 8.0: ... } // yes Atenciosamente, David Rodrigues

[PHP-DEV] Method parameter promotion support

2020-11-26 Thread David Rodrigues
red. public function setAge(private int $age) {} Just to think about whether it is possible to think of something along these lines, but I'm still not sure if it's a good option. Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-20 Thread David Rodrigues
the stables, so it's too late to enforce the right (to me) ordering. Yeah, but is there any way to go back now? :/ Atenciosamente, David Rodrigues Em sex., 20 de nov. de 2020 às 16:08, Sara Golemon escreveu: > On Fri, Nov 20, 2020 at 12:58 PM Guilliam Xavier < > guilliam.xav...@gm

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-20 Thread David Rodrigues
exposes fb() to global scope and could causes errors: function test() { function fb($n): int { if ($n === 0) return 0; if ($n === 1) return 1; return fb($n - 1) + fb($n - 2); } var_dump(fb(10)); } test(); test(); // Fatal error: Cannot redeclare fb() Atenciosamente, David R

[PHP-DEV] strict_types will be default at some moment?

2020-11-11 Thread David Rodrigues
, the unique behavior). Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread David Rodrigues
too. function fn1() as $lambda1 { return function() as $lambda2 use ($lambda1) { return [ gettype($lambda1), gettype($lambda2) ]; }; } Atenciosamente, David Rodrigues Em qua., 11 de nov. de 2020 às 14:59, Christoph M. Becker escreveu: > On 11.11.2020 at 18:39, Dan Ackr

[PHP-DEV] Supports to ?:= assignment operator

2020-11-11 Thread David Rodrigues
! Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread David Rodrigues
x(): void => y(); // equivalents to function x(): void { y(); } Atenciosamente, David Rodrigues Em seg., 26 de out. de 2020 às 11:23, Michał Marcin Brzuchalski < michal.brzuchal...@gmail.com> escreveu: > Hi Larry, > > I'm wondering why we hadn't thought yet about r

[PHP-DEV] static vars must allow expressions

2020-10-05 Thread David Rodrigues
lass Test { public function test(): void { static $x = 0; $x++; var_dump($x); } } (new Test)->test(); // 1 (new Test)->test(); // 2 Note that $x will share the context like a static property, even if it been called from a non-static context. Atenciosamente, David Rodrigues

Re: [PHP-DEV] RFC: execution opcode file without php source code file

2020-10-02 Thread David Rodrigues
be done. So opcode could be generated based on encrypted phar to give more speed. Atenciosamente, David Rodrigues Em sex., 2 de out. de 2020 às 13:52, Rowan Tommins escreveu: > On Thu, 1 Oct 2020 at 16:13, Dik Takken wrote: > > > The only use case I see is to package commercial c

Re: [PHP-DEV] __isset() and null value

2020-09-04 Thread David Rodrigues
Maybe you just can implements your own method to check? Like your exists() example. Em sex, 4 de set de 2020 15:08, Michael Voříšek - ČVUT FEL < voris...@fel.cvut.cz> escreveu: > Your examples provide code for checking the existance of real > properties. But how to check existance of a magic one?

Re: [PHP-DEV] Pass source object to clone like __clone($origThis)

2020-09-03 Thread David Rodrigues
s created using reflection without > constructor. > > With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, > > Michael Voříšek > > On 3 Sep 2020 18:00, Sara Golemon wrote: > > > On Thu, Sep 3, 2020 at 10:40 AM David Rodrigues > > wrote: >

Re: [PHP-DEV] Pass source object to clone like __clone($origThis)

2020-09-03 Thread David Rodrigues
It was just an example to avoid modify how clone works, using existing features. :) Em qui, 3 de set de 2020 13:00, Sara Golemon escreveu: > On Thu, Sep 3, 2020 at 10:40 AM David Rodrigues > wrote: > >> Now I rethinked about what I said. Really, maybe clone is not the best >

Re: [PHP-DEV] Pass source object to clone like __clone($origThis)

2020-09-03 Thread David Rodrigues
$this->copies[] = $userCopy; return $userCopy; } Considering it, we have access to both now, with "write to source" support with no additional feature need. Em qui, 3 de set de 2020 11:21, Sara Golemon escreveu: > On Wed, Sep 2, 2020 at 2:11 PM David Rodrigues > wrote: &g

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-03 Thread David Rodrigues
Do you think that it could be proxied? I mean, optimize foreach (array_keys()...) syntax to not call array_keys() in fact, but a optimized version of foreach to handle key only. I don't know it opcache could do that, and if it already does. Em qui, 3 de set de 2020 12:12, Levi Morrison via interna

Re: [PHP-DEV] [RFC] Global functions any() and all() on iterables

2020-09-03 Thread David Rodrigues
Do you think that it could be proxied too? I mean, optimize foreach (array_keys()...) syntax to not call array_keys() in fact, but a optimized version of foreach to handle key only. Em qui, 3 de set de 2020 11:36, Sara Golemon escreveu: > On Mon, Aug 31, 2020 at 6:56 PM tyson andre > wrote: > >

Re: [PHP-DEV] Pass source object to clone like __clone($origThis)

2020-09-03 Thread David Rodrigues
I don't see problem to allow modify the original object, once that you are doing it by using a new argument, and not the $this itself. Em qui, 3 de set de 2020 08:49, Pedro Magalhães escreveu: > On Wed, Sep 2, 2020 at 7:41 PM Michael Voříšek - ČVUT FEL < > voris...@fel.cvut.cz> wrote: > > > do y

Re: [PHP-DEV] Pass source object to clone like __clone($origThis)

2020-09-02 Thread David Rodrigues
I understand... seems that `$this` is very confusing inside `__clone()`: when writing, it writes to the clone, when reading it reads from original. Seems valid a new optional parameter definition with the original source. Atenciosamente, David Rodrigues Em qua., 2 de set. de 2020 às 15:41

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread David Rodrigues
I think "void" is a good solution and is very clear, compared to "_". [void, void, $username] = getUserData(); Atenciosamente, David Rodrigues Em qua., 2 de set. de 2020 às 10:57, Dik Takken escreveu: > On 02-09-2020 15:35, Chase Peeler wrote: > > Isn't t

Re: [PHP-DEV] array_reject() as counterpart of array_filter()

2020-08-31 Thread David Rodrigues
tenciosamente, David Rodrigues Em seg., 31 de ago. de 2020 às 13:00, Sara Golemon escreveu: > On Mon, Aug 31, 2020 at 10:35 AM David Rodrigues > wrote: > >> It should be possible for the engine (at some layer) to look at that > closure > >> and see that it's just ne

Re: [PHP-DEV] array_reject() as counterpart of array_filter()

2020-08-31 Thread David Rodrigues
be a good solution, but how hard should it be to create a proxy like that? Atenciosamente, David Rodrigues Em seg., 31 de ago. de 2020 às 11:55, Sara Golemon escreveu: > On Mon, Aug 31, 2020 at 9:41 AM David Rodrigues > wrote: > >> > I agree with Larry that userland implementat

Re: [PHP-DEV] array_reject() as counterpart of array_filter()

2020-08-31 Thread David Rodrigues
will be very simple and will not need to create a new function to userland. PS.: the array_reject() name suggestion is based on the lodash version ( https://lodash.com/docs/4.17.15#reject). Atenciosamente, David Rodrigues Em seg., 31 de ago. de 2020 às 11:08, Chase Peeler

[PHP-DEV] array_reject() as counterpart of array_filter()

2020-08-30 Thread David Rodrigues
Currently we have array_filter(), but sometimes we need an inverse function like array_reject(). array_reject('is_null', [ 1, 2, null, 3 ]); // [ 1, 2, 3 ] It could be easily implemented with: function array_reverse($fn, $arr) { return array_filter(fn($item) => !$fn($item), $arr); } Anyway, I t

Re: [PHP-DEV] Re: Should hash comments be deprecated?

2020-08-29 Thread David Rodrigues
I have suggested on past a declare() to help in cases like that: declare(php_version = "8.0"); It could be declared to new PHP files, so old files could supports # as comments and new files will not. Other option is supports escreveu: > Hi internals, > > If it turns out that the impact on lega

Re: [PHP-DEV] [VOTE] Shorter Attribute Syntax Change

2020-08-18 Thread David Rodrigues
I really found your idea better than all. Keywork is already reserved, make sense on this context. Em ter, 18 de ago de 2020 03:49, Aleksander Machniak escreveu: > On 18.08.2020 00:35, Mike Schinkel wrote: > > 1. Postpone inclusion of attributes until PHP 8.1 > > +1 > > I wonder why my suggestio

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread David Rodrigues
I suggests to make something like Node does: import "file.php" ($a, $b) so $a and $b must be extracted from file.php context. All other variables should be ignored. Or, to avoid create more complexity and possible new keywords to import syntax, maybe create a new function: importx(string $file, ?

Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2

2020-08-05 Thread David Rodrigues
A new suggestion: @attr(...). It could be used on future for other syntaxes and should be supersedes the error supression. So will be a BC exclusively for @attr() error supression for attr() function. But it is few verbose and easy to understand. With error supression remotion (9.0?) it could be us

Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2

2020-08-04 Thread David Rodrigues
equired characters: (16+1) - Has end delimiter: yes - Allow grouping: yes - Forward compatibility in PHP 7: yes - Breaks BC of valid PHP 7 codes: no - Used by other languages: no? - Familiar with Docblock Usage: I don't know - Difficulties with Userland Parsers: I don't know Atenciosament

Re: [PHP-DEV] [RFC] [Discussion] Shorter Attribute Syntax Change

2020-07-30 Thread David Rodrigues
gement, and on future we could have the "verbose syntax" ("using attribute()") and shortened syntax (to be decided, but like "#[...]"). Atenciosamente, David Rodrigues Em qui., 30 de jul. de 2020 às 11:09, tyson andre escreveu: > Hi David, > > > I

Re: [PHP-DEV] [RFC] [Discussion] Shorter Attribute Syntax Change

2020-07-30 Thread David Rodrigues
I would like to suggests the syntax "using attribute(Attribute, ...)". It is more clear and should not create BC. Em qui, 30 de jul de 2020 10:28, Joe Ferguson escreveu: > On Thu, Jul 30, 2020 at 7:50 AM Benjamin Eberlei > wrote: > > > I think it has become clear that we need to revisit this sy

Re: [PHP-DEV] Allow two words keywords

2020-07-29 Thread David Rodrigues
Oh, you are right! "yield from" is not common for me currently, so I really skipped it. In this case, is there some problem to apply it to Attribute case? "using attribute(Attribute())" or something like that? Atenciosamente, David Rodrigues Em qua., 29 de jul. de 2020 às

[PHP-DEV] Allow two words keywords

2020-07-29 Thread David Rodrigues
le is very hard to Google symbols (so search will be "what mean double at in PHP" or "what mean hashtag brackets"). Atenciosamente, David Rodrigues

Re: [PHP-DEV] The @@ is terrible, are we sure we're OK with it?

2020-07-23 Thread David Rodrigues
eed a new keyword, so we can apply it "as a function": attr(Attribute(), Attribute()) function () {...} or attribute(). Or even more complex syntaxes, like: [: Attribute :]. Atenciosamente, David Rodrigues Em qui., 23 de jul. de 2020 às 12:32, Benas IML escreveu: > Just to chime i

Re: [PHP-DEV] The @@ is terrible, are we sure we're OK with it?

2020-07-22 Thread David Rodrigues
ribute(...), ... Or even create a new keyword like: with Attribute(...), ... function withAttribute() { ... } And in last case, just use nothing but the attribute itself as a prefix: Attribute(...) function withAttribute() {...} Atenciosamente, David Rodrigues Em qua., 22 de jul. de 2020 às

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-07-15 Thread David Rodrigues
cast working together with __toBool() is a good one, but I think that it is being discussed in another topic. Atenciosamente, David Rodrigues Em ter., 14 de jul. de 2020 às 20:59, Josh Bruce escreveu: > Implement an interface and magic method to allow objects to represent > false (or empty) w

Re: [PHP-DEV] [RFC] \PHP namespace usage heuristics

2020-07-07 Thread David Rodrigues
There are some problem by using double back slash for PHP namespace? Eg. Instead of \PHP\String be just \\String. Em ter, 7 de jul de 2020 19:04, Larry Garfield escreveu: > On Tue, Jul 7, 2020, at 4:22 PM, Miguel Rosales wrote: > > Larry Garfield wrote on 07/07/2020 16:46: > > > This has reache

Re: [PHP-DEV] Improve "trying to get property 'id' of non-object" error message

2020-07-02 Thread David Rodrigues
Seems great, but maybe include more information should be better: Warning: Attempt to read property 'property' on bool <> in /in/IGUcS on line 5 Atenciosamente, David Rodrigues Em qui., 2 de jul. de 2020 às 12:27, Máté Kocsis escreveu: > Hi David, > > Please have a

[PHP-DEV] Improve "trying to get property 'id' of non-object" error message

2020-07-02 Thread David Rodrigues
;property -> trying to get property 'id' of non-object (array) retrieved from return of getObject() Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Property write visibility

2020-06-29 Thread David Rodrigues
, because if we have get:public, and $x is accessible, so it is isset by nature. Atenciosamente, David Rodrigues Em seg., 29 de jun. de 2020 às 12:03, Deleu escreveu: > As a user, I would prefer the original proposed syntax `public:private` or > the Swift syntax `public private(set)` t

Re: [PHP-DEV] Re: [VOTE] Attribute Amendments

2020-06-22 Thread David Rodrigues
I like to suggest that, by default, attributes could be repeatable, so we can disable this instead (eg. "@@ Attribute(self::IS_UNIQUE)"). Atenciosamente, David Rodrigues Em seg., 22 de jun. de 2020 às 13:38, Benjamin Eberlei escreveu: > Hello, > > The voting period is over

Re: [PHP-DEV] About the use of the terms master/slave and blacklist, proposal to replace.

2020-06-15 Thread David Rodrigues
life (of course, considering that there are really exceptions). Anyway, I believe that we must keep the current terminology as long as it has specific meaning for us and, if it is to change, to change little by little, and not in a radical or forced way. Atenciosamente, David Rodrigues Em seg.,

[PHP-DEV] Improvement to errors

2020-05-26 Thread David Rodrigues
t; I believe that the second solution is the simplest to be implemented and already solves the problem enough. Atenciosamente, David Rodrigues

[PHP-DEV] Graceful timeout

2020-05-16 Thread David Rodrigues
need works with external resources, like RESTful, where timeout can occur and we need a better way to work with that. Or when we have few seconds to run a process. What do you think? Atenciosamente, David Rodrigues

Re: [PHP-DEV] Proposal For Return-If / Early Return / Guard Clause Syntax

2020-05-10 Thread David Rodrigues
I just think that this way is more compatible witth the reading. "Return X if Y" seems better than "return (if) X: (then) Y". Too the ":" could conflicts with return type. Em dom, 10 de mai de 2020 16:59, Ralph Schindler escreveu: > > > On 5/10/20 1:56 PM

Re: [PHP-DEV] Proposal For Return-If / Early Return / Guard Clause Syntax

2020-05-10 Thread David Rodrigues
Suggestion: return if $x > 1; (to return "void") return $y if ($x > 1 && $x < 5); break if $x > 1; break 2 if $x > 1; throw new Exception if $x > 1; Em dom, 10 de mai de 2020 15:48, Nikita Popov escreveu: > On Sun, May 10, 2020 at 5:49 PM Ralph Schindler > wrote: > > > Hi! > > > > > > # Intr

Re: [PHP-DEV] max_input_vars trigger detection

2020-05-10 Thread David Rodrigues
Maybe throw an exception by default when it happen. Considering max_input_vars+1, when hit, throw. Em dom, 10 de mai de 2020 09:34, Craig Duncan escreveu: > > > > Although not particularly elegant, and it does require you to reject > requests that hit but don't exceed the limit, I've used this a

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

2020-04-13 Thread David Rodrigues
tenciosamente, David Rodrigues Em seg., 13 de abr. de 2020 às 12:32, Reindl Harald escreveu: > > > Am 13.04.20 um 17:08 schrieb David Rodrigues: > > With all the humility of the world and without wanting to be exhaustive > > about this, my only question is why can't we keep

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

2020-04-13 Thread David Rodrigues
ch are basically the same thing, however, in different scopes. Likewise, "break 2" would be impossible in this case, so just issue an error saying "break n is not supported in this situation". Atenciosamente, David Rodrigues Em seg., 13 de abr. de 2020 às 11:49, Rowan Tommins e

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-03-31 Thread David Rodrigues
another format to switch. And maybe you should just use "return" here to specify the return value. $x = switch ($y) { case 1: return $y + 1; case 2: return $y - 1; // default: return null; }; Atenciosamente, David Rodrigues Em ter., 31 de mar. de 2020 às 15:51, Ilija Tovilo

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread David Rodrigues
I think it useful, despite that it could be done by using array_push() as Woortmann said. Anyway, I think valid a new proposal for thinks like that. But I will suggests this: $arr[] = ... $items; Atenciosamente, David Rodrigues Em sáb., 28 de mar. de 2020 às 20:07, Michael Voříšek - ČVUT FEL

Re: [PHP-DEV] semicolon terminator for switch cases

2020-03-26 Thread David Rodrigues
I agree with Tovilo. It is weird and confusing. Actually I never know that it was possible. And the ";" sounds like "it ends here", while ":" counds like "it does it ->". For me, "case 1;" will sounds like "skip case 1". Atencio

Re: [PHP-DEV] [RFC] Constructor Property Promotion

2020-03-26 Thread David Rodrigues
ction __construct(public int $x) { ... } } class B extends A { public function __construct(public int $y) { ...; parent::__construct($y); } } Atenciosamente, David Rodrigues Em qui., 26 de mar. de 2020 às 12:45, Sebastian Bergmann escreveu: > Am 26.03.2020 um 14:30 schrieb Nikita Popo

Re: [PHP-DEV] Class cast

2020-03-25 Thread David Rodrigues
); But you have only A $a. You can create: function __cast($value) { if ($value instanceof A) return B($value, 123, M_PI); } Then use: requiresB((B) $a); Atenciosamente, David Rodrigues Em qua., 25 de mar. de 2020 às 20:06, Stanislav Malyshev < smalys...@gmail.com> escreveu: >

[PHP-DEV] Class cast

2020-03-25 Thread David Rodrigues
and properties. --- To make possible custom some kind of castings, I suggests a new magic method __cast($value). class Number { ... function __cast($value) { if (is_int($value) || is_float($value)) return new static($value); throw new TypeError(); } } Just to talk. Atenci

[PHP-DEV] Argument with default value

2020-03-14 Thread David Rodrigues
int $b = 0) My suggestion would be to use the keyword "default" in the context of the argument. To avoid confusion, another keyword could be created, but I don't see why they confuse "default" as an argument and "default" for switch. test(default, 2) === test(M_PI, 2, 0) Atenciosamente, David Rodrigues

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread David Rodrigues
ther languages. And too, could annotators have some additional features like Typescript decorators? Atenciosamente, David Rodrigues Em seg., 9 de mar. de 2020 às 16:35, Aleksander Machniak escreveu: > On 09.03.2020 15:42, Benjamin Eberlei wrote: > > The RFC is at https://wiki.php.net/r

Re: [PHP-DEV] Re: [RFC] Attributes v2

2020-03-09 Thread David Rodrigues
ntil the PSR staff decides how best to write. Atenciosamente, David Rodrigues Em seg., 9 de mar. de 2020 às 16:19, Andrea Faulds escreveu: > Benjamin Eberlei wrote: > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > > 2016 with a few changes, incorporating feed

Re: [PHP-DEV] New PCRE function

2020-02-19 Thread David Rodrigues
Maybe you can set all this messages as lowercase? That way we can use it more easily. If we need the first letter in capital letters we can use `ucfirst()`, because the opposite is more complicated (a `strtolower()` would "break" the "JIT" message, for example). Atenciosame

Re: [PHP-DEV] Operator overloading for userspace objects

2020-01-28 Thread David Rodrigues
have an error. Call order should be respected now once that will be impossible you have $objectA * $objectB without defines a priority (the main handler). -- Atenciosamente, David Rodrigues Em ter., 28 de jan. de 2020 às 20:14, escreveu: > Hello everybody, > > > > the last days I

Re: [PHP-DEV] register_shutdown_function() not supports private methods

2019-11-28 Thread David Rodrigues
Em qui., 28 de nov. de 2019 às 14:13, Dan Ackroyd escreveu: > On Wed, 27 Nov 2019 at 23:33, David Rodrigues > wrote: > > > > Hi internals, > > > > I am using the register_shutdown_function() inside a class, and then I > have > > created a private meth

[PHP-DEV] register_shutdown_function() not supports private methods

2019-11-27 Thread David Rodrigues
t a public scope. As workaround I am keeping it as public. So, there are some reason to it do not works like spl does? -- David Rodrigues

[PHP-DEV] Inline switch as alternative to nested inline conditional

2019-10-15 Thread David Rodrigues
: ( $expr == B1 ? B2 : C ); Just a discussion to check what do you think. -- David Rodrigues

Re: [PHP-DEV] PHP 7.4.0RC3 is available for testing

2019-10-03 Thread David Rodrigues
9AGId2Gp0YgGOaNTu+BZmeB6Q+pnjWNO5fJVRry68= > =ueur > -END PGP SIGNATURE- > > > -- > PHP 7.4 Release Manager > Host of PHP Internals News: https://phpinternals.news > Like Xdebug? Become my Patron: https://www.patreon.com/derickr > https://derickrethans.nl | https://xdebug.org | https://dram.io > twitter: @derickr and @xdebug > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- David Rodrigues

[PHP-DEV] Symbol implementation

2019-04-27 Thread David Rodrigues
ES6 supports the Symbol type that is a replacement to hard-coded identifiers where it are not really need. I like to suggests a similar feature to PHP. #0: it should be a partial class that could not be instantiated (new symbol should be invalid, like an abstract class). In this point I should s

[PHP-DEV] TCO: Tail Call Optimization

2019-04-27 Thread David Rodrigues
Not long ago I heard about the Tail Call Optimization from ES6. It seemed obscure to me at first, but once I understood the benefit of having it, it seemed like a good idea of optimization for PHP to avoid recursion problems. Is there any plan to make it possible in the engine? -- David

[PHP-DEV] Re: [RFC] Nullable Casting

2019-04-21 Thread David Rodrigues
] > > > > Thank you, > > Hello again internals, > > Thanks everyone for your valuable feedback. I have updated the RFC > with a new Discussion section to [try to] summarize the various > arguments raised in this thread. > > -- > Guilliam Xavier > -- David Rodrigues

[PHP-DEV] Allow number_format() have three args

2019-04-08 Thread David Rodrigues
f you pretends to keep the comma as fourth arg once that normally you will use or "." or "," as decimal separator. * If you pretends to use dot + comma, just use two args; * If you pretends to use comma + dot, just use four args; * If you pretends to use dot + nothing, use three args; * If you pretends to use comma + nothing, use three args; -- David Rodrigues

Re: [PHP-DEV] [RFC] Nullable Casting

2019-04-07 Thread David Rodrigues
ull; > } > > return (int)$int; > } > > register_cast_function('?int', 'castToIntOrNull'); > > $x = (?int)getIntOrNull(); > > > > Additionally, it was requested on the mailing list to consider adding > > support of nullable types to the settype() function, > > e.g. settype($variable, "?int") > > Someone probably needs to make an argument for it to be in core, > rather than just saying that it's something that could be done. > > cheers > Dan > Ack > -- David Rodrigues

[PHP-DEV] random_seed()

2019-03-31 Thread David Rodrigues
Just to know, can we have a random_seed() for random_int()/random_bytes() like we have mt_srand() to mt_rand()? I don't know if random_int() is more "random" than mt_rand(), but if it is, so maybe is valid a random_seed() function. -- David Rodrigues

  1   2   >