« first day (3517 days earlier)      last day (1647 days later) » 
00:00 - 18:0018:00 - 00:00

18:00
To be fair, I've not worked in a language that includes ?-> (or equivalent), so I cannot say with confidence how useful it would be. My point is that I am concerned it would lead down a dead end that makes building something more robust in the future more difficult.
@Crell How should Either in combination with ?-> work in your opinion?
My current best idea (which does not make it the best idea, just what I have so far) is that ?-> short circuits on "instanceof Failure" rather than "is_null". Same basic fallthrough logic but with a more robust type, so that functions/methods can return subclasses of Failure that have meaning in their domain model.
But why can't we make ?-> short circuit both of those?
Because if you DO care what the result is, it makes checking the result more complicated as you always have to check for both.
@Crell or just don't use that feature.
18:09
not really, it's only more complicated if you don't know if it's an Either or Maybe
But when would that be the case?
Otherwise you can check for null or Result::error (or whatever)
I suppose that depends if you wrote all the functions/methods in the chain.
@Crell Ah I think I get what you mean now. So if you have $foo?->maybe()?->either() you won't know where it stops.
Right.
@Crell I suppose that's true.
18:12
And if it stops at the either(), and you check for is_null($result), then Failure is not null so you'll end up on the success path when you shouldn't. (And vice versa, since null is not an instanceof Failure.)
25 mins ago, by Danack
@Crell I'm pretty sure that one of the things I don't like about functional programming, is trying to pretend the error cases don't exist by wrapping them in more and more code. In this case, if some api call isn't returning the data you are hoping for, pushing handling that error to another place doesn't seem better to be.
I feel like there ought to be a more elegant solution to this space, I just don't know what at the moment.
@Danack I don't get what point you're making there, frankly. The "push the error to elsewhere" behavior is what exceptions do, not what monadic error handling does. That's why I mentioned exceptions.
I will write a blog post eventually on it.
"You have to deal with it here or explicitly defer it" is, like, one of the benefits of monads I listed in my book.
I think I can only top that by making a stone plaque and engraving my thoughts on it...
18:22
@Crell Do you have a link to the book?
Hello anyone here have an experience with yii rest api plz i need help
From our room's topic:
> Don't ask to ask, just ask.
@Crell Thinking about it, you could have a similar issue with just multiple Eithers. $foo?->bar()?->baz()
In that case at least you know the result would be an instanceof Failure. So it's at least on par with Exceptions in terms of expressiveness.
If is bar(): Either<A, B> and baz(): Either<C, D> the result of the expression would be B|C|D.
Or C|D wrapped in a failure probably
18:29
I guess that depends if you're using the Either as a wrapper or a value in itself. I... don't 100% know how legit it is to have the error wrapper be itself the error, but that's what I showed in the book at least. It's possible it's not still a Proper Monad at that point. I'd have to verify somehow.
@Crell Either way, I think ?-> for Maybe would be more useful/common than ?-> for Either. If you have something that returns an error it makes sense to deal with it right away. But as mentioned null should mean error IMO.
@Crell it means you don't have the data. There are many times when that's not an error, it's just optional/nullable data.
Sometimes, yes. Although I still hold that such cases should be made more explicit. That's hard to do without Generics, though; Union types make it a bit easier but very disjoint.
@Danack That's why I like Rusts naming, Option::{Some, None} and Result::{Ok, Error}
*actually Err, which is a little silly
Right. Rust avoids nulls entirely by giving you Option::{Some, None} instead.
@IluTov Feel free to pick up a copy of the book. :-) It may make my various ramblings make more sense.
(If not, I didn't do a good job with it.)
18:38
@Crell A proper option type would be better but I'm not sure it's worth it to further fragment the PHP API.
More than it already is, you mean... ;-)
(Any function that returns false for error is bad and should feel bad.)
Haha that's why I edited the comment and added the word further :D
C++ is moving towards std::expected. It's like an either but it expects one of the options as the happy path. You can do basic bool tests if you like branching locally, or you can just unwrap it if you'd prefer it to throw. One type supports both error patterns, so the hope is APIs can standardize on this without having much of an opinion on the error handling model.
Option would be great for things like function first(): Option<T> if T is an Option itself but oh well.
It would have made PSR-6 much cleaner, too.
But we really can't have full option monad support without generics, and we all know how that's working out.
18:41
@Crell You can help a bit with that :) A lot of them have been axed by introducing ValueError throwing :)
Eh?
Doesn't work for all functions
@Crell I have a very bad track record when it comes to reading the books I've bought :D But at least the money would go to somebody I know ^^
I'll settle for that. :-D
But functions which returned false on error due to bad initial values usually throw ValueError in PHP 8.0, still need to go back through some of the extensions to further clean-up but yeah some function will have a "cleaner" return type
18:44
We're changing functions to throw errors instead of return false? That seems like a not-small API change.
Not for all functions, strpos still returns fase
19:10
@Danack I'll announce the RFC with one of the "meh" examples later tonight if that's alright with you. I'll keep looking for better ones.
pickup the PR neo
What's the schedule for match()? That should go to a vote soon-ish, yes?
@Crell I'll wait for at least another 2 weeks (but I'll send a reminder on Saturday).
OK.
I really need to get time to finish partials so that I can get both it and compose to a vote before deadline. :-/ If I can't I'll just put compose out on its own and see what happens.
@IluTov erm. I think I opened a PR. but I can't see it....
19:18
@Danack I received and merged 2
@IluTov I opened one an hour ago. but it seems to have vanished, and github isn't showing me the normal 'create pull request' button for: github.com/Danack/nullsafe-operator-rfc/commit/…
@Danack Hm, never got that one. But I'll make sure to merge it before I send it out :)
I think maybe having the source md file only in a PR and not in the repo has confused either github, or me, or both.
@Danack branches?
I used the online editor, but edited it from IluTov's repo. That has resulted in a change in my repo, but as that branch has already been merged, the normal open pull request button hasn't appeared.
19:28
Can you rebase the branch onto your master, then open PR?
Granted, that requires cloning locally...
yeah...or can just let IluTov sort that problem out....
@Danack I can merge your branch, no problem :)
 
1 hour later…
20:56
Minor Service Outage ・ Notifications has Partial Outage
Incident on 2020-06-02 21:00 UTC ・ Notifications has Partial Outage
21:36
All issues have been resolved!
leave it a day or two, and then add something like "I can see people are commenting that the model is badly designed but none of these null conditions are errors. The session may not have been started for the page. The user may not be logged in. The user may have started using our service through a login where we don't have an address for them. Or they may have chosen to not provide a country for their address."
maybe.
@IluTov to be fair, I certainly avoid modelling my data to be like that by accident....but some of the time it's the right model.
Also, reddit is full of dumb people.
@Danack Also, sometimes you just have to work with crappy code bases. If there are tools that can help you with that that's a win in my book.
@Danack That's why I like it there, amongst my kind :P
to be fair, I know I'm also dumb a lot of the time. the only thing that happens here that is useful is that people can disagree and not always try to beat the other side up to 'win' an argument.
22:06
@IluTov so maybe change the user->address->country into getUser()->getAddress()->country ?
@IluTov Want to chat about it on the phpinternals news podcast?
I drafted an RFC to use @@ for the attribute syntax in PHP 8. Any thoughts before I publish it? gist.github.com/theodorejb/071fa8790dec4b0de51f9b016688feb4
22:21
> It also improves code readability by standing out better and making it easier to tell at a glance where attributes are used as opposed to shift tokens or generics.
those are opinions not universally shared. Some people say that the angle brackets are too bold, and now at the same time they don't stand out enough.
Also, something about respecting the opinion of the people who spent time working on the feature.
@Danack Hmm, maybe I can reword this. By "standing out better" I just mean it looks more distinct from shift tokens and generics.
@Danack I definitely want to be respectful. @beberlei suggested that I create an RFC if I feel strongly about the syntax, and I know there are others who feel similarly. I'm not sure if it's a majority, though.
Tbf I think <<Attribute>> stands out more than @@
ThW
ThW
I don't think the conflict with the shift syntax is a good argument. 1. not really that much used 2. syntaxhighlighting
@ThW Fair enough. It's definitely a minor issue at best.
ThW
ThW
However I like the @@ syntax, compared to <<>>
22:35
@Danack This. beberlei spent a lot of time implementing this, overriding his RFC without first discussing it with him seems disrespectful.
ThW
ThW
I would name it something like "alternative" not "better"
@Derick I'll let Danack do it xD
@ThW That's a good idea
ThW
ThW
or "Shorter"
@ThW Still, talk to @beberlei first. Mabye he's cool with it. Maybe not. Going behind his back doesn't seem like the right thing to do.
22:38
He did tell him to make an RFC if he feels strongly about it on the list
@Girgias Oh, then I withdraw my statement ^^
@Danack I already changed into $user?->getAddress()?->country
ThW
ThW
@IluTov Talking to @beberlei for this is a must, because of the work he has done and knowledge he now has.
and it is not that talking to him is difficult :-)
@ThW Agreed. I did tag him in one of my above messages. Maybe I should email him about it, though?
@ThW I renamed the draft now, and removed the "standing out better" phrase.
ThW
ThW
Did you you change the title? Is see the changed filename, but the title is still the same
@ThW Oops, fixed
ThW
ThW
22:57
And yeah, I would drop him a note and ask for his opinion.
Okay. I appreciate all the feedback!
ThW
ThW
My latest use for attributes (well doc comment tags) was connecting SCSS files to Zeplin (designer tool)
00:00 - 18:0018:00 - 00:00

« first day (3517 days earlier)      last day (1647 days later) »