« first day (4450 days earlier)      last day (722 days later) » 

@Tiffany blinks
Well this is not the time to look into it
01:50
It's mb_regex_set_options specifically that has weird behavior
But yeah, I had moment of "WTF is going on"
 
6 hours later…
07:30
@Derick I see "CentOS Stream" in the wizard (group), and then "EL-8"
07:46
Question: the only way to check via reflection if a class is an attribute is to check if it has attribute #[Attribute], yes?
#[Attribute]
class Foo {}
class Bar extends Foo {}
#[Bar]
class Baz {}
var_dump((new ReflectionClass(Baz::class))->getAttributes()[0]->newInstance());
This seems illogical to me resulting in
Fatal error: Uncaught Error: Attempting to use non-attribute class "Bar" as attribute in /in/QfPRY:8
Stack trace:
#0 /in/QfPRY(8): ReflectionAttribute->newInstance()
Checked the original RFC https://wiki.php.net/rfc/attributes_v2 and there is nothing about extending attribute classes, the only thing about extending attribute classes is in *Future Scope*
> Extending userland attributes to allow declaring which target they are allowed to be declared on including validation of those targets in ReflectionAttribute::newInstance().
Ok, that is because attributes are not inherited, hmmm I didn't expect that.
If I override inherited function then the attributes from parent method are not available anymore
I see Java has an annotation which in PHP could be an attribute #[Inherited] which targets attribute classes geeksforgeeks.org/inherited-annotations-in-java
Meaning such attribute would be available via inheritance, does that make sense?
 
5 hours later…
12:44
@Jimbus Seems pretty cold outside.
12:55
@RemiCollet Yeah, found it ;-)
@Derick notice than "CentOS 8" is dead, have to use "CentOS Stream 8" (or original RHEL, or another clone, AlmaLinux, RockyLinux...)
 
1 hour later…
13:58
Morning
14:18
@Tpojka The rain isn't supposed to start freezing until midnight, here in east central Indiana
15:11
@Jimbus Here (Bosnia) is few days ok (around 42ºF) after some 22ºF 10 days before that.
@Tpojka My buddy lives out in the US NW and they had a 42F temp drop in one hour
24C
That's right adventure. :D
15:28
\o/
How much data would a data mapper map if a data mapper would map data?
@zeriyoshi hey there.
My thoughts are about a page up.
@Danack I do not see much value in being strict about it. What I think is most important is to abolish the state of global random numbers.
I think the global state is clearly detrimental to the future development of the PHP core. I believe that proper migration needs to take place, as when srand, which depends on libc, became an alias for mt_srand.
@zeriyoshi "is clearly detrimental" what problem is it causing?
As you say, mt_rand() is harmless and does not need to be changed. On the contrary, that is why you can simply replace it with random_int(). Also, we now have powerful refactoring tools at our disposal.
@Danack Swoole, for example, which is an extension hosted in PECL, also copies the Mersenne Twister state in order to fork the process. It is dangerous because it can generate sequences that are random and yet definite.
15:39
One belief I have is that PHP is splitting into two camps, where one type of project has static analysis and other modern tools setup like refactoring, and the other type of project has basically the same set of tooling as it did a decade ago, i.e. none.
The people who have projects that were written a decade ago using mt_rand() probably don't have refactoring tools setup. They also aren't guaranteed to have any programmers left maintaining their application. If it's been sitting there for years just working, they might not have hired a new programmer after their last one left.
@Danack That's right. However, I learned and used them when migrating PHP 7.x code to 8.x. I think we are probably coming to a point where migration is not realistically possible without using such tools for most legacy applications.
"It is dangerous" - even if that is true (and I'm not sure it is due to how few times the code is calling it per day), it's not obvious to me that the danger justifies the cost of people migrating.
Also, if you are using random numbers as random numbers, this change can be done by simple substitution without using the tool. I believe that it is probably almost unnecessary to use the tool.
"can be done by simple substitution" - that assumes the company has a programmer still working on the project.
Hmmm. To be honest, I am still not convinced about the aliasing of srand(). This destructive change was clearly impossible to migrate. If this change is acceptable, I can't help but think that this change is also acceptable.
15:46
I have a use case for mt_rand which can't be replace by random_int :)
@SaifEddinGmati Good for you. Now go read php.net/manual/en/class.random-engine-mt19937.php
However, if you take into account that PHP is a tool for the web in the first place, I understand your point of view. There are not many situations where random numbers are used. However, this is often not the case when implementing an API server.
https://github.com/azjezz/psl/blob/next/src/Psl/PseudoRandom/int.php

Psl has 3 components in place related to randomness, one of which is `RandomSequence` which is basically what the new random engine is.
In this case, using the Randomizer from PHP 8.2 seems appropriate. If not PHP 8.2, you can still use arokettu's excellent polyfill.
https://github.com/arokettu/php-random-polyfill
15:50
PSL doesn't relay on polyfill at all, mt_rand exists and it does the job.
So I'll try to say two things clearly. People have a gut instinct that the justification for removing something from PHP needs to be proportional to the length of time something has been around. e.g. a new experimental feature that is introduced in one version of PHP, can be completely changed in the next version. mt_rand() has been present for over two decades, so people are going to want to see a strong justification for removing it.
@zeriyoshi PSL has only one dependency which is the event loop, that polyfill pulls 4 more dependencies with it, doing so just to replace mt_rant doesn't make sense IMO.
The second thing is, although mt_srand() might not be 100% safe, and touches global state, I strongly suspect many people aren't going to agree that it is worth removing. The RFC would really need to make a strong case for it, not just say "there are global scope issues" documented elsewhere.
@Danack ^ personally i didn't update PSL to explicitly require 8.2 because i don't see a benefit from doing so yet, if mt_rand is removed from 8.3, then I'm forced to update the requirement to 8.2, but until now, I'm not seeing anything in 8.3 that would make me update the requirement.
And even if the RFC does that, you should probably mentally prepare yourself for an....energetic, conversation about removing it.
15:56
Yes, mt_rand() has been around for a long time and is available in many versions. On the other hand, it is true that Randomizer is still only available in 8.2. It should be considered that mt_srand() and mt_rand() are sufficient in many situations. Nevertheless, they still have state problems.

It is certainly possible to consider this sufficient because of the workaround. However, I would like to question this once.
And as I said on twitter, it's not currently deprecated, so the earliest it could be removed would be 8.4 (if that exists), but even then....giving people more than one version of PHP to do the replacement (i.e. removing it in 9.0) might be more acceptable.
@Danack personally, I'm okay with it mutating the global state, and PSL has an alternative that doesn't do that ( Psl\RandomSequence\ ).
@Danack
Thank you. I too believe we need energy for this discussion. PHP 8.2 has just been released and the fact that it is moving now shows that I have the motivation to do so for now :)
@Danack Indeed.
Sorry, I'm still getting used to the Stackoverflow chat...
At some point, I'm going to make my own chat, that is a bit easier to use...
@SaifEddinGmati The PSL use case was very informative as an example of how mt_rand() removal can be harmful. Thank you.
That said, what do you think about the random_float() function addition? I think it would be nice to have this function because of the complexity of the Randomizer
(I do not intend to deprecate lcg_value())
16:04
That sounds like a good idea, that should probably be stripped out to a separate RFC, where it would likely be passed without controversy.
OK, I will make this separate another RFC. It will be useful.
does random_float take min/max or does it generate [0.0, 1.0]?
@SaifEddinGmati I assume a signature like this: externals.io/message/119188#119192
ugh... doesn't make sense?
more specially the boundary thing
random_int doesn't have that, so why would random_float?
make it consistent by having the same behavior
oh look, a discussion about boundaries and random number generation.
Aug 10, 2020 at 20:34, by Danack
self-defenestration intensifies.
16:10
@Danack or join the dark side and make a discord account
Well, I have one. But I was hoping for a good chat system...
SO's reply feature > Discord's reply feature
@Tiffany is there any "official" discord?
In most cases, it is assumed that the call will be made with no arguments. Most requirements can probably be satisfied.
When the need to specify arguments arises, you need to know what they mean (I didn't understand this at first)
However, it could be simpler.
@zeriyoshi but it's inconsistent, the "best" implementation imo would have no arguments, and just return [0.0, 1.0]
16:12
@SaifEddinGmati For PHP? Not that I'm aware of...
@Tiffany I'm in like 2 and both are dead lol
( php servers )
@SaifEddinGmati If you are trying to do something complicated, you can certainly use the Randomizer. It makes sense.
Consider removing unnecessary arguments.
@SaifEddinGmati phpc.chat is all I know of, at this point
@zeriyoshi [0.0, 1.0] isn't complicated, that's how most libraries/languages do it for floats.
@SaifEddinGmati I think I may have misplaced my English. I thought better to remove the all arguments.
16:18
yea, making random_float() simply have no arguments is good. otherwise use Randomizer.
@CMB are you around?
cmb
cmb
@Danack pong
phpc.social down?
For a moment there, it looked like Tim was there... I apologize here for leaving you in charge of the documentation and the 8.3 RFC while I do the PHP migration at work.
cmb
cmb
@Danack "Thou shalt not remove features in minor version, lest thy users remove thy head."
16:21
@cmb I just invited you to a room, but the notification for that is terrible on mobile......maybe follow me on twitter so I can DM you, or find that room?
Oh god this user note about array_sum is leading me down an insane rabbit hole... It's numeric strings all over again but worse
@zeriyoshi I'm not at home over the holidays and click into the chat on my phone every once in a while.
As I said, all good from my side :-)
@SaifEddinGmati no, they do not, most languages have [0.0, 1.0) and that is the better default.
I'm also not convinced that random_float() is a good thing, because then folks will use random_float() * (b - a) + a which is unsafe. But more regarding this on the list, when I'm back home at a proper keyboard.
@TimWolla Okay, I did not understand the end of year holidays :), Year-end holidays in Japan will be a little later. (Shogatsu)
You obviously understand random numbers better than I do haha.
(This is not funny at all and I should be a little more diligent)
isn't basically random_float(): float { return random_int(0, PHP_INT_MAX) / PHP_INT_MAX; }?
@zeriyoshi I'm on vacation at little early. First official holiday for me in Germany is the 25th for Christmas.
@SaifEddinGmati No. That is biased. You usually divide 0..253-1 by 253. That gives you an even distribution in [0, 1).
But that is only possible for [0,1), not different ranges.
16:36
just checked, PSL does [0, 1], not [0, 1).

https://github.com/azjezz/psl/blob/next/src/Psl/PseudoRandom/float.php#L19
@TimWolla -1 just so it's exclusive, right?
Yes, but that exclusive bit is necessary so it's unbiased. Half-open intervals also act more nicely with everything else, because they can be split without needing tie breaks for 0.5
See dl.acm.org/doi/10.1145/3503512 for more details (you should be able to find a preprint PDF via Google).
The implementation for getFloat() in 8.3 is based on that paper.
i recently added Range to PSL ( github.com/azjezz/psl/pull/378 / github.com/azjezz/psl/pull/380 ), going to add nextForRange($range) to random sequence in 3.0.
that way it's easy to control .
and don't need different methods for int and floats.
I believe it's impossible to correctly implement getFloat() in userland, because you lack the functionality for "next float".
psl Sequence doesn't use the randomizer anyway, would need to re-implement it manually
Yes, I understand that. But you still won't be able to correctly implement a function for unbiased floats in arbitrary ranges in userland.
I've done quite a bit of research for Randomizer::getFloat() in that topic and the paper I've linked basically sums up all the problems.
16:48
link?
how is it implemented internally?
Paper is linked some messages above. The internal implementation is in gammasection.c in php-src master.
On my phone, so no links, I'm afraid.
You can also check the RFC, it explains all that stuff with pointers for details.
The part you can't do in userland is called gamma_high and gamma_low I believe.
(heading off now, might take another look later)
more specifically you mean nextafter?
I guess I need to first understand what is happening in floating point :innocent:
I have to work tomorrow, so I'm going to bed today. I'll be back!
Japanese holidays start on the 29th :)
i don't see why it can't be re-implemented in PHP, but I'm not going to bother with it now, will let you know when i do.
17:43
@SaifEddinGmati it was, briefly
 
1 hour later…
19:10
@Girgias Every string is a number when you try hard enough
19:30
@IluTov every number is a string.
19:45
@IluTov It's honnestly worse than that, so I suppose I have some more RFC writting to do...
@IluTov just saw this wiki.php.net/rfc/dynamic_class_constant_fetch why 😭
we actually used this to determine if it's going to be a method call lol - github.com/php-rust-tools/parser/blob/main/src/parser/…
actually, looking at it now, i don't why we even did that lol github.com/php-rust-tools/parser/blob/main/src/parser/…
20:33
@SaifEddinGmati I really strongly recommend not using negative emojis when asking people questions. It is not conducive to a productive conversation.
⠀⠀⠀⠀⠀⠀⠀⠀
⣀⢴⡾⠿⠛⠛⠉⠉⠛⠛⠿⠖⣦⢄⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣠⡴⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢶⣄⠀⠀⠀⠀⠀
⠀⠀⠀⢠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⢳⣄⠀⠀⠀
⠀⠀⣰⡟⠀⠀⠀⠿⠿⢿⣶⣦⣄⡀⠀⠀⠀⠀⠀⣠⣴⣶⣾⠿⠿⠇⠻⣂⠀⠀
⠀⣼⡍⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⡦⠀⠀⠰⣿⣿⣿⣿⡄⠀⠀⠀⠀⠱⣢⠀
⢸⡿⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⡟⠀⠀⠀⠀⠸⣿⣿⣿⠃⠀⠀⠀⠀⠀⢻⠄
⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠋⠁⠀⠀⠀⠀⠀⠙⠛⠁⠀⠀⠀⠀⠀⠀⠈⡇
⣿⡅⠀⠀⠀⠀⠀⠀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢼
⢻⡇⠀⠀⠀⠀⠀⠀⢸⠀⠱⡄⣴⣶⣶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣸
⠘⣿⡀⠀⠀⠀⠀⠀⡸⠀⠀⡇⠀⠀⠀⠀⢉⣙⣟⣀⡀⠀⠀⠀⠀⠀⠀⠀⣏⠃
⠀⠹⣵⡀⠀⠀⣠⠚⠀⢀⣾⡠⠤⠔⠒⠚⠉⢀⣀⠤⠟⠀⠀⠀⠀⠀⠀⣾⠋⠀
⠀⠀⠘⢷⡄⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀⠾⡉⠁⠀⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀
⠀⠀⠀⠈⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠠⠤⡇⠀⠀⠀⠀⠀⠀⢀⡴⠟⠁⠀⠀⠀
⠀⠀⠀⠀⠘⣧⡀⠀⠀⠀⠀⠀⠀⠀⠠⢴⡇⠀⠀⣀⣠⣴⠞⠋⠁⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠘⠷⣦⣀⣀⣀⣀⣀⣀⣠⢼⠾⠟⠛⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀
@Danack I didn't intend it as negative ^^'
You didn't intend 'Loudly Crying Face' as a negative?
20:40
@Danack ????
To be clear, the problem is that negative emojis are used to make other people feel bad without providing an argument that can be responded to. I see them a lot on github...
There's a minor difference when it's between people who know each other
To... some extent... as well as can be said online
@SaifEddinGmati yes
@SaifEddinGmati I mean, technically everything can be implemented in PHP, but in that case the result likely is neither pretty, nor efficient. Musl uses a union to easily modify the bit level representation of the underlying double: git.musl-libc.org/cgit/musl/tree/src/math/nextafter.c
yes... i actually thought it was named sobbing face lol anyways: Loudly Crying Face conveys uncontrollable feelings and overwhelming sentiments, ranging from grief and disappointment to hilarity and joy.

I tend to use it a lot as a laughing emoji as well, it's my 3rd most used emoji lol
@TimWolla i don't think it wouldn't be efficient, especially with JIT, it's good at optimizing this kind of things.
 
2 hours later…
22:55
@SaifEddinGmati I see it didn't take you long to solve that problem :P
23:06
because we kinda already supported it, we just were triggering a function that looks for ( even if we knew it's not there so it returns a parser error :P
the rest is just code clean up

« first day (4450 days earlier)      last day (722 days later) »