[PHP-DEV] RFC: Initialize objects by using an object initializer.

2015-06-26 Thread David Rodrigues
Hello, I tried to register in RFC Wiki but I get the error "That wasn't the answer we were expecting", but in all cases, I'm David Rodrigues, and I like to suggest a method to initialize objects by using an object initializar. Currently it is supported on C#

Re: [PHP-DEV] [RFC] Arrow functions / short closures

2019-03-13 Thread David Rodrigues
mple is roughly equivalent > to: > > function($x) use($multiplier) { return $x * $multiplier; } > > The RFC contains a detailed discussion of syntax choices and binding modes. > > Regards, > Nikita > -- David Rodrigues

Re: [PHP-DEV] [RFC] Arrow functions / short closures

2019-03-14 Thread David Rodrigues
> So the following, while redundant, is currently valid: > > $foo = [ ($bar) => $baz ]; > Yeah, I don't think in that case. And maybe using [] instead of ()? For instance: "[$x] => $x + 1". PHP don't supports and array as key, so maybe it will not causes any conflict. -- David Rodrigues

Re: [PHP-DEV] [RFC] Change the precedence of the concatenation operator

2019-03-29 Thread David Rodrigues
is promoting programmers to make mistakes. Albeit typically > easy to catch ones, it is a quality of life change at least. > > Hence I'm proposing a RFC changing the precedences: > https://wiki.php.net/rfc/concatenation_precedence > > Bob > -- 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

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] 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

[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] 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] 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

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] 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

[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

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

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] 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] 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] [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

[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

[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

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: >

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] 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] 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] [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] [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] [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] 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] 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] 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

[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

[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

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.,

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] [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

[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] 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

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] [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] 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] 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

[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] 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

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] [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] 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] 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] 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] [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] 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

[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] 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

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
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] 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] 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] 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] [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] 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] 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] 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
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] __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] 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

[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] 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] Supports to ?:= assignment operator

2020-11-11 Thread David Rodrigues
! 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] 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-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

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

[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

[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] Traits "implements" support

2020-11-26 Thread David Rodrigues
red! } 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] 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

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] preg_replace(string, null) is allowed?

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

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

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] [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: >

[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] [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: > > >

Re: [PHP-DEV] Pipe Operator v2

2016-07-21 Thread David Rodrigues
This is a great idea in general, but I think that this kind of operator is not the ideal (expect for $$ that seems very good). Some possibilities to think about: |> (as suggested) seems strange and not very clear, mainly in linear calls --> can be too long, but can make more sense or continuing,

[PHP-DEV] RFC: lazy statements

2016-07-21 Thread David Rodrigues
implementation of this feature. All this ways have a lot of limitations. A hackish example that shows how it should works on current PHP version: http://pastebin.com/cz93wL7n --- I tell more about that here: https://bugs.php.net/bug.php?id=72637 -- David Rodrigues -- PHP Internals - PHP

Re: [PHP-DEV] Pipe Operator v2

2016-07-22 Thread David Rodrigues
e end however, is something I'd rather handle > with the following: > > foo() |> bar($$) |> $baz = qux($$); > > Which is both legal with the syntax as-is, and entirely readable > without adding an extra operator. > > -Sara > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] New operator for context-dependent escaping

2016-07-22 Thread David Rodrigues
The idea is good, but I think that is not pratical in general. --- First point: we should define each new identifier that could be used. It not make clear what this identifier does or even how it should works when a package redefines what it does. For instance: // file1.php set_escape_handler('

Re: [PHP-DEV] RFC: lazy statements

2016-07-22 Thread David Rodrigues
> However, that also means there's an enormous potential for race > conditions. Technically no more than closures now, but the use cases > seem like they'd make it more prevalent. If you "use" by reference, or > use a mutable object, or a service that depends on IO, etc. then the > resulting valu

Re: [PHP-DEV] RFC: lazy statements

2016-07-23 Thread David Rodrigues
Dan Ackroyd wrote: > This looks to solve a problem very similar to the one solved by the > 'Memoize' annotation in HHVM - > https://docs.hhvm.com/hack/attributes/special#__memoize > However the memoize functionality seems a lot clearer to me, as it's > less 'magic'; it doesn't make accessing a var

Re: [PHP-DEV] RFC: lazy statements

2016-07-24 Thread David Rodrigues
Dan Ackroyd wrote: > Yes, but the difference is in the surprise factor. > > Two functions having a circular dependency ==> not too astonishing, > and easy to think about. > > Reading the value of a variable having a circular dependency ==> give > up programming to become a farmer. Okay, so we can

Re: [PHP-DEV] RFC Karma Request

2016-07-26 Thread David Rodrigues
p.net/bug.php?id=50434. I've added those functions on my > local PHP copy. I would like to make an RFC and a PR for adding it to the > core PHP copy. > > Thanks, > > Will > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: htt

Re: [PHP-DEV] optionally return class name from gettype

2016-07-29 Thread David Rodrigues
'm not sure on the boolean through, I think a new function might be better. > > It's something that can be implemented in userland, but it's also something > that's really often needed. > > Regards, Niklas -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC Posted for str_begins and str_ends functions

2016-08-01 Thread David Rodrigues
arate functions rather than as a parameter. e.g. >> str_begins(), str_ibegins(), str_ends(), end_iends() > > +1 for having functions for case insensitivity. > I'm not sure if we should have "s". i.e. str_begin"s". > > Regards, > > -- > Yasuo Oh

Re: [PHP-DEV] Function auto-loading

2016-08-07 Thread David Rodrigues
>>> along with Composer auto-loading features will favor a best practice of >>> shipping packages with namespaced functions only, so the performance >>> implications of checking twice would be negligible in practice. >>> >>> Being basically unable to shi

Re: [PHP-DEV] BC break with rand() where min > max

2016-08-08 Thread David Rodrigues
> Looking for some feedback/opinions on whether anyone else thinks this > should be fixed differently (or not at all). > > N.B. this also changes the behaviour of mt_rand to now accept min > max -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Treats raw types if used as object

2016-08-09 Thread David Rodrigues
ormance? It should be great. In all case, depending of response here, I could try do something, but I don't promises. -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Method compare()

2016-08-09 Thread David Rodrigues
27;, 5) => compare($id, 5, '>') I guess that it could supports all PHP operators: ==, ===, !=, <>, !==, <, >, <= and >=. The spaceship operator does the works too for integers, but not should works if you expects than $a === $b, or when you expects than $a >= $b. -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Method compare()

2016-08-09 Thread David Rodrigues
ndition is client-defined, not developer-defined. For instance: lower, greater, lower-equal, greater-equal, equal In this case, I should implements a switch, where a compare() should works fine. -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC][DISCUSSION] Remove utf8_decode() and utf8_encode()

2016-08-14 Thread David Rodrigues
> PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Allow infinity integer length

2016-08-29 Thread David Rodrigues
float, $bits), for instance). But it can be part of another discussion. -- David Rodrigues -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

  1   2   >