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:
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
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
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
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
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
; // 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);
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
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`.
>
>
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
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
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
]" // $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
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
--
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
`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
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
manual/en/function.is-scalar.php).
--
Guilliam Xavier
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
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
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
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
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
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
> 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
'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
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
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
PHP 8.0.0 because of an unexpected
interaction of those two things?
(adding Nikita to the CC list)
--
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
.io/message/112996 ) for the RFC.
--
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
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
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
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
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
;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
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
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
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
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 <
nd continue again from step 5.
(where "step 5" refers to the discussion phase)
Regards,
--
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
`
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
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
Plus` have a public `__construct(int $seed
)` and implement the magic `__serialize()`/`__unserialize()`.
Best regards,
--
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
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
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-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
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
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
> 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
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
``
(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
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
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
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
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
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
r more discussion.
Regards,
--
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
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
c" parts and quote/escape
the dynamic parameters)?
Regards,
--
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
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
added later (or in
PFA).
Regards,
--
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
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
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
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
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
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
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
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
>
> 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
;)
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
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
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
> >
> >
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
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 - 100 of 190 matches
Mail list logo