« first day (4430 days earlier)      last day (512 days later) » 

1:42 AM
@cmb (or others) small nudge about the callables doc amendment PR for PHP Internals Book
 
 
8 hours later…
9:23 AM
I have form with add /edit employees in the form of list. I have add/edit form at app.js file which is included at the end. For add I just opened blank form popup and for edit I create html in run-time. So problem is app.js code correctly for add and not for edit form. I am assuming it is because I created that form once I click on edit button but how can I make this workable? Any idea?
 
9:36 AM
@Crell How does it break BC? It's already like this (if you discount readonly).
 
 
1 hour later…
10:51 AM
@Crell I don't think it's parsed as a function. Someone suggested "new" keyword plus () evaluating an expression.
In any case, it's good news for my polyglot code, since I can now do a new() C macro. ^^
 
11:14 AM
@Exception Check what URL are you at and conditionally use appropriate JS function.
 
cmb
11:31 AM
@OlleHärstedt yep; you can also use Point::class
 
12:07 PM
@cmb hm k.
 
12:48 PM
Which operator executes both side of condition not matter what?
I tried: null | new \stdClass() but got:
Unsupported operand types: stdClass | null
 
1:47 PM
o/
 
2:04 PM
o/
 
2:42 PM
@cmb Apologies for adding extraneous letters to your name in my ML post... I was deliberately spelling it out to counter Paul's shortening but I went overboard :-).
 
cmb
@Derick That's absolutely no problem (in fact, I don't mind Chris either). :)
 
OK. Although, I think there are also other issues with Paul's style of communication...
 
cmb
yep
 
@Derick for the record....I am trying to organise having a beer with someone who knows him because of other things....
 
@Derick Because we're not discounting readonly, because we do want to merge it with readonly later. So readonly's behavior is relevant.
 
3:04 PM
@Derick To clarify: This does continue to happen when the property visibility (not just set-visibility) is not met. In the case of readonly, set-visibility does not influence whether __set is called.
 
@IluTov I am having to do a deep dive, because I don't want to talk out of my arse ;-)
 
@Derick That's reasonable, the behavior is confusing and non-intuitive in multiple corners. Currently, behavior is relatively consistent though. When the property is invisible to the caller (e.g. the property is private but you're calling outside the class) it acts as if it weren't here at all. unset kind of mimics that, as if the property were deleted. A-vis is not like that, it's a restriction, so IMO the user should be informed that they're trying to modify when they shouldn't.
 
I don't think I agree with that.
 
From not thinking too much about this and from a userland developer perspective I would agree with Derick's disagreement.
I'm not sure if I've ever written a __set(), though.
 
@Derick I do think it would be weird for assignment to behave differently inside and outside the class.
@TimWolla Your criticism to support iterators is fair. Unfortunately that also makes the naming a bit less clear. (does Assoc/List refer to the return value or parameter?) I'm not sure what to do with the namespace comment. We've tried bigger efforts of aliasing functions that have failed, and adding an entirely new standard library at once is not realistic.
 
3:24 PM
@IluTov Basically my whole email can be boiled down to "I believe the proposal I've linked to would do it better in every metric possible and it should be included as part of that proposal".
A well-written iterable API is something that would be a real value-add to the standard library. It should be sufficiently large to include all important operations from the start (“no single-function namespace”), but may be extended in the future if the need arises.
I'm also not convinced we need to differentiate between List\unique and Assoc\unique, as to my understanding List\unique(...) === array_values(Assoc\unique(...)).
And then with the other RFC proposal one would have iterable\drop_keys(iterable\unique($arrayOrGeneratorOrWhateverYourHeartDesires)).
 
@TimWolla Wrapping in array_values also means building 2 arrays just to discard one. It may not be a big deal for one case but if there's no alternative that's pretty wasteful.
 
This is not something users should need to concern themselves with. The heavy lifting should be done by the engine (or optimizer). This might or might not be easily possible (as of now), but I strongly don't think that performance should influence API design.
Adding onto the API later-on if there is a clear value-add is always possible, e.g. JavaScript has Array.flatMap(…) as an optimization for Array.map(…).flat(), but the initial design should be simple building blocks that users can combine – similarly to the Unix tools.
 
3:57 PM
Remember the good old days when I used to ask stupid PHP questions instead of whining about MS Access sucking the joy out of my life? Good times!
 
4:10 PM
Friday room o/
 
@TimWolla Still, always preserving keys is not good api design. Of course, the root issue is that we don't have separate data types to begin with but that's a much harder problem to fix.
 
@PeeHaa \o/
 
@StatikStasis o/ \o/
 
@IluTov I was confused at first, because I didn't see the problem,if the user passes a list, then there are no keys to begin with, if an assoc array is passed, then the user will likely want to preserve their keys.
… but as values will be dropped, it will poke holes into the array.
 
4:26 PM
@TimWolla Yeah, one common issue I've seen is filtering a list with array_filter and then doing json_encode, resulting in a JSON object instead of an array, due to the keys not being continuous.
 
Perhaps the correct solution would then be that the function by default heuristically does what the user (i.e. me) expected it to do: If the input is a list in the first place it will automatically be renumbered, if not, then keys would be preserved. As it's a new function it should not need to cater to old code that much and in new code the distinction between lists and assoc arrays are reasonably well-defined.
Anyway, my main concern is the "bigger picture" I've mentioned: I don't find it useful to piecemeal deliver new functions if they deviate from existing "patterns" (in this case they deviate by introducing a namespace), because that effectively locks in future choices somewhat.
 
@TimWolla For this particular case, that could still lead to confusion if the keys happen to be continuous, like if they were class constants used for array keys, which is not uncommon. Another problem is that we would need to know if an array is a list without looping over it, which by looking at zend_array_is_list doesn't seem to be the case.
 
4:46 PM
FWIW, I'd also favor a more robust suite of array-or-iterable functions that compose nicely. If some of those include "and guarantee the result is a list by discarding keys if appropriate", I'm cool with that.
I think that would dovetail better with a future in which pipes and some form of PFA exist. :-)
 
5:17 PM
@Crell can you explain why the weird __set behaviour can’t just be tied explicitly to the readonly keyword and let regular avis properties act in a more intuitive manner? Why do they need to have exactly the same behaviour on that front?
 
5:30 PM
@IluTov why is asymmetric visibility “not like [visibility]”?
@IluTov assignment on regular private or protected properties with a __set already behaves differently inside or outside the class - my entire point in this is that it would be weird to not to have that capability that has existed since… 5.0(?) in properties that just want to drop the boilerplate __get method but keep the custom setter for external writes/sets.
 
@Stephen There's likely no absolute right or wrong here, but this is how I see it: When a property is private, assigning from the outside acts as if this property didn't exist at all. That makes sense, as there is no way to interact with that property. When the property is read-accessible, it's clear that you're trying to write to that property, which is a mistake as you don't have the access to do so. For me, an error is more intuitive here.
@Stephen That isn't true though, if you have a property declared there's no way to make it go through __get or __set, unless making the property private, but then you'd still need to declare both __get and __set.
@Stephen I'm not sure which response you're referencing. Diverging from readonly behavior is technically possible of course.
 
5:50 PM
@IluTov I still disagree. The __set() handler should be picked there, so that additional logic can be used. An error message does not benefit anything, whereas calling __set() allows for other possibilities.
 
this just seems like you’re using semantics to defend a weird view frankly. Using __get and __set to provide a property with the same essential behaviour as property accessors would allow is ridiculously common.

I don’t think it’s a stretch to say that if i make a private property accessible via __set I’m expecting people to write to it, and go through my custom logic
@IluTov huh? What “isn’t true”?
 
@Stephen Because we want to bring back aviz/readonly integration in the future, and setting ourselves up to make that harder doesn't seem wise.
 
@Crell that doesn’t answer my question. If you want to allow the combo, why can’t the readonly aspect impose the __set limitation, where there was an actual case made for why the limitation exists
Protected: calls __set
public protected(set): calls __set
anythint readonly: doesn’t call __set
Sorry for typos I’m on my phone
 
Except anything readonly does call __set today, iff the property has been explicitly unset(). (Whether this is logical or not is a separate question.)
 
*sigh*
Ok add
any property when unset: calls __set
Can you please explain why the limitation can’t be tied to readonly as it is now
 
5:58 PM
So you're suggesting binding the "__set is only called if it's been unset" to the "writeonce" part of readonly, not to the "private(set)" part? (Because readonly is really a shorthand for "writeonce private(set)", which IMO is dumb but that's another matter.)
 
Well what I’m actually saying is bind it to the use of the readonly keyword because that is what the developer uses, but if you want to use the term writeonce in place I guess that has the same effect
Wow that’s some typo
 
trying to set a readonly property from outside the class should also trigger __set() IMO, of course, it will fail when doing so, but if it doesn't do that, it is currently a bug.
 
readonly == "private(set) writeonce". That is its behavior. That's why I'm trying to be very specific about what aspect of it we're talking about, because it by nature overlaps with aviz. That's what the whole email thread was about. :-)
 
@Derick thats the whole thing with the limitation - I can actually see a scenario where WeirdShit(tm) happens in that scenario - because some __set methods will modify other stuff in the class expecting the later $this->foo = $value to succeed.
 
"Most problems in programming come from trying to make one thing do more than one thing." -- Basically why we're having this conversation.
 
6:03 PM
I believe that’s the sort of “edge cases” Nikita refers to in his readonly rfc.
 
In any case, the current RFCs behaviour with how __set is called is broken, and I won't be voting for it in this way.
__set() should always be called if the visibility rules (for set) don't allow the property to be seen
 
@Derick Which part, given that at this point I'm confused as to which exact piece people are talking about, and whether they're actually talking about how readonly works?
 
It's called visibility for a reason.
 
So you're saying readonly is already broken, by that definition, because __set is only called sometimes.
 
@Crell I am not talking about readonly, I am talking about async visibility. Stop conflating that.
 
6:04 PM
@Derick I agreed with a recent mail that it should be called write-access instead of visibility for this reason :D
 
@Crell and yes, I do say that. I even spelled that out a few lines ago.
 
readonly implies private(set). It is impossible to not acknowledge that when discussing aviz, because there is already prior art.
We can't just ignore that.
 
Right, if readonly implies private(set), then __set should be called in other scopes. If it doesn't, that is a bug.
 
@Crell if you want to say the weird/broken __set behaviour is tied to the concept of “write once” I wouldn’t argue. I wouldn’t use that term because it’s never shown as that in Userland but I understand your meaning.
 
Well, then 8.1/2 has a bug, but I don't know if it's safe to change. :-)
 
6:06 PM
I find your use of smiles and weird quotes off putting. It's not helpful.
 
@Stephen The ideal would be if readonly meant that and only that, but that shi has, sadly, sailed.
 
JRL
@Derick Wouldn't "being seen" be the read visibility though, and not the set visibility?
 
@IluTov we’re a long way down this discussion for one of the authors to say think they’re using the wrong term
 
@JRL When setting, no...
 
I am trying to keep the conversation cordial. (And the quote is from... I forget which famous computer scientist. But I'm observing that the double-effect of readonly is the reason we're having this conversation.)
 
6:08 PM
Because readonly got it wrong, doesn't mean async visibility should get it wrong too. It's a feature that doesn't require "readonly" to exist, and it's an extension of the "normal" public/protected/private declarations.
 
@Derick Would you support changing the behavior of readonly in a future RFC such that __set is triggered for uninitialized as well as unset() values? Even though that's technically a behavior change/BC break?
 
@Crell I have said many times now that __set should be called regardless, when a property is being set from outside of a scope that allows the property to be set.
 
Ok, using whatever terminology you want to use, why can’t the existing - acknowledged as weird and arguably broken - behaviour of __set with readonly be limited to properties that are marked as readonly (or in a class marked as such)
 
(I'm not proposing to write that RFC right now, just getting a lay of the land.)
 
That doesnt preclude using readonly and avis together - it just means it gets the existing behaviour of readonly and makes it eg public protected(set) not public privste(set)
 
6:10 PM
if readonly indicates private(set) implicitly, then outside of that defining class's scope, __set should be called. If it is called inside the class scope, then I believe only when it has been unset(), as I think that's now normal userland classes behave with regards to properties.
 
Do classes call __set for non-readonly explicitly unset private properties now?
 
I don't know that, but async vis should emulate that behaviour.
 
JRL
wait, im sorry to distract, but is what you are all referencing saying that if you unset() a readonly prop, you are actually then allowed to write to that property once?
 
@JRL no. Well my original request/question isn’t no.
I’ve never asked about the unset behaviour. I didn’t even know that behaviour exists. I just want __set to be called when the property’s set visibility is unmatched.
 
JRL
6:14 PM
yes, i followed what you were talking about @Stephen, i was more interested in this unset() behavior
 
@Crell The answer is "yes": 3v4l.org/DuIKb
 
@Crell from outside the class I don’t see why they wouldn’t
 
Yeah, just discovered that myself. Huh.
 
JRL
this is a pretty interesting edge case
 
Does that mean the descriptive logic in the RFC right now is still not technically correct/complete?
 
6:19 PM
@Crell you mean the list of examples that will/won’t call __set?
 
The decision tree bulleted list.
 
I'm going to have to go. It's Friday night dinner time.
 
Enjoy!
 
JRL
okay, so it appears that if you call unset() on a readonly prop that is uninitialized, it works fine and it calls __set()
but, if you call unset() on a readonly prop that has been set, it errors
 
I need to go too, because it’s 1am and I have concrete to pour tomorrow…
 
JRL
6:21 PM
 
There are times I hate PHP. :-)
 
@Crell I hope this discussion clarified what im asking about, and I really hope you’ll reconsider your position on it.
Have a good weekend everyone
 
JRL
wow, that's an annoying array of behaviors
 
@Stephen To clarify my position (though I don't want to speak for Ilija on this one):

* I do not want to introduce any BC breaks, now or in the future.
* I want to be able to combine readonly and aviz in the future in a logical way.
* The logic for what happens when should be as simple as possible.

This being PHP, points 1 and 3 are frequently mutually incompatible, and this is why we cannot have nice things. :-)
 
6:25 PM
Unsetting on properties has always been a horribad hack. I think the only reason it's still in there was because Ocramius uses it for his proxy layer
 
JRL
lol
 
@crell Right but if the weird broken behaviour is tied to the readonly keyword specifically (or the writeonce behaviour of you want to use the term) then what BC break is there?
 
JRL
has it actually been talked about before for removal?
 
@Stephen If we explicitly associate it with the writeonce part, then... I think we're safe?
 
@Crell shut up and take my money.
2
 
6:27 PM
(That's the strongest argument you've made so far in my eyes. :-) )
@Stephen lol
I'll have to think it through to see if I can think of any other implications/landmines. @IluTov?
 
Dude, let @Stephen got to sleep, he has to manual labor in the morning~
 
/me hands @Stephen his teddybear.
 
or perhaps labour
 
@Crell Sorry, can you summarize? You've lost me at some point in the conversation.
 
Such is this conversation... ;-)
 
cmb
6:31 PM
@MarkR Also Doctrine for public properties.
 
@Jimbus it’s not guaranteed to be “morning” by any means.
 
:)
 
cmb
It's always morning somewhere in the world.
 
YO
 
o/
 
6:35 PM
@cmb I’ll tell my neighbours that when they ask about using power tools at 10pm.
Night all.
 
JRL
RE: American English vs. British English, i do find it fascinating that a lot of the word differences I'm aware of are food related. Chips vs. Fries, Crisps vs. Chips, Biscuit vs. Cookie, Scone vs. Biscuit, Pudding vs. Dessert, Grill vs. Broil
What i find most fascinating about those sets of words is that they are the ones that british folks seem to get the most upset about me "getting wrong" (when that sort of thing comes up), and they are also the ones that I care least about "getting right" for a British person
I'll adjust "Sidewalk" to "Pavement" for a British person when we are talking, for instance.
But I never adjust my food words, even when I know them.
 
how about sports names?
 
JRL
like what?
 
footaball
 
JRL
eh, but soccer is also a british word
i dont really consider that one of those tbh
 
6:41 PM
\o
 
JRL
soccer is a word the british invented
american football used to be called "Rugby Football" in both Britain and America
the rules for British Rudgby and American Rugby diverged though
 
So, I think this is what we're talking about now?
 
JRL
the British shortened it to Rgby, the Americans shortened it to Football to avoid confusion since they were no longer the same game really
 
// When writing to a property on an object with __set:
If (property is NOT read-visible) {
  call __set
} else {
  if (property is set-visible) {
    assign property
  } else {
   if (property is readonly (aka writeonce)) {
    If (property is unset) {
      call __set
    } else {

      error
    }
  } else {
    call __set
  }
}
Oh screw you, SO formatting.
@IluTov @JRL (And Stephen and Derick when they get back tomorrow.)
 
The unset part is wrong. All properties call __set when unset, regardless whether they are readonly.
Also, the "property is set-visible" seems to have two else clauses ^^
 
6:51 PM
It's special...
(Hang on.)
// When writing to a property on an object with __set:
if (property is NOT read-visible) {
  call __set
} else {
  if (property is set-visible) {
    assign property
  } else {
    if (property is unset) {
      call __set
    } else {

      if (property is readonly) {
        error
      } else {
        call __set
      }
    }
  }
}
 
@Crell Yeah that looks right. Well, I don't really care about __set so I'm fine with this if other people are.
 
7:07 PM
@cmb @Girgias hey o/ can I help in any way on that 8.2 curl constants PR this weekend? :-)
 
8:00 PM
morning all
What do you normally do with a line having one method parameter which type is a long multi UNION type exceeding 110 chars? Split into one part of UNION type each line or how?
 
 
2 hours later…
9:47 PM
Question my life choices that led to me having such a long union.
 
9:59 PM
But when dealing with reflection, where that is the only option at times, I've just sucked it up and had a long line.
 
use ReflectionSomething as A;
(and then repeat for the other classes you need with different letters)
 
@Crell for quite a long minute here I understood that as a marriage joke
 
@FélixAdriyelGagnon-Grenier LOL. No, not quite. :-)
 
10:58 PM
Another week behind us all. Have a good weekend!
 

« first day (4430 days earlier)      last day (512 days later) »