[PHP-DEV] Wiki RFC karma request

2019-03-10 Thread Guilliam Xavier
Hello, I'd like to do some work on the Nullable Casting RFC (encouraged by its author). Could someone grant the wiki user guilliamxavier the necessary karma? Thanks in advance. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] Wiki RFC karma request

2019-03-11 Thread Guilliam Xavier
On Mon, Mar 11, 2019 at 11:47 AM Nikita Popov wrote: > > Hi, > > I've granted you rfc karma on the wiki. Please check if it works. Yes, now I can edit pages under /rfc, thank you :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] [RFC] Nullable Casting

2019-04-06 Thread Guilliam Xavier
ubsections (hopefully "None" to all) as well as a review of the proposed implementation: https://github.com/php/php-src/pull/3764 Thank you, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2019-04-08 Thread Guilliam Xavier
this thread (who hasn't had the time to answer questions yet, sorry), I would ask everyone to please try to avoid sarcasm and provocation (intentional or not), especially if you actually like the idea =( Thank you in advance -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2019-04-09 Thread Guilliam Xavier
hought about say, "nullable_intval()", "nullable_strval()" etc. but we're missing "arrayval()" and "objectval()"...) Best regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2019-04-10 Thread Guilliam Xavier
On Wed, Apr 10, 2019 at 12:52 PM Nikita Popov wrote: > > I'm a bit concerned that there are two possible semantics for what (?int) > does: > > 1. What I would intuitively expect: A fallible integer cast. I.e. try to > cast to integer and if not possible return null. So (?int) "foobar" becomes > n

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

2019-04-10 Thread Guilliam Xavier
; // TypeError (function (?string $x) { var_dump($x); })($obj); // TypeError var_dump((function ($x): string { return $x; })($obj)); // TypeError var_dump((function ($x): ?string { return $x; })($obj)); // TypeError var_dump((string) $obj); // Recoverable fatal error var_dump((?string) $obj);

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

2019-04-11 Thread Guilliam Xavier
ould argue they are programming errors or bugs to fix), and people seem to expect different things from a new "(?type)" cast syntax (not to speak of the existing "(type)" cast) as how to handle those "failures"... Honestly as a newbie here I'm feeling more tired

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

2019-04-21 Thread Guilliam Xavier
On Sat, Apr 6, 2019 at 9:52 AM Guilliam Xavier wrote: > > Hello internals, > > David and I would like to open the discussion on our joint RFC: > > https://wiki.php.net/rfc/nullable-casting > > Mainly, it would enable to use e.g. `(?int)$x` besides `(int)$x`. > >

Re: [PHP-DEV] [RFC] Strict operators directive

2019-06-25 Thread Guilliam Xavier
aniels > > [Arnold Daniels - Chat @ > Spike](https://www.spikenow.com/?ref=spike-organic-signature&_ts=1mzl6) > [1mzl6] Hello, thanks for the impressive work... I have just one interrogation: why disallow `~` for strings? (e.g. currently `~"\x00\x01\x02"` gi

Re: [PHP-DEV] Stop replacing dots with underscores in query, post and cookie parameters for PHP 8?

2019-07-15 Thread Guilliam Xavier
com/api-platform/core/issues/509 - https://github.com/api-platform/core/blob/v2.4.5/src/Util/RequestParser.php -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Let's allow eval() to be turned off in PHP 8

2019-11-26 Thread Guilliam Xavier
For the record, a few months ago, https://github.com/php/php-src/pull/4084 (extending `disable_functions` to handle `eval`) was first merged but finally reverted (requested by Xdebug), and the feature request https://bugs.php.net/bug.php?id=62397 was closed (with an explanation). -- Guilliam

Re: [PHP-DEV] What to do with "$array[foobar]"?

2020-01-10 Thread Guilliam Xavier
]" // $object->arr . '[qux]' "$array[arr][bar]" // $array['arr'] . '[bar]' "$array[obj]->qux" // $array['obj'] . '->qux' In any case, I'm +1 for deprecating "$array[key]", and "$array[0]" to avoid introducing another inconsistency. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Allow ::class on objects

2020-01-10 Thread Guilliam Xavier
ciative too but `!$x === 42` is evaluated as `(!$x) === 42` (not as `!($x === 42)`). According to the docs, associativity only matters for operators of equal precedence, e.g. `4 - 3 - 2` is evaluated as `(4 - 3) - 2`, and `4 ** 3 ** 2` is evaluated as `4 ** (3 ** 2)`. -- Guilliam Xavier --

Re: [PHP-DEV] [RFC] Static return type

2020-01-14 Thread Guilliam Xavier
n $this;` in addition to the check. I'm -1 for `: fluent` or `fluent function` as an alternative to `: $this`. I'm -0.5 for `: new` / `: clone`. About "what comes out is the same type as what goes in", I would wait for generics. -- Guilliam Xavier -- PHP Internals - PHP

Re: [PHP-DEV] [VOTE] declare(function_and_const_lookup='global')

2020-01-30 Thread Guilliam Xavier
ession that the leading backslash be required to avoid relative resolution, but `use Ns\Klass;` is already absolute. And for strings, `\Ns\Klass::class` (or `get_class(new \Ns\Klass())`) is equal to `'Ns\Klass'`, not `'\Ns\Klass'`. -- Guilliam Xavier

Re: [PHP-DEV] Re: [RFC] "arrayable" pseudo type hint

2020-02-04 Thread Guilliam Xavier
same way you cannot declare an `interface Iterable` because of the `iterable` reserved word, <https://3v4l.org/Fhqar>), so you would need another name (if you want the alias) -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Warn when declaring required parameter after optional one

2020-02-05 Thread Guilliam Xavier
er concerns about this > change? Can you please just clarify which of the following will emit a deprecation? function f1($a = null, $b) {} function f2(A $a = null, $b) {} function f3(?A $a = null, $b) {} (I think f1 will, f2 won't, but f3?) Thanks > > Regards, > Nikita > -- Guilliam Xavier

Re: [PHP-DEV] [RFC]

2020-02-11 Thread Guilliam Xavier
I think 'func' will be more > consistent. Actually PHP 7.4's short closures / array functions use `fn`, not `func`. But `::fn` would look... weird. I agree with Diogo that `::function` would be more consistent. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Adding a "Stringable" interface to PHP 8

2020-02-11 Thread Guilliam Xavier
ior, which this ones also is. But one could argue that "string" is not a verb like "traverse", "serialize", "count", "throw" etc. Potential alternatives would be Stringifyable (or Stringifiable?), StringCastable, StringConvertible... (Even though

Re: [PHP-DEV] [RFC] Adding a "Stringable" interface to PHP 8

2020-02-11 Thread Guilliam Xavier
On Tue, Feb 11, 2020 at 2:11 PM Michał Brzuchalski wrote: > > wt., 11 lut 2020 o 13:59 Guilliam Xavier > napisał(a): >> >> On Tue, Feb 11, 2020 at 1:12 PM Nicolas Grekas >> wrote: >> > >> > > >> > > Just so someone has mentione

Re: [PHP-DEV] [RFC]

2020-02-11 Thread Guilliam Xavier
t; ::closure get a closure that can call the function. > > Or have ::function to return the name of the function and provide a syntax > something like ${myfunc} to return a closure, which has been suggested later > in this thread. That might deserve consideration indeed... -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Proposal for a new basic function: str_contains

2020-02-16 Thread Guilliam Xavier
ld want `str_{starts,ends}_with` even more (without case-insensitive nor multibyte variants)] -- Guilliam Xavier On Fri, Feb 14, 2020 at 11:14 AM G. P. B. wrote: > > On Fri, 14 Feb 2020 at 10:58, Aegir Leet wrote: > > > I generally like the idea, but it seems many (most?) real-world

Re: [PHP-DEV] [RFC] [VOTE] str_contains is accepted

2020-03-16 Thread Guilliam Xavier
e str_starts_with and str_ends_with in PHP 8 too? -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] Voting opens for str_starts_with and ends_with functions

2020-03-20 Thread Guilliam Xavier
epted for the next PHP 8.0 (<https://externals.io/message/109050>). Would you be willing to reboot your RFC with just str_starts_with and str_ends_with (and a stronger case of how people keep implementing them using the inefficient and/or error-prone currently available alternatives)? Best regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC Raised for str_starts_with and str_ends_with

2020-03-26 Thread Guilliam Xavier
ient, error-prone, hard to understand...) plus how they handle empty strings. (And also probably shorten the introduction ^^ or move parts into a new subsection) PS: you could also add a link to the str_contains RFC Best regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-26 Thread Guilliam Xavier
eful). I fear that "hint" notice could break Symfony apps... Couldn't you just not trigger it in this case? -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Allow trailing comma in parameter lists

2020-03-30 Thread Guilliam Xavier
ines below 120 characters ;) Maybe the RFC could include an example? But I am curious too about why it failed last time. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC][DISCUSSION] Change var_export() array syntax touse short hand arrays

2020-04-08 Thread Guilliam Xavier
e bool|int) would be BC-compliant...) Moreover the RFC currently says that var_export([1, 2, 3]) produces ``` array(1, 2, 3) ``` but it actually produces ``` array ( 0 => 1, 1 => 2, 2 => 3, ) ``` Regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] Allow trailing comma in parameter lists

2020-04-09 Thread Guilliam Xavier
rs that would still exceed 120 columns if on a single line (with e.g. descriptive names, [union] type declarations for parameters and/or return, and/or a class constant as default value for the last parameter, that's not so uncommon)... Just my two cents ;) Best regards, -- Guilliam

Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed

2020-04-14 Thread Guilliam Xavier
https://3v4l.org/0VmYQ. Actually there are ways to use integers as property names, but they are converted to strings on creation: https://3v4l.org/0k4LS and https://3v4l.org/HhPZP (also https://3v4l.org/Ts42B). ArrayAccess doesn't use magic __isset(string $name) but interface offsetExist

Re: [PHP-DEV] PHP 7.4.5 Released!

2020-04-16 Thread Guilliam Xavier
ion guide: <http://php.net/manual/migration74.php> > > Many thanks to all the contributors and supporters! Thanks, just noticed the "Release Announcement" link is dead, the working one is: <http://php.net/releases/7_4_5.php> -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Type hints in array destructuring expressions

2020-04-16 Thread Guilliam Xavier
nt $year]) { ``` I immediately think of a similar: ``` $years = ["now" => 2020, "future" => 2021]; foreach ($years as string $description => int $year) { ``` or: ``` $foos = [new Foo("one"), new Foo("two")]; foreach ($foos as Foo $foo) { ``` Now I rem

Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed

2020-04-16 Thread Guilliam Xavier
rn an `array` and a `string` (when called), but why not check their signature (if typed) at *compile time* too (i.e. make https://3v4l.org/ZPrVi an error)? Regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2020-04-18 Thread Guilliam Xavier
attribute, untyped equivalent to respectively: function ( <> \B $x ) function ( <> $x ) which permit whitespace (unambiguous because delimited): function ( << A >> \ B $x ) function ( << A \ B >> $x ) (although I've never seen code

Re: [PHP-DEV] [RFC] Mixed type

2020-04-20 Thread Guilliam Xavier
`resource` in union types. All the more reason to standardize those "aliases" in core? -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Mixed type

2020-04-20 Thread Guilliam Xavier
very code path of] the implementation returns a value. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Mixed type

2020-04-21 Thread Guilliam Xavier
manual/en/function.is-scalar.php). -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Function pipe operator

2020-04-22 Thread Guilliam Xavier
ds#walk-the-line where the author defines a custom `-:` operator such that `x -: f` desugars to `f x` (equivalent to how `$x |> $f` would desugar to `$f($x)` with the RFC), which allows to write e.g. `xs -: sort -: reverse` instead of `reverse (sort xs)` or `(reverse . sort) xs`. -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-22 Thread Guilliam Xavier
s %e/%E and %g/%G (and possible %H)? -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: [PHP-DEV] [RFC] Mixed type

2020-04-23 Thread Guilliam Xavier
efined by this RFC (i.e. equivalent to the currently-impossible-to-write union of all primitive types, including resource and null [but not void that is not a data type]) is LSP-conformant. Regards, -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Function pipe operator

2020-04-23 Thread Guilliam Xavier
https://repl.it/repls/KindLightsalmonApplicationserver Ah, thanks for the intel! (I see it was added in 2015, i.e. a few years after the publication of LYAHFGG in 2011) -- Guilliam Xavier -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: [PHP-DEV] [RFC] Mixed type

2020-04-23 Thread Guilliam Xavier
Hi Christoph and Rowan (your replies kind of overlap), On Thu, Apr 23, 2020 at 12:21 PM Christoph M. Becker wrote: > > On 23.04.2020 at 11:26, Guilliam Xavier wrote: > > > On Wed, Apr 22, 2020 at 11:10 PM Barney Laurance > > wrote: > > > >> Taking a rand

Re: [PHP-DEV][RFC] Rename T_PAAMAYIM_NEKUDOTAYIM to T_DOUBLE_COLON

2020-06-12 Thread Guilliam Xavier
> So please, let the parser tell me not only the line of the error, but also the colum. > Other information currently missing from the message - e.g. column > number, hints about unclosed blocks - is likely to be far more useful >> a) Character count (at line 456, character 23) > >> > >> b) Quote

Re: [PHP-DEV] Putting the match expression in constant expressions in PHP 8.0 or 8.1

2020-08-08 Thread Guilliam Xavier
'prod' => 'production-config', > default => null, > }; > } > ``` > > https://github.com/php/php-src/pull/5951 implements the main part of the > change. > Hi, thanks, just noticed that your examples should use `===` not `==`. Regards -- Guilliam Xavier

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

2020-11-20 Thread Guilliam Xavier
on't know if that would be a problem, because today we can have it > "function(): Type use($x)", so "Type use($x)"? > No we can't, try it (Parse error). The correct order is "function() use($x): Type". -- Guilliam Xavier

Re: [PHP-DEV] Re: [RFC] var_representation() : readable alternative to var_export()

2021-02-04 Thread Guilliam Xavier
will still cause newlines in the output" part is obsolete (since `\r` and `\n` are escaped now). Apart from that, since var_export (and var_dump) can't really be "fixed" for BC reasons, I'm +1 for the new function. Thanks -- Guilliam Xavier

Re: [PHP-DEV] Interaction between finally blocks and exit()

2021-02-08 Thread Guilliam Xavier
PHP 8.0.0 because of an unexpected interaction of those two things? (adding Nikita to the CC list) -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-10 Thread Guilliam Xavier
= [2,4,1,3]; usort($list, fn ($a, $b) => $a < $b); /* Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero */ echo json_encode($list); // [4,3,2,1] ``` (That's probably because PHP user comparison functions were modelled from C (e.g. strcmp()), not C++ (e.g. std::less).) Of course here the "correct" thing is to return `$a <=> $b` (or `$b <=> $a` for descending order), but you can also return `$a - $b` (not necessarily in [-1,0,1]), or even a string `"foo"` still without any warning in 8.0.2 (just a certainly wrong result)... Anyway, to me it feels natural that any()/all() would "work" like array_filter(). @Tyson by the way, in the any()/all() case (vs the any_value()/all_values() and potential any_key()/all_keys() etc.), wouldn't it be preferable to add the optional `int $flags = 0` (or "$mode") parameter right from the start (even if not used yet), as adding it in a later release would apparently pose some BC concerns (ArgumentCountError, polyfills etc.)? -- Guilliam Xavier

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

2021-02-18 Thread Guilliam Xavier
.io/message/112996 ) for the RFC. -- Guilliam Xavier

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

2021-02-23 Thread Guilliam Xavier
... Maybe PHP could do the same (with `null` rather than an empty string for the default), i.e.: var_dump(true ? 'foo'); // string(3) "foo" var_dump(false ? 'foo'); // NULL but I'm not sure if the added complexity (in parser implementation and in the language) would be worth it, to avoid typing " : null", nor if everyone would actually find the shorthand more readable? -- Guilliam Xavier

Re: [PHP-DEV] Interaction between finally blocks and exit()

2021-02-23 Thread Guilliam Xavier
320 > Hello again, >From my message from two weeks ago, my understanding is that finally blocks are *never* supposed to be executed on exit(), and that there is indeed a bug (regression) with generators. With PHP 8.0.3RC1 having been released without any reply here from the people CCed, maybe you should open a bug report? -- Guilliam Xavier

Re: [PHP-DEV] Interaction between finally blocks and exit()

2021-02-23 Thread Guilliam Xavier
On Tue, Feb 23, 2021 at 5:12 PM Nikita Popov wrote: > On Tue, Feb 23, 2021 at 4:52 PM Guilliam Xavier > wrote: > >> On Fri, Feb 5, 2021 at 2:10 PM G. P. B. wrote: >> >> > Greetings internals, >> > >> > While working on rewriting the PHP docs ab

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

2021-02-23 Thread Guilliam Xavier
dangerous and > tricky thing. (I just had several PRs against one of my OSS libraries > because it relied on falsy, which had all sorts of incorrect failure > conditions.) > I would just add that it's also true for "?:" (i.e. not specific to the suggestion at hand, although the lack of a non-controversial example so far may be a hint) > > I'd be a -1 here. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-02-26 Thread Guilliam Xavier
so must be last; for array_filter, the callback is optional, so must be after the array. (Correct me if I'm wrong.) -- Guilliam Xavier

Re: [PHP-DEV] [RFC] class_name:namespace

2021-02-26 Thread Guilliam Xavier
;getNamespaceName()` and/or `$r->getShortName()`). Like `str_contains()` was introduced as a "shorthand" for `false !== strpos()`, something like `get_namespace_name()` and/or `get_short_name()` (or other namings) might be worth considering. Regards, -- Guilliam Xavier

Re: [PHP-DEV] Small annoyances of PHP: Simple fixes would make tests fail

2021-03-05 Thread Guilliam Xavier
t;) while breaking more tests... While at it, there are two more things that bug me: - the space before the opening parenthesis in "array (", vs "::__set_state(array(" / "(object) array(" - the line break after "=>" when the value is an array or object (which is also the cause of the trailing space, by the way) but changing them would be a bigger break, too... Regards, -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] Fibers

2021-03-18 Thread Guilliam Xavier
per has > opted into it. Both of the above are different approaches to that > being proposed in this RFC (this is a design choice by the authors). > At the risk of sounding dumb: What would that code look like with fibers? Thanks, -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] Fibers

2021-03-22 Thread Guilliam Xavier
ad more time. Any objections? > >> > >> > >> How much time do you think you need? > > > > Another week seems reasonable; enough time to evaluate it more > > thoroughly but not delay things seriously. > > This is fine with me. Let's extend voting for about another week, ending > on 3/28 at about 11 PM EDT. > I'm afraid you can't: from https://wiki.php.net/rfc/voting#voting > A valid voting period must be declared when voting is started and must not be changed during the vote. (Not that I care personally, but you would take the risk of the vote being invalidated...) -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] Fibers

2021-03-22 Thread Guilliam Xavier
On Mon, Mar 22, 2021 at 4:38 PM Levi Morrison wrote: > On Mon, Mar 22, 2021 at 9:13 AM Guilliam Xavier > wrote: > > > > On Sat, Mar 20, 2021 at 3:06 PM Aaron Piotrowski > wrote: > >> > >> > >> > On Mar 19, 2021, at 5:47 PM, Levi Morrison <

Re: [PHP-DEV] [VOTE] Fibers

2021-03-22 Thread Guilliam Xavier
nd continue again from step 5. (where "step 5" refers to the discussion phase) Regards, -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] Fibers

2021-03-22 Thread Guilliam Xavier
basis of "bureaucratic" arguments in the past, and wanted to avoid that here)... (In this case I personally find it reasonable, but who am I?) Just in case, let's record that the result is currently 48:14 ;) -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Short functions, take 2

2021-03-25 Thread Guilliam Xavier
` class A { function method($arg1) { expr($arg1); } } ``` i.e. I initially forgot the "return " (and had to go back and add it). I would surely not have this problem anymore with this: ``` class A { function method($arg1) => expr($arg1); } ``` (It also seems I don't have this problem when writing a return on its own line :/) Regards, -- Guilliam Xavier

Re: [PHP-DEV] Why is assert limited to a debugging feature only?

2021-04-01 Thread Guilliam Xavier
unsubscribe, visit: https://www.php.net/unsub.php > > Hi, I agree with Olle's explanation (and am indeed using `assert()` that way). Also note that both linked libs throw `InvalidArgumentException` (subclasses of), so not the same kind of "assertions" (despite the name). Regards, -- Guilliam Xavier

Re: [PHP-DEV] [VOTE] Object scoped RNG implementation

2021-04-01 Thread Guilliam Xavier
Plus` have a public `__construct(int $seed )` and implement the magic `__serialize()`/`__unserialize()`. Best regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC][Draft] Sealed Classes

2021-04-27 Thread Guilliam Xavier
ealed (which seems legit), only with None made final (which... could be debated, but unrelated to the RFC at hand). Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC][Draft] Sealed Classes

2021-04-27 Thread Guilliam Xavier
I guess is to replace `@internal` phpDoc). I'm not saying that this RFC is bad, but probably not as convincing as it could be. Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC][Draft] Sealed Classes

2021-04-28 Thread Guilliam Xavier
Forwarding to the list, and answering: On Wed, Apr 28, 2021 at 9:51 AM Tony Marston wrote: > On 27/04/2021 17:22, Guilliam Xavier wrote: > > On Sat, Apr 24, 2021 at 12:55 PM Saif Eddin Gmati > > > wrote: > > > > > > To me the first sentence of the RFC i

Re: [PHP-DEV] [RFC][Draft] Sealed Classes

2021-04-28 Thread Guilliam Xavier
Re-forwarding to the list (please stop replying to me in private, thanks). Also re-answering but I will stop there because that's too much digression for a partial quote of my initial message. On Wed, Apr 28, 2021 at 5:30 PM Tony Marston wrote: > On 28/04/2021 14:30, Guilliam Xavi

Re: [PHP-DEV] [RFC][Draft] Sealed Classes

2021-04-29 Thread Guilliam Xavier
On Wed, Apr 28, 2021 at 10:18 PM Dan Ackroyd wrote: > On Wed, 28 Apr 2021 at 14:30, Guilliam Xavier > wrote: > > > > Forwarding to the list, and answering: > > > > Please don't do that. > > He was blocked from the list for repeatedly derailing convers

Re: [PHP-DEV] [RFC][Draft] Body-less __construct

2021-05-10 Thread Guilliam Xavier
either explicitly declared so in a class, or implicitly in an interface). Granted, property promotion is already special (cannot be used in an abstract constructor), but it can also be mixed with non-promoted parameters and body, so I feat that your proposed alternative syntax would bring more confusion than convenience :s Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC][Draft] Body-less __construct

2021-05-11 Thread Guilliam Xavier
> interface MyLibraryException; > > > class DefaultMyLibraryException extends \RuntimeException implements > MyLibraryException; > > ``` > > Is an excellent use case for this! > > I'm probably biased by my C++ background but to me this looks like "forward declarations" (i.e. just declares types but doesn't *define* them) :/ Regards, -- Guilliam Xavier

Re: [PHP-DEV] Trait constants

2021-05-12 Thread Guilliam Xavier
gt; > * Constants mustn't be accessible directly on the trait, i.e. > TraitName::FOOBAR throws. > Sorry for asking so late, but: why? Note that currently both TraitName::$foobar and TraitName::foobar() work: https://3v4l.org/eGlYm Thanks, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Partial function application

2021-05-17 Thread Guilliam Xavier
`` (both would be called as `$p()`, i.e. without any arg). Here we had to add a `?` only for "technical" reasons. More generally I also agree that `?` having two different meanings/behaviors in e.g. `f(?, 2)` [or `f(1, ?, 3)`] vs `f(1, ?)` -- namely: "exactly 1 arg" vs "0+ args" -- is confusing. I think I too would prefer `?` to only mean "exactly 1 arg", and - either have another token for "0+ args" (e.g.: `f(?, 2)` [and `f(1, ?, 3)`] vs `f(1, ...)`, and also `noParam(...)` and `threeParams(1, 2, 3, ...)` ) - or have another syntax like Hossein first suggested (e.g.: `*f(?, 2)` [and `*f(1, ?, 3)`] vs `*f(1)`, and also `*noParam()` and `*threeParams(1, 2, 3)`). Unless there are compelling (or at least convincing) reasons against? Thanks, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Partial function application

2021-05-17 Thread Guilliam Xavier
On Mon, May 17, 2021 at 5:16 PM Mike Schinkel wrote: > > > On May 17, 2021, at 10:50 AM, Guilliam Xavier > wrote: > > > > On Mon, May 17, 2021 at 6:58 AM Mike Schinkel wrote: > >> > >> > Well, I was thinking that by changing the proposed syntax we

Re: [PHP-DEV] [RFC] Partial function application

2021-05-17 Thread Guilliam Xavier
arameter, e.g.: ``` function f($a, $b, $c, $d, $e) {/*...*/} /* We want to bind value 4 to param "d" */ // with current syntax: $p = f(?, d: 4); /* or f(?, ?, ?, 4) */ // with another hypothetical syntax: $p = *f(d: 4); ``` Anyway, looking forward to your update =) Thanks, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Partial function application

2021-05-17 Thread Guilliam Xavier
On Mon, May 17, 2021 at 5:47 PM Alexandru Pătrănescu wrote: > > On Mon, May 17, 2021 at 6:36 PM Guilliam Xavier > wrote: > >> On Mon, May 17, 2021 at 5:01 PM Levi Morrison < >> levi.morri...@datadoghq.com> >> wrote: >> >> > Joe Watkins has

Re: [PHP-DEV] Re: [RFC] [Discussion] Final constants

2021-05-18 Thread Guilliam Xavier
riel, see https://wiki.php.net/rfc/final_class_const#reflection > A `ReflectionClassConstant::isFinal()` method is added in order to be able to retrieve if a constant is final. Regards =) -- Guilliam Xavier

Re: [PHP-DEV] [RFC] [Draft] Add RNG extension and deprecate mt_srand()

2021-05-19 Thread Guilliam Xavier
the vote should be split into 3 parts: the new classes, the deprecations (which itself could be split between [mt_]srand and [mt_]rand), and the change of internal RNG for shuffle/str_shuffle/array_rand. Best regards, -- Guilliam Xavier

Re: [PHP-DEV] Trait constants

2021-05-19 Thread Guilliam Xavier
r more discussion. Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] [Draft] Add RNG extension and deprecate mt_srand()

2021-05-20 Thread Guilliam Xavier
; functions, so... By the way, for `generateInt()` (without explicit $min/$max args), I assume that $max defaults to PHP_INT_MAX, but does $min default to PHP_INT_MIN or actually 0 [if it's like [mt_]rand() I guess that the answer is probably 0, but that could be written clear in the RFC]? > > Thanks for the detailed remarks. Based on these, I would like to clean up > the RFC. > > Regards, > Go Kudo > Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Guilliam Xavier
ble and not performing a call. > Hi, several other syntaxes have been proposed to consideration in the PFA thread, and I wouldn't want to start new bikeshedding here; is there a place that would be more appropriate to gather the possibilities (like a kind of updatable list)? Thanks, -- Guilliam Xavier

Re: [PHP-DEV] Re: Injection vulnerabilities

2021-05-24 Thread Guilliam Xavier
c" parts and quote/escape the dynamic parameters)? Regards, -- Guilliam Xavier

[PHP-DEV] Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension)

2021-05-24 Thread Guilliam Xavier
for static analysis)... Ideally it should be distinct `(array $value): array` and `(string $value): string`, but that probably requires two distinct names? - For internal implementation, isn't there a signed/unsigned "mismatch" between PHP `function next(): int` and C `uint64_t (*next)(void)` return types? Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-25 Thread Guilliam Xavier
a lot easier to understand even if > someone is not that familiar with it yet. > FWIW: In this context, ? and * remind me of shell wildcards (used by glob() and fnmatch()), which makes sense too. Also, at least one person is opposed to "...". -- Guilliam Xavier

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-25 Thread Guilliam Xavier
added later (or in PFA). Regards, -- Guilliam Xavier

[PHP-DEV] Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension)

2021-05-26 Thread Guilliam Xavier
costly operation?) or some other solution someone can think of? Ah that made me think: should some methods better be `final`? Finally, the current "Open Issues" section should probably renamed to "Discussion" or even "FAQ" here? Regards, -- Guilliam Xavier

Re: [PHP-DEV] Disable autovivification on false

2021-05-26 Thread Guilliam Xavier
s) { /* ... */ } } } ``` All other cases I can remember were arguably bugs (missing initialization). That said, deprecating it on false would already be a +1. Regards, -- Guilliam Xavier

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Guilliam Xavier
er > making uninitialized something other than "your constructor is bad and you > should feel bad." > I think you said the word: serialization. And especially *deserialization*, e.g. from a JSON payload into a typed DTO *without* calling the constructor (then the DTO is passed through validation, which must handle uninitialized typed properties "gracefully"). -- Guilliam Xavier

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-27 Thread Guilliam Xavier
isset); but the PR was only proposing `is_initialized($foo, 'bar')` (regular function, akin to property_exists). Anyway, that's a "Wont fix". (PS about previous messages: I actually don't write custom serializers myself) -- Guilliam Xavier

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Guilliam Xavier
T) ); That said, I wouldn't mind a new indent parameter (but note that allowing an arbitrary string [not limited to whitespace] might result in invalid JSON). Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Pipe Operator, take 2

2021-06-08 Thread Guilliam Xavier
Name() as a step, something not possible with PFA), and is also trivially free. A PFA-based optimization would entail significant overhead relative to simple function calls, unless special optimization for the pipe operator usage is introduced (which may not be possible, depending on precise semantics). """ Could you (or Nikita) expand a bit on this (esp. the advantages of the PFA approach / disadvantages of Hack's approach)? Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Pipe Operator, take 2

2021-06-08 Thread Guilliam Xavier
On Tue, Jun 8, 2021 at 4:09 PM Larry Garfield wrote: > On Tue, Jun 8, 2021, at 5:41 AM, Guilliam Xavier wrote: > > > you forgot to update one > > `explode(?)` to `str_split(?)`, and also, the first `fn($v) => > > 'strtoupper'` should be just `'strtoupp

Re: [PHP-DEV] Re: [RFC] Under Discussion: Add Random class and RandomNumberGenerator interface

2021-06-09 Thread Guilliam Xavier
gt; > > Therefore, an equivalent method to mt_getrandmax() is no longer provided. > Great! > > > > > uint64 & right-shift > > > > This is a specification of the RNG implementation. PHP does not have > > unsigned integers, but RNG handles unsigned integers (to be precise, even > > the sign bit is random). > > > > As mentioned above, PHP does not have unsigned integers, which means that > > using the results generated by RNGs may cause compatibility problems in > the > > future. To avoid this, a 1-bit right shift is always required (similar to > > mt_rand()). > Good to know, thanks. Regards, -- Guilliam Xavier

Re: [PHP-DEV] Re: [RFC] Under Discussion: Add Random class and RandomNumberGenerator interface

2021-06-09 Thread Guilliam Xavier
> > Couldn't the Random class simply implement `public function __clone(): > void` (that would internally do like `$this->algo = clone $this->algo;`)? > Sorry I meant like `$this->rng = clone $this->rng;`. PS: Please don't reply to this erratum, but rather to the previous message ;)

Re: [PHP-DEV] Re: [RFC] Under Discussion: Add Random class and RandomNumberGenerator interface

2021-06-09 Thread Guilliam Xavier
ior when calling nextInt() in a 32-bit environment using a 64-bit RNG [...] which means that the code loses compatibility with the result of running on a 64-bit machine"? And you asked if throwing an exception would be preferable? Anyway, I personally don't care about 32-bit (but other people may). > Regards, > Go Kudo > Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Partial Function Application, take 2

2021-06-10 Thread Guilliam Xavier
ped parameter `?Foo $foo`)? Related, for `$null === null`, is `$c = $null->bar(?);` / `$c = $null::baz(?);` an immediate error, or only later when calling `$c($arg)`? Regards, -- Guilliam Xavier

Re: [PHP-DEV] [RFC] Partial Function Application, take 2

2021-06-10 Thread Guilliam Xavier
On Thu, Jun 10, 2021 at 4:34 PM Larry Garfield wrote: > On Thu, Jun 10, 2021, at 3:17 AM, Guilliam Xavier wrote: > > On Wed, Jun 2, 2021 at 7:47 PM Larry Garfield > > wrote: > > > > > https://wiki.php.net/rfc/partial_function_application > > > >

Re: [PHP-DEV] [RFC] Partial Function Application, take 2

2021-06-10 Thread Guilliam Xavier
On Thu, Jun 10, 2021 at 7:32 PM Guilliam Xavier wrote: > > Since `$null?->whatever(1, 'a')` currently always returns null without > error, shouldn't `$null?->whatever(?, 'a')` return a closure (with a > signature built from the placeholders onl

Re: [PHP-DEV] [RFC] Partial Function Application, take 2

2021-06-11 Thread Guilliam Xavier
ected" Error, and `$boo = $baz(...);` makes the subsequent `$boo(5);` throw a "not enough arguments ..." Error) (weird, looks like `$bar = $foo(2, ...);` and/or `$baz = $bar(3, ...);` dropped too many params) Regards, -- Guilliam Xavier

  1   2   >