« first day (3842 days earlier)      last day (1089 days later) » 
06:00 - 20:0020:00 - 22:00

6:04 AM
posted on April 23, 2021

 
6:16 AM
good morning
i'm looking for ages for a php callback function after successfully saving a file: $domxml->save($xml_file_name);
 
 
1 hour later…
7:25 AM
@SaifEddinGmati friends
=====================================================================
Running selected tests.
PASS Circular Friendship [Zend/tests/friends/001.phpt]
PASS Circular Friendship Parent [Zend/tests/friends/002.phpt]
PASS No Friendship [Zend/tests/friends/003.phpt]
PASS Friendship [Zend/tests/friends/004.phpt]
PASS Friendship Inheritance [Zend/tests/friends/005.phpt]
=====================================================================
Number of tests :    5                 5
Tests skipped   :    0 (  0.0%) --------
 
7:45 AM
also, morning everyone :)
 
8:14 AM
Hi Dr Nick!
 
Does anybody have an idea where to find RHEL 7/8 downloads without having to sign up to anything?
 
created an account now already :-/
but thanks
but their site is "Internal Erroring", so I'll dl that one instead.
 
@JoeWatkins You're on a roll these past couple of months. Good show
 
How to call entity without an identity? In context of Http Client implementation types used as an input to creation process doesn't include an identity cause it's autogenerated on remote side, therefore the input is something close to the entity but without an identity and has less properties than the actual entity fetched by GET methods in REST API I try to implement HttpClient.
It could be an DTO or Model or Request, but speaking of DTO I instantly think about DDD, when speaking of Request I instantly think of a HTTP Request, considering Model I think about anemic model only, how to choose?
 
8:47 AM
\o morning
 
o/ morning all
 
\o
something a little different for Friday open.spotify.com/track/…
 
... it's already friday?
 
inorite
 
^ That is remarkably mellow
 
8:54 AM
I'm ready for a couple of days where I don't have to go out ...
the world has beaten the crap out of me almost every day this week ...
including, I drove into a concrete barrier on a roundabout ... and since then have ended up backwards in the road while trying to go round other roundabouts ...
 
:S damn
You might want to go spend a week or two in the US where there's much fewer roundabouts
 
I noticed yesterday that one of the rear wheels was flat, and missing the valve thing ... took it to a place to get new tyres, and it turns out it had an inner tube in it ... you know, like a mountain bike has ...
I think that's the reason for the waywardness, it only showed up when it was raining hard ...
 
A couple of years ago I managed to have a slow rear-end collision on a road that could charitably be called degraded. Poor guy I had hit had only just had his new car back for 2 weeks since he last got hit
 
wtf I didn't realise tubed tyres on cars was a thing in the last ~40yrs
 
they laughed at me in the tyre place, started to call me "el granjero" ... "the farmer" ...
 
9:00 AM
wait are you driving another scoobie? :-P
 
no, 1997 golf cabriolet ...
 
lolwut how tf did that end up with tubes
is that a mk3?
 
I dunno, the guy I bought it off is a piece of work, this is the second car in 6 months, and the first one caught on fire while I was driving on a motorway ...
 
solid build but not as good looking as the mk4
 
yeah, mk3
@DaveRandom cabrio though ...
 
9:01 AM
@JoeWatkins ...and you bought another one from the same guy??
@JoeWatkins oh that changes things
 
no choice, he's an English chap and is letting my pay monthly ...
I hadn't even finished paying for the first car when I had him take it away ...
it'll be years and years before I can get a lease/loan for something new ...
 
I took delivery of this the other day (for a friend)
 
oh wow
 
it's in unbelievably good nick
 
That looks like it should be in a skip... is there something vintage about it?
 
9:04 AM
looks neat
 
@MarkR escort mk1s are proper vintage now yeh
weirdly
the racey ones anyway
 
they're all awesome
 
that one has a 1.8 in it, but still only 4 gears and brake disks like jam-jar lids :-P
 
there's quite a lot of that sort of thing going on here ... cars never rust if you can keep them +10k from the coast ...
 
I need to go out on a job but ttyl
 
9:06 AM
lata
 
o/
 
@JoeWatkins i don't know much about how the PHP parser works, is it possible to have

`sealed interface Throwable permits Exception, Error {}` syntax as in Java ( https://docs.oracle.com/en/java/javase/15/language/sealed-classes-and-interfaces.html )?

i was also thinking about a more soft alternative

`sealed interface TypeInterface {}` which would permits implementations in the same namespace + children namespaces ( however, declaring a sealed symbol in the global namespace woud be completely redundant )
 
you won't get through a patch that introduces two new keywords, I'm pretty sure ...
 
9:21 AM
yield new Hello();
Async greetings, courtesy of @DaveRandom
 
what's the issue in introducing a new keyword ( except that it can't be used for class names anymore )?
 
just that, it's a pretty strong argument ...
lohle @Tfifnyan
 
R.P
Hi all. Apparently I am very bad at googling as I can't find reason why $var = 'abcde'; echo $var[0]; echos letter 'a' in one environment and echos nothing in another. Still looking for stackoverflow post, but maybe here someone knows answer right away?
 
9:36 AM
that doesn't seem right
 
@JoeWatkins IMHO, it's not, we can have a separate vote in RFC for the syntax, that is if it is possible to implement.
 
@JoeWatkins split thread?
Wait, split thread would have half the sentence sliced
 
@SaifEddinGmati because it's new keywords, there's no problem implementing it, include it as an option and I'll change it if it gets in ... but ti's hard to swallow that one is better than the other when the other has actual arguments against it ...
@Tiffany order of operations are no longer important, get used to it ...
nor is spelling ...
this patch isn't totally finished, it's only been on my mind now for a day, but it's something to play with while you work on the rfc, the syntax and words of the thing are secondarily important at this point ...
 
I started writing the RFC, will let you know when it's done: gist.github.com/azjezz/0414eb760021a6c2930641b2be1e31a6
 
@SaifEddinGmati always start with why we need this thing, not what this thing is ... implying the benefits in the explanation of the thing isn't good enough ... spell out what problem this solves ...
 
9:51 AM
👍 thanks, will update accordingly
 
On the topic of sealing... a year or two ago I took a stab at adding a keyword to make class properties sealed by default (none of this horrible dynamic properties unless you opt in) but I dropped it when Nikic suggested editions, which had the potential to include it by default. But editions seem to have fallen by the wayside.

What think people to the idea of bringing it back? It can be accomplished via a trait but I think that is messy A.F.
 
I think you should work with the other guy that wants to introduce sealing and come up with a coherent definition of what that is ... you are much more likely to get the word in if it's supporting multiple things ...
 
Perhaps sealing is the wrong word... more of a 'no dynamic props'
 
it doesn't look or read terrible ... but voting on two different meanings for one words is not a thing people will swallow, unless there's one vote and here's what we mean by sealing properties and here's what we mean by sealing classes ...
I can't necessarily think of anything better for properties anyway ... "direct" maybe ... "stable" maybe ...
not really better ... you still have to define what you mean ...
 
The main problem I see is it's opting out of what should be default behaviour
 
10:00 AM
deal with the world the way it is, we can't really ever change that default ...
 
Well that was where I was pinning a lot of hope on editions
github.com/php/php-rfcs/pull/2 which I think died a death
 
yeah but iirc doctrine uses this as a core part of it's functionality ...
what do you think the chances are of getting an edition, or version, or whatever you want to call it, that is incompatible with doctrine ?
 
"strict properties"?
 
Pretty high initially I'd say. It would however allow doing what I would consider some sensible things (like removing dynamic properties by default) and making them opt-in. Making the default surface much more sensible.
 
10:18 AM
Is this similar to readonly/writeonce?
They feel similar, but something tells me they aren't
 
The one I linked?
 
Let me check, haven't clicked links yet :X
Ah, they're different
How would it affect classes that were made in like PHP 4 days that use an array of properties?
 
I'd forgotten that Rowan had already RFC'd it tbh
 
And primary reason those classes haven't been refactored is mainly keeping backwards compatibility, and we don't know how many other classes in the entire code base are dependent on the array of properties, but short answer is a lot. Like probably in the range of hundreds. :/
Really wish I could change those though...
@JoeWatkins never properly thanked you for introducing me to the file command, it's something I use pretty regularly in my current job to verify files if I'm unable to confirm the integrity of a file by sight
So, thank you :)
 
10:42 AM
@MarkR wouldn't the following be better alternative:

```
declare(strict_properties=1);

class Foo {}
```
?

i.e classes defined with `declare(strict_properties=1);` won't have dynamic properties.
 
@SaifEddinGmati That would have fallen under the fine-grained-declares option, but yes that's an option
 
 
1 hour later…
12:03 PM
@MarkR Yeah, but I also prefer opt-in over opt-out. I wish PHP had saner defaults (private, void, etc).
 
Hmm, deprecate dynamic properties, unless class is declared using dynamic class Foo {}?
 
@SaifEddinGmati Yeah, exactly. It's probably not something that has to do with scope but with the kind of class. E.g. it probably makes sense for stdClass but not App\Entity\User. So a class modifier makes more sense.
 
yea, i think internally only stdClass would need to be declared dynamic.
 
12:20 PM
morns
@PeeHaa yup
 
12:49 PM
@SaifEddinGmati you never had an use case where you dynamically attached data to some object, unbeknownst to that object? But I think this should be explicitly marked then, like $myObject->@myDynamicProperty to prevent typos.
I do not think that the feature should be stripped outright
 
never, if i want to store data dynamically i use an array, that's what that's for.

but even then, 90% of the time i know exactly what an array contains and i can type it's elements using psalm/phpstan object-like-array annotation.
worked on multiple legacy projects that used dynamic properties, and every time it's just the original author not declaring them correctly, not because the data is actually dynamic.
 
@SaifEddinGmati note that this only happens to me when using code from other libraries - like, I have an object … need to pass that to the library and then retrieve it later
 
then the library is doing something "wrong".

i think i came across a PHP template engine before which allows you to access context variables in the template using `$this->user` .. etc, that's a use case where the library can either:

1. declare the `$this` class explicitly dynamic.
2. use an array `$this->context['user']`
3. extract the variables in the template scope so you can use `$user` directly.
 
cmb
"The general use case for weak maps is to associate data with individual object instances, without forcing them to stay alive and thus effectively leak memory in long-running processes."
 
@cmb yeah, probably less necessary with weak maps now. But a couple years ago we didn't have them :-)
 
cmb
12:57 PM
right :)
 
Cannot combine named arguments and argument unpacking this is sad 😭 I was hoping to use two types object instantiation where all arguments from the base class are passed by named arguments but for the extending class passed via splat operator with arguments unpacking from additional array
Why is that restriction at all?
 
1:16 PM
@SaifEddinGmati I wanted to do something like that, but time and motivation is always the issue :(
 
I am building a small PHP extension but seeing some weird behaviour passing in an array to a method defined in the extension. See the paste here: pastebin.com/aEZSy1zX . Anyone can point me in the right direction to understand why this is happening?
 
Might need to deref the array?
Also what version of PHP should that extension support?
A bunch of things in this are a tad wrong even for PHP 7 if I'm not mistaken
 
7.2 is what I am running now.
 
Wait are you trying to modify the array by ref?
In that case you can't use "a" as a ZPP format, as that does CoW
Anyway I need to go, hopefully someone else can help you in the mean time
 
Thanks @Girgias !
 
cmb
1:33 PM
@Jacob you can use "a!" instead of "a" to separate the array; in that case the modification inside the function doesn't affect the passed argument.
not "a!" but "a/"
 
@cmb thanks a lot, at first look that indeed seems to do the trick!
If I want to pass multiple arrays in that way, I then do "a/a/" ?
 
@brzuchal I think mainly just not implemented
I think, as named args have to deal with stack frame extension anyway, it should be possible to at least support foo(...$args, name: $x). Possibly would even work automatically if the error is dropped
 
cmb
1:50 PM
@Jacob yes; note though, that array separation enforces a copy of the array, and as such defeats CoW.
 
@cmb great, thanks for the help.
 
Somehow I just learned that the xor operator exists
 
2:31 PM
thats normal, xor is one of the operations mostly only useful for bit manipulation and crypto related math stuff.. much like population count (popcount)
 
@makadev Do you mean the ^ operator?
 
@scorgn ^^
 
I don't actually know that much about bits, I just learned yesterday how to get an integer from the bit representation or the other way around; and the different bit manipulations
I was learning it for an assessment for an interview that said it would test on that, but they never ended up asking any questions about it
But I mean the actual xor operator, not the ^ operator haha
 
ah, the logical operator
 
Yup
I am sure there was a scenario where I've needed it in the past
 
2:40 PM
ye.. like 2 times in 10 years probably
and then you can just write !== if it's clear left/right argument are boolean
 
Probably haha
Right, but if they're just truthy in some other way I would usually do "if (($a || $b) && !($a && $b)) { ... }` which isn't that much harder anyways but still cool it exists
I'm surprised there's no sign for it that operates at a higher precedence though
Not that it would really be necessary but it does add an inconsistency
 
@scorgn what do you mean?
 
@makadev There's and, and or, as well as && and ||. The sign operators (&& and ||) have higher precedence than the word ones, for lack of better words to call them lol (and and or).
 
Bit operations in PHP basically exist to do certain things efficiently, which is why they were made operators (and because C has them as operators probably played into it). They are uncommon enough that I would ideally have them as known functions that get optimized into opcodes still, but do not exist in grammar. This would have freed up the names and, xor, etc, to be used as functions for other purposes, which IMO is totally legitimate.
 
@LeviMorrison I was wondering about that, I've rarely seen bit operations used in the wild
With the exception of flags
 
2:54 PM
You can do bitwise operations on strings in PHP. This is uncommon but how certain algorithms are implemented efficiently:
> If both operands for the &, | and ^ operators are strings, then the operation will be performed on the ASCII values of the characters that make up the strings and the result will be a string.
 
That makes sense, I was imagining it was responsible for efficiently communicating with the computer more efficiently in some way but I suppose algorithms make more sense
 
@scorgn hmm.. who knows.. normally you wouldn't mix keyword and symbol operators anyway, also only python/pascal programmers would use and/or/xor ;)
 
@makadev It is treated differently so I think you would use and/or and &&/|| based on what precedence you want them to have. I've never used them anyways though
 
 
2 hours later…
4:39 PM
@LeviMorrison isn't bitwise operations used for stuff like making a brainfuck compiler in PHP? (as a toy project, not as something useful)
 
I don't know anything about that language, so I don't know.
 
OR two parameters bitwise, example: json_encode($data,JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT); or any error_reporting combination, there are many functions in which you can use bitwise operators
 
I think it was something Leigh tried teaching me a long time ago, digging through chat logs
 
@ln-s Ironically, such usage is basically saying "enable throw on error AND do pretty printing", which is a bit confusing because it's the bitwise-or operator :)
 
4:45 PM
yeah
\JSON_THROW_ON_ERROR + \JSON_PRETTY_PRINT would be the same
 
array_key_exists() does not work for false/true ・ Reproducible crash ・ #80978
 
5:25 PM
\o
 
\o/
 
~o~
 
༼ つ ◕_◕ ༽つ
 
5:41 PM
}o{
 
/o\
 
\o.o/
 
6:07 PM
is there a real-world situation of where an iterator's key would be scalar, but non-int?
 
What is zend_function.internal_function.reserved used for?
@Tiffany Iterator keys are often strings.
 
@Trowski zend extensions can reserve memory, op arrays have it too
 
@JoeWatkins My actual problem: I wanted to shove a pointer to the current fiber into zend_execute_data, where would be a good place to do that?
 
@IluTov some people in the discussion on my "Locked Properties" thought the opposite: like strict_types, enforcing "no dynamic properties" at the use site allows you to write strict code interacting with old libraries
 
the current fiber isn't execute_data->This ?
 
6:16 PM
@Tiffany you mean float|bool|string ? i never encountered any use case where keys where something other than string, int, arraykey ( string|int ), or objects.
 
it also gives libraries that are doing funky things with their properties an escape hatch scoped to their own code, rather than having to declare the whole class as dynamic for all users
 
@JoeWatkins That might be a good place. The frames above are the this that may be used by the callback used when creating the fiber.
 
yeah frame.This would be standard thing to do then ...
wait
 
I need to work out skipping through an iterator, and I think I have to use the iterator's key. I was looking up the manual and was curious when an iterator's key would be something other than int, but it makes sense given array indices can be strings
 
6:19 PM
@Tiffany should be mixed 3v4l.org/usudo
 
what's fci.object here ?
it looks like that ought to be where you set the This, by setting fci.object, I think ...
I seem to remember you get that fci from the user, it's a func arg, right ?
that already has the object set surely ...
 
that's not really an argument tho, declaring the class dynamic is just 1 keyword.

if libraries want to support both PHP 8.X ( version with dynamic classes ), and previous versions, the best solution we be to allow dynamic properties in PHP 8.X, but with a deprecation warning, later versions for said libraries can support PHP 8.X and newer with the use of dynamic classes feature.

but i really wonder how many libraries out there make use of dynamic property access.
 
It would need to be a stepped approach anyway
You need one version to add the keyword
Then a later version for a deprecation
Then again another version to remove the fallback
 
yea, that would be better.
 
@SaifEddinGmati read the notes at the bottom of my RFC and the conversation they link to: wiki.php.net/rfc/locked-classes#reasons_for_withdrawal
 
6:24 PM
@JoeWatkins fci.object is going to be whatever object is associated with the callable given to new Fiber(callable).
At least I assume, no?
 
several use cases for dynamic properties were discussed, as were different ways of opting in
 
fiber->fci is set here.
 
@IMSoP Those people are ever so slightly crazy
 
yeah, so not there ...
 
Marco is very attached to his lazy-loading implementation
 
6:27 PM
maybe insert a fake frame, how crappy are your exception traces at the moment, do they make any sense at all ?
 
i don't really like the "locked classes" RFC, as it makes this weird PHP thing ( dynamic properties ) an opt-out feature, i'm pretty sure people would agree on the opposite ( dynamic classes must opt in ) to not encourage the use of them.

this removes the "ugly keyword" argument, as you won't have to use it everywhere, only when you need a class to have dynamic properties.
 
@JoeWatkins execute_data->This seems to have worked the way I wanted.
It was otherwise NULL, so no worries.
 
I too think that dynamic properties should be opt-in. However to do that we need some way of changing the default behaviour without a huge BC break. There's two options on the table for that, fine grained declares and editions, neither of which has moved forward.
 
	fiber->execute_data = (zend_execute_data *) stack->top;

	memset(fiber->execute_data, 0, sizeof(zend_execute_data));

	EG(current_execute_data) = fiber->execute_data;
there ...
cool ...
 
Yep, added ZVAL_OBJ(&fiber->execute_data->This, &fiber->std); there.
 
6:31 PM
well, personally, I think stdClass should be deprecated, but some people seem to really like it
 
stdclass has its place (json mainly)
 
use an array
that's PHP's version of a key-value map
 
Yes and is absolutely horrible for it wherever an empty object is concerned
 
?
 
@IMSoP less key presses to access an element 😛 $foo->bar vs $foo['bar'] ( YOU HAVE TO PRESS THE KEYBOARD 2 MORE TIMES!!! )
 
6:33 PM
lol
 
JSON has a clear distinction between arrays and objects, PHP arrays have no (accessible) difference.
an empty array could be either, making it impossible to reconstitute into JSON
 
@JoeWatkins Within a ZEND_METHOD for __construct, can I always assume that execute_data->prev_execute_data is set and that it's from user code?
That is, can I assume execute_data->prev_execute_data->func->op_array.filename is a thing?
 
@IMSoP There's actually JSON_FORCE_OBJECT to try and get around this but it has to be done for the entire payload at once.
 
look at zend_get_executed_filename
 
6:35 PM
@IMSoP and i am using AZERTY keyboard, [ is alt+5 and ' is alt+4so for me, that's 4 MORE TIMES!!!!
 
@MarkR huh, I'd honestly never come across that edge case; seems a pretty rubbish reason to have a fake object with only dynamic properties and no methods, though
 
jokes aside, i'm 100% for throwing stdClass out of the window, and (object) $arr.
 
seems more like a reason to distinguish "vect" and "map"
 
@JoeWatkins Perfect, had started writing exactly that loop :)
 
and for everything else, come up with a better way of getting data into anonymous classes
 
6:37 PM
wait, why are scalars allowed to be turned into objects????? 3v4l.org/WPIu3
 
if stdClass didn't exist, I don't think we'd need to add it, because new class{} does the same thing anyway
unless we ban dynamic properties
 
new dynamic class {} :p
 
@SaifEddinGmati wow, that's some classic PHP magic
 
I'm wondering how much (if at all) we should abuse annotations for for the sake of BC.

#[FixedProperties]
class foo { .... }

I'm not sure how fond I am of the idea of using annotations to change engine features in that way
 
that solves neither of the big criticisms: opt-in vs opt-out, and declare-site vs call-site
 
6:40 PM
Is there a reason to not use smart_str_append_printf? Seems convenient, but I always see a string of smart_str_append* calls.
 
@IMSoP i would love for array to be split into vec/dict/keyset, but i also would hate to see them land without generics ( docs.hhvm.com/hack/arrays-and-collections/introduction )
 
@IMSoP call site is a nonsense argument IMO. What next, the call site can opt out of the user defined __set function?
 
@MarkR no, the call-site opts in to being strict, to say "I don't care if the library is doing weird shit with its properties, don't let me accidentally add one"
 
But the library itself might want that, it should be on the class itself to express that.
 
why? the class itself doesn't care about extra properties being added dynamically
unless it's doing some weird reflection on itself
 
6:43 PM
yea, class site arguments doesn't really make sense here, if I'm a library author, and i explicitly don't want any of the classes provided by my library to be abuse for storing arbitrary data, that won't work for me.
 
meh, this is the same argument as strict_types, and I think it's bullshit
libraries shouldn't have control over the code that uses them
 
@Trowski well if you don't need the formatting ... (vs)printf isn't fast ...
 
I assumed so, yeah.
No use making generating backtraces any slower.
 
They should have control over their own instances. That is one of the fundamental principles behind encapsulation.
 
the protection I want is that if I typo "$foo->somehting" instead of "$foo->something", it's an error rather than dynamic behaviour
and that's a call-site error, not a definition one
 
6:45 PM
So basically we want both. The library needs "I manage myself, keep off" and the call site needs "Prevent me from screwing this up"
 
I can't think of any reason the library should care
if it uses dynamic properties itself, it couldn't be declared as "locked"
and if it doesn't, it won't notice that they're there
declaring on the class is easier - even I was able to write the patch for it - but I think the arguments for doing it at call-site are valid
 
as a library author, i care, i want "$foo->somehting" instead of "$foo->something" to always throw, so people know they screwed up, and it's not the library's fault it's returning null, or setting the value doesn't change the behavior.
 
@SaifEddinGmati that's not your problem
if I use your library wrong, I'm an idiot
 
```
$foo = something();
$foo->cnofiguration = ...;

$foo->doSomething(); // huh? not working? better complain to the author that their library is bugged!
```
^ i can simply prevent this if i have control over my own objects, which currently i can have by throwing an exception when using __get or __set.
 
It all goes back to defaults. If the default was no dynamic properties, this would be a non-issue. The 1 out of every 500 new classes that wants it would declare it separately and job done.
 
6:50 PM
you can also prevent it by designing your library better to not rely on property assignments
 
@SaifEddinGmati Same with the array cast :)
 
or you can tell users they're idiots
 
I am of course talking about modern written code, not stuff from 5.4
 
@MarkR you still need to decide if the opt-out is at call-site or declare-site, though
one of the use cases pointed out in the discussion was debug functions attaching a property to detect reference loops
 
@IMSoP Two different concerns IMO. Both are valid but require two different solutions.
 
6:52 PM
@Girgias I'm used to (array) $scalar; and it makes more sense to have key 0, but where does scalar property name come from? 3v4l.org/ZZmFn
 
@SaifEddinGmati That I couldn't tell you
 
@MarkR well, which is it, a non-issue or two issues? :P
mostly kidding
but regards "modern", I work every day with code dating to PHP 4; you can't just assume everything will get re-written every few years
 
@IMSoP and honestly, I'd probably use both, although I can see issues with the interaction of class instances which expect dynamic properties and wanting to prevent typos
 
@LeviMorrison @MarkR Which of you was it that suggested adding some more example equivalents to the partial RFC? Have any suggestions of examples beyond the volume(x, y, z) example from the tests?
 
Do i have to send an email to internals to be granted karma for RFC?
 
7:05 PM
@MarkR yeah, that's where call-site-only shines: Marco can have his weird lazy-loaded properties, but if I make a typo accessing them, I still get an error :)
I think that's much more powerful than "library author thinks you should write code this way"
where does it end? functions that you can't call if you use tabs instead of spaces? ;)
 
We're not talking about style, we're talking about editing the properties of a class >.>
The basic idea that a class is responsible for defining its data and behaviour
 
@IMSoP Don't summon Marco!
 
@Crell DIY pipe? pipe("foo", tolowercase(?), ucwords(?), substr(?, 0, 30))
 
I already reference the real pipe operator, which is my next step after this. :-)
 
I haven't looked at the RFC yet but does this support methods?
 
7:10 PM
Yes.
 
^ exactly!

for example, symfony security tokens are serialized into session, if user does $token->foo = $resource somewhere, they would be stuck figuring out why you are losing session every time, but the framework in this case can protect the user from making such mistakes by simply disallowing dynamic properties.
 
oh $this->sweeet(?)
 
(I guess it was Levi that suggested the table then... :-) )
@MarkR Yup. :-)
 
$this->sweeet(?): as
 
`$s = $candy->sweet(?)`
is equivalent to
`$s = fn($x) => $candy->sweet($x)`

But it also promotes all the types.
 
7:12 PM
Good, I use that pattern a bunch
How was midwest php by the way Crell?
 
Pretty good. Not quite over.
 
is function filter_nulls = array_filter(?, fn($v) => $v !== null); ( i.e: declare non-anonymous partial functions ) a future scope?
 
Not as such. But I have an RFC for short-functions that lets you do:

`function filter_nulls($list): iterable => array_filter($list, fn($v) => $v !== null);`
Basically everyone on Twitter and Reddit loves it, but internals is more skeptical.
 
i updated my example, it's even shorter :p
 
There's no plans for named functions with auto-typing like that, no.
 
7:25 PM
Oh FFS, I found a variance case for my pure intersection type PR which fails
(well more exactly it works when it should fail)
 
Task succeeded unsuccessfully ?
 
@SaifEddinGmati that would give a big fat error when it failed to serialize, though; if the user doesn't see that error, they're not going to see the "assigning dynamic property" error either
@MarkR no, we're talking about editing things which explicitly aren't properties of the class, and are therefore, arguably, none of the class's business
 
@IMSoP I'm going to superglue a third arm to you... on your face. Don't worry, it's not one of your limbs, none of your business really ^.^
 
not equivalent; the class literally won't ever see the extra property
if it does, it's doing something with dynamic properties, and couldn't use strict behaviour at the definition anyway
it's more like "I'm going to use Google Glass to super-impose a third limb whenever I look at you"
 
Yet that third limb shows up whenever someone takes a picture of you (serializes) . Or if you look in the mirror.
 
7:37 PM
yes, like I say "doing some weird reflection on itself"
I'm sure there are bonkers edge cases both ways around
 
Ask Marco, he's the master of using bonkers edge cases to accomplish useful things.
 
sure, and call-site opt-in / opt-out suits that absolutely perfectly
you could even have one specific method on the class that toggles the flag while it messes with things
 
I missed the start of this conversation, but it doesn't matter, you just suggested a magic method, so I feel like I made it for the end ...
 
I'm not disagreeing that call site declarations would be a handy tool to have. With the exception of it being file based, so you couldn't use its protection for other things alongside those that require dynamic properties
 
@JoeWatkins heh, no, I just meant as a library author you could have some place in the library where you use declare(dynamic_properties=on) { .... } or whatever
rather than having to leave your classes open for everyone
 
7:41 PM
it's a shame andrea is not here to tell us all the story about the time she introduced a declare flag, and then spent several years regretting that she used a declare flag ...
 
So we should do define(dynamic_properties=on)? Got it!~
 
You mean strict types or something else?
 
please let's not declare things, let's keep the type system within the type system, where the types are ...
 
@MarkR yeah, and maybe there's cases like serialization where the class author would want the control; I just don't like the "as a library author, I should be able to control my users because I don't trust them" argument
and people 100% make that argument about strict_types
 
We wouldn't be having this argument if dynamic properties were opt-in from the get go :-) no-one would even consider adding arbitrary properties to other classes that didn't expose __set
 
7:44 PM
I think @PeeHaa has a time machine, you can just jump in it and .... oh ...
 
Let's add declare(platform=8.1) and change the default behaviour \o/
 
I mean it just is never going to happen, not in a million years ...
 
the declare, or the default?
 
I'm not saying some sort of editions, but there will never be an edition of the kind that totally breaks software like doctrine, or even wordpress ...
 
I believe the intent was for editions (if they ever happened to become a thing) to be per-file, as the alternative was fine grained declares, themselves per-file
 
7:49 PM
Jul 9 '18 at 19:13, by Andrea
declare(i_opened_pandoras_box_by_suggesting_declare_strict_types="please don't suggest any new declare()s im really sorry")
I think that explains it the best
 
look at that ... study it ...
 
Tiffany with the archival-fu... :-)
 
@JoeWatkins I've got a whole "meta" RFC on why strict_type are bad :p
 
@Crell it's all about knowing what patterns to search and how :P
 
I'd love to learn that fu ngl
 
7:50 PM
The year is 2025... Girgias is making his 700th commit, still trying to make non-strict types better.
 
@MarkR if it's not a default, it's not a default, if you can't rely on this behaviour it's not worth anything as an opt-in is it ?
 
@JoeWatkins I believe an edition would compile error if the version of PHP running it didn't have support for the edition.
 
@MarkR If I take until 2025 to make another 250 commits I don't what happenned lol
 
I was going to say, it would be closer to maybe 1000 or 1500 commits rather than 700
maybe 2500 or 3000
 
And sure in a perfect world, strict types would probably be great, but I don't think type juggling at its core is terrible, it just need to be constrained to certain occasions
@Tiffany Wow wow wow calm down, Nikita doesn't even have 5k and his been at it for ages
 
7:54 PM
XD
Is 3 o'clock in the afternoon too late for a cup of tea...
 
It is always tea o'clock.
 
it's never too late for tea
 
I suppose it's Friday, what's it matter if I fall asleep at 1 AM
 
That's what rooibos tea is for. (Caffeine free.)
 
you mean to say a cup of tea at 3pm will keep you up until 1 in the morning ?
are you putting sugar in it, or cocaine ?
 
7:59 PM
Maybe got those mixed up, who knows
 
I'm really sensitive to caffeine I think. The past few times I've drank tea after like 2-4 PM, I have trouble falling asleep before midnight.
 
ask him if he be crawling through them walls since 3PM
lol
 
06:00 - 20:0020:00 - 22:00

« first day (3842 days earlier)      last day (1089 days later) »